DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 2/5] i40evf: Remove 'host_is_dpdk', and use version number instead
Date: Thu,  6 Nov 2014 20:53:47 +0800	[thread overview]
Message-ID: <1415278430-17920-3-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1415278430-17920-1-git-send-email-helin.zhang@intel.com>

API version number is straightfoward enough for checking
the PF host, and no need to use 'host_is_dpdk'.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 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 */
-- 
1.8.1.4

  parent reply	other threads:[~2014-11-06 12:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-14 14:48 [dpdk-dev] [PATCH v2 0/5] support of configurable CRC stripping in VF Helin Zhang
2014-09-14 14:48 ` [dpdk-dev] [PATCH v2 1/5] config: remove useless i40e items in config files Helin Zhang
2014-09-14 14:48 ` [dpdk-dev] [PATCH v2 2/5] i40e: renaming and code style fix Helin Zhang
2014-09-14 14:48 ` [dpdk-dev] [PATCH v2 3/5] i40e: support of processing crc stripping config in PF host Helin Zhang
2014-09-14 14:48 ` [dpdk-dev] [PATCH v2 4/5] i40e: set crc stripping in rx queue configuration Helin Zhang
2014-09-29  2:51   ` Xu, HuilongX
2014-09-14 14:48 ` [dpdk-dev] [PATCH v2 5/5] i40evf: support of configurable crc stripping in VF Helin Zhang
2014-11-06 12:53 ` [dpdk-dev] [PATCH v3 0/5] support of configurable CRC " Helin Zhang
2014-11-06 12:53   ` [dpdk-dev] [PATCH v3 1/5] config: remove useless i40e items in config files Helin Zhang
2014-11-06 12:53   ` Helin Zhang [this message]
2014-11-06 12:53   ` [dpdk-dev] [PATCH v3 3/5] i40e: renaming and code style fix Helin Zhang
2014-11-06 12:53   ` [dpdk-dev] [PATCH v3 4/5] i40e: support of configurable crc stripping in rx queue Helin Zhang
2014-11-06 12:53   ` [dpdk-dev] [PATCH v3 5/5] i40e: support of configurable VF crc stripping Helin Zhang
2014-11-06 15:46   ` [dpdk-dev] [PATCH v3 0/5] support of configurable CRC stripping in VF Ananyev, Konstantin
2014-11-06 22:51     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415278430-17920-3-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).