From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [dpdk-dev] [PATCH v2 1/7] net/txgbe: update device ID
Date: Tue, 16 Mar 2021 18:51:43 +0800 [thread overview]
Message-ID: <20210316105149.110904-2-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20210316105149.110904-1-jiawenwu@trustnetic.com>
For more different devices, update device ID and subsystem id.
Signed-off-by: Jiawen Wu <jiawenwu@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
+/* 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
next prev parent reply other threads:[~2021-03-16 10:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 10:51 [dpdk-dev] [PATCH v2 0/7] txgbe backplane AN training Jiawen Wu
2021-03-16 10:51 ` Jiawen Wu [this message]
2021-03-16 10:51 ` [dpdk-dev] [PATCH v2 2/7] net/txgbe: add device arguments Jiawen Wu
2021-03-24 10:59 ` Ferruh Yigit
2021-03-24 11:01 ` Ferruh Yigit
2021-03-16 10:51 ` [dpdk-dev] [PATCH v2 3/7] net/txgbe: move firmware version get function to base code Jiawen Wu
2021-03-16 10:51 ` [dpdk-dev] [PATCH v2 4/7] net/txgbe: update link setup process of backplane NICs Jiawen Wu
2021-03-16 10:51 ` [dpdk-dev] [PATCH v2 5/7] net/txgbe/base: support to handle backplane AN73 flow Jiawen Wu
2021-03-16 10:51 ` [dpdk-dev] [PATCH v2 6/7] net/txgbe: handle AN interrupt and link update Jiawen Wu
2021-03-16 10:51 ` [dpdk-dev] [PATCH v2 7/7] net/txgbe: add FFE parameters for user debugging Jiawen Wu
2021-03-23 17:33 ` [dpdk-dev] [PATCH v2 0/7] txgbe backplane AN training Ferruh Yigit
2021-03-24 1:57 ` Jiawen Wu
2021-03-24 10:36 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210316105149.110904-2-jiawenwu@trustnetic.com \
--to=jiawenwu@trustnetic.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).