DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/iavf: fix default RSS configuration
@ 2021-01-31 10:47 Xuan Ding
  2021-02-01  0:44 ` Zhang, Qi Z
  0 siblings, 1 reply; 2+ messages in thread
From: Xuan Ding @ 2021-01-31 10:47 UTC (permalink / raw)
  To: qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, Xuan Ding

Add advanced RSS offloads check due to some legacy driver(kernel/DPDK PF)
does not support virtual channel command VIRTCHNL_OP_RSS_HENA with
hena = 0 and VIRTCHNL_OP_ADD_RSS_CFG.

Fixes: 95f2f0e9fc2a6("net/iavf: improve default RSS")

Signed-off-by: Xuan Ding <xuan.ding@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 67 +++++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 26 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 58a20b443f..d8735401d9 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -291,11 +291,13 @@ iavf_init_rss(struct iavf_adapter *adapter)
 	if (ret)
 		return ret;
 
-	/* Set RSS hash configuration based on rss_conf->rss_hf. */
-	ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "fail to set default RSS");
-		return ret;
+	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF) {
+		/* Set RSS hash configuration based on rss_conf->rss_hf. */
+		ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to set default RSS");
+			return ret;
+		}
 	}
 
 	return 0;
@@ -1251,21 +1253,23 @@ iavf_dev_rss_hash_update(struct rte_eth_dev *dev,
 	if (rss_conf->rss_hf == 0)
 		return 0;
 
-	/* Clear existing RSS. */
-	ret = iavf_set_hena(adapter, 0);
+	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF) {
+		/* Clear existing RSS. */
+		ret = iavf_set_hena(adapter, 0);
 
-	/* It is a workaround, temporarily allow error to be returned
-	 * due to possible lack of PF handling for hena = 0.
-	 */
-	if (ret)
-		PMD_DRV_LOG(WARNING, "fail to clean existing RSS,"
-			    "lack PF support");
+		/* It is a workaround, temporarily allow error to be returned
+		 * due to possible lack of PF handling for hena = 0.
+		 */
+		if (ret)
+			PMD_DRV_LOG(WARNING, "fail to clean existing RSS,"
+				    "lack PF support");
 
-	/* Set new RSS configuration. */
-	ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "fail to set new RSS");
-		return ret;
+		/* Set new RSS configuration. */
+		ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to set new RSS");
+			return ret;
+		}
 	}
 
 	return 0;
@@ -2092,6 +2096,24 @@ iavf_dev_filter_ctrl(struct rte_eth_dev *dev,
 	return ret;
 }
 
+static void
+iavf_default_rss_disable(struct iavf_adapter *adapter)
+{
+	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	int ret = 0;
+
+	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF) {
+		/* Set hena = 0 to ask PF to cleanup all existing RSS. */
+		ret = iavf_set_hena(adapter, 0);
+		if (ret)
+			/* It is a workaround, temporarily allow error to be
+			 * returned due to possible lack of PF handling for
+			 * hena = 0.
+			 */
+			PMD_INIT_LOG(WARNING, "fail to disable default RSS,"
+				    "lack PF support");
+	}
+}
 
 static int
 iavf_dev_init(struct rte_eth_dev *eth_dev)
@@ -2180,14 +2202,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 		return ret;
 	}
 
-	/* Set hena = 0 to ask PF to cleanup all existing RSS. */
-	ret = iavf_set_hena(adapter, 0);
-	if (ret)
-		/* It is a workaround, temporarily allow error to be returned
-		 * due to possible lack of PF handling for hena = 0.
-		 */
-		PMD_DRV_LOG(WARNING, "fail to disable default RSS,"
-			    "lack PF support");
+	iavf_default_rss_disable(adapter);
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/iavf: fix default RSS configuration
  2021-01-31 10:47 [dpdk-dev] [PATCH] net/iavf: fix default RSS configuration Xuan Ding
@ 2021-02-01  0:44 ` Zhang, Qi Z
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Qi Z @ 2021-02-01  0:44 UTC (permalink / raw)
  To: Ding, Xuan, Wu, Jingjing, Xing, Beilei; +Cc: dev



> -----Original Message-----
> From: Ding, Xuan <xuan.ding@intel.com>
> Sent: Sunday, January 31, 2021 6:47 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Ding, Xuan <xuan.ding@intel.com>
> Subject: [PATCH] net/iavf: fix default RSS configuration
> 
> Add advanced RSS offloads check due to some legacy driver(kernel/DPDK PF)
> does not support virtual channel command VIRTCHNL_OP_RSS_HENA with
> hena = 0 and VIRTCHNL_OP_ADD_RSS_CFG.
> 
> Fixes: 95f2f0e9fc2a6("net/iavf: improve default RSS")

Fixes: 95f2f0e9fc2a ("net/iavf: improve default RSS")

> 
> Signed-off-by: Xuan Ding <xuan.ding@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-01  0:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-31 10:47 [dpdk-dev] [PATCH] net/iavf: fix default RSS configuration Xuan Ding
2021-02-01  0:44 ` Zhang, Qi Z

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).