net/thunderx: remove generic passX references
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Thu, 21 Jul 2016 14:01:45 +0000 (19:31 +0530)
committerBruce Richardson <bruce.richardson@intel.com>
Fri, 30 Sep 2016 10:27:18 +0000 (12:27 +0200)
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
drivers/net/thunderx/base/nicvf_hw.h
drivers/net/thunderx/nicvf_ethdev.c

index 001b0ed..2b12d9c 100644 (file)
@@ -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;
index 9db1d30..602a6ff 100644 (file)
 
 #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)
 
index d98a537..4dda64f 100644 (file)
@@ -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,