struct bnxt_rx_queue *rxq = (struct bnxt_rx_queue *)rx_queue;
struct bnxt_rx_ring_info *rxr;
struct bnxt_cp_ring_info *cpr;
- struct bnxt_sw_rx_bd *rx_buf;
+ struct rte_mbuf *rx_buf;
struct rx_pkt_cmpl *rxcmp;
uint32_t cons, cp_cons;
int rc;
if (CMPL_VALID(rxcmp, !cpr->valid))
return RTE_ETH_RX_DESC_DONE;
}
- rx_buf = &rxr->rx_buf_ring[cons];
- if (rx_buf->mbuf == NULL)
+ rx_buf = rxr->rx_buf_ring[cons];
+ if (rx_buf == NULL)
return RTE_ETH_RX_DESC_UNAVAIL;
uint16_t
bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
{
- struct bnxt_sw_rx_bd *prod_rx_buf;
+ struct rte_mbuf **prod_rx_buf;
struct bnxt_rx_ring_info *rep_rxr;
struct bnxt_rx_queue *rep_rxq;
struct rte_eth_dev *vfr_eth_dev;
mask = rep_rxr->rx_ring_struct->ring_mask;
/* Put this mbuf on the RxQ of the Representor */
- prod_rx_buf =
- &rep_rxr->rx_buf_ring[rep_rxr->rx_prod++ & mask];
- if (!prod_rx_buf->mbuf) {
- prod_rx_buf->mbuf = mbuf;
+ prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_prod++ & mask];
+ if (!*prod_rx_buf) {
+ *prod_rx_buf = mbuf;
vfr_bp->rx_bytes[que] += mbuf->pkt_len;
vfr_bp->rx_pkts[que]++;
} else {
uint16_t nb_pkts)
{
struct bnxt_rx_queue *rxq = rx_queue;
- struct bnxt_sw_rx_bd *cons_rx_buf;
+ struct rte_mbuf **cons_rx_buf;
struct bnxt_rx_ring_info *rxr;
uint16_t nb_rx_pkts = 0;
uint16_t mask, i;
mask = rxr->rx_ring_struct->ring_mask;
for (i = 0; i < nb_pkts; i++) {
cons_rx_buf = &rxr->rx_buf_ring[rxr->rx_cons & mask];
- if (!cons_rx_buf->mbuf)
+ if (*cons_rx_buf == NULL)
return nb_rx_pkts;
- rx_pkts[nb_rx_pkts] = cons_rx_buf->mbuf;
+ rx_pkts[nb_rx_pkts] = *cons_rx_buf;
rx_pkts[nb_rx_pkts]->port = rxq->port_id;
- cons_rx_buf->mbuf = NULL;
+ *cons_rx_buf = NULL;
nb_rx_pkts++;
rxr->rx_cons++;
}
struct bnxt *parent_bp = rep_bp->parent_dev->data->dev_private;
struct bnxt_rx_queue *parent_rxq;
struct bnxt_rx_queue *rxq;
- struct bnxt_sw_rx_bd *buf_ring;
+ struct rte_mbuf **buf_ring;
int rc = 0;
if (queue_idx >= BNXT_MAX_VF_REP_RINGS) {
goto out;
buf_ring = rte_zmalloc_socket("bnxt_rx_vfr_buf_ring",
- sizeof(struct bnxt_sw_rx_bd) *
+ sizeof(struct rte_mbuf *) *
rxq->rx_ring->rx_ring_struct->ring_size,
RTE_CACHE_LINE_SIZE, socket_id);
if (!buf_ring) {
rx_ring->vmem =
(void **)((char *)mz->addr + rx_vmem_start);
rx_ring_info->rx_buf_ring =
- (struct bnxt_sw_rx_bd *)rx_ring->vmem;
+ (struct rte_mbuf **)rx_ring->vmem;
}
rx_ring = rx_ring_info->ag_ring_struct;
rx_ring->vmem =
(void **)((char *)mz->addr + ag_vmem_start);
rx_ring_info->ag_buf_ring =
- (struct bnxt_sw_rx_bd *)rx_ring->vmem;
+ (struct rte_mbuf **)rx_ring->vmem;
}
rx_ring_info->ag_bitmap =
void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
{
- struct bnxt_sw_rx_bd *sw_ring;
+ struct rte_mbuf **sw_ring;
struct bnxt_tpa_info *tpa_info;
uint16_t i;
if (sw_ring) {
for (i = 0;
i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
- if (sw_ring[i].mbuf) {
- rte_pktmbuf_free_seg(sw_ring[i].mbuf);
- sw_ring[i].mbuf = NULL;
+ if (sw_ring[i]) {
+ rte_pktmbuf_free_seg(sw_ring[i]);
+ sw_ring[i] = NULL;
}
}
}
if (sw_ring) {
for (i = 0;
i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
- if (sw_ring[i].mbuf) {
- rte_pktmbuf_free_seg(sw_ring[i].mbuf);
- sw_ring[i].mbuf = NULL;
+ if (sw_ring[i]) {
+ rte_pktmbuf_free_seg(sw_ring[i]);
+ sw_ring[i] = NULL;
}
}
}
uint16_t prod)
{
struct rx_prod_pkt_bd *rxbd = &rxr->rx_desc_ring[prod];
- struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[prod];
+ struct rte_mbuf **rx_buf = &rxr->rx_buf_ring[prod];
struct rte_mbuf *mbuf;
mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
return -ENOMEM;
}
- rx_buf->mbuf = mbuf;
+ *rx_buf = mbuf;
mbuf->data_off = RTE_PKTMBUF_HEADROOM;
rxbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
uint16_t prod)
{
struct rx_prod_pkt_bd *rxbd = &rxr->ag_desc_ring[prod];
- struct bnxt_sw_rx_bd *rx_buf = &rxr->ag_buf_ring[prod];
+ struct rte_mbuf **rx_buf = &rxr->ag_buf_ring[prod];
struct rte_mbuf *mbuf;
if (rxbd == NULL) {
return -ENOMEM;
}
- rx_buf->mbuf = mbuf;
+ *rx_buf = mbuf;
mbuf->data_off = RTE_PKTMBUF_HEADROOM;
rxbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
struct rte_mbuf *mbuf)
{
uint16_t prod = RING_NEXT(rxr->rx_ring_struct, rxr->rx_prod);
- struct bnxt_sw_rx_bd *prod_rx_buf;
+ struct rte_mbuf **prod_rx_buf;
struct rx_prod_pkt_bd *prod_bd;
prod_rx_buf = &rxr->rx_buf_ring[prod];
- RTE_ASSERT(prod_rx_buf->mbuf == NULL);
+ RTE_ASSERT(*prod_rx_buf == NULL);
RTE_ASSERT(mbuf != NULL);
- prod_rx_buf->mbuf = mbuf;
+ *prod_rx_buf = mbuf;
prod_bd = &rxr->rx_desc_ring[prod];
struct rte_mbuf *bnxt_consume_rx_buf(struct bnxt_rx_ring_info *rxr,
uint16_t cons)
{
- struct bnxt_sw_rx_bd *cons_rx_buf;
+ struct rte_mbuf **cons_rx_buf;
struct rte_mbuf *mbuf;
cons_rx_buf = &rxr->rx_buf_ring[cons];
- RTE_ASSERT(cons_rx_buf->mbuf != NULL);
- mbuf = cons_rx_buf->mbuf;
- cons_rx_buf->mbuf = NULL;
+ RTE_ASSERT(*cons_rx_buf != NULL);
+ mbuf = *cons_rx_buf;
+ *cons_rx_buf = NULL;
+
return mbuf;
}
bool is_thor_tpa = tpa_info && BNXT_CHIP_THOR(rxq->bp);
for (i = 0; i < agg_buf; i++) {
- struct bnxt_sw_rx_bd *ag_buf;
+ struct rte_mbuf **ag_buf;
struct rte_mbuf *ag_mbuf;
if (is_thor_tpa) {
ag_cons = rxcmp->opaque;
RTE_ASSERT(ag_cons <= rxr->ag_ring_struct->ring_mask);
ag_buf = &rxr->ag_buf_ring[ag_cons];
- ag_mbuf = ag_buf->mbuf;
+ ag_mbuf = *ag_buf;
RTE_ASSERT(ag_mbuf != NULL);
ag_mbuf->data_len = rte_le_to_cpu_16(rxcmp->len);
last->next = ag_mbuf;
last = ag_mbuf;
- ag_buf->mbuf = NULL;
+ *ag_buf = NULL;
/*
* As aggregation buffer consumed out of order in TPA module,
for (; cnt;
i = RING_NEXT(rxr->rx_ring_struct, i), cnt--) {
- struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[i];
+ struct rte_mbuf **rx_buf = &rxr->rx_buf_ring[i];
/* Buffer already allocated for this index. */
- if (rx_buf->mbuf != NULL)
+ if (*rx_buf != NULL)
continue;
/* This slot is empty. Alloc buffer for Rx */
ring->ring_mask = ring->ring_size - 1;
ring->bd = (void *)rxr->rx_desc_ring;
ring->bd_dma = rxr->rx_desc_mapping;
- ring->vmem_size = ring->ring_size * sizeof(struct bnxt_sw_rx_bd);
+ ring->vmem_size = ring->ring_size * sizeof(struct rte_mbuf *);
ring->vmem = (void **)&rxr->rx_buf_ring;
ring->fw_ring_id = INVALID_HW_RING_ID;
ring->ring_mask = ring->ring_size - 1;
ring->bd = (void *)rxr->ag_desc_ring;
ring->bd_dma = rxr->ag_desc_mapping;
- ring->vmem_size = ring->ring_size * sizeof(struct bnxt_sw_rx_bd);
+ ring->vmem_size = ring->ring_size * sizeof(struct rte_mbuf *);
ring->vmem = (void **)&rxr->ag_buf_ring;
ring->fw_ring_id = INVALID_HW_RING_ID;
prod = rxr->rx_prod;
for (i = 0; i < ring->ring_size; i++) {
- if (unlikely(!rxr->rx_buf_ring[i].mbuf)) {
+ if (unlikely(!rxr->rx_buf_ring[i])) {
if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
PMD_DRV_LOG(WARNING,
"init'ed rx ring %d with %d/%d mbufs only\n",
prod = rxr->ag_prod;
for (i = 0; i < ring->ring_size; i++) {
- if (unlikely(!rxr->ag_buf_ring[i].mbuf)) {
+ if (unlikely(!rxr->ag_buf_ring[i])) {
if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
PMD_DRV_LOG(WARNING,
"init'ed AG ring %d with %d/%d mbufs only\n",
struct rx_tpa_v2_abuf_cmpl agg_arr[TPA_MAX_NUM_SEGS];
};
-struct bnxt_sw_rx_bd {
- struct rte_mbuf *mbuf; /* data associated with RX descriptor */
-};
-
struct bnxt_rx_ring_info {
uint16_t rx_prod;
uint16_t ag_prod;
struct rx_prod_pkt_bd *rx_desc_ring;
struct rx_prod_pkt_bd *ag_desc_ring;
- struct bnxt_sw_rx_bd *rx_buf_ring; /* sw ring */
- struct bnxt_sw_rx_bd *ag_buf_ring; /* sw ring */
+ struct rte_mbuf **rx_buf_ring; /* sw ring */
+ struct rte_mbuf **ag_buf_ring; /* sw ring */
rte_iova_t rx_desc_mapping;
rte_iova_t ag_desc_mapping;
bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr)
{
struct rx_prod_pkt_bd *rxbds = &rxr->rx_desc_ring[rxq->rxrearm_start];
- struct bnxt_sw_rx_bd *rx_bufs = &rxr->rx_buf_ring[rxq->rxrearm_start];
+ struct rte_mbuf **rx_bufs = &rxr->rx_buf_ring[rxq->rxrearm_start];
struct rte_mbuf *mb0, *mb1;
int i;
uint64x2_t buf_addr0, buf_addr1;
uint64x2_t rxbd0, rxbd1;
- mb0 = rx_bufs[0].mbuf;
- mb1 = rx_bufs[1].mbuf;
+ mb0 = rx_bufs[0];
+ mb1 = rx_bufs[1];
/* Load address fields from both mbufs */
buf_addr0 = vld1q_u64((uint64_t *)&mb0->buf_addr);
raw_cons = tmp_raw_cons;
cons = rxcmp->opaque;
- mbuf = rxr->rx_buf_ring[cons].mbuf;
+ mbuf = rxr->rx_buf_ring[cons];
rte_prefetch0(mbuf);
- rxr->rx_buf_ring[cons].mbuf = NULL;
+ rxr->rx_buf_ring[cons] = NULL;
/* Set constant fields from mbuf initializer. */
vst1q_u64((uint64_t *)&mbuf->rearm_data, mbuf_init);
bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr)
{
struct rx_prod_pkt_bd *rxbds = &rxr->rx_desc_ring[rxq->rxrearm_start];
- struct bnxt_sw_rx_bd *rx_bufs = &rxr->rx_buf_ring[rxq->rxrearm_start];
+ struct rte_mbuf **rx_bufs = &rxr->rx_buf_ring[rxq->rxrearm_start];
struct rte_mbuf *mb0, *mb1;
int i;
__m128i buf_addr0, buf_addr1;
__m128i rxbd0, rxbd1;
- mb0 = rx_bufs[0].mbuf;
- mb1 = rx_bufs[1].mbuf;
+ mb0 = rx_bufs[0];
+ mb1 = rx_bufs[1];
/* Load address fields from both mbufs */
buf_addr0 = _mm_loadu_si128((__m128i *)&mb0->buf_addr);
raw_cons = tmp_raw_cons;
cons = rxcmp->opaque;
- mbuf = rxr->rx_buf_ring[cons].mbuf;
+ mbuf = rxr->rx_buf_ring[cons];
rte_prefetch0(mbuf);
- rxr->rx_buf_ring[cons].mbuf = NULL;
+ rxr->rx_buf_ring[cons] = NULL;
/* Set constant fields from mbuf initializer. */
_mm_store_si128((__m128i *)&mbuf->rearm_data,