DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: <dev@dpdk.org>
Cc: <thomas.monjalon@6wind.com>, <bruce.richardson@intel.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH 1/3] net/thunderx: remove generic passx references from the driver
Date: Thu, 21 Jul 2016 19:31:45 +0530	[thread overview]
Message-ID: <1469109707-23213-2-git-send-email-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <1469109707-23213-1-git-send-email-jerin.jacob@caviumnetworks.com>

thunderx pmd driver needs to support multiple SoC
variants in ThunderX family.
Remove generic pass references from driver as each SoC
can have same pass number.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 drivers/net/thunderx/base/nicvf_hw.c |  2 +-
 drivers/net/thunderx/base/nicvf_hw.h | 12 +++++-------
 drivers/net/thunderx/nicvf_ethdev.c  | 24 ++++++++++++------------
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/net/thunderx/base/nicvf_hw.c b/drivers/net/thunderx/base/nicvf_hw.c
index 001b0ed..2b12d9c 100644
--- a/drivers/net/thunderx/base/nicvf_hw.c
+++ b/drivers/net/thunderx/base/nicvf_hw.c
@@ -140,7 +140,7 @@ nicvf_base_init(struct nicvf *nic)
 	if (nic->subsystem_device_id == 0)
 		return NICVF_ERR_BASE_INIT;
 
-	if (nicvf_hw_version(nic) == NICVF_PASS2)
+	if (nicvf_hw_version(nic) == PCI_SUB_DEVICE_ID_CN88XX_PASS2_NICVF)
 		nic->hwcap |= NICVF_CAP_TUNNEL_PARSING;
 
 	return NICVF_OK;
diff --git a/drivers/net/thunderx/base/nicvf_hw.h b/drivers/net/thunderx/base/nicvf_hw.h
index 9db1d30..602a6ff 100644
--- a/drivers/net/thunderx/base/nicvf_hw.h
+++ b/drivers/net/thunderx/base/nicvf_hw.h
@@ -37,11 +37,11 @@
 
 #include "nicvf_hw_defs.h"
 
-#define	PCI_VENDOR_ID_CAVIUM			0x177D
-#define	PCI_DEVICE_ID_THUNDERX_PASS1_NICVF	0x0011
-#define	PCI_DEVICE_ID_THUNDERX_PASS2_NICVF	0xA034
-#define	PCI_SUB_DEVICE_ID_THUNDERX_PASS1_NICVF	0xA11E
-#define	PCI_SUB_DEVICE_ID_THUNDERX_PASS2_NICVF	0xA134
+#define	PCI_VENDOR_ID_CAVIUM				0x177D
+#define	PCI_DEVICE_ID_THUNDERX_CN88XX_PASS1_NICVF	0x0011
+#define	PCI_DEVICE_ID_THUNDERX_NICVF			0xA034
+#define	PCI_SUB_DEVICE_ID_CN88XX_PASS1_NICVF		0xA11E
+#define	PCI_SUB_DEVICE_ID_CN88XX_PASS2_NICVF		0xA134
 
 #define NICVF_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
@@ -50,8 +50,6 @@
 #define NICVF_GET_TX_STATS(reg) \
 	nicvf_reg_read(nic, NIC_VNIC_TX_STAT_0_4 | (reg << 3))
 
-#define NICVF_PASS1	(PCI_SUB_DEVICE_ID_THUNDERX_PASS1_NICVF)
-#define NICVF_PASS2	(PCI_SUB_DEVICE_ID_THUNDERX_PASS2_NICVF)
 
 #define NICVF_CAP_TUNNEL_PARSING          (1ULL << 0)
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4f875c0..3802d49 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -265,7 +265,7 @@ nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	size_t copied;
 	static uint32_t ptypes[32];
 	struct nicvf *nic = nicvf_pmd_priv(dev);
-	static const uint32_t ptypes_pass1[] = {
+	static const uint32_t ptypes_common[] = {
 		RTE_PTYPE_L3_IPV4,
 		RTE_PTYPE_L3_IPV4_EXT,
 		RTE_PTYPE_L3_IPV6,
@@ -274,7 +274,7 @@ nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 		RTE_PTYPE_L4_UDP,
 		RTE_PTYPE_L4_FRAG,
 	};
-	static const uint32_t ptypes_pass2[] = {
+	static const uint32_t ptypes_tunnel[] = {
 		RTE_PTYPE_TUNNEL_GRE,
 		RTE_PTYPE_TUNNEL_GENEVE,
 		RTE_PTYPE_TUNNEL_VXLAN,
@@ -282,12 +282,12 @@ nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	};
 	static const uint32_t ptypes_end = RTE_PTYPE_UNKNOWN;
 
-	copied = sizeof(ptypes_pass1);
-	memcpy(ptypes, ptypes_pass1, copied);
-	if (nicvf_hw_version(nic) == NICVF_PASS2) {
-		memcpy((char *)ptypes + copied, ptypes_pass2,
-			sizeof(ptypes_pass2));
-		copied += sizeof(ptypes_pass2);
+	copied = sizeof(ptypes_common);
+	memcpy(ptypes, ptypes_common, copied);
+	if (nicvf_hw_cap(nic) & NICVF_CAP_TUNNEL_PARSING) {
+		memcpy((char *)ptypes + copied, ptypes_tunnel,
+			sizeof(ptypes_tunnel));
+		copied += sizeof(ptypes_tunnel);
 	}
 
 	memcpy((char *)ptypes + copied, &ptypes_end, sizeof(ptypes_end));
@@ -1741,16 +1741,16 @@ static const struct rte_pci_id pci_id_nicvf_map[] = {
 	{
 		.class_id = RTE_CLASS_ANY_ID,
 		.vendor_id = PCI_VENDOR_ID_CAVIUM,
-		.device_id = PCI_DEVICE_ID_THUNDERX_PASS1_NICVF,
+		.device_id = PCI_DEVICE_ID_THUNDERX_CN88XX_PASS1_NICVF,
 		.subsystem_vendor_id = PCI_VENDOR_ID_CAVIUM,
-		.subsystem_device_id = PCI_SUB_DEVICE_ID_THUNDERX_PASS1_NICVF,
+		.subsystem_device_id = PCI_SUB_DEVICE_ID_CN88XX_PASS1_NICVF,
 	},
 	{
 		.class_id = RTE_CLASS_ANY_ID,
 		.vendor_id = PCI_VENDOR_ID_CAVIUM,
-		.device_id = PCI_DEVICE_ID_THUNDERX_PASS2_NICVF,
+		.device_id = PCI_DEVICE_ID_THUNDERX_NICVF,
 		.subsystem_vendor_id = PCI_VENDOR_ID_CAVIUM,
-		.subsystem_device_id = PCI_SUB_DEVICE_ID_THUNDERX_PASS2_NICVF,
+		.subsystem_device_id = PCI_SUB_DEVICE_ID_CN88XX_PASS2_NICVF,
 	},
 	{
 		.vendor_id = 0,
-- 
2.5.5

  reply	other threads:[~2016-07-21 14:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 14:01 [dpdk-dev] [PATCH 0/3] net/thunderx: add 81xx SoC support Jerin Jacob
2016-07-21 14:01 ` Jerin Jacob [this message]
2016-07-21 14:01 ` [dpdk-dev] [PATCH 2/3] net/thunderx: introduce cqe_rx2 HW capability flag Jerin Jacob
2016-07-21 14:01 ` [dpdk-dev] [PATCH 3/3] net/thunderx: add 81xx SoC support Jerin Jacob
2016-09-21 10:01 ` [dpdk-dev] [PATCH 0/3] " Bruce Richardson

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=1469109707-23213-2-git-send-email-jerin.jacob@caviumnetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.com \
    /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).