[v2] net/iavf: fix virtual channel RSS command error handling

Message ID 20210726091724.17104-1-alvinx.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/iavf: fix virtual channel RSS command error handling |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Alvin Zhang July 26, 2021, 9:17 a.m. UTC
  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")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)
  

Comments

Qi Zhang July 27, 2021, 11:54 a.m. UTC | #1
> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Monday, July 26, 2021 5:17 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> stable@dpdk.org
> 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.
> 
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 41382c6..574cfe0 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -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;