On 3/5/2021 11:23 AM, Jiawen Wu wrote:
For more different devices, update device ID and subsystem id.

Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com>
---
  drivers/net/txgbe/base/txgbe_devids.h | 44 ++++++++++++++-------
  drivers/net/txgbe/base/txgbe_hw.c     | 55 ++++++++++++---------------
  drivers/net/txgbe/base/txgbe_phy.c    | 40 +++++++++++--------
  drivers/net/txgbe/txgbe_ethdev.c      |  4 +-
  drivers/net/txgbe/txgbe_ethdev_vf.c   |  4 +-
  5 files changed, 84 insertions(+), 63 deletions(-)

diff --git a/drivers/net/txgbe/base/txgbe_devids.h 
b/drivers/net/txgbe/base/txgbe_devids.h
index 744f2f3b5..cb186170e 100644
--- a/drivers/net/txgbe/base/txgbe_devids.h
+++ b/drivers/net/txgbe/base/txgbe_devids.h
@@ -15,22 +15,40 @@
  /*
   * Device IDs
   */
-#define TXGBE_DEV_ID_RAPTOR_VF                  0x1000
-#define TXGBE_DEV_ID_RAPTOR_SFP                 0x1001 /* fiber */
-#define TXGBE_DEV_ID_RAPTOR_KR_KX_KX4           0x1002 /* backplane */
-#define TXGBE_DEV_ID_RAPTOR_XAUI                0x1003 /* copper */
-#define TXGBE_DEV_ID_RAPTOR_SGMII               0x1004 /* copper */
-#define TXGBE_DEV_ID_RAPTOR_QSFP                0x1011 /* fiber */
-#define TXGBE_DEV_ID_RAPTOR_VF_HV               0x2000
-#define TXGBE_DEV_ID_RAPTOR_T3_LOM              0x2001
-
-#define TXGBE_DEV_ID_WX1820_SFP                 0x2001
+#define TXGBE_DEV_ID_SP1000                    0x1001
+#define TXGBE_DEV_ID_WX1820                    0x2001
+#define TXGBE_DEV_ID_SP1000_VF                  0x1000
+#define TXGBE_DEV_ID_WX1820_VF                  0x2000
/*
- * Subdevice IDs
+ * Subsystem IDs
   */
-#define TXGBE_SUBDEV_ID_RAPTOR                 0x0000
-#define TXGBE_SUBDEV_ID_MPW                    0x0001
+/* SFP */
+#define TXGBE_DEV_ID_SP1000_SFP                        0x0000
+#define TXGBE_DEV_ID_WX1820_SFP                        0x2000
+#define TXGBE_DEV_ID_SFP                       0x00

Just for double check, is id '0x0000' valid, from the overall SP/WX logic it looks like it should be '0x1000'.

+/* copper */
+#define TXGBE_DEV_ID_SP1000_XAUI               0x1010
+#define TXGBE_DEV_ID_WX1820_XAUI               0x2010
+#define TXGBE_DEV_ID_XAUI                      0x10
+#define TXGBE_DEV_ID_SP1000_SGMII              0x1020
+#define TXGBE_DEV_ID_WX1820_SGMII              0x2020
+#define TXGBE_DEV_ID_SGMII                     0x20
+/* backplane */
+#define TXGBE_DEV_ID_SP1000_KR_KX_KX4          0x1030
+#define TXGBE_DEV_ID_WX1820_KR_KX_KX4          0x2030
+#define TXGBE_DEV_ID_KR_KX_KX4                 0x30
+/* MAC Interface */
+#define TXGBE_DEV_ID_SP1000_MAC_XAUI           0x1040
+#define TXGBE_DEV_ID_WX1820_MAC_XAUI           0x2040
+#define TXGBE_DEV_ID_MAC_XAUI                  0x40
+#define TXGBE_DEV_ID_SP1000_MAC_SGMII           0x1060
+#define TXGBE_DEV_ID_WX1820_MAC_SGMII           0x2060
+#define TXGBE_DEV_ID_MAC_SGMII                  0x60
+/* combined interface*/
+#define TXGBE_DEV_ID_SFI_XAUI                  0x50
+/* fiber qsfp*/
+#define TXGBE_DEV_ID_QSFP                      0x11
#define TXGBE_ETHERTYPE_FLOW_CTRL 0x8808
  #define TXGBE_ETHERTYPE_IEEE_VLAN   0x8100  /* 802.1q protocol */
diff --git a/drivers/net/txgbe/base/txgbe_hw.c 
b/drivers/net/txgbe/base/txgbe_hw.c
index 3cee8b857..7a3e9510c 100644
--- a/drivers/net/txgbe/base/txgbe_hw.c
+++ b/drivers/net/txgbe/base/txgbe_hw.c
@@ -60,9 +60,9 @@ bool txgbe_device_supports_autoneg_fc(struct txgbe_hw *hw)
                break;
        case txgbe_media_type_copper:
                /* only some copper devices support flow control autoneg */
-               switch (hw->device_id) {
-               case TXGBE_DEV_ID_RAPTOR_XAUI:
-               case TXGBE_DEV_ID_RAPTOR_SGMII:
+               switch (hw->device_id & 0xFF) {
+               case TXGBE_DEV_ID_XAUI:
+               case TXGBE_DEV_ID_SGMII:

Should this be "hw->subsystem_device_id & 0xFF", instead of 'hw->device_id' as has been a few below instances? If the 'hw->device_id' is the pci device id, the 'hw->device_id & 0xFF' can be 0 or 1, both don't match the cases in the switch.

Reply via email to