From patchwork Thu Mar 16 10:20:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 21822 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 38BA5CF62; Thu, 16 Mar 2017 11:22:36 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id AFD1B1396; Thu, 16 Mar 2017 11:22:09 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 16 Mar 2017 03:22:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,170,1486454400"; d="scan'208";a="61130817" Received: from jeffguo-s2600wt2.sh.intel.com ([10.239.129.150]) by orsmga002.jf.intel.com with ESMTP; 16 Mar 2017 03:22:07 -0700 From: Jeff Guo To: helin.zhang@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, stable@dpdk.org Date: Thu, 16 Mar 2017 18:20:08 +0800 Message-Id: <1489659608-47745-4-git-send-email-jia.guo@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489659608-47745-1-git-send-email-jia.guo@intel.com> References: <1489659608-47745-1-git-send-email-jia.guo@intel.com> Subject: [dpdk-dev] [dpdk-dev 4/4] net/i40evf: add notify to correct CRC strip config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Cc: stable@dpdk.org --- config/common_base | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) 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);