From: Jiawen Wu Date: Mon, 29 Mar 2021 03:17:19 +0000 (+0800) Subject: net/txgbe: update device ID X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6666db9d5b120ff372324bfea7c4269f12f69e3f;p=dpdk.git net/txgbe: update device ID For more different devices, update device ID and subsystem id. Signed-off-by: Jiawen Wu --- diff --git a/drivers/net/txgbe/base/txgbe_devids.h b/drivers/net/txgbe/base/txgbe_devids.h index 744f2f3b5e..cb186170e6 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 +/* 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 3cee8b8572..81efb6444c 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->subsystem_device_id & 0xFF) { + case TXGBE_DEV_ID_XAUI: + case TXGBE_DEV_ID_SGMII: supported = true; break; default: @@ -2525,26 +2525,12 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw) } switch (hw->device_id) { - case TXGBE_DEV_ID_RAPTOR_KR_KX_KX4: - hw->phy.media_type = txgbe_media_type_backplane; + case TXGBE_DEV_ID_SP1000: + case TXGBE_DEV_ID_WX1820: hw->mac.type = txgbe_mac_raptor; break; - case TXGBE_DEV_ID_RAPTOR_XAUI: - case TXGBE_DEV_ID_RAPTOR_SGMII: - hw->phy.media_type = txgbe_media_type_copper; - hw->mac.type = txgbe_mac_raptor; - break; - case TXGBE_DEV_ID_RAPTOR_SFP: - case TXGBE_DEV_ID_WX1820_SFP: - hw->phy.media_type = txgbe_media_type_fiber; - hw->mac.type = txgbe_mac_raptor; - break; - case TXGBE_DEV_ID_RAPTOR_QSFP: - hw->phy.media_type = txgbe_media_type_fiber_qsfp; - hw->mac.type = txgbe_mac_raptor; - break; - case TXGBE_DEV_ID_RAPTOR_VF: - case TXGBE_DEV_ID_RAPTOR_VF_HV: + case TXGBE_DEV_ID_SP1000_VF: + case TXGBE_DEV_ID_WX1820_VF: hw->phy.media_type = txgbe_media_type_virtual; hw->mac.type = txgbe_mac_raptor_vf; break; @@ -2554,8 +2540,8 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw) break; } - DEBUGOUT("found mac: %d media: %d, returns: %d\n", - hw->mac.type, hw->phy.media_type, err); + DEBUGOUT("found mac: %d, returns: %d\n", + hw->mac.type, err); return err; } @@ -2613,7 +2599,7 @@ s32 txgbe_init_phy_raptor(struct txgbe_hw *hw) DEBUGFUNC("txgbe_init_phy_raptor"); - if (hw->device_id == TXGBE_DEV_ID_RAPTOR_QSFP) { + if ((hw->device_id & 0xFF) == TXGBE_DEV_ID_QSFP) { /* Store flag indicating I2C bus access control unit. */ hw->phy.qsfp_shared_i2c_bus = TRUE; @@ -3017,22 +3003,29 @@ u32 txgbe_get_media_type_raptor(struct txgbe_hw *hw) break; } - switch (hw->device_id) { - case TXGBE_DEV_ID_RAPTOR_KR_KX_KX4: + switch (hw->subsystem_device_id & 0xFF) { + case TXGBE_DEV_ID_KR_KX_KX4: + case TXGBE_DEV_ID_MAC_SGMII: + case TXGBE_DEV_ID_MAC_XAUI: /* Default device ID is mezzanine card KX/KX4 */ media_type = txgbe_media_type_backplane; break; - case TXGBE_DEV_ID_RAPTOR_SFP: - case TXGBE_DEV_ID_WX1820_SFP: + case TXGBE_DEV_ID_SFP: media_type = txgbe_media_type_fiber; break; - case TXGBE_DEV_ID_RAPTOR_QSFP: + case TXGBE_DEV_ID_QSFP: media_type = txgbe_media_type_fiber_qsfp; break; - case TXGBE_DEV_ID_RAPTOR_XAUI: - case TXGBE_DEV_ID_RAPTOR_SGMII: + case TXGBE_DEV_ID_XAUI: + case TXGBE_DEV_ID_SGMII: media_type = txgbe_media_type_copper; break; + case TXGBE_DEV_ID_SFI_XAUI: + if (hw->bus.lan_id == 0) + media_type = txgbe_media_type_fiber; + else + media_type = txgbe_media_type_copper; + break; default: media_type = txgbe_media_type_unknown; break; diff --git a/drivers/net/txgbe/base/txgbe_phy.c b/drivers/net/txgbe/base/txgbe_phy.c index bdd6bf780e..37c41099f3 100644 --- a/drivers/net/txgbe/base/txgbe_phy.c +++ b/drivers/net/txgbe/base/txgbe_phy.c @@ -2126,26 +2126,32 @@ u64 txgbe_autoc_read(struct txgbe_hw *hw) u32 sr_pma_ctl1; u32 sr_an_ctl; u32 sr_an_adv_reg2; + u8 type = hw->subsystem_device_id & 0xFF; if (hw->phy.multispeed_fiber) { autoc |= TXGBE_AUTOC_LMS_10G; - } else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_SFP || - hw->device_id == TXGBE_DEV_ID_WX1820_SFP) { - autoc |= TXGBE_AUTOC_LMS_10G | - TXGBE_AUTOC_10GS_SFI; - } else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_QSFP) { + } else if (type == TXGBE_DEV_ID_SFP) { + autoc |= TXGBE_AUTOC_LMS_10G; + autoc |= TXGBE_AUTOC_10GS_SFI; + } else if (type == TXGBE_DEV_ID_QSFP) { autoc = 0; /*TBD*/ - } else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_XAUI) { - autoc |= TXGBE_AUTOC_LMS_10G_LINK_NO_AN | - TXGBE_AUTOC_10G_XAUI; + } else if (type == TXGBE_DEV_ID_XAUI || type == TXGBE_DEV_ID_SFI_XAUI) { + autoc |= TXGBE_AUTOC_LMS_10G_LINK_NO_AN; + autoc |= TXGBE_AUTOC_10G_XAUI; hw->phy.link_mode = TXGBE_PHYSICAL_LAYER_10GBASE_T; - } else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_SGMII) { + } else if (type == TXGBE_DEV_ID_SGMII) { autoc |= TXGBE_AUTOC_LMS_SGMII_1G_100M; hw->phy.link_mode = TXGBE_PHYSICAL_LAYER_1000BASE_T | TXGBE_PHYSICAL_LAYER_100BASE_TX; + } else if (type == TXGBE_DEV_ID_MAC_XAUI) { + autoc |= TXGBE_AUTOC_LMS_10G_LINK_NO_AN; + hw->phy.link_mode = TXGBE_PHYSICAL_LAYER_10GBASE_KX4; + } else if (type == TXGBE_DEV_ID_MAC_SGMII) { + autoc |= TXGBE_AUTOC_LMS_1G_LINK_NO_AN; + hw->phy.link_mode = TXGBE_PHYSICAL_LAYER_1000BASE_KX; } - if (hw->device_id != TXGBE_DEV_ID_RAPTOR_SGMII) + if (type != TXGBE_DEV_ID_KR_KX_KX4) return autoc; sr_pcs_ctl = rd32_epcs(hw, SR_XS_PCS_CTRL2); @@ -2201,13 +2207,14 @@ void txgbe_autoc_write(struct txgbe_hw *hw, u64 autoc) bool autoneg; u32 speed; u32 mactxcfg = 0; + u8 device_type = hw->subsystem_device_id & 0xFF; speed = TXGBE_AUTOC_SPEED(autoc); autoc &= ~TXGBE_AUTOC_SPEED_MASK; autoneg = (autoc & TXGBE_AUTOC_AUTONEG ? true : false); autoc &= ~TXGBE_AUTOC_AUTONEG; - if (hw->device_id == TXGBE_DEV_ID_RAPTOR_KR_KX_KX4) { + if (device_type == TXGBE_DEV_ID_KR_KX_KX4) { if (!autoneg) { switch (hw->phy.link_mode) { case TXGBE_PHYSICAL_LAYER_10GBASE_KR: @@ -2223,16 +2230,19 @@ void txgbe_autoc_write(struct txgbe_hw *hw, u64 autoc) return; } } - } else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_XAUI || - hw->device_id == TXGBE_DEV_ID_RAPTOR_SGMII) { + } else if (device_type == TXGBE_DEV_ID_XAUI || + device_type == TXGBE_DEV_ID_SGMII || + device_type == TXGBE_DEV_ID_MAC_XAUI || + device_type == TXGBE_DEV_ID_MAC_SGMII || + (device_type == TXGBE_DEV_ID_SFI_XAUI && + hw->phy.media_type == txgbe_media_type_copper)) { if (speed == TXGBE_LINK_SPEED_10GB_FULL) { txgbe_set_link_to_kx4(hw, autoneg); } else { txgbe_set_link_to_kx(hw, speed, 0); txgbe_set_sgmii_an37_ability(hw); } - } else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_SFP || - hw->device_id == TXGBE_DEV_ID_WX1820_SFP) { + } else if (hw->phy.media_type == txgbe_media_type_fiber) { txgbe_set_link_to_sfi(hw, speed); } diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index 9949d4e09d..58713ae42f 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -138,8 +138,8 @@ static void txgbe_l2_tunnel_conf(struct rte_eth_dev *dev); * The set of PCI devices this driver supports */ static const struct rte_pci_id pci_id_txgbe_map[] = { - { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_RAPTOR_SFP) }, - { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_WX1820_SFP) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_SP1000) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_WX1820) }, { .vendor_id = 0, /* sentinel */ }, }; diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c index 63a45d32c1..3a5123733e 100644 --- a/drivers/net/txgbe/txgbe_ethdev_vf.c +++ b/drivers/net/txgbe/txgbe_ethdev_vf.c @@ -71,8 +71,8 @@ static void txgbevf_dev_interrupt_handler(void *param); * The set of PCI devices this driver supports (for VF) */ static const struct rte_pci_id pci_id_txgbevf_map[] = { - { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_RAPTOR_VF) }, - { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_RAPTOR_VF_HV) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_SP1000_VF) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_WX1820_VF) }, { .vendor_id = 0, /* sentinel */ }, };