DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mingxia Liu <mingxia.liu@intel.com>
To: dev@dpdk.org, beilei.xing@intel.com, yuying.zhang@intel.com
Cc: Mingxia Liu <mingxia.liu@intel.com>,
	Xiao Wang <xiao.w.wang@intel.com>,
	Junfeng Guo <junfeng.guo@intel.com>
Subject: [PATCH v2 5/5] net/cpfl: adjust RSS LUT to exclude hairpin queue
Date: Tue, 14 Feb 2023 11:38:52 +0000	[thread overview]
Message-ID: <20230214113852.3341607-6-mingxia.liu@intel.com> (raw)
In-Reply-To: <20230214113852.3341607-1-mingxia.liu@intel.com>

RSS should direct traffic only to the normal data Rx queues,
so when hairpin queue configured, RSS LUT should be adjusted
to exclude the hairpin queue.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
 drivers/net/cpfl/cpfl_ethdev.c | 38 ++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index f08b7beb13..014735b2b0 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -446,7 +446,8 @@ cpfl_init_rss(struct idpf_vport *vport)
 {
 	struct rte_eth_rss_conf *rss_conf;
 	struct rte_eth_dev_data *dev_data;
-	uint16_t i, nb_q;
+	struct cpfl_rx_queue *cpfl_rxq;
+	uint16_t i, nb_q, max_nb_data_q;
 	int ret = 0;
 
 	dev_data = vport->dev_data;
@@ -465,8 +466,16 @@ cpfl_init_rss(struct idpf_vport *vport)
 			   vport->rss_key_size);
 	}
 
+	/* RSS only to the data queues */
+	max_nb_data_q = nb_q;
+	if (nb_q > 1) {
+		cpfl_rxq = dev_data->rx_queues[nb_q - 1];
+		if (cpfl_rxq && cpfl_rxq->hairpin_info.hairpin_q)
+			max_nb_data_q = nb_q - 1;
+	}
+
 	for (i = 0; i < vport->rss_lut_size; i++)
-		vport->rss_lut[i] = i % nb_q;
+		vport->rss_lut[i] = i % max_nb_data_q;
 
 	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
 
@@ -673,8 +682,6 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	    (struct cpfl_vport *)dev->data->dev_private;
 	struct idpf_vport *vport = &(cpfl_vport->base);
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
-	struct idpf_adapter *adapter = vport->adapter;
-	int ret;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
 		PMD_INIT_LOG(ERR, "Setting link speed is not supported");
@@ -713,17 +720,6 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
-	if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
-		ret = cpfl_init_rss(vport);
-		if (ret != 0) {
-			PMD_INIT_LOG(ERR, "Failed to init rss");
-			return ret;
-		}
-	} else {
-		PMD_INIT_LOG(ERR, "RSS is not supported.");
-		return -1;
-	}
-
 	vport->max_pkt_len =
 		(dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
 		CPFL_ETH_OVERHEAD;
@@ -748,11 +744,23 @@ cpfl_start_queues(struct rte_eth_dev *dev)
 	struct cpfl_vport *cpfl_vport =
 	    (struct cpfl_vport *)dev->data->dev_private;
 	struct idpf_vport *vport = &(cpfl_vport->base);
+	struct idpf_adapter *adapter = vport->adapter;
 	struct cpfl_rx_queue *cpfl_rxq;
 	struct cpfl_tx_queue *cpfl_txq;
 	int err = 0;
 	int i;
 
+	if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		err = cpfl_init_rss(vport);
+		if (err != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init rss");
+			return err;
+		}
+	} else {
+		PMD_INIT_LOG(ERR, "RSS is not supported.");
+		return -1;
+	}
+
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		cpfl_txq = dev->data->tx_queues[i];
 		if (cpfl_txq == NULL || cpfl_txq->base.tx_deferred_start)
-- 
2.25.1


      parent reply	other threads:[~2023-02-14 12:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 13:06 [PATCH 0/1] add port to port feature for CPFL PMD Mingxia Liu
2023-01-18 13:06 ` [PATCH 1/1] net/cpfl: add port to port feature Mingxia Liu
2023-02-13  3:30   ` Xing, Beilei
2023-02-14 11:38 ` [PATCH v2 0/5] " Mingxia Liu
2023-02-14 11:38   ` [PATCH v2 1/5] net/cpfl: add some structure for hairpin queue Mingxia Liu
2023-02-14 11:38   ` [PATCH v2 2/5] net/cpfl: update device initialization " Mingxia Liu
2023-02-14 11:38   ` [PATCH v2 3/5] net/cpfl: add hairpin queue enable and setup Mingxia Liu
2023-02-14 11:38   ` [PATCH v2 4/5] net/cpfl: support hairpin queue start and stop Mingxia Liu
2023-02-14 11:38   ` Mingxia Liu [this message]

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=20230214113852.3341607-6-mingxia.liu@intel.com \
    --to=mingxia.liu@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=junfeng.guo@intel.com \
    --cc=xiao.w.wang@intel.com \
    --cc=yuying.zhang@intel.com \
    /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).