For Multiprocess dpdk applications retrieving the offload parameter for receive packet directly from struct eth_dev giving segmentation fault since rxmode.offloads from eth_dev was null duirng recv_pkts. So retrieved offload from rx/tx_queue_setup()
Signed-off-by: Jesna K E <jesna....@amd.com> --- drivers/net/axgbe/axgbe_rxtx.c | 10 ++++------ drivers/net/axgbe/axgbe_rxtx.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index 9b283bd9d0..5dc4fe7369 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -86,6 +86,7 @@ int axgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, if (rxq->free_thresh > rxq->nb_desc) rxq->free_thresh = rxq->nb_desc >> 3; + rxq->offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads; /* Allocate RX ring hardware descriptors */ size = rxq->nb_desc * sizeof(union axgbe_rx_desc); dma = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx, size, 128, @@ -211,7 +212,6 @@ axgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, unsigned int err, etlt; uint32_t error_status; uint16_t idx, pidx, pkt_len; - uint64_t offloads; idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur); while (nb_rx < nb_pkts) { @@ -278,14 +278,13 @@ axgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, mbuf->hash.rss = rte_le_to_cpu_32(desc->write.desc1); etlt = AXGMAC_GET_BITS_LE(desc->write.desc3, RX_NORMAL_DESC3, ETLT); - offloads = rxq->pdata->eth_dev->data->dev_conf.rxmode.offloads; if (!err || !etlt) { if (etlt == RX_CVLAN_TAG_PRESENT) { mbuf->ol_flags |= RTE_MBUF_F_RX_VLAN; mbuf->vlan_tci = AXGMAC_GET_BITS_LE(desc->write.desc0, RX_NORMAL_DESC0, OVT); - if (offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) mbuf->ol_flags |= RTE_MBUF_F_RX_VLAN_STRIPPED; else mbuf->ol_flags &= ~RTE_MBUF_F_RX_VLAN_STRIPPED; @@ -345,7 +344,6 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue, unsigned int err = 0, etlt; uint32_t error_status = 0; uint16_t idx, pidx, data_len = 0, pkt_len = 0; - uint64_t offloads; bool eop = 0; idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur); @@ -441,14 +439,13 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue, rte_le_to_cpu_32(desc->write.desc1); etlt = AXGMAC_GET_BITS_LE(desc->write.desc3, RX_NORMAL_DESC3, ETLT); - offloads = rxq->pdata->eth_dev->data->dev_conf.rxmode.offloads; if (!err || !etlt) { if (etlt == RX_CVLAN_TAG_PRESENT) { first_seg->ol_flags |= RTE_MBUF_F_RX_VLAN; first_seg->vlan_tci = AXGMAC_GET_BITS_LE(desc->write.desc0, RX_NORMAL_DESC0, OVT); - if (offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) first_seg->ol_flags |= RTE_MBUF_F_RX_VLAN_STRIPPED; else @@ -606,6 +603,7 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, txq->desc = tz->addr; txq->queue_id = queue_idx; txq->port_id = dev->data->port_id; + txq->offloads = offloads; txq->dma_regs = (void *)((uint8_t *)pdata->xgmac_regs + DMA_CH_BASE + (DMA_CH_INC * txq->queue_id)); txq->dma_tail_reg = (volatile uint32_t *)((uint8_t *)txq->dma_regs + diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index a904939de3..3e38d321f2 100644 --- a/drivers/net/axgbe/axgbe_rxtx.h +++ b/drivers/net/axgbe/axgbe_rxtx.h @@ -100,7 +100,7 @@ struct axgbe_rx_queue { uint64_t rx_mbuf_alloc_failed; /* Number of mbufs allocated from pool*/ uint64_t mbuf_alloc; - + uint64_t offloads; /**< Rx offloads with RTE_ETH_RX_OFFLOAD_**/ } __rte_cache_aligned; /*Tx descriptor format */ @@ -149,7 +149,7 @@ struct axgbe_tx_queue { uint64_t pkts; uint64_t bytes; uint64_t errors; - + uint64_t offloads; /**< Tx offload flags of RTE_ETH_TX_OFFLOAD_* */ } __rte_cache_aligned; /*Queue related APIs */ -- 2.25.1