[dpdk-dev,dpdk-dev,4/4] net/i40evf: add notify to correct CRC strip config

Message ID 1489659608-47745-4-git-send-email-jia.guo@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Guo, Jia March 16, 2017, 10:20 a.m. UTC
  Since VF has no ability to disable/enable HW CRC strip for non-DPDK PF
drivers in i40e, if HW CRC strip config in example app's rxmode is not
match with the kernel PF default config, VF driver will return fail.
The patch just add notify to let user know how to correctly re-config
it to let the VF successful to work.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Cc: stable@dpdk.org
---
 config/common_base                |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c | 30 +++++++++++++++++++++---------
 2 files changed, 22 insertions(+), 9 deletions(-)
  

Patch

diff --git a/config/common_base b/config/common_base
index aeee13e..2b9fcfb 100644
--- a/config/common_base
+++ b/config/common_base
@@ -188,6 +188,7 @@  CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF=4
 CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM=4
 # interval up to 8160 us, aligned to 2 (or default value)
 CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
+CONFIG_RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC=n
 
 #
 # Compile burst-oriented FM10K PMD
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 55fd344..f72bda3 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1567,7 +1567,7 @@  i40evf_dev_configure(struct rte_eth_dev *dev)
 	struct i40e_adapter *ad =
 		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
-	struct i40e_vf *vf;
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
 	 * allocation or vector Rx preconditions we will reset it.
@@ -1577,17 +1577,29 @@  i40evf_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 	ad->tx_vec_allowed = true;
 
-	/* For non-DPDK PF drivers, VF has no ability to disable HW
-	 * CRC strip, and is implicitly enabled by the PF.
+	/* For non-DPDK PF drivers, VF has no ability to disable/enable HW
+	 * CRC strip, and is implicitly enabled/disabled by the PF.
 	 */
-	if (!conf->rxmode.hw_strip_crc) {
-		vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-		if ((vf->version_major == I40E_VIRTCHNL_VERSION_MAJOR) &&
-		    (vf->version_minor <= I40E_VIRTCHNL_VERSION_MINOR)) {
-			/* Peer is running non-DPDK PF driver. */
-			PMD_INIT_LOG(ERR, "VF can't disable HW CRC Strip");
+	if ((vf->version_major == I40E_VIRTCHNL_VERSION_MAJOR) &&
+		(vf->version_minor <= I40E_VIRTCHNL_VERSION_MINOR)) {
+		/* Peer is running non-DPDK PF driver. */
+#ifndef RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC
+		if (!conf->rxmode.hw_strip_crc) {
+			PMD_INIT_LOG(ERR, "VF can't disable HW CRC Strip"
+				" for non-DPDK PF drivers\n");
+			PMD_INIT_LOG(ERR, "hw_strip_crc should be set 1"
+				" by default for non-DPDK PF drivers!");
+			return -EINVAL;
+		}
+#else
+		if (conf->rxmode.hw_strip_crc) {
+			PMD_INIT_LOG(ERR, "VF can't enable HW CRC Strip"
+				" for non-DPDK PF drivers\n");
+			PMD_INIT_LOG(ERR, "hw_strip_crc should be set 0"
+				" by default for non-DPDK PF drivers!");
 			return -EINVAL;
 		}
+#endif
 	}
 
 	return i40evf_init_vlan(dev);