From patchwork Thu Nov 6 12:53:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Helin" X-Patchwork-Id: 1162 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 446897F39; Thu, 6 Nov 2014 13:44:53 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id EC2317F48 for ; Thu, 6 Nov 2014 13:44:49 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 06 Nov 2014 04:54:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,325,1413270000"; d="scan'208";a="603420981" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 06 Nov 2014 04:54:04 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id sA6Cs2HP010536; Thu, 6 Nov 2014 20:54:02 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id sA6Cs0RX017968; Thu, 6 Nov 2014 20:54:02 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sA6Cs0Aj017964; Thu, 6 Nov 2014 20:54:00 +0800 From: Helin Zhang To: dev@dpdk.org Date: Thu, 6 Nov 2014 20:53:47 +0800 Message-Id: <1415278430-17920-3-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1415278430-17920-1-git-send-email-helin.zhang@intel.com> References: <1410706109-30448-1-git-send-email-helin.zhang@intel.com> <1415278430-17920-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v3 2/5] i40evf: Remove 'host_is_dpdk', and use version number instead X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" API version number is straightfoward enough for checking the PF host, and no need to use 'host_is_dpdk'. Signed-off-by: Helin Zhang --- lib/librte_pmd_i40e/i40e_ethdev.h | 3 ++- lib/librte_pmd_i40e/i40e_ethdev_vf.c | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h b/lib/librte_pmd_i40e/i40e_ethdev.h index afa14aa..96361c2 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.h +++ b/lib/librte_pmd_i40e/i40e_ethdev.h @@ -323,7 +323,8 @@ struct i40e_vf { bool promisc_unicast_enabled; bool promisc_multicast_enabled; - bool host_is_dpdk; /* The flag indicates if the host is DPDK */ + uint32_t version_major; /* Major version number */ + uint32_t version_minor; /* Minor version number */ uint16_t promisc_flags; /* Promiscuous setting */ uint32_t vlan[I40E_VFTA_SIZE]; /* VLAN bit map */ diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c index fa838e6..966f02f 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c +++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c @@ -393,17 +393,18 @@ i40evf_check_api_version(struct rte_eth_dev *dev) } pver = (struct i40e_virtchnl_version_info *)args.out_buffer; - /* We are talking with DPDK host */ - if (pver->major == I40E_DPDK_VERSION_MAJOR) { - vf->host_is_dpdk = TRUE; - PMD_DRV_LOG(INFO, "Detect PF host is DPDK app"); - } - /* It's linux host driver */ - else if ((pver->major != version.major) || - (pver->minor != version.minor)) { - PMD_INIT_LOG(ERR, "pf/vf API version mismatch. " - "(%u.%u)-(%u.%u)", pver->major, pver->minor, - version.major, version.minor); + vf->version_major = pver->major; + vf->version_minor = pver->minor; + if (vf->version_major == I40E_DPDK_VERSION_MAJOR) + PMD_DRV_LOG(INFO, "Peer is DPDK PF host"); + else if ((vf->version_major == I40E_VIRTCHNL_VERSION_MAJOR) && + (vf->version_minor == I40E_VIRTCHNL_VERSION_MINOR)) + PMD_DRV_LOG(INFO, "Peer is Linux PF host"); + else { + PMD_INIT_LOG(ERR, "PF/VF API version mismatch:(%u.%u)-(%u.%u)", + vf->version_major, vf->version_minor, + I40E_VIRTCHNL_VERSION_MAJOR, + I40E_VIRTCHNL_VERSION_MINOR); return -1; } @@ -1182,7 +1183,7 @@ i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask) struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); /* Linux pf host doesn't support vlan offload yet */ - if (vf->host_is_dpdk) { + if (vf->version_major == I40E_DPDK_VERSION_MAJOR) { /* Vlan stripping setting */ if (mask & ETH_VLAN_STRIP_MASK) { /* Enable or disable VLAN stripping */ @@ -1207,7 +1208,7 @@ i40evf_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on) info.on = on; /* Linux pf host don't support vlan offload yet */ - if (vf->host_is_dpdk) { + if (vf->version_major == I40E_DPDK_VERSION_MAJOR) { if (info.on) info.config.pvid = pvid; else { @@ -1480,7 +1481,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev, * DPDK pf host provide interfacet to acquire link status * while Linux driver does not */ - if (vf->host_is_dpdk) + if (vf->version_major == I40E_DPDK_VERSION_MAJOR) i40evf_get_link_status(dev, &new_link); else { /* Always assume it's up, for Linux driver PF host */