VF support for the 40G NIC was previously omitted; only the 25G VF was
added. Now add 40G VF support based on the existing 25G VF implementation,
with no major changes but only device ID adaptation.

Signed-off-by: Zaiyu Wang <[email protected]>
---
 drivers/net/txgbe/base/txgbe_devids.h | 2 ++
 drivers/net/txgbe/base/txgbe_hw.c     | 7 +++++++
 drivers/net/txgbe/base/txgbe_regs.h   | 7 +++++--
 drivers/net/txgbe/base/txgbe_type.h   | 1 +
 drivers/net/txgbe/base/txgbe_vf.c     | 7 ++++---
 drivers/net/txgbe/txgbe_ethdev.c      | 1 +
 drivers/net/txgbe/txgbe_ethdev_vf.c   | 2 ++
 7 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/drivers/net/txgbe/base/txgbe_devids.h 
b/drivers/net/txgbe/base/txgbe_devids.h
index b7133c7d54..f5454ffbb1 100644
--- a/drivers/net/txgbe/base/txgbe_devids.h
+++ b/drivers/net/txgbe/base/txgbe_devids.h
@@ -28,6 +28,8 @@
 #define TXGBE_DEV_ID_AML_VF                    0x5001
 #define TXGBE_DEV_ID_AML5024_VF                        0x5024
 #define TXGBE_DEV_ID_AML5124_VF                        0x5124
+#define TXGBE_DEV_ID_AML503F_VF                        0x503f
+#define TXGBE_DEV_ID_AML513F_VF                        0x513f
 
 /*
  * Subsystem IDs
diff --git a/drivers/net/txgbe/base/txgbe_hw.c 
b/drivers/net/txgbe/base/txgbe_hw.c
index 0f3db3a1ad..21465d68ff 100644
--- a/drivers/net/txgbe/base/txgbe_hw.c
+++ b/drivers/net/txgbe/base/txgbe_hw.c
@@ -2543,6 +2543,7 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)
                break;
        case txgbe_mac_sp_vf:
        case txgbe_mac_aml_vf:
+       case txgbe_mac_aml40_vf:
                status = txgbe_init_ops_vf(hw);
                break;
        default:
@@ -2573,6 +2574,7 @@ bool txgbe_is_vf(struct txgbe_hw *hw)
        switch (hw->mac.type) {
        case txgbe_mac_sp_vf:
        case txgbe_mac_aml_vf:
+       case txgbe_mac_aml40_vf:
                return true;
        default:
                return false;
@@ -2620,6 +2622,11 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)
                hw->phy.media_type = txgbe_media_type_virtual;
                hw->mac.type = txgbe_mac_aml_vf;
                break;
+       case TXGBE_DEV_ID_AML503F_VF:
+       case TXGBE_DEV_ID_AML513F_VF:
+               hw->phy.media_type = txgbe_media_type_virtual;
+               hw->mac.type = txgbe_mac_aml40_vf;
+               break;
        default:
                err = TXGBE_ERR_DEVICE_NOT_SUPPORTED;
                DEBUGOUT("Unsupported device id: %x", hw->device_id);
diff --git a/drivers/net/txgbe/base/txgbe_regs.h 
b/drivers/net/txgbe/base/txgbe_regs.h
index 95c585a025..5eb92c54b6 100644
--- a/drivers/net/txgbe/base/txgbe_regs.h
+++ b/drivers/net/txgbe/base/txgbe_regs.h
@@ -1824,12 +1824,14 @@ txgbe_map_reg(struct txgbe_hw *hw, u32 reg)
        switch (reg) {
        case TXGBE_REG_RSSTBL:
                if (hw->mac.type == txgbe_mac_sp_vf ||
-                   hw->mac.type == txgbe_mac_aml_vf)
+                   hw->mac.type == txgbe_mac_aml_vf ||
+                   hw->mac.type == txgbe_mac_aml40_vf)
                        reg = TXGBE_VFRSSTBL(0);
                break;
        case TXGBE_REG_RSSKEY:
                if (hw->mac.type == txgbe_mac_sp_vf ||
-                   hw->mac.type == txgbe_mac_aml_vf)
+                   hw->mac.type == txgbe_mac_aml_vf ||
+                   hw->mac.type == txgbe_mac_aml40_vf)
                        reg = TXGBE_VFRSSKEY(0);
                break;
        default:
@@ -2012,6 +2014,7 @@ static inline void txgbe_flush(struct txgbe_hw *hw)
                break;
        case txgbe_mac_sp_vf:
        case txgbe_mac_aml_vf:
+       case txgbe_mac_aml40_vf:
                rd32(hw, TXGBE_VFSTATUS);
                break;
        default:
diff --git a/drivers/net/txgbe/base/txgbe_type.h 
b/drivers/net/txgbe/base/txgbe_type.h
index 956080c702..132d5c4eff 100644
--- a/drivers/net/txgbe/base/txgbe_type.h
+++ b/drivers/net/txgbe/base/txgbe_type.h
@@ -171,6 +171,7 @@ enum txgbe_mac_type {
        txgbe_mac_aml40,
        txgbe_mac_sp_vf,
        txgbe_mac_aml_vf,
+       txgbe_mac_aml40_vf,
        txgbe_num_macs
 };
 
diff --git a/drivers/net/txgbe/base/txgbe_vf.c 
b/drivers/net/txgbe/base/txgbe_vf.c
index 1a8a20f104..4412006f1f 100644
--- a/drivers/net/txgbe/base/txgbe_vf.c
+++ b/drivers/net/txgbe/base/txgbe_vf.c
@@ -134,7 +134,9 @@ s32 txgbe_reset_hw_vf(struct txgbe_hw *hw)
        }
 
        /* amlite: bme */
-       if (hw->mac.type == txgbe_mac_aml_vf)
+       if (hw->mac.type == txgbe_mac_aml_vf ||
+           hw->mac.type == txgbe_mac_aml40_vf)
+
                wr32(hw, TXGBE_BME_AML, 0x1);
 
        if (!timeout)
@@ -493,8 +495,7 @@ s32 txgbe_check_mac_link_vf(struct txgbe_hw *hw, u32 *speed,
        /* for SFP+ modules and DA cables it can take up to 500usecs
         * before the link status is correct
         */
-       if ((mac->type == txgbe_mac_sp_vf ||
-            mac->type == txgbe_mac_aml_vf) && wait_to_complete) {
+       if (wait_to_complete) {
                if (po32m(hw, TXGBE_VFSTATUS, TXGBE_VFSTATUS_UP,
                        0, NULL, 5, 100))
                        goto out;
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 003a24141c..63b967d71a 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -5228,6 +5228,7 @@ txgbe_rss_update(enum txgbe_mac_type mac_type)
        case txgbe_mac_aml:
        case txgbe_mac_aml40:
        case txgbe_mac_aml_vf:
+       case txgbe_mac_aml40_vf:
                return 1;
        default:
                return 0;
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c 
b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 7ec1e009ed..655ccc622f 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -77,6 +77,8 @@ static const struct rte_pci_id pci_id_txgbevf_map[] = {
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_AML_VF) },
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_AML5024_VF) },
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_AML5124_VF) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_AML503F_VF) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_AML513F_VF) },
        { .vendor_id = 0, /* sentinel */ },
 };
 
-- 
2.21.0.windows.1

Reply via email to