DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jesna K E <jesna.k.e@amd.com>
To: <dev@dpdk.org>
Cc: <Ferruh.Yigit@amd.com>, <Selwin.Sebastian@amd.com>,
	Jesna K E <jesna.k.e@amd.com>
Subject: [PATCH v2] net/axgbe: move offloads to Rx/Tx queue setup
Date: Thu, 19 Jan 2023 07:20:49 +0530	[thread overview]
Message-ID: <20230119015049.114687-1-jesna.k.e@amd.com> (raw)

For Multiprocess dpdk applications need to retrieve the offload parameter
from the Device data directly that is shared between
primary and secondary processes rather than accessing from
Port private data (pdata) since this is not shared
between primary and secondary process .

Signed-off-by: Jesna K E <jesna.k.e@amd.com>
---
 drivers/net/axgbe/axgbe_rxtx.c | 12 +++++-------
 drivers/net/axgbe/axgbe_rxtx.h |  4 ++--
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
index 9b283bd9d0..625a92109b 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
@@ -578,7 +575,7 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		return -ENOMEM;
 	txq->pdata = pdata;
 	offloads = tx_conf->offloads |
-		txq->pdata->eth_dev->data->dev_conf.txmode.offloads;
+		dev->data->dev_conf.txmode.offloads;
 	txq->nb_desc = tx_desc;
 	txq->free_thresh = tx_conf->tx_free_thresh ?
 		tx_conf->tx_free_thresh : AXGBE_TX_FREE_THRESH;
@@ -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 1dceb76606..a218bf0f47 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


             reply	other threads:[~2023-01-19  1:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  1:50 Jesna K E [this message]
2023-01-19  9:15 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230119015049.114687-1-jesna.k.e@amd.com \
    --to=jesna.k.e@amd.com \
    --cc=Ferruh.Yigit@amd.com \
    --cc=Selwin.Sebastian@amd.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).