Skip to contentSkip to conversation

net/iavf: fix virtual channel RSS command error handling

PATCH Superseded Alvin Zhang 2 participants 4 messages Jul 21, 2021 – Jul 27, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/iavf: fix virtual channel RSS command error handling

Kernel PF may not respond to virtual channel commands VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA, which will cause VF to fail to start.

RSS offload type configuration is not a necessary feature for VF, so in order to improve VF compatibility, in this patch the PMD will ignore the error result of above two commands and will print warnings instead.

Fixes 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")
---
 drivers/net/iavf/iavf_ethdev.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/net/iavf/iavf_ethdev.c +14 -12
index 41382c6..162f55d 100644
@@ -259,7 +259,7 @@ struct rte_iavf_xstats_name_off {
 	return err;
 }
 
-static int
+static void
 iavf_config_rss_hf(struct iavf_adapter *adapter, uint64_t rss_hf)
 {
 	static const uint64_t map_hena_rss[] = {
@@ -319,8 +319,12 @@ struct rte_iavf_xstats_name_off {
 	int ret;
 
 	ret = iavf_get_hena_caps(adapter, &caps);
-	if (ret)
-		return ret;
+	if (ret) {
+		PMD_DRV_LOG(WARNING,
+			    "fail to get supported RSS caps, lack PF support");
+		return;
+	}
+
 	/**
 	 * ETH_RSS_IPV4 and ETH_RSS_IPV6 can be considered as 2
 	 * generalizations of all other IPv4 and IPv6 RSS types.
@@ -343,8 +347,11 @@ struct rte_iavf_xstats_name_off {
 	}
 
 	ret = iavf_set_hena(adapter, hena);
-	if (ret)
-		return ret;
+	if (ret) {
+		PMD_DRV_LOG(WARNING,
+			    "fail to clean existing RSS, lack PF support");
+		return;
+	}
 
 	if (valid_rss_hf & ipv4_rss)
 		valid_rss_hf |= rss_hf & ETH_RSS_IPV4;
@@ -357,7 +364,6 @@ struct rte_iavf_xstats_name_off {
 			    rss_hf & ~valid_rss_hf);
 
 	vf->rss_hf = valid_rss_hf;
-	return 0;
 }
 
 static int
@@ -409,9 +415,7 @@ struct rte_iavf_xstats_name_off {
 			return ret;
 		}
 	} else {
-		ret = iavf_config_rss_hf(adapter, rss_conf->rss_hf);
-		if (ret != -ENOTSUP)
-			return ret;
+		iavf_config_rss_hf(adapter, rss_conf->rss_hf);
 	}
 
 	return 0;
@@ -1400,9 +1404,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
 			return ret;
 		}
 	} else {
-		ret = iavf_config_rss_hf(adapter, rss_conf->rss_hf);
-		if (ret != -ENOTSUP)
-			return ret;
+		iavf_config_rss_hf(adapter, rss_conf->rss_hf);
 	}
 
 	return 0;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 39 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Alvin Zhang
Sent: Wednesday, July 21, 2021 2:32 PM
To: Xing, Beilei <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/iavf: fix virtual channel RSS command error handling

Kernel PF may not respond to virtual channel commands VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA, which will cause VF to fail to start.

RSS offload type configuration is not a necessary feature for VF, so in order to improve VF compatibility, in this patch the PMD will ignore the error result of above two commands and will print warnings instead.

Fixes 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")
---
 drivers/net/iavf/iavf_ethdev.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/net/iavf/iavf_ethdev.c index renamed from drivers/net/iavf/iavf_ethdev.c +0 -0

41382c6..162f55d 100644

drivers/net/iavf/iavf_ethdev.c +1 -1
@@ -259,7 +259,7 @@ struct rte_iavf_xstats_name_off {
 	return err;
 }
 
-static int
+static void
 iavf_config_rss_hf(struct iavf_adapter *adapter, uint64_t rss_hf)  {
 	static const uint64_t map_hena_rss[] = { @@ -319,8 +319,12 @@ struct
 rte_iavf_xstats_name_off {

drivers/net/iavf/iavf_ethdev.c struct rte_iavf_xstats_name_off { · line 324

Quoted 8 lines
drivers/net/iavf/iavf_ethdev.c +3 -2
 	int ret;
 
 	ret = iavf_get_hena_caps(adapter, &caps);
-	if (ret)
-		return ret;
+	if (ret) {
+		PMD_DRV_LOG(WARNING,
+			    "fail to get supported RSS caps, lack PF support");

This is misleading, the failure reason is not necessary be "lack PF support', it could be any other reason
So better just print the error code here, or simply ignore if a meaningful failure message will already be printed inside iavf_get_hena_caps.

Quoted 7 lines
drivers/net/iavf/iavf_ethdev.c +3 -0
+		return;
+	}
+
 	/**
 	 * ETH_RSS_IPV4 and ETH_RSS_IPV6 can be considered as 2
 	 * generalizations of all other IPv4 and IPv6 RSS types.

drivers/net/iavf/iavf_ethdev.c struct rte_iavf_xstats_name_off { · line 352

Quoted 8 lines
drivers/net/iavf/iavf_ethdev.c +3 -2
@@ -343,8 +347,11 @@ struct rte_iavf_xstats_name_off {
 	}
 
 	ret = iavf_set_hena(adapter, hena);
-	if (ret)
-		return ret;
+	if (ret) {
+		PMD_DRV_LOG(WARNING,
+			    "fail to clean existing RSS, lack PF support");

Actually this is not the case to "clean" but "overwrite", also the "lack PF support" should be refined base on previous comments.

Quoted 38 lines
drivers/net/iavf/iavf_ethdev.c +2 -0
+		return;
+	}
 
 	if (valid_rss_hf & ipv4_rss)
 		valid_rss_hf |= rss_hf & ETH_RSS_IPV4; @@ -357,7 +364,6 @@

struct rte_iavf_xstats_name_off {

drivers/net/iavf/iavf_ethdev.c +2 -7
 			    rss_hf & ~valid_rss_hf);
 
 	vf->rss_hf = valid_rss_hf;
-	return 0;
 }
 
 static int
@@ -409,9 +415,7 @@ struct rte_iavf_xstats_name_off {
 			return ret;
 		}
 	} else {
-		ret = iavf_config_rss_hf(adapter, rss_conf->rss_hf);
-		if (ret != -ENOTSUP)
-			return ret;
+		iavf_config_rss_hf(adapter, rss_conf->rss_hf);
 	}
 
 	return 0;
@@ -1400,9 +1404,7 @@ static int iavf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 			return ret;
 		}
 	} else {
-		ret = iavf_config_rss_hf(adapter, rss_conf->rss_hf);
-		if (ret != -ENOTSUP)
-			return ret;
+		iavf_config_rss_hf(adapter, rss_conf->rss_hf);
 	}
 

return 0;
--
1.8.3.1

#2 lore raw

PATCH v2 1/1 net/iavf: fix virtual channel RSS command error handling

In reply to Alvin Zhang

Kernel PF may not respond to virtual channel commands VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA, which will cause VF to fail to start.

RSS offload type configuration is not a necessary feature for VF, so in order to improve VF compatibility, in this patch the PMD will ignore the error result of above two commands and will print warnings instead.

Fixes 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")
---
 drivers/net/iavf/iavf_ethdev.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/net/iavf/iavf_ethdev.c +22 -12
index 41382c6..574cfe0 100644
@@ -259,7 +259,7 @@ struct rte_iavf_xstats_name_off {
 	return err;
 }
 
-static int
+static void
 iavf_config_rss_hf(struct iavf_adapter *adapter, uint64_t rss_hf)
 {
 	static const uint64_t map_hena_rss[] = {
@@ -319,8 +319,16 @@ struct rte_iavf_xstats_name_off {
 	int ret;
 
 	ret = iavf_get_hena_caps(adapter, &caps);
-	if (ret)
-		return ret;
+	if (ret) {
+		/**
+		 * RSS offload type configuration is not a necessary feature
+		 * for VF, so here just print a warning and return.
+		 */
+		PMD_DRV_LOG(WARNING,
+			    "fail to get RSS offload type caps, ret: %d", ret);
+		return;
+	}
+
 	/**
 	 * ETH_RSS_IPV4 and ETH_RSS_IPV6 can be considered as 2
 	 * generalizations of all other IPv4 and IPv6 RSS types.
@@ -343,8 +351,15 @@ struct rte_iavf_xstats_name_off {
 	}
 
 	ret = iavf_set_hena(adapter, hena);
-	if (ret)
-		return ret;
+	if (ret) {
+		/**
+		 * RSS offload type configuration is not a necessary feature
+		 * for VF, so here just print a warning and return.
+		 */
+		PMD_DRV_LOG(WARNING,
+			    "fail to set RSS offload types, ret: %d", ret);
+		return;
+	}
 
 	if (valid_rss_hf & ipv4_rss)
 		valid_rss_hf |= rss_hf & ETH_RSS_IPV4;
@@ -357,7 +372,6 @@ struct rte_iavf_xstats_name_off {
 			    rss_hf & ~valid_rss_hf);
 
 	vf->rss_hf = valid_rss_hf;
-	return 0;
 }
 
 static int
@@ -409,9 +423,7 @@ struct rte_iavf_xstats_name_off {
 			return ret;
 		}
 	} else {
-		ret = iavf_config_rss_hf(adapter, rss_conf->rss_hf);
-		if (ret != -ENOTSUP)
-			return ret;
+		iavf_config_rss_hf(adapter, rss_conf->rss_hf);
 	}
 
 	return 0;
@@ -1400,9 +1412,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
 			return ret;
 		}
 	} else {
-		ret = iavf_config_rss_hf(adapter, rss_conf->rss_hf);
-		if (ret != -ENOTSUP)
-			return ret;
+		iavf_config_rss_hf(adapter, rss_conf->rss_hf);
 	}
 
 	return 0;
Signature · 1 line
1.8.3.1
Acked-by on v2 1/1 Applied
#3 lore raw
Quoted 14 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Monday, July 26, 2021 5:17 PM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH v2] net/iavf: fix virtual channel RSS command error handling

Kernel PF may not respond to virtual channel commands VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA, which will cause VF to fail to start.

Quoted 8 lines

RSS offload type configuration is not a necessary feature for VF, so in order to improve VF compatibility, in this patch the PMD will ignore the error result of above two commands and will print warnings instead.

Fixes 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")

Applied to dpdk-next-net-intel.

Thanks
Qi