From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E2928A054F; Tue, 16 Mar 2021 11:52:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F055242860; Tue, 16 Mar 2021 11:51:59 +0100 (CET) Received: from smtpbg501.qq.com (smtpbg501.qq.com [203.205.250.101]) by mails.dpdk.org (Postfix) with ESMTP id 445054069F for ; Tue, 16 Mar 2021 11:51:54 +0100 (CET) X-QQ-mid: bizesmtp11t1615891907tch4oiz8 Received: from wxdbg.localdomain.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Tue, 16 Mar 2021 18:51:47 +0800 (CST) X-QQ-SSF: 01400000002000C0E000B00A0000000 X-QQ-FEAT: xeo957adDlbekHyjWHKpIGy978AqilPYjrzYtd+g5MVmT4A7FDVt8iClU0kSs ca0YjU8jwF0tOD2FMrZyp+iEBH4rAQmxhQCwNckuG87scMqNzoWcz9yWiK9PpKr6F4Rz7Lw cgkMPPemYRcqdlGiSed9062ck28u8PrgZYo99lXdADkN1JJu9Um0QjPcdA7g29yxMaILxpK mihIR5J/Z2WoXsGCzvB6aTi0sUlcE2r8t5P+8/+eK8ScK6Lp7wBMPRIB14FvRX5LOGA7QNt FKX2FFd3/OHrQG6THVqq+qf8W/53oef//cgiErEXkfg6cHqsUs6QOBjKx8LEMwS1tOtPUDG r+TELRNRZl6aeTN7S6cU9Xxt4FpLA== X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Date: Tue, 16 Mar 2021 18:51:43 +0800 Message-Id: <20210316105149.110904-2-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210316105149.110904-1-jiawenwu@trustnetic.com> References: <20210316105149.110904-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH v2 1/7] net/txgbe: update device ID X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For more different devices, update device ID and subsystem id. Signed-off-by: Jiawen Wu --- 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 +/* 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..81efb6444 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 bdd6bf780..37c41099f 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 1ab8d2cde..e3c0c5d42 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 63a45d32c..3a5123733 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 */ }, }; -- 2.27.0