*** Wangxun new NIC support ***
Subsystems (2)
cover *** Wangxun new NIC support ***
We have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 10G/40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
Zaiyu Wang (2):
net/txgbe: add support for Wangxun new NIC Amber-Lite 25g/40g net/txgbe: add basic code for Amber-Liter NIC configuration
drivers/net/txgbe/base/meson.build | 4 + drivers/net/txgbe/base/txgbe_aml.c | 345 +++ drivers/net/txgbe/base/txgbe_aml.h | 11 + drivers/net/txgbe/base/txgbe_aml40.c | 196 ++ drivers/net/txgbe/base/txgbe_aml40.h | 11 + drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_e56.c | 3371 +++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_e56.h | 1784 +++++++++++++ drivers/net/txgbe/base/txgbe_e56_bp.c | 2238 ++++++++++++++++ drivers/net/txgbe/base/txgbe_e56_bp.h | 13 + drivers/net/txgbe/base/txgbe_hw.c | 23 +- drivers/net/txgbe/base/txgbe_hw.h | 2 +- drivers/net/txgbe/base/txgbe_osdep.h | 4 + drivers/net/txgbe/base/txgbe_phy.h | 17 + drivers/net/txgbe/base/txgbe_regs.h | 25 +- drivers/net/txgbe/base/txgbe_type.h | 36 + drivers/net/txgbe/txgbe_ethdev.c | 35 +- 17 files changed, 8110 insertions(+), 14 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h create mode 100644 drivers/net/txgbe/base/txgbe_e56.c create mode 100644 drivers/net/txgbe/base/txgbe_e56.h create mode 100644 drivers/net/txgbe/base/txgbe_e56_bp.c create mode 100644 drivers/net/txgbe/base/txgbe_e56_bp.h
Signature · 1 line
2.21.0.windows.1
PATCH 1/2 net/txgbe: add support for Wangxun new NIC Amber-Lite 25g/40g
Amber-Lite is a new model of network interface card launched by Wangxun. It comes in two types: one supports 10g/25g rates, and the other supports 10g/40g rates.
--- drivers/net/txgbe/base/txgbe_devids.h | 9 +++++++ drivers/net/txgbe/base/txgbe_hw.c | 17 +++++++++++++ drivers/net/txgbe/base/txgbe_regs.h | 4 ++- drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 35 ++++++++++++++++++++------- 5 files changed, 58 insertions(+), 10 deletions(-)
drivers/net/txgbe/base/txgbe_devids.h +9 -0
@@ -19,6 +19,15 @@#define TXGBE_DEV_ID_WX1820 0x2001#define TXGBE_DEV_ID_SP1000_VF 0x1000#define TXGBE_DEV_ID_WX1820_VF 0x2000 +#define TXGBE_DEV_ID_AML 0x5000 +#define TXGBE_DEV_ID_AML5025 0x5025 +#define TXGBE_DEV_ID_AML5125 0x5125 +#define TXGBE_DEV_ID_AML5040 0x5040 +#define TXGBE_DEV_ID_AML5140 0x5140 + +#define TXGBE_DEV_ID_AML_VF 0x5001 +#define TXGBE_DEV_ID_AML5024_VF 0x5024 +#define TXGBE_DEV_ID_AML5124_VF 0x5124/* * Subsystem IDs
drivers/net/txgbe/base/txgbe_hw.c +17 -0
@@ -2469,6 +2469,8 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) {case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: status =txgbe_init_ops_pf (hw);break ;case txgbe_mac_raptor_vf:
@@ -2506,11 +2508,26 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)case TXGBE_DEV_ID_WX1820 : hw->mac.type = txgbe_mac_raptor;break ; +case TXGBE_DEV_ID_AML : +case TXGBE_DEV_ID_AML5025 : +case TXGBE_DEV_ID_AML5125 : + hw->mac.type = txgbe_mac_aml; +break ; +case TXGBE_DEV_ID_AML5040 : +case TXGBE_DEV_ID_AML5140 : + hw->mac.type = txgbe_mac_aml40; +break ;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 ; +case TXGBE_DEV_ID_AML_VF : +case TXGBE_DEV_ID_AML5024_VF : +case TXGBE_DEV_ID_AML5124_VF : + hw->phy.media_type = txgbe_media_type_virtual; + hw->mac.type = txgbe_mac_aml_vf; +break ;default : err =TXGBE_ERR_DEVICE_NOT_SUPPORTED ;DEBUGOUT ("Unsupported device id: %x" , hw->device_id);
drivers/net/txgbe/base/txgbe_regs.h +3 -1
@@ -97,7 +97,9 @@#define TXGBE_LINK_SPEED_2_5GB_FULL 0x0400#define TXGBE_LINK_SPEED_5GB_FULL 0x0800#define TXGBE_LINK_SPEED_10GB_FULL 0x0080 -#define TXGBE_LINK_SPEED_40GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_25GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_40GB_FULL 0x0040 +#define TXGBE_LINK_SPEED_50GB_FULL 0x0200#define TXGBE_AUTOC_AUTONEG MS64(63, 0x1)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -148,7 +148,10 @@ enum txgbe_eeprom_type {enum txgbe_mac_type { txgbe_mac_unknown =0 , txgbe_mac_raptor, + txgbe_mac_aml, + txgbe_mac_aml40, txgbe_mac_raptor_vf, + txgbe_mac_aml_vf, txgbe_num_macs };
drivers/net/txgbe/txgbe_ethdev.c +26 -9
@@ -145,6 +145,11 @@ static void txgbe_l2_tunnel_conf(struct rte_eth_dev *dev);static const struct rte_pci_id pci_id_txgbe_map[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_SP1000 ) }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_WX1820 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5025 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5125 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5040 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5140 ) }, { .vendor_id =0 ,/* sentinel */ }, };
@@ -1829,8 +1834,13 @@ txgbe_dev_start(struct rte_eth_dev *dev)if (err) goto error; - allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | -RTE_ETH_LINK_SPEED_10G ; +if (hw->mac.type == txgbe_mac_aml40) + allowed_speeds =RTE_ETH_LINK_SPEED_40G ; +else if (hw->mac.type == txgbe_mac_aml) + allowed_speeds =RTE_ETH_LINK_SPEED_10G |RTE_ETH_LINK_SPEED_25G ; +else + allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | +RTE_ETH_LINK_SPEED_10G ; link_speeds = &dev->data->dev_conf.link_speeds;if (((*link_speeds) >>1 ) & ~(allowed_speeds >>1 )) {
@@ -1840,17 +1850,24 @@ txgbe_dev_start(struct rte_eth_dev *dev) speed =0x0 ;if (*link_speeds ==RTE_ETH_LINK_SPEED_AUTONEG ) { - speed = (TXGBE_LINK_SPEED_100M_FULL | -TXGBE_LINK_SPEED_1GB_FULL | -TXGBE_LINK_SPEED_10GB_FULL ); +if (hw->mac.type == txgbe_mac_aml40) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + }else if (hw->mac.type == txgbe_mac_aml) { + speed = (TXGBE_LINK_SPEED_10GB_FULL | +TXGBE_LINK_SPEED_25GB_FULL ); + }else { + speed = (TXGBE_LINK_SPEED_100M_FULL | +TXGBE_LINK_SPEED_1GB_FULL | +TXGBE_LINK_SPEED_10GB_FULL ); + } hw->autoneg = true; }else { +if (*link_speeds &RTE_ETH_LINK_SPEED_40G ) + speed |=TXGBE_LINK_SPEED_40GB_FULL ; +if (*link_speeds &RTE_ETH_LINK_SPEED_25G ) + speed |=TXGBE_LINK_SPEED_25GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_10G ) speed |=TXGBE_LINK_SPEED_10GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_5G ) - speed |=TXGBE_LINK_SPEED_5GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_2_5G ) - speed |=TXGBE_LINK_SPEED_2_5GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_1G ) speed |=TXGBE_LINK_SPEED_1GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_100M )
Signature · 1 line
2.21.0.windows.1
PATCH 2/2 net/txgbe: add basic code for Amber-Liter NIC configuration
In reply to Zaiyu WangDue to minimal hardware differences between Amber-Lite and Wangxun 10G NICs, we continue to support both within the txgbe driver instead of developing a new one.
--- drivers/net/txgbe/base/meson.build | 4 + drivers/net/txgbe/base/txgbe_aml.c | 345 +++ drivers/net/txgbe/base/txgbe_aml.h | 11 + drivers/net/txgbe/base/txgbe_aml40.c | 196 ++ drivers/net/txgbe/base/txgbe_aml40.h | 11 + drivers/net/txgbe/base/txgbe_e56.c | 3371 +++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_e56.h | 1784 +++++++++++++ drivers/net/txgbe/base/txgbe_e56_bp.c | 2238 ++++++++++++++++ drivers/net/txgbe/base/txgbe_e56_bp.h | 13 + drivers/net/txgbe/base/txgbe_hw.c | 10 +- drivers/net/txgbe/base/txgbe_hw.h | 2 +- drivers/net/txgbe/base/txgbe_osdep.h | 4 + drivers/net/txgbe/base/txgbe_phy.h | 17 + drivers/net/txgbe/base/txgbe_regs.h | 21 +- drivers/net/txgbe/base/txgbe_type.h | 33 + 15 files changed, 8054 insertions(+), 6 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h create mode 100644 drivers/net/txgbe/base/txgbe_e56.c create mode 100644 drivers/net/txgbe/base/txgbe_e56.h create mode 100644 drivers/net/txgbe/base/txgbe_e56_bp.c create mode 100644 drivers/net/txgbe/base/txgbe_e56_bp.h
drivers/net/txgbe/base/meson.build +4 -0
@@ -6,10 +6,14 @@ sources = [ 'txgbe_dcb.c', 'txgbe_eeprom.c', 'txgbe_hw.c', + 'txgbe_aml.c', + 'txgbe_aml40.c', 'txgbe_mbx.c', 'txgbe_mng.c', 'txgbe_phy.c', 'txgbe_vf.c', + 'txgbe_e56.c', + 'txgbe_e56_bp.c', ] error_cflags = []
drivers/net/txgbe/base/txgbe_aml.c new file +345 -0
346 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML_H_ +#define _TXGBE_AML_H_ + +#include "txgbe_type.h" + +#endif /* _TXGBE_AML_H_ */
drivers/net/txgbe/base/txgbe_aml40.c new file +196 -0
196 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml40.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML40_H_ +#define _TXGBE_AML40_H_ + +#include "txgbe_type.h" + +#endif /* _TXGBE_AML40_H_ */
drivers/net/txgbe/base/txgbe_e56.c new file +3371 -0
2,422 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_e56.h new file +1784 -0
1,784 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_e56_bp.c new file +2238 -0
2,238 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_e56_bp.h new file +13 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.0.windows.1
Part of the diff is not shown here. View the raw message.
v2 cover Wangxun new NIC support
In reply to Zaiyu WangWe have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
Zaiyu Wang (15):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add other hardware-related changes
doc: update for txgbe
doc/guides/nics/txgbe.rst | 8 +- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 355 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 159 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 355 +++++++++++++++++--- drivers/net/txgbe/base/txgbe_hw.h | 16 +- drivers/net/txgbe/base/txgbe_mng.c | 252 +++++++++++---- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 +++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 95 +++++- drivers/net/txgbe/base/txgbe_type.h | 66 ++++ drivers/net/txgbe/txgbe_ethdev.c | 373 ++++++++++++++++++++-- drivers/net/txgbe/txgbe_rxtx.c | 201 +++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 22 files changed, 1945 insertions(+), 214 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Signature · 1 line
2.21.0.windows.1
PATCH v2 1/15 net/txgbe: add basic information for Amber-Lite 25G/40G NICs
Add device IDs, speed and other basic information for Wangxun's new Amber-Lite NICs: aml (10G/25G) and aml40 (40G).
--- drivers/net/txgbe/base/txgbe_devids.h | 9 +++++++ drivers/net/txgbe/base/txgbe_hw.c | 17 +++++++++++++ drivers/net/txgbe/base/txgbe_regs.h | 4 ++- drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 35 ++++++++++++++++++++------- 5 files changed, 58 insertions(+), 10 deletions(-)
drivers/net/txgbe/base/txgbe_devids.h +9 -0
@@ -19,6 +19,15 @@#define TXGBE_DEV_ID_WX1820 0x2001#define TXGBE_DEV_ID_SP1000_VF 0x1000#define TXGBE_DEV_ID_WX1820_VF 0x2000 +#define TXGBE_DEV_ID_AML 0x5000 +#define TXGBE_DEV_ID_AML5025 0x5025 +#define TXGBE_DEV_ID_AML5125 0x5125 +#define TXGBE_DEV_ID_AML5040 0x5040 +#define TXGBE_DEV_ID_AML5140 0x5140 + +#define TXGBE_DEV_ID_AML_VF 0x5001 +#define TXGBE_DEV_ID_AML5024_VF 0x5024 +#define TXGBE_DEV_ID_AML5124_VF 0x5124/* * Subsystem IDs
drivers/net/txgbe/base/txgbe_hw.c +17 -0
@@ -2469,6 +2469,8 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) {case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: status =txgbe_init_ops_pf (hw);break ;case txgbe_mac_raptor_vf:
@@ -2506,11 +2508,26 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)case TXGBE_DEV_ID_WX1820 : hw->mac.type = txgbe_mac_raptor;break ; +case TXGBE_DEV_ID_AML : +case TXGBE_DEV_ID_AML5025 : +case TXGBE_DEV_ID_AML5125 : + hw->mac.type = txgbe_mac_aml; +break ; +case TXGBE_DEV_ID_AML5040 : +case TXGBE_DEV_ID_AML5140 : + hw->mac.type = txgbe_mac_aml40; +break ;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 ; +case TXGBE_DEV_ID_AML_VF : +case TXGBE_DEV_ID_AML5024_VF : +case TXGBE_DEV_ID_AML5124_VF : + hw->phy.media_type = txgbe_media_type_virtual; + hw->mac.type = txgbe_mac_aml_vf; +break ;default : err =TXGBE_ERR_DEVICE_NOT_SUPPORTED ;DEBUGOUT ("Unsupported device id: %x" , hw->device_id);
drivers/net/txgbe/base/txgbe_regs.h +3 -1
@@ -97,7 +97,9 @@#define TXGBE_LINK_SPEED_2_5GB_FULL 0x0400#define TXGBE_LINK_SPEED_5GB_FULL 0x0800#define TXGBE_LINK_SPEED_10GB_FULL 0x0080 -#define TXGBE_LINK_SPEED_40GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_25GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_40GB_FULL 0x0040 +#define TXGBE_LINK_SPEED_50GB_FULL 0x0200#define TXGBE_AUTOC_AUTONEG MS64(63, 0x1)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -148,7 +148,10 @@ enum txgbe_eeprom_type {enum txgbe_mac_type { txgbe_mac_unknown =0 , txgbe_mac_raptor, + txgbe_mac_aml, + txgbe_mac_aml40, txgbe_mac_raptor_vf, + txgbe_mac_aml_vf, txgbe_num_macs };
drivers/net/txgbe/txgbe_ethdev.c +26 -9
@@ -145,6 +145,11 @@ static void txgbe_l2_tunnel_conf(struct rte_eth_dev *dev);static const struct rte_pci_id pci_id_txgbe_map[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_SP1000 ) }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_WX1820 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5025 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5125 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5040 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5140 ) }, { .vendor_id =0 ,/* sentinel */ }, };
@@ -1829,8 +1834,13 @@ txgbe_dev_start(struct rte_eth_dev *dev)if (err) goto error; - allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | -RTE_ETH_LINK_SPEED_10G ; +if (hw->mac.type == txgbe_mac_aml40) + allowed_speeds =RTE_ETH_LINK_SPEED_40G ; +else if (hw->mac.type == txgbe_mac_aml) + allowed_speeds =RTE_ETH_LINK_SPEED_10G |RTE_ETH_LINK_SPEED_25G ; +else + allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | +RTE_ETH_LINK_SPEED_10G ; link_speeds = &dev->data->dev_conf.link_speeds;if (((*link_speeds) >>1 ) & ~(allowed_speeds >>1 )) {
@@ -1840,17 +1850,24 @@ txgbe_dev_start(struct rte_eth_dev *dev) speed =0x0 ;if (*link_speeds ==RTE_ETH_LINK_SPEED_AUTONEG ) { - speed = (TXGBE_LINK_SPEED_100M_FULL | -TXGBE_LINK_SPEED_1GB_FULL | -TXGBE_LINK_SPEED_10GB_FULL ); +if (hw->mac.type == txgbe_mac_aml40) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + }else if (hw->mac.type == txgbe_mac_aml) { + speed = (TXGBE_LINK_SPEED_10GB_FULL | +TXGBE_LINK_SPEED_25GB_FULL ); + }else { + speed = (TXGBE_LINK_SPEED_100M_FULL | +TXGBE_LINK_SPEED_1GB_FULL | +TXGBE_LINK_SPEED_10GB_FULL ); + } hw->autoneg = true; }else { +if (*link_speeds &RTE_ETH_LINK_SPEED_40G ) + speed |=TXGBE_LINK_SPEED_40GB_FULL ; +if (*link_speeds &RTE_ETH_LINK_SPEED_25G ) + speed |=TXGBE_LINK_SPEED_25GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_10G ) speed |=TXGBE_LINK_SPEED_10GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_5G ) - speed |=TXGBE_LINK_SPEED_5GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_2_5G ) - speed |=TXGBE_LINK_SPEED_2_5GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_1G ) speed |=TXGBE_LINK_SPEED_1GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_100M )
Signature · 1 line
2.21.0.windows.1
PATCH v2 2/15 net/txgbe: add new SW-FW mailbox interface
In reply to Zaiyu WangAmber-Lite NICs adopt new mailbox interface for software-firmware interaion to enable enhanced functionality.
--- drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_mng.c | 216 +++++++++++++++++++------- drivers/net/txgbe/base/txgbe_mng.h | 17 +- drivers/net/txgbe/base/txgbe_regs.h | 7 + drivers/net/txgbe/base/txgbe_type.h | 4 + 6 files changed, 193 insertions(+), 60 deletions(-)
drivers/net/txgbe/base/txgbe_eeprom.c +6 -1
@@ -366,8 +366,13 @@ s32 txgbe_calc_eeprom_checksum(struct txgbe_hw *hw) err = hw->rom.readw_buffer (hw, i, seg, buffer);if (err)return err; -for (j =0 ; j < seg; j++) +for (j =0 ; j < seg; j++) { +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +if (((i + j) >= (TXGBE_SHOWROM_I2C_PTR /2 )) && + ((i + j) < (TXGBE_SHOWROM_I2C_END /2 ))) + buffer[j] =0xffff ; checksum += buffer[j]; + } } checksum = (u16 )TXGBE_EEPROM_SUM - checksum + read_checksum;
drivers/net/txgbe/base/txgbe_eeprom.h +2 -0
@@ -20,6 +20,8 @@#define TXGBE_PBANUM0_PTR 0x05#define TXGBE_PBANUM1_PTR 0x06#define TXGBE_SW_REGION_PTR 0x1C +#define TXGBE_SHOWROM_I2C_PTR 0xB00 +#define TXGBE_SHOWROM_I2C_END 0xF00#define TXGBE_EE_CSUM_MAX 0x800#define TXGBE_EEPROM_CHECKSUM 0x2F
drivers/net/txgbe/base/txgbe_mng.c +160 -56
316 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_mng.h +14 -3
@@ -60,6 +60,8 @@#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376 +#define TXGBE_HIC_HDR_INDEX_MAX 255 +/* Host Interface Command Structures */ struct txgbe_hic_hdr {u8 cmd;
@@ -68,21 +70,30 @@ struct txgbe_hic_hdr {u8 cmd_resv;u8 ret_status; } cmd_or_resp; -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };struct txgbe_hic_hdr2_req {u8 cmd;u8 buf_lenh;u8 buf_lenl; -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };struct txgbe_hic_hdr2_rsp {u8 cmd;u8 buf_lenl;u8 buf_lenh_status;/* 7-5: high bits of buf_len, 4-0: status */ -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };union txgbe_hic_hdr2 {
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -263,6 +263,13 @@#define TXGBE_MNGMBXCTL_FWACK MS(3, 0x1)#define TXGBE_MNGMBX 0x01E100 +/* amlite: swfw mailbox changes */ +#define TXGBE_AML_MNG_MBOX_CTL_SW2FW 0x01E0A0 +#define TXGBE_AML_MNG_MBOX_SW2FW 0x01E200 +#define TXGBE_AML_MNG_MBOX_CTL_FW2SW 0x01E0A4 +#define TXGBE_AML_MNG_MBOX_FW2SW 0x01E300 +#define TXGBE_AML_MNG_MBOX_NOTIFY MS(31, 0x1) +/****************************************************************************** * Port Registers ******************************************************************************/
drivers/net/txgbe/base/txgbe_type.h +4 -0
@@ -821,6 +821,10 @@ struct txgbe_hw {u64 tx_qp_bytes;u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; + +/*amlite: new SW-FW mbox */ +u8 swfw_index; +rte_atomic32_t swfw_busy; };struct txgbe_backplane_ability {
Signature · 1 line
2.21.0.windows.1
PATCH v2 3/15 net/txgbe: add identification support for new SFP/QSFP modules
In reply to Zaiyu WangAdd identification support for new SFP/QSFP module types (e.g., 25G SR/CR) in the Amber-Lite NIC configuration flow.
--- drivers/net/txgbe/base/txgbe_phy.c | 92 ++++++++++++++++++++++++----- drivers/net/txgbe/base/txgbe_phy.h | 23 ++++++++ drivers/net/txgbe/base/txgbe_regs.h | 5 +- drivers/net/txgbe/base/txgbe_type.h | 12 ++++ 4 files changed, 117 insertions(+), 15 deletions(-)
drivers/net/txgbe/base/txgbe_phy.c +78 -14
@@ -774,10 +774,21 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)u8 identifier =0 ;u8 comp_codes_1g =0 ;u8 comp_codes_10g =0 ; +u8 comp_codes_25g =0 ; +u8 comp_copper_len =0 ;u8 oui_bytes[3 ] = {0 ,0 ,0 };u8 cable_tech =0 ;u8 cable_spec =0 ;u16 enforce_sfp =0 ; +u32 value; + +if (hw->mac.type == txgbe_mac_aml) { + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_ABS_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + }if (hw->phy.media_type != txgbe_media_type_fiber) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -811,6 +822,16 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)if (err !=0 ) goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_25GBE_COMP_CODES , + &comp_codes_25g); +if (err !=0 ) + goto ERR_I2C; + + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_COPPER_LENGTH , + &comp_copper_len); +if (err !=0 ) + goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_TECHNOLOGY , &cable_tech);if (err !=0 )
@@ -832,12 +853,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)* 11 SFP_1g_sx_CORE0 - chip-specific * 12 SFP_1g_sx_CORE1 - chip-specific */ -if (cable_tech &TXGBE_SFF_CABLE_DA_PASSIVE ) { -if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; -else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; - }else if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { +if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_SPEC_COMP , &cable_spec);if (err !=0 )
@@ -849,6 +865,17 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }else { hw->phy.sfp_type = txgbe_sfp_type_unknown; } + }else if (comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core1; + }else if (comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {
@@ -876,11 +903,20 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)/* Determine if the SFP+ PHY is dual speed or not. */ hw->phy.multispeed_fiber = false; -if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || - ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) - hw->phy.multispeed_fiber = true; +if (hw->mac.type == txgbe_mac_aml) { +if ((comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) && + ((comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE ) || + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }else { +if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || + ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }/* Determine PHY vendor */ if (hw->phy.type != txgbe_phy_nl) {
@@ -938,7 +974,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }/* Verify supported 1G SFP modules */ - if (comp_codes_10g == 0 && + if (comp_codes_10g == 0 && comp_codes_25g == 0 && !(hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core1 || hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core0 || hw->phy.sfp_type == txgbe_sfp_type_1g_lx_core0 ||
@@ -986,6 +1022,7 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)u8 cable_length =0 ;u8 device_tech =0 ;bool active_cable = false; +u32 value;if (hw->phy.media_type != txgbe_media_type_fiber_qsfp) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -993,6 +1030,16 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw) goto out; } +if (hw->mac.type == txgbe_mac_aml40) { +/* config GPIO before read i2c */ +wr32 (hw,TXGBE_GPIODATA ,TXGBE_GPIOBIT_1 ); + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_PRST_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + } + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_IDENTIFIER , &identifier); ERR_I2C:
@@ -1024,10 +1071,27 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)if (comp_codes_10g &TXGBE_SFF_QSFP_DA_PASSIVE_CABLE ) { hw->phy.type = txgbe_phy_qsfp_unknown_passive; +if (hw->mac.type == txgbe_mac_aml40) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core1; + }else { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + } + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_SR4 ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core1; + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_LR4 ) {if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core0;else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {if (hw->bus.lan_id ==0 )
drivers/net/txgbe/base/txgbe_phy.h +23 -0
@@ -249,6 +249,8 @@#define TXGBE_SFF_VENDOR_OUI_BYTE2 0x27#define TXGBE_SFF_1GBE_COMP_CODES 0x06#define TXGBE_SFF_10GBE_COMP_CODES 0x03 +#define TXGBE_SFF_25GBE_COMP_CODES 0x24 +#define TXGBE_SFF_COPPER_LENGTH 0x12#define TXGBE_SFF_CABLE_TECHNOLOGY 0x08#define TXGBE_SFF_CABLE_DA_PASSIVE 0x4#define TXGBE_SFF_CABLE_DA_ACTIVE 0x8
@@ -275,6 +277,23 @@#define TXGBE_SFF_1GBASET_CAPABLE 0x8#define TXGBE_SFF_10GBASESR_CAPABLE 0x10#define TXGBE_SFF_10GBASELR_CAPABLE 0x20 +#define TXGBE_SFF_25GBASESR_CAPABLE 0x2 +#define TXGBE_SFF_25GBASELR_CAPABLE 0x3 +#define TXGBE_SFF_25GBASEER_CAPABLE 0x4 +#define TXGBE_SFF_25GBASECR_91FEC 0xB +#define TXGBE_SFF_25GBASECR_74FEC 0xC +#define TXGBE_SFF_25GBASECR_NOFEC 0xD +#define TXGBE_SFF_40GBASE_SR_CAPABLE 0x10 +#define TXGBE_SFF_4x10GBASESR_CAP 0x11 +#define TXGBE_SFF_40GBASEPSM4_Parallel 0x12 +#define TXGBE_SFF_40GBASE_SWMD4_CAP 0x1f + +#define TXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_5 0x1 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_5 0x8 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_12 0x18 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_12 0x19 +#define TXGBE_SFF_SOFT_RS_SELECT_MASK 0x8#define TXGBE_SFF_SOFT_RS_SELECT_10G 0x8#define TXGBE_SFF_SOFT_RS_SELECT_1G 0x0
@@ -290,6 +309,10 @@#define TXGBE_I2C_EEPROM_STATUS_FAIL 0x2#define TXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 +#define TXGBE_SFF_40GBASE_CR4 0x8 +#define TXGBE_SFF_40GBASE_SR4 0x4 +#define TXGBE_SFF_40GBASE_LR4 0x2 +/* EEPROM for SFF-8472 (dev_addr = 0xA2) */ #define TXGBE_I2C_EEPROM_DEV_ADDR2 0xA2
drivers/net/txgbe/base/txgbe_regs.h +4 -1
@@ -1601,7 +1601,10 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C - +#define TXGBE_GPIOEXT 0x014850 +#define TXGBE_SFP1_MOD_ABS_LS MS(2, 0x1)/* GPIO_EXT SFP ABSENT*/ +#define TXGBE_SFP1_RX_LOS_LS MS(3, 0x1)/* GPIO_EXT RX LOSS */ +#define TXGBE_SFP1_MOD_PRST_LS MS(4, 0x1)/* GPIO_EXT SFP ABSENT*/ #define TXGBE_ARBPOOLIDX 0x01820C#define TXGBE_ARBTXRATE 0x018404
drivers/net/txgbe/base/txgbe_type.h +12 -0
@@ -214,6 +214,18 @@ enum txgbe_sfp_type { txgbe_sfp_type_1g_sx_core1, txgbe_sfp_type_1g_lx_core0, txgbe_sfp_type_1g_lx_core1, + txgbe_sfp_type_25g_sr_core0, + txgbe_sfp_type_25g_sr_core1, + txgbe_sfp_type_25g_lr_core0, + txgbe_sfp_type_25g_lr_core1, + txgbe_sfp_type_25g_aoc_core0, + txgbe_sfp_type_25g_aoc_core1, + txgbe_qsfp_type_40g_cu_core0, + txgbe_qsfp_type_40g_cu_core1, + txgbe_qsfp_type_40g_sr_core0, + txgbe_qsfp_type_40g_sr_core1, + txgbe_qsfp_type_40g_lr_core0, + txgbe_qsfp_type_40g_lr_core1, txgbe_sfp_type_not_present =0xFFFE , txgbe_sfp_type_not_known =0xFFFF };
Signature · 1 line
2.21.0.windows.1
PATCH v2 4/15 net/txgbe: add basic link configuration for Amber-Lite NICs
In reply to Zaiyu WangDue to Amber-Lite's significant differences from our 10G NICs, we split link configuration components (setup_link, check_link, etc.) into new files.
--- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 324 +++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 21 ++ drivers/net/txgbe/base/txgbe_aml40.c | 125 +++++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_hw.c | 78 ++++++- drivers/net/txgbe/base/txgbe_hw.h | 13 +- drivers/net/txgbe/base/txgbe_regs.h | 9 + drivers/net/txgbe/base/txgbe_type.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 8 + 10 files changed, 585 insertions(+), 17 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
drivers/net/txgbe/base/meson.build +2 -0
@@ -6,6 +6,8 @@ base_sources = files( 'txgbe_dcb.c', 'txgbe_eeprom.c', 'txgbe_hw.c', + 'txgbe_aml.c', + 'txgbe_aml40.c', 'txgbe_mbx.c', 'txgbe_mng.c', 'txgbe_phy.c',
drivers/net/txgbe/base/txgbe_aml.c new file +324 -0
324 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML_H_ +#define _TXGBE_AML_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml (struct txgbe_hw *hw, +u32 *speed, +bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw); +#endif /* _TXGBE_AML_H_ */
drivers/net/txgbe/base/txgbe_aml40.c new file +125 -0
125 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml40.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML40_H_ +#define _TXGBE_AML40_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml40 (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml40 (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml40 (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw); +#endif /* _TXGBE_AML40_H_ */
drivers/net/txgbe/base/txgbe_hw.c +66 -12
163 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_hw.h +8 -5
@@ -56,7 +56,7 @@ s32 txgbe_set_vlvf(struct txgbe_hw *hw, u32 vlan, u32 vind,s32 txgbe_clear_vfta (struct txgbe_hw *hw);s32 txgbe_find_vlvf_slot (struct txgbe_hw *hw,u32 vlan,bool vlvf_bypass); -s32 txgbe_check_mac_link (struct txgbe_hw *hw, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete);
@@ -86,10 +86,11 @@ s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg, u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);s32 txgbe_init_shared_code (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw); -s32 txgbe_init_ops_pf (struct txgbe_hw *hw); -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_init_ops_generic (struct txgbe_hw *hw); +void txgbe_init_ops_sp (struct txgbe_hw *hw); +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg); -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw); +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw);void txgbe_disable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_enable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_flap_tx_laser_multispeed_fiber (struct txgbe_hw *hw);
@@ -103,7 +104,7 @@ s32 txgbe_start_mac_link_raptor(struct txgbe_hw *hw,s32 txgbe_setup_mac_link (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw); -void txgbe_init_mac_link_ops (struct txgbe_hw *hw); +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
@@ -114,4 +115,6 @@ s32 txgbe_reinit_fdir_tables(struct txgbe_hw *hw);bool txgbe_verify_lesm_fw_enabled_raptor (struct txgbe_hw *hw);s32 txgbe_fmgr_cmd_op (struct txgbe_hw *hw,u32 cmd,u32 cmd_addr);s32 txgbe_flash_read_dword (struct txgbe_hw *hw,u32 addr,u32 *data); +s32 txgbe_e56_check_phy_link (struct txgbe_hw *hw,u32 *speed, +bool *link_up);#endif /* _TXGBE_HW_H_ */
drivers/net/txgbe/base/txgbe_regs.h +9 -0
@@ -1577,6 +1577,15 @@ enum txgbe_5tuple_protocol {#define TXGBE_PORTSTAT_BW_100M MS(3, 0x1)#define TXGBE_PORTSTAT_ID (r) RS(r, 8, 0x1) +/* amlite: diff from sapphire */ +#define TXGBE_CFG_PORT_ST_AML_LINK_MASK MS(1, 0xF) +#define TXGBE_CFG_PORT_ST_AML_LINK_10G MS(4, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_25G MS(3, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_40G MS(2, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_50G MS(1, 0x1) + +#define TXGBE_AML_PHY_LINK_UP MS(2, 0x1) +#define TXGBE_VXLAN 0x014410#define TXGBE_VXLAN_GPE 0x014414#define TXGBE_GENEVE 0x014418
drivers/net/txgbe/base/txgbe_type.h +2 -0
@@ -551,6 +551,7 @@ struct txgbe_mac_info {s32 (*prot_autoc_read)(struct txgbe_hw *hw,bool *locked,u64 *value);s32 (*prot_autoc_write)(struct txgbe_hw *hw,bool locked,u64 value);s32 (*negotiate_api_version)(struct txgbe_hw *hw,int api); +void (*init_mac_link_ops)(struct txgbe_hw *hw);/* Link */ void (*disable_tx_laser)(struct txgbe_hw *hw);
@@ -834,6 +835,7 @@ struct txgbe_hw {u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; +rte_spinlock_t phy_lock;/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy;
drivers/net/txgbe/txgbe_ethdev.c +8 -0
@@ -3068,6 +3068,14 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,case TXGBE_LINK_SPEED_10GB_FULL : link.link_speed =RTE_ETH_SPEED_NUM_10G ;break ; + +case TXGBE_LINK_SPEED_25GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_25G ; +break ; + +case TXGBE_LINK_SPEED_40GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_40G ; +break ; }/* Re configure MAC RX */
Signature · 1 line
2.21.0.windows.1
RE: [PATCH v2 04/15] net/txgbe: add basic link configuration for Amber-Lite NICs
Quoted 34 lines
drivers/net/txgbe/base/txgbe_aml.c new file +34
-0+s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw, +u32 speed, +bool autoneg_wait_to_complete) +{ +bool autoneg = false; +s32 status =0 ; +s32 ret_status =0 ; +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +int i; +u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; +u32 value =0 ; + +UNREFERENCED_PARAMETER (autoneg_wait_to_complete); + +if (hw->phy.sfp_type == txgbe_sfp_type_not_present) { +DEBUGOUT ("SFP not detected, skip setup mac link" ); +return 0 ; + } + +/* Check to see if speed passed in is supported. */ + status = hw->mac.get_link_capabilities (hw, + &link_capabilities, &autoneg); +if (status) +return status; + + speed &= link_capabilities; +if (speed ==TXGBE_LINK_SPEED_UNKNOWN ) +return TXGBE_ERR_LINK_SETUP ; + + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value & (TXGBE_SFP1_MOD_ABS_LS |TXGBE_SFP1_RX_LOS_LS )) +return status; +
drivers/net/txgbe/base/txgbe_aml.c line 177
Quoted 10 lines
drivers/net/txgbe/base/txgbe_aml.c new file +10
-0+for (i =0 ; i <4 ; i++) { +txgbe_e56_check_phy_link (hw, &link_speed, &link_up); +if (link_up) +break ; +msleep (250 ); + } + +if (link_speed == speed && link_up && + !(speed ==TXGBE_LINK_SPEED_25GB_FULL )) +return status;
speed != TXGBE_LINK_SPEED_25GB_FULL
Quoted 4 lines
drivers/net/txgbe/base/txgbe_aml.c new file +4
-0+ +rte_spinlock_lock (&hw->phy_lock); + ret_status =0 ; +rte_spinlock_unlock (&hw->phy_lock);
drivers/net/txgbe/base/txgbe_aml.c line 191
Quoted 10 lines
drivers/net/txgbe/base/txgbe_aml.c new file +10
-0+ +if (ret_status ==TXGBE_ERR_PHY_INIT_NOT_DONE ) +return status; + +for (i =0 ; i <4 ; i++) { +txgbe_e56_check_phy_link (hw, &link_speed, &link_up); +if (link_up) +return status; +msleep (250 ); + }
Double tab.
Quoted 22 lines
drivers/net/txgbe/base/txgbe_aml.c new file +22
-0+ +return status; +} + +/** +* txgbe_setup_mac_link_multispeed_fiber_aml - Set MAC link speed +* @hw: pointer to hardware structure +* @speed: new link speed +* @autoneg_wait_to_complete: true when waiting for completion is needed +* +* Set the link speed in the MAC and/or PHY register and restarts link. +**/ +static s32 txgbe_setup_mac_link_multispeed_fiber_aml (struct txgbe_hw *hw, +u32 speed, +bool autoneg_wait_to_complete) +{ +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +u32 highest_link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +s32 status =0 ; +u32 speedcnt =0 ; +bool autoneg, link_up = false; +
drivers/net/txgbe/base/txgbe_aml.c line 223
Quoted 10 lines
drivers/net/txgbe/base/txgbe_aml.c new file +10
-0+/* Mask off requested but non-supported speeds */ + status = hw->mac.get_link_capabilities (hw, &link_speed, &autoneg); +if (status !=0 ) +return status; + + speed &= link_speed; + +/* Try each speed one by one, highest priority first. We do this in +* software because 10Gb fiber doesn't support speed autonegotiation. +*/
Neither 25Gb fiber.
drivers/net/txgbe/base/txgbe_aml.c line 234
Quoted 11 lines
drivers/net/txgbe/base/txgbe_aml.c new file +11
-0+if (speed &TXGBE_LINK_SPEED_25GB_FULL ) { + speedcnt++; + highest_link_speed =TXGBE_LINK_SPEED_25GB_FULL ; + +/* If we already have link at this speed, just jump out */ +txgbe_e56_check_phy_link (hw, &link_speed, &link_up); + +if ((link_speed ==TXGBE_LINK_SPEED_25GB_FULL ) && link_up) + goto out; + +/* Allow module to change analog characteristics (1G->10G) */
10G -> 25G
Quoted 203 lines
drivers/net/txgbe/base/txgbe_aml.c new file +66
-0+msec_delay (40 ); + + status = hw->mac.setup_mac_link (hw, +TXGBE_LINK_SPEED_25GB_FULL , + autoneg_wait_to_complete); +if (status !=0 ) +return status; + +/*aml wait link in setup,no need to repeatly wait*/ +/* If we have link, just jump out */ +txgbe_e56_check_phy_link (hw, &link_speed, &link_up); + +if (link_up) + goto out; + + } + +if (speed &TXGBE_LINK_SPEED_10GB_FULL ) { + speedcnt++; +if (highest_link_speed ==TXGBE_LINK_SPEED_UNKNOWN ) + highest_link_speed =TXGBE_LINK_SPEED_10GB_FULL ; + +/* If we already have link at this speed, just jump out */ +txgbe_e56_check_phy_link (hw, &link_speed, &link_up); + +if ((link_speed ==TXGBE_LINK_SPEED_10GB_FULL ) && link_up) + goto out; + +/* Allow module to change analog characteristics (25G->10G) */ +msec_delay (40 ); + + status = hw->mac.setup_mac_link (hw,TXGBE_LINK_SPEED_10GB_FULL , + autoneg_wait_to_complete); +if (status !=0 ) +return status; + +/*aml wait link in setup,no need to repeatly wait*/ +/* If we have link, just jump out */ +txgbe_e56_check_phy_link (hw, &link_speed, &link_up); + +if (link_up) + goto out; + } + +/* We didn't get link. Configure back to the highest speed we tried, +* (if there was more than one). We call ourselves back with just the +* single highest speed that the user requested. +*/ +if (speedcnt >1 ) + status =txgbe_setup_mac_link_multispeed_fiber_aml (hw, + highest_link_speed, + autoneg_wait_to_complete); + +out: +/* Set autoneg_advertised value based on input link speed */ + hw->phy.autoneg_advertised =0 ; + +if (speed &TXGBE_LINK_SPEED_25GB_FULL ) + hw->phy.autoneg_advertised |=TXGBE_LINK_SPEED_25GB_FULL ; + +if (speed &TXGBE_LINK_SPEED_10GB_FULL ) + hw->phy.autoneg_advertised |=TXGBE_LINK_SPEED_10GB_FULL ; + +return status; +} +drivers/net/txgbe/base/txgbe_hw.c +31
-11@@ -11,6 +11,8 @@#include "txgbe_eeprom.h" #include "txgbe_mng.h" #include "txgbe_hw.h" +#include "txgbe_aml.h" +#include "txgbe_aml40.h" #define TXGBE_RAPTOR_MAX_TX_QUEUES 128#define TXGBE_RAPTOR_MAX_RX_QUEUES 128@@ -1906,7 +1908,7 @@ static bool txgbe_need_crosstalk_fix(struct txgbe_hw *hw)* * Reads the links register to determine if link is up and the current speed **/ -s32 txgbe_check_mac_link (struct txgbe_hw *hw,u32 *speed, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete) {u32 links_reg, links_orig;@@ -2459,7 +2461,7 @@ s32 txgbe_setup_mac_link_multispeed_fiber(struct txgbe_hw *hw,**/ s32 txgbe_init_shared_code (struct txgbe_hw *hw) { -s32 status; +s32 status =0 ;/* * Set the mac type @@ -2469,11 +2471,16 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) {case txgbe_mac_raptor: +txgbe_init_ops_sp (hw); +break ;case txgbe_mac_aml: +txgbe_init_ops_aml (hw); +break ;case txgbe_mac_aml40: - status =txgbe_init_ops_pf (hw); +txgbe_init_ops_aml40 (hw);break ;case txgbe_mac_raptor_vf: +case txgbe_mac_aml_vf: status =txgbe_init_ops_vf (hw);break ;default :@@ -2539,7 +2546,7 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)return err; } -void txgbe_init_mac_link_ops (struct txgbe_hw *hw) +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw) {struct txgbe_mac_info *mac = &hw->mac;@@ -2599,7 +2606,7 @@ s32 txgbe_init_phy_raptor(struct txgbe_hw *hw) goto init_phy_ops_out;/* Setup function pointers based on detected SFP module and speeds */ -txgbe_init_mac_link_ops (hw); + hw->mac.init_mac_link_ops (hw);/* If copper media, overwrite with copper function pointers */ if (phy->media_type == txgbe_media_type_copper) {@@ -2634,7 +2641,7 @@ s32 txgbe_setup_sfp_modules(struct txgbe_hw *hw)if (hw->phy.sfp_type == txgbe_sfp_type_unknown)return 0 ; -txgbe_init_mac_link_ops (hw); + hw->mac.init_mac_link_ops (hw);/* PHY config will finish before releasing the semaphore */ err = hw->mac.acquire_swfw_sync (hw,TXGBE_MNGSEM_SWPHY );@@ -2781,7 +2788,7 @@ s32 txgbe_flash_read_dword(struct txgbe_hw *hw, u32 addr, u32 *data)* Initialize the function pointers and assign the MAC type. * Does not touch the hardware. **/ -s32 txgbe_init_ops_pf (struct txgbe_hw *hw) +s32 txgbe_init_ops_generic (struct txgbe_hw *hw) {struct txgbe_bus_info *bus = &hw->bus;struct txgbe_mac_info *mac = &hw->mac;@@ -2793,7 +2800,6 @@ s32 txgbe_init_ops_pf(struct txgbe_hw *hw) bus->set_lan_id = txgbe_set_lan_id_multi_port;/* PHY */ - phy->get_media_type = txgbe_get_media_type_raptor; phy->identify = txgbe_identify_phy; phy->init = txgbe_init_phy_raptor; phy->read_reg = txgbe_read_phy_reg;@@ -2861,8 +2867,6 @@ s32 txgbe_init_ops_pf(struct txgbe_hw *hw) mac->fc_autoneg = txgbe_fc_autoneg;/* Link */ - mac->get_link_capabilities = txgbe_get_link_capabilities_raptor; - mac->check_link = txgbe_check_mac_link; mac->setup_pba = txgbe_set_pba;/* Manageability interface */ @@ -2901,6 +2905,22 @@ s32 txgbe_init_ops_pf(struct txgbe_hw *hw)return 0 ; } +void txgbe_init_ops_sp (struct txgbe_hw *hw) +{ +struct txgbe_mac_info *mac = &hw->mac; +struct txgbe_phy_info *phy = &hw->phy; + +txgbe_init_ops_generic (hw); + +/* PHY */ + phy->get_media_type = txgbe_get_media_type_sp; + +/* LINK */ + mac->init_mac_link_ops = txgbe_init_mac_link_ops_sp; + mac->get_link_capabilities = txgbe_get_link_capabilities_sp; + mac->check_link = txgbe_check_mac_link_sp; +} +/** * txgbe_get_link_capabilities_raptor - Determines link capabilities * @hw: pointer to hardware structure @@ -2909,7 +2929,7 @@ s32 txgbe_init_ops_pf(struct txgbe_hw *hw)* * Determines the link capabilities by reading the AUTOC register. **/ -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg) {
drivers/net/txgbe/base/txgbe_hw.c s32 txgbe_get_link_capabilities_raptor(struct txgbe_hw *hw, · line 3038
Quoted 5 lines
drivers/net/txgbe/base/txgbe_hw.c +1
-1@@ -3015,7 +3035,7 @@ s32 txgbe_get_link_capabilities_raptor(struct txgbe_hw *hw,* * Returns the media type (fiber, copper, backplane) **/ -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw) +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw)
I think it should be a separate patch to cleanup codes: *_raptor -> *_sp
Quoted 85 lines
drivers/net/txgbe/base/txgbe_hw.c +34
-0{u32 media_type;@@ -3849,3 +3869,37 @@ s32 txgbe_reset_pipeline_raptor(struct txgbe_hw *hw)return err; } +s32 txgbe_e56_check_phy_link (struct txgbe_hw *hw,u32 *speed, +bool *link_up) +{ +u32 rdata =0 ; +u32 links_reg =0 ; + +/* must read it twice because the state may +* not be correct the first time you read it +*/ + rdata =rd32_epcs (hw,0x30001 ); + rdata =rd32_epcs (hw,0x30001 ); + +if (rdata &TXGBE_AML_PHY_LINK_UP ) + *link_up = true; +else + *link_up = false; + + links_reg =rd32 (hw,TXGBE_PORTSTAT ); +if (*link_up) { +if ((links_reg &TXGBE_CFG_PORT_ST_AML_LINK_40G ) == +TXGBE_CFG_PORT_ST_AML_LINK_40G ) + *speed =TXGBE_LINK_SPEED_40GB_FULL ; +else if ((links_reg &TXGBE_CFG_PORT_ST_AML_LINK_25G ) == +TXGBE_CFG_PORT_ST_AML_LINK_25G ) + *speed =TXGBE_LINK_SPEED_25GB_FULL ; +else if ((links_reg &TXGBE_CFG_PORT_ST_AML_LINK_10G ) == +TXGBE_CFG_PORT_ST_AML_LINK_10G ) + *speed =TXGBE_LINK_SPEED_10GB_FULL ; + }else { + *speed =TXGBE_LINK_SPEED_UNKNOWN ; + } + +return 0 ; +}drivers/net/txgbe/base/txgbe_hw.h +8
-5@@ -56,7 +56,7 @@ s32 txgbe_set_vlvf(struct txgbe_hw *hw, u32 vlan, u32 vind,s32 txgbe_clear_vfta (struct txgbe_hw *hw);s32 txgbe_find_vlvf_slot (struct txgbe_hw *hw,u32 vlan,bool vlvf_bypass); -s32 txgbe_check_mac_link (struct txgbe_hw *hw, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete);@@ -86,10 +86,11 @@ s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg, u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);s32 txgbe_init_shared_code (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw); -s32 txgbe_init_ops_pf (struct txgbe_hw *hw); -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_init_ops_generic (struct txgbe_hw *hw); +void txgbe_init_ops_sp (struct txgbe_hw *hw); +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg); -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw); +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw);void txgbe_disable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_enable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_flap_tx_laser_multispeed_fiber (struct txgbe_hw *hw);@@ -103,7 +104,7 @@ s32 txgbe_start_mac_link_raptor(struct txgbe_hw *hw,s32 txgbe_setup_mac_link (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw); -void txgbe_init_mac_link_ops (struct txgbe_hw *hw); +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);@@ -114,4 +115,6 @@ s32 txgbe_reinit_fdir_tables(struct txgbe_hw *hw);bool txgbe_verify_lesm_fw_enabled_raptor (struct txgbe_hw *hw);s32 txgbe_fmgr_cmd_op (struct txgbe_hw *hw,u32 cmd,u32 cmd_addr);s32 txgbe_flash_read_dword (struct txgbe_hw *hw,u32 addr,u32 *data); +s32 txgbe_e56_check_phy_link (struct txgbe_hw *hw,u32 *speed, +bool *link_up);#endif /* _TXGBE_HW_H_ */
PATCH v2 5/15 net/txgbe: add support for PHY configuration via SW-FW mailbox
In reply to Zaiyu WangMigrate Amber-Lite PHY configuration to firmware due to complexity. Driver now sends mailbox commands for link state changes, handled by firmware’s intricate PHY setup process
--- drivers/net/txgbe/base/txgbe_aml.c | 52 ++++++++++++++++------------ drivers/net/txgbe/base/txgbe_aml40.c | 37 +++++++++++++++++++- drivers/net/txgbe/base/txgbe_hw.c | 1 + drivers/net/txgbe/base/txgbe_mng.c | 36 +++++++++++++++++++ drivers/net/txgbe/base/txgbe_mng.h | 17 +++++++++ drivers/net/txgbe/base/txgbe_type.h | 7 ++++ 6 files changed, 126 insertions(+), 24 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +29 -23
@@ -131,21 +131,37 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +{ +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +int cnt =0 ; +int i; + +if (speed ==TXGBE_LINK_SPEED_25GB_FULL ) + cnt =4 ; +else + cnt =1 ; + +for (i =0 ; i < (4 * cnt); i++) { + hw->mac.check_link (hw, &link_speed, &link_up, false); +if (link_up) +break ; +msleep (250 ); + } +} +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete) {bool autoneg = false;s32 status =0 ; -s32 ret_status =0 ;u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false; -int i;u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ;u32 value =0 ; -UNREFERENCED_PARAMETER (autoneg_wait_to_complete); -if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );return 0 ;
@@ -165,30 +181,20 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw,if (value & (TXGBE_SFP1_MOD_ABS_LS |TXGBE_SFP1_RX_LOS_LS ))return status; -for (i =0 ; i <4 ; i++) { -txgbe_e56_check_phy_link (hw, &link_speed, &link_up); -if (link_up) -break ; -msleep (250 ); - } + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); -if (link_speed == speed && link_up && - !(speed ==TXGBE_LINK_SPEED_25GB_FULL )) +if (link_speed == speed && link_up)return status; -rte_spinlock_lock (&hw->phy_lock); - ret_status =0 ; -rte_spinlock_unlock (&hw->phy_lock); +if (speed &TXGBE_LINK_SPEED_25GB_FULL ) + speed =0x10 ; +else if (speed &TXGBE_LINK_SPEED_10GB_FULL ) + speed =0x08 ; -if (ret_status ==TXGBE_ERR_PHY_INIT_NOT_DONE ) -return status; + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); -for (i =0 ; i <4 ; i++) { -txgbe_e56_check_phy_link (hw, &link_speed, &link_up); -if (link_up) -return status; -msleep (250 ); - } +txgbe_wait_for_link_up_aml (hw, speed);return status; }
drivers/net/txgbe/base/txgbe_aml40.c +36 -1
@@ -106,7 +106,42 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 speed, bool autoneg_wait_to_complete) { -return 0 ; + bool autoneg = false; +s32 status =0 ; +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; +u32 value =0 ; + +if (hw->phy.sfp_type == txgbe_sfp_type_not_present) { +DEBUGOUT ("SFP not detected, skip setup mac link" ); +return 0 ; + } + +/* Check to see if speed passed in is supported. */ + status = hw->mac.get_link_capabilities (hw, + &link_capabilities, &autoneg); +if (status) +return status; + + speed &= link_capabilities; +if (speed ==TXGBE_LINK_SPEED_UNKNOWN ) +return TXGBE_ERR_LINK_SETUP ; + + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); + +if (link_speed == speed && link_up) +return status; + +if (speed &TXGBE_LINK_SPEED_40GB_FULL ) + speed =0x20 ; + + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); + +txgbe_wait_for_link_up_aml (hw, speed); + +return status; }void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw)
drivers/net/txgbe/base/txgbe_hw.c +1 -0
@@ -2819,6 +2819,7 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) phy->write_i2c_byte_unlocked = txgbe_write_i2c_byte_unlocked; phy->check_overtemp = txgbe_check_overtemp; phy->reset = txgbe_reset_phy; + phy->set_link_hostif = txgbe_hic_ephy_set_link;/* MAC */ mac->init_hw = txgbe_init_hw;
drivers/net/txgbe/base/txgbe_mng.c +36 -0
@@ -590,3 +590,39 @@ s32 txgbe_hic_set_lldp(struct txgbe_hw *hw, bool on)return txgbe_host_interface_command (hw, (u32 *)&buffer,sizeof (buffer),TXGBE_HI_COMMAND_TIMEOUT , false); } + +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex) +{ +struct txgbe_hic_ephy_setlink buffer; +s32 status; +int i; + + buffer.hdr.cmd =FW_PHY_CONFIG_LINK_CMD ; + buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); + buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; + + buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.speed = speed; + buffer.autoneg = autoneg; + buffer.duplex = duplex; + +for (i =0 ; i <=FW_CEM_MAX_RETRIES ; i++) { + status =txgbe_host_interface_command (hw, (u32 *)&buffer, +sizeof (buffer), +TXGBE_HI_COMMAND_TIMEOUT_SHORT , true); +if (status !=0 ) { +msleep (1 ); +continue ; + } + +if (buffer.hdr.cmd_or_resp.ret_status == +FW_CEM_RESP_STATUS_SUCCESS ) + status =0 ; +else + status =TXGBE_ERR_HOST_INTERFACE_COMMAND ; + +break ; + } + +return status; +}
drivers/net/txgbe/base/txgbe_mng.h +17 -0
@@ -13,6 +13,7 @@#define TXGBE_PMMBX_BSIZE (TXGBE_PMMBX_QSIZE * 4)#define TXGBE_PMMBX_DATA_SIZE (TXGBE_PMMBX_BSIZE - FW_NVM_DATA_OFFSET * 4)#define TXGBE_HI_COMMAND_TIMEOUT 5000/* Process HI command limit */ +#define TXGBE_HI_COMMAND_TIMEOUT_SHORT 500/* Process HI command limit */ #define TXGBE_HI_FLASH_ERASE_TIMEOUT 5000/* Process Erase command limit */ #define TXGBE_HI_FLASH_UPDATE_TIMEOUT 5000/* Process Update command limit */ #define TXGBE_HI_FLASH_VERIFY_TIMEOUT 60000/* Process Apply command limit */
@@ -56,6 +57,12 @@#define FW_LLDP_GET_CMD 0xF2#define FW_LLDP_SET_CMD_OFF 0xF1#define FW_LLDP_SET_CMD_ON 0xF0 +#define FW_PHY_CONFIG_READ_CMD 0xc0 +#define FW_PHY_CONFIG_LINK_CMD 0xc1 +#define FW_PHY_CONFIG_FC_CMD 0xc2 +#define FW_PHY_CONFIG_POWER_CMD 0xc3 +#define FW_PHY_CONFIG_RESET_CMD 0xc4 +#define FW_READ_SFP_INFO_CMD 0xc5#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376
@@ -101,6 +108,15 @@ union txgbe_hic_hdr2 {struct txgbe_hic_hdr2_rsp rsp; }; +struct txgbe_hic_ephy_setlink { +struct txgbe_hic_hdr hdr; +u8 speed; +u8 duplex; +u8 autoneg; +u8 fec_mode; +u8 resv[4 ]; +}; +struct txgbe_hic_drv_info {struct txgbe_hic_hdr hdr;u8 port_num;
@@ -204,5 +220,6 @@ bool txgbe_mng_present(struct txgbe_hw *hw);bool txgbe_mng_enabled (struct txgbe_hw *hw);s32 txgbe_hic_get_lldp (struct txgbe_hw *hw);s32 txgbe_hic_set_lldp (struct txgbe_hw *hw,bool on); +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);#endif /* _TXGBE_MNG_H_ */
drivers/net/txgbe/base/txgbe_type.h +7 -0
@@ -688,6 +688,7 @@ struct txgbe_phy_info { u8 *value);s32 (*write_i2c_byte_unlocked)(struct txgbe_hw *hw,u8 offset,u8 addr,u8 value); +s32 (*set_link_hostif)(struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);enum txgbe_phy_type type;u32 addr;
@@ -771,6 +772,12 @@ enum txgbe_isb_idx {TXGBE_ISB_MAX }; +#define TXGBE_PHY_FEC_RS MS(0, 0x1) +#define TXGBE_PHY_FEC_BASER MS(1, 0x1) +#define TXGBE_PHY_FEC_OFF MS(2, 0x1) +#define TXGBE_PHY_FEC_AUTO (TXGBE_PHY_FEC_OFF | TXGBE_PHY_FEC_BASER |\ + TXGBE_PHY_FEC_RS) +struct txgbe_devargs {u16 auto_neg;u16 poll;
Signature · 1 line
2.21.0.windows.1
RE: [PATCH v2 05/15] net/txgbe: add support for PHY configuration via SW-FW mailbox
Quoted 5 lines
Subject: [PATCH v2 05/15] net/txgbe: add support for PHY configuration via SW-FW mailbox
Migrate Amber-Lite PHY configuration to firmware due to complexity. Driver now sends mailbox commands for link state changes, handled by firmware’s intricate PHY setup process
This patch removes what was added by the previous patch. I don't understand why. Why not simply merge these into the previous patch. Or just configure nothing there.
And...
Quoted 58 lines
Signed-off-by Zaiyu Wang <[email protected]>--- drivers/net/txgbe/base/txgbe_aml.c | 52 ++++++++++++++++------------ drivers/net/txgbe/base/txgbe_aml40.c | 37 +++++++++++++++++++- drivers/net/txgbe/base/txgbe_hw.c | 1 + drivers/net/txgbe/base/txgbe_mng.c | 36 +++++++++++++++++++ drivers/net/txgbe/base/txgbe_mng.h | 17 +++++++++ drivers/net/txgbe/base/txgbe_type.h | 7 ++++ 6 files changed, 126 insertions(+), 24 deletions(-)drivers/net/txgbe/base/txgbe_aml.c +20
-4@@ -131,21 +131,37 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +{ +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +int cnt =0 ; +int i; + +if (speed ==TXGBE_LINK_SPEED_25GB_FULL ) + cnt =4 ; +else + cnt =1 ; + +for (i =0 ; i < (4 * cnt); i++) { + hw->mac.check_link (hw, &link_speed, &link_up, false); +if (link_up) +break ; +msleep (250 ); + } +} +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete) {bool autoneg = false;s32 status =0 ; -s32 ret_status =0 ;u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false; -int i;u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ;u32 value =0 ; -UNREFERENCED_PARAMETER (autoneg_wait_to_complete); -if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );return 0 ;
drivers/net/txgbe/base/txgbe_aml.c s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw, · line 173
Quoted 9 lines
drivers/net/txgbe/base/txgbe_aml.c +0
-6@@ -165,30 +181,20 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw,if (value & (TXGBE_SFP1_MOD_ABS_LS |TXGBE_SFP1_RX_LOS_LS ))return status; -for (i =0 ; i <4 ; i++) { -txgbe_e56_check_phy_link (hw, &link_speed, &link_up); -if (link_up) -break ; -msleep (250 ); - }
txgbe_e56_check_phy_link() is deleted here, but still be invoked in txgbe_setup_mac_link_multispeed_fiber_aml() ?
Quoted 66 lines
drivers/net/txgbe/base/txgbe_aml.c +9
-13+ status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); -if (link_speed == speed && link_up && - !(speed ==TXGBE_LINK_SPEED_25GB_FULL )) +if (link_speed == speed && link_up)return status; -rte_spinlock_lock (&hw->phy_lock); - ret_status =0 ; -rte_spinlock_unlock (&hw->phy_lock); +if (speed &TXGBE_LINK_SPEED_25GB_FULL ) + speed =0x10 ; +else if (speed &TXGBE_LINK_SPEED_10GB_FULL ) + speed =0x08 ; -if (ret_status ==TXGBE_ERR_PHY_INIT_NOT_DONE ) -return status; + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); -for (i =0 ; i <4 ; i++) { -txgbe_e56_check_phy_link (hw, &link_speed, &link_up); -if (link_up) -return status; -msleep (250 ); - } +txgbe_wait_for_link_up_aml (hw, speed);return status; }drivers/net/txgbe/base/txgbe_aml40.c +27
-1@@ -106,7 +106,42 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 speed, bool autoneg_wait_to_complete) { -return 0 ; + bool autoneg = false; +s32 status =0 ; +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; +u32 value =0 ; + +if (hw->phy.sfp_type == txgbe_sfp_type_not_present) { +DEBUGOUT ("SFP not detected, skip setup mac link" ); +return 0 ; + } + +/* Check to see if speed passed in is supported. */ + status = hw->mac.get_link_capabilities (hw, + &link_capabilities, &autoneg); +if (status) +return status; + + speed &= link_capabilities; +if (speed ==TXGBE_LINK_SPEED_UNKNOWN ) +return TXGBE_ERR_LINK_SETUP ; + + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); + +if (link_speed == speed && link_up) +return status;
drivers/net/txgbe/base/txgbe_aml40.c s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw, · line 145
Quoted 10 lines
drivers/net/txgbe/base/txgbe_aml40.c +9
-0+ +if (speed &TXGBE_LINK_SPEED_40GB_FULL ) + speed =0x20 ; + + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); + +txgbe_wait_for_link_up_aml (hw, speed); + +return status; }
The commit log does not explain why aml40 should be configured in this patch.
PATCH v2 6/15 net/txgbe: add RX&TX support for Amber-Lite NICs
In reply to Zaiyu WangThe packet handling workflow largely reuses the existing 10G NIC’s process, so we adjusted driver conditional checks rather than making major changes to the overall flow.
--- drivers/net/txgbe/base/txgbe_aml.c | 2 +- drivers/net/txgbe/base/txgbe_aml.h | 1 + drivers/net/txgbe/base/txgbe_aml40.c | 1 - drivers/net/txgbe/base/txgbe_hw.c | 27 ++++++++++++ drivers/net/txgbe/base/txgbe_hw.h | 2 + drivers/net/txgbe/base/txgbe_regs.h | 30 +++++++++++++ drivers/net/txgbe/txgbe_ethdev.c | 12 ++++-- drivers/net/txgbe/txgbe_rxtx.c | 64 +++++++++++++++------------- 8 files changed, 104 insertions(+), 35 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +1 -1
@@ -131,7 +131,7 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } -static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;
drivers/net/txgbe/base/txgbe_aml.h +1 -0
@@ -15,6 +15,7 @@ s32 txgbe_check_mac_link_aml(struct txgbe_hw *hw,s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw,u32 *speed,bool *autoneg);u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed);s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_aml40.c +0 -1
@@ -111,7 +111,6 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; -u32 value =0 ;if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );
drivers/net/txgbe/base/txgbe_hw.c +27 -0
@@ -20,6 +20,7 @@#define TXGBE_RAPTOR_MC_TBL_SIZE 128#define TXGBE_RAPTOR_VFT_TBL_SIZE 128#define TXGBE_RAPTOR_RX_PB_SIZE 512/*KB*/ +#define TXGBE_AML_RX_PB_SIZE 768 static s32 txgbe_setup_copper_link_raptor(struct txgbe_hw *hw, u32 speed,
@@ -2494,6 +2495,29 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)return status; } +int txgbe_is_vf (struct txgbe_hw *hw) +{ +switch (hw->mac.type) { +case txgbe_mac_raptor_vf: +case txgbe_mac_aml_vf: +return 1 ; +default : +return 0 ; + } +} + +int txgbe_is_pf (struct txgbe_hw *hw) +{ +switch (hw->mac.type) { +case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: +return 1 ; +default : +return 0 ; + } +} +/** * txgbe_set_mac_type - Sets MAC type * @hw: pointer to the HW structure
@@ -2903,6 +2927,9 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) mac->max_rx_queues =TXGBE_RAPTOR_MAX_RX_QUEUES ; mac->max_tx_queues =TXGBE_RAPTOR_MAX_TX_QUEUES ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) + mac->rx_pb_size =TXGBE_AML_RX_PB_SIZE ; +return 0 ; }
drivers/net/txgbe/base/txgbe_hw.h +2 -0
@@ -85,6 +85,8 @@ void txgbe_set_mta(struct txgbe_hw *hw, u8 *mc_addr);s32 txgbe_negotiate_fc (struct txgbe_hw *hw,u32 adv_reg,u32 lp_reg,u32 adv_sym,u32 adv_asm,u32 lp_sym,u32 lp_asm);s32 txgbe_init_shared_code (struct txgbe_hw *hw); +int txgbe_is_vf (struct txgbe_hw *hw); +int txgbe_is_pf (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw);s32 txgbe_init_ops_generic (struct txgbe_hw *hw);void txgbe_init_ops_sp (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +30 -0
@@ -318,12 +318,18 @@#define TXGBE_LEDCTL_1G MS(2, 0x1)#define TXGBE_LEDCTL_100M MS(3, 0x1)#define TXGBE_LEDCTL_ACTIVE MS(4, 0x1) +#define TXGBE_LINKUP_FILTER 0x014428#define TXGBE_TAGTPID (i) (0x014430 + (i) * 4)/* 0-3 */ #define TXGBE_TAGTPID_LSB_MASK MS(0, 0xFFFF)#define TXGBE_TAGTPID_LSB (v) LS(v, 0, 0xFFFF)#define TXGBE_TAGTPID_MSB_MASK MS(16, 0xFFFF)#define TXGBE_TAGTPID_MSB (v) LS(v, 16, 0xFFFF) +/*AML LINK STATUS OVERWRITE*/ +#define TXGBE_AML_EPCS_MISC_CTL 0x13240 +#define TXGBE_AML_LINK_STATUS_OVRD_EN 0x00000020 +#define TXGBE_AML_LINK_STATUS_OVRD_VAL 0x00000010 +/** * GPIO Control * P0: link speed change
@@ -1389,6 +1395,7 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_HTHRESH_MASK MS(8, 0xF)#define TXGBE_TXCFG_HTHRESH (v) LS(v, 8, 0xF)#define TXGBE_TXCFG_WTHRESH_MASK MS(16, 0x7F) +#define TXGBE_TXCFG_WTHRESH_MASK_AML MS(16, 0x1FF)#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F)#define TXGBE_TXCFG_FLUSH MS(26, 0x1)
@@ -1634,6 +1641,16 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBRXCTL_WSP MS(2, 0x1)#define TXGBE_ARBRXCTL_DIA MS(6, 0x1) +#define TXGBE_RDM_VF_RE (_i) (0x12004 + ((_i) * 4)) +#define TXGBE_RDM_VFRE_CLR (_i) (0x120A0 + ((_i) * 4)) +#define TXGBE_RDM_RSC_CTL 0x1200C +/* amlite: rdm_rsc_ctl_free_ctl */ +#define TXGBE_RDM_RSC_CTL_FREE_CTL MS(7, 0x1) +#define TXGBE_RDM_RSC_CTL_FREE_CNT_DIS MS(8, 0x1) +#define TXGBE_RDM_ARB_CFG (_i) (0x12040 + ((_i) * 4))/* 8 of these (0-7) */ +#define TXGBE_RDM_PF_QDE (_i) (0x12080 + ((_i) * 4)) +#define TXGBE_RDM_PF_HIDE (_i) (0x12090 + ((_i) * 4)) +#define TXGBE_RPUP2TC 0x019008#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7
@@ -1708,6 +1725,19 @@ enum txgbe_5tuple_protocol {#define TXGBE_MACTXCFG_SPEED_10G LS(0, 29, 0x3)#define TXGBE_MACTXCFG_SPEED_1G LS(3, 29, 0x3) +#define TXGBE_MAC_TX_CFG_AML_SPEED_MASK 0x78000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_50G 0x20000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_40G 0x00000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_25G 0x10000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_10G 0x40000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_1G 0x70000000U + +#define TXGBE_MAC_MISC_CTL 0x11f00 +#define TXGBE_MAC_MISC_LINK_STS_MOD MS(0, 0x1) +#define TXGBE_LINK_BOTH_PCS_MAC MS(0, 0x1) + +#define TXGBE_EPHY_STAT 0x13404 +#define TXGBE_EPHY_STAT_PPL_LOCK 0x3#define TXGBE_ISBADDRL 0x000160#define TXGBE_ISBADDRH 0x000164
drivers/net/txgbe/txgbe_ethdev.c +9 -3
@@ -385,7 +385,7 @@ txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,uint32_t q_map;uint8_t n, offset; -if (hw->mac.type != txgbe_mac_raptor) +if (!txgbe_is_pf (hw))return -ENOSYS ;if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK )
@@ -1806,7 +1806,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) }/* Skip link setup if loopback mode is enabled. */ -if (hw->mac.type == txgbe_mac_raptor && +if (txgbe_is_pf (hw) && dev->data->dev_conf.lpbk_mode) goto skip_link_setup;
@@ -2816,6 +2816,7 @@ txgbe_dev_sfp_event(struct rte_eth_dev *dev)wr32 (hw,TXGBE_GPIOINTMASK ,0xFF ); reg =rd32 (hw,TXGBE_GPIORAWINTSTAT ); +if (reg &TXGBE_GPIOBIT_0 )wr32 (hw,TXGBE_GPIOEOI ,TXGBE_GPIOBIT_0 );if (reg &TXGBE_GPIOBIT_2 ) {
@@ -3078,8 +3079,13 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,break ; } +/* enable mac receiver */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); + } +/* Re configure MAC RX */ -if (hw->mac.type == txgbe_mac_raptor) { +if (txgbe_is_pf (hw)) { reg =rd32 (hw,TXGBE_MACRXCFG );wr32 (hw,TXGBE_MACRXCFG , reg); wr32m(hw, TXGBE_MACRXFLT, TXGBE_MACRXFLT_PROMISC,
drivers/net/txgbe/txgbe_rxtx.c +34 -30
162 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v2 7/15 net/txgbe: add hardware reset change for Amber-Lite NICs
In reply to Zaiyu WangAdd necessary configurations for Amber-Lite's hardware reset process, which differs from the 10G NIC's. These configurations may be modified in future to accommodate further changes.
--- drivers/net/txgbe/base/txgbe_hw.c | 72 ++++++++++++++++++++++------- drivers/net/txgbe/base/txgbe_regs.h | 2 + 2 files changed, 58 insertions(+), 16 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +56 -16
@@ -267,6 +267,8 @@ s32 txgbe_start_hw(struct txgbe_hw *hw)/* Cache bit indicating need for crosstalk fix */ switch (hw->mac.type) {case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: hw->mac.get_device_caps (hw, &device_caps);if (device_caps &TXGBE_DEVICE_CAPS_NO_CROSSTALK_WR ) hw->need_crosstalk_fix = false;
@@ -3500,13 +3502,37 @@ txgbe_reset_misc(struct txgbe_hw *hw) {int i;u32 value; +int err =0 ; +u32 speed;wr32 (hw,TXGBE_ISBADDRL , hw->isb_dma &0x00000000FFFFFFFF );wr32 (hw,TXGBE_ISBADDRH , hw->isb_dma >>32 ); - value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); -if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) - hw->link_status =TXGBE_LINK_STATUS_NONE ; +if (hw->mac.type == txgbe_mac_aml) { +if ((rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK ) + !=TXGBE_EPHY_STAT_PPL_LOCK ) { + speed =TXGBE_LINK_SPEED_25GB_FULL + |TXGBE_LINK_SPEED_10GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else if (hw->mac.type == txgbe_mac_aml40) { +if (!(rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK )) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else { + value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); +if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) + hw->link_status =TXGBE_LINK_STATUS_NONE ; + }/* receive packets that size > 2048 */ wr32m(hw, TXGBE_MACRXCFG,
@@ -3596,9 +3622,10 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)if (!hw->phy.reset_disable) hw->phy.reset (hw); -/* remember AUTOC from before we reset */ - autoc = hw->mac.autoc_read (hw); - +if (hw->mac.type == txgbe_mac_raptor) { +/* remember AUTOC from before we reset */ + autoc = hw->mac.autoc_read (hw); + } mac_reset_top:/* Do LAN reset, the MNG domain will not be reset. */ wr32 (hw,TXGBE_RST ,TXGBE_RST_LAN (hw->bus.lan_id));
@@ -3629,16 +3656,28 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw) goto mac_reset_top; } -/* -* Store the original AUTOC/AUTOC2 values if they have not been -* stored off yet. Otherwise restore the stored original -* values since the reset operation sets back to defaults. -*/ -if (!hw->mac.orig_link_settings_stored) { - hw->mac.orig_autoc = hw->mac.autoc_read (hw); - hw->mac.orig_link_settings_stored = true; +/* amlite TODO*/ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_LINKUP_FILTER ,30 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); +/* amlite: bme */ +wr32 (hw,TXGBE_PX_PF_BME ,TXGBE_PX_PF_BME_EN ); +/* amlite: rdm_rsc_ctl_free_ctl set to 1 */ +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); }else { - hw->mac.orig_autoc = autoc; +/* +* Store the original AUTOC/AUTOC2 values if they have not been +* stored off yet. Otherwise restore the stored original +* values since the reset operation sets back to defaults. +*/ +if (!hw->mac.orig_link_settings_stored) { + hw->mac.orig_autoc = hw->mac.autoc_read (hw); + hw->mac.orig_link_settings_stored = true; + }else { + hw->mac.orig_autoc = autoc; + } }if (hw->phy.ffe_set) {
@@ -3646,7 +3685,8 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)msec_delay (50 );/* A temporary solution to set phy */ -txgbe_set_phy_temp (hw); +if (hw->mac.type == txgbe_mac_raptor) +txgbe_set_phy_temp (hw); }/* Store the permanent mac address */
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1236,6 +1236,8 @@ enum txgbe_5tuple_protocol { TXGBE_ICRMISC_LNKUP)#define TXGBE_ICSMISC 0x000104#define TXGBE_IENMISC 0x000108 +#define TXGBE_PX_PF_BME 0x0004B8 +#define TXGBE_PX_PF_BME_EN MS(0, 0x1)#define TXGBE_IVARMISC 0x0004FC#define TXGBE_IVARMISC_VEC (v) LS(v, 0, 0x7)#define TXGBE_IVARMISC_VLD MS(7, 0x1)
Signature · 1 line
2.21.0.windows.1
PATCH v2 8/15 net/txgbe: add MAC reconfiguration to avoid packet loss
In reply to Zaiyu WangThere was a bug that RX will lose the first packet when down/up port.
When PHY is configured, mac error code is reported to the MAC layer, and MAC locked this status without unlocking. As a result, when the first packet is reveived, MAC reports this error code and RDB dismissed this packet.
Do MAC reset can clean MAC error code so we can fix this bug.
--- drivers/net/txgbe/base/txgbe_hw.c | 37 +++++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_hw.h | 1 + drivers/net/txgbe/base/txgbe_regs.h | 2 ++ drivers/net/txgbe/txgbe_ethdev.c | 1 + 4 files changed, 41 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +37 -0
@@ -3497,6 +3497,43 @@ txgbe_check_flash_load(struct txgbe_hw *hw, u32 check_bit)return err; } +int txgbe_reconfig_mac (struct txgbe_hw *hw) +{ +u32 mac_wdg_timeout; +u32 mac_flow_ctrl; + + mac_wdg_timeout =rd32 (hw,TXGBE_MAC_WDG_TIMEOUT ); + mac_flow_ctrl =rd32 (hw,TXGBE_RXFCCFG ); + +if (hw->bus.lan_id ==0 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_0 ); +else if (hw->bus.lan_id ==1 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_1 ); + +/* wait for mac reset complete */ +usec_delay (1500 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); + +/* receive packets that size > 2048 */ +wr32m (hw,TXGBE_MACRXCFG , +TXGBE_MACRXCFG_JUMBO ,TXGBE_MACRXCFG_JUMBO ); + +/* clear counters on read */ +wr32m (hw,TXGBE_MACCNTCTL , +TXGBE_MACCNTCTL_RC ,TXGBE_MACCNTCTL_RC ); + +wr32m (hw,TXGBE_RXFCCFG , +TXGBE_RXFCCFG_FC ,TXGBE_RXFCCFG_FC ); + +wr32 (hw,TXGBE_MACRXFLT ,TXGBE_MACRXFLT_PROMISC ); + +wr32 (hw,TXGBE_MAC_WDG_TIMEOUT , mac_wdg_timeout); +wr32 (hw,TXGBE_RXFCCFG , mac_flow_ctrl); + +return 0 ; +} +static void txgbe_reset_misc (struct txgbe_hw *hw) {
drivers/net/txgbe/base/txgbe_hw.h +1 -0
@@ -107,6 +107,7 @@ s32 txgbe_setup_mac_link(struct txgbe_hw *hw, u32 speed, bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw);void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw); +int txgbe_reconfig_mac (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -158,6 +158,8 @@#define TXGBE_RST_SW MS(0, 0x1)#define TXGBE_RST_LAN (i) MS(((i) + 1), 0x1)#define TXGBE_RST_FW MS(3, 0x1) +#define TXGBE_RST_MAC_LAN_1 MS(17, 0x1) +#define TXGBE_RST_MAC_LAN_0 MS(20, 0x1)#define TXGBE_RST_ETH (i) MS(((i) + 29), 0x1)#define TXGBE_RST_GLB MS(31, 0x1)#define TXGBE_RST_DEFAULT (TXGBE_RST_SW | \
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -3081,6 +3081,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,/* enable mac receiver */ if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +txgbe_reconfig_mac (hw);wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); }
Signature · 1 line
2.21.0.windows.1
PATCH v2 9/15 net/txgbe: add TX head Write-Back mode for Amber-Lite NICs
In reply to Zaiyu WangAdd TX head Write-Back mode for Amber-Lite NICs. When enabled, the hardware no longer individually rewrites descriptors but intermittently notifies the driver of processed descriptor indices. This feature significantly improves performance and is enabled by default in the driver. Users can configure it via tx_headwb and tx_headwb_size in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 7 ++ drivers/net/txgbe/base/txgbe_type.h | 6 ++ drivers/net/txgbe/txgbe_ethdev.c | 9 ++ drivers/net/txgbe/txgbe_rxtx.c | 126 ++++++++++++++++++---- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +++-- 6 files changed, 151 insertions(+), 27 deletions(-)
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -1402,6 +1402,13 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_WTHRESH_MASK_AML MS(16, 0x1FF)#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F)#define TXGBE_TXCFG_FLUSH MS(26, 0x1) +#define TXGBE_PX_TR_CFG_HEAD_WB MS(27, 0x1)/* amlite head wb */ +#define TXGBE_PX_TR_CFG_HEAD_WB_64BYTE MS(28, 0x1)/* amlite head wb 64byte */ +#define TXGBE_PX_TR_CFG_HEAD_WB_MASK MS(27, 0x3) + +/* amlite: tx head wb */ +#define TXGBE_PX_TR_HEAD_ADDRL (_i) (0x03028 + ((_i) * 0x40)) +#define TXGBE_PX_TR_HEAD_ADDRH (_i) (0x0302C + ((_i) * 0x40))#define TXGBE_TDM_DESC_CHK (i) (0x0180B0 + (i) * 4)/*0-3*/ #define TXGBE_TDM_DESC_NONFATAL (i) (0x0180C0 + (i) * 4)/*0-3*/
drivers/net/txgbe/base/txgbe_type.h +6 -0
@@ -723,6 +723,8 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_MAIN "ffe_main"#define TXGBE_DEVARG_FFE_PRE "ffe_pre"#define TXGBE_DEVARG_FFE_POST "ffe_post" +#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb" +#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -733,6 +735,8 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_MAIN ,TXGBE_DEVARG_FFE_PRE ,TXGBE_DEVARG_FFE_POST , +TXGBE_DEVARG_TX_HEAD_WB , +TXGBE_DEVARG_TX_HEAD_WB_SIZE , NULL };
@@ -783,6 +787,8 @@ struct txgbe_devargs {u16 poll;u16 present;u16 sgmii; +u16 tx_headwb; +u16 tx_headwb_size; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +9 -0
@@ -513,6 +513,9 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)u16 ffe_main =27 ;u16 ffe_pre =8 ;u16 ffe_post =44 ; +/* New devargs for amberlite config */ +u16 tx_headwb =1 ; +u16 tx_headwb_size =16 ;if (devargs ==NULL ) goto null;
@@ -537,6 +540,10 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &ffe_pre);rte_kvargs_process (kvlist,TXGBE_DEVARG_FFE_POST , &txgbe_handle_devarg, &ffe_post); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB , + &txgbe_handle_devarg, &tx_headwb); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , + &txgbe_handle_devarg, &tx_headwb_size);rte_kvargs_free (kvlist); null:
@@ -544,6 +551,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.poll = poll; hw->devarg.present = present; hw->devarg.sgmii = sgmii; + hw->devarg.tx_headwb = tx_headwb; + hw->devarg.tx_headwb_size = tx_headwb_size; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
drivers/net/txgbe/txgbe_rxtx.c +106 -20
173 lines not on this page · raw message
drivers/net/txgbe/txgbe_rxtx.h +3 -0
@@ -414,6 +414,9 @@ struct txgbe_tx_queue {const struct rte_memzone *mz;uint64_t desc_error;bool resetting; +const struct rte_memzone *headwb; +uint64_t headwb_dma; +volatile uint32_t *headwb_mem; };struct txgbe_txq_ops {
drivers/net/txgbe/txgbe_rxtx_vec_common.h +20 -7
@@ -89,13 +89,26 @@ txgbe_tx_free_bufs(struct txgbe_tx_queue *txq)int nb_free =0 ;struct rte_mbuf *m, *free[RTE_TXGBE_TX_MAX_FREE_BUF_SZ ]; -/* check DD bit on threshold descriptor */ - status = txq->tx_ring[txq->tx_next_dd].dw3; -if (!(status &TXGBE_TXD_DD )) { -if (txq->nb_tx_free >>1 < txq->tx_free_thresh) -txgbe_set32_masked (txq->tdc_reg_addr, -TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); -return 0 ; +if (txq->headwb_mem) { +uint16_t tx_last_dd = txq->nb_tx_desc + + txq->tx_next_dd - txq->tx_free_thresh; +if (tx_last_dd >= txq->nb_tx_desc) + tx_last_dd -= txq->nb_tx_desc; +volatile uint16_t head = (uint16_t )*(txq->headwb_mem); +if (txq->tx_next_dd > head && head > tx_last_dd) +return 0 ; +else if (tx_last_dd > txq->tx_next_dd && + (head > tx_last_dd || head < txq->tx_next_dd)) +return 0 ; + }else { +/* check DD bit on threshold descriptor */ + status = txq->tx_ring[txq->tx_next_dd].dw3; +if (!(status &TXGBE_TXD_DD )) { +if (txq->nb_tx_free >>1 < txq->tx_free_thresh) +txgbe_set32_masked (txq->tdc_reg_addr, +TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); +return 0 ; + } } n = txq->tx_free_thresh;
Signature · 1 line
2.21.0.windows.1
RE: [PATCH v2 09/15] net/txgbe: add TX head Write-Back mode for Amber-Lite NICs
Quoted 57 lines
drivers/net/txgbe/base/txgbe_type.h +6
-0@@ -723,6 +723,8 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_MAIN "ffe_main"#define TXGBE_DEVARG_FFE_PRE "ffe_pre"#define TXGBE_DEVARG_FFE_POST "ffe_post" +#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb" +#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,@@ -733,6 +735,8 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_MAIN ,TXGBE_DEVARG_FFE_PRE ,TXGBE_DEVARG_FFE_POST , +TXGBE_DEVARG_TX_HEAD_WB , +TXGBE_DEVARG_TX_HEAD_WB_SIZE , NULL };@@ -783,6 +787,8 @@ struct txgbe_devargs {u16 poll;u16 present;u16 sgmii; +u16 tx_headwb; +u16 tx_headwb_size; };struct txgbe_hw {drivers/net/txgbe/txgbe_ethdev.c +7
-0@@ -513,6 +513,9 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)u16 ffe_main =27 ;u16 ffe_pre =8 ;u16 ffe_post =44 ; +/* New devargs for amberlite config */ +u16 tx_headwb =1 ; +u16 tx_headwb_size =16 ;if (devargs ==NULL ) goto null;@@ -537,6 +540,10 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &ffe_pre);rte_kvargs_process (kvlist,TXGBE_DEVARG_FFE_POST , &txgbe_handle_devarg, &ffe_post); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB , + &txgbe_handle_devarg, &tx_headwb); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , + &txgbe_handle_devarg, &tx_headwb_size);rte_kvargs_free (kvlist); null:
drivers/net/txgbe/txgbe_ethdev.c txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) · line 558
Quoted 8 lines
drivers/net/txgbe/txgbe_ethdev.c +2
-0@@ -544,6 +551,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.poll = poll; hw->devarg.present = present; hw->devarg.sgmii = sgmii; + hw->devarg.tx_headwb = tx_headwb; + hw->devarg.tx_headwb_size = tx_headwb_size; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
Add the strings into RTE_PMD_REGISTER_PARAM_STRING().
Quoted 29 lines
drivers/net/txgbe/txgbe_rxtx.c +13
-8@@ -92,14 +92,29 @@ txgbe_tx_free_bufs(struct txgbe_tx_queue *txq)int i, nb_free =0 ;struct rte_mbuf *m, *free[RTE_TXGBE_TX_MAX_FREE_BUF_SZ ]; -/* check DD bit on threshold descriptor */ - status = txq->tx_ring[txq->tx_next_dd].dw3; -if (!(status &rte_cpu_to_le_32 (TXGBE_TXD_DD ))) { -if (txq->nb_tx_free >>1 < txq->tx_free_thresh) -txgbe_set32_masked (txq->tdc_reg_addr, -TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); -return 0 ; - } +if (txq->headwb_mem) { +uint16_t tx_last_dd = txq->nb_tx_desc + + txq->tx_next_dd - txq->tx_free_thresh; +if (tx_last_dd >= txq->nb_tx_desc) + tx_last_dd -= txq->nb_tx_desc; + +volatile uint16_t head = (uint16_t )*(txq->headwb_mem); + +if (txq->tx_next_dd > head && head > tx_last_dd) +return 0 ; +else if (tx_last_dd > txq->tx_next_dd && + (head > tx_last_dd || head < txq->tx_next_dd)) +return 0 ;
drivers/net/txgbe/txgbe_rxtx.c txgbe_tx_free_bufs(struct txgbe_tx_queue *txq) · line 117
Quoted 10 lines
drivers/net/txgbe/txgbe_rxtx.c +10
-0+ }else { +/* check DD bit on threshold descriptor */ + status = txq->tx_ring[txq->tx_next_dd].dw3; +if (!(status &rte_cpu_to_le_32 (TXGBE_TXD_DD ))) { +if (txq->nb_tx_free >>1 < txq->tx_free_thresh) +txgbe_set32_masked (txq->tdc_reg_addr, +TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); +return 0 ; + } +}
TAB
PATCH v2 10/15 net/txgbe: add RX desc merge mode for Amber-Lite NICs
In reply to Zaiyu WangAdd RX desc merge mode for Amber-Lite NICs. When enabled, the hardware batch-processes RX packets, significantly enhancing performance. This feature is enabled by default in the driver and can be configured via the rx_desc_merge parameter in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 4 ++++ drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 4 ++++ drivers/net/txgbe/txgbe_rxtx.c | 11 +++++++++++ 4 files changed, 22 insertions(+)
drivers/net/txgbe/base/txgbe_regs.h +4 -0
@@ -1373,6 +1373,7 @@ enum txgbe_5tuple_protocol {#define TXGBE_RXCFG_HDRLEN (v) LS(HDRLEN(v), 12, 0xF)#define TXGBE_RXCFG_HDRLEN_MASK MS(12, 0xF)#define TXGBE_RXCFG_WTHRESH (v) LS(v, 16, 0x7) +#define TXGBE_RXCFG_DESC_MERGE MS(19, 0x1)#define TXGBE_RXCFG_ETAG MS(22, 0x1)#define TXGBE_RXCFG_RSCMAX_MASK MS(23, 0x3)#define TXGBE_RXCFG_RSCMAX_1 LS(0, 23, 0x3)
@@ -1666,6 +1667,9 @@ enum txgbe_5tuple_protocol {#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7 +#define TXGBE_RDM_DCACHE_CTL 0x0120A8 +#define TXGBE_RDM_DCACHE_CTL_EN MS(0, 0x1) +/* mac switcher */ #define TXGBE_ETHADDRL 0x016200#define TXGBE_ETHADDRL_AD0 (v) LS(v, 0, 0xFF)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -725,6 +725,7 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_POST "ffe_post"#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb"#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size" +#define TXGBE_DEVARG_RX_DESC_MERGE "rx_desc_merge"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -737,6 +738,7 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_POST ,TXGBE_DEVARG_TX_HEAD_WB ,TXGBE_DEVARG_TX_HEAD_WB_SIZE , +TXGBE_DEVARG_RX_DESC_MERGE , NULL };
@@ -789,6 +791,7 @@ struct txgbe_devargs {u16 sgmii;u16 tx_headwb;u16 tx_headwb_size; +u16 rx_desc_merge; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +4 -0
@@ -516,6 +516,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)/* New devargs for amberlite config */ u16 tx_headwb =1 ;u16 tx_headwb_size =16 ; +u16 rx_desc_merge =1 ;if (devargs ==NULL ) goto null;
@@ -544,6 +545,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &tx_headwb);rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , &txgbe_handle_devarg, &tx_headwb_size); +rte_kvargs_process (kvlist,TXGBE_DEVARG_RX_DESC_MERGE , + &txgbe_handle_devarg, &rx_desc_merge);rte_kvargs_free (kvlist); null:
@@ -553,6 +556,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.sgmii = sgmii; hw->devarg.tx_headwb = tx_headwb; hw->devarg.tx_headwb_size = tx_headwb_size; + hw->devarg.rx_desc_merge = rx_desc_merge; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
drivers/net/txgbe/txgbe_rxtx.c +11 -0
@@ -4649,6 +4649,17 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev) buf_size =ROUND_DOWN (buf_size,0x1 <<10 ); srrctl |=TXGBE_RXCFG_PKTLEN (buf_size); +if ((hw->mac.type == txgbe_mac_aml || + hw->mac.type == txgbe_mac_aml40) && hw->devarg.rx_desc_merge ==1 ) { + srrctl |=TXGBE_RXCFG_DESC_MERGE ; + +wr32 (hw,TXGBE_RDM_DCACHE_CTL ,TXGBE_RDM_DCACHE_CTL_EN ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CNT_DIS , + ~TXGBE_RDM_RSC_CTL_FREE_CNT_DIS ); + } +wr32 (hw,TXGBE_RXCFG (rxq->reg_idx), srrctl);/* It adds dual VLAN length for supporting dual VLAN */
Signature · 1 line
2.21.0.windows.1
PATCH v2 11/15 net/txgbe: add FEC support for Amber-Lite 25G NICs
In reply to Zaiyu WangAmber-Lite 25G NICs support four FEC modes (off, baser, rs, auto). The driver implements standard interfaces (fec_get_capability, fec_get, fec_set) to allow manual configuration. The default FEC mode is set to 'auto'.
--- drivers/net/txgbe/base/txgbe_aml.c | 27 ++++++- drivers/net/txgbe/base/txgbe_hw.c | 3 + drivers/net/txgbe/base/txgbe_mng.c | 2 +- drivers/net/txgbe/base/txgbe_phy.h | 1 + drivers/net/txgbe/base/txgbe_type.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 121 ++++++++++++++++++++++++++++ 6 files changed, 154 insertions(+), 2 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +26 -1
@@ -131,6 +131,26 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static int +txgbe_phy_fec_get (struct txgbe_hw *hw) +{ +int value =0 ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_RS_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x4 ) +return TXGBE_PHY_FEC_RS ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_KR_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x1 ) +return TXGBE_PHY_FEC_BASER ; + +return TXGBE_PHY_FEC_OFF ; +} +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;
@@ -184,7 +204,12 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw, status = hw->mac.check_link (hw, &link_speed, &link_up, autoneg_wait_to_complete); -if (link_speed == speed && link_up) +if (link_up && speed ==TXGBE_LINK_SPEED_25GB_FULL ) + hw->cur_fec_link =txgbe_phy_fec_get (hw); + +if (link_speed == speed && link_up && + !(speed ==TXGBE_LINK_SPEED_25GB_FULL && + !(hw->fec_mode & hw->cur_fec_link)))return status;if (speed &TXGBE_LINK_SPEED_25GB_FULL )
drivers/net/txgbe/base/txgbe_hw.c +3 -0
@@ -329,6 +329,9 @@ s32 txgbe_init_hw(struct txgbe_hw *hw)txgbe_disable_lldp (hw); +/* Init fec mode to 'AUTO' */ + hw->fec_mode =TXGBE_PHY_FEC_AUTO ; +/* Reset the hardware */ status = hw->mac.reset_hw (hw);if (status ==0 || status ==TXGBE_ERR_SFP_NOT_PRESENT ) {
drivers/net/txgbe/base/txgbe_mng.c +1 -1
@@ -601,7 +601,7 @@ s32 txgbe_hic_ephy_set_link(struct txgbe_hw *hw, u8 speed, u8 autoneg, u8 duplex buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; - buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.fec_mode = hw->fec_mode; buffer.speed = speed; buffer.autoneg = autoneg; buffer.duplex = duplex;
drivers/net/txgbe/base/txgbe_phy.h +1 -0
@@ -40,6 +40,7 @@#define SR_PMA_KR_LD_CESTS_RR MS16(15, 0x1)#define SR_PMA_KR_FEC_CTRL 0x0100AB#define SR_PMA_KR_FEC_CTRL_EN MS16(0, 0x1) +#define SR_PMA_RS_FEC_CTRL 0x0100C8#define SR_MII_MMD_CTL 0x1F0000#define SR_MII_MMD_CTL_AN_EN 0x1000#define SR_MII_MMD_CTL_RESTART_AN 0x0200
drivers/net/txgbe/base/txgbe_type.h +2 -0
@@ -855,6 +855,8 @@ struct txgbe_hw {/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy; +u32 fec_mode; +u32 cur_fec_link; };struct txgbe_backplane_ability {
drivers/net/txgbe/txgbe_ethdev.c +121 -0
142 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v2 12/15 net/txgbe: add GPIO configuration
In reply to Zaiyu WangAdd GPIO configuration for Amber-Lite NICs to match design differences from 10G NICs: The Amber-Lite NIC requires additional setup steps compared to 10G NICs to ensure proper functionality of features SFP module detection.
--- drivers/net/txgbe/base/txgbe_regs.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 111 ++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1626,6 +1626,8 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTEN 0x014830#define TXGBE_GPIOINTMASK 0x014834#define TXGBE_GPIOINTTYPE 0x014838 +#define TXGBE_GPIO_INT_POLARITY 0x01483C +#define TXGBE_GPIO_INT_POLARITY_3 MS(3, 0x1)#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C
drivers/net/txgbe/txgbe_ethdev.c +111 -0
158 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v2 13/15 net/txgbe: disable unstable features
In reply to Zaiyu WangTemporarily disabled unstable features on Amber-Lite NICs (e.g., flow control). These incomplete features will be gradually completed in future driver updates.
--- drivers/net/txgbe/base/txgbe_hw.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +7 -0
@@ -144,6 +144,10 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw)u32 value =0 ;u64 reg_bp =0 ; +/* amlite-to-do */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +return 0 ; +/* Validate the requested mode */ if (hw->fc.strict_ieee && hw->fc.requested_mode == txgbe_fc_rx_pause) {DEBUGOUT ("txgbe_fc_rx_pause not valid in strict IEEE mode" );
@@ -3235,6 +3239,9 @@ void txgbe_set_hard_rate_select_speed(struct txgbe_hw *hw,u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA );switch (speed) { +case TXGBE_LINK_SPEED_25GB_FULL : +/* amlite-to-do */ +break ;case TXGBE_LINK_SPEED_10GB_FULL : esdp_reg |= (TXGBE_GPIOBIT_4 |TXGBE_GPIOBIT_5 );break ;
Signature · 1 line
2.21.0.windows.1
PATCH v2 14/15 net/txgbe: add other hardware-related changes
In reply to Zaiyu WangAdd other hardware-related changes for Amber-Lite NICs, such as PF queue rate limit, enable/disable tx laser.
--- drivers/net/txgbe/base/txgbe_hw.c | 113 +++++++++++++++++++++------ drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 35 +++++++++ drivers/net/txgbe/base/txgbe_regs.h | 23 ++++++ drivers/net/txgbe/base/txgbe_type.h | 27 +++++++ drivers/net/txgbe/txgbe_ethdev.c | 72 ++++++++++++++--- 6 files changed, 238 insertions(+), 34 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +90 -23
@@ -2213,27 +2213,56 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw)* * Returns the thermal sensor data structure **/ +#define PHYINIT_TIMEOUT 1000s32 txgbe_get_thermal_sensor_data (struct txgbe_hw *hw) {struct txgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;s64 tsv;u32 ts_stat; +u32 data_code; +int temp_data, temp_fraction; +int i =0 ;/* Only support thermal sensors attached to physical port 0 */ if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; - ts_stat =rd32 (hw,TXGBE_TSSTAT ); - tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); - tsv = tsv >1200 ? tsv :1200 ; - tsv = -(48380 <<8 ) /1000 - + tsv * (31020 <<8 ) /100000 - - tsv * tsv * (18201 <<8 ) /100000000 - + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 - - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; - tsv >>=8 ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0001 ); - data->sensor[0 ].temp = (s16 )tsv; +while (1 ) { + data_code =rd32 (hw,TXGBE_AML_TS_STS ); +if ((data_code &TXGBE_AML_TS_STS_VLD ) !=0 ) +break ; +msleep (1 ); +if (i++ >PHYINIT_TIMEOUT ) { +PMD_DRV_LOG (ERR ,"ERROR: Wait 0x1033c Timeout!!!" ); +return -1 ; + } + } + + data_code = data_code &0xFFF ; + temp_data =419400 +2205 * (data_code *1000 /4094 -500 ); + +/* Change double Temperature to int */ + tsv = temp_data /10000 ; + temp_fraction = temp_data - (tsv *10000 ); +if (temp_fraction >=5000 ) + tsv +=1 ; + data->sensor[0 ].temp = (s16 )tsv; + }else { + ts_stat =rd32 (hw,TXGBE_TSSTAT ); + tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); + tsv = tsv >1200 ? tsv :1200 ; + tsv = -(48380 <<8 ) /1000 + + tsv * (31020 <<8 ) /100000 + - tsv * tsv * (18201 <<8 ) /100000000 + + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 + - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; + tsv >>=8 ; + + data->sensor[0 ].temp = (s16 )tsv; + }return 0 ; }
@@ -2254,16 +2283,32 @@ s32 txgbe_init_thermal_sensor_thresh(struct txgbe_hw *hw)if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; -wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); -wr32 (hw,TXGBE_TSINTR , -TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); -wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); - - data->sensor[0 ].alarm_thresh =100 ; -wr32 (hw,TXGBE_TSATHRE ,677 ); data->sensor[0 ].dalarm_thresh =90 ; -wr32 (hw,TXGBE_TSDTHRE ,614 ); + +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0 ); +wr32 (hw,TXGBE_AML_INTR_RAW_LO ,TXGBE_AML_INTR_CL_LO ); +wr32 (hw,TXGBE_AML_INTR_RAW_HI ,TXGBE_AML_INTR_CL_HI ); + +wr32 (hw,TXGBE_AML_INTR_HIGH_EN ,TXGBE_AML_INTR_EN_HI ); +wr32 (hw,TXGBE_AML_INTR_LOW_EN ,TXGBE_AML_INTR_EN_LO ); + +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_EVAL_MODE_MASK ,0x10 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_ALARM_THRE_MASK ,0x186a0000 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_DALARM_THRE_MASK ,0x16f60 ); +wr32 (hw,TXGBE_AML_TS_ENA ,0x1 ); + }else { +wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); +wr32 (hw,TXGBE_TSINTR , +TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); +wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); + + data->sensor[0 ].alarm_thresh =100 ; +wr32 (hw,TXGBE_TSATHRE ,677 ); + data->sensor[0 ].dalarm_thresh =90 ; +wr32 (hw,TXGBE_TSDTHRE ,614 ); + }return 0 ; }
@@ -3172,12 +3217,28 @@ void txgbe_disable_tx_laser_multispeed_fiber(struct txgbe_hw *hw) {u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA ); -if (txgbe_close_notify (hw)) -txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | -TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); +if (txgbe_close_notify (hw)) { +/* over write led when ifconfig down */ +if (hw->mac.type == txgbe_mac_aml40) { +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_40G | +TXGBE_AMLITE_LED_LINK_ACTIVE ); + }else if (hw->mac.type == txgbe_mac_aml) +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_25G | +TXGBE_AMLITE_LED_LINK_10G |TXGBE_AMLITE_LED_LINK_ACTIVE ); +else +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | +TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); + }/* Disable Tx laser; allow 100us to go dark per spec */ - esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg &= ~TXGBE_GPIOBIT_1 ; + }else if (hw->mac.type == txgbe_mac_aml) { + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);usec_delay (100 );
@@ -3199,7 +3260,13 @@ void txgbe_enable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)wr32 (hw,TXGBE_LEDCTL ,0 );/* Enable Tx laser; allow 100ms to light up */ - esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);msec_delay (100 );
drivers/net/txgbe/base/txgbe_osdep.h +2 -0
@@ -162,6 +162,8 @@ static inline u64 REVERT_BIT_MASK64(u64 mask) ((mask &0xFFFFFFFF00000000 ) >>32 ); } +#define BIT (nr) (1UL << (nr)) +#define IOMEM #define prefetch (x) rte_prefetch0(x)
drivers/net/txgbe/base/txgbe_phy.c +35 -0
@@ -173,6 +173,41 @@ s32 txgbe_get_phy_id(struct txgbe_hw *hw)u32 err;u16 phy_id_high =0 ;u16 phy_id_low =0 ; +u32 i =0 ; +u32 status; + +if (hw->mac.type == txgbe_mac_aml) { + hw->phy.addr =0 ; + +for (i =0 ; i <32 ; i++) { + hw->phy.addr = i; + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_HIGH ,0 , &phy_id_high); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 1" ); +return status; + } +DEBUGOUT ("%d: phy_id_high 0x%x" , i, phy_id_high); +if ((phy_id_high &0xFFFF ) ==0x0141 ) +break ; + } + +if (i ==32 ) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed" ); +return TXGBE_ERR_PHY ; + } + + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_LOW ,0 , &phy_id_low); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 2" ); +return status; + } + hw->phy.id = (u32)(phy_id_high &0xFFFF ) <<6 ; + hw->phy.id |= (u32)((phy_id_low &0xFC00 ) >>10 ); + +DEBUGOUT ("phy_id 0x%x" , hw->phy.id); + +return status; + } err = hw->phy.read_reg(hw, TXGBE_MD_PHY_ID_HIGH, TXGBE_MD_DEV_PMA_PMD,
drivers/net/txgbe/base/txgbe_regs.h +23 -0
@@ -302,6 +302,17 @@#define TXGBE_PORT_LINK1000M MS(2, 0x1)#define TXGBE_PORT_LINK100M MS(3, 0x1)#define TXGBE_PORT_LANID (r) RS(r, 8, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL MS(5, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL MS(4, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL MS(3, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL MS(2, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL MS(1, 0x1) +#define TXGBE_AMLITE_LED_LINK_ACTIVE TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL +#define TXGBE_AMLITE_LED_LINK_10G TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL +#define TXGBE_AMLITE_LED_LINK_25G TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL +#define TXGBE_AMLITE_LED_LINK_40G TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL +#define TXGBE_AMLITE_LED_LINK_50G TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL +#define TXGBE_EXTAG 0x014408#define TXGBE_EXTAG_ETAG_MASK MS(0, 0xFFFF)#define TXGBE_EXTAG_ETAG (v) LS(v, 0, 0xFFFF)
@@ -1641,6 +1652,18 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBTXRATE_MIN (v) LS(v, 0, 0x3FFF)#define TXGBE_ARBTXRATE_MAX (v) LS(v, 16, 0x3FFF) +#define TXGBE_TDM_RL_QUEUE_IDX 0x018210 +#define TXGBE_TDM_RL_QUEUE_CFG 0x018214 +#define TXGBE_TDM_FACTOR_INT_MASK MS(16, 0xFFFF) +#define TXGBE_TDM_FACTOR_FRA_MASK MS(0, 0xFFFC) +#define TXGBE_TDM_FACTOR_INT_SHIFT 16 +#define TXGBE_TDM_FACTOR_FRA_SHIFT 2 + +#define TXGBE_TDM_RL_VM_IDX 0x018218 +#define TXGBE_TDM_RL_VM_CFG 0x01821C +#define TXGBE_TDM_RL_CFG 0x018400 +#define TXGBE_TDM_RL_EN MS(0, 0x1) +/* qos */ #define TXGBE_ARBTXCTL 0x018200#define TXGBE_ARBTXCTL_RRM MS(1, 0x1)
drivers/net/txgbe/base/txgbe_type.h +27 -0
@@ -37,6 +37,33 @@#include "txgbe_osdep.h" #include "txgbe_devids.h" +/* Sensors for AMLITE PVT(Process Voltage Temperature) */ +#define TXGBE_AML_INTR_RAW_HI 0x10300 +#define TXGBE_AML_INTR_RAW_ME 0x10304 +#define TXGBE_AML_INTR_RAW_LO 0x10308 +#define TXGBE_AML_TS_CTL1 0x10330 +#define TXGBE_AML_TS_CTL2 0x10334 +#define TXGBE_AML_TS_ENA 0x10338 +#define TXGBE_AML_TS_STS 0x1033C +#define TXGBE_AML_INTR_HIGH_EN 0x10318 +#define TXGBE_AML_INTR_MED_EN 0x1031C +#define TXGBE_AML_INTR_LOW_EN 0x10320 +#define TXGBE_AML_INTR_HIGH_STS 0x1030C +#define TXGBE_AML_INTR_MED_STS 0x10310 +#define TXGBE_AML_INTR_LOW_STS 0x10314 + +#define TXGBE_AML_TS_STS_VLD 0x00001000U +#define TXGBE_AML_INTR_EN_HI 0x00000002U +#define TXGBE_AML_INTR_EN_ME 0x00000001U +#define TXGBE_AML_INTR_EN_LO 0x00000001U +#define TXGBE_AML_INTR_CL_HI 0x00000002U +#define TXGBE_AML_INTR_CL_ME 0x00000001U +#define TXGBE_AML_INTR_CL_LO 0x00000001U +#define TXGBE_AML_EVAL_MODE_MASK 0x00000010U +#define TXGBE_AML_CAL_MODE_MASK 0x00000008U +#define TXGBE_AML_ALARM_THRE_MASK 0x1FFE0000U +#define TXGBE_AML_DALARM_THRE_MASK 0x0001FFE0U +struct txgbe_thermal_diode_data {s16 temp;s16 alarm_thresh;
drivers/net/txgbe/txgbe_ethdev.c +61 -11
101 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v2 15/15 doc: update for txgbe
In reply to Zaiyu WangAdd new types of Wangxun NICs into txgbe supported NICs list.
--- doc/guides/nics/txgbe.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
doc/guides/nics/txgbe.rst +6 -2
@@ -4,8 +4,12 @@ TXGBE Poll Mode Driver ====================== -The TXGBE PMD (librte_pmd_txgbe) provides poll mode driver support -for Wangxun 10 Gigabit Ethernet NICs. +Supported NICs +-------- + +- Wangxun 10 Gigabit Ethernet NICs +- Wangxun 25 Gigabit Ethernet NICs +- Wangxun 40 Gigabit Ethernet NICs Features --------
Signature · 1 line
2.21.0.windows.1
v3 cover Wangxun new NIC support
In reply to Zaiyu WangWe have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
---
v2:
- split patch into 15 functional subpatches
- replace PHY configuration with mailbox cmd to firmware
---
v3:
- fix compilation errors and documentation formatting
---
Zaiyu Wang (15):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add other hardware-related changes
doc: update for txgbe
doc/guides/nics/txgbe.rst | 8 +- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 ++++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 357 ++++++++++++++++++--- drivers/net/txgbe/base/txgbe_hw.h | 16 +- drivers/net/txgbe/base/txgbe_mng.c | 252 +++++++++++---- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 +++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 95 +++++- drivers/net/txgbe/base/txgbe_type.h | 66 ++++ drivers/net/txgbe/txgbe_ethdev.c | 373 ++++++++++++++++++++-- drivers/net/txgbe/txgbe_rxtx.c | 201 +++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 22 files changed, 1946 insertions(+), 215 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Signature · 1 line
2.21.0.windows.1
PATCH v3 1/15 net/txgbe: add basic information for Amber-Lite 25G/40G NICs
Add device IDs, speed and other basic information for Wangxun's new Amber-Lite NICs: aml (10G/25G) and aml40 (40G).
--- drivers/net/txgbe/base/txgbe_devids.h | 9 +++++++ drivers/net/txgbe/base/txgbe_hw.c | 17 +++++++++++++ drivers/net/txgbe/base/txgbe_regs.h | 4 ++- drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 35 ++++++++++++++++++++------- 5 files changed, 58 insertions(+), 10 deletions(-)
drivers/net/txgbe/base/txgbe_devids.h +9 -0
@@ -19,6 +19,15 @@#define TXGBE_DEV_ID_WX1820 0x2001#define TXGBE_DEV_ID_SP1000_VF 0x1000#define TXGBE_DEV_ID_WX1820_VF 0x2000 +#define TXGBE_DEV_ID_AML 0x5000 +#define TXGBE_DEV_ID_AML5025 0x5025 +#define TXGBE_DEV_ID_AML5125 0x5125 +#define TXGBE_DEV_ID_AML5040 0x5040 +#define TXGBE_DEV_ID_AML5140 0x5140 + +#define TXGBE_DEV_ID_AML_VF 0x5001 +#define TXGBE_DEV_ID_AML5024_VF 0x5024 +#define TXGBE_DEV_ID_AML5124_VF 0x5124/* * Subsystem IDs
drivers/net/txgbe/base/txgbe_hw.c +17 -0
@@ -2469,6 +2469,8 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) {case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: status =txgbe_init_ops_pf (hw);break ;case txgbe_mac_raptor_vf:
@@ -2506,11 +2508,26 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)case TXGBE_DEV_ID_WX1820 : hw->mac.type = txgbe_mac_raptor;break ; +case TXGBE_DEV_ID_AML : +case TXGBE_DEV_ID_AML5025 : +case TXGBE_DEV_ID_AML5125 : + hw->mac.type = txgbe_mac_aml; +break ; +case TXGBE_DEV_ID_AML5040 : +case TXGBE_DEV_ID_AML5140 : + hw->mac.type = txgbe_mac_aml40; +break ;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 ; +case TXGBE_DEV_ID_AML_VF : +case TXGBE_DEV_ID_AML5024_VF : +case TXGBE_DEV_ID_AML5124_VF : + hw->phy.media_type = txgbe_media_type_virtual; + hw->mac.type = txgbe_mac_aml_vf; +break ;default : err =TXGBE_ERR_DEVICE_NOT_SUPPORTED ;DEBUGOUT ("Unsupported device id: %x" , hw->device_id);
drivers/net/txgbe/base/txgbe_regs.h +3 -1
@@ -97,7 +97,9 @@#define TXGBE_LINK_SPEED_2_5GB_FULL 0x0400#define TXGBE_LINK_SPEED_5GB_FULL 0x0800#define TXGBE_LINK_SPEED_10GB_FULL 0x0080 -#define TXGBE_LINK_SPEED_40GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_25GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_40GB_FULL 0x0040 +#define TXGBE_LINK_SPEED_50GB_FULL 0x0200#define TXGBE_AUTOC_AUTONEG MS64(63, 0x1)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -148,7 +148,10 @@ enum txgbe_eeprom_type {enum txgbe_mac_type { txgbe_mac_unknown =0 , txgbe_mac_raptor, + txgbe_mac_aml, + txgbe_mac_aml40, txgbe_mac_raptor_vf, + txgbe_mac_aml_vf, txgbe_num_macs };
drivers/net/txgbe/txgbe_ethdev.c +26 -9
@@ -145,6 +145,11 @@ static void txgbe_l2_tunnel_conf(struct rte_eth_dev *dev);static const struct rte_pci_id pci_id_txgbe_map[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_SP1000 ) }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_WX1820 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5025 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5125 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5040 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5140 ) }, { .vendor_id =0 ,/* sentinel */ }, };
@@ -1829,8 +1834,13 @@ txgbe_dev_start(struct rte_eth_dev *dev)if (err) goto error; - allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | -RTE_ETH_LINK_SPEED_10G ; +if (hw->mac.type == txgbe_mac_aml40) + allowed_speeds =RTE_ETH_LINK_SPEED_40G ; +else if (hw->mac.type == txgbe_mac_aml) + allowed_speeds =RTE_ETH_LINK_SPEED_10G |RTE_ETH_LINK_SPEED_25G ; +else + allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | +RTE_ETH_LINK_SPEED_10G ; link_speeds = &dev->data->dev_conf.link_speeds;if (((*link_speeds) >>1 ) & ~(allowed_speeds >>1 )) {
@@ -1840,17 +1850,24 @@ txgbe_dev_start(struct rte_eth_dev *dev) speed =0x0 ;if (*link_speeds ==RTE_ETH_LINK_SPEED_AUTONEG ) { - speed = (TXGBE_LINK_SPEED_100M_FULL | -TXGBE_LINK_SPEED_1GB_FULL | -TXGBE_LINK_SPEED_10GB_FULL ); +if (hw->mac.type == txgbe_mac_aml40) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + }else if (hw->mac.type == txgbe_mac_aml) { + speed = (TXGBE_LINK_SPEED_10GB_FULL | +TXGBE_LINK_SPEED_25GB_FULL ); + }else { + speed = (TXGBE_LINK_SPEED_100M_FULL | +TXGBE_LINK_SPEED_1GB_FULL | +TXGBE_LINK_SPEED_10GB_FULL ); + } hw->autoneg = true; }else { +if (*link_speeds &RTE_ETH_LINK_SPEED_40G ) + speed |=TXGBE_LINK_SPEED_40GB_FULL ; +if (*link_speeds &RTE_ETH_LINK_SPEED_25G ) + speed |=TXGBE_LINK_SPEED_25GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_10G ) speed |=TXGBE_LINK_SPEED_10GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_5G ) - speed |=TXGBE_LINK_SPEED_5GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_2_5G ) - speed |=TXGBE_LINK_SPEED_2_5GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_1G ) speed |=TXGBE_LINK_SPEED_1GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_100M )
Signature · 1 line
2.21.0.windows.1
PATCH v3 2/15 net/txgbe: add new SW-FW mailbox interface
In reply to Zaiyu WangAmber-Lite NICs adopt new mailbox interface for software-firmware interaion to enable enhanced functionality.
--- drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_mng.c | 216 +++++++++++++++++++------- drivers/net/txgbe/base/txgbe_mng.h | 17 +- drivers/net/txgbe/base/txgbe_regs.h | 7 + drivers/net/txgbe/base/txgbe_type.h | 4 + 6 files changed, 193 insertions(+), 60 deletions(-)
drivers/net/txgbe/base/txgbe_eeprom.c +6 -1
@@ -366,8 +366,13 @@ s32 txgbe_calc_eeprom_checksum(struct txgbe_hw *hw) err = hw->rom.readw_buffer (hw, i, seg, buffer);if (err)return err; -for (j =0 ; j < seg; j++) +for (j =0 ; j < seg; j++) { +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +if (((i + j) >= (TXGBE_SHOWROM_I2C_PTR /2 )) && + ((i + j) < (TXGBE_SHOWROM_I2C_END /2 ))) + buffer[j] =0xffff ; checksum += buffer[j]; + } } checksum = (u16 )TXGBE_EEPROM_SUM - checksum + read_checksum;
drivers/net/txgbe/base/txgbe_eeprom.h +2 -0
@@ -20,6 +20,8 @@#define TXGBE_PBANUM0_PTR 0x05#define TXGBE_PBANUM1_PTR 0x06#define TXGBE_SW_REGION_PTR 0x1C +#define TXGBE_SHOWROM_I2C_PTR 0xB00 +#define TXGBE_SHOWROM_I2C_END 0xF00#define TXGBE_EE_CSUM_MAX 0x800#define TXGBE_EEPROM_CHECKSUM 0x2F
drivers/net/txgbe/base/txgbe_mng.c +160 -56
316 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_mng.h +14 -3
@@ -60,6 +60,8 @@#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376 +#define TXGBE_HIC_HDR_INDEX_MAX 255 +/* Host Interface Command Structures */ struct txgbe_hic_hdr {u8 cmd;
@@ -68,21 +70,30 @@ struct txgbe_hic_hdr {u8 cmd_resv;u8 ret_status; } cmd_or_resp; -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };struct txgbe_hic_hdr2_req {u8 cmd;u8 buf_lenh;u8 buf_lenl; -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };struct txgbe_hic_hdr2_rsp {u8 cmd;u8 buf_lenl;u8 buf_lenh_status;/* 7-5: high bits of buf_len, 4-0: status */ -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };union txgbe_hic_hdr2 {
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -263,6 +263,13 @@#define TXGBE_MNGMBXCTL_FWACK MS(3, 0x1)#define TXGBE_MNGMBX 0x01E100 +/* amlite: swfw mailbox changes */ +#define TXGBE_AML_MNG_MBOX_CTL_SW2FW 0x01E0A0 +#define TXGBE_AML_MNG_MBOX_SW2FW 0x01E200 +#define TXGBE_AML_MNG_MBOX_CTL_FW2SW 0x01E0A4 +#define TXGBE_AML_MNG_MBOX_FW2SW 0x01E300 +#define TXGBE_AML_MNG_MBOX_NOTIFY MS(31, 0x1) +/****************************************************************************** * Port Registers ******************************************************************************/
drivers/net/txgbe/base/txgbe_type.h +4 -0
@@ -821,6 +821,10 @@ struct txgbe_hw {u64 tx_qp_bytes;u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; + +/*amlite: new SW-FW mbox */ +u8 swfw_index; +rte_atomic32_t swfw_busy; };struct txgbe_backplane_ability {
Signature · 1 line
2.21.0.windows.1
RE: [PATCH v3 02/15] net/txgbe: add new SW-FW mailbox interface
Quoted 169 lines
drivers/net/txgbe/base/txgbe_mng.c +117
-30@@ -113,54 +102,148 @@ txgbe_host_interface_command(struct txgbe_hw *hw, u32 *buffer, {u32 hdr_size =sizeof (struct txgbe_hic_hdr );struct txgbe_hic_hdr *resp = (struct txgbe_hic_hdr *)buffer; +struct txgbe_hic_hdr *recv_hdr;u16 buf_len; -s32 err; -u32 bi; +s32 err =0 ; +u32 bi, i;u32 dword_len; +u8 send_cmd;if (length ==0 || length >TXGBE_PMMBX_BSIZE ) {DEBUGOUT ("Buffer length failure buffersize=%d." , length);return TXGBE_ERR_HOST_INTERFACE_COMMAND ; } -/* Take management host interface semaphore */ - err = hw->mac.acquire_swfw_sync (hw,TXGBE_MNGSEM_SWMBX ); -if (err) -return err; +/* Calculate length in DWORDs. We must be DWORD aligned */ +if (length %sizeof (u32)) { +DEBUGOUT ("Buffer length failure, not aligned to dword" ); +return TXGBE_ERR_INVALID_ARGUMENT ; + } - err =txgbe_hic_unlocked (hw, buffer, length, timeout); -if (err) - goto rel_out; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +/* try to get lock */ +while (rte_atomic32_test_and_set (&hw->swfw_busy)) { + timeout--; +if (!timeout) +return TXGBE_ERR_TIMEOUT ; +usec_delay (1000 ); + } + +/* index to unique seq id for each mbox message */ + resp->cksum_or_index.index = hw->swfw_index; + send_cmd = resp->cmd; + +/* Calculate length in DWORDs */ + dword_len = length >>2 ; + +/* write data to SW-FW mbox array */ +for (i =0 ; i < dword_len; i++) { +wr32a (hw,TXGBE_AML_MNG_MBOX_SW2FW , + i,rte_cpu_to_le_32 (buffer[i])); +/* write flush */ +rd32a (hw,TXGBE_AML_MNG_MBOX_SW2FW , i); + } + +/* amlite: generate interrupt to notify FW */ +wr32m (hw,TXGBE_AML_MNG_MBOX_CTL_SW2FW , +TXGBE_AML_MNG_MBOX_NOTIFY ,0 ); +wr32m (hw,TXGBE_AML_MNG_MBOX_CTL_SW2FW , +TXGBE_AML_MNG_MBOX_NOTIFY ,TXGBE_AML_MNG_MBOX_NOTIFY ); + +/* Calculate length in DWORDs */ + dword_len = hdr_size >>2 ; + +/* polling reply from FW */ + timeout =50 ; +do { + timeout--; +usec_delay (1000 ); + +/* read hdr */ +for (bi =0 ; bi < dword_len; bi++) + buffer[bi] =rd32a (hw,TXGBE_AML_MNG_MBOX_FW2SW , bi); + +/* check hdr */ + recv_hdr = (struct txgbe_hic_hdr *)buffer; + +if (recv_hdr->cmd == send_cmd && + recv_hdr->cksum_or_index.index == hw->swfw_index) +break ; + }while (timeout); + +if (!timeout) { +PMD_DRV_LOG (ERR ,"Polling from FW messages timeout, cmd is 0x%x, index is %d" , + send_cmd, hw->swfw_index); + err =TXGBE_ERR_TIMEOUT ; + goto rel_out; + } + +/* expect no reply from FW then return */ +/* release lock if return */ +if (!return_data) + goto rel_out; + +/* If there is any thing in data position pull it in */ + buf_len = recv_hdr->buf_len; +if (buf_len ==0 ) + goto rel_out; + +if (length < buf_len + hdr_size) { +DEBUGOUT ("Buffer not large enough for reply message." ); + err =TXGBE_ERR_HOST_INTERFACE_COMMAND ; + goto rel_out; + } -if (!return_data) - goto rel_out; +/* Calculate length in DWORDs, add 3 for odd lengths */ + dword_len = (buf_len +3 ) >>2 ; +for (; bi <= dword_len; bi++) + buffer[bi] =rd32a (hw,TXGBE_AML_MNG_MBOX_FW2SW , bi); + }else { +/* Take management host interface semaphore */ + err = hw->mac.acquire_swfw_sync (hw,TXGBE_MNGSEM_SWMBX ); +if (err) +return err; -/* Calculate length in DWORDs */ - dword_len = hdr_size >>2 ; + err =txgbe_hic_unlocked (hw, buffer, length, timeout); +if (err) + goto rel_out; -/* first pull in the header so we know the buffer length */ -for (bi =0 ; bi < dword_len; bi++) - buffer[bi] =rd32a (hw,TXGBE_MNGMBX , bi); +if (!return_data) + goto rel_out; - buf_len = resp->buf_len; -if (!buf_len) - goto rel_out; +/* Calculate length in DWORDs */ + dword_len = hdr_size >>2 ; -if (length < buf_len + hdr_size) { -DEBUGOUT ("Buffer not large enough for reply message." ); - err =TXGBE_ERR_HOST_INTERFACE_COMMAND ; - goto rel_out; - } +/* first pull in the header so we know the buffer length */ +for (bi =0 ; bi < dword_len; bi++) + buffer[bi] =rd32a (hw,TXGBE_MNGMBX , bi); + + buf_len = resp->buf_len; +if (!buf_len) + goto rel_out; -/* Calculate length in DWORDs, add 3 for odd lengths */ - dword_len = (buf_len +3 ) >>2 ; +if (length < buf_len + hdr_size) { +DEBUGOUT ("Buffer not large enough for reply message." ); + err =TXGBE_ERR_HOST_INTERFACE_COMMAND ; + goto rel_out; + } -/* Pull in the rest of the buffer (bi is where we left off) */ -for (; bi <= dword_len; bi++) - buffer[bi] =rd32a (hw,TXGBE_MNGMBX , bi); +/* Calculate length in DWORDs, add 3 for odd lengths */ + dword_len = (buf_len +3 ) >>2 ; +/* Pull in the rest of the buffer (bi is where we left off) */ +for (; bi <= dword_len; bi++) + buffer[bi] =rd32a (hw,TXGBE_MNGMBX , bi); + } rel_out: - hw->mac.release_swfw_sync (hw,TXGBE_MNGSEM_SWMBX ); +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) {
drivers/net/txgbe/base/txgbe_mng.c txgbe_host_interface_command(struct txgbe_hw *hw, u32 *buffer, · line 249
Quoted 10 lines
drivers/net/txgbe/base/txgbe_mng.c +7
-0+/* index++, index replace txgbe_hic_hdr.checksum */ + hw->swfw_index = resp->cksum_or_index.index ==TXGBE_HIC_HDR_INDEX_MAX ? +0 : resp->cksum_or_index.index +1 ; +rte_atomic32_clear (&hw->swfw_busy); + }else { + hw->mac.release_swfw_sync (hw,TXGBE_MNGSEM_SWMBX ); + }return err; }
It would be more appropriate to divide then into two functions with different mac type, as their contents differ greatly.
drivers/net/txgbe/base/txgbe_mng.c s32 txgbe_hic_sr_read(struct txgbe_hw *hw, u32 addr, u8 *buf, int len) · line 282
Quoted 9 lines
drivers/net/txgbe/base/txgbe_mng.c +2
-1@@ -187,22 +276,27 @@ s32 txgbe_hic_sr_read(struct txgbe_hw *hw, u32 addr, u8 *buf, int len) command.hdr.req.cmd =FW_READ_SHADOW_RAM_CMD ; command.hdr.req.buf_lenh =0 ; command.hdr.req.buf_lenl =FW_READ_SHADOW_RAM_LEN ; - command.hdr.req.checksum =FW_DEFAULT_CHECKSUM ; command.address =cpu_to_be32 (addr); command.length =cpu_to_be16 (len); +if (hw->mac.type == txgbe_mac_raptor) + command.hdr.req.cksum_or_index.checksum =FW_DEFAULT_CHECKSUM ;
This change is unnecessary:
Quoted 22 lines
drivers/net/txgbe/base/txgbe_mng.h +8
-2@@ -68,21 +70,30 @@ struct txgbe_hic_hdr {u8 cmd_resv;u8 ret_status; } cmd_or_resp; -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };struct txgbe_hic_hdr2_req {u8 cmd;u8 buf_lenh;u8 buf_lenl; -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };
drivers/net/txgbe/base/txgbe_mng.h struct txgbe_hic_hdr { · line 97
Quoted 10 lines
drivers/net/txgbe/base/txgbe_mng.h +4
-1struct txgbe_hic_hdr2_rsp {u8 cmd;u8 buf_lenl;u8 buf_lenh_status;/* 7-5: high bits of buf_len, 4-0: status */ -u8 checksum; +union { +u8 checksum; +u8 index; + } cksum_or_index; };
No need to name the union.
PATCH v3 3/15 net/txgbe: add identification support for new SFP/QSFP modules
In reply to Zaiyu WangAdd identification support for new SFP/QSFP module types (e.g., 25G SR/CR) in the Amber-Lite NIC configuration flow.
--- drivers/net/txgbe/base/txgbe_phy.c | 92 ++++++++++++++++++++++++----- drivers/net/txgbe/base/txgbe_phy.h | 23 ++++++++ drivers/net/txgbe/base/txgbe_regs.h | 5 +- drivers/net/txgbe/base/txgbe_type.h | 12 ++++ 4 files changed, 117 insertions(+), 15 deletions(-)
drivers/net/txgbe/base/txgbe_phy.c +78 -14
@@ -774,10 +774,21 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)u8 identifier =0 ;u8 comp_codes_1g =0 ;u8 comp_codes_10g =0 ; +u8 comp_codes_25g =0 ; +u8 comp_copper_len =0 ;u8 oui_bytes[3 ] = {0 ,0 ,0 };u8 cable_tech =0 ;u8 cable_spec =0 ;u16 enforce_sfp =0 ; +u32 value; + +if (hw->mac.type == txgbe_mac_aml) { + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_ABS_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + }if (hw->phy.media_type != txgbe_media_type_fiber) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -811,6 +822,16 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)if (err !=0 ) goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_25GBE_COMP_CODES , + &comp_codes_25g); +if (err !=0 ) + goto ERR_I2C; + + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_COPPER_LENGTH , + &comp_copper_len); +if (err !=0 ) + goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_TECHNOLOGY , &cable_tech);if (err !=0 )
@@ -832,12 +853,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)* 11 SFP_1g_sx_CORE0 - chip-specific * 12 SFP_1g_sx_CORE1 - chip-specific */ -if (cable_tech &TXGBE_SFF_CABLE_DA_PASSIVE ) { -if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; -else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; - }else if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { +if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_SPEC_COMP , &cable_spec);if (err !=0 )
@@ -849,6 +865,17 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }else { hw->phy.sfp_type = txgbe_sfp_type_unknown; } + }else if (comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core1; + }else if (comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {
@@ -876,11 +903,20 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)/* Determine if the SFP+ PHY is dual speed or not. */ hw->phy.multispeed_fiber = false; -if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || - ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) - hw->phy.multispeed_fiber = true; +if (hw->mac.type == txgbe_mac_aml) { +if ((comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) && + ((comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE ) || + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }else { +if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || + ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }/* Determine PHY vendor */ if (hw->phy.type != txgbe_phy_nl) {
@@ -938,7 +974,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }/* Verify supported 1G SFP modules */ - if (comp_codes_10g == 0 && + if (comp_codes_10g == 0 && comp_codes_25g == 0 && !(hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core1 || hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core0 || hw->phy.sfp_type == txgbe_sfp_type_1g_lx_core0 ||
@@ -986,6 +1022,7 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)u8 cable_length =0 ;u8 device_tech =0 ;bool active_cable = false; +u32 value;if (hw->phy.media_type != txgbe_media_type_fiber_qsfp) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -993,6 +1030,16 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw) goto out; } +if (hw->mac.type == txgbe_mac_aml40) { +/* config GPIO before read i2c */ +wr32 (hw,TXGBE_GPIODATA ,TXGBE_GPIOBIT_1 ); + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_PRST_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + } + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_IDENTIFIER , &identifier); ERR_I2C:
@@ -1024,10 +1071,27 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)if (comp_codes_10g &TXGBE_SFF_QSFP_DA_PASSIVE_CABLE ) { hw->phy.type = txgbe_phy_qsfp_unknown_passive; +if (hw->mac.type == txgbe_mac_aml40) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core1; + }else { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + } + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_SR4 ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core1; + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_LR4 ) {if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core0;else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {if (hw->bus.lan_id ==0 )
drivers/net/txgbe/base/txgbe_phy.h +23 -0
@@ -249,6 +249,8 @@#define TXGBE_SFF_VENDOR_OUI_BYTE2 0x27#define TXGBE_SFF_1GBE_COMP_CODES 0x06#define TXGBE_SFF_10GBE_COMP_CODES 0x03 +#define TXGBE_SFF_25GBE_COMP_CODES 0x24 +#define TXGBE_SFF_COPPER_LENGTH 0x12#define TXGBE_SFF_CABLE_TECHNOLOGY 0x08#define TXGBE_SFF_CABLE_DA_PASSIVE 0x4#define TXGBE_SFF_CABLE_DA_ACTIVE 0x8
@@ -275,6 +277,23 @@#define TXGBE_SFF_1GBASET_CAPABLE 0x8#define TXGBE_SFF_10GBASESR_CAPABLE 0x10#define TXGBE_SFF_10GBASELR_CAPABLE 0x20 +#define TXGBE_SFF_25GBASESR_CAPABLE 0x2 +#define TXGBE_SFF_25GBASELR_CAPABLE 0x3 +#define TXGBE_SFF_25GBASEER_CAPABLE 0x4 +#define TXGBE_SFF_25GBASECR_91FEC 0xB +#define TXGBE_SFF_25GBASECR_74FEC 0xC +#define TXGBE_SFF_25GBASECR_NOFEC 0xD +#define TXGBE_SFF_40GBASE_SR_CAPABLE 0x10 +#define TXGBE_SFF_4x10GBASESR_CAP 0x11 +#define TXGBE_SFF_40GBASEPSM4_PARALLEL 0x12 +#define TXGBE_SFF_40GBASE_SWMD4_CAP 0x1f + +#define TXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_5 0x1 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_5 0x8 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_12 0x18 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_12 0x19 +#define TXGBE_SFF_SOFT_RS_SELECT_MASK 0x8#define TXGBE_SFF_SOFT_RS_SELECT_10G 0x8#define TXGBE_SFF_SOFT_RS_SELECT_1G 0x0
@@ -290,6 +309,10 @@#define TXGBE_I2C_EEPROM_STATUS_FAIL 0x2#define TXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 +#define TXGBE_SFF_40GBASE_CR4 0x8 +#define TXGBE_SFF_40GBASE_SR4 0x4 +#define TXGBE_SFF_40GBASE_LR4 0x2 +/* EEPROM for SFF-8472 (dev_addr = 0xA2) */ #define TXGBE_I2C_EEPROM_DEV_ADDR2 0xA2
drivers/net/txgbe/base/txgbe_regs.h +4 -1
@@ -1601,7 +1601,10 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C - +#define TXGBE_GPIOEXT 0x014850 +#define TXGBE_SFP1_MOD_ABS_LS MS(2, 0x1)/* GPIO_EXT SFP ABSENT*/ +#define TXGBE_SFP1_RX_LOS_LS MS(3, 0x1)/* GPIO_EXT RX LOSS */ +#define TXGBE_SFP1_MOD_PRST_LS MS(4, 0x1)/* GPIO_EXT SFP ABSENT*/ #define TXGBE_ARBPOOLIDX 0x01820C#define TXGBE_ARBTXRATE 0x018404
drivers/net/txgbe/base/txgbe_type.h +12 -0
@@ -214,6 +214,18 @@ enum txgbe_sfp_type { txgbe_sfp_type_1g_sx_core1, txgbe_sfp_type_1g_lx_core0, txgbe_sfp_type_1g_lx_core1, + txgbe_sfp_type_25g_sr_core0, + txgbe_sfp_type_25g_sr_core1, + txgbe_sfp_type_25g_lr_core0, + txgbe_sfp_type_25g_lr_core1, + txgbe_sfp_type_25g_aoc_core0, + txgbe_sfp_type_25g_aoc_core1, + txgbe_qsfp_type_40g_cu_core0, + txgbe_qsfp_type_40g_cu_core1, + txgbe_qsfp_type_40g_sr_core0, + txgbe_qsfp_type_40g_sr_core1, + txgbe_qsfp_type_40g_lr_core0, + txgbe_qsfp_type_40g_lr_core1, txgbe_sfp_type_not_present =0xFFFE , txgbe_sfp_type_not_known =0xFFFF };
Signature · 1 line
2.21.0.windows.1
PATCH v3 4/15 net/txgbe: add basic link configuration for Amber-Lite NICs
In reply to Zaiyu WangDue to Amber-Lite's significant differences from our 10G NICs, we split link configuration components (setup_link, check_link, etc.) into new files.
--- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 323 +++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 21 ++ drivers/net/txgbe/base/txgbe_aml40.c | 126 +++++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_hw.c | 78 ++++++- drivers/net/txgbe/base/txgbe_hw.h | 13 +- drivers/net/txgbe/base/txgbe_regs.h | 9 + drivers/net/txgbe/base/txgbe_type.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 8 + 10 files changed, 585 insertions(+), 17 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
drivers/net/txgbe/base/meson.build +2 -0
@@ -6,6 +6,8 @@ base_sources = files( 'txgbe_dcb.c', 'txgbe_eeprom.c', 'txgbe_hw.c', + 'txgbe_aml.c', + 'txgbe_aml40.c', 'txgbe_mbx.c', 'txgbe_mng.c', 'txgbe_phy.c',
drivers/net/txgbe/base/txgbe_aml.c new file +323 -0
323 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML_H_ +#define _TXGBE_AML_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml (struct txgbe_hw *hw, +u32 *speed, +bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw); +#endif /* _TXGBE_AML_H_ */
drivers/net/txgbe/base/txgbe_aml40.c new file +126 -0
126 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml40.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML40_H_ +#define _TXGBE_AML40_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml40 (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml40 (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml40 (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw); +#endif /* _TXGBE_AML40_H_ */
drivers/net/txgbe/base/txgbe_hw.c +66 -12
163 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_hw.h +8 -5
@@ -56,7 +56,7 @@ s32 txgbe_set_vlvf(struct txgbe_hw *hw, u32 vlan, u32 vind,s32 txgbe_clear_vfta (struct txgbe_hw *hw);s32 txgbe_find_vlvf_slot (struct txgbe_hw *hw,u32 vlan,bool vlvf_bypass); -s32 txgbe_check_mac_link (struct txgbe_hw *hw, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete);
@@ -86,10 +86,11 @@ s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg, u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);s32 txgbe_init_shared_code (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw); -s32 txgbe_init_ops_pf (struct txgbe_hw *hw); -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_init_ops_generic (struct txgbe_hw *hw); +void txgbe_init_ops_sp (struct txgbe_hw *hw); +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg); -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw); +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw);void txgbe_disable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_enable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_flap_tx_laser_multispeed_fiber (struct txgbe_hw *hw);
@@ -103,7 +104,7 @@ s32 txgbe_start_mac_link_raptor(struct txgbe_hw *hw,s32 txgbe_setup_mac_link (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw); -void txgbe_init_mac_link_ops (struct txgbe_hw *hw); +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
@@ -114,4 +115,6 @@ s32 txgbe_reinit_fdir_tables(struct txgbe_hw *hw);bool txgbe_verify_lesm_fw_enabled_raptor (struct txgbe_hw *hw);s32 txgbe_fmgr_cmd_op (struct txgbe_hw *hw,u32 cmd,u32 cmd_addr);s32 txgbe_flash_read_dword (struct txgbe_hw *hw,u32 addr,u32 *data); +s32 txgbe_e56_check_phy_link (struct txgbe_hw *hw,u32 *speed, +bool *link_up);#endif /* _TXGBE_HW_H_ */
drivers/net/txgbe/base/txgbe_regs.h +9 -0
@@ -1577,6 +1577,15 @@ enum txgbe_5tuple_protocol {#define TXGBE_PORTSTAT_BW_100M MS(3, 0x1)#define TXGBE_PORTSTAT_ID (r) RS(r, 8, 0x1) +/* amlite: diff from sapphire */ +#define TXGBE_CFG_PORT_ST_AML_LINK_MASK MS(1, 0xF) +#define TXGBE_CFG_PORT_ST_AML_LINK_10G MS(4, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_25G MS(3, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_40G MS(2, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_50G MS(1, 0x1) + +#define TXGBE_AML_PHY_LINK_UP MS(2, 0x1) +#define TXGBE_VXLAN 0x014410#define TXGBE_VXLAN_GPE 0x014414#define TXGBE_GENEVE 0x014418
drivers/net/txgbe/base/txgbe_type.h +2 -0
@@ -551,6 +551,7 @@ struct txgbe_mac_info {s32 (*prot_autoc_read)(struct txgbe_hw *hw,bool *locked,u64 *value);s32 (*prot_autoc_write)(struct txgbe_hw *hw,bool locked,u64 value);s32 (*negotiate_api_version)(struct txgbe_hw *hw,int api); +void (*init_mac_link_ops)(struct txgbe_hw *hw);/* Link */ void (*disable_tx_laser)(struct txgbe_hw *hw);
@@ -834,6 +835,7 @@ struct txgbe_hw {u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; +rte_spinlock_t phy_lock;/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy;
drivers/net/txgbe/txgbe_ethdev.c +8 -0
@@ -3068,6 +3068,14 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,case TXGBE_LINK_SPEED_10GB_FULL : link.link_speed =RTE_ETH_SPEED_NUM_10G ;break ; + +case TXGBE_LINK_SPEED_25GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_25G ; +break ; + +case TXGBE_LINK_SPEED_40GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_40G ; +break ; }/* Re configure MAC RX */
Signature · 1 line
2.21.0.windows.1
Re: [PATCH v3 04/15] net/txgbe: add basic link configuration for Amber-Lite NICs
Quoted 6 lines · On Thu, 26 Jun 2025 16:02:09 +0800 Zaiyu Wang <[email protected]> wrote:
Due to Amber-Lite's significant differences from our 10G NICs, we split link configuration components (
setup_link,check_link, etc.) into new files.Signed-off-by Zaiyu Wang <[email protected]>---
This does not apply cleanly to current main (or next-net) branch. Looks like there is some fuzz (file offset) changes.
Rather than me trying to fix, and potentially breaking the driver; please resubmit.
RE: [PATCH v3 04/15] net/txgbe: add basic link configuration for Amber-Lite NICs
Quoted 16 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Monday, August 4, 2025 12:43 AM
To: Zaiyu Wang <[email protected]>
Cc: [email protected]; Jiawen Wu <[email protected]>; Jian Wang <[email protected]>
Subject: Re: [PATCH v3 04/15] net/txgbe: add basic link configuration for Amber-Lite NICsQuoted 4 lines · On Thu, 26 Jun 2025 16:02:09 +0800 Zaiyu Wang <[email protected]> wrote:
Due to Amber-Lite's significant differences from our 10G NICs, we split link configuration components (
setup_link,check_link, etc.) into new files.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Zaiyu Wang <[email protected]>---
This does not apply cleanly to current main (or next-net) branch. Looks like there is some fuzz (file offset) changes.
Rather than me trying to fix, and potentially breaking the driver; please
resubmit.
Quoted 1 line
Hi Stephen,
My apologies for the late follow-up on my previous patchset.
I've addressed the fuzz issue as well as the other review comments, and resubmitted a new version of the patchset two weeks ago. It now applies cleanly to the main branch.
Could you please take a look when you have a moment? We would really appreciate if it could be considered for the 25.11 release.
Thanks for your time and consideration.
PATCH v3 5/15 net/txgbe: add support for PHY configuration via SW-FW mailbox
In reply to Zaiyu WangMigrate Amber-Lite PHY configuration to firmware due to complexity. Driver now sends mailbox commands for link state changes, handled by firmware’s intricate PHY setup process
--- drivers/net/txgbe/base/txgbe_aml.c | 52 ++++++++++++++++------------ drivers/net/txgbe/base/txgbe_aml40.c | 37 +++++++++++++++++++- drivers/net/txgbe/base/txgbe_hw.c | 1 + drivers/net/txgbe/base/txgbe_mng.c | 36 +++++++++++++++++++ drivers/net/txgbe/base/txgbe_mng.h | 17 +++++++++ drivers/net/txgbe/base/txgbe_type.h | 7 ++++ 6 files changed, 126 insertions(+), 24 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +29 -23
@@ -131,21 +131,37 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +{ +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +int cnt =0 ; +int i; + +if (speed ==TXGBE_LINK_SPEED_25GB_FULL ) + cnt =4 ; +else + cnt =1 ; + +for (i =0 ; i < (4 * cnt); i++) { + hw->mac.check_link (hw, &link_speed, &link_up, false); +if (link_up) +break ; +msleep (250 ); + } +} +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete) {bool autoneg = false;s32 status =0 ; -s32 ret_status =0 ;u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false; -int i;u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ;u32 value =0 ; -UNREFERENCED_PARAMETER (autoneg_wait_to_complete); -if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );return 0 ;
@@ -165,30 +181,20 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw,if (value & (TXGBE_SFP1_MOD_ABS_LS |TXGBE_SFP1_RX_LOS_LS ))return status; -for (i =0 ; i <4 ; i++) { -txgbe_e56_check_phy_link (hw, &link_speed, &link_up); -if (link_up) -break ; -msleep (250 ); - } + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); -if (link_speed == speed && link_up && - !(speed ==TXGBE_LINK_SPEED_25GB_FULL )) +if (link_speed == speed && link_up)return status; -rte_spinlock_lock (&hw->phy_lock); - ret_status =0 ; -rte_spinlock_unlock (&hw->phy_lock); +if (speed &TXGBE_LINK_SPEED_25GB_FULL ) + speed =0x10 ; +else if (speed &TXGBE_LINK_SPEED_10GB_FULL ) + speed =0x08 ; -if (ret_status ==TXGBE_ERR_PHY_INIT_NOT_DONE ) -return status; + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); -for (i =0 ; i <4 ; i++) { -txgbe_e56_check_phy_link (hw, &link_speed, &link_up); -if (link_up) -return status; -msleep (250 ); - } +txgbe_wait_for_link_up_aml (hw, speed);return status; }
drivers/net/txgbe/base/txgbe_aml40.c +36 -1
@@ -107,7 +107,42 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 speed, bool autoneg_wait_to_complete) { -return 0 ; + bool autoneg = false; +s32 status =0 ; +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; +u32 value =0 ; + +if (hw->phy.sfp_type == txgbe_sfp_type_not_present) { +DEBUGOUT ("SFP not detected, skip setup mac link" ); +return 0 ; + } + +/* Check to see if speed passed in is supported. */ + status = hw->mac.get_link_capabilities (hw, + &link_capabilities, &autoneg); +if (status) +return status; + + speed &= link_capabilities; +if (speed ==TXGBE_LINK_SPEED_UNKNOWN ) +return TXGBE_ERR_LINK_SETUP ; + + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); + +if (link_speed == speed && link_up) +return status; + +if (speed &TXGBE_LINK_SPEED_40GB_FULL ) + speed =0x20 ; + + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); + +txgbe_wait_for_link_up_aml (hw, speed); + +return status; }void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw)
drivers/net/txgbe/base/txgbe_hw.c +1 -0
@@ -2819,6 +2819,7 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) phy->write_i2c_byte_unlocked = txgbe_write_i2c_byte_unlocked; phy->check_overtemp = txgbe_check_overtemp; phy->reset = txgbe_reset_phy; + phy->set_link_hostif = txgbe_hic_ephy_set_link;/* MAC */ mac->init_hw = txgbe_init_hw;
drivers/net/txgbe/base/txgbe_mng.c +36 -0
@@ -590,3 +590,39 @@ s32 txgbe_hic_set_lldp(struct txgbe_hw *hw, bool on)return txgbe_host_interface_command (hw, (u32 *)&buffer,sizeof (buffer),TXGBE_HI_COMMAND_TIMEOUT , false); } + +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex) +{ +struct txgbe_hic_ephy_setlink buffer; +s32 status; +int i; + + buffer.hdr.cmd =FW_PHY_CONFIG_LINK_CMD ; + buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); + buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; + + buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.speed = speed; + buffer.autoneg = autoneg; + buffer.duplex = duplex; + +for (i =0 ; i <=FW_CEM_MAX_RETRIES ; i++) { + status =txgbe_host_interface_command (hw, (u32 *)&buffer, +sizeof (buffer), +TXGBE_HI_COMMAND_TIMEOUT_SHORT , true); +if (status !=0 ) { +msleep (1 ); +continue ; + } + +if (buffer.hdr.cmd_or_resp.ret_status == +FW_CEM_RESP_STATUS_SUCCESS ) + status =0 ; +else + status =TXGBE_ERR_HOST_INTERFACE_COMMAND ; + +break ; + } + +return status; +}
drivers/net/txgbe/base/txgbe_mng.h +17 -0
@@ -13,6 +13,7 @@#define TXGBE_PMMBX_BSIZE (TXGBE_PMMBX_QSIZE * 4)#define TXGBE_PMMBX_DATA_SIZE (TXGBE_PMMBX_BSIZE - FW_NVM_DATA_OFFSET * 4)#define TXGBE_HI_COMMAND_TIMEOUT 5000/* Process HI command limit */ +#define TXGBE_HI_COMMAND_TIMEOUT_SHORT 500/* Process HI command limit */ #define TXGBE_HI_FLASH_ERASE_TIMEOUT 5000/* Process Erase command limit */ #define TXGBE_HI_FLASH_UPDATE_TIMEOUT 5000/* Process Update command limit */ #define TXGBE_HI_FLASH_VERIFY_TIMEOUT 60000/* Process Apply command limit */
@@ -56,6 +57,12 @@#define FW_LLDP_GET_CMD 0xF2#define FW_LLDP_SET_CMD_OFF 0xF1#define FW_LLDP_SET_CMD_ON 0xF0 +#define FW_PHY_CONFIG_READ_CMD 0xc0 +#define FW_PHY_CONFIG_LINK_CMD 0xc1 +#define FW_PHY_CONFIG_FC_CMD 0xc2 +#define FW_PHY_CONFIG_POWER_CMD 0xc3 +#define FW_PHY_CONFIG_RESET_CMD 0xc4 +#define FW_READ_SFP_INFO_CMD 0xc5#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376
@@ -101,6 +108,15 @@ union txgbe_hic_hdr2 {struct txgbe_hic_hdr2_rsp rsp; }; +struct txgbe_hic_ephy_setlink { +struct txgbe_hic_hdr hdr; +u8 speed; +u8 duplex; +u8 autoneg; +u8 fec_mode; +u8 resv[4 ]; +}; +struct txgbe_hic_drv_info {struct txgbe_hic_hdr hdr;u8 port_num;
@@ -204,5 +220,6 @@ bool txgbe_mng_present(struct txgbe_hw *hw);bool txgbe_mng_enabled (struct txgbe_hw *hw);s32 txgbe_hic_get_lldp (struct txgbe_hw *hw);s32 txgbe_hic_set_lldp (struct txgbe_hw *hw,bool on); +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);#endif /* _TXGBE_MNG_H_ */
drivers/net/txgbe/base/txgbe_type.h +7 -0
@@ -688,6 +688,7 @@ struct txgbe_phy_info { u8 *value);s32 (*write_i2c_byte_unlocked)(struct txgbe_hw *hw,u8 offset,u8 addr,u8 value); +s32 (*set_link_hostif)(struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);enum txgbe_phy_type type;u32 addr;
@@ -771,6 +772,12 @@ enum txgbe_isb_idx {TXGBE_ISB_MAX }; +#define TXGBE_PHY_FEC_RS MS(0, 0x1) +#define TXGBE_PHY_FEC_BASER MS(1, 0x1) +#define TXGBE_PHY_FEC_OFF MS(2, 0x1) +#define TXGBE_PHY_FEC_AUTO (TXGBE_PHY_FEC_OFF | TXGBE_PHY_FEC_BASER |\ + TXGBE_PHY_FEC_RS) +struct txgbe_devargs {u16 auto_neg;u16 poll;
Signature · 1 line
2.21.0.windows.1
PATCH v3 6/15 net/txgbe: add RX&TX support for Amber-Lite NICs
In reply to Zaiyu WangThe packet handling workflow largely reuses the existing 10G NIC’s process, so we adjusted driver conditional checks rather than making major changes to the overall flow.
--- drivers/net/txgbe/base/txgbe_aml.c | 2 +- drivers/net/txgbe/base/txgbe_aml.h | 1 + drivers/net/txgbe/base/txgbe_aml40.c | 1 - drivers/net/txgbe/base/txgbe_hw.c | 27 ++++++++++++ drivers/net/txgbe/base/txgbe_hw.h | 2 + drivers/net/txgbe/base/txgbe_regs.h | 30 +++++++++++++ drivers/net/txgbe/txgbe_ethdev.c | 12 ++++-- drivers/net/txgbe/txgbe_rxtx.c | 64 +++++++++++++++------------- 8 files changed, 104 insertions(+), 35 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +1 -1
@@ -131,7 +131,7 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } -static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;
drivers/net/txgbe/base/txgbe_aml.h +1 -0
@@ -15,6 +15,7 @@ s32 txgbe_check_mac_link_aml(struct txgbe_hw *hw,s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw,u32 *speed,bool *autoneg);u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed);s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_aml40.c +0 -1
@@ -112,7 +112,6 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; -u32 value =0 ;if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );
drivers/net/txgbe/base/txgbe_hw.c +27 -0
@@ -20,6 +20,7 @@#define TXGBE_RAPTOR_MC_TBL_SIZE 128#define TXGBE_RAPTOR_VFT_TBL_SIZE 128#define TXGBE_RAPTOR_RX_PB_SIZE 512/*KB*/ +#define TXGBE_AML_RX_PB_SIZE 768 static s32 txgbe_setup_copper_link_raptor(struct txgbe_hw *hw, u32 speed,
@@ -2494,6 +2495,29 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)return status; } +int txgbe_is_vf (struct txgbe_hw *hw) +{ +switch (hw->mac.type) { +case txgbe_mac_raptor_vf: +case txgbe_mac_aml_vf: +return 1 ; +default : +return 0 ; + } +} + +int txgbe_is_pf (struct txgbe_hw *hw) +{ +switch (hw->mac.type) { +case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: +return 1 ; +default : +return 0 ; + } +} +/** * txgbe_set_mac_type - Sets MAC type * @hw: pointer to the HW structure
@@ -2903,6 +2927,9 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) mac->max_rx_queues =TXGBE_RAPTOR_MAX_RX_QUEUES ; mac->max_tx_queues =TXGBE_RAPTOR_MAX_TX_QUEUES ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) + mac->rx_pb_size =TXGBE_AML_RX_PB_SIZE ; +return 0 ; }
drivers/net/txgbe/base/txgbe_hw.h +2 -0
@@ -85,6 +85,8 @@ void txgbe_set_mta(struct txgbe_hw *hw, u8 *mc_addr);s32 txgbe_negotiate_fc (struct txgbe_hw *hw,u32 adv_reg,u32 lp_reg,u32 adv_sym,u32 adv_asm,u32 lp_sym,u32 lp_asm);s32 txgbe_init_shared_code (struct txgbe_hw *hw); +int txgbe_is_vf (struct txgbe_hw *hw); +int txgbe_is_pf (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw);s32 txgbe_init_ops_generic (struct txgbe_hw *hw);void txgbe_init_ops_sp (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +30 -0
@@ -318,12 +318,18 @@#define TXGBE_LEDCTL_1G MS(2, 0x1)#define TXGBE_LEDCTL_100M MS(3, 0x1)#define TXGBE_LEDCTL_ACTIVE MS(4, 0x1) +#define TXGBE_LINKUP_FILTER 0x014428#define TXGBE_TAGTPID (i) (0x014430 + (i) * 4)/* 0-3 */ #define TXGBE_TAGTPID_LSB_MASK MS(0, 0xFFFF)#define TXGBE_TAGTPID_LSB (v) LS(v, 0, 0xFFFF)#define TXGBE_TAGTPID_MSB_MASK MS(16, 0xFFFF)#define TXGBE_TAGTPID_MSB (v) LS(v, 16, 0xFFFF) +/*AML LINK STATUS OVERWRITE*/ +#define TXGBE_AML_EPCS_MISC_CTL 0x13240 +#define TXGBE_AML_LINK_STATUS_OVRD_EN 0x00000020 +#define TXGBE_AML_LINK_STATUS_OVRD_VAL 0x00000010 +/** * GPIO Control * P0: link speed change
@@ -1389,6 +1395,7 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_HTHRESH_MASK MS(8, 0xF)#define TXGBE_TXCFG_HTHRESH (v) LS(v, 8, 0xF)#define TXGBE_TXCFG_WTHRESH_MASK MS(16, 0x7F) +#define TXGBE_TXCFG_WTHRESH_MASK_AML MS(16, 0x1FF)#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F)#define TXGBE_TXCFG_FLUSH MS(26, 0x1)
@@ -1634,6 +1641,16 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBRXCTL_WSP MS(2, 0x1)#define TXGBE_ARBRXCTL_DIA MS(6, 0x1) +#define TXGBE_RDM_VF_RE (_i) (0x12004 + ((_i) * 4)) +#define TXGBE_RDM_VFRE_CLR (_i) (0x120A0 + ((_i) * 4)) +#define TXGBE_RDM_RSC_CTL 0x1200C +/* amlite: rdm_rsc_ctl_free_ctl */ +#define TXGBE_RDM_RSC_CTL_FREE_CTL MS(7, 0x1) +#define TXGBE_RDM_RSC_CTL_FREE_CNT_DIS MS(8, 0x1) +#define TXGBE_RDM_ARB_CFG (_i) (0x12040 + ((_i) * 4))/* 8 of these (0-7) */ +#define TXGBE_RDM_PF_QDE (_i) (0x12080 + ((_i) * 4)) +#define TXGBE_RDM_PF_HIDE (_i) (0x12090 + ((_i) * 4)) +#define TXGBE_RPUP2TC 0x019008#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7
@@ -1708,6 +1725,19 @@ enum txgbe_5tuple_protocol {#define TXGBE_MACTXCFG_SPEED_10G LS(0, 29, 0x3)#define TXGBE_MACTXCFG_SPEED_1G LS(3, 29, 0x3) +#define TXGBE_MAC_TX_CFG_AML_SPEED_MASK 0x78000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_50G 0x20000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_40G 0x00000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_25G 0x10000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_10G 0x40000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_1G 0x70000000U + +#define TXGBE_MAC_MISC_CTL 0x11f00 +#define TXGBE_MAC_MISC_LINK_STS_MOD MS(0, 0x1) +#define TXGBE_LINK_BOTH_PCS_MAC MS(0, 0x1) + +#define TXGBE_EPHY_STAT 0x13404 +#define TXGBE_EPHY_STAT_PPL_LOCK 0x3#define TXGBE_ISBADDRL 0x000160#define TXGBE_ISBADDRH 0x000164
drivers/net/txgbe/txgbe_ethdev.c +9 -3
@@ -385,7 +385,7 @@ txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,uint32_t q_map;uint8_t n, offset; -if (hw->mac.type != txgbe_mac_raptor) +if (!txgbe_is_pf (hw))return -ENOSYS ;if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK )
@@ -1806,7 +1806,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) }/* Skip link setup if loopback mode is enabled. */ -if (hw->mac.type == txgbe_mac_raptor && +if (txgbe_is_pf (hw) && dev->data->dev_conf.lpbk_mode) goto skip_link_setup;
@@ -2816,6 +2816,7 @@ txgbe_dev_sfp_event(struct rte_eth_dev *dev)wr32 (hw,TXGBE_GPIOINTMASK ,0xFF ); reg =rd32 (hw,TXGBE_GPIORAWINTSTAT ); +if (reg &TXGBE_GPIOBIT_0 )wr32 (hw,TXGBE_GPIOEOI ,TXGBE_GPIOBIT_0 );if (reg &TXGBE_GPIOBIT_2 ) {
@@ -3078,8 +3079,13 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,break ; } +/* enable mac receiver */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); + } +/* Re configure MAC RX */ -if (hw->mac.type == txgbe_mac_raptor) { +if (txgbe_is_pf (hw)) { reg =rd32 (hw,TXGBE_MACRXCFG );wr32 (hw,TXGBE_MACRXCFG , reg); wr32m(hw, TXGBE_MACRXFLT, TXGBE_MACRXFLT_PROMISC,
drivers/net/txgbe/txgbe_rxtx.c +34 -30
162 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
RE: [PATCH v3 06/15] net/txgbe: add RX&TX support for Amber-Lite NICs
Quoted 9 lines
drivers/net/txgbe/base/txgbe_regs.h +1
-0@@ -318,12 +318,18 @@#define TXGBE_LEDCTL_1G MS(2, 0x1)#define TXGBE_LEDCTL_100M MS(3, 0x1)#define TXGBE_LEDCTL_ACTIVE MS(4, 0x1) +#define TXGBE_LINKUP_FILTER 0x014428
drivers/net/txgbe/base/txgbe_regs.h line 331
Quoted 10 lines
drivers/net/txgbe/base/txgbe_regs.h +4
-0#define TXGBE_TAGTPID (i) (0x014430 + (i) * 4)/* 0-3 */ #define TXGBE_TAGTPID_LSB_MASK MS(0, 0xFFFF)#define TXGBE_TAGTPID_LSB (v) LS(v, 0, 0xFFFF)#define TXGBE_TAGTPID_MSB_MASK MS(16, 0xFFFF)#define TXGBE_TAGTPID_MSB (v) LS(v, 16, 0xFFFF) +/*AML LINK STATUS OVERWRITE*/ +#define TXGBE_AML_EPCS_MISC_CTL 0x13240 +#define TXGBE_AML_LINK_STATUS_OVRD_EN 0x00000020 +#define TXGBE_AML_LINK_STATUS_OVRD_VAL 0x00000010
Improve readability and be consistent, use MS() here.
drivers/net/txgbe/base/txgbe_regs.h enum txgbe_5tuple_protocol { · line 1733
Quoted 7 lines
drivers/net/txgbe/base/txgbe_regs.h +6
-0+#define TXGBE_MAC_TX_CFG_AML_SPEED_MASK 0x78000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_50G 0x20000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_40G 0x00000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_25G 0x10000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_10G 0x40000000U +#define TXGBE_MAC_TX_CFG_AML_SPEED_1G 0x70000000U
Ditto.
Quoted 12 lines
drivers/net/txgbe/base/txgbe_regs.h +3
-5@@ -4712,11 +4702,18 @@ txgbe_dev_rxtx_start(struct rte_eth_dev *dev)for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];/* Setup Transmit Threshold Registers */ -wr32m (hw,TXGBE_TXCFG (txq->reg_idx), -TXGBE_TXCFG_HTHRESH_MASK | -TXGBE_TXCFG_WTHRESH_MASK , -TXGBE_TXCFG_HTHRESH (txq->hthresh) | -TXGBE_TXCFG_WTHRESH (txq->wthresh)); +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) + wr32m(hw, TXGBE_TXCFG(txq->reg_idx), + TXGBE_TXCFG_HTHRESH_MASK |
drivers/net/txgbe/base/txgbe_regs.h txgbe_dev_rxtx_start(struct rte_eth_dev *dev) · line 4717
Quoted 10 lines
drivers/net/txgbe/base/txgbe_regs.h +9
-0+TXGBE_TXCFG_WTHRESH_MASK_AML , +TXGBE_TXCFG_HTHRESH (txq->hthresh) | + TXGBE_TXCFG_WTHRESH(txq->wthresh)); + else + wr32m(hw, TXGBE_TXCFG(txq->reg_idx), + TXGBE_TXCFG_HTHRESH_MASK | +TXGBE_TXCFG_WTHRESH_MASK , + TXGBE_TXCFG_HTHRESH(txq->hthresh) | + TXGBE_TXCFG_WTHRESH(txq->wthresh)); }
These...
#define TXGBE_TXCFG_WTHRESH_MASK MS(16, 0x7F) #define TXGBE_TXCFG_WTHRESH_MASK_AML MS(16, 0x1FF) #define TXGBE_TXCFG_WTHRESH(v) LS(v, 16, 0x7F)
How to deal with txq->wthresh is greater than 0x7F for aml?
PATCH v3 7/15 net/txgbe: add hardware reset change for Amber-Lite NICs
In reply to Zaiyu WangAdd necessary configurations for Amber-Lite's hardware reset process, which differs from the 10G NIC's. These configurations may be modified in future to accommodate further changes.
--- drivers/net/txgbe/base/txgbe_hw.c | 74 ++++++++++++++++++++++------- drivers/net/txgbe/base/txgbe_regs.h | 2 + 2 files changed, 59 insertions(+), 17 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +57 -17
@@ -267,6 +267,8 @@ s32 txgbe_start_hw(struct txgbe_hw *hw)/* Cache bit indicating need for crosstalk fix */ switch (hw->mac.type) {case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: hw->mac.get_device_caps (hw, &device_caps);if (device_caps &TXGBE_DEVICE_CAPS_NO_CROSSTALK_WR ) hw->need_crosstalk_fix = false;
@@ -3500,13 +3502,37 @@ txgbe_reset_misc(struct txgbe_hw *hw) {int i;u32 value; +int err =0 ; +u32 speed;wr32 (hw,TXGBE_ISBADDRL , hw->isb_dma &0x00000000FFFFFFFF );wr32 (hw,TXGBE_ISBADDRH , hw->isb_dma >>32 ); - value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); -if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) - hw->link_status =TXGBE_LINK_STATUS_NONE ; +if (hw->mac.type == txgbe_mac_aml) { +if ((rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK ) + !=TXGBE_EPHY_STAT_PPL_LOCK ) { + speed =TXGBE_LINK_SPEED_25GB_FULL + |TXGBE_LINK_SPEED_10GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else if (hw->mac.type == txgbe_mac_aml40) { +if (!(rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK )) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else { + value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); +if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) + hw->link_status =TXGBE_LINK_STATUS_NONE ; + }/* receive packets that size > 2048 */ wr32m(hw, TXGBE_MACRXCFG,
@@ -3569,7 +3595,7 @@ txgbe_reset_misc(struct txgbe_hw *hw)s32 txgbe_reset_hw (struct txgbe_hw *hw) {s32 status; -u32 autoc; +u32 autoc =0 ;/* Call adapter stop to disable tx/rx and clear interrupts */ status = hw->mac.stop_hw (hw);
@@ -3596,9 +3622,10 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)if (!hw->phy.reset_disable) hw->phy.reset (hw); -/* remember AUTOC from before we reset */ - autoc = hw->mac.autoc_read (hw); - +if (hw->mac.type == txgbe_mac_raptor) { +/* remember AUTOC from before we reset */ + autoc = hw->mac.autoc_read (hw); + } mac_reset_top:/* Do LAN reset, the MNG domain will not be reset. */ wr32 (hw,TXGBE_RST ,TXGBE_RST_LAN (hw->bus.lan_id));
@@ -3629,16 +3656,28 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw) goto mac_reset_top; } -/* -* Store the original AUTOC/AUTOC2 values if they have not been -* stored off yet. Otherwise restore the stored original -* values since the reset operation sets back to defaults. -*/ -if (!hw->mac.orig_link_settings_stored) { - hw->mac.orig_autoc = hw->mac.autoc_read (hw); - hw->mac.orig_link_settings_stored = true; +/* amlite TODO*/ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_LINKUP_FILTER ,30 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); +/* amlite: bme */ +wr32 (hw,TXGBE_PX_PF_BME ,TXGBE_PX_PF_BME_EN ); +/* amlite: rdm_rsc_ctl_free_ctl set to 1 */ +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); }else { - hw->mac.orig_autoc = autoc; +/* +* Store the original AUTOC/AUTOC2 values if they have not been +* stored off yet. Otherwise restore the stored original +* values since the reset operation sets back to defaults. +*/ +if (!hw->mac.orig_link_settings_stored) { + hw->mac.orig_autoc = hw->mac.autoc_read (hw); + hw->mac.orig_link_settings_stored = true; + }else { + hw->mac.orig_autoc = autoc; + } }if (hw->phy.ffe_set) {
@@ -3646,7 +3685,8 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)msec_delay (50 );/* A temporary solution to set phy */ -txgbe_set_phy_temp (hw); +if (hw->mac.type == txgbe_mac_raptor) +txgbe_set_phy_temp (hw); }/* Store the permanent mac address */
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1236,6 +1236,8 @@ enum txgbe_5tuple_protocol { TXGBE_ICRMISC_LNKUP)#define TXGBE_ICSMISC 0x000104#define TXGBE_IENMISC 0x000108 +#define TXGBE_PX_PF_BME 0x0004B8 +#define TXGBE_PX_PF_BME_EN MS(0, 0x1)#define TXGBE_IVARMISC 0x0004FC#define TXGBE_IVARMISC_VEC (v) LS(v, 0, 0x7)#define TXGBE_IVARMISC_VLD MS(7, 0x1)
Signature · 1 line
2.21.0.windows.1
PATCH v3 8/15 net/txgbe: add MAC reconfiguration to avoid packet loss
In reply to Zaiyu WangThere was a bug that RX will lose the first packet when down/up port.
When PHY is configured, mac error code is reported to the MAC layer, and MAC locked this status without unlocking. As a result, when the first packet is reveived, MAC reports this error code and RDB dismissed this packet.
Do MAC reset can clean MAC error code so we can fix this bug.
--- drivers/net/txgbe/base/txgbe_hw.c | 37 +++++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_hw.h | 1 + drivers/net/txgbe/base/txgbe_regs.h | 2 ++ drivers/net/txgbe/txgbe_ethdev.c | 1 + 4 files changed, 41 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +37 -0
@@ -3497,6 +3497,43 @@ txgbe_check_flash_load(struct txgbe_hw *hw, u32 check_bit)return err; } +int txgbe_reconfig_mac (struct txgbe_hw *hw) +{ +u32 mac_wdg_timeout; +u32 mac_flow_ctrl; + + mac_wdg_timeout =rd32 (hw,TXGBE_MAC_WDG_TIMEOUT ); + mac_flow_ctrl =rd32 (hw,TXGBE_RXFCCFG ); + +if (hw->bus.lan_id ==0 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_0 ); +else if (hw->bus.lan_id ==1 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_1 ); + +/* wait for mac reset complete */ +usec_delay (1500 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); + +/* receive packets that size > 2048 */ +wr32m (hw,TXGBE_MACRXCFG , +TXGBE_MACRXCFG_JUMBO ,TXGBE_MACRXCFG_JUMBO ); + +/* clear counters on read */ +wr32m (hw,TXGBE_MACCNTCTL , +TXGBE_MACCNTCTL_RC ,TXGBE_MACCNTCTL_RC ); + +wr32m (hw,TXGBE_RXFCCFG , +TXGBE_RXFCCFG_FC ,TXGBE_RXFCCFG_FC ); + +wr32 (hw,TXGBE_MACRXFLT ,TXGBE_MACRXFLT_PROMISC ); + +wr32 (hw,TXGBE_MAC_WDG_TIMEOUT , mac_wdg_timeout); +wr32 (hw,TXGBE_RXFCCFG , mac_flow_ctrl); + +return 0 ; +} +static void txgbe_reset_misc (struct txgbe_hw *hw) {
drivers/net/txgbe/base/txgbe_hw.h +1 -0
@@ -107,6 +107,7 @@ s32 txgbe_setup_mac_link(struct txgbe_hw *hw, u32 speed, bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw);void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw); +int txgbe_reconfig_mac (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -158,6 +158,8 @@#define TXGBE_RST_SW MS(0, 0x1)#define TXGBE_RST_LAN (i) MS(((i) + 1), 0x1)#define TXGBE_RST_FW MS(3, 0x1) +#define TXGBE_RST_MAC_LAN_1 MS(17, 0x1) +#define TXGBE_RST_MAC_LAN_0 MS(20, 0x1)#define TXGBE_RST_ETH (i) MS(((i) + 29), 0x1)#define TXGBE_RST_GLB MS(31, 0x1)#define TXGBE_RST_DEFAULT (TXGBE_RST_SW | \
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -3081,6 +3081,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,/* enable mac receiver */ if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +txgbe_reconfig_mac (hw);wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); }
Signature · 1 line
2.21.0.windows.1
PATCH v3 9/15 net/txgbe: add TX head Write-Back mode for Amber-Lite NICs
In reply to Zaiyu WangAdd TX head Write-Back mode for Amber-Lite NICs. When enabled, the hardware no longer individually rewrites descriptors but intermittently notifies the driver of processed descriptor indices. This feature significantly improves performance and is enabled by default in the driver. Users can configure it via tx_headwb and tx_headwb_size in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 7 ++ drivers/net/txgbe/base/txgbe_type.h | 6 ++ drivers/net/txgbe/txgbe_ethdev.c | 9 ++ drivers/net/txgbe/txgbe_rxtx.c | 126 ++++++++++++++++++---- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +++-- 6 files changed, 151 insertions(+), 27 deletions(-)
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -1402,6 +1402,13 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_WTHRESH_MASK_AML MS(16, 0x1FF)#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F)#define TXGBE_TXCFG_FLUSH MS(26, 0x1) +#define TXGBE_PX_TR_CFG_HEAD_WB MS(27, 0x1)/* amlite head wb */ +#define TXGBE_PX_TR_CFG_HEAD_WB_64BYTE MS(28, 0x1)/* amlite head wb 64byte */ +#define TXGBE_PX_TR_CFG_HEAD_WB_MASK MS(27, 0x3) + +/* amlite: tx head wb */ +#define TXGBE_PX_TR_HEAD_ADDRL (_i) (0x03028 + ((_i) * 0x40)) +#define TXGBE_PX_TR_HEAD_ADDRH (_i) (0x0302C + ((_i) * 0x40))#define TXGBE_TDM_DESC_CHK (i) (0x0180B0 + (i) * 4)/*0-3*/ #define TXGBE_TDM_DESC_NONFATAL (i) (0x0180C0 + (i) * 4)/*0-3*/
drivers/net/txgbe/base/txgbe_type.h +6 -0
@@ -723,6 +723,8 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_MAIN "ffe_main"#define TXGBE_DEVARG_FFE_PRE "ffe_pre"#define TXGBE_DEVARG_FFE_POST "ffe_post" +#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb" +#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -733,6 +735,8 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_MAIN ,TXGBE_DEVARG_FFE_PRE ,TXGBE_DEVARG_FFE_POST , +TXGBE_DEVARG_TX_HEAD_WB , +TXGBE_DEVARG_TX_HEAD_WB_SIZE , NULL };
@@ -783,6 +787,8 @@ struct txgbe_devargs {u16 poll;u16 present;u16 sgmii; +u16 tx_headwb; +u16 tx_headwb_size; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +9 -0
@@ -513,6 +513,9 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)u16 ffe_main =27 ;u16 ffe_pre =8 ;u16 ffe_post =44 ; +/* New devargs for amberlite config */ +u16 tx_headwb =1 ; +u16 tx_headwb_size =16 ;if (devargs ==NULL ) goto null;
@@ -537,6 +540,10 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &ffe_pre);rte_kvargs_process (kvlist,TXGBE_DEVARG_FFE_POST , &txgbe_handle_devarg, &ffe_post); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB , + &txgbe_handle_devarg, &tx_headwb); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , + &txgbe_handle_devarg, &tx_headwb_size);rte_kvargs_free (kvlist); null:
@@ -544,6 +551,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.poll = poll; hw->devarg.present = present; hw->devarg.sgmii = sgmii; + hw->devarg.tx_headwb = tx_headwb; + hw->devarg.tx_headwb_size = tx_headwb_size; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
drivers/net/txgbe/txgbe_rxtx.c +106 -20
173 lines not on this page · raw message
drivers/net/txgbe/txgbe_rxtx.h +3 -0
@@ -414,6 +414,9 @@ struct txgbe_tx_queue {const struct rte_memzone *mz;uint64_t desc_error;bool resetting; +const struct rte_memzone *headwb; +uint64_t headwb_dma; +volatile uint32_t *headwb_mem; };struct txgbe_txq_ops {
drivers/net/txgbe/txgbe_rxtx_vec_common.h +20 -7
@@ -89,13 +89,26 @@ txgbe_tx_free_bufs(struct txgbe_tx_queue *txq)int nb_free =0 ;struct rte_mbuf *m, *free[RTE_TXGBE_TX_MAX_FREE_BUF_SZ ]; -/* check DD bit on threshold descriptor */ - status = txq->tx_ring[txq->tx_next_dd].dw3; -if (!(status &TXGBE_TXD_DD )) { -if (txq->nb_tx_free >>1 < txq->tx_free_thresh) -txgbe_set32_masked (txq->tdc_reg_addr, -TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); -return 0 ; +if (txq->headwb_mem) { +uint16_t tx_last_dd = txq->nb_tx_desc + + txq->tx_next_dd - txq->tx_free_thresh; +if (tx_last_dd >= txq->nb_tx_desc) + tx_last_dd -= txq->nb_tx_desc; +volatile uint16_t head = (uint16_t )*txq->headwb_mem; +if (txq->tx_next_dd > head && head > tx_last_dd) +return 0 ; +else if (tx_last_dd > txq->tx_next_dd && + (head > tx_last_dd || head < txq->tx_next_dd)) +return 0 ; + }else { +/* check DD bit on threshold descriptor */ + status = txq->tx_ring[txq->tx_next_dd].dw3; +if (!(status &TXGBE_TXD_DD )) { +if (txq->nb_tx_free >>1 < txq->tx_free_thresh) +txgbe_set32_masked (txq->tdc_reg_addr, +TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); +return 0 ; + } } n = txq->tx_free_thresh;
Signature · 1 line
2.21.0.windows.1
PATCH v3 10/15 net/txgbe: add RX desc merge mode for Amber-Lite NICs
In reply to Zaiyu WangAdd RX desc merge mode for Amber-Lite NICs. When enabled, the hardware batch-processes RX packets, significantly enhancing performance. This feature is enabled by default in the driver and can be configured via the rx_desc_merge parameter in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 4 ++++ drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 4 ++++ drivers/net/txgbe/txgbe_rxtx.c | 11 +++++++++++ 4 files changed, 22 insertions(+)
drivers/net/txgbe/base/txgbe_regs.h +4 -0
@@ -1373,6 +1373,7 @@ enum txgbe_5tuple_protocol {#define TXGBE_RXCFG_HDRLEN (v) LS(HDRLEN(v), 12, 0xF)#define TXGBE_RXCFG_HDRLEN_MASK MS(12, 0xF)#define TXGBE_RXCFG_WTHRESH (v) LS(v, 16, 0x7) +#define TXGBE_RXCFG_DESC_MERGE MS(19, 0x1)#define TXGBE_RXCFG_ETAG MS(22, 0x1)#define TXGBE_RXCFG_RSCMAX_MASK MS(23, 0x3)#define TXGBE_RXCFG_RSCMAX_1 LS(0, 23, 0x3)
@@ -1666,6 +1667,9 @@ enum txgbe_5tuple_protocol {#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7 +#define TXGBE_RDM_DCACHE_CTL 0x0120A8 +#define TXGBE_RDM_DCACHE_CTL_EN MS(0, 0x1) +/* mac switcher */ #define TXGBE_ETHADDRL 0x016200#define TXGBE_ETHADDRL_AD0 (v) LS(v, 0, 0xFF)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -725,6 +725,7 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_POST "ffe_post"#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb"#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size" +#define TXGBE_DEVARG_RX_DESC_MERGE "rx_desc_merge"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -737,6 +738,7 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_POST ,TXGBE_DEVARG_TX_HEAD_WB ,TXGBE_DEVARG_TX_HEAD_WB_SIZE , +TXGBE_DEVARG_RX_DESC_MERGE , NULL };
@@ -789,6 +791,7 @@ struct txgbe_devargs {u16 sgmii;u16 tx_headwb;u16 tx_headwb_size; +u16 rx_desc_merge; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +4 -0
@@ -516,6 +516,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)/* New devargs for amberlite config */ u16 tx_headwb =1 ;u16 tx_headwb_size =16 ; +u16 rx_desc_merge =1 ;if (devargs ==NULL ) goto null;
@@ -544,6 +545,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &tx_headwb);rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , &txgbe_handle_devarg, &tx_headwb_size); +rte_kvargs_process (kvlist,TXGBE_DEVARG_RX_DESC_MERGE , + &txgbe_handle_devarg, &rx_desc_merge);rte_kvargs_free (kvlist); null:
@@ -553,6 +556,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.sgmii = sgmii; hw->devarg.tx_headwb = tx_headwb; hw->devarg.tx_headwb_size = tx_headwb_size; + hw->devarg.rx_desc_merge = rx_desc_merge; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
drivers/net/txgbe/txgbe_rxtx.c +11 -0
@@ -4649,6 +4649,17 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev) buf_size =ROUND_DOWN (buf_size,0x1 <<10 ); srrctl |=TXGBE_RXCFG_PKTLEN (buf_size); +if ((hw->mac.type == txgbe_mac_aml || + hw->mac.type == txgbe_mac_aml40) && hw->devarg.rx_desc_merge ==1 ) { + srrctl |=TXGBE_RXCFG_DESC_MERGE ; + +wr32 (hw,TXGBE_RDM_DCACHE_CTL ,TXGBE_RDM_DCACHE_CTL_EN ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CNT_DIS , + ~TXGBE_RDM_RSC_CTL_FREE_CNT_DIS ); + } +wr32 (hw,TXGBE_RXCFG (rxq->reg_idx), srrctl);/* It adds dual VLAN length for supporting dual VLAN */
Signature · 1 line
2.21.0.windows.1
PATCH v3 11/15 net/txgbe: add FEC support for Amber-Lite 25G NICs
In reply to Zaiyu WangAmber-Lite 25G NICs support four FEC modes (off, baser, rs, auto). The driver implements standard interfaces (fec_get_capability, fec_get, fec_set) to allow manual configuration. The default FEC mode is set to 'auto'.
--- drivers/net/txgbe/base/txgbe_aml.c | 27 ++++++- drivers/net/txgbe/base/txgbe_hw.c | 3 + drivers/net/txgbe/base/txgbe_mng.c | 2 +- drivers/net/txgbe/base/txgbe_phy.h | 1 + drivers/net/txgbe/base/txgbe_type.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 121 ++++++++++++++++++++++++++++ 6 files changed, 154 insertions(+), 2 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +26 -1
@@ -131,6 +131,26 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static int +txgbe_phy_fec_get (struct txgbe_hw *hw) +{ +int value =0 ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_RS_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x4 ) +return TXGBE_PHY_FEC_RS ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_KR_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x1 ) +return TXGBE_PHY_FEC_BASER ; + +return TXGBE_PHY_FEC_OFF ; +} +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;
@@ -184,7 +204,12 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw, status = hw->mac.check_link (hw, &link_speed, &link_up, autoneg_wait_to_complete); -if (link_speed == speed && link_up) +if (link_up && speed ==TXGBE_LINK_SPEED_25GB_FULL ) + hw->cur_fec_link =txgbe_phy_fec_get (hw); + +if (link_speed == speed && link_up && + !(speed ==TXGBE_LINK_SPEED_25GB_FULL && + !(hw->fec_mode & hw->cur_fec_link)))return status;if (speed &TXGBE_LINK_SPEED_25GB_FULL )
drivers/net/txgbe/base/txgbe_hw.c +3 -0
@@ -329,6 +329,9 @@ s32 txgbe_init_hw(struct txgbe_hw *hw)txgbe_disable_lldp (hw); +/* Init fec mode to 'AUTO' */ + hw->fec_mode =TXGBE_PHY_FEC_AUTO ; +/* Reset the hardware */ status = hw->mac.reset_hw (hw);if (status ==0 || status ==TXGBE_ERR_SFP_NOT_PRESENT ) {
drivers/net/txgbe/base/txgbe_mng.c +1 -1
@@ -601,7 +601,7 @@ s32 txgbe_hic_ephy_set_link(struct txgbe_hw *hw, u8 speed, u8 autoneg, u8 duplex buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; - buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.fec_mode = hw->fec_mode; buffer.speed = speed; buffer.autoneg = autoneg; buffer.duplex = duplex;
drivers/net/txgbe/base/txgbe_phy.h +1 -0
@@ -40,6 +40,7 @@#define SR_PMA_KR_LD_CESTS_RR MS16(15, 0x1)#define SR_PMA_KR_FEC_CTRL 0x0100AB#define SR_PMA_KR_FEC_CTRL_EN MS16(0, 0x1) +#define SR_PMA_RS_FEC_CTRL 0x0100C8#define SR_MII_MMD_CTL 0x1F0000#define SR_MII_MMD_CTL_AN_EN 0x1000#define SR_MII_MMD_CTL_RESTART_AN 0x0200
drivers/net/txgbe/base/txgbe_type.h +2 -0
@@ -855,6 +855,8 @@ struct txgbe_hw {/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy; +u32 fec_mode; +u32 cur_fec_link; };struct txgbe_backplane_ability {
drivers/net/txgbe/txgbe_ethdev.c +121 -0
142 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v3 12/15 net/txgbe: add GPIO configuration
In reply to Zaiyu WangAdd GPIO configuration for Amber-Lite NICs to match design differences from 10G NICs: The Amber-Lite NIC requires additional setup steps compared to 10G NICs to ensure proper functionality of features SFP module detection.
--- drivers/net/txgbe/base/txgbe_regs.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 111 ++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1626,6 +1626,8 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTEN 0x014830#define TXGBE_GPIOINTMASK 0x014834#define TXGBE_GPIOINTTYPE 0x014838 +#define TXGBE_GPIO_INT_POLARITY 0x01483C +#define TXGBE_GPIO_INT_POLARITY_3 MS(3, 0x1)#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C
drivers/net/txgbe/txgbe_ethdev.c +111 -0
158 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v3 13/15 net/txgbe: disable unstable features
In reply to Zaiyu WangTemporarily disabled unstable features on Amber-Lite NICs (e.g., flow control). These incomplete features will be gradually completed in future driver updates.
--- drivers/net/txgbe/base/txgbe_hw.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +7 -0
@@ -144,6 +144,10 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw)u32 value =0 ;u64 reg_bp =0 ; +/* amlite-to-do */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +return 0 ; +/* Validate the requested mode */ if (hw->fc.strict_ieee && hw->fc.requested_mode == txgbe_fc_rx_pause) {DEBUGOUT ("txgbe_fc_rx_pause not valid in strict IEEE mode" );
@@ -3235,6 +3239,9 @@ void txgbe_set_hard_rate_select_speed(struct txgbe_hw *hw,u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA );switch (speed) { +case TXGBE_LINK_SPEED_25GB_FULL : +/* amlite-to-do */ +break ;case TXGBE_LINK_SPEED_10GB_FULL : esdp_reg |= (TXGBE_GPIOBIT_4 |TXGBE_GPIOBIT_5 );break ;
Signature · 1 line
2.21.0.windows.1
PATCH v3 14/15 net/txgbe: add other hardware-related changes
In reply to Zaiyu WangAdd other hardware-related changes for Amber-Lite NICs, such as PF queue rate limit, enable/disable tx laser.
--- drivers/net/txgbe/base/txgbe_hw.c | 113 +++++++++++++++++++++------ drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 35 +++++++++ drivers/net/txgbe/base/txgbe_regs.h | 23 ++++++ drivers/net/txgbe/base/txgbe_type.h | 27 +++++++ drivers/net/txgbe/txgbe_ethdev.c | 72 ++++++++++++++--- 6 files changed, 238 insertions(+), 34 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +90 -23
@@ -2213,27 +2213,56 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw)* * Returns the thermal sensor data structure **/ +#define PHYINIT_TIMEOUT 1000s32 txgbe_get_thermal_sensor_data (struct txgbe_hw *hw) {struct txgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;s64 tsv;u32 ts_stat; +u32 data_code; +int temp_data, temp_fraction; +int i =0 ;/* Only support thermal sensors attached to physical port 0 */ if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; - ts_stat =rd32 (hw,TXGBE_TSSTAT ); - tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); - tsv = tsv >1200 ? tsv :1200 ; - tsv = -(48380 <<8 ) /1000 - + tsv * (31020 <<8 ) /100000 - - tsv * tsv * (18201 <<8 ) /100000000 - + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 - - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; - tsv >>=8 ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0001 ); - data->sensor[0 ].temp = (s16 )tsv; +while (1 ) { + data_code =rd32 (hw,TXGBE_AML_TS_STS ); +if ((data_code &TXGBE_AML_TS_STS_VLD ) !=0 ) +break ; +msleep (1 ); +if (i++ >PHYINIT_TIMEOUT ) { +PMD_DRV_LOG (ERR ,"ERROR: Wait 0x1033c Timeout!!!" ); +return -1 ; + } + } + + data_code = data_code &0xFFF ; + temp_data =419400 +2205 * (data_code *1000 /4094 -500 ); + +/* Change double Temperature to int */ + tsv = temp_data /10000 ; + temp_fraction = temp_data - (tsv *10000 ); +if (temp_fraction >=5000 ) + tsv +=1 ; + data->sensor[0 ].temp = (s16 )tsv; + }else { + ts_stat =rd32 (hw,TXGBE_TSSTAT ); + tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); + tsv = tsv >1200 ? tsv :1200 ; + tsv = -(48380 <<8 ) /1000 + + tsv * (31020 <<8 ) /100000 + - tsv * tsv * (18201 <<8 ) /100000000 + + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 + - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; + tsv >>=8 ; + + data->sensor[0 ].temp = (s16 )tsv; + }return 0 ; }
@@ -2254,16 +2283,32 @@ s32 txgbe_init_thermal_sensor_thresh(struct txgbe_hw *hw)if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; -wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); -wr32 (hw,TXGBE_TSINTR , -TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); -wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); - - data->sensor[0 ].alarm_thresh =100 ; -wr32 (hw,TXGBE_TSATHRE ,677 ); data->sensor[0 ].dalarm_thresh =90 ; -wr32 (hw,TXGBE_TSDTHRE ,614 ); + +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0 ); +wr32 (hw,TXGBE_AML_INTR_RAW_LO ,TXGBE_AML_INTR_CL_LO ); +wr32 (hw,TXGBE_AML_INTR_RAW_HI ,TXGBE_AML_INTR_CL_HI ); + +wr32 (hw,TXGBE_AML_INTR_HIGH_EN ,TXGBE_AML_INTR_EN_HI ); +wr32 (hw,TXGBE_AML_INTR_LOW_EN ,TXGBE_AML_INTR_EN_LO ); + +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_EVAL_MODE_MASK ,0x10 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_ALARM_THRE_MASK ,0x186a0000 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_DALARM_THRE_MASK ,0x16f60 ); +wr32 (hw,TXGBE_AML_TS_ENA ,0x1 ); + }else { +wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); +wr32 (hw,TXGBE_TSINTR , +TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); +wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); + + data->sensor[0 ].alarm_thresh =100 ; +wr32 (hw,TXGBE_TSATHRE ,677 ); + data->sensor[0 ].dalarm_thresh =90 ; +wr32 (hw,TXGBE_TSDTHRE ,614 ); + }return 0 ; }
@@ -3172,12 +3217,28 @@ void txgbe_disable_tx_laser_multispeed_fiber(struct txgbe_hw *hw) {u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA ); -if (txgbe_close_notify (hw)) -txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | -TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); +if (txgbe_close_notify (hw)) { +/* over write led when ifconfig down */ +if (hw->mac.type == txgbe_mac_aml40) { +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_40G | +TXGBE_AMLITE_LED_LINK_ACTIVE ); + }else if (hw->mac.type == txgbe_mac_aml) +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_25G | +TXGBE_AMLITE_LED_LINK_10G |TXGBE_AMLITE_LED_LINK_ACTIVE ); +else +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | +TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); + }/* Disable Tx laser; allow 100us to go dark per spec */ - esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg &= ~TXGBE_GPIOBIT_1 ; + }else if (hw->mac.type == txgbe_mac_aml) { + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);usec_delay (100 );
@@ -3199,7 +3260,13 @@ void txgbe_enable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)wr32 (hw,TXGBE_LEDCTL ,0 );/* Enable Tx laser; allow 100ms to light up */ - esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);msec_delay (100 );
drivers/net/txgbe/base/txgbe_osdep.h +2 -0
@@ -162,6 +162,8 @@ static inline u64 REVERT_BIT_MASK64(u64 mask) ((mask &0xFFFFFFFF00000000 ) >>32 ); } +#define BIT (nr) (1UL << (nr)) +#define IOMEM #define prefetch (x) rte_prefetch0(x)
drivers/net/txgbe/base/txgbe_phy.c +35 -0
@@ -173,6 +173,41 @@ s32 txgbe_get_phy_id(struct txgbe_hw *hw)u32 err;u16 phy_id_high =0 ;u16 phy_id_low =0 ; +u32 i =0 ; +u32 status; + +if (hw->mac.type == txgbe_mac_aml) { + hw->phy.addr =0 ; + +for (i =0 ; i <32 ; i++) { + hw->phy.addr = i; + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_HIGH ,0 , &phy_id_high); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 1" ); +return status; + } +DEBUGOUT ("%d: phy_id_high 0x%x" , i, phy_id_high); +if ((phy_id_high &0xFFFF ) ==0x0141 ) +break ; + } + +if (i ==32 ) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed" ); +return TXGBE_ERR_PHY ; + } + + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_LOW ,0 , &phy_id_low); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 2" ); +return status; + } + hw->phy.id = (u32)(phy_id_high &0xFFFF ) <<6 ; + hw->phy.id |= (u32)((phy_id_low &0xFC00 ) >>10 ); + +DEBUGOUT ("phy_id 0x%x" , hw->phy.id); + +return status; + } err = hw->phy.read_reg(hw, TXGBE_MD_PHY_ID_HIGH, TXGBE_MD_DEV_PMA_PMD,
drivers/net/txgbe/base/txgbe_regs.h +23 -0
@@ -302,6 +302,17 @@#define TXGBE_PORT_LINK1000M MS(2, 0x1)#define TXGBE_PORT_LINK100M MS(3, 0x1)#define TXGBE_PORT_LANID (r) RS(r, 8, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL MS(5, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL MS(4, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL MS(3, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL MS(2, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL MS(1, 0x1) +#define TXGBE_AMLITE_LED_LINK_ACTIVE TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL +#define TXGBE_AMLITE_LED_LINK_10G TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL +#define TXGBE_AMLITE_LED_LINK_25G TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL +#define TXGBE_AMLITE_LED_LINK_40G TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL +#define TXGBE_AMLITE_LED_LINK_50G TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL +#define TXGBE_EXTAG 0x014408#define TXGBE_EXTAG_ETAG_MASK MS(0, 0xFFFF)#define TXGBE_EXTAG_ETAG (v) LS(v, 0, 0xFFFF)
@@ -1641,6 +1652,18 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBTXRATE_MIN (v) LS(v, 0, 0x3FFF)#define TXGBE_ARBTXRATE_MAX (v) LS(v, 16, 0x3FFF) +#define TXGBE_TDM_RL_QUEUE_IDX 0x018210 +#define TXGBE_TDM_RL_QUEUE_CFG 0x018214 +#define TXGBE_TDM_FACTOR_INT_MASK MS(16, 0xFFFF) +#define TXGBE_TDM_FACTOR_FRA_MASK MS(0, 0xFFFC) +#define TXGBE_TDM_FACTOR_INT_SHIFT 16 +#define TXGBE_TDM_FACTOR_FRA_SHIFT 2 + +#define TXGBE_TDM_RL_VM_IDX 0x018218 +#define TXGBE_TDM_RL_VM_CFG 0x01821C +#define TXGBE_TDM_RL_CFG 0x018400 +#define TXGBE_TDM_RL_EN MS(0, 0x1) +/* qos */ #define TXGBE_ARBTXCTL 0x018200#define TXGBE_ARBTXCTL_RRM MS(1, 0x1)
drivers/net/txgbe/base/txgbe_type.h +27 -0
@@ -37,6 +37,33 @@#include "txgbe_osdep.h" #include "txgbe_devids.h" +/* Sensors for AMLITE PVT(Process Voltage Temperature) */ +#define TXGBE_AML_INTR_RAW_HI 0x10300 +#define TXGBE_AML_INTR_RAW_ME 0x10304 +#define TXGBE_AML_INTR_RAW_LO 0x10308 +#define TXGBE_AML_TS_CTL1 0x10330 +#define TXGBE_AML_TS_CTL2 0x10334 +#define TXGBE_AML_TS_ENA 0x10338 +#define TXGBE_AML_TS_STS 0x1033C +#define TXGBE_AML_INTR_HIGH_EN 0x10318 +#define TXGBE_AML_INTR_MED_EN 0x1031C +#define TXGBE_AML_INTR_LOW_EN 0x10320 +#define TXGBE_AML_INTR_HIGH_STS 0x1030C +#define TXGBE_AML_INTR_MED_STS 0x10310 +#define TXGBE_AML_INTR_LOW_STS 0x10314 + +#define TXGBE_AML_TS_STS_VLD 0x00001000U +#define TXGBE_AML_INTR_EN_HI 0x00000002U +#define TXGBE_AML_INTR_EN_ME 0x00000001U +#define TXGBE_AML_INTR_EN_LO 0x00000001U +#define TXGBE_AML_INTR_CL_HI 0x00000002U +#define TXGBE_AML_INTR_CL_ME 0x00000001U +#define TXGBE_AML_INTR_CL_LO 0x00000001U +#define TXGBE_AML_EVAL_MODE_MASK 0x00000010U +#define TXGBE_AML_CAL_MODE_MASK 0x00000008U +#define TXGBE_AML_ALARM_THRE_MASK 0x1FFE0000U +#define TXGBE_AML_DALARM_THRE_MASK 0x0001FFE0U +struct txgbe_thermal_diode_data {s16 temp;s16 alarm_thresh;
drivers/net/txgbe/txgbe_ethdev.c +61 -11
101 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
RE: [PATCH v3 14/15] net/txgbe: add other hardware-related changes
Quoted 4 lines
Subject: [PATCH v3 14/15] net/txgbe: add other hardware-related changes
Add other hardware-related changes for Amber-Lite NICs, such as PF queue rate limit, enable/disable tx laser.
Split patches for different features.
PATCH v3 15/15 doc: update for txgbe
In reply to Zaiyu WangAdd new types of Wangxun NICs(Amber-Lite NIC models) into txgbe supported NICs list.
--- doc/guides/nics/txgbe.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
doc/guides/nics/txgbe.rst +6 -2
@@ -4,8 +4,12 @@ TXGBE Poll Mode Driver ====================== -The TXGBE PMD (librte_pmd_txgbe) provides poll mode driver support -for Wangxun 10 Gigabit Ethernet NICs. +Supported NICs +-------------- + +- Wangxun 10 Gigabit Ethernet NICs +- Wangxun 25 Gigabit Ethernet NICs +- Wangxun 40 Gigabit Ethernet NICs Features --------
Signature · 1 line
2.21.0.windows.1
Re: [PATCH v3 00/15] Wangxun new NIC support
In reply to Zaiyu WangQuoted 50 lines · On Thu, 26 Jun 2025 16:02:05 +0800 Zaiyu Wang <[email protected]> wrote:
We have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
---
v2:
- split patch into 15 functional subpatches
- replace PHY configuration with mailbox cmd to firmware
---
v3:
- fix compilation errors and documentation formatting
---Zaiyu Wang (15):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add other hardware-related changes
doc: update for txgbedoc/guides/nics/txgbe.rst | 8 +- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 ++++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 357 ++++++++++++++++++--- drivers/net/txgbe/base/txgbe_hw.h | 16 +- drivers/net/txgbe/base/txgbe_mng.c | 252 +++++++++++---- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 +++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 95 +++++- drivers/net/txgbe/base/txgbe_type.h | 66 ++++ drivers/net/txgbe/txgbe_ethdev.c | 373 ++++++++++++++++++++--
Quoted 9 lines
drivers/net/txgbe/txgbe_rxtx.c | 201 +++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 22 files changed, 1946 insertions(+), 215 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Haven't looked at this in detail, but it is too late to get
this new NIC into 25.07 release, will put it early in queue of 25.11 reviews.
v4 cover Wangxun new NIC support
In reply to Zaiyu WangWe have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
Zaiyu Wang (20):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface
net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: rename raptor to sp for Sapphire-specific code net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add support for TX laser enable/disable net/txgbe: add support for TX queue rate limiting net/txgbe: add support for getting PHY ID
net/txgbe: add thermal sensor configuration for Amber-Lite NICs net/txgbe: add RSS for Amber-Lite NICs
doc: update for txgbe
doc/guides/nics/txgbe.rst | 8 +- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 365 ++++++++++++++++---- drivers/net/txgbe/base/txgbe_hw.h | 15 +- drivers/net/txgbe/base/txgbe_mng.c | 184 +++++++++- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 ++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 103 +++++- drivers/net/txgbe/base/txgbe_type.h | 70 +++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 390 ++++++++++++++++++++-- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 203 ++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 26 files changed, 1937 insertions(+), 202 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Signature · 1 line
2.21.0.windows.1
PATCH v4 1/20 net/txgbe: add basic information for Amber-Lite 25G/40G NICs
Add device IDs, speed and other basic information for Wangxun's new Amber-Lite NICs: aml (10G/25G) and aml40 (40G).
--- drivers/net/txgbe/base/txgbe_devids.h | 9 +++++++ drivers/net/txgbe/base/txgbe_hw.c | 17 +++++++++++++ drivers/net/txgbe/base/txgbe_regs.h | 4 ++- drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 35 ++++++++++++++++++++------- 5 files changed, 58 insertions(+), 10 deletions(-)
drivers/net/txgbe/base/txgbe_devids.h +9 -0
@@ -19,6 +19,15 @@#define TXGBE_DEV_ID_WX1820 0x2001#define TXGBE_DEV_ID_SP1000_VF 0x1000#define TXGBE_DEV_ID_WX1820_VF 0x2000 +#define TXGBE_DEV_ID_AML 0x5000 +#define TXGBE_DEV_ID_AML5025 0x5025 +#define TXGBE_DEV_ID_AML5125 0x5125 +#define TXGBE_DEV_ID_AML5040 0x5040 +#define TXGBE_DEV_ID_AML5140 0x5140 + +#define TXGBE_DEV_ID_AML_VF 0x5001 +#define TXGBE_DEV_ID_AML5024_VF 0x5024 +#define TXGBE_DEV_ID_AML5124_VF 0x5124/* * Subsystem IDs
drivers/net/txgbe/base/txgbe_hw.c +17 -0
@@ -2476,6 +2476,8 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) {case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: status =txgbe_init_ops_pf (hw);break ;case txgbe_mac_raptor_vf:
@@ -2523,11 +2525,26 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)case TXGBE_DEV_ID_WX1820 : hw->mac.type = txgbe_mac_raptor;break ; +case TXGBE_DEV_ID_AML : +case TXGBE_DEV_ID_AML5025 : +case TXGBE_DEV_ID_AML5125 : + hw->mac.type = txgbe_mac_aml; +break ; +case TXGBE_DEV_ID_AML5040 : +case TXGBE_DEV_ID_AML5140 : + hw->mac.type = txgbe_mac_aml40; +break ;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 ; +case TXGBE_DEV_ID_AML_VF : +case TXGBE_DEV_ID_AML5024_VF : +case TXGBE_DEV_ID_AML5124_VF : + hw->phy.media_type = txgbe_media_type_virtual; + hw->mac.type = txgbe_mac_aml_vf; +break ;default : err =TXGBE_ERR_DEVICE_NOT_SUPPORTED ;DEBUGOUT ("Unsupported device id: %x" , hw->device_id);
drivers/net/txgbe/base/txgbe_regs.h +3 -1
@@ -97,7 +97,9 @@#define TXGBE_LINK_SPEED_2_5GB_FULL 0x0400#define TXGBE_LINK_SPEED_5GB_FULL 0x0800#define TXGBE_LINK_SPEED_10GB_FULL 0x0080 -#define TXGBE_LINK_SPEED_40GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_25GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_40GB_FULL 0x0040 +#define TXGBE_LINK_SPEED_50GB_FULL 0x0200#define TXGBE_AUTOC_AUTONEG MS64(63, 0x1)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -140,7 +140,10 @@ enum txgbe_eeprom_type {enum txgbe_mac_type { txgbe_mac_unknown =0 , txgbe_mac_raptor, + txgbe_mac_aml, + txgbe_mac_aml40, txgbe_mac_raptor_vf, + txgbe_mac_aml_vf, txgbe_num_macs };
drivers/net/txgbe/txgbe_ethdev.c +26 -9
@@ -145,6 +145,11 @@ static void txgbe_l2_tunnel_conf(struct rte_eth_dev *dev);static const struct rte_pci_id pci_id_txgbe_map[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_SP1000 ) }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_WX1820 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5025 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5125 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5040 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5140 ) }, { .vendor_id =0 ,/* sentinel */ }, };
@@ -1829,8 +1834,13 @@ txgbe_dev_start(struct rte_eth_dev *dev)if (err) goto error; - allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | -RTE_ETH_LINK_SPEED_10G ; +if (hw->mac.type == txgbe_mac_aml40) + allowed_speeds =RTE_ETH_LINK_SPEED_40G ; +else if (hw->mac.type == txgbe_mac_aml) + allowed_speeds =RTE_ETH_LINK_SPEED_10G |RTE_ETH_LINK_SPEED_25G ; +else + allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | +RTE_ETH_LINK_SPEED_10G ; link_speeds = &dev->data->dev_conf.link_speeds;if (((*link_speeds) >>1 ) & ~(allowed_speeds >>1 )) {
@@ -1840,17 +1850,24 @@ txgbe_dev_start(struct rte_eth_dev *dev) speed =0x0 ;if (*link_speeds ==RTE_ETH_LINK_SPEED_AUTONEG ) { - speed = (TXGBE_LINK_SPEED_100M_FULL | -TXGBE_LINK_SPEED_1GB_FULL | -TXGBE_LINK_SPEED_10GB_FULL ); +if (hw->mac.type == txgbe_mac_aml40) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + }else if (hw->mac.type == txgbe_mac_aml) { + speed = (TXGBE_LINK_SPEED_10GB_FULL | +TXGBE_LINK_SPEED_25GB_FULL ); + }else { + speed = (TXGBE_LINK_SPEED_100M_FULL | +TXGBE_LINK_SPEED_1GB_FULL | +TXGBE_LINK_SPEED_10GB_FULL ); + } hw->autoneg = true; }else { +if (*link_speeds &RTE_ETH_LINK_SPEED_40G ) + speed |=TXGBE_LINK_SPEED_40GB_FULL ; +if (*link_speeds &RTE_ETH_LINK_SPEED_25G ) + speed |=TXGBE_LINK_SPEED_25GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_10G ) speed |=TXGBE_LINK_SPEED_10GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_5G ) - speed |=TXGBE_LINK_SPEED_5GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_2_5G ) - speed |=TXGBE_LINK_SPEED_2_5GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_1G ) speed |=TXGBE_LINK_SPEED_1GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_100M )
Signature · 1 line
2.21.0.windows.1
PATCH v4 2/20 net/txgbe: add new SW-FW mailbox interface
In reply to Zaiyu WangAmber-Lite NICs adopt new mailbox interface for software-firmware interaion to enable enhanced functionality.
--- drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_mng.c | 148 +++++++++++++++++++++++--- drivers/net/txgbe/base/txgbe_mng.h | 17 ++- drivers/net/txgbe/base/txgbe_regs.h | 7 ++ drivers/net/txgbe/base/txgbe_type.h | 4 + 6 files changed, 165 insertions(+), 20 deletions(-)
drivers/net/txgbe/base/txgbe_eeprom.c +6 -1
@@ -366,8 +366,13 @@ s32 txgbe_calc_eeprom_checksum(struct txgbe_hw *hw) err = hw->rom.readw_buffer (hw, i, seg, buffer);if (err)return err; -for (j =0 ; j < seg; j++) +for (j =0 ; j < seg; j++) { +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +if (((i + j) >= (TXGBE_SHOWROM_I2C_PTR /2 )) && + ((i + j) < (TXGBE_SHOWROM_I2C_END /2 ))) + buffer[j] =0xffff ; checksum += buffer[j]; + } } checksum = (u16 )TXGBE_EEPROM_SUM - checksum + read_checksum;
drivers/net/txgbe/base/txgbe_eeprom.h +2 -0
@@ -20,6 +20,8 @@#define TXGBE_PBANUM0_PTR 0x05#define TXGBE_PBANUM1_PTR 0x06#define TXGBE_SW_REGION_PTR 0x1C +#define TXGBE_SHOWROM_I2C_PTR 0xB00 +#define TXGBE_SHOWROM_I2C_END 0xF00#define TXGBE_EE_CSUM_MAX 0x800#define TXGBE_EEPROM_CHECKSUM 0x2F
drivers/net/txgbe/base/txgbe_mng.c +132 -16
192 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_mng.h +14 -3
@@ -60,6 +60,8 @@#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376 +#define TXGBE_HIC_HDR_INDEX_MAX 255 +/* Host Interface Command Structures */ struct txgbe_hic_hdr {u8 cmd;
@@ -68,21 +70,30 @@ struct txgbe_hic_hdr {u8 cmd_resv;u8 ret_status; } cmd_or_resp; -u8 checksum; +union { +u8 checksum; +u8 index; + }; };struct txgbe_hic_hdr2_req {u8 cmd;u8 buf_lenh;u8 buf_lenl; -u8 checksum; +union { +u8 checksum; +u8 index; + }; };struct txgbe_hic_hdr2_rsp {u8 cmd;u8 buf_lenl;u8 buf_lenh_status;/* 7-5: high bits of buf_len, 4-0: status */ -u8 checksum; +union { +u8 checksum; +u8 index; + }; };union txgbe_hic_hdr2 {
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -263,6 +263,13 @@#define TXGBE_MNGMBXCTL_FWACK MS(3, 0x1)#define TXGBE_MNGMBX 0x01E100 +/* amlite: swfw mailbox changes */ +#define TXGBE_AML_MNG_MBOX_CTL_SW2FW 0x01E0A0 +#define TXGBE_AML_MNG_MBOX_SW2FW 0x01E200 +#define TXGBE_AML_MNG_MBOX_CTL_FW2SW 0x01E0A4 +#define TXGBE_AML_MNG_MBOX_FW2SW 0x01E300 +#define TXGBE_AML_MNG_MBOX_NOTIFY MS(31, 0x1) +/****************************************************************************** * Port Registers ******************************************************************************/
drivers/net/txgbe/base/txgbe_type.h +4 -0
@@ -814,6 +814,10 @@ struct txgbe_hw {u64 tx_qp_bytes;u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; + +/*amlite: new SW-FW mbox */ +u8 swfw_index; +rte_atomic32_t swfw_busy; };struct txgbe_backplane_ability {
Signature · 1 line
2.21.0.windows.1
PATCH v4 3/20 net/txgbe: add identification support for new SFP/QSFP modules
In reply to Zaiyu WangAdd identification support for new SFP/QSFP module types (e.g., 25G SR/CR) in the Amber-Lite NIC configuration flow.
--- drivers/net/txgbe/base/txgbe_phy.c | 92 ++++++++++++++++++++++++----- drivers/net/txgbe/base/txgbe_phy.h | 23 ++++++++ drivers/net/txgbe/base/txgbe_regs.h | 5 +- drivers/net/txgbe/base/txgbe_type.h | 12 ++++ 4 files changed, 117 insertions(+), 15 deletions(-)
drivers/net/txgbe/base/txgbe_phy.c +78 -14
@@ -774,10 +774,21 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)u8 identifier =0 ;u8 comp_codes_1g =0 ;u8 comp_codes_10g =0 ; +u8 comp_codes_25g =0 ; +u8 comp_copper_len =0 ;u8 oui_bytes[3 ] = {0 ,0 ,0 };u8 cable_tech =0 ;u8 cable_spec =0 ;u16 enforce_sfp =0 ; +u32 value; + +if (hw->mac.type == txgbe_mac_aml) { + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_ABS_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + }if (hw->phy.media_type != txgbe_media_type_fiber) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -811,6 +822,16 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)if (err !=0 ) goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_25GBE_COMP_CODES , + &comp_codes_25g); +if (err !=0 ) + goto ERR_I2C; + + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_COPPER_LENGTH , + &comp_copper_len); +if (err !=0 ) + goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_TECHNOLOGY , &cable_tech);if (err !=0 )
@@ -832,12 +853,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)* 11 SFP_1g_sx_CORE0 - chip-specific * 12 SFP_1g_sx_CORE1 - chip-specific */ -if (cable_tech &TXGBE_SFF_CABLE_DA_PASSIVE ) { -if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; -else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; - }else if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { +if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_SPEC_COMP , &cable_spec);if (err !=0 )
@@ -849,6 +865,17 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }else { hw->phy.sfp_type = txgbe_sfp_type_unknown; } + }else if (comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core1; + }else if (comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {
@@ -876,11 +903,20 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)/* Determine if the SFP+ PHY is dual speed or not. */ hw->phy.multispeed_fiber = false; -if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || - ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) - hw->phy.multispeed_fiber = true; +if (hw->mac.type == txgbe_mac_aml) { +if ((comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) && + ((comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE ) || + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }else { +if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || + ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }/* Determine PHY vendor */ if (hw->phy.type != txgbe_phy_nl) {
@@ -938,7 +974,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }/* Verify supported 1G SFP modules */ - if (comp_codes_10g == 0 && + if (comp_codes_10g == 0 && comp_codes_25g == 0 && !(hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core1 || hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core0 || hw->phy.sfp_type == txgbe_sfp_type_1g_lx_core0 ||
@@ -986,6 +1022,7 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)u8 cable_length =0 ;u8 device_tech =0 ;bool active_cable = false; +u32 value;if (hw->phy.media_type != txgbe_media_type_fiber_qsfp) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -993,6 +1030,16 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw) goto out; } +if (hw->mac.type == txgbe_mac_aml40) { +/* config GPIO before read i2c */ +wr32 (hw,TXGBE_GPIODATA ,TXGBE_GPIOBIT_1 ); + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_PRST_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + } + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_IDENTIFIER , &identifier); ERR_I2C:
@@ -1024,10 +1071,27 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)if (comp_codes_10g &TXGBE_SFF_QSFP_DA_PASSIVE_CABLE ) { hw->phy.type = txgbe_phy_qsfp_unknown_passive; +if (hw->mac.type == txgbe_mac_aml40) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core1; + }else { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + } + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_SR4 ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core1; + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_LR4 ) {if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core0;else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {if (hw->bus.lan_id ==0 )
drivers/net/txgbe/base/txgbe_phy.h +23 -0
@@ -249,6 +249,8 @@#define TXGBE_SFF_VENDOR_OUI_BYTE2 0x27#define TXGBE_SFF_1GBE_COMP_CODES 0x06#define TXGBE_SFF_10GBE_COMP_CODES 0x03 +#define TXGBE_SFF_25GBE_COMP_CODES 0x24 +#define TXGBE_SFF_COPPER_LENGTH 0x12#define TXGBE_SFF_CABLE_TECHNOLOGY 0x08#define TXGBE_SFF_CABLE_DA_PASSIVE 0x4#define TXGBE_SFF_CABLE_DA_ACTIVE 0x8
@@ -275,6 +277,23 @@#define TXGBE_SFF_1GBASET_CAPABLE 0x8#define TXGBE_SFF_10GBASESR_CAPABLE 0x10#define TXGBE_SFF_10GBASELR_CAPABLE 0x20 +#define TXGBE_SFF_25GBASESR_CAPABLE 0x2 +#define TXGBE_SFF_25GBASELR_CAPABLE 0x3 +#define TXGBE_SFF_25GBASEER_CAPABLE 0x4 +#define TXGBE_SFF_25GBASECR_91FEC 0xB +#define TXGBE_SFF_25GBASECR_74FEC 0xC +#define TXGBE_SFF_25GBASECR_NOFEC 0xD +#define TXGBE_SFF_40GBASE_SR_CAPABLE 0x10 +#define TXGBE_SFF_4x10GBASESR_CAP 0x11 +#define TXGBE_SFF_40GBASEPSM4_PARALLEL 0x12 +#define TXGBE_SFF_40GBASE_SWMD4_CAP 0x1f + +#define TXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_5 0x1 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_5 0x8 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_12 0x18 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_12 0x19 +#define TXGBE_SFF_SOFT_RS_SELECT_MASK 0x8#define TXGBE_SFF_SOFT_RS_SELECT_10G 0x8#define TXGBE_SFF_SOFT_RS_SELECT_1G 0x0
@@ -290,6 +309,10 @@#define TXGBE_I2C_EEPROM_STATUS_FAIL 0x2#define TXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 +#define TXGBE_SFF_40GBASE_CR4 0x8 +#define TXGBE_SFF_40GBASE_SR4 0x4 +#define TXGBE_SFF_40GBASE_LR4 0x2 +/* EEPROM for SFF-8472 (dev_addr = 0xA2) */ #define TXGBE_I2C_EEPROM_DEV_ADDR2 0xA2
drivers/net/txgbe/base/txgbe_regs.h +4 -1
@@ -1605,7 +1605,10 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C - +#define TXGBE_GPIOEXT 0x014850 +#define TXGBE_SFP1_MOD_ABS_LS MS(2, 0x1)/* GPIO_EXT SFP ABSENT*/ +#define TXGBE_SFP1_RX_LOS_LS MS(3, 0x1)/* GPIO_EXT RX LOSS */ +#define TXGBE_SFP1_MOD_PRST_LS MS(4, 0x1)/* GPIO_EXT SFP ABSENT*/ #define TXGBE_ARBPOOLIDX 0x01820C#define TXGBE_ARBTXRATE 0x018404
drivers/net/txgbe/base/txgbe_type.h +12 -0
@@ -206,6 +206,18 @@ enum txgbe_sfp_type { txgbe_sfp_type_1g_sx_core1, txgbe_sfp_type_1g_lx_core0, txgbe_sfp_type_1g_lx_core1, + txgbe_sfp_type_25g_sr_core0, + txgbe_sfp_type_25g_sr_core1, + txgbe_sfp_type_25g_lr_core0, + txgbe_sfp_type_25g_lr_core1, + txgbe_sfp_type_25g_aoc_core0, + txgbe_sfp_type_25g_aoc_core1, + txgbe_qsfp_type_40g_cu_core0, + txgbe_qsfp_type_40g_cu_core1, + txgbe_qsfp_type_40g_sr_core0, + txgbe_qsfp_type_40g_sr_core1, + txgbe_qsfp_type_40g_lr_core0, + txgbe_qsfp_type_40g_lr_core1, txgbe_sfp_type_not_present =0xFFFE , txgbe_sfp_type_not_known =0xFFFF };
Signature · 1 line
2.21.0.windows.1
PATCH v4 4/20 net/txgbe: rename raptor to sp for Sapphire-specific code
In reply to Zaiyu WangThe term "raptor" was originally used as a general designation for NICs when only Sapphire series existed. With the addition of Amber-Lite series NICs, we now use "sp" to replace "raptor" for driver components that are specific to Sapphire NICs, while retaining the "raptor" name for common flows applicable to all NICs.
--- drivers/net/txgbe/base/txgbe_hw.c | 62 +++++++++++++++++++---------- drivers/net/txgbe/base/txgbe_hw.h | 11 ++--- drivers/net/txgbe/base/txgbe_regs.h | 8 ++-- drivers/net/txgbe/base/txgbe_type.h | 5 ++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 14 +++---- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 24 +++++------ 9 files changed, 76 insertions(+), 54 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +41 -21
@@ -272,7 +272,7 @@ s32 txgbe_start_hw(struct txgbe_hw *hw)/* Cache bit indicating need for crosstalk fix */ switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp: hw->mac.get_device_caps (hw, &device_caps);if (device_caps &TXGBE_DEVICE_CAPS_NO_CROSSTALK_WR ) hw->need_crosstalk_fix = false;
@@ -1915,7 +1915,7 @@ static bool txgbe_need_crosstalk_fix(struct txgbe_hw *hw)* * Reads the links register to determine if link is up and the current speed **/ -s32 txgbe_check_mac_link (struct txgbe_hw *hw,u32 *speed, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete) {u32 links_reg, links_orig;
@@ -1928,7 +1928,7 @@ s32 txgbe_check_mac_link(struct txgbe_hw *hw, u32 *speed,u32 sfp_cage_full;switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp: sfp_cage_full = !rd32m (hw,TXGBE_GPIODATA ,TXGBE_GPIOBIT_2 );break ;
@@ -2475,12 +2475,13 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp: +txgbe_init_ops_sp (hw); +break ;case txgbe_mac_aml:case txgbe_mac_aml40: - status =txgbe_init_ops_pf (hw);break ; -case txgbe_mac_raptor_vf: +case txgbe_mac_sp_vf: status =txgbe_init_ops_vf (hw);break ;default :
@@ -2497,7 +2498,7 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)bool txgbe_is_pf (struct txgbe_hw *hw) {switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp:return true;default :return false;
@@ -2523,7 +2524,7 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)switch (hw->device_id) {case TXGBE_DEV_ID_SP1000 :case TXGBE_DEV_ID_WX1820 : - hw->mac.type = txgbe_mac_raptor; + hw->mac.type = txgbe_mac_sp;break ;case TXGBE_DEV_ID_AML :case TXGBE_DEV_ID_AML5025 :
@@ -2537,7 +2538,7 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)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; + hw->mac.type = txgbe_mac_sp_vf;break ;case TXGBE_DEV_ID_AML_VF :case TXGBE_DEV_ID_AML5024_VF :
@@ -2556,7 +2557,7 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)return err; } -void txgbe_init_mac_link_ops (struct txgbe_hw *hw) +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw) {struct txgbe_mac_info *mac = &hw->mac;
@@ -2616,7 +2617,7 @@ s32 txgbe_init_phy_raptor(struct txgbe_hw *hw) goto init_phy_ops_out;/* Setup function pointers based on detected SFP module and speeds */ -txgbe_init_mac_link_ops (hw); +txgbe_init_mac_link_ops_sp (hw);/* If copper media, overwrite with copper function pointers */ if (phy->media_type == txgbe_media_type_copper) {
@@ -2651,7 +2652,7 @@ s32 txgbe_setup_sfp_modules(struct txgbe_hw *hw)if (hw->phy.sfp_type == txgbe_sfp_type_unknown)return 0 ; -txgbe_init_mac_link_ops (hw); +txgbe_init_mac_link_ops_sp (hw);/* PHY config will finish before releasing the semaphore */ err = hw->mac.acquire_swfw_sync (hw,TXGBE_MNGSEM_SWPHY );
@@ -2792,13 +2793,13 @@ s32 txgbe_flash_read_dword(struct txgbe_hw *hw, u32 addr, u32 *data) }/** -* txgbe_init_ops_pf - Inits func ptrs and MAC type +* txgbe_init_ops_generic - Inits func ptrs and MAC type * @hw: pointer to hardware structure * * Initialize the function pointers and assign the MAC type. * Does not touch the hardware. **/ -s32 txgbe_init_ops_pf (struct txgbe_hw *hw) +s32 txgbe_init_ops_generic (struct txgbe_hw *hw) {struct txgbe_bus_info *bus = &hw->bus;struct txgbe_mac_info *mac = &hw->mac;
@@ -2918,15 +2919,31 @@ s32 txgbe_init_ops_pf(struct txgbe_hw *hw)return 0 ; } +void txgbe_init_ops_sp (struct txgbe_hw *hw) +{ +struct txgbe_mac_info *mac = &hw->mac; +struct txgbe_phy_info *phy = &hw->phy; + +txgbe_init_ops_generic (hw); + +/* PHY */ + phy->get_media_type = txgbe_get_media_type_sp; + +/* LINK */ + mac->init_mac_link_ops = txgbe_init_mac_link_ops_sp; + mac->get_link_capabilities = txgbe_get_link_capabilities_sp; + mac->check_link = txgbe_check_mac_link_sp; +} +/** -* txgbe_get_link_capabilities_raptor - Determines link capabilities +* txgbe_get_link_capabilities_sp - Determines link capabilities * @hw: pointer to hardware structure * @speed: pointer to link speed * @autoneg: true when autoneg or autotry is enabled * * Determines the link capabilities by reading the AUTOC register. **/ -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg) {
@@ -3027,12 +3044,12 @@ s32 txgbe_get_link_capabilities_raptor(struct txgbe_hw *hw, }/** -* txgbe_get_media_type_raptor - Get media type +* txgbe_get_media_type_sp - Get media type * @hw: pointer to hardware structure * * Returns the media type (fiber, copper, backplane) **/ -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw) +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw) {u32 media_type;
@@ -3565,8 +3582,10 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)if (!hw->phy.reset_disable) hw->phy.reset (hw); -/* remember AUTOC from before we reset */ - autoc = hw->mac.autoc_read (hw); +if (hw->mac.type == txgbe_mac_sp) { +/* remember AUTOC from before we reset */ + autoc = hw->mac.autoc_read (hw); + } mac_reset_top:/* Do LAN reset, the MNG domain will not be reset. */
@@ -3615,7 +3634,8 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)msec_delay (50 );/* A temporary solution to set phy */ -txgbe_set_phy_temp (hw); +if (hw->mac.type == txgbe_mac_sp) +txgbe_set_phy_temp (hw); }/* Store the permanent mac address */
drivers/net/txgbe/base/txgbe_hw.h +6 -5
@@ -56,7 +56,7 @@ s32 txgbe_set_vlvf(struct txgbe_hw *hw, u32 vlan, u32 vind,s32 txgbe_clear_vfta (struct txgbe_hw *hw);s32 txgbe_find_vlvf_slot (struct txgbe_hw *hw,u32 vlan,bool vlvf_bypass); -s32 txgbe_check_mac_link (struct txgbe_hw *hw, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete);
@@ -87,10 +87,11 @@ s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg,s32 txgbe_init_shared_code (struct txgbe_hw *hw);bool txgbe_is_pf (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw); -s32 txgbe_init_ops_pf (struct txgbe_hw *hw); -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_init_ops_generic (struct txgbe_hw *hw); +void txgbe_init_ops_sp (struct txgbe_hw *hw); +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg); -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw); +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw);void txgbe_disable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_enable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_flap_tx_laser_multispeed_fiber (struct txgbe_hw *hw);
@@ -104,7 +105,7 @@ s32 txgbe_start_mac_link_raptor(struct txgbe_hw *hw,s32 txgbe_setup_mac_link (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw); -void txgbe_init_mac_link_ops (struct txgbe_hw *hw); +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +4 -4
@@ -1737,11 +1737,11 @@ txgbe_map_reg(struct txgbe_hw *hw, u32 reg) {switch (reg) {case TXGBE_REG_RSSTBL : -if (hw->mac.type == txgbe_mac_raptor_vf) +if (hw->mac.type == txgbe_mac_sp_vf) reg =TXGBE_VFRSSTBL (0 );break ;case TXGBE_REG_RSSKEY : -if (hw->mac.type == txgbe_mac_raptor_vf) +if (hw->mac.type == txgbe_mac_sp_vf) reg =TXGBE_VFRSSKEY (0 );break ;default :
@@ -1917,10 +1917,10 @@ po32m(struct txgbe_hw *hw, u32 reg, u32 mask, u32 expect, u32 *actual,static inline void txgbe_flush (struct txgbe_hw *hw) {switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp:rd32 (hw,TXGBE_PWR );break ; -case txgbe_mac_raptor_vf: +case txgbe_mac_sp_vf:rd32 (hw,TXGBE_VFSTATUS );break ;default :
drivers/net/txgbe/base/txgbe_type.h +3 -2
@@ -139,10 +139,10 @@ enum txgbe_eeprom_type {enum txgbe_mac_type { txgbe_mac_unknown =0 , - txgbe_mac_raptor, + txgbe_mac_sp, txgbe_mac_aml, txgbe_mac_aml40, - txgbe_mac_raptor_vf, + txgbe_mac_sp_vf, txgbe_mac_aml_vf, txgbe_num_macs };
@@ -544,6 +544,7 @@ struct txgbe_mac_info {s32 (*prot_autoc_read)(struct txgbe_hw *hw,bool *locked,u64 *value);s32 (*prot_autoc_write)(struct txgbe_hw *hw,bool locked,u64 value);s32 (*negotiate_api_version)(struct txgbe_hw *hw,int api); +void (*init_mac_link_ops)(struct txgbe_hw *hw);/* Link */ void (*disable_tx_laser)(struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_vf.c +1 -1
@@ -488,7 +488,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_raptor_vf && wait_to_complete) { +if (mac->type == txgbe_mac_sp_vf && wait_to_complete) {if (po32m (hw,TXGBE_VFSTATUS ,TXGBE_VFSTATUS_UP ,0 ,NULL ,5 ,100 )) goto out;
drivers/net/txgbe/txgbe_ethdev.c +7 -7
@@ -385,7 +385,7 @@ txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,uint32_t q_map;uint8_t n, offset; -if (hw->mac.type != txgbe_mac_raptor) +if (hw->mac.type != txgbe_mac_sp)return -ENOSYS ;if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK )
@@ -1806,7 +1806,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) }/* Skip link setup if loopback mode is enabled. */ -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && dev->data->dev_conf.lpbk_mode) goto skip_link_setup;
@@ -3072,7 +3072,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev, }/* Re configure MAC RX */ -if (hw->mac.type == txgbe_mac_raptor) { +if (hw->mac.type == txgbe_mac_sp) { reg =rd32 (hw,TXGBE_MACRXCFG );wr32 (hw,TXGBE_MACRXCFG , reg); wr32m(hw, TXGBE_MACRXFLT, TXGBE_MACRXFLT_PROMISC,
@@ -3858,7 +3858,7 @@ txgbe_uc_hash_table_set(struct rte_eth_dev *dev,struct txgbe_uta_info *uta_info =TXGBE_DEV_UTA_INFO (dev);/* The UTA table only exists on pf hardware */ -if (hw->mac.type < txgbe_mac_raptor) +if (hw->mac.type < txgbe_mac_sp)return -ENOTSUP ; vector =txgbe_uta_vector (hw, mac_addr);
@@ -3903,7 +3903,7 @@ txgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on)int i;/* The UTA table only exists on pf hardware */ -if (hw->mac.type < txgbe_mac_raptor) +if (hw->mac.type < txgbe_mac_sp)return -ENOTSUP ;if (on) {
@@ -4969,8 +4969,8 @@ bool txgbe_rss_update_sp(enum txgbe_mac_type mac_type) {switch (mac_type) { -case txgbe_mac_raptor: -case txgbe_mac_raptor_vf: +case txgbe_mac_sp: +case txgbe_mac_sp_vf:return 1 ;default :return 0 ;
drivers/net/txgbe/txgbe_ethdev_vf.c +1 -1
@@ -375,7 +375,7 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev)PMD_INIT_LOG (DEBUG ,"port %d vendorID=0x%x deviceID=0x%x mac.type=%s" , eth_dev->data->port_id, pci_dev->id.vendor_id, - pci_dev->id.device_id,"txgbe_mac_raptor_vf" ); + pci_dev->id.device_id,"txgbe_mac_sp_vf" );return 0 ; }
drivers/net/txgbe/txgbe_flow.c +1 -1
@@ -2854,7 +2854,7 @@ txgbe_parse_fdir_filter(struct rte_eth_dev *dev, step_next: -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && rule->fdirflags ==TXGBE_FDIRPICMD_DROP && (rule->input.src_port !=0 || rule->input.dst_port !=0 ))return -ENOTSUP ;
drivers/net/txgbe/txgbe_rxtx.c +12 -12
@@ -80,7 +80,7 @@ txgbe_is_vf(struct rte_eth_dev *dev)struct txgbe_hw *hw =TXGBE_DEV_HW (dev);switch (hw->mac.type) { -case txgbe_mac_raptor_vf: +case txgbe_mac_sp_vf:return 1 ;default :return 0 ;
@@ -2121,10 +2121,10 @@ txgbe_get_rx_port_offloads(struct rte_eth_dev *dev)* RSC is only supported by PF devices in a non-SR-IOV * mode. */ -if (hw->mac.type == txgbe_mac_raptor && !sriov->active) +if (hw->mac.type == txgbe_mac_sp && !sriov->active) offloads |=RTE_ETH_RX_OFFLOAD_TCP_LRO ; -if (hw->mac.type == txgbe_mac_raptor) +if (hw->mac.type == txgbe_mac_sp) offloads |=RTE_ETH_RX_OFFLOAD_MACSEC_STRIP ; offloads |=RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM ;
@@ -2498,7 +2498,7 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,/* Modification to set tail pointer for virtual function * if vf is detected. */ -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { txq->tdt_reg_addr =TXGBE_REG_ADDR (hw,TXGBE_TXWP (queue_idx)); txq->tdc_reg_addr =TXGBE_REG_ADDR (hw,TXGBE_TXCFG (queue_idx)); }else {
@@ -2791,7 +2791,7 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,/* * Modified to setup VFRDT for Virtual Function */ -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { rxq->rdt_reg_addr =TXGBE_REG_ADDR (hw,TXGBE_RXWP (queue_idx)); rxq->rdh_reg_addr =
@@ -3037,7 +3037,7 @@ txgbe_rss_disable(struct rte_eth_dev *dev)struct txgbe_hw *hw; hw =TXGBE_DEV_HW (dev); -if (hw->mac.type == txgbe_mac_raptor_vf) +if (hw->mac.type == txgbe_mac_sp_vf)wr32m (hw,TXGBE_VFPLCFG ,TXGBE_VFPLCFG_RSSENA ,0 );else wr32m (hw,TXGBE_RACTL ,TXGBE_RACTL_RSSENA ,0 );
@@ -3074,7 +3074,7 @@ txgbe_dev_rss_hash_update(struct rte_eth_dev *dev,/* Set configured hashing protocols */ rss_hf = rss_conf->rss_hf &TXGBE_RSS_OFFLOAD_ALL ; -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { mrqc =rd32 (hw,TXGBE_VFPLCFG ); mrqc &= ~TXGBE_VFPLCFG_RSSMASK ;if (rss_hf &RTE_ETH_RSS_IPV4 )
@@ -3166,7 +3166,7 @@ txgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev, } rss_hf =0 ; -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { mrqc =rd32 (hw,TXGBE_VFPLCFG );if (mrqc &TXGBE_VFPLCFG_RSSIPV4 ) rss_hf |=RTE_ETH_RSS_IPV4 ;
@@ -3627,7 +3627,7 @@ txgbe_dcb_hw_arbite_tx_config(struct txgbe_hw *hw, uint16_t *refill, uint16_t *max, uint8_t *bwg_id, uint8_t *tsa, uint8_t *map) { switch (hw->mac.type) { - case txgbe_mac_raptor: + case txgbe_mac_sp:txgbe_dcb_config_tx_desc_arbiter_raptor (hw ,refill ,max ,bwg_id ,tsa ); txgbe_dcb_config_tx_data_arbiter_raptor(hw, refill,
@@ -4555,7 +4555,7 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev)* If loopback mode is configured, set LPBK bit. */ hlreg0 =rd32 (hw,TXGBE_PSRCTL ); -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && dev->data->dev_conf.lpbk_mode) hlreg0 |=TXGBE_PSRCTL_LBENA ;else
@@ -4640,7 +4640,7 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev)wr32 (hw,TXGBE_PSRCTL , rxcsum); -if (hw->mac.type == txgbe_mac_raptor) { +if (hw->mac.type == txgbe_mac_sp) { rdrxctl =rd32 (hw,TXGBE_SECRXCTL );if (rx_conf->offloads &RTE_ETH_RX_OFFLOAD_KEEP_CRC ) rdrxctl &= ~TXGBE_SECRXCTL_CRCSTRIP ;
@@ -4765,7 +4765,7 @@ txgbe_dev_rxtx_start(struct rte_eth_dev *dev) hw->mac.enable_rx_dma (hw, rxctrl);/* If loopback mode is enabled, set up the link accordingly */ -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && dev->data->dev_conf.lpbk_mode)txgbe_setup_loopback_link_raptor (hw);
Signature · 1 line
2.21.0.windows.1
PATCH v4 5/20 net/txgbe: add basic link configuration for Amber-Lite NICs
In reply to Zaiyu WangDue to Amber-Lite's significant differences from our 10G NICs, we split link configuration components (setup_link, check_link, etc.) into new files.
--- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 296 +++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 21 ++ drivers/net/txgbe/base/txgbe_aml40.c | 126 ++++++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_hw.c | 49 ++++- drivers/net/txgbe/base/txgbe_hw.h | 2 + drivers/net/txgbe/base/txgbe_regs.h | 9 + drivers/net/txgbe/base/txgbe_type.h | 1 + drivers/net/txgbe/txgbe_ethdev.c | 8 + 10 files changed, 528 insertions(+), 6 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
drivers/net/txgbe/base/meson.build +2 -0
@@ -6,6 +6,8 @@ base_sources = files( 'txgbe_dcb.c', 'txgbe_eeprom.c', 'txgbe_hw.c', + 'txgbe_aml.c', + 'txgbe_aml40.c', 'txgbe_mbx.c', 'txgbe_mng.c', 'txgbe_phy.c',
drivers/net/txgbe/base/txgbe_aml.c new file +296 -0
296 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML_H_ +#define _TXGBE_AML_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml (struct txgbe_hw *hw, +u32 *speed, +bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw); +#endif /* _TXGBE_AML_H_ */
drivers/net/txgbe/base/txgbe_aml40.c new file +126 -0
126 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml40.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML40_H_ +#define _TXGBE_AML40_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml40 (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml40 (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml40 (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw); +#endif /* _TXGBE_AML40_H_ */
drivers/net/txgbe/base/txgbe_hw.c +43 -6
97 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_hw.h +2 -0
@@ -116,4 +116,6 @@ s32 txgbe_reinit_fdir_tables(struct txgbe_hw *hw);bool txgbe_verify_lesm_fw_enabled_raptor (struct txgbe_hw *hw);s32 txgbe_fmgr_cmd_op (struct txgbe_hw *hw,u32 cmd,u32 cmd_addr);s32 txgbe_flash_read_dword (struct txgbe_hw *hw,u32 addr,u32 *data); +s32 txgbe_e56_check_phy_link (struct txgbe_hw *hw,u32 *speed, +bool *link_up);#endif /* _TXGBE_HW_H_ */
drivers/net/txgbe/base/txgbe_regs.h +9 -0
@@ -1581,6 +1581,15 @@ enum txgbe_5tuple_protocol {#define TXGBE_PORTSTAT_BW_100M MS(3, 0x1)#define TXGBE_PORTSTAT_ID (r) RS(r, 8, 0x1) +/* amlite: diff from sapphire */ +#define TXGBE_CFG_PORT_ST_AML_LINK_MASK MS(1, 0xF) +#define TXGBE_CFG_PORT_ST_AML_LINK_10G MS(4, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_25G MS(3, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_40G MS(2, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_50G MS(1, 0x1) + +#define TXGBE_AML_PHY_LINK_UP MS(2, 0x1) +#define TXGBE_VXLAN 0x014410#define TXGBE_VXLAN_GPE 0x014414#define TXGBE_GENEVE 0x014418
drivers/net/txgbe/base/txgbe_type.h +1 -0
@@ -828,6 +828,7 @@ struct txgbe_hw {u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; +rte_spinlock_t phy_lock;/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy;
drivers/net/txgbe/txgbe_ethdev.c +8 -0
@@ -3069,6 +3069,14 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,case TXGBE_LINK_SPEED_10GB_FULL : link.link_speed =RTE_ETH_SPEED_NUM_10G ;break ; + +case TXGBE_LINK_SPEED_25GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_25G ; +break ; + +case TXGBE_LINK_SPEED_40GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_40G ; +break ; }/* Re configure MAC RX */
Signature · 1 line
2.21.0.windows.1
PATCH v4 6/20 net/txgbe: add support for PHY configuration via SW-FW mailbox
In reply to Zaiyu WangMigrate Amber-Lite PHY configuration to firmware due to complexity. Driver now sends mailbox commands for link state changes, handled by firmware’s intricate PHY setup process
--- drivers/net/txgbe/base/txgbe_aml.c | 37 ++++++++++++++++++++++++++-- drivers/net/txgbe/base/txgbe_aml40.c | 37 +++++++++++++++++++++++++++- drivers/net/txgbe/base/txgbe_hw.c | 1 + drivers/net/txgbe/base/txgbe_mng.c | 36 +++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_mng.h | 17 +++++++++++++ drivers/net/txgbe/base/txgbe_type.h | 7 ++++++ 6 files changed, 132 insertions(+), 3 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +35 -2
@@ -131,6 +131,26 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +{ +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +int cnt =0 ; +int i; + +if (speed ==TXGBE_LINK_SPEED_25GB_FULL ) + cnt =4 ; +else + cnt =1 ; + +for (i =0 ; i < (4 * cnt); i++) { + hw->mac.check_link (hw, &link_speed, &link_up, false); +if (link_up) +break ; +msleep (250 ); + } +} +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete)
@@ -142,8 +162,6 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw,u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ;u32 value =0 ; -UNREFERENCED_PARAMETER (autoneg_wait_to_complete); -if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );return 0 ;
@@ -163,6 +181,21 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw,if (value & (TXGBE_SFP1_MOD_ABS_LS |TXGBE_SFP1_RX_LOS_LS ))return status; + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); + +if (link_speed == speed && link_up) +return status; + +if (speed &TXGBE_LINK_SPEED_25GB_FULL ) + speed =0x10 ; +else if (speed &TXGBE_LINK_SPEED_10GB_FULL ) + speed =0x08 ; + + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); + +txgbe_wait_for_link_up_aml (hw, speed); +return status; }
drivers/net/txgbe/base/txgbe_aml40.c +36 -1
@@ -107,7 +107,42 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 speed, bool autoneg_wait_to_complete) { -return 0 ; + bool autoneg = false; +s32 status =0 ; +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; +u32 value =0 ; + +if (hw->phy.sfp_type == txgbe_sfp_type_not_present) { +DEBUGOUT ("SFP not detected, skip setup mac link" ); +return 0 ; + } + +/* Check to see if speed passed in is supported. */ + status = hw->mac.get_link_capabilities (hw, + &link_capabilities, &autoneg); +if (status) +return status; + + speed &= link_capabilities; +if (speed ==TXGBE_LINK_SPEED_UNKNOWN ) +return TXGBE_ERR_LINK_SETUP ; + + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); + +if (link_speed == speed && link_up) +return status; + +if (speed &TXGBE_LINK_SPEED_40GB_FULL ) + speed =0x20 ; + + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); + +txgbe_wait_for_link_up_aml (hw, speed); + +return status; }void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw)
drivers/net/txgbe/base/txgbe_hw.c +1 -0
@@ -2836,6 +2836,7 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) phy->write_i2c_byte_unlocked = txgbe_write_i2c_byte_unlocked; phy->check_overtemp = txgbe_check_overtemp; phy->reset = txgbe_reset_phy; + phy->set_link_hostif = txgbe_hic_ephy_set_link;/* MAC */ mac->init_hw = txgbe_init_hw;
drivers/net/txgbe/base/txgbe_mng.c +36 -0
@@ -602,3 +602,39 @@ s32 txgbe_hic_set_lldp(struct txgbe_hw *hw, bool on)return txgbe_host_interface_command (hw, (u32 *)&buffer,sizeof (buffer),TXGBE_HI_COMMAND_TIMEOUT , false); } + +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex) +{ +struct txgbe_hic_ephy_setlink buffer; +s32 status; +int i; + + buffer.hdr.cmd =FW_PHY_CONFIG_LINK_CMD ; + buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); + buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; + + buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.speed = speed; + buffer.autoneg = autoneg; + buffer.duplex = duplex; + +for (i =0 ; i <=FW_CEM_MAX_RETRIES ; i++) { + status =txgbe_host_interface_command (hw, (u32 *)&buffer, +sizeof (buffer), +TXGBE_HI_COMMAND_TIMEOUT_SHORT , true); +if (status !=0 ) { +msleep (1 ); +continue ; + } + +if (buffer.hdr.cmd_or_resp.ret_status == +FW_CEM_RESP_STATUS_SUCCESS ) + status =0 ; +else + status =TXGBE_ERR_HOST_INTERFACE_COMMAND ; + +break ; + } + +return status; +}
drivers/net/txgbe/base/txgbe_mng.h +17 -0
@@ -13,6 +13,7 @@#define TXGBE_PMMBX_BSIZE (TXGBE_PMMBX_QSIZE * 4)#define TXGBE_PMMBX_DATA_SIZE (TXGBE_PMMBX_BSIZE - FW_NVM_DATA_OFFSET * 4)#define TXGBE_HI_COMMAND_TIMEOUT 5000/* Process HI command limit */ +#define TXGBE_HI_COMMAND_TIMEOUT_SHORT 500/* Process HI command limit */ #define TXGBE_HI_FLASH_ERASE_TIMEOUT 5000/* Process Erase command limit */ #define TXGBE_HI_FLASH_UPDATE_TIMEOUT 5000/* Process Update command limit */ #define TXGBE_HI_FLASH_VERIFY_TIMEOUT 60000/* Process Apply command limit */
@@ -56,6 +57,12 @@#define FW_LLDP_GET_CMD 0xF2#define FW_LLDP_SET_CMD_OFF 0xF1#define FW_LLDP_SET_CMD_ON 0xF0 +#define FW_PHY_CONFIG_READ_CMD 0xc0 +#define FW_PHY_CONFIG_LINK_CMD 0xc1 +#define FW_PHY_CONFIG_FC_CMD 0xc2 +#define FW_PHY_CONFIG_POWER_CMD 0xc3 +#define FW_PHY_CONFIG_RESET_CMD 0xc4 +#define FW_READ_SFP_INFO_CMD 0xc5#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376
@@ -101,6 +108,15 @@ union txgbe_hic_hdr2 {struct txgbe_hic_hdr2_rsp rsp; }; +struct txgbe_hic_ephy_setlink { +struct txgbe_hic_hdr hdr; +u8 speed; +u8 duplex; +u8 autoneg; +u8 fec_mode; +u8 resv[4 ]; +}; +struct txgbe_hic_drv_info {struct txgbe_hic_hdr hdr;u8 port_num;
@@ -204,5 +220,6 @@ bool txgbe_mng_present(struct txgbe_hw *hw);bool txgbe_mng_enabled (struct txgbe_hw *hw);s32 txgbe_hic_get_lldp (struct txgbe_hw *hw);s32 txgbe_hic_set_lldp (struct txgbe_hw *hw,bool on); +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);#endif /* _TXGBE_MNG_H_ */
drivers/net/txgbe/base/txgbe_type.h +7 -0
@@ -681,6 +681,7 @@ struct txgbe_phy_info { u8 *value);s32 (*write_i2c_byte_unlocked)(struct txgbe_hw *hw,u8 offset,u8 addr,u8 value); +s32 (*set_link_hostif)(struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);enum txgbe_phy_type type;u32 addr;
@@ -764,6 +765,12 @@ enum txgbe_isb_idx {TXGBE_ISB_MAX }; +#define TXGBE_PHY_FEC_RS MS(0, 0x1) +#define TXGBE_PHY_FEC_BASER MS(1, 0x1) +#define TXGBE_PHY_FEC_OFF MS(2, 0x1) +#define TXGBE_PHY_FEC_AUTO (TXGBE_PHY_FEC_OFF | TXGBE_PHY_FEC_BASER |\ + TXGBE_PHY_FEC_RS) +struct txgbe_devargs {u16 auto_neg;u16 poll;
Signature · 1 line
2.21.0.windows.1
PATCH v4 7/20 net/txgbe: add RX&TX support for Amber-Lite NICs
In reply to Zaiyu WangThe packet handling workflow largely reuses the existing 10G NIC’s process, so we adjusted driver conditional checks rather than making major changes to the overall flow.
--- drivers/net/txgbe/base/txgbe_aml.c | 2 +- drivers/net/txgbe/base/txgbe_aml.h | 1 + drivers/net/txgbe/base/txgbe_aml40.c | 1 - drivers/net/txgbe/base/txgbe_hw.c | 17 ++++++++ drivers/net/txgbe/base/txgbe_hw.h | 1 + drivers/net/txgbe/base/txgbe_regs.h | 31 ++++++++++++++ drivers/net/txgbe/txgbe_ethdev.c | 12 ++++-- drivers/net/txgbe/txgbe_rxtx.c | 64 +++++++++++++++------------- 8 files changed, 94 insertions(+), 35 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +1 -1
@@ -131,7 +131,7 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } -static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;
drivers/net/txgbe/base/txgbe_aml.h +1 -0
@@ -15,6 +15,7 @@ s32 txgbe_check_mac_link_aml(struct txgbe_hw *hw,s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw,u32 *speed,bool *autoneg);u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed);s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_aml40.c +0 -1
@@ -112,7 +112,6 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; -u32 value =0 ;if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );
drivers/net/txgbe/base/txgbe_hw.c +17 -0
@@ -20,6 +20,7 @@#define TXGBE_RAPTOR_MC_TBL_SIZE 128#define TXGBE_RAPTOR_VFT_TBL_SIZE 128#define TXGBE_RAPTOR_RX_PB_SIZE 512/*KB*/ +#define TXGBE_AML_RX_PB_SIZE 768 static s32 txgbe_setup_copper_link_raptor(struct txgbe_hw *hw, u32 speed,
@@ -2505,6 +2506,19 @@ bool txgbe_is_pf(struct txgbe_hw *hw) {switch (hw->mac.type) {case txgbe_mac_sp: +case txgbe_mac_aml: +case txgbe_mac_aml40: +return true; +default : +return false; + } +} + +bool txgbe_is_vf (struct txgbe_hw *hw) +{ +switch (hw->mac.type) { +case txgbe_mac_sp_vf: +case txgbe_mac_aml_vf:return true;default :return false;
@@ -2920,6 +2934,9 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) mac->max_rx_queues =TXGBE_RAPTOR_MAX_RX_QUEUES ; mac->max_tx_queues =TXGBE_RAPTOR_MAX_TX_QUEUES ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) + mac->rx_pb_size =TXGBE_AML_RX_PB_SIZE ; +return 0 ; }
drivers/net/txgbe/base/txgbe_hw.h +1 -0
@@ -86,6 +86,7 @@ s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg, u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);s32 txgbe_init_shared_code (struct txgbe_hw *hw);bool txgbe_is_pf (struct txgbe_hw *hw); +bool txgbe_is_vf (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw);s32 txgbe_init_ops_generic (struct txgbe_hw *hw);void txgbe_init_ops_sp (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +31 -0
@@ -318,12 +318,18 @@#define TXGBE_LEDCTL_1G MS(2, 0x1)#define TXGBE_LEDCTL_100M MS(3, 0x1)#define TXGBE_LEDCTL_ACTIVE MS(4, 0x1) +#define TXGBE_LINKUP_FILTER 0x014428#define TXGBE_TAGTPID (i) (0x014430 + (i) * 4)/* 0-3 */ #define TXGBE_TAGTPID_LSB_MASK MS(0, 0xFFFF)#define TXGBE_TAGTPID_LSB (v) LS(v, 0, 0xFFFF)#define TXGBE_TAGTPID_MSB_MASK MS(16, 0xFFFF)#define TXGBE_TAGTPID_MSB (v) LS(v, 16, 0xFFFF) +/*AML LINK STATUS OVERWRITE*/ +#define TXGBE_AML_EPCS_MISC_CTL 0x13240 +#define TXGBE_AML_LINK_STATUS_OVRD_EN MS(5, 0x1) +#define TXGBE_AML_LINK_STATUS_OVRD_VAL MS(4, 0x1) +/** * GPIO Control * P0: link speed change
@@ -1393,7 +1399,9 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_HTHRESH_MASK MS(8, 0xF)#define TXGBE_TXCFG_HTHRESH (v) LS(v, 8, 0xF)#define TXGBE_TXCFG_WTHRESH_MASK MS(16, 0x7F) +#define TXGBE_TXCFG_WTHRESH_MASK_AML MS(16, 0x1FF)#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F) +#define TXGBE_TXCFG_WTHRESH_AML (v) LS(v, 16, 0x1FF)#define TXGBE_TXCFG_FLUSH MS(26, 0x1)#define TXGBE_TDM_DESC_CHK (i) (0x0180B0 + (i) * 4)/*0-3*/
@@ -1638,6 +1646,16 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBRXCTL_WSP MS(2, 0x1)#define TXGBE_ARBRXCTL_DIA MS(6, 0x1) +#define TXGBE_RDM_VF_RE (_i) (0x12004 + ((_i) * 4)) +#define TXGBE_RDM_VFRE_CLR (_i) (0x120A0 + ((_i) * 4)) +#define TXGBE_RDM_RSC_CTL 0x1200C +/* amlite: rdm_rsc_ctl_free_ctl */ +#define TXGBE_RDM_RSC_CTL_FREE_CTL MS(7, 0x1) +#define TXGBE_RDM_RSC_CTL_FREE_CNT_DIS MS(8, 0x1) +#define TXGBE_RDM_ARB_CFG (_i) (0x12040 + ((_i) * 4))/* 8 of these (0-7) */ +#define TXGBE_RDM_PF_QDE (_i) (0x12080 + ((_i) * 4)) +#define TXGBE_RDM_PF_HIDE (_i) (0x12090 + ((_i) * 4)) +#define TXGBE_RPUP2TC 0x019008#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7
@@ -1712,6 +1730,19 @@ enum txgbe_5tuple_protocol {#define TXGBE_MACTXCFG_SPEED_10G LS(0, 29, 0x3)#define TXGBE_MACTXCFG_SPEED_1G LS(3, 29, 0x3) +#define TXGBE_MAC_TX_CFG_AML_SPEED_MASK MS(28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_50G LS(2, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_40G LS(0, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_25G LS(1, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_10G LS(4, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_1G LS(7, 28, 0x7) + +#define TXGBE_MAC_MISC_CTL 0x11f00 +#define TXGBE_MAC_MISC_LINK_STS_MOD MS(0, 0x1) +#define TXGBE_LINK_BOTH_PCS_MAC MS(0, 0x1) + +#define TXGBE_EPHY_STAT 0x13404 +#define TXGBE_EPHY_STAT_PPL_LOCK 0x3#define TXGBE_ISBADDRL 0x000160#define TXGBE_ISBADDRH 0x000164
drivers/net/txgbe/txgbe_ethdev.c +9 -3
@@ -385,7 +385,7 @@ txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,uint32_t q_map;uint8_t n, offset; -if (hw->mac.type != txgbe_mac_sp) +if (!txgbe_is_pf (hw))return -ENOSYS ;if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK )
@@ -1806,7 +1806,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) }/* Skip link setup if loopback mode is enabled. */ -if (hw->mac.type == txgbe_mac_sp && +if (txgbe_is_pf (hw) && dev->data->dev_conf.lpbk_mode) goto skip_link_setup;
@@ -2817,6 +2817,7 @@ txgbe_dev_sfp_event(struct rte_eth_dev *dev)wr32 (hw,TXGBE_GPIOINTMASK ,0xFF ); reg =rd32 (hw,TXGBE_GPIORAWINTSTAT ); +if (reg &TXGBE_GPIOBIT_0 )wr32 (hw,TXGBE_GPIOEOI ,TXGBE_GPIOBIT_0 );if (reg &TXGBE_GPIOBIT_2 ) {
@@ -3079,8 +3080,13 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,break ; } +/* enable mac receiver */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); + } +/* Re configure MAC RX */ -if (hw->mac.type == txgbe_mac_sp) { +if (txgbe_is_pf (hw)) { reg =rd32 (hw,TXGBE_MACRXCFG );wr32 (hw,TXGBE_MACRXCFG , reg); wr32m(hw, TXGBE_MACRXFLT, TXGBE_MACRXFLT_PROMISC,
drivers/net/txgbe/txgbe_rxtx.c +34 -30
162 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v4 8/20 net/txgbe: add hardware reset change for Amber-Lite NICs
In reply to Zaiyu WangAdd necessary configurations for Amber-Lite's hardware reset process, which differs from the 10G NIC's. These configurations may be modified in future to accommodate further changes.
--- drivers/net/txgbe/base/txgbe_hw.c | 64 +++++++++++++++++++++++------ drivers/net/txgbe/base/txgbe_regs.h | 2 + 2 files changed, 53 insertions(+), 13 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +51 -13
@@ -276,6 +276,8 @@ s32 txgbe_start_hw(struct txgbe_hw *hw)/* Cache bit indicating need for crosstalk fix */ switch (hw->mac.type) {case txgbe_mac_sp: +case txgbe_mac_aml: +case txgbe_mac_aml40: hw->mac.get_device_caps (hw, &device_caps);if (device_caps &TXGBE_DEVICE_CAPS_NO_CROSSTALK_WR ) hw->need_crosstalk_fix = false;
@@ -3507,13 +3509,37 @@ txgbe_reset_misc(struct txgbe_hw *hw) {int i;u32 value; +int err =0 ; +u32 speed;wr32 (hw,TXGBE_ISBADDRL , hw->isb_dma &0x00000000FFFFFFFF );wr32 (hw,TXGBE_ISBADDRH , hw->isb_dma >>32 ); - value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); -if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) - hw->link_status =TXGBE_LINK_STATUS_NONE ; +if (hw->mac.type == txgbe_mac_aml) { +if ((rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK ) + !=TXGBE_EPHY_STAT_PPL_LOCK ) { + speed =TXGBE_LINK_SPEED_25GB_FULL + |TXGBE_LINK_SPEED_10GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else if (hw->mac.type == txgbe_mac_aml40) { +if (!(rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK )) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else { + value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); +if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) + hw->link_status =TXGBE_LINK_STATUS_NONE ; + }/* receive packets that size > 2048 */ wr32m(hw, TXGBE_MACRXCFG,
@@ -3576,7 +3602,7 @@ txgbe_reset_misc(struct txgbe_hw *hw)s32 txgbe_reset_hw (struct txgbe_hw *hw) {s32 status; -u32 autoc; +u32 autoc =0 ;/* Call adapter stop to disable tx/rx and clear interrupts */ status = hw->mac.stop_hw (hw);
@@ -3638,16 +3664,28 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw) goto mac_reset_top; } -/* -* Store the original AUTOC/AUTOC2 values if they have not been -* stored off yet. Otherwise restore the stored original -* values since the reset operation sets back to defaults. -*/ -if (!hw->mac.orig_link_settings_stored) { - hw->mac.orig_autoc = hw->mac.autoc_read (hw); - hw->mac.orig_link_settings_stored = true; +/* amlite TODO*/ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_LINKUP_FILTER ,30 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); +/* amlite: bme */ +wr32 (hw,TXGBE_PX_PF_BME ,TXGBE_PX_PF_BME_EN ); +/* amlite: rdm_rsc_ctl_free_ctl set to 1 */ +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); }else { - hw->mac.orig_autoc = autoc; +/* +* Store the original AUTOC/AUTOC2 values if they have not been +* stored off yet. Otherwise restore the stored original +* values since the reset operation sets back to defaults. +*/ +if (!hw->mac.orig_link_settings_stored) { + hw->mac.orig_autoc = hw->mac.autoc_read (hw); + hw->mac.orig_link_settings_stored = true; + }else { + hw->mac.orig_autoc = autoc; + } }if (hw->phy.ffe_set) {
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1238,6 +1238,8 @@ enum txgbe_5tuple_protocol { TXGBE_ICRMISC_LNKUP)#define TXGBE_ICSMISC 0x000104#define TXGBE_IENMISC 0x000108 +#define TXGBE_PX_PF_BME 0x0004B8 +#define TXGBE_PX_PF_BME_EN MS(0, 0x1)#define TXGBE_IVARMISC 0x0004FC#define TXGBE_IVARMISC_VEC (v) LS(v, 0, 0x7)#define TXGBE_IVARMISC_VLD MS(7, 0x1)
Signature · 1 line
2.21.0.windows.1
PATCH v4 9/20 net/txgbe: add MAC reconfiguration to avoid packet loss
In reply to Zaiyu WangThere was a bug that RX will lose the first packet when down/up port.
When PHY is configured, mac error code is reported to the MAC layer, and MAC locked this status without unlocking. As a result, when the first packet is reveived, MAC reports this error code and RDB dismissed this packet.
Do MAC reset can clean MAC error code so we can fix this bug.
--- drivers/net/txgbe/base/txgbe_hw.c | 37 +++++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_hw.h | 1 + drivers/net/txgbe/base/txgbe_regs.h | 2 ++ drivers/net/txgbe/txgbe_ethdev.c | 1 + 4 files changed, 41 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +37 -0
@@ -3504,6 +3504,43 @@ txgbe_check_flash_load(struct txgbe_hw *hw, u32 check_bit)return err; } +int txgbe_reconfig_mac (struct txgbe_hw *hw) +{ +u32 mac_wdg_timeout; +u32 mac_flow_ctrl; + + mac_wdg_timeout =rd32 (hw,TXGBE_MAC_WDG_TIMEOUT ); + mac_flow_ctrl =rd32 (hw,TXGBE_RXFCCFG ); + +if (hw->bus.lan_id ==0 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_0 ); +else if (hw->bus.lan_id ==1 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_1 ); + +/* wait for mac reset complete */ +usec_delay (1500 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); + +/* receive packets that size > 2048 */ +wr32m (hw,TXGBE_MACRXCFG , +TXGBE_MACRXCFG_JUMBO ,TXGBE_MACRXCFG_JUMBO ); + +/* clear counters on read */ +wr32m (hw,TXGBE_MACCNTCTL , +TXGBE_MACCNTCTL_RC ,TXGBE_MACCNTCTL_RC ); + +wr32m (hw,TXGBE_RXFCCFG , +TXGBE_RXFCCFG_FC ,TXGBE_RXFCCFG_FC ); + +wr32 (hw,TXGBE_MACRXFLT ,TXGBE_MACRXFLT_PROMISC ); + +wr32 (hw,TXGBE_MAC_WDG_TIMEOUT , mac_wdg_timeout); +wr32 (hw,TXGBE_RXFCCFG , mac_flow_ctrl); + +return 0 ; +} +static void txgbe_reset_misc (struct txgbe_hw *hw) {
drivers/net/txgbe/base/txgbe_hw.h +1 -0
@@ -107,6 +107,7 @@ s32 txgbe_setup_mac_link(struct txgbe_hw *hw, u32 speed, bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw);void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw); +int txgbe_reconfig_mac (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -158,6 +158,8 @@#define TXGBE_RST_SW MS(0, 0x1)#define TXGBE_RST_LAN (i) MS(((i) + 1), 0x1)#define TXGBE_RST_FW MS(3, 0x1) +#define TXGBE_RST_MAC_LAN_1 MS(17, 0x1) +#define TXGBE_RST_MAC_LAN_0 MS(20, 0x1)#define TXGBE_RST_ETH (i) MS(((i) + 29), 0x1)#define TXGBE_RST_GLB MS(31, 0x1)#define TXGBE_RST_DEFAULT (TXGBE_RST_SW | \
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -3082,6 +3082,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,/* enable mac receiver */ if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +txgbe_reconfig_mac (hw);wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); }
Signature · 1 line
2.21.0.windows.1
PATCH v4 10/20 net/txgbe: add TX head Write-Back mode for Amber-Lite NICs
In reply to Zaiyu WangAdd TX head Write-Back mode for Amber-Lite NICs. When enabled, the hardware no longer individually rewrites descriptors but intermittently notifies the driver of processed descriptor indices. This feature significantly improves performance and is enabled by default in the driver. Users can configure it via tx_headwb and tx_headwb_size in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 7 ++ drivers/net/txgbe/base/txgbe_type.h | 6 ++ drivers/net/txgbe/txgbe_ethdev.c | 13 ++- drivers/net/txgbe/txgbe_rxtx.c | 124 ++++++++++++++++++---- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +++-- 6 files changed, 153 insertions(+), 27 deletions(-)
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -1407,6 +1407,13 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F)#define TXGBE_TXCFG_WTHRESH_AML (v) LS(v, 16, 0x1FF)#define TXGBE_TXCFG_FLUSH MS(26, 0x1) +#define TXGBE_PX_TR_CFG_HEAD_WB MS(27, 0x1)/* amlite head wb */ +#define TXGBE_PX_TR_CFG_HEAD_WB_64BYTE MS(28, 0x1)/* amlite head wb 64byte */ +#define TXGBE_PX_TR_CFG_HEAD_WB_MASK MS(27, 0x3) + +/* amlite: tx head wb */ +#define TXGBE_PX_TR_HEAD_ADDRL (_i) (0x03028 + ((_i) * 0x40)) +#define TXGBE_PX_TR_HEAD_ADDRH (_i) (0x0302C + ((_i) * 0x40))#define TXGBE_TDM_DESC_CHK (i) (0x0180B0 + (i) * 4)/*0-3*/ #define TXGBE_TDM_DESC_NONFATAL (i) (0x0180C0 + (i) * 4)/*0-3*/
drivers/net/txgbe/base/txgbe_type.h +6 -0
@@ -716,6 +716,8 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_MAIN "ffe_main"#define TXGBE_DEVARG_FFE_PRE "ffe_pre"#define TXGBE_DEVARG_FFE_POST "ffe_post" +#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb" +#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -726,6 +728,8 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_MAIN ,TXGBE_DEVARG_FFE_PRE ,TXGBE_DEVARG_FFE_POST , +TXGBE_DEVARG_TX_HEAD_WB , +TXGBE_DEVARG_TX_HEAD_WB_SIZE , NULL };
@@ -776,6 +780,8 @@ struct txgbe_devargs {u16 poll;u16 present;u16 sgmii; +u16 tx_headwb; +u16 tx_headwb_size; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +12 -1
@@ -513,6 +513,9 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)u16 ffe_main =27 ;u16 ffe_pre =8 ;u16 ffe_post =44 ; +/* New devargs for amberlite config */ +u16 tx_headwb =1 ; +u16 tx_headwb_size =16 ;if (devargs ==NULL ) goto null;
@@ -537,6 +540,10 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &ffe_pre);rte_kvargs_process (kvlist,TXGBE_DEVARG_FFE_POST , &txgbe_handle_devarg, &ffe_post); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB , + &txgbe_handle_devarg, &tx_headwb); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , + &txgbe_handle_devarg, &tx_headwb_size);rte_kvargs_free (kvlist); null:
@@ -544,6 +551,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.poll = poll; hw->devarg.present = present; hw->devarg.sgmii = sgmii; + hw->devarg.tx_headwb = tx_headwb; + hw->devarg.tx_headwb_size = tx_headwb_size; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
@@ -5718,7 +5727,9 @@ RTE_PMD_REGISTER_PARAM_STRING(net_txgbe,TXGBE_DEVARG_FFE_SET "=<0-4>" TXGBE_DEVARG_FFE_MAIN "=<uint16>" TXGBE_DEVARG_FFE_PRE "=<uint16>" - TXGBE_DEVARG_FFE_POST "=<uint16>"); +TXGBE_DEVARG_FFE_POST "=<uint16>" +TXGBE_DEVARG_TX_HEAD_WB "=<0|1>" + TXGBE_DEVARG_TX_HEAD_WB_SIZE "=<1|16>");RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_driver, driver,NOTICE );
drivers/net/txgbe/txgbe_rxtx.c +105 -19
172 lines not on this page · raw message
drivers/net/txgbe/txgbe_rxtx.h +3 -0
@@ -414,6 +414,9 @@ struct txgbe_tx_queue {const struct rte_memzone *mz;uint64_t desc_error;bool resetting; +const struct rte_memzone *headwb; +uint64_t headwb_dma; +volatile uint32_t *headwb_mem; };struct txgbe_txq_ops {
drivers/net/txgbe/txgbe_rxtx_vec_common.h +20 -7
@@ -89,13 +89,26 @@ txgbe_tx_free_bufs(struct txgbe_tx_queue *txq)int nb_free =0 ;struct rte_mbuf *m, *free[RTE_TXGBE_TX_MAX_FREE_BUF_SZ ]; -/* check DD bit on threshold descriptor */ - status = txq->tx_ring[txq->tx_next_dd].dw3; -if (!(status &TXGBE_TXD_DD )) { -if (txq->nb_tx_free >>1 < txq->tx_free_thresh) -txgbe_set32_masked (txq->tdc_reg_addr, -TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); -return 0 ; +if (txq->headwb_mem) { +uint16_t tx_last_dd = txq->nb_tx_desc + + txq->tx_next_dd - txq->tx_free_thresh; +if (tx_last_dd >= txq->nb_tx_desc) + tx_last_dd -= txq->nb_tx_desc; +volatile uint16_t head = (uint16_t )*txq->headwb_mem; +if (txq->tx_next_dd > head && head > tx_last_dd) +return 0 ; +else if (tx_last_dd > txq->tx_next_dd && + (head > tx_last_dd || head < txq->tx_next_dd)) +return 0 ; + }else { +/* check DD bit on threshold descriptor */ + status = txq->tx_ring[txq->tx_next_dd].dw3; +if (!(status &TXGBE_TXD_DD )) { +if (txq->nb_tx_free >>1 < txq->tx_free_thresh) +txgbe_set32_masked (txq->tdc_reg_addr, +TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); +return 0 ; + } } n = txq->tx_free_thresh;
Signature · 1 line
2.21.0.windows.1
PATCH v4 11/20 net/txgbe: add RX desc merge mode for Amber-Lite NICs
In reply to Zaiyu WangAdd RX desc merge mode for Amber-Lite NICs. When enabled, the hardware batch-processes RX packets, significantly enhancing performance. This feature is enabled by default in the driver and can be configured via the rx_desc_merge parameter in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 4 ++++ drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 7 ++++++- drivers/net/txgbe/txgbe_rxtx.c | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-)
drivers/net/txgbe/base/txgbe_regs.h +4 -0
@@ -1377,6 +1377,7 @@ enum txgbe_5tuple_protocol {#define TXGBE_RXCFG_HDRLEN (v) LS(HDRLEN(v), 12, 0xF)#define TXGBE_RXCFG_HDRLEN_MASK MS(12, 0xF)#define TXGBE_RXCFG_WTHRESH (v) LS(v, 16, 0x7) +#define TXGBE_RXCFG_DESC_MERGE MS(19, 0x1)#define TXGBE_RXCFG_ETAG MS(22, 0x1)#define TXGBE_RXCFG_RSCMAX_MASK MS(23, 0x3)#define TXGBE_RXCFG_RSCMAX_1 LS(0, 23, 0x3)
@@ -1671,6 +1672,9 @@ enum txgbe_5tuple_protocol {#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7 +#define TXGBE_RDM_DCACHE_CTL 0x0120A8 +#define TXGBE_RDM_DCACHE_CTL_EN MS(0, 0x1) +/* mac switcher */ #define TXGBE_ETHADDRL 0x016200#define TXGBE_ETHADDRL_AD0 (v) LS(v, 0, 0xFF)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -718,6 +718,7 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_POST "ffe_post"#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb"#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size" +#define TXGBE_DEVARG_RX_DESC_MERGE "rx_desc_merge"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -730,6 +731,7 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_POST ,TXGBE_DEVARG_TX_HEAD_WB ,TXGBE_DEVARG_TX_HEAD_WB_SIZE , +TXGBE_DEVARG_RX_DESC_MERGE , NULL };
@@ -782,6 +784,7 @@ struct txgbe_devargs {u16 sgmii;u16 tx_headwb;u16 tx_headwb_size; +u16 rx_desc_merge; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +6 -1
@@ -516,6 +516,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)/* New devargs for amberlite config */ u16 tx_headwb =1 ;u16 tx_headwb_size =16 ; +u16 rx_desc_merge =1 ;if (devargs ==NULL ) goto null;
@@ -544,6 +545,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &tx_headwb);rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , &txgbe_handle_devarg, &tx_headwb_size); +rte_kvargs_process (kvlist,TXGBE_DEVARG_RX_DESC_MERGE , + &txgbe_handle_devarg, &rx_desc_merge);rte_kvargs_free (kvlist); null:
@@ -553,6 +556,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.sgmii = sgmii; hw->devarg.tx_headwb = tx_headwb; hw->devarg.tx_headwb_size = tx_headwb_size; + hw->devarg.rx_desc_merge = rx_desc_merge; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
@@ -5729,7 +5733,8 @@ RTE_PMD_REGISTER_PARAM_STRING(net_txgbe,TXGBE_DEVARG_FFE_PRE "=<uint16>" TXGBE_DEVARG_FFE_POST "=<uint16>" TXGBE_DEVARG_TX_HEAD_WB "=<0|1>" - TXGBE_DEVARG_TX_HEAD_WB_SIZE "=<1|16>"); +TXGBE_DEVARG_TX_HEAD_WB_SIZE "=<1|16>" + TXGBE_DEVARG_RX_DESC_MERGE "=<0|1>");RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_driver, driver,NOTICE );
drivers/net/txgbe/txgbe_rxtx.c +11 -0
@@ -4667,6 +4667,17 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev) buf_size =ROUND_DOWN (buf_size,0x1 <<10 ); srrctl |=TXGBE_RXCFG_PKTLEN (buf_size); +if ((hw->mac.type == txgbe_mac_aml || + hw->mac.type == txgbe_mac_aml40) && hw->devarg.rx_desc_merge ==1 ) { + srrctl |=TXGBE_RXCFG_DESC_MERGE ; + +wr32 (hw,TXGBE_RDM_DCACHE_CTL ,TXGBE_RDM_DCACHE_CTL_EN ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CNT_DIS , + ~TXGBE_RDM_RSC_CTL_FREE_CNT_DIS ); + } +wr32 (hw,TXGBE_RXCFG (rxq->reg_idx), srrctl);/* It adds dual VLAN length for supporting dual VLAN */
Signature · 1 line
2.21.0.windows.1
PATCH v4 12/20 net/txgbe: add FEC support for Amber-Lite 25G NICs
In reply to Zaiyu WangAmber-Lite 25G NICs support four FEC modes (off, baser, rs, auto). The driver implements standard interfaces (fec_get_capability, fec_get, fec_set) to allow manual configuration. The default FEC mode is set to 'auto'.
--- drivers/net/txgbe/base/txgbe_aml.c | 27 ++++++- drivers/net/txgbe/base/txgbe_hw.c | 3 + drivers/net/txgbe/base/txgbe_mng.c | 2 +- drivers/net/txgbe/base/txgbe_phy.h | 1 + drivers/net/txgbe/base/txgbe_type.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 121 ++++++++++++++++++++++++++++ 6 files changed, 154 insertions(+), 2 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +26 -1
@@ -131,6 +131,26 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static int +txgbe_phy_fec_get (struct txgbe_hw *hw) +{ +int value =0 ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_RS_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x4 ) +return TXGBE_PHY_FEC_RS ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_KR_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x1 ) +return TXGBE_PHY_FEC_BASER ; + +return TXGBE_PHY_FEC_OFF ; +} +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;
@@ -184,7 +204,12 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw, status = hw->mac.check_link (hw, &link_speed, &link_up, autoneg_wait_to_complete); -if (link_speed == speed && link_up) +if (link_up && speed ==TXGBE_LINK_SPEED_25GB_FULL ) + hw->cur_fec_link =txgbe_phy_fec_get (hw); + +if (link_speed == speed && link_up && + !(speed ==TXGBE_LINK_SPEED_25GB_FULL && + !(hw->fec_mode & hw->cur_fec_link)))return status;if (speed &TXGBE_LINK_SPEED_25GB_FULL )
drivers/net/txgbe/base/txgbe_hw.c +3 -0
@@ -338,6 +338,9 @@ s32 txgbe_init_hw(struct txgbe_hw *hw)txgbe_disable_lldp (hw); +/* Init fec mode to 'AUTO' */ + hw->fec_mode =TXGBE_PHY_FEC_AUTO ; +/* Reset the hardware */ status = hw->mac.reset_hw (hw);if (status ==0 || status ==TXGBE_ERR_SFP_NOT_PRESENT ) {
drivers/net/txgbe/base/txgbe_mng.c +1 -1
@@ -613,7 +613,7 @@ s32 txgbe_hic_ephy_set_link(struct txgbe_hw *hw, u8 speed, u8 autoneg, u8 duplex buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; - buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.fec_mode = hw->fec_mode; buffer.speed = speed; buffer.autoneg = autoneg; buffer.duplex = duplex;
drivers/net/txgbe/base/txgbe_phy.h +1 -0
@@ -40,6 +40,7 @@#define SR_PMA_KR_LD_CESTS_RR MS16(15, 0x1)#define SR_PMA_KR_FEC_CTRL 0x0100AB#define SR_PMA_KR_FEC_CTRL_EN MS16(0, 0x1) +#define SR_PMA_RS_FEC_CTRL 0x0100C8#define SR_MII_MMD_CTL 0x1F0000#define SR_MII_MMD_CTL_AN_EN 0x1000#define SR_MII_MMD_CTL_RESTART_AN 0x0200
drivers/net/txgbe/base/txgbe_type.h +2 -0
@@ -848,6 +848,8 @@ struct txgbe_hw {/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy; +u32 fec_mode; +u32 cur_fec_link; };struct txgbe_backplane_ability {
drivers/net/txgbe/txgbe_ethdev.c +121 -0
142 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v4 13/20 net/txgbe: add GPIO configuration
In reply to Zaiyu WangAdd GPIO configuration for Amber-Lite NICs to match design differences from 10G NICs: The Amber-Lite NIC requires additional setup steps compared to 10G NICs to ensure proper functionality of features SFP module detection.
--- drivers/net/txgbe/base/txgbe_regs.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 111 ++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1631,6 +1631,8 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTEN 0x014830#define TXGBE_GPIOINTMASK 0x014834#define TXGBE_GPIOINTTYPE 0x014838 +#define TXGBE_GPIO_INT_POLARITY 0x01483C +#define TXGBE_GPIO_INT_POLARITY_3 MS(3, 0x1)#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C
drivers/net/txgbe/txgbe_ethdev.c +111 -0
158 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v4 14/20 net/txgbe: disable unstable features
In reply to Zaiyu WangTemporarily disabled unstable features on Amber-Lite NICs (e.g., flow control). These incomplete features will be gradually completed in future driver updates.
--- drivers/net/txgbe/base/txgbe_hw.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +7 -0
@@ -144,6 +144,10 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw)u32 value =0 ;u64 reg_bp =0 ; +/* amlite-to-do */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +return 0 ; +/* Validate the requested mode */ if (hw->fc.strict_ieee && hw->fc.requested_mode == txgbe_fc_rx_pause) {DEBUGOUT ("txgbe_fc_rx_pause not valid in strict IEEE mode" );
@@ -3242,6 +3246,9 @@ void txgbe_set_hard_rate_select_speed(struct txgbe_hw *hw,u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA );switch (speed) { +case TXGBE_LINK_SPEED_25GB_FULL : +/* amlite-to-do */ +break ;case TXGBE_LINK_SPEED_10GB_FULL : esdp_reg |= (TXGBE_GPIOBIT_4 |TXGBE_GPIOBIT_5 );break ;
Signature · 1 line
2.21.0.windows.1
PATCH v4 15/20 net/txgbe: add support for TX laser enable/disable
In reply to Zaiyu WangAdd enable/disable TX laser configuration code for Amber-Lite NICs. Due to hardware design differences, the GPIO controlling the TX laser on Amber-Lite NICs differs from Sapphire NICs, requiring corresponding configuration changes.
--- drivers/net/txgbe/base/txgbe_hw.c | 31 ++++++++++++++++++++++++----- drivers/net/txgbe/base/txgbe_regs.h | 10 ++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +26 -5
@@ -3179,12 +3179,28 @@ void txgbe_disable_tx_laser_multispeed_fiber(struct txgbe_hw *hw) {u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA ); -if (txgbe_close_notify (hw)) -txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | -TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); +if (txgbe_close_notify (hw)) { +/* over write led when ifconfig down */ +if (hw->mac.type == txgbe_mac_aml40) { +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_40G | +TXGBE_AMLITE_LED_LINK_ACTIVE ); + }else if (hw->mac.type == txgbe_mac_aml) +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_25G | +TXGBE_AMLITE_LED_LINK_10G |TXGBE_AMLITE_LED_LINK_ACTIVE ); +else +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | +TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); + }/* Disable Tx laser; allow 100us to go dark per spec */ - esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg &= ~TXGBE_GPIOBIT_1 ; + }else if (hw->mac.type == txgbe_mac_aml) { + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);usec_delay (100 );
@@ -3206,7 +3222,12 @@ void txgbe_enable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)wr32 (hw,TXGBE_LEDCTL ,0 );/* Enable Tx laser; allow 100ms to light up */ - esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);msec_delay (100 );
drivers/net/txgbe/base/txgbe_regs.h +10 -0
@@ -302,6 +302,16 @@#define TXGBE_PORT_LINK1000M MS(2, 0x1)#define TXGBE_PORT_LINK100M MS(3, 0x1)#define TXGBE_PORT_LANID (r) RS(r, 8, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL MS(5, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL MS(4, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL MS(3, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL MS(2, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL MS(1, 0x1) +#define TXGBE_AMLITE_LED_LINK_ACTIVE TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL +#define TXGBE_AMLITE_LED_LINK_10G TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL +#define TXGBE_AMLITE_LED_LINK_25G TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL +#define TXGBE_AMLITE_LED_LINK_40G TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL +#define TXGBE_AMLITE_LED_LINK_50G TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL#define TXGBE_EXTAG 0x014408#define TXGBE_EXTAG_ETAG_MASK MS(0, 0xFFFF)#define TXGBE_EXTAG_ETAG (v) LS(v, 0, 0xFFFF)
Signature · 1 line
2.21.0.windows.1
PATCH v4 16/20 net/txgbe: add support for TX queue rate limiting
In reply to Zaiyu WangAdd TX queue rate limiting functionality for Amber-Lite NICs. Due to hardware design differences, the TX queue rate limiting configuration for Amber-Lite NICs requires updates compared to Sapphire NICs.
--- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_regs.h | 12 +++++ drivers/net/txgbe/txgbe_ethdev.c | 69 +++++++++++++++++++++++----- 3 files changed, 72 insertions(+), 11 deletions(-)
drivers/net/txgbe/base/txgbe_osdep.h +2 -0
@@ -164,6 +164,8 @@ static inline u64 REVERT_BIT_MASK64(u64 mask)#define IOMEM +#define BIT (nr) (1UL << (nr)) +#define prefetch (x) rte_prefetch0(x)#define ARRAY_SIZE (x) ((int32_t)RTE_DIM(x))
drivers/net/txgbe/base/txgbe_regs.h +12 -0
@@ -1656,6 +1656,18 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBTXRATE_MIN (v) LS(v, 0, 0x3FFF)#define TXGBE_ARBTXRATE_MAX (v) LS(v, 16, 0x3FFF) +#define TXGBE_TDM_RL_QUEUE_IDX 0x018210 +#define TXGBE_TDM_RL_QUEUE_CFG 0x018214 +#define TXGBE_TDM_FACTOR_INT_MASK MS(16, 0xFFFF) +#define TXGBE_TDM_FACTOR_FRA_MASK MS(0, 0xFFFC) +#define TXGBE_TDM_FACTOR_INT_SHIFT 16 +#define TXGBE_TDM_FACTOR_FRA_SHIFT 2 + +#define TXGBE_TDM_RL_VM_IDX 0x018218 +#define TXGBE_TDM_RL_VM_CFG 0x01821C +#define TXGBE_TDM_RL_CFG 0x018400 +#define TXGBE_TDM_RL_EN MS(0, 0x1) +/* qos */ #define TXGBE_ARBTXCTL 0x018200#define TXGBE_ARBTXCTL_RRM MS(1, 0x1)
drivers/net/txgbe/txgbe_ethdev.c +58 -11
91 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v4 17/20 net/txgbe: add support for getting PHY ID
In reply to Zaiyu WangAdd PHY ID reading functionality for Amber-Lite NICs. Due to hardware design differences, the process for obtaining the PHY ID on Amber-Lite NICs differs from Sapphire NICs and requires additional delay handling.
--- drivers/net/txgbe/base/txgbe_phy.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/net/txgbe/base/txgbe_phy.c +35 -0
@@ -173,6 +173,41 @@ s32 txgbe_get_phy_id(struct txgbe_hw *hw)u32 err;u16 phy_id_high =0 ;u16 phy_id_low =0 ; +u32 i =0 ; +u32 status; + +if (hw->mac.type == txgbe_mac_aml) { + hw->phy.addr =0 ; + +for (i =0 ; i <32 ; i++) { + hw->phy.addr = i; + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_HIGH ,0 , &phy_id_high); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 1" ); +return status; + } +DEBUGOUT ("%d: phy_id_high 0x%x" , i, phy_id_high); +if ((phy_id_high &0xFFFF ) ==0x0141 ) +break ; + } + +if (i ==32 ) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed" ); +return TXGBE_ERR_PHY ; + } + + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_LOW ,0 , &phy_id_low); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 2" ); +return status; + } + hw->phy.id = (u32)(phy_id_high &0xFFFF ) <<6 ; + hw->phy.id |= (u32)((phy_id_low &0xFC00 ) >>10 ); + +DEBUGOUT ("phy_id 0x%x" , hw->phy.id); + +return status; + } err = hw->phy.read_reg(hw, TXGBE_MD_PHY_ID_HIGH, TXGBE_MD_DEV_PMA_PMD,
Signature · 1 line
2.21.0.windows.1
PATCH v4 18/20 net/txgbe: add thermal sensor configuration for Amber-Lite NICs
In reply to Zaiyu WangAdd thermal sensor configuration code for Amber-Lite NICs. Due to differences in hardware design, Amber-Lite NICs require different configuration from Sapphire NICs to initialize and retrieve thermal sensor data.
--- drivers/net/txgbe/base/txgbe_hw.c | 81 ++++++++++++++++++++++------- drivers/net/txgbe/base/txgbe_type.h | 27 ++++++++++ 2 files changed, 90 insertions(+), 18 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +63 -18
@@ -2220,27 +2220,56 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw)* * Returns the thermal sensor data structure **/ +#define PHYINIT_TIMEOUT 1000s32 txgbe_get_thermal_sensor_data (struct txgbe_hw *hw) {struct txgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;s64 tsv;u32 ts_stat; +u32 data_code; +int temp_data, temp_fraction; +int i =0 ;/* Only support thermal sensors attached to physical port 0 */ if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; - ts_stat =rd32 (hw,TXGBE_TSSTAT ); - tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); - tsv = tsv >1200 ? tsv :1200 ; - tsv = -(48380 <<8 ) /1000 - + tsv * (31020 <<8 ) /100000 - - tsv * tsv * (18201 <<8 ) /100000000 - + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 - - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; - tsv >>=8 ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0001 ); + +while (1 ) { + data_code =rd32 (hw,TXGBE_AML_TS_STS ); +if ((data_code &TXGBE_AML_TS_STS_VLD ) !=0 ) +break ; +msleep (1 ); +if (i++ >PHYINIT_TIMEOUT ) { +PMD_DRV_LOG (ERR ,"ERROR: Wait 0x1033c Timeout!!!" ); +return -1 ; + } + } + + data_code = data_code &0xFFF ; + temp_data =419400 +2205 * (data_code *1000 /4094 -500 ); - data->sensor[0 ].temp = (s16 )tsv; +/* Change double Temperature to int */ + tsv = temp_data /10000 ; + temp_fraction = temp_data - (tsv *10000 ); +if (temp_fraction >=5000 ) + tsv +=1 ; + data->sensor[0 ].temp = (s16 )tsv; + }else { + ts_stat =rd32 (hw,TXGBE_TSSTAT ); + tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); + tsv = tsv >1200 ? tsv :1200 ; + tsv = -(48380 <<8 ) /1000 + + tsv * (31020 <<8 ) /100000 + - tsv * tsv * (18201 <<8 ) /100000000 + + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 + - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; + tsv >>=8 ; + + data->sensor[0 ].temp = (s16 )tsv; + }return 0 ; }
@@ -2261,16 +2290,32 @@ s32 txgbe_init_thermal_sensor_thresh(struct txgbe_hw *hw)if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; -wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); -wr32 (hw,TXGBE_TSINTR , -TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); -wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); - - data->sensor[0 ].alarm_thresh =100 ; -wr32 (hw,TXGBE_TSATHRE ,677 ); data->sensor[0 ].dalarm_thresh =90 ; -wr32 (hw,TXGBE_TSDTHRE ,614 ); + +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0 ); +wr32 (hw,TXGBE_AML_INTR_RAW_LO ,TXGBE_AML_INTR_CL_LO ); +wr32 (hw,TXGBE_AML_INTR_RAW_HI ,TXGBE_AML_INTR_CL_HI ); + +wr32 (hw,TXGBE_AML_INTR_HIGH_EN ,TXGBE_AML_INTR_EN_HI ); +wr32 (hw,TXGBE_AML_INTR_LOW_EN ,TXGBE_AML_INTR_EN_LO ); + +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_EVAL_MODE_MASK ,0x10 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_ALARM_THRE_MASK ,0x186a0000 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_DALARM_THRE_MASK ,0x16f60 ); +wr32 (hw,TXGBE_AML_TS_ENA ,0x1 ); + }else { +wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); +wr32 (hw,TXGBE_TSINTR , +TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); +wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); + + data->sensor[0 ].alarm_thresh =100 ; +wr32 (hw,TXGBE_TSATHRE ,677 ); + data->sensor[0 ].dalarm_thresh =90 ; +wr32 (hw,TXGBE_TSDTHRE ,614 ); + }return 0 ; }
drivers/net/txgbe/base/txgbe_type.h +27 -0
@@ -37,6 +37,33 @@#include "txgbe_osdep.h" #include "txgbe_devids.h" +/* Sensors for AMLITE PVT(Process Voltage Temperature) */ +#define TXGBE_AML_INTR_RAW_HI 0x10300 +#define TXGBE_AML_INTR_RAW_ME 0x10304 +#define TXGBE_AML_INTR_RAW_LO 0x10308 +#define TXGBE_AML_TS_CTL1 0x10330 +#define TXGBE_AML_TS_CTL2 0x10334 +#define TXGBE_AML_TS_ENA 0x10338 +#define TXGBE_AML_TS_STS 0x1033C +#define TXGBE_AML_INTR_HIGH_EN 0x10318 +#define TXGBE_AML_INTR_MED_EN 0x1031C +#define TXGBE_AML_INTR_LOW_EN 0x10320 +#define TXGBE_AML_INTR_HIGH_STS 0x1030C +#define TXGBE_AML_INTR_MED_STS 0x10310 +#define TXGBE_AML_INTR_LOW_STS 0x10314 + +#define TXGBE_AML_TS_STS_VLD 0x00001000U +#define TXGBE_AML_INTR_EN_HI 0x00000002U +#define TXGBE_AML_INTR_EN_ME 0x00000001U +#define TXGBE_AML_INTR_EN_LO 0x00000001U +#define TXGBE_AML_INTR_CL_HI 0x00000002U +#define TXGBE_AML_INTR_CL_ME 0x00000001U +#define TXGBE_AML_INTR_CL_LO 0x00000001U +#define TXGBE_AML_EVAL_MODE_MASK 0x00000010U +#define TXGBE_AML_CAL_MODE_MASK 0x00000008U +#define TXGBE_AML_ALARM_THRE_MASK 0x1FFE0000U +#define TXGBE_AML_DALARM_THRE_MASK 0x0001FFE0U +struct txgbe_thermal_diode_data {s16 temp;s16 alarm_thresh;
Signature · 1 line
2.21.0.windows.1
PATCH v4 19/20 net/txgbe: add RSS for Amber-Lite NICs
In reply to Zaiyu WangAdd RSS (Receive Side Scaling) functionality for Amber-Lite NICs. The Amber-Lite NIC series provides comprehensive RSS support with hardware implementation identical to Sapphire NICs. This commit enables RSS by applying the existing RSS configuration directly to Amber-Lite NICs without requiring architectural changes.
--- drivers/net/txgbe/txgbe_ethdev.c | 7 +++++-- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/txgbe/txgbe_ethdev.c +5 -2
@@ -3849,7 +3849,7 @@ txgbe_dev_rss_reta_update(struct rte_eth_dev *dev,PMD_INIT_FUNC_TRACE (); -if (!txgbe_rss_update_sp (hw->mac.type)) { +if (!txgbe_rss_update (hw->mac.type)) {PMD_DRV_LOG (ERR ,"RSS reta update is not supported on this " "NIC." );return -ENOTSUP ;
@@ -5174,11 +5174,14 @@ txgbe_get_module_eeprom(struct rte_eth_dev *dev, }bool -txgbe_rss_update_sp (enum txgbe_mac_type mac_type) +txgbe_rss_update (enum txgbe_mac_type mac_type) {switch (mac_type) {case txgbe_mac_sp:case txgbe_mac_sp_vf: +case txgbe_mac_aml: +case txgbe_mac_aml40: +case txgbe_mac_aml_vf:return 1 ;default :return 0 ;
drivers/net/txgbe/txgbe_ethdev.h +1 -1
@@ -517,7 +517,7 @@ int txgbe_dev_rss_hash_update(struct rte_eth_dev *dev,int txgbe_dev_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf); -bool txgbe_rss_update_sp (enum txgbe_mac_type mac_type); +bool txgbe_rss_update (enum txgbe_mac_type mac_type); int txgbe_add_del_ntuple_filter(struct rte_eth_dev *dev, struct rte_eth_ntuple_filter *filter,
drivers/net/txgbe/txgbe_rxtx.c +1 -1
@@ -3111,7 +3111,7 @@ txgbe_dev_rss_hash_update(struct rte_eth_dev *dev,uint64_t rss_hf;uint16_t i; -if (!txgbe_rss_update_sp (hw->mac.type)) { +if (!txgbe_rss_update (hw->mac.type)) {PMD_DRV_LOG (ERR ,"RSS hash update is not supported on this " "NIC." );return -ENOTSUP ;
Signature · 1 line
2.21.0.windows.1
PATCH v4 20/20 doc: update for txgbe
In reply to Zaiyu WangAdd new types of Wangxun NICs(Amber-Lite NIC models) into txgbe supported NICs list.
--- doc/guides/nics/txgbe.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
doc/guides/nics/txgbe.rst +6 -2
@@ -4,8 +4,12 @@ TXGBE Poll Mode Driver ====================== -The TXGBE PMD (librte_pmd_txgbe) provides poll mode driver support -for Wangxun 10 Gigabit Ethernet NICs. +Supported NICs +-------------- + +- Wangxun 10 Gigabit Ethernet NICs +- Wangxun 25 Gigabit Ethernet NICs +- Wangxun 40 Gigabit Ethernet NICs Features --------
Signature · 1 line
2.21.0.windows.1
Re: [PATCH v4 00/20] Wangxun new NIC support
In reply to Zaiyu WangQuoted 50 lines · On Tue, 30 Sep 2025 17:59:32 +0800 Zaiyu Wang <[email protected]> wrote:
We have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
Zaiyu Wang (20):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface
net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: rename raptor to sp for Sapphire-specific code net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add support for TX laser enable/disable net/txgbe: add support for TX queue rate limiting net/txgbe: add support for getting PHY ID
net/txgbe: add thermal sensor configuration for Amber-Lite NICs net/txgbe: add RSS for Amber-Lite NICs
doc: update for txgbedoc/guides/nics/txgbe.rst | 8 +- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 365 ++++++++++++++++---- drivers/net/txgbe/base/txgbe_hw.h | 15 +- drivers/net/txgbe/base/txgbe_mng.c | 184 +++++++++- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 ++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 103 +++++- drivers/net/txgbe/base/txgbe_type.h | 70 +++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 390 ++++++++++++++++++++-- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +-
Quoted 8 lines
drivers/net/txgbe/txgbe_rxtx.c | 203 ++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 26 files changed, 1937 insertions(+), 202 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Please add (as follow on patch) short summary for release notes for 25.11
RE: [PATCH v4 00/20] Wangxun new NIC support
Quoted 71 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, October 16, 2025 6:04 AM
To: Zaiyu Wang <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v4 00/20] Wangxun new NIC supportQuoted 38 lines · On Tue, 30 Sep 2025 17:59:32 +0800 Zaiyu Wang <[email protected]> wrote:
We have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
Zaiyu Wang (20):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface
net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: rename raptor to sp for Sapphire-specific code net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add support for TX laser enable/disable net/txgbe: add support for TX queue rate limiting net/txgbe: add support for getting PHY ID
net/txgbe: add thermal sensor configuration for Amber-Lite NICs net/txgbe: add RSS for Amber-Lite NICs
doc: update for txgbedoc/guides/nics/txgbe.rst | 8 +- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 365 ++++++++++++++++---- drivers/net/txgbe/base/txgbe_hw.h | 15 +- drivers/net/txgbe/base/txgbe_mng.c | 184 +++++++++-Quoted 8 lines
drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 ++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 103 +++++- drivers/net/txgbe/base/txgbe_type.h | 70 +++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 390++++++++++++++++++++--
Quoted 11 lines
drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 203 ++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 26 files changed, 1937 insertions(+), 202 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Quoted 2 lines
Please add (as follow on patch) short summary for release notes for 25.11
Will do right away. Thanks.
v5 cover Wangxun new NIC support
In reply to Zaiyu WangWe have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
---
v5:
- update txgbe guides, add more usage instructions
- add a short summary into 25.11 release notes
---
Zaiyu Wang (21):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface
net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: rename raptor to sp for Sapphire-specific code net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add support for TX laser enable/disable net/txgbe: add support for TX queue rate limiting net/txgbe: add support for getting PHY ID
net/txgbe: add thermal sensor configuration for Amber-Lite NICs net/txgbe: add RSS for Amber-Lite NICs
doc: update for txgbe guides
doc: update release notes for Wangxun txgbe driver
doc/guides/nics/txgbe.rst | 31 +- doc/guides/rel_notes/release_25_11.rst | 7 + drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 365 ++++++++++++++++---- drivers/net/txgbe/base/txgbe_hw.h | 15 +- drivers/net/txgbe/base/txgbe_mng.c | 184 +++++++++- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 ++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 103 +++++- drivers/net/txgbe/base/txgbe_type.h | 70 +++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 390 ++++++++++++++++++++-- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 203 ++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 27 files changed, 1967 insertions(+), 202 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Signature · 1 line
2.21.0.windows.1
PATCH v5 1/21 net/txgbe: add basic information for Amber-Lite 25G/40G NICs
Add device IDs, speed and other basic information for Wangxun's new Amber-Lite NICs: aml (10G/25G) and aml40 (40G).
--- drivers/net/txgbe/base/txgbe_devids.h | 9 +++++++ drivers/net/txgbe/base/txgbe_hw.c | 17 +++++++++++++ drivers/net/txgbe/base/txgbe_regs.h | 4 ++- drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 35 ++++++++++++++++++++------- 5 files changed, 58 insertions(+), 10 deletions(-)
drivers/net/txgbe/base/txgbe_devids.h +9 -0
@@ -19,6 +19,15 @@#define TXGBE_DEV_ID_WX1820 0x2001#define TXGBE_DEV_ID_SP1000_VF 0x1000#define TXGBE_DEV_ID_WX1820_VF 0x2000 +#define TXGBE_DEV_ID_AML 0x5000 +#define TXGBE_DEV_ID_AML5025 0x5025 +#define TXGBE_DEV_ID_AML5125 0x5125 +#define TXGBE_DEV_ID_AML5040 0x5040 +#define TXGBE_DEV_ID_AML5140 0x5140 + +#define TXGBE_DEV_ID_AML_VF 0x5001 +#define TXGBE_DEV_ID_AML5024_VF 0x5024 +#define TXGBE_DEV_ID_AML5124_VF 0x5124/* * Subsystem IDs
drivers/net/txgbe/base/txgbe_hw.c +17 -0
@@ -2476,6 +2476,8 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) {case txgbe_mac_raptor: +case txgbe_mac_aml: +case txgbe_mac_aml40: status =txgbe_init_ops_pf (hw);break ;case txgbe_mac_raptor_vf:
@@ -2523,11 +2525,26 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)case TXGBE_DEV_ID_WX1820 : hw->mac.type = txgbe_mac_raptor;break ; +case TXGBE_DEV_ID_AML : +case TXGBE_DEV_ID_AML5025 : +case TXGBE_DEV_ID_AML5125 : + hw->mac.type = txgbe_mac_aml; +break ; +case TXGBE_DEV_ID_AML5040 : +case TXGBE_DEV_ID_AML5140 : + hw->mac.type = txgbe_mac_aml40; +break ;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 ; +case TXGBE_DEV_ID_AML_VF : +case TXGBE_DEV_ID_AML5024_VF : +case TXGBE_DEV_ID_AML5124_VF : + hw->phy.media_type = txgbe_media_type_virtual; + hw->mac.type = txgbe_mac_aml_vf; +break ;default : err =TXGBE_ERR_DEVICE_NOT_SUPPORTED ;DEBUGOUT ("Unsupported device id: %x" , hw->device_id);
drivers/net/txgbe/base/txgbe_regs.h +3 -1
@@ -97,7 +97,9 @@#define TXGBE_LINK_SPEED_2_5GB_FULL 0x0400#define TXGBE_LINK_SPEED_5GB_FULL 0x0800#define TXGBE_LINK_SPEED_10GB_FULL 0x0080 -#define TXGBE_LINK_SPEED_40GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_25GB_FULL 0x0100 +#define TXGBE_LINK_SPEED_40GB_FULL 0x0040 +#define TXGBE_LINK_SPEED_50GB_FULL 0x0200#define TXGBE_AUTOC_AUTONEG MS64(63, 0x1)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -140,7 +140,10 @@ enum txgbe_eeprom_type {enum txgbe_mac_type { txgbe_mac_unknown =0 , txgbe_mac_raptor, + txgbe_mac_aml, + txgbe_mac_aml40, txgbe_mac_raptor_vf, + txgbe_mac_aml_vf, txgbe_num_macs };
drivers/net/txgbe/txgbe_ethdev.c +26 -9
@@ -145,6 +145,11 @@ static void txgbe_l2_tunnel_conf(struct rte_eth_dev *dev);static const struct rte_pci_id pci_id_txgbe_map[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_SP1000 ) }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_WX1820 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5025 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5125 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5040 ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_WANGXUN ,TXGBE_DEV_ID_AML5140 ) }, { .vendor_id =0 ,/* sentinel */ }, };
@@ -1829,8 +1834,13 @@ txgbe_dev_start(struct rte_eth_dev *dev)if (err) goto error; - allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | -RTE_ETH_LINK_SPEED_10G ; +if (hw->mac.type == txgbe_mac_aml40) + allowed_speeds =RTE_ETH_LINK_SPEED_40G ; +else if (hw->mac.type == txgbe_mac_aml) + allowed_speeds =RTE_ETH_LINK_SPEED_10G |RTE_ETH_LINK_SPEED_25G ; +else + allowed_speeds =RTE_ETH_LINK_SPEED_100M |RTE_ETH_LINK_SPEED_1G | +RTE_ETH_LINK_SPEED_10G ; link_speeds = &dev->data->dev_conf.link_speeds;if (((*link_speeds) >>1 ) & ~(allowed_speeds >>1 )) {
@@ -1840,17 +1850,24 @@ txgbe_dev_start(struct rte_eth_dev *dev) speed =0x0 ;if (*link_speeds ==RTE_ETH_LINK_SPEED_AUTONEG ) { - speed = (TXGBE_LINK_SPEED_100M_FULL | -TXGBE_LINK_SPEED_1GB_FULL | -TXGBE_LINK_SPEED_10GB_FULL ); +if (hw->mac.type == txgbe_mac_aml40) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + }else if (hw->mac.type == txgbe_mac_aml) { + speed = (TXGBE_LINK_SPEED_10GB_FULL | +TXGBE_LINK_SPEED_25GB_FULL ); + }else { + speed = (TXGBE_LINK_SPEED_100M_FULL | +TXGBE_LINK_SPEED_1GB_FULL | +TXGBE_LINK_SPEED_10GB_FULL ); + } hw->autoneg = true; }else { +if (*link_speeds &RTE_ETH_LINK_SPEED_40G ) + speed |=TXGBE_LINK_SPEED_40GB_FULL ; +if (*link_speeds &RTE_ETH_LINK_SPEED_25G ) + speed |=TXGBE_LINK_SPEED_25GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_10G ) speed |=TXGBE_LINK_SPEED_10GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_5G ) - speed |=TXGBE_LINK_SPEED_5GB_FULL ; -if (*link_speeds &RTE_ETH_LINK_SPEED_2_5G ) - speed |=TXGBE_LINK_SPEED_2_5GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_1G ) speed |=TXGBE_LINK_SPEED_1GB_FULL ;if (*link_speeds &RTE_ETH_LINK_SPEED_100M )
Signature · 1 line
2.21.0.windows.1
PATCH v5 2/21 net/txgbe: add new SW-FW mailbox interface
In reply to Zaiyu WangAmber-Lite NICs adopt new mailbox interface for software-firmware interaion to enable enhanced functionality.
--- drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_mng.c | 148 +++++++++++++++++++++++--- drivers/net/txgbe/base/txgbe_mng.h | 17 ++- drivers/net/txgbe/base/txgbe_regs.h | 7 ++ drivers/net/txgbe/base/txgbe_type.h | 4 + 6 files changed, 165 insertions(+), 20 deletions(-)
drivers/net/txgbe/base/txgbe_eeprom.c +6 -1
@@ -366,8 +366,13 @@ s32 txgbe_calc_eeprom_checksum(struct txgbe_hw *hw) err = hw->rom.readw_buffer (hw, i, seg, buffer);if (err)return err; -for (j =0 ; j < seg; j++) +for (j =0 ; j < seg; j++) { +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +if (((i + j) >= (TXGBE_SHOWROM_I2C_PTR /2 )) && + ((i + j) < (TXGBE_SHOWROM_I2C_END /2 ))) + buffer[j] =0xffff ; checksum += buffer[j]; + } } checksum = (u16 )TXGBE_EEPROM_SUM - checksum + read_checksum;
drivers/net/txgbe/base/txgbe_eeprom.h +2 -0
@@ -20,6 +20,8 @@#define TXGBE_PBANUM0_PTR 0x05#define TXGBE_PBANUM1_PTR 0x06#define TXGBE_SW_REGION_PTR 0x1C +#define TXGBE_SHOWROM_I2C_PTR 0xB00 +#define TXGBE_SHOWROM_I2C_END 0xF00#define TXGBE_EE_CSUM_MAX 0x800#define TXGBE_EEPROM_CHECKSUM 0x2F
drivers/net/txgbe/base/txgbe_mng.c +132 -16
192 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_mng.h +14 -3
@@ -60,6 +60,8 @@#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376 +#define TXGBE_HIC_HDR_INDEX_MAX 255 +/* Host Interface Command Structures */ struct txgbe_hic_hdr {u8 cmd;
@@ -68,21 +70,30 @@ struct txgbe_hic_hdr {u8 cmd_resv;u8 ret_status; } cmd_or_resp; -u8 checksum; +union { +u8 checksum; +u8 index; + }; };struct txgbe_hic_hdr2_req {u8 cmd;u8 buf_lenh;u8 buf_lenl; -u8 checksum; +union { +u8 checksum; +u8 index; + }; };struct txgbe_hic_hdr2_rsp {u8 cmd;u8 buf_lenl;u8 buf_lenh_status;/* 7-5: high bits of buf_len, 4-0: status */ -u8 checksum; +union { +u8 checksum; +u8 index; + }; };union txgbe_hic_hdr2 {
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -263,6 +263,13 @@#define TXGBE_MNGMBXCTL_FWACK MS(3, 0x1)#define TXGBE_MNGMBX 0x01E100 +/* amlite: swfw mailbox changes */ +#define TXGBE_AML_MNG_MBOX_CTL_SW2FW 0x01E0A0 +#define TXGBE_AML_MNG_MBOX_SW2FW 0x01E200 +#define TXGBE_AML_MNG_MBOX_CTL_FW2SW 0x01E0A4 +#define TXGBE_AML_MNG_MBOX_FW2SW 0x01E300 +#define TXGBE_AML_MNG_MBOX_NOTIFY MS(31, 0x1) +/****************************************************************************** * Port Registers ******************************************************************************/
drivers/net/txgbe/base/txgbe_type.h +4 -0
@@ -814,6 +814,10 @@ struct txgbe_hw {u64 tx_qp_bytes;u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; + +/*amlite: new SW-FW mbox */ +u8 swfw_index; +rte_atomic32_t swfw_busy; };struct txgbe_backplane_ability {
Signature · 1 line
2.21.0.windows.1
PATCH v5 3/21 net/txgbe: add identification support for new SFP/QSFP modules
In reply to Zaiyu WangAdd identification support for new SFP/QSFP module types (e.g., 25G SR/CR) in the Amber-Lite NIC configuration flow.
--- drivers/net/txgbe/base/txgbe_phy.c | 92 ++++++++++++++++++++++++----- drivers/net/txgbe/base/txgbe_phy.h | 23 ++++++++ drivers/net/txgbe/base/txgbe_regs.h | 5 +- drivers/net/txgbe/base/txgbe_type.h | 12 ++++ 4 files changed, 117 insertions(+), 15 deletions(-)
drivers/net/txgbe/base/txgbe_phy.c +78 -14
@@ -774,10 +774,21 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)u8 identifier =0 ;u8 comp_codes_1g =0 ;u8 comp_codes_10g =0 ; +u8 comp_codes_25g =0 ; +u8 comp_copper_len =0 ;u8 oui_bytes[3 ] = {0 ,0 ,0 };u8 cable_tech =0 ;u8 cable_spec =0 ;u16 enforce_sfp =0 ; +u32 value; + +if (hw->mac.type == txgbe_mac_aml) { + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_ABS_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + }if (hw->phy.media_type != txgbe_media_type_fiber) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -811,6 +822,16 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)if (err !=0 ) goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_25GBE_COMP_CODES , + &comp_codes_25g); +if (err !=0 ) + goto ERR_I2C; + + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_COPPER_LENGTH , + &comp_copper_len); +if (err !=0 ) + goto ERR_I2C; + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_TECHNOLOGY , &cable_tech);if (err !=0 )
@@ -832,12 +853,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)* 11 SFP_1g_sx_CORE0 - chip-specific * 12 SFP_1g_sx_CORE1 - chip-specific */ -if (cable_tech &TXGBE_SFF_CABLE_DA_PASSIVE ) { -if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; -else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; - }else if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { +if (cable_tech &TXGBE_SFF_CABLE_DA_ACTIVE ) { err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_CABLE_SPEC_COMP , &cable_spec);if (err !=0 )
@@ -849,6 +865,17 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }else { hw->phy.sfp_type = txgbe_sfp_type_unknown; } + }else if (comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_sr_core1; + }else if (comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_25g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {
@@ -876,11 +903,20 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw)/* Determine if the SFP+ PHY is dual speed or not. */ hw->phy.multispeed_fiber = false; -if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || - ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && - (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) - hw->phy.multispeed_fiber = true; +if (hw->mac.type == txgbe_mac_aml) { +if ((comp_codes_25g ==TXGBE_SFF_25GBASESR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASELR_CAPABLE || + comp_codes_25g ==TXGBE_SFF_25GBASEER_CAPABLE ) && + ((comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE ) || + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }else { +if (((comp_codes_1g &TXGBE_SFF_1GBASESX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASESR_CAPABLE )) || + ((comp_codes_1g &TXGBE_SFF_1GBASELX_CAPABLE ) && + (comp_codes_10g &TXGBE_SFF_10GBASELR_CAPABLE ))) + hw->phy.multispeed_fiber = true; + }/* Determine PHY vendor */ if (hw->phy.type != txgbe_phy_nl) {
@@ -938,7 +974,7 @@ s32 txgbe_identify_sfp_module(struct txgbe_hw *hw) }/* Verify supported 1G SFP modules */ - if (comp_codes_10g == 0 && + if (comp_codes_10g == 0 && comp_codes_25g == 0 && !(hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core1 || hw->phy.sfp_type == txgbe_sfp_type_1g_cu_core0 || hw->phy.sfp_type == txgbe_sfp_type_1g_lx_core0 ||
@@ -986,6 +1022,7 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)u8 cable_length =0 ;u8 device_tech =0 ;bool active_cable = false; +u32 value;if (hw->phy.media_type != txgbe_media_type_fiber_qsfp) { hw->phy.sfp_type = txgbe_sfp_type_not_present;
@@ -993,6 +1030,16 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw) goto out; } +if (hw->mac.type == txgbe_mac_aml40) { +/* config GPIO before read i2c */ +wr32 (hw,TXGBE_GPIODATA ,TXGBE_GPIOBIT_1 ); + value =rd32 (hw,TXGBE_GPIOEXT ); +if (value &TXGBE_SFP1_MOD_PRST_LS ) { + hw->phy.sfp_type = txgbe_sfp_type_not_present; +return TXGBE_ERR_SFP_NOT_PRESENT ; + } + } + err = hw->phy.read_i2c_eeprom (hw,TXGBE_SFF_IDENTIFIER , &identifier); ERR_I2C:
@@ -1024,10 +1071,27 @@ s32 txgbe_identify_qsfp_module(struct txgbe_hw *hw)if (comp_codes_10g &TXGBE_SFF_QSFP_DA_PASSIVE_CABLE ) { hw->phy.type = txgbe_phy_qsfp_unknown_passive; +if (hw->mac.type == txgbe_mac_aml40) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_cu_core1; + }else { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; +else + hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + } + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_SR4 ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core0; +else + hw->phy.sfp_type = txgbe_qsfp_type_40g_sr_core1; + }else if (comp_codes_10g &TXGBE_SFF_40GBASE_LR4 ) {if (hw->bus.lan_id ==0 ) - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core0; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core0;else - hw->phy.sfp_type = txgbe_sfp_type_da_cu_core1; + hw->phy.sfp_type = txgbe_qsfp_type_40g_lr_core1; }else if (comp_codes_10g & (TXGBE_SFF_10GBASESR_CAPABLE |TXGBE_SFF_10GBASELR_CAPABLE )) {if (hw->bus.lan_id ==0 )
drivers/net/txgbe/base/txgbe_phy.h +23 -0
@@ -249,6 +249,8 @@#define TXGBE_SFF_VENDOR_OUI_BYTE2 0x27#define TXGBE_SFF_1GBE_COMP_CODES 0x06#define TXGBE_SFF_10GBE_COMP_CODES 0x03 +#define TXGBE_SFF_25GBE_COMP_CODES 0x24 +#define TXGBE_SFF_COPPER_LENGTH 0x12#define TXGBE_SFF_CABLE_TECHNOLOGY 0x08#define TXGBE_SFF_CABLE_DA_PASSIVE 0x4#define TXGBE_SFF_CABLE_DA_ACTIVE 0x8
@@ -275,6 +277,23 @@#define TXGBE_SFF_1GBASET_CAPABLE 0x8#define TXGBE_SFF_10GBASESR_CAPABLE 0x10#define TXGBE_SFF_10GBASELR_CAPABLE 0x20 +#define TXGBE_SFF_25GBASESR_CAPABLE 0x2 +#define TXGBE_SFF_25GBASELR_CAPABLE 0x3 +#define TXGBE_SFF_25GBASEER_CAPABLE 0x4 +#define TXGBE_SFF_25GBASECR_91FEC 0xB +#define TXGBE_SFF_25GBASECR_74FEC 0xC +#define TXGBE_SFF_25GBASECR_NOFEC 0xD +#define TXGBE_SFF_40GBASE_SR_CAPABLE 0x10 +#define TXGBE_SFF_4x10GBASESR_CAP 0x11 +#define TXGBE_SFF_40GBASEPSM4_PARALLEL 0x12 +#define TXGBE_SFF_40GBASE_SWMD4_CAP 0x1f + +#define TXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_5 0x1 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_5 0x8 +#define TXGBE_SFF_25GAUI_C2M_AOC_BER_12 0x18 +#define TXGBE_SFF_25GAUI_C2M_ACC_BER_12 0x19 +#define TXGBE_SFF_SOFT_RS_SELECT_MASK 0x8#define TXGBE_SFF_SOFT_RS_SELECT_10G 0x8#define TXGBE_SFF_SOFT_RS_SELECT_1G 0x0
@@ -290,6 +309,10 @@#define TXGBE_I2C_EEPROM_STATUS_FAIL 0x2#define TXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 +#define TXGBE_SFF_40GBASE_CR4 0x8 +#define TXGBE_SFF_40GBASE_SR4 0x4 +#define TXGBE_SFF_40GBASE_LR4 0x2 +/* EEPROM for SFF-8472 (dev_addr = 0xA2) */ #define TXGBE_I2C_EEPROM_DEV_ADDR2 0xA2
drivers/net/txgbe/base/txgbe_regs.h +4 -1
@@ -1605,7 +1605,10 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C - +#define TXGBE_GPIOEXT 0x014850 +#define TXGBE_SFP1_MOD_ABS_LS MS(2, 0x1)/* GPIO_EXT SFP ABSENT*/ +#define TXGBE_SFP1_RX_LOS_LS MS(3, 0x1)/* GPIO_EXT RX LOSS */ +#define TXGBE_SFP1_MOD_PRST_LS MS(4, 0x1)/* GPIO_EXT SFP ABSENT*/ #define TXGBE_ARBPOOLIDX 0x01820C#define TXGBE_ARBTXRATE 0x018404
drivers/net/txgbe/base/txgbe_type.h +12 -0
@@ -206,6 +206,18 @@ enum txgbe_sfp_type { txgbe_sfp_type_1g_sx_core1, txgbe_sfp_type_1g_lx_core0, txgbe_sfp_type_1g_lx_core1, + txgbe_sfp_type_25g_sr_core0, + txgbe_sfp_type_25g_sr_core1, + txgbe_sfp_type_25g_lr_core0, + txgbe_sfp_type_25g_lr_core1, + txgbe_sfp_type_25g_aoc_core0, + txgbe_sfp_type_25g_aoc_core1, + txgbe_qsfp_type_40g_cu_core0, + txgbe_qsfp_type_40g_cu_core1, + txgbe_qsfp_type_40g_sr_core0, + txgbe_qsfp_type_40g_sr_core1, + txgbe_qsfp_type_40g_lr_core0, + txgbe_qsfp_type_40g_lr_core1, txgbe_sfp_type_not_present =0xFFFE , txgbe_sfp_type_not_known =0xFFFF };
Signature · 1 line
2.21.0.windows.1
PATCH v5 4/21 net/txgbe: rename raptor to sp for Sapphire-specific code
In reply to Zaiyu WangThe term "raptor" was originally used as a general designation for NICs when only Sapphire series existed. With the addition of Amber-Lite series NICs, we now use "sp" to replace "raptor" for driver components that are specific to Sapphire NICs, while retaining the "raptor" name for common flows applicable to all NICs.
--- drivers/net/txgbe/base/txgbe_hw.c | 62 +++++++++++++++++++---------- drivers/net/txgbe/base/txgbe_hw.h | 11 ++--- drivers/net/txgbe/base/txgbe_regs.h | 8 ++-- drivers/net/txgbe/base/txgbe_type.h | 5 ++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 14 +++---- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 24 +++++------ 9 files changed, 76 insertions(+), 54 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +41 -21
@@ -272,7 +272,7 @@ s32 txgbe_start_hw(struct txgbe_hw *hw)/* Cache bit indicating need for crosstalk fix */ switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp: hw->mac.get_device_caps (hw, &device_caps);if (device_caps &TXGBE_DEVICE_CAPS_NO_CROSSTALK_WR ) hw->need_crosstalk_fix = false;
@@ -1915,7 +1915,7 @@ static bool txgbe_need_crosstalk_fix(struct txgbe_hw *hw)* * Reads the links register to determine if link is up and the current speed **/ -s32 txgbe_check_mac_link (struct txgbe_hw *hw,u32 *speed, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete) {u32 links_reg, links_orig;
@@ -1928,7 +1928,7 @@ s32 txgbe_check_mac_link(struct txgbe_hw *hw, u32 *speed,u32 sfp_cage_full;switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp: sfp_cage_full = !rd32m (hw,TXGBE_GPIODATA ,TXGBE_GPIOBIT_2 );break ;
@@ -2475,12 +2475,13 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)txgbe_init_ops_dummy (hw);switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp: +txgbe_init_ops_sp (hw); +break ;case txgbe_mac_aml:case txgbe_mac_aml40: - status =txgbe_init_ops_pf (hw);break ; -case txgbe_mac_raptor_vf: +case txgbe_mac_sp_vf: status =txgbe_init_ops_vf (hw);break ;default :
@@ -2497,7 +2498,7 @@ s32 txgbe_init_shared_code(struct txgbe_hw *hw)bool txgbe_is_pf (struct txgbe_hw *hw) {switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp:return true;default :return false;
@@ -2523,7 +2524,7 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)switch (hw->device_id) {case TXGBE_DEV_ID_SP1000 :case TXGBE_DEV_ID_WX1820 : - hw->mac.type = txgbe_mac_raptor; + hw->mac.type = txgbe_mac_sp;break ;case TXGBE_DEV_ID_AML :case TXGBE_DEV_ID_AML5025 :
@@ -2537,7 +2538,7 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)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; + hw->mac.type = txgbe_mac_sp_vf;break ;case TXGBE_DEV_ID_AML_VF :case TXGBE_DEV_ID_AML5024_VF :
@@ -2556,7 +2557,7 @@ s32 txgbe_set_mac_type(struct txgbe_hw *hw)return err; } -void txgbe_init_mac_link_ops (struct txgbe_hw *hw) +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw) {struct txgbe_mac_info *mac = &hw->mac;
@@ -2616,7 +2617,7 @@ s32 txgbe_init_phy_raptor(struct txgbe_hw *hw) goto init_phy_ops_out;/* Setup function pointers based on detected SFP module and speeds */ -txgbe_init_mac_link_ops (hw); +txgbe_init_mac_link_ops_sp (hw);/* If copper media, overwrite with copper function pointers */ if (phy->media_type == txgbe_media_type_copper) {
@@ -2651,7 +2652,7 @@ s32 txgbe_setup_sfp_modules(struct txgbe_hw *hw)if (hw->phy.sfp_type == txgbe_sfp_type_unknown)return 0 ; -txgbe_init_mac_link_ops (hw); +txgbe_init_mac_link_ops_sp (hw);/* PHY config will finish before releasing the semaphore */ err = hw->mac.acquire_swfw_sync (hw,TXGBE_MNGSEM_SWPHY );
@@ -2792,13 +2793,13 @@ s32 txgbe_flash_read_dword(struct txgbe_hw *hw, u32 addr, u32 *data) }/** -* txgbe_init_ops_pf - Inits func ptrs and MAC type +* txgbe_init_ops_generic - Inits func ptrs and MAC type * @hw: pointer to hardware structure * * Initialize the function pointers and assign the MAC type. * Does not touch the hardware. **/ -s32 txgbe_init_ops_pf (struct txgbe_hw *hw) +s32 txgbe_init_ops_generic (struct txgbe_hw *hw) {struct txgbe_bus_info *bus = &hw->bus;struct txgbe_mac_info *mac = &hw->mac;
@@ -2918,15 +2919,31 @@ s32 txgbe_init_ops_pf(struct txgbe_hw *hw)return 0 ; } +void txgbe_init_ops_sp (struct txgbe_hw *hw) +{ +struct txgbe_mac_info *mac = &hw->mac; +struct txgbe_phy_info *phy = &hw->phy; + +txgbe_init_ops_generic (hw); + +/* PHY */ + phy->get_media_type = txgbe_get_media_type_sp; + +/* LINK */ + mac->init_mac_link_ops = txgbe_init_mac_link_ops_sp; + mac->get_link_capabilities = txgbe_get_link_capabilities_sp; + mac->check_link = txgbe_check_mac_link_sp; +} +/** -* txgbe_get_link_capabilities_raptor - Determines link capabilities +* txgbe_get_link_capabilities_sp - Determines link capabilities * @hw: pointer to hardware structure * @speed: pointer to link speed * @autoneg: true when autoneg or autotry is enabled * * Determines the link capabilities by reading the AUTOC register. **/ -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg) {
@@ -3027,12 +3044,12 @@ s32 txgbe_get_link_capabilities_raptor(struct txgbe_hw *hw, }/** -* txgbe_get_media_type_raptor - Get media type +* txgbe_get_media_type_sp - Get media type * @hw: pointer to hardware structure * * Returns the media type (fiber, copper, backplane) **/ -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw) +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw) {u32 media_type;
@@ -3565,8 +3582,10 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)if (!hw->phy.reset_disable) hw->phy.reset (hw); -/* remember AUTOC from before we reset */ - autoc = hw->mac.autoc_read (hw); +if (hw->mac.type == txgbe_mac_sp) { +/* remember AUTOC from before we reset */ + autoc = hw->mac.autoc_read (hw); + } mac_reset_top:/* Do LAN reset, the MNG domain will not be reset. */
@@ -3615,7 +3634,8 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw)msec_delay (50 );/* A temporary solution to set phy */ -txgbe_set_phy_temp (hw); +if (hw->mac.type == txgbe_mac_sp) +txgbe_set_phy_temp (hw); }/* Store the permanent mac address */
drivers/net/txgbe/base/txgbe_hw.h +6 -5
@@ -56,7 +56,7 @@ s32 txgbe_set_vlvf(struct txgbe_hw *hw, u32 vlan, u32 vind,s32 txgbe_clear_vfta (struct txgbe_hw *hw);s32 txgbe_find_vlvf_slot (struct txgbe_hw *hw,u32 vlan,bool vlvf_bypass); -s32 txgbe_check_mac_link (struct txgbe_hw *hw, +s32 txgbe_check_mac_link_sp (struct txgbe_hw *hw,u32 *speed,bool *link_up,bool link_up_wait_to_complete);
@@ -87,10 +87,11 @@ s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg,s32 txgbe_init_shared_code (struct txgbe_hw *hw);bool txgbe_is_pf (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw); -s32 txgbe_init_ops_pf (struct txgbe_hw *hw); -s32 txgbe_get_link_capabilities_raptor (struct txgbe_hw *hw, +s32 txgbe_init_ops_generic (struct txgbe_hw *hw); +void txgbe_init_ops_sp (struct txgbe_hw *hw); +s32 txgbe_get_link_capabilities_sp (struct txgbe_hw *hw,u32 *speed,bool *autoneg); -u32 txgbe_get_media_type_raptor (struct txgbe_hw *hw); +u32 txgbe_get_media_type_sp (struct txgbe_hw *hw);void txgbe_disable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_enable_tx_laser_multispeed_fiber (struct txgbe_hw *hw);void txgbe_flap_tx_laser_multispeed_fiber (struct txgbe_hw *hw);
@@ -104,7 +105,7 @@ s32 txgbe_start_mac_link_raptor(struct txgbe_hw *hw,s32 txgbe_setup_mac_link (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw); -void txgbe_init_mac_link_ops (struct txgbe_hw *hw); +void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +4 -4
@@ -1737,11 +1737,11 @@ txgbe_map_reg(struct txgbe_hw *hw, u32 reg) {switch (reg) {case TXGBE_REG_RSSTBL : -if (hw->mac.type == txgbe_mac_raptor_vf) +if (hw->mac.type == txgbe_mac_sp_vf) reg =TXGBE_VFRSSTBL (0 );break ;case TXGBE_REG_RSSKEY : -if (hw->mac.type == txgbe_mac_raptor_vf) +if (hw->mac.type == txgbe_mac_sp_vf) reg =TXGBE_VFRSSKEY (0 );break ;default :
@@ -1917,10 +1917,10 @@ po32m(struct txgbe_hw *hw, u32 reg, u32 mask, u32 expect, u32 *actual,static inline void txgbe_flush (struct txgbe_hw *hw) {switch (hw->mac.type) { -case txgbe_mac_raptor: +case txgbe_mac_sp:rd32 (hw,TXGBE_PWR );break ; -case txgbe_mac_raptor_vf: +case txgbe_mac_sp_vf:rd32 (hw,TXGBE_VFSTATUS );break ;default :
drivers/net/txgbe/base/txgbe_type.h +3 -2
@@ -139,10 +139,10 @@ enum txgbe_eeprom_type {enum txgbe_mac_type { txgbe_mac_unknown =0 , - txgbe_mac_raptor, + txgbe_mac_sp, txgbe_mac_aml, txgbe_mac_aml40, - txgbe_mac_raptor_vf, + txgbe_mac_sp_vf, txgbe_mac_aml_vf, txgbe_num_macs };
@@ -544,6 +544,7 @@ struct txgbe_mac_info {s32 (*prot_autoc_read)(struct txgbe_hw *hw,bool *locked,u64 *value);s32 (*prot_autoc_write)(struct txgbe_hw *hw,bool locked,u64 value);s32 (*negotiate_api_version)(struct txgbe_hw *hw,int api); +void (*init_mac_link_ops)(struct txgbe_hw *hw);/* Link */ void (*disable_tx_laser)(struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_vf.c +1 -1
@@ -488,7 +488,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_raptor_vf && wait_to_complete) { +if (mac->type == txgbe_mac_sp_vf && wait_to_complete) {if (po32m (hw,TXGBE_VFSTATUS ,TXGBE_VFSTATUS_UP ,0 ,NULL ,5 ,100 )) goto out;
drivers/net/txgbe/txgbe_ethdev.c +7 -7
@@ -385,7 +385,7 @@ txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,uint32_t q_map;uint8_t n, offset; -if (hw->mac.type != txgbe_mac_raptor) +if (hw->mac.type != txgbe_mac_sp)return -ENOSYS ;if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK )
@@ -1806,7 +1806,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) }/* Skip link setup if loopback mode is enabled. */ -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && dev->data->dev_conf.lpbk_mode) goto skip_link_setup;
@@ -3072,7 +3072,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev, }/* Re configure MAC RX */ -if (hw->mac.type == txgbe_mac_raptor) { +if (hw->mac.type == txgbe_mac_sp) { reg =rd32 (hw,TXGBE_MACRXCFG );wr32 (hw,TXGBE_MACRXCFG , reg); wr32m(hw, TXGBE_MACRXFLT, TXGBE_MACRXFLT_PROMISC,
@@ -3858,7 +3858,7 @@ txgbe_uc_hash_table_set(struct rte_eth_dev *dev,struct txgbe_uta_info *uta_info =TXGBE_DEV_UTA_INFO (dev);/* The UTA table only exists on pf hardware */ -if (hw->mac.type < txgbe_mac_raptor) +if (hw->mac.type < txgbe_mac_sp)return -ENOTSUP ; vector =txgbe_uta_vector (hw, mac_addr);
@@ -3903,7 +3903,7 @@ txgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on)int i;/* The UTA table only exists on pf hardware */ -if (hw->mac.type < txgbe_mac_raptor) +if (hw->mac.type < txgbe_mac_sp)return -ENOTSUP ;if (on) {
@@ -4969,8 +4969,8 @@ bool txgbe_rss_update_sp(enum txgbe_mac_type mac_type) {switch (mac_type) { -case txgbe_mac_raptor: -case txgbe_mac_raptor_vf: +case txgbe_mac_sp: +case txgbe_mac_sp_vf:return 1 ;default :return 0 ;
drivers/net/txgbe/txgbe_ethdev_vf.c +1 -1
@@ -375,7 +375,7 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev)PMD_INIT_LOG (DEBUG ,"port %d vendorID=0x%x deviceID=0x%x mac.type=%s" , eth_dev->data->port_id, pci_dev->id.vendor_id, - pci_dev->id.device_id,"txgbe_mac_raptor_vf" ); + pci_dev->id.device_id,"txgbe_mac_sp_vf" );return 0 ; }
drivers/net/txgbe/txgbe_flow.c +1 -1
@@ -2854,7 +2854,7 @@ txgbe_parse_fdir_filter(struct rte_eth_dev *dev, step_next: -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && rule->fdirflags ==TXGBE_FDIRPICMD_DROP && (rule->input.src_port !=0 || rule->input.dst_port !=0 ))return -ENOTSUP ;
drivers/net/txgbe/txgbe_rxtx.c +12 -12
@@ -80,7 +80,7 @@ txgbe_is_vf(struct rte_eth_dev *dev)struct txgbe_hw *hw =TXGBE_DEV_HW (dev);switch (hw->mac.type) { -case txgbe_mac_raptor_vf: +case txgbe_mac_sp_vf:return 1 ;default :return 0 ;
@@ -2121,10 +2121,10 @@ txgbe_get_rx_port_offloads(struct rte_eth_dev *dev)* RSC is only supported by PF devices in a non-SR-IOV * mode. */ -if (hw->mac.type == txgbe_mac_raptor && !sriov->active) +if (hw->mac.type == txgbe_mac_sp && !sriov->active) offloads |=RTE_ETH_RX_OFFLOAD_TCP_LRO ; -if (hw->mac.type == txgbe_mac_raptor) +if (hw->mac.type == txgbe_mac_sp) offloads |=RTE_ETH_RX_OFFLOAD_MACSEC_STRIP ; offloads |=RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM ;
@@ -2498,7 +2498,7 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,/* Modification to set tail pointer for virtual function * if vf is detected. */ -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { txq->tdt_reg_addr =TXGBE_REG_ADDR (hw,TXGBE_TXWP (queue_idx)); txq->tdc_reg_addr =TXGBE_REG_ADDR (hw,TXGBE_TXCFG (queue_idx)); }else {
@@ -2791,7 +2791,7 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,/* * Modified to setup VFRDT for Virtual Function */ -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { rxq->rdt_reg_addr =TXGBE_REG_ADDR (hw,TXGBE_RXWP (queue_idx)); rxq->rdh_reg_addr =
@@ -3037,7 +3037,7 @@ txgbe_rss_disable(struct rte_eth_dev *dev)struct txgbe_hw *hw; hw =TXGBE_DEV_HW (dev); -if (hw->mac.type == txgbe_mac_raptor_vf) +if (hw->mac.type == txgbe_mac_sp_vf)wr32m (hw,TXGBE_VFPLCFG ,TXGBE_VFPLCFG_RSSENA ,0 );else wr32m (hw,TXGBE_RACTL ,TXGBE_RACTL_RSSENA ,0 );
@@ -3074,7 +3074,7 @@ txgbe_dev_rss_hash_update(struct rte_eth_dev *dev,/* Set configured hashing protocols */ rss_hf = rss_conf->rss_hf &TXGBE_RSS_OFFLOAD_ALL ; -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { mrqc =rd32 (hw,TXGBE_VFPLCFG ); mrqc &= ~TXGBE_VFPLCFG_RSSMASK ;if (rss_hf &RTE_ETH_RSS_IPV4 )
@@ -3166,7 +3166,7 @@ txgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev, } rss_hf =0 ; -if (hw->mac.type == txgbe_mac_raptor_vf) { +if (hw->mac.type == txgbe_mac_sp_vf) { mrqc =rd32 (hw,TXGBE_VFPLCFG );if (mrqc &TXGBE_VFPLCFG_RSSIPV4 ) rss_hf |=RTE_ETH_RSS_IPV4 ;
@@ -3627,7 +3627,7 @@ txgbe_dcb_hw_arbite_tx_config(struct txgbe_hw *hw, uint16_t *refill, uint16_t *max, uint8_t *bwg_id, uint8_t *tsa, uint8_t *map) { switch (hw->mac.type) { - case txgbe_mac_raptor: + case txgbe_mac_sp:txgbe_dcb_config_tx_desc_arbiter_raptor (hw ,refill ,max ,bwg_id ,tsa ); txgbe_dcb_config_tx_data_arbiter_raptor(hw, refill,
@@ -4555,7 +4555,7 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev)* If loopback mode is configured, set LPBK bit. */ hlreg0 =rd32 (hw,TXGBE_PSRCTL ); -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && dev->data->dev_conf.lpbk_mode) hlreg0 |=TXGBE_PSRCTL_LBENA ;else
@@ -4640,7 +4640,7 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev)wr32 (hw,TXGBE_PSRCTL , rxcsum); -if (hw->mac.type == txgbe_mac_raptor) { +if (hw->mac.type == txgbe_mac_sp) { rdrxctl =rd32 (hw,TXGBE_SECRXCTL );if (rx_conf->offloads &RTE_ETH_RX_OFFLOAD_KEEP_CRC ) rdrxctl &= ~TXGBE_SECRXCTL_CRCSTRIP ;
@@ -4765,7 +4765,7 @@ txgbe_dev_rxtx_start(struct rte_eth_dev *dev) hw->mac.enable_rx_dma (hw, rxctrl);/* If loopback mode is enabled, set up the link accordingly */ -if (hw->mac.type == txgbe_mac_raptor && +if (hw->mac.type == txgbe_mac_sp && dev->data->dev_conf.lpbk_mode)txgbe_setup_loopback_link_raptor (hw);
Signature · 1 line
2.21.0.windows.1
PATCH v5 5/21 net/txgbe: add basic link configuration for Amber-Lite NICs
In reply to Zaiyu WangDue to Amber-Lite's significant differences from our 10G NICs, we split link configuration components (setup_link, check_link, etc.) into new files.
--- drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 296 +++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 21 ++ drivers/net/txgbe/base/txgbe_aml40.c | 126 ++++++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_hw.c | 49 ++++- drivers/net/txgbe/base/txgbe_hw.h | 2 + drivers/net/txgbe/base/txgbe_regs.h | 9 + drivers/net/txgbe/base/txgbe_type.h | 1 + drivers/net/txgbe/txgbe_ethdev.c | 8 + 10 files changed, 528 insertions(+), 6 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
drivers/net/txgbe/base/meson.build +2 -0
@@ -6,6 +6,8 @@ base_sources = files( 'txgbe_dcb.c', 'txgbe_eeprom.c', 'txgbe_hw.c', + 'txgbe_aml.c', + 'txgbe_aml40.c', 'txgbe_mbx.c', 'txgbe_mng.c', 'txgbe_phy.c',
drivers/net/txgbe/base/txgbe_aml.c new file +296 -0
296 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML_H_ +#define _TXGBE_AML_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml (struct txgbe_hw *hw, +u32 *speed, +bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw); +#endif /* _TXGBE_AML_H_ */
drivers/net/txgbe/base/txgbe_aml40.c new file +126 -0
126 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_aml40.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2025 Beijing WangXun Technology Co., Ltd. +* Copyright(c) 2010-2017 Intel Corporation +*/ + +#ifndef _TXGBE_AML40_H_ +#define _TXGBE_AML40_H_ + +#include "txgbe_type.h" + +void txgbe_init_ops_aml40 (struct txgbe_hw *hw); +s32 txgbe_check_mac_link_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *link_up,bool link_up_wait_to_complete); +s32 txgbe_get_link_capabilities_aml40 (struct txgbe_hw *hw, +u32 *speed,bool *autoneg); +u32 txgbe_get_media_type_aml40 (struct txgbe_hw *hw); +s32 txgbe_setup_mac_link_aml40 (struct txgbe_hw *hw,u32 speed, +bool autoneg_wait_to_complete); +void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw); +#endif /* _TXGBE_AML40_H_ */
drivers/net/txgbe/base/txgbe_hw.c +43 -6
97 lines not on this page · raw message
drivers/net/txgbe/base/txgbe_hw.h +2 -0
@@ -116,4 +116,6 @@ s32 txgbe_reinit_fdir_tables(struct txgbe_hw *hw);bool txgbe_verify_lesm_fw_enabled_raptor (struct txgbe_hw *hw);s32 txgbe_fmgr_cmd_op (struct txgbe_hw *hw,u32 cmd,u32 cmd_addr);s32 txgbe_flash_read_dword (struct txgbe_hw *hw,u32 addr,u32 *data); +s32 txgbe_e56_check_phy_link (struct txgbe_hw *hw,u32 *speed, +bool *link_up);#endif /* _TXGBE_HW_H_ */
drivers/net/txgbe/base/txgbe_regs.h +9 -0
@@ -1581,6 +1581,15 @@ enum txgbe_5tuple_protocol {#define TXGBE_PORTSTAT_BW_100M MS(3, 0x1)#define TXGBE_PORTSTAT_ID (r) RS(r, 8, 0x1) +/* amlite: diff from sapphire */ +#define TXGBE_CFG_PORT_ST_AML_LINK_MASK MS(1, 0xF) +#define TXGBE_CFG_PORT_ST_AML_LINK_10G MS(4, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_25G MS(3, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_40G MS(2, 0x1) +#define TXGBE_CFG_PORT_ST_AML_LINK_50G MS(1, 0x1) + +#define TXGBE_AML_PHY_LINK_UP MS(2, 0x1) +#define TXGBE_VXLAN 0x014410#define TXGBE_VXLAN_GPE 0x014414#define TXGBE_GENEVE 0x014418
drivers/net/txgbe/base/txgbe_type.h +1 -0
@@ -828,6 +828,7 @@ struct txgbe_hw {u64 rx_qp_mc_packets; } qp_last[TXGBE_MAX_QP ]; +rte_spinlock_t phy_lock;/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy;
drivers/net/txgbe/txgbe_ethdev.c +8 -0
@@ -3069,6 +3069,14 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,case TXGBE_LINK_SPEED_10GB_FULL : link.link_speed =RTE_ETH_SPEED_NUM_10G ;break ; + +case TXGBE_LINK_SPEED_25GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_25G ; +break ; + +case TXGBE_LINK_SPEED_40GB_FULL : + link.link_speed =RTE_ETH_SPEED_NUM_40G ; +break ; }/* Re configure MAC RX */
Signature · 1 line
2.21.0.windows.1
PATCH v5 6/21 net/txgbe: add support for PHY configuration via SW-FW mailbox
In reply to Zaiyu WangMigrate Amber-Lite PHY configuration to firmware due to complexity. Driver now sends mailbox commands for link state changes, handled by firmware’s intricate PHY setup process
--- drivers/net/txgbe/base/txgbe_aml.c | 37 ++++++++++++++++++++++++++-- drivers/net/txgbe/base/txgbe_aml40.c | 37 +++++++++++++++++++++++++++- drivers/net/txgbe/base/txgbe_hw.c | 1 + drivers/net/txgbe/base/txgbe_mng.c | 36 +++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_mng.h | 17 +++++++++++++ drivers/net/txgbe/base/txgbe_type.h | 7 ++++++ 6 files changed, 132 insertions(+), 3 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +35 -2
@@ -131,6 +131,26 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +{ +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +int cnt =0 ; +int i; + +if (speed ==TXGBE_LINK_SPEED_25GB_FULL ) + cnt =4 ; +else + cnt =1 ; + +for (i =0 ; i < (4 * cnt); i++) { + hw->mac.check_link (hw, &link_speed, &link_up, false); +if (link_up) +break ; +msleep (250 ); + } +} +s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete)
@@ -142,8 +162,6 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw,u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ;u32 value =0 ; -UNREFERENCED_PARAMETER (autoneg_wait_to_complete); -if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );return 0 ;
@@ -163,6 +181,21 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw,if (value & (TXGBE_SFP1_MOD_ABS_LS |TXGBE_SFP1_RX_LOS_LS ))return status; + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); + +if (link_speed == speed && link_up) +return status; + +if (speed &TXGBE_LINK_SPEED_25GB_FULL ) + speed =0x10 ; +else if (speed &TXGBE_LINK_SPEED_10GB_FULL ) + speed =0x08 ; + + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); + +txgbe_wait_for_link_up_aml (hw, speed); +return status; }
drivers/net/txgbe/base/txgbe_aml40.c +36 -1
@@ -107,7 +107,42 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 speed, bool autoneg_wait_to_complete) { -return 0 ; + bool autoneg = false; +s32 status =0 ; +u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ; +bool link_up = false; +u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; +u32 value =0 ; + +if (hw->phy.sfp_type == txgbe_sfp_type_not_present) { +DEBUGOUT ("SFP not detected, skip setup mac link" ); +return 0 ; + } + +/* Check to see if speed passed in is supported. */ + status = hw->mac.get_link_capabilities (hw, + &link_capabilities, &autoneg); +if (status) +return status; + + speed &= link_capabilities; +if (speed ==TXGBE_LINK_SPEED_UNKNOWN ) +return TXGBE_ERR_LINK_SETUP ; + + status = hw->mac.check_link (hw, &link_speed, &link_up, + autoneg_wait_to_complete); + +if (link_speed == speed && link_up) +return status; + +if (speed &TXGBE_LINK_SPEED_40GB_FULL ) + speed =0x20 ; + + status = hw->phy.set_link_hostif (hw, (u8 )speed, autoneg, true); + +txgbe_wait_for_link_up_aml (hw, speed); + +return status; }void txgbe_init_mac_link_ops_aml40 (struct txgbe_hw *hw)
drivers/net/txgbe/base/txgbe_hw.c +1 -0
@@ -2836,6 +2836,7 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) phy->write_i2c_byte_unlocked = txgbe_write_i2c_byte_unlocked; phy->check_overtemp = txgbe_check_overtemp; phy->reset = txgbe_reset_phy; + phy->set_link_hostif = txgbe_hic_ephy_set_link;/* MAC */ mac->init_hw = txgbe_init_hw;
drivers/net/txgbe/base/txgbe_mng.c +36 -0
@@ -602,3 +602,39 @@ s32 txgbe_hic_set_lldp(struct txgbe_hw *hw, bool on)return txgbe_host_interface_command (hw, (u32 *)&buffer,sizeof (buffer),TXGBE_HI_COMMAND_TIMEOUT , false); } + +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex) +{ +struct txgbe_hic_ephy_setlink buffer; +s32 status; +int i; + + buffer.hdr.cmd =FW_PHY_CONFIG_LINK_CMD ; + buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); + buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; + + buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.speed = speed; + buffer.autoneg = autoneg; + buffer.duplex = duplex; + +for (i =0 ; i <=FW_CEM_MAX_RETRIES ; i++) { + status =txgbe_host_interface_command (hw, (u32 *)&buffer, +sizeof (buffer), +TXGBE_HI_COMMAND_TIMEOUT_SHORT , true); +if (status !=0 ) { +msleep (1 ); +continue ; + } + +if (buffer.hdr.cmd_or_resp.ret_status == +FW_CEM_RESP_STATUS_SUCCESS ) + status =0 ; +else + status =TXGBE_ERR_HOST_INTERFACE_COMMAND ; + +break ; + } + +return status; +}
drivers/net/txgbe/base/txgbe_mng.h +17 -0
@@ -13,6 +13,7 @@#define TXGBE_PMMBX_BSIZE (TXGBE_PMMBX_QSIZE * 4)#define TXGBE_PMMBX_DATA_SIZE (TXGBE_PMMBX_BSIZE - FW_NVM_DATA_OFFSET * 4)#define TXGBE_HI_COMMAND_TIMEOUT 5000/* Process HI command limit */ +#define TXGBE_HI_COMMAND_TIMEOUT_SHORT 500/* Process HI command limit */ #define TXGBE_HI_FLASH_ERASE_TIMEOUT 5000/* Process Erase command limit */ #define TXGBE_HI_FLASH_UPDATE_TIMEOUT 5000/* Process Update command limit */ #define TXGBE_HI_FLASH_VERIFY_TIMEOUT 60000/* Process Apply command limit */
@@ -56,6 +57,12 @@#define FW_LLDP_GET_CMD 0xF2#define FW_LLDP_SET_CMD_OFF 0xF1#define FW_LLDP_SET_CMD_ON 0xF0 +#define FW_PHY_CONFIG_READ_CMD 0xc0 +#define FW_PHY_CONFIG_LINK_CMD 0xc1 +#define FW_PHY_CONFIG_FC_CMD 0xc2 +#define FW_PHY_CONFIG_POWER_CMD 0xc3 +#define FW_PHY_CONFIG_RESET_CMD 0xc4 +#define FW_READ_SFP_INFO_CMD 0xc5#define TXGBE_CHECKSUM_CAP_ST_PASS 0x80658383#define TXGBE_CHECKSUM_CAP_ST_FAIL 0x70657376
@@ -101,6 +108,15 @@ union txgbe_hic_hdr2 {struct txgbe_hic_hdr2_rsp rsp; }; +struct txgbe_hic_ephy_setlink { +struct txgbe_hic_hdr hdr; +u8 speed; +u8 duplex; +u8 autoneg; +u8 fec_mode; +u8 resv[4 ]; +}; +struct txgbe_hic_drv_info {struct txgbe_hic_hdr hdr;u8 port_num;
@@ -204,5 +220,6 @@ bool txgbe_mng_present(struct txgbe_hw *hw);bool txgbe_mng_enabled (struct txgbe_hw *hw);s32 txgbe_hic_get_lldp (struct txgbe_hw *hw);s32 txgbe_hic_set_lldp (struct txgbe_hw *hw,bool on); +s32 txgbe_hic_ephy_set_link (struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);#endif /* _TXGBE_MNG_H_ */
drivers/net/txgbe/base/txgbe_type.h +7 -0
@@ -681,6 +681,7 @@ struct txgbe_phy_info { u8 *value);s32 (*write_i2c_byte_unlocked)(struct txgbe_hw *hw,u8 offset,u8 addr,u8 value); +s32 (*set_link_hostif)(struct txgbe_hw *hw,u8 speed,u8 autoneg,u8 duplex);enum txgbe_phy_type type;u32 addr;
@@ -764,6 +765,12 @@ enum txgbe_isb_idx {TXGBE_ISB_MAX }; +#define TXGBE_PHY_FEC_RS MS(0, 0x1) +#define TXGBE_PHY_FEC_BASER MS(1, 0x1) +#define TXGBE_PHY_FEC_OFF MS(2, 0x1) +#define TXGBE_PHY_FEC_AUTO (TXGBE_PHY_FEC_OFF | TXGBE_PHY_FEC_BASER |\ + TXGBE_PHY_FEC_RS) +struct txgbe_devargs {u16 auto_neg;u16 poll;
Signature · 1 line
2.21.0.windows.1
PATCH v5 7/21 net/txgbe: add RX&TX support for Amber-Lite NICs
In reply to Zaiyu WangThe packet handling workflow largely reuses the existing 10G NIC’s process, so we adjusted driver conditional checks rather than making major changes to the overall flow.
--- drivers/net/txgbe/base/txgbe_aml.c | 2 +- drivers/net/txgbe/base/txgbe_aml.h | 1 + drivers/net/txgbe/base/txgbe_aml40.c | 1 - drivers/net/txgbe/base/txgbe_hw.c | 17 ++++++++ drivers/net/txgbe/base/txgbe_hw.h | 1 + drivers/net/txgbe/base/txgbe_regs.h | 31 ++++++++++++++ drivers/net/txgbe/txgbe_ethdev.c | 12 ++++-- drivers/net/txgbe/txgbe_rxtx.c | 64 +++++++++++++++------------- 8 files changed, 94 insertions(+), 35 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +1 -1
@@ -131,7 +131,7 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } -static void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;
drivers/net/txgbe/base/txgbe_aml.h +1 -0
@@ -15,6 +15,7 @@ s32 txgbe_check_mac_link_aml(struct txgbe_hw *hw,s32 txgbe_get_link_capabilities_aml (struct txgbe_hw *hw,u32 *speed,bool *autoneg);u32 txgbe_get_media_type_aml (struct txgbe_hw *hw); +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed);s32 txgbe_setup_mac_link_aml (struct txgbe_hw *hw,u32 speed,bool autoneg_wait_to_complete);void txgbe_init_mac_link_ops_aml (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_aml40.c +0 -1
@@ -112,7 +112,6 @@ s32 txgbe_setup_mac_link_aml40(struct txgbe_hw *hw,u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;bool link_up = false;u32 link_capabilities =TXGBE_LINK_SPEED_UNKNOWN ; -u32 value =0 ;if (hw->phy.sfp_type == txgbe_sfp_type_not_present) {DEBUGOUT ("SFP not detected, skip setup mac link" );
drivers/net/txgbe/base/txgbe_hw.c +17 -0
@@ -20,6 +20,7 @@#define TXGBE_RAPTOR_MC_TBL_SIZE 128#define TXGBE_RAPTOR_VFT_TBL_SIZE 128#define TXGBE_RAPTOR_RX_PB_SIZE 512/*KB*/ +#define TXGBE_AML_RX_PB_SIZE 768 static s32 txgbe_setup_copper_link_raptor(struct txgbe_hw *hw, u32 speed,
@@ -2505,6 +2506,19 @@ bool txgbe_is_pf(struct txgbe_hw *hw) {switch (hw->mac.type) {case txgbe_mac_sp: +case txgbe_mac_aml: +case txgbe_mac_aml40: +return true; +default : +return false; + } +} + +bool txgbe_is_vf (struct txgbe_hw *hw) +{ +switch (hw->mac.type) { +case txgbe_mac_sp_vf: +case txgbe_mac_aml_vf:return true;default :return false;
@@ -2920,6 +2934,9 @@ s32 txgbe_init_ops_generic(struct txgbe_hw *hw) mac->max_rx_queues =TXGBE_RAPTOR_MAX_RX_QUEUES ; mac->max_tx_queues =TXGBE_RAPTOR_MAX_TX_QUEUES ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) + mac->rx_pb_size =TXGBE_AML_RX_PB_SIZE ; +return 0 ; }
drivers/net/txgbe/base/txgbe_hw.h +1 -0
@@ -86,6 +86,7 @@ s32 txgbe_negotiate_fc(struct txgbe_hw *hw, u32 adv_reg, u32 lp_reg, u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);s32 txgbe_init_shared_code (struct txgbe_hw *hw);bool txgbe_is_pf (struct txgbe_hw *hw); +bool txgbe_is_vf (struct txgbe_hw *hw);s32 txgbe_set_mac_type (struct txgbe_hw *hw);s32 txgbe_init_ops_generic (struct txgbe_hw *hw);void txgbe_init_ops_sp (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +31 -0
@@ -318,12 +318,18 @@#define TXGBE_LEDCTL_1G MS(2, 0x1)#define TXGBE_LEDCTL_100M MS(3, 0x1)#define TXGBE_LEDCTL_ACTIVE MS(4, 0x1) +#define TXGBE_LINKUP_FILTER 0x014428#define TXGBE_TAGTPID (i) (0x014430 + (i) * 4)/* 0-3 */ #define TXGBE_TAGTPID_LSB_MASK MS(0, 0xFFFF)#define TXGBE_TAGTPID_LSB (v) LS(v, 0, 0xFFFF)#define TXGBE_TAGTPID_MSB_MASK MS(16, 0xFFFF)#define TXGBE_TAGTPID_MSB (v) LS(v, 16, 0xFFFF) +/*AML LINK STATUS OVERWRITE*/ +#define TXGBE_AML_EPCS_MISC_CTL 0x13240 +#define TXGBE_AML_LINK_STATUS_OVRD_EN MS(5, 0x1) +#define TXGBE_AML_LINK_STATUS_OVRD_VAL MS(4, 0x1) +/** * GPIO Control * P0: link speed change
@@ -1393,7 +1399,9 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_HTHRESH_MASK MS(8, 0xF)#define TXGBE_TXCFG_HTHRESH (v) LS(v, 8, 0xF)#define TXGBE_TXCFG_WTHRESH_MASK MS(16, 0x7F) +#define TXGBE_TXCFG_WTHRESH_MASK_AML MS(16, 0x1FF)#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F) +#define TXGBE_TXCFG_WTHRESH_AML (v) LS(v, 16, 0x1FF)#define TXGBE_TXCFG_FLUSH MS(26, 0x1)#define TXGBE_TDM_DESC_CHK (i) (0x0180B0 + (i) * 4)/*0-3*/
@@ -1638,6 +1646,16 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBRXCTL_WSP MS(2, 0x1)#define TXGBE_ARBRXCTL_DIA MS(6, 0x1) +#define TXGBE_RDM_VF_RE (_i) (0x12004 + ((_i) * 4)) +#define TXGBE_RDM_VFRE_CLR (_i) (0x120A0 + ((_i) * 4)) +#define TXGBE_RDM_RSC_CTL 0x1200C +/* amlite: rdm_rsc_ctl_free_ctl */ +#define TXGBE_RDM_RSC_CTL_FREE_CTL MS(7, 0x1) +#define TXGBE_RDM_RSC_CTL_FREE_CNT_DIS MS(8, 0x1) +#define TXGBE_RDM_ARB_CFG (_i) (0x12040 + ((_i) * 4))/* 8 of these (0-7) */ +#define TXGBE_RDM_PF_QDE (_i) (0x12080 + ((_i) * 4)) +#define TXGBE_RDM_PF_HIDE (_i) (0x12090 + ((_i) * 4)) +#define TXGBE_RPUP2TC 0x019008#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7
@@ -1712,6 +1730,19 @@ enum txgbe_5tuple_protocol {#define TXGBE_MACTXCFG_SPEED_10G LS(0, 29, 0x3)#define TXGBE_MACTXCFG_SPEED_1G LS(3, 29, 0x3) +#define TXGBE_MAC_TX_CFG_AML_SPEED_MASK MS(28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_50G LS(2, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_40G LS(0, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_25G LS(1, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_10G LS(4, 28, 0x7) +#define TXGBE_MAC_TX_CFG_AML_SPEED_1G LS(7, 28, 0x7) + +#define TXGBE_MAC_MISC_CTL 0x11f00 +#define TXGBE_MAC_MISC_LINK_STS_MOD MS(0, 0x1) +#define TXGBE_LINK_BOTH_PCS_MAC MS(0, 0x1) + +#define TXGBE_EPHY_STAT 0x13404 +#define TXGBE_EPHY_STAT_PPL_LOCK 0x3#define TXGBE_ISBADDRL 0x000160#define TXGBE_ISBADDRH 0x000164
drivers/net/txgbe/txgbe_ethdev.c +9 -3
@@ -385,7 +385,7 @@ txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,uint32_t q_map;uint8_t n, offset; -if (hw->mac.type != txgbe_mac_sp) +if (!txgbe_is_pf (hw))return -ENOSYS ;if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK )
@@ -1806,7 +1806,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) }/* Skip link setup if loopback mode is enabled. */ -if (hw->mac.type == txgbe_mac_sp && +if (txgbe_is_pf (hw) && dev->data->dev_conf.lpbk_mode) goto skip_link_setup;
@@ -2817,6 +2817,7 @@ txgbe_dev_sfp_event(struct rte_eth_dev *dev)wr32 (hw,TXGBE_GPIOINTMASK ,0xFF ); reg =rd32 (hw,TXGBE_GPIORAWINTSTAT ); +if (reg &TXGBE_GPIOBIT_0 )wr32 (hw,TXGBE_GPIOEOI ,TXGBE_GPIOBIT_0 );if (reg &TXGBE_GPIOBIT_2 ) {
@@ -3079,8 +3080,13 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,break ; } +/* enable mac receiver */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); + } +/* Re configure MAC RX */ -if (hw->mac.type == txgbe_mac_sp) { +if (txgbe_is_pf (hw)) { reg =rd32 (hw,TXGBE_MACRXCFG );wr32 (hw,TXGBE_MACRXCFG , reg); wr32m(hw, TXGBE_MACRXFLT, TXGBE_MACRXFLT_PROMISC,
drivers/net/txgbe/txgbe_rxtx.c +34 -30
162 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v5 8/21 net/txgbe: add hardware reset change for Amber-Lite NICs
In reply to Zaiyu WangAdd necessary configurations for Amber-Lite's hardware reset process, which differs from the 10G NIC's. These configurations may be modified in future to accommodate further changes.
--- drivers/net/txgbe/base/txgbe_hw.c | 64 +++++++++++++++++++++++------ drivers/net/txgbe/base/txgbe_regs.h | 2 + 2 files changed, 53 insertions(+), 13 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +51 -13
@@ -276,6 +276,8 @@ s32 txgbe_start_hw(struct txgbe_hw *hw)/* Cache bit indicating need for crosstalk fix */ switch (hw->mac.type) {case txgbe_mac_sp: +case txgbe_mac_aml: +case txgbe_mac_aml40: hw->mac.get_device_caps (hw, &device_caps);if (device_caps &TXGBE_DEVICE_CAPS_NO_CROSSTALK_WR ) hw->need_crosstalk_fix = false;
@@ -3507,13 +3509,37 @@ txgbe_reset_misc(struct txgbe_hw *hw) {int i;u32 value; +int err =0 ; +u32 speed;wr32 (hw,TXGBE_ISBADDRL , hw->isb_dma &0x00000000FFFFFFFF );wr32 (hw,TXGBE_ISBADDRH , hw->isb_dma >>32 ); - value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); -if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) - hw->link_status =TXGBE_LINK_STATUS_NONE ; +if (hw->mac.type == txgbe_mac_aml) { +if ((rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK ) + !=TXGBE_EPHY_STAT_PPL_LOCK ) { + speed =TXGBE_LINK_SPEED_25GB_FULL + |TXGBE_LINK_SPEED_10GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else if (hw->mac.type == txgbe_mac_aml40) { +if (!(rd32 (hw,TXGBE_EPHY_STAT ) &TXGBE_EPHY_STAT_PPL_LOCK )) { + speed =TXGBE_LINK_SPEED_40GB_FULL ; + err = hw->mac.setup_link (hw, speed, false); +if (err) { +DEBUGOUT ("setup phy failed" ); +return ; + } + } + }else { + value =rd32_epcs (hw,SR_XS_PCS_CTRL2 ); +if ((value &0x3 ) !=SR_PCS_CTRL2_TYPE_SEL_X ) + hw->link_status =TXGBE_LINK_STATUS_NONE ; + }/* receive packets that size > 2048 */ wr32m(hw, TXGBE_MACRXCFG,
@@ -3576,7 +3602,7 @@ txgbe_reset_misc(struct txgbe_hw *hw)s32 txgbe_reset_hw (struct txgbe_hw *hw) {s32 status; -u32 autoc; +u32 autoc =0 ;/* Call adapter stop to disable tx/rx and clear interrupts */ status = hw->mac.stop_hw (hw);
@@ -3638,16 +3664,28 @@ s32 txgbe_reset_hw(struct txgbe_hw *hw) goto mac_reset_top; } -/* -* Store the original AUTOC/AUTOC2 values if they have not been -* stored off yet. Otherwise restore the stored original -* values since the reset operation sets back to defaults. -*/ -if (!hw->mac.orig_link_settings_stored) { - hw->mac.orig_autoc = hw->mac.autoc_read (hw); - hw->mac.orig_link_settings_stored = true; +/* amlite TODO*/ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_LINKUP_FILTER ,30 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); +/* amlite: bme */ +wr32 (hw,TXGBE_PX_PF_BME ,TXGBE_PX_PF_BME_EN ); +/* amlite: rdm_rsc_ctl_free_ctl set to 1 */ +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); }else { - hw->mac.orig_autoc = autoc; +/* +* Store the original AUTOC/AUTOC2 values if they have not been +* stored off yet. Otherwise restore the stored original +* values since the reset operation sets back to defaults. +*/ +if (!hw->mac.orig_link_settings_stored) { + hw->mac.orig_autoc = hw->mac.autoc_read (hw); + hw->mac.orig_link_settings_stored = true; + }else { + hw->mac.orig_autoc = autoc; + } }if (hw->phy.ffe_set) {
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1238,6 +1238,8 @@ enum txgbe_5tuple_protocol { TXGBE_ICRMISC_LNKUP)#define TXGBE_ICSMISC 0x000104#define TXGBE_IENMISC 0x000108 +#define TXGBE_PX_PF_BME 0x0004B8 +#define TXGBE_PX_PF_BME_EN MS(0, 0x1)#define TXGBE_IVARMISC 0x0004FC#define TXGBE_IVARMISC_VEC (v) LS(v, 0, 0x7)#define TXGBE_IVARMISC_VLD MS(7, 0x1)
Signature · 1 line
2.21.0.windows.1
PATCH v5 9/21 net/txgbe: add MAC reconfiguration to avoid packet loss
In reply to Zaiyu WangThere was a bug that RX will lose the first packet when down/up port.
When PHY is configured, mac error code is reported to the MAC layer, and MAC locked this status without unlocking. As a result, when the first packet is reveived, MAC reports this error code and RDB dismissed this packet.
Do MAC reset can clean MAC error code so we can fix this bug.
--- drivers/net/txgbe/base/txgbe_hw.c | 37 +++++++++++++++++++++++++++++ drivers/net/txgbe/base/txgbe_hw.h | 1 + drivers/net/txgbe/base/txgbe_regs.h | 2 ++ drivers/net/txgbe/txgbe_ethdev.c | 1 + 4 files changed, 41 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +37 -0
@@ -3504,6 +3504,43 @@ txgbe_check_flash_load(struct txgbe_hw *hw, u32 check_bit)return err; } +int txgbe_reconfig_mac (struct txgbe_hw *hw) +{ +u32 mac_wdg_timeout; +u32 mac_flow_ctrl; + + mac_wdg_timeout =rd32 (hw,TXGBE_MAC_WDG_TIMEOUT ); + mac_flow_ctrl =rd32 (hw,TXGBE_RXFCCFG ); + +if (hw->bus.lan_id ==0 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_0 ); +else if (hw->bus.lan_id ==1 ) +wr32 (hw,TXGBE_RST ,TXGBE_RST_MAC_LAN_1 ); + +/* wait for mac reset complete */ +usec_delay (1500 ); +wr32m (hw,TXGBE_MAC_MISC_CTL ,TXGBE_MAC_MISC_LINK_STS_MOD , +TXGBE_LINK_BOTH_PCS_MAC ); + +/* receive packets that size > 2048 */ +wr32m (hw,TXGBE_MACRXCFG , +TXGBE_MACRXCFG_JUMBO ,TXGBE_MACRXCFG_JUMBO ); + +/* clear counters on read */ +wr32m (hw,TXGBE_MACCNTCTL , +TXGBE_MACCNTCTL_RC ,TXGBE_MACCNTCTL_RC ); + +wr32m (hw,TXGBE_RXFCCFG , +TXGBE_RXFCCFG_FC ,TXGBE_RXFCCFG_FC ); + +wr32 (hw,TXGBE_MACRXFLT ,TXGBE_MACRXFLT_PROMISC ); + +wr32 (hw,TXGBE_MAC_WDG_TIMEOUT , mac_wdg_timeout); +wr32 (hw,TXGBE_RXFCCFG , mac_flow_ctrl); + +return 0 ; +} +static void txgbe_reset_misc (struct txgbe_hw *hw) {
drivers/net/txgbe/base/txgbe_hw.h +1 -0
@@ -107,6 +107,7 @@ s32 txgbe_setup_mac_link(struct txgbe_hw *hw, u32 speed, bool autoneg_wait_to_complete);s32 txgbe_setup_sfp_modules (struct txgbe_hw *hw);void txgbe_init_mac_link_ops_sp (struct txgbe_hw *hw); +int txgbe_reconfig_mac (struct txgbe_hw *hw);s32 txgbe_reset_hw (struct txgbe_hw *hw);s32 txgbe_start_hw_raptor (struct txgbe_hw *hw);s32 txgbe_init_phy_raptor (struct txgbe_hw *hw);
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -158,6 +158,8 @@#define TXGBE_RST_SW MS(0, 0x1)#define TXGBE_RST_LAN (i) MS(((i) + 1), 0x1)#define TXGBE_RST_FW MS(3, 0x1) +#define TXGBE_RST_MAC_LAN_1 MS(17, 0x1) +#define TXGBE_RST_MAC_LAN_0 MS(20, 0x1)#define TXGBE_RST_ETH (i) MS(((i) + 29), 0x1)#define TXGBE_RST_GLB MS(31, 0x1)#define TXGBE_RST_DEFAULT (TXGBE_RST_SW | \
drivers/net/txgbe/txgbe_ethdev.c +1 -0
@@ -3082,6 +3082,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,/* enable mac receiver */ if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +txgbe_reconfig_mac (hw);wr32m (hw,TXGBE_MACRXCFG ,TXGBE_MACRXCFG_ENA ,TXGBE_MACRXCFG_ENA ); }
Signature · 1 line
2.21.0.windows.1
PATCH v5 10/21 net/txgbe: add TX head Write-Back mode for Amber-Lite NICs
In reply to Zaiyu WangAdd TX head Write-Back mode for Amber-Lite NICs. When enabled, the hardware no longer individually rewrites descriptors but intermittently notifies the driver of processed descriptor indices. This feature significantly improves performance and is enabled by default in the driver. Users can configure it via tx_headwb and tx_headwb_size in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 7 ++ drivers/net/txgbe/base/txgbe_type.h | 6 ++ drivers/net/txgbe/txgbe_ethdev.c | 13 ++- drivers/net/txgbe/txgbe_rxtx.c | 124 ++++++++++++++++++---- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +++-- 6 files changed, 153 insertions(+), 27 deletions(-)
drivers/net/txgbe/base/txgbe_regs.h +7 -0
@@ -1407,6 +1407,13 @@ enum txgbe_5tuple_protocol {#define TXGBE_TXCFG_WTHRESH (v) LS(v, 16, 0x7F)#define TXGBE_TXCFG_WTHRESH_AML (v) LS(v, 16, 0x1FF)#define TXGBE_TXCFG_FLUSH MS(26, 0x1) +#define TXGBE_PX_TR_CFG_HEAD_WB MS(27, 0x1)/* amlite head wb */ +#define TXGBE_PX_TR_CFG_HEAD_WB_64BYTE MS(28, 0x1)/* amlite head wb 64byte */ +#define TXGBE_PX_TR_CFG_HEAD_WB_MASK MS(27, 0x3) + +/* amlite: tx head wb */ +#define TXGBE_PX_TR_HEAD_ADDRL (_i) (0x03028 + ((_i) * 0x40)) +#define TXGBE_PX_TR_HEAD_ADDRH (_i) (0x0302C + ((_i) * 0x40))#define TXGBE_TDM_DESC_CHK (i) (0x0180B0 + (i) * 4)/*0-3*/ #define TXGBE_TDM_DESC_NONFATAL (i) (0x0180C0 + (i) * 4)/*0-3*/
drivers/net/txgbe/base/txgbe_type.h +6 -0
@@ -716,6 +716,8 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_MAIN "ffe_main"#define TXGBE_DEVARG_FFE_PRE "ffe_pre"#define TXGBE_DEVARG_FFE_POST "ffe_post" +#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb" +#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -726,6 +728,8 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_MAIN ,TXGBE_DEVARG_FFE_PRE ,TXGBE_DEVARG_FFE_POST , +TXGBE_DEVARG_TX_HEAD_WB , +TXGBE_DEVARG_TX_HEAD_WB_SIZE , NULL };
@@ -776,6 +780,8 @@ struct txgbe_devargs {u16 poll;u16 present;u16 sgmii; +u16 tx_headwb; +u16 tx_headwb_size; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +12 -1
@@ -513,6 +513,9 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)u16 ffe_main =27 ;u16 ffe_pre =8 ;u16 ffe_post =44 ; +/* New devargs for amberlite config */ +u16 tx_headwb =1 ; +u16 tx_headwb_size =16 ;if (devargs ==NULL ) goto null;
@@ -537,6 +540,10 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &ffe_pre);rte_kvargs_process (kvlist,TXGBE_DEVARG_FFE_POST , &txgbe_handle_devarg, &ffe_post); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB , + &txgbe_handle_devarg, &tx_headwb); +rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , + &txgbe_handle_devarg, &tx_headwb_size);rte_kvargs_free (kvlist); null:
@@ -544,6 +551,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.poll = poll; hw->devarg.present = present; hw->devarg.sgmii = sgmii; + hw->devarg.tx_headwb = tx_headwb; + hw->devarg.tx_headwb_size = tx_headwb_size; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
@@ -5718,7 +5727,9 @@ RTE_PMD_REGISTER_PARAM_STRING(net_txgbe,TXGBE_DEVARG_FFE_SET "=<0-4>" TXGBE_DEVARG_FFE_MAIN "=<uint16>" TXGBE_DEVARG_FFE_PRE "=<uint16>" - TXGBE_DEVARG_FFE_POST "=<uint16>"); +TXGBE_DEVARG_FFE_POST "=<uint16>" +TXGBE_DEVARG_TX_HEAD_WB "=<0|1>" + TXGBE_DEVARG_TX_HEAD_WB_SIZE "=<1|16>");RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_driver, driver,NOTICE );
drivers/net/txgbe/txgbe_rxtx.c +105 -19
172 lines not on this page · raw message
drivers/net/txgbe/txgbe_rxtx.h +3 -0
@@ -414,6 +414,9 @@ struct txgbe_tx_queue {const struct rte_memzone *mz;uint64_t desc_error;bool resetting; +const struct rte_memzone *headwb; +uint64_t headwb_dma; +volatile uint32_t *headwb_mem; };struct txgbe_txq_ops {
drivers/net/txgbe/txgbe_rxtx_vec_common.h +20 -7
@@ -89,13 +89,26 @@ txgbe_tx_free_bufs(struct txgbe_tx_queue *txq)int nb_free =0 ;struct rte_mbuf *m, *free[RTE_TXGBE_TX_MAX_FREE_BUF_SZ ]; -/* check DD bit on threshold descriptor */ - status = txq->tx_ring[txq->tx_next_dd].dw3; -if (!(status &TXGBE_TXD_DD )) { -if (txq->nb_tx_free >>1 < txq->tx_free_thresh) -txgbe_set32_masked (txq->tdc_reg_addr, -TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); -return 0 ; +if (txq->headwb_mem) { +uint16_t tx_last_dd = txq->nb_tx_desc + + txq->tx_next_dd - txq->tx_free_thresh; +if (tx_last_dd >= txq->nb_tx_desc) + tx_last_dd -= txq->nb_tx_desc; +volatile uint16_t head = (uint16_t )*txq->headwb_mem; +if (txq->tx_next_dd > head && head > tx_last_dd) +return 0 ; +else if (tx_last_dd > txq->tx_next_dd && + (head > tx_last_dd || head < txq->tx_next_dd)) +return 0 ; + }else { +/* check DD bit on threshold descriptor */ + status = txq->tx_ring[txq->tx_next_dd].dw3; +if (!(status &TXGBE_TXD_DD )) { +if (txq->nb_tx_free >>1 < txq->tx_free_thresh) +txgbe_set32_masked (txq->tdc_reg_addr, +TXGBE_TXCFG_FLUSH ,TXGBE_TXCFG_FLUSH ); +return 0 ; + } } n = txq->tx_free_thresh;
Signature · 1 line
2.21.0.windows.1
PATCH v5 11/21 net/txgbe: add RX desc merge mode for Amber-Lite NICs
In reply to Zaiyu WangAdd RX desc merge mode for Amber-Lite NICs. When enabled, the hardware batch-processes RX packets, significantly enhancing performance. This feature is enabled by default in the driver and can be configured via the rx_desc_merge parameter in devargs.
--- drivers/net/txgbe/base/txgbe_regs.h | 4 ++++ drivers/net/txgbe/base/txgbe_type.h | 3 +++ drivers/net/txgbe/txgbe_ethdev.c | 7 ++++++- drivers/net/txgbe/txgbe_rxtx.c | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-)
drivers/net/txgbe/base/txgbe_regs.h +4 -0
@@ -1377,6 +1377,7 @@ enum txgbe_5tuple_protocol {#define TXGBE_RXCFG_HDRLEN (v) LS(HDRLEN(v), 12, 0xF)#define TXGBE_RXCFG_HDRLEN_MASK MS(12, 0xF)#define TXGBE_RXCFG_WTHRESH (v) LS(v, 16, 0x7) +#define TXGBE_RXCFG_DESC_MERGE MS(19, 0x1)#define TXGBE_RXCFG_ETAG MS(22, 0x1)#define TXGBE_RXCFG_RSCMAX_MASK MS(23, 0x3)#define TXGBE_RXCFG_RSCMAX_1 LS(0, 23, 0x3)
@@ -1671,6 +1672,9 @@ enum txgbe_5tuple_protocol {#define TXGBE_RPUP2TC_UP_SHIFT 3#define TXGBE_RPUP2TC_UP_MASK 0x7 +#define TXGBE_RDM_DCACHE_CTL 0x0120A8 +#define TXGBE_RDM_DCACHE_CTL_EN MS(0, 0x1) +/* mac switcher */ #define TXGBE_ETHADDRL 0x016200#define TXGBE_ETHADDRL_AD0 (v) LS(v, 0, 0xFF)
drivers/net/txgbe/base/txgbe_type.h +3 -0
@@ -718,6 +718,7 @@ struct txgbe_phy_info {#define TXGBE_DEVARG_FFE_POST "ffe_post"#define TXGBE_DEVARG_TX_HEAD_WB "tx_headwb"#define TXGBE_DEVARG_TX_HEAD_WB_SIZE "tx_headwb_size" +#define TXGBE_DEVARG_RX_DESC_MERGE "rx_desc_merge"static const char *const txgbe_valid_arguments[] = {TXGBE_DEVARG_BP_AUTO ,
@@ -730,6 +731,7 @@ static const char * const txgbe_valid_arguments[] = {TXGBE_DEVARG_FFE_POST ,TXGBE_DEVARG_TX_HEAD_WB ,TXGBE_DEVARG_TX_HEAD_WB_SIZE , +TXGBE_DEVARG_RX_DESC_MERGE , NULL };
@@ -782,6 +784,7 @@ struct txgbe_devargs {u16 sgmii;u16 tx_headwb;u16 tx_headwb_size; +u16 rx_desc_merge; };struct txgbe_hw {
drivers/net/txgbe/txgbe_ethdev.c +6 -1
@@ -516,6 +516,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)/* New devargs for amberlite config */ u16 tx_headwb =1 ;u16 tx_headwb_size =16 ; +u16 rx_desc_merge =1 ;if (devargs ==NULL ) goto null;
@@ -544,6 +545,8 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) &txgbe_handle_devarg, &tx_headwb);rte_kvargs_process (kvlist,TXGBE_DEVARG_TX_HEAD_WB_SIZE , &txgbe_handle_devarg, &tx_headwb_size); +rte_kvargs_process (kvlist,TXGBE_DEVARG_RX_DESC_MERGE , + &txgbe_handle_devarg, &rx_desc_merge);rte_kvargs_free (kvlist); null:
@@ -553,6 +556,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs) hw->devarg.sgmii = sgmii; hw->devarg.tx_headwb = tx_headwb; hw->devarg.tx_headwb_size = tx_headwb_size; + hw->devarg.rx_desc_merge = rx_desc_merge; hw->phy.ffe_set = ffe_set; hw->phy.ffe_main = ffe_main; hw->phy.ffe_pre = ffe_pre;
@@ -5729,7 +5733,8 @@ RTE_PMD_REGISTER_PARAM_STRING(net_txgbe,TXGBE_DEVARG_FFE_PRE "=<uint16>" TXGBE_DEVARG_FFE_POST "=<uint16>" TXGBE_DEVARG_TX_HEAD_WB "=<0|1>" - TXGBE_DEVARG_TX_HEAD_WB_SIZE "=<1|16>"); +TXGBE_DEVARG_TX_HEAD_WB_SIZE "=<1|16>" + TXGBE_DEVARG_RX_DESC_MERGE "=<0|1>");RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (txgbe_logtype_driver, driver,NOTICE );
drivers/net/txgbe/txgbe_rxtx.c +11 -0
@@ -4667,6 +4667,17 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev) buf_size =ROUND_DOWN (buf_size,0x1 <<10 ); srrctl |=TXGBE_RXCFG_PKTLEN (buf_size); +if ((hw->mac.type == txgbe_mac_aml || + hw->mac.type == txgbe_mac_aml40) && hw->devarg.rx_desc_merge ==1 ) { + srrctl |=TXGBE_RXCFG_DESC_MERGE ; + +wr32 (hw,TXGBE_RDM_DCACHE_CTL ,TXGBE_RDM_DCACHE_CTL_EN ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CTL , +TXGBE_RDM_RSC_CTL_FREE_CTL ); +wr32m (hw,TXGBE_RDM_RSC_CTL ,TXGBE_RDM_RSC_CTL_FREE_CNT_DIS , + ~TXGBE_RDM_RSC_CTL_FREE_CNT_DIS ); + } +wr32 (hw,TXGBE_RXCFG (rxq->reg_idx), srrctl);/* It adds dual VLAN length for supporting dual VLAN */
Signature · 1 line
2.21.0.windows.1
PATCH v5 12/21 net/txgbe: add FEC support for Amber-Lite 25G NICs
In reply to Zaiyu WangAmber-Lite 25G NICs support four FEC modes (off, baser, rs, auto). The driver implements standard interfaces (fec_get_capability, fec_get, fec_set) to allow manual configuration. The default FEC mode is set to 'auto'.
--- drivers/net/txgbe/base/txgbe_aml.c | 27 ++++++- drivers/net/txgbe/base/txgbe_hw.c | 3 + drivers/net/txgbe/base/txgbe_mng.c | 2 +- drivers/net/txgbe/base/txgbe_phy.h | 1 + drivers/net/txgbe/base/txgbe_type.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 121 ++++++++++++++++++++++++++++ 6 files changed, 154 insertions(+), 2 deletions(-)
drivers/net/txgbe/base/txgbe_aml.c +26 -1
@@ -131,6 +131,26 @@ u32 txgbe_get_media_type_aml(struct txgbe_hw *hw)return media_type; } +static int +txgbe_phy_fec_get (struct txgbe_hw *hw) +{ +int value =0 ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_RS_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x4 ) +return TXGBE_PHY_FEC_RS ; + +rte_spinlock_lock (&hw->phy_lock); + value =rd32_epcs (hw,SR_PMA_KR_FEC_CTRL ); +rte_spinlock_unlock (&hw->phy_lock); +if (value &0x1 ) +return TXGBE_PHY_FEC_BASER ; + +return TXGBE_PHY_FEC_OFF ; +} +void txgbe_wait_for_link_up_aml (struct txgbe_hw *hw,u32 speed) {u32 link_speed =TXGBE_LINK_SPEED_UNKNOWN ;
@@ -184,7 +204,12 @@ s32 txgbe_setup_mac_link_aml(struct txgbe_hw *hw, status = hw->mac.check_link (hw, &link_speed, &link_up, autoneg_wait_to_complete); -if (link_speed == speed && link_up) +if (link_up && speed ==TXGBE_LINK_SPEED_25GB_FULL ) + hw->cur_fec_link =txgbe_phy_fec_get (hw); + +if (link_speed == speed && link_up && + !(speed ==TXGBE_LINK_SPEED_25GB_FULL && + !(hw->fec_mode & hw->cur_fec_link)))return status;if (speed &TXGBE_LINK_SPEED_25GB_FULL )
drivers/net/txgbe/base/txgbe_hw.c +3 -0
@@ -338,6 +338,9 @@ s32 txgbe_init_hw(struct txgbe_hw *hw)txgbe_disable_lldp (hw); +/* Init fec mode to 'AUTO' */ + hw->fec_mode =TXGBE_PHY_FEC_AUTO ; +/* Reset the hardware */ status = hw->mac.reset_hw (hw);if (status ==0 || status ==TXGBE_ERR_SFP_NOT_PRESENT ) {
drivers/net/txgbe/base/txgbe_mng.c +1 -1
@@ -613,7 +613,7 @@ s32 txgbe_hic_ephy_set_link(struct txgbe_hw *hw, u8 speed, u8 autoneg, u8 duplex buffer.hdr.buf_len =sizeof (struct txgbe_hic_ephy_setlink ) -sizeof (struct txgbe_hic_hdr ); buffer.hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ; - buffer.fec_mode =TXGBE_PHY_FEC_AUTO ; + buffer.fec_mode = hw->fec_mode; buffer.speed = speed; buffer.autoneg = autoneg; buffer.duplex = duplex;
drivers/net/txgbe/base/txgbe_phy.h +1 -0
@@ -40,6 +40,7 @@#define SR_PMA_KR_LD_CESTS_RR MS16(15, 0x1)#define SR_PMA_KR_FEC_CTRL 0x0100AB#define SR_PMA_KR_FEC_CTRL_EN MS16(0, 0x1) +#define SR_PMA_RS_FEC_CTRL 0x0100C8#define SR_MII_MMD_CTL 0x1F0000#define SR_MII_MMD_CTL_AN_EN 0x1000#define SR_MII_MMD_CTL_RESTART_AN 0x0200
drivers/net/txgbe/base/txgbe_type.h +2 -0
@@ -848,6 +848,8 @@ struct txgbe_hw {/*amlite: new SW-FW mbox */ u8 swfw_index;rte_atomic32_t swfw_busy; +u32 fec_mode; +u32 cur_fec_link; };struct txgbe_backplane_ability {
drivers/net/txgbe/txgbe_ethdev.c +121 -0
142 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v5 13/21 net/txgbe: add GPIO configuration
In reply to Zaiyu WangAdd GPIO configuration for Amber-Lite NICs to match design differences from 10G NICs: The Amber-Lite NIC requires additional setup steps compared to 10G NICs to ensure proper functionality of features SFP module detection.
--- drivers/net/txgbe/base/txgbe_regs.h | 2 + drivers/net/txgbe/txgbe_ethdev.c | 111 ++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+)
drivers/net/txgbe/base/txgbe_regs.h +2 -0
@@ -1631,6 +1631,8 @@ enum txgbe_5tuple_protocol {#define TXGBE_GPIOINTEN 0x014830#define TXGBE_GPIOINTMASK 0x014834#define TXGBE_GPIOINTTYPE 0x014838 +#define TXGBE_GPIO_INT_POLARITY 0x01483C +#define TXGBE_GPIO_INT_POLARITY_3 MS(3, 0x1)#define TXGBE_GPIOINTSTAT 0x014840#define TXGBE_GPIORAWINTSTAT 0x014844#define TXGBE_GPIOEOI 0x01484C
drivers/net/txgbe/txgbe_ethdev.c +111 -0
158 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v5 14/21 net/txgbe: disable unstable features
In reply to Zaiyu WangTemporarily disabled unstable features on Amber-Lite NICs (e.g., flow control). These incomplete features will be gradually completed in future driver updates.
--- drivers/net/txgbe/base/txgbe_hw.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/txgbe/base/txgbe_hw.c +7 -0
@@ -144,6 +144,10 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw)u32 value =0 ;u64 reg_bp =0 ; +/* amlite-to-do */ +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) +return 0 ; +/* Validate the requested mode */ if (hw->fc.strict_ieee && hw->fc.requested_mode == txgbe_fc_rx_pause) {DEBUGOUT ("txgbe_fc_rx_pause not valid in strict IEEE mode" );
@@ -3242,6 +3246,9 @@ void txgbe_set_hard_rate_select_speed(struct txgbe_hw *hw,u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA );switch (speed) { +case TXGBE_LINK_SPEED_25GB_FULL : +/* amlite-to-do */ +break ;case TXGBE_LINK_SPEED_10GB_FULL : esdp_reg |= (TXGBE_GPIOBIT_4 |TXGBE_GPIOBIT_5 );break ;
Signature · 1 line
2.21.0.windows.1
PATCH v5 15/21 net/txgbe: add support for TX laser enable/disable
In reply to Zaiyu WangAdd enable/disable TX laser configuration code for Amber-Lite NICs. Due to hardware design differences, the GPIO controlling the TX laser on Amber-Lite NICs differs from Sapphire NICs, requiring corresponding configuration changes.
--- drivers/net/txgbe/base/txgbe_hw.c | 31 ++++++++++++++++++++++++----- drivers/net/txgbe/base/txgbe_regs.h | 10 ++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +26 -5
@@ -3179,12 +3179,28 @@ void txgbe_disable_tx_laser_multispeed_fiber(struct txgbe_hw *hw) {u32 esdp_reg =rd32 (hw,TXGBE_GPIODATA ); -if (txgbe_close_notify (hw)) -txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | -TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); +if (txgbe_close_notify (hw)) { +/* over write led when ifconfig down */ +if (hw->mac.type == txgbe_mac_aml40) { +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_40G | +TXGBE_AMLITE_LED_LINK_ACTIVE ); + }else if (hw->mac.type == txgbe_mac_aml) +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_AMLITE_LED_LINK_25G | +TXGBE_AMLITE_LED_LINK_10G |TXGBE_AMLITE_LED_LINK_ACTIVE ); +else +txgbe_led_off (hw,TXGBE_LEDCTL_UP |TXGBE_LEDCTL_10G | +TXGBE_LEDCTL_1G |TXGBE_LEDCTL_ACTIVE ); + }/* Disable Tx laser; allow 100us to go dark per spec */ - esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg &= ~TXGBE_GPIOBIT_1 ; + }else if (hw->mac.type == txgbe_mac_aml) { + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg |= (TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);usec_delay (100 );
@@ -3206,7 +3222,12 @@ void txgbe_enable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)wr32 (hw,TXGBE_LEDCTL ,0 );/* Enable Tx laser; allow 100ms to light up */ - esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); +if (hw->mac.type == txgbe_mac_aml40) { +wr32m (hw,TXGBE_GPIODIR ,TXGBE_GPIOBIT_1 ,TXGBE_GPIOBIT_1 ); + esdp_reg |=TXGBE_GPIOBIT_1 ; + }else { + esdp_reg &= ~(TXGBE_GPIOBIT_0 |TXGBE_GPIOBIT_1 ); + }wr32 (hw,TXGBE_GPIODATA , esdp_reg);txgbe_flush (hw);msec_delay (100 );
drivers/net/txgbe/base/txgbe_regs.h +10 -0
@@ -302,6 +302,16 @@#define TXGBE_PORT_LINK1000M MS(2, 0x1)#define TXGBE_PORT_LINK100M MS(3, 0x1)#define TXGBE_PORT_LANID (r) RS(r, 8, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL MS(5, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL MS(4, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL MS(3, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL MS(2, 0x1) +#define TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL MS(1, 0x1) +#define TXGBE_AMLITE_LED_LINK_ACTIVE TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL +#define TXGBE_AMLITE_LED_LINK_10G TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL +#define TXGBE_AMLITE_LED_LINK_25G TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL +#define TXGBE_AMLITE_LED_LINK_40G TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL +#define TXGBE_AMLITE_LED_LINK_50G TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL#define TXGBE_EXTAG 0x014408#define TXGBE_EXTAG_ETAG_MASK MS(0, 0xFFFF)#define TXGBE_EXTAG_ETAG (v) LS(v, 0, 0xFFFF)
Signature · 1 line
2.21.0.windows.1
PATCH v5 16/21 net/txgbe: add support for TX queue rate limiting
In reply to Zaiyu WangAdd TX queue rate limiting functionality for Amber-Lite NICs. Due to hardware design differences, the TX queue rate limiting configuration for Amber-Lite NICs requires updates compared to Sapphire NICs.
--- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_regs.h | 12 +++++ drivers/net/txgbe/txgbe_ethdev.c | 69 +++++++++++++++++++++++----- 3 files changed, 72 insertions(+), 11 deletions(-)
drivers/net/txgbe/base/txgbe_osdep.h +2 -0
@@ -164,6 +164,8 @@ static inline u64 REVERT_BIT_MASK64(u64 mask)#define IOMEM +#define BIT (nr) (1UL << (nr)) +#define prefetch (x) rte_prefetch0(x)#define ARRAY_SIZE (x) ((int32_t)RTE_DIM(x))
drivers/net/txgbe/base/txgbe_regs.h +12 -0
@@ -1656,6 +1656,18 @@ enum txgbe_5tuple_protocol {#define TXGBE_ARBTXRATE_MIN (v) LS(v, 0, 0x3FFF)#define TXGBE_ARBTXRATE_MAX (v) LS(v, 16, 0x3FFF) +#define TXGBE_TDM_RL_QUEUE_IDX 0x018210 +#define TXGBE_TDM_RL_QUEUE_CFG 0x018214 +#define TXGBE_TDM_FACTOR_INT_MASK MS(16, 0xFFFF) +#define TXGBE_TDM_FACTOR_FRA_MASK MS(0, 0xFFFC) +#define TXGBE_TDM_FACTOR_INT_SHIFT 16 +#define TXGBE_TDM_FACTOR_FRA_SHIFT 2 + +#define TXGBE_TDM_RL_VM_IDX 0x018218 +#define TXGBE_TDM_RL_VM_CFG 0x01821C +#define TXGBE_TDM_RL_CFG 0x018400 +#define TXGBE_TDM_RL_EN MS(0, 0x1) +/* qos */ #define TXGBE_ARBTXCTL 0x018200#define TXGBE_ARBTXCTL_RRM MS(1, 0x1)
drivers/net/txgbe/txgbe_ethdev.c +58 -11
91 lines not on this page · raw message
Signature · 1 line
2.21.0.windows.1
PATCH v5 17/21 net/txgbe: add support for getting PHY ID
In reply to Zaiyu WangAdd PHY ID reading functionality for Amber-Lite NICs. Due to hardware design differences, the process for obtaining the PHY ID on Amber-Lite NICs differs from Sapphire NICs and requires additional delay handling.
--- drivers/net/txgbe/base/txgbe_phy.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/net/txgbe/base/txgbe_phy.c +35 -0
@@ -173,6 +173,41 @@ s32 txgbe_get_phy_id(struct txgbe_hw *hw)u32 err;u16 phy_id_high =0 ;u16 phy_id_low =0 ; +u32 i =0 ; +u32 status; + +if (hw->mac.type == txgbe_mac_aml) { + hw->phy.addr =0 ; + +for (i =0 ; i <32 ; i++) { + hw->phy.addr = i; + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_HIGH ,0 , &phy_id_high); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 1" ); +return status; + } +DEBUGOUT ("%d: phy_id_high 0x%x" , i, phy_id_high); +if ((phy_id_high &0xFFFF ) ==0x0141 ) +break ; + } + +if (i ==32 ) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed" ); +return TXGBE_ERR_PHY ; + } + + status =txgbe_read_phy_reg_mdi (hw,TXGBE_MD_PHY_ID_LOW ,0 , &phy_id_low); +if (status) { +DEBUGOUT ("txgbe_read_phy_reg_mdi failed 2" ); +return status; + } + hw->phy.id = (u32)(phy_id_high &0xFFFF ) <<6 ; + hw->phy.id |= (u32)((phy_id_low &0xFC00 ) >>10 ); + +DEBUGOUT ("phy_id 0x%x" , hw->phy.id); + +return status; + } err = hw->phy.read_reg(hw, TXGBE_MD_PHY_ID_HIGH, TXGBE_MD_DEV_PMA_PMD,
Signature · 1 line
2.21.0.windows.1
PATCH v5 18/21 net/txgbe: add thermal sensor configuration for Amber-Lite NICs
In reply to Zaiyu WangAdd thermal sensor configuration code for Amber-Lite NICs. Due to differences in hardware design, Amber-Lite NICs require different configuration from Sapphire NICs to initialize and retrieve thermal sensor data.
--- drivers/net/txgbe/base/txgbe_hw.c | 81 ++++++++++++++++++++++------- drivers/net/txgbe/base/txgbe_type.h | 27 ++++++++++ 2 files changed, 90 insertions(+), 18 deletions(-)
drivers/net/txgbe/base/txgbe_hw.c +63 -18
@@ -2220,27 +2220,56 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw)* * Returns the thermal sensor data structure **/ +#define PHYINIT_TIMEOUT 1000s32 txgbe_get_thermal_sensor_data (struct txgbe_hw *hw) {struct txgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;s64 tsv;u32 ts_stat; +u32 data_code; +int temp_data, temp_fraction; +int i =0 ;/* Only support thermal sensors attached to physical port 0 */ if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; - ts_stat =rd32 (hw,TXGBE_TSSTAT ); - tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); - tsv = tsv >1200 ? tsv :1200 ; - tsv = -(48380 <<8 ) /1000 - + tsv * (31020 <<8 ) /100000 - - tsv * tsv * (18201 <<8 ) /100000000 - + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 - - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; - tsv >>=8 ; +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0001 ); + +while (1 ) { + data_code =rd32 (hw,TXGBE_AML_TS_STS ); +if ((data_code &TXGBE_AML_TS_STS_VLD ) !=0 ) +break ; +msleep (1 ); +if (i++ >PHYINIT_TIMEOUT ) { +PMD_DRV_LOG (ERR ,"ERROR: Wait 0x1033c Timeout!!!" ); +return -1 ; + } + } + + data_code = data_code &0xFFF ; + temp_data =419400 +2205 * (data_code *1000 /4094 -500 ); - data->sensor[0 ].temp = (s16 )tsv; +/* Change double Temperature to int */ + tsv = temp_data /10000 ; + temp_fraction = temp_data - (tsv *10000 ); +if (temp_fraction >=5000 ) + tsv +=1 ; + data->sensor[0 ].temp = (s16 )tsv; + }else { + ts_stat =rd32 (hw,TXGBE_TSSTAT ); + tsv = (s64 )TXGBE_TSSTAT_DATA (ts_stat); + tsv = tsv >1200 ? tsv :1200 ; + tsv = -(48380 <<8 ) /1000 + + tsv * (31020 <<8 ) /100000 + - tsv * tsv * (18201 <<8 ) /100000000 + + tsv * tsv * tsv * (81542 <<8 ) /1000000000000 + - tsv * tsv * tsv * tsv * (16743 <<8 ) /1000000000000000 ; + tsv >>=8 ; + + data->sensor[0 ].temp = (s16 )tsv; + }return 0 ; }
@@ -2261,16 +2290,32 @@ s32 txgbe_init_thermal_sensor_thresh(struct txgbe_hw *hw)if (hw->bus.lan_id !=0 )return TXGBE_NOT_IMPLEMENTED ; -wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); -wr32 (hw,TXGBE_TSINTR , -TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); -wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); - - data->sensor[0 ].alarm_thresh =100 ; -wr32 (hw,TXGBE_TSATHRE ,677 ); data->sensor[0 ].dalarm_thresh =90 ; -wr32 (hw,TXGBE_TSDTHRE ,614 ); + +if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) { +wr32 (hw,TXGBE_AML_TS_ENA ,0x0 ); +wr32 (hw,TXGBE_AML_INTR_RAW_LO ,TXGBE_AML_INTR_CL_LO ); +wr32 (hw,TXGBE_AML_INTR_RAW_HI ,TXGBE_AML_INTR_CL_HI ); + +wr32 (hw,TXGBE_AML_INTR_HIGH_EN ,TXGBE_AML_INTR_EN_HI ); +wr32 (hw,TXGBE_AML_INTR_LOW_EN ,TXGBE_AML_INTR_EN_LO ); + +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_EVAL_MODE_MASK ,0x10 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_ALARM_THRE_MASK ,0x186a0000 ); +wr32m (hw,TXGBE_AML_TS_CTL1 ,TXGBE_AML_DALARM_THRE_MASK ,0x16f60 ); +wr32 (hw,TXGBE_AML_TS_ENA ,0x1 ); + }else { +wr32 (hw,TXGBE_TSCTRL ,TXGBE_TSCTRL_EVALMD ); +wr32 (hw,TXGBE_TSINTR , +TXGBE_TSINTR_AEN |TXGBE_TSINTR_DEN ); +wr32 (hw,TXGBE_TSEN ,TXGBE_TSEN_ENA ); + + data->sensor[0 ].alarm_thresh =100 ; +wr32 (hw,TXGBE_TSATHRE ,677 ); + data->sensor[0 ].dalarm_thresh =90 ; +wr32 (hw,TXGBE_TSDTHRE ,614 ); + }return 0 ; }
drivers/net/txgbe/base/txgbe_type.h +27 -0
@@ -37,6 +37,33 @@#include "txgbe_osdep.h" #include "txgbe_devids.h" +/* Sensors for AMLITE PVT(Process Voltage Temperature) */ +#define TXGBE_AML_INTR_RAW_HI 0x10300 +#define TXGBE_AML_INTR_RAW_ME 0x10304 +#define TXGBE_AML_INTR_RAW_LO 0x10308 +#define TXGBE_AML_TS_CTL1 0x10330 +#define TXGBE_AML_TS_CTL2 0x10334 +#define TXGBE_AML_TS_ENA 0x10338 +#define TXGBE_AML_TS_STS 0x1033C +#define TXGBE_AML_INTR_HIGH_EN 0x10318 +#define TXGBE_AML_INTR_MED_EN 0x1031C +#define TXGBE_AML_INTR_LOW_EN 0x10320 +#define TXGBE_AML_INTR_HIGH_STS 0x1030C +#define TXGBE_AML_INTR_MED_STS 0x10310 +#define TXGBE_AML_INTR_LOW_STS 0x10314 + +#define TXGBE_AML_TS_STS_VLD 0x00001000U +#define TXGBE_AML_INTR_EN_HI 0x00000002U +#define TXGBE_AML_INTR_EN_ME 0x00000001U +#define TXGBE_AML_INTR_EN_LO 0x00000001U +#define TXGBE_AML_INTR_CL_HI 0x00000002U +#define TXGBE_AML_INTR_CL_ME 0x00000001U +#define TXGBE_AML_INTR_CL_LO 0x00000001U +#define TXGBE_AML_EVAL_MODE_MASK 0x00000010U +#define TXGBE_AML_CAL_MODE_MASK 0x00000008U +#define TXGBE_AML_ALARM_THRE_MASK 0x1FFE0000U +#define TXGBE_AML_DALARM_THRE_MASK 0x0001FFE0U +struct txgbe_thermal_diode_data {s16 temp;s16 alarm_thresh;
Signature · 1 line
2.21.0.windows.1
PATCH v5 19/21 net/txgbe: add RSS for Amber-Lite NICs
In reply to Zaiyu WangAdd RSS (Receive Side Scaling) functionality for Amber-Lite NICs. The Amber-Lite NIC series provides comprehensive RSS support with hardware implementation identical to Sapphire NICs. This commit enables RSS by applying the existing RSS configuration directly to Amber-Lite NICs without requiring architectural changes.
--- drivers/net/txgbe/txgbe_ethdev.c | 7 +++++-- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/txgbe/txgbe_ethdev.c +5 -2
@@ -3849,7 +3849,7 @@ txgbe_dev_rss_reta_update(struct rte_eth_dev *dev,PMD_INIT_FUNC_TRACE (); -if (!txgbe_rss_update_sp (hw->mac.type)) { +if (!txgbe_rss_update (hw->mac.type)) {PMD_DRV_LOG (ERR ,"RSS reta update is not supported on this " "NIC." );return -ENOTSUP ;
@@ -5174,11 +5174,14 @@ txgbe_get_module_eeprom(struct rte_eth_dev *dev, }bool -txgbe_rss_update_sp (enum txgbe_mac_type mac_type) +txgbe_rss_update (enum txgbe_mac_type mac_type) {switch (mac_type) {case txgbe_mac_sp:case txgbe_mac_sp_vf: +case txgbe_mac_aml: +case txgbe_mac_aml40: +case txgbe_mac_aml_vf:return 1 ;default :return 0 ;
drivers/net/txgbe/txgbe_ethdev.h +1 -1
@@ -517,7 +517,7 @@ int txgbe_dev_rss_hash_update(struct rte_eth_dev *dev,int txgbe_dev_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf); -bool txgbe_rss_update_sp (enum txgbe_mac_type mac_type); +bool txgbe_rss_update (enum txgbe_mac_type mac_type); int txgbe_add_del_ntuple_filter(struct rte_eth_dev *dev, struct rte_eth_ntuple_filter *filter,
drivers/net/txgbe/txgbe_rxtx.c +1 -1
@@ -3111,7 +3111,7 @@ txgbe_dev_rss_hash_update(struct rte_eth_dev *dev,uint64_t rss_hf;uint16_t i; -if (!txgbe_rss_update_sp (hw->mac.type)) { +if (!txgbe_rss_update (hw->mac.type)) {PMD_DRV_LOG (ERR ,"RSS hash update is not supported on this " "NIC." );return -ENOTSUP ;
Signature · 1 line
2.21.0.windows.1
PATCH v5 20/21 doc: update for txgbe guides
In reply to Zaiyu WangAdd new types of Wangxun NICs(Amber-Lite NIC models) into txgbe supported NICs list, and supplement usage instructions.
--- doc/guides/nics/txgbe.rst | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
doc/guides/nics/txgbe.rst +29 -2
@@ -4,8 +4,12 @@ TXGBE Poll Mode Driver ====================== -The TXGBE PMD (librte_pmd_txgbe) provides poll mode driver support -for Wangxun 10 Gigabit Ethernet NICs. +Supported NICs +-------------- + +- Wangxun 10 Gigabit Ethernet NICs +- Wangxun 25 Gigabit Ethernet NICs +- Wangxun 40 Gigabit Ethernet NICs Features --------
@@ -30,6 +34,7 @@ Features - FW version - LRO - Generic flow API +- Forward Error Correction (FEC) (only for 25G NICs) Prerequisites -------------
@@ -37,6 +42,9 @@ Prerequisites - Learning about Wangxun 10 Gigabit Ethernet NICs using `<https://www.net-swift.com/a/383.html>`_. +- Learning about Wangxun 25 Gigabit Ethernet NICs using + `<https://www.net-swift.com/a/25GbE-tong-yong-lei-FF5025.html>`_. + - Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. Configuration
@@ -139,6 +147,25 @@ Please note that following ``devargs`` are only set for backplane NICs. PHY parameter used for user debugging. Setting other values to take effect requires setting the ``ffe_set``. +Please note that following ``devargs`` are only set for Amber-Lite NICs. + +- ``tx_headwb`` (default **1**) + + Use to enable the TX Head Write-Back mode. In this mode, the hardware + merges and writes back a group of TX descriptors together to reduce + memory access times, which helps improve performance. + +- ``tx_headwb_size`` (default **16**) + + Tx head write-back length. It is recommended to use the default values. + Setting other values to take effect requires setting the ``tx_headwb``. + +- ``rx_desc_merge`` (default **1**) + + Use to enable the RX descriptor merge mode. In this mode, the hardware + merges and writes back a group of RX descriptors together to reduce + memory access times, which helps improve performance. + Driver compilation and testing ------------------------------
Signature · 1 line
2.21.0.windows.1
PATCH v5 21/21 doc: update release notes for Wangxun txgbe driver
In reply to Zaiyu WangAdd recent updates of Wangxun txgbe driver to 25.11 release notes.
--- doc/guides/rel_notes/release_25_11.rst | 7 +++++++ 1 file changed, 7 insertions(+)
doc/guides/rel_notes/release_25_11.rst +7 -0
@@ -87,6 +87,13 @@ New Features * Added multi-process per port. * Optimized code. +* **Updated Wangxun txgbe driver.** + + Added support for Wangxun Amber-Lite NIC series, including FF5025 (supporting + 10G and 25G) and FF5040 (supporting 40G). As these new models share hardware + similarities with the existing 10G Sapphire NICs, many of the existing + configurations and practices are expected to apply. + * **Allow overriding the automatic usage/help generation in argparse library.** The argparse library now supports overriding the automatic help text generation,
Signature · 1 line
2.21.0.windows.1
Stephen Hemminger
AppliedRe: [PATCH v5 00/21] Wangxun new NIC support
In reply to Zaiyu WangQuoted 57 lines · On Thu, 16 Oct 2025 19:17:14 +0800 Zaiyu Wang <[email protected]> wrote:
We have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
---
v5:
- update txgbe guides, add more usage instructions
- add a short summary into 25.11 release notes
---Zaiyu Wang (21):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface
net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: rename raptor to sp for Sapphire-specific code net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add support for TX laser enable/disable net/txgbe: add support for TX queue rate limiting net/txgbe: add support for getting PHY ID
net/txgbe: add thermal sensor configuration for Amber-Lite NICs net/txgbe: add RSS for Amber-Lite NICs
doc: update for txgbe guides
doc: update release notes for Wangxun txgbe driverdoc/guides/nics/txgbe.rst | 31 +- doc/guides/rel_notes/release_25_11.rst | 7 + drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 365 ++++++++++++++++---- drivers/net/txgbe/base/txgbe_hw.h | 15 +- drivers/net/txgbe/base/txgbe_mng.c | 184 +++++++++- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 ++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 103 +++++- drivers/net/txgbe/base/txgbe_type.h | 70 +++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 390 ++++++++++++++++++++-- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +-
Quoted 9 lines
drivers/net/txgbe/txgbe_rxtx.c | 203 ++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 27 files changed, 1967 insertions(+), 202 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Queued to next-net.
I changed the git commit subject to conform to the restrictions imposed by check-git-log.sh. Max line length of 60 and prefer "Rx" over "RX"
RE: [PATCH v5 00/21] Wangxun new NIC support
Quoted 78 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Friday, October 17, 2025 12:59 AM
To: Zaiyu Wang <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v5 00/21] Wangxun new NIC supportQuoted 46 lines · On Thu, 16 Oct 2025 19:17:14 +0800 Zaiyu Wang <[email protected]> wrote:
We have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
---
v5:
- update txgbe guides, add more usage instructions
- add a short summary into 25.11 release notes
---Zaiyu Wang (21):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface
net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: rename raptor to sp for Sapphire-specific code net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add support for TX laser enable/disable net/txgbe: add support for TX queue rate limiting net/txgbe: add support for getting PHY ID
net/txgbe: add thermal sensor configuration for Amber-Lite NICs net/txgbe: add RSS for Amber-Lite NICs
doc: update for txgbe guides
doc: update release notes for Wangxun txgbe driverdoc/guides/nics/txgbe.rst | 31 +- doc/guides/rel_notes/release_25_11.rst | 7 + drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 365 ++++++++++++++++---- drivers/net/txgbe/base/txgbe_hw.h | 15 +- drivers/net/txgbe/base/txgbe_mng.c | 184 +++++++++-Quoted 8 lines
drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 ++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 103 +++++- drivers/net/txgbe/base/txgbe_type.h | 70 +++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 390++++++++++++++++++++--
Quoted 12 lines
drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +- drivers/net/txgbe/txgbe_rxtx.c | 203 ++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 27 files changed, 1967 insertions(+), 202 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Quoted 4 lines
Queued to next-net.
I changed the git commit subject to conform to the restrictions imposed bycheck-git-log.sh. Max line length of 60 and prefer "Rx" over "RX"
Thank you for queuing the patch and fixing the nits. I'll pay more attention to such details in future submissions.
Re: [PATCH v5 00/21] Wangxun new NIC support
In reply to Zaiyu WangQuoted 57 lines · On Thu, 16 Oct 2025 19:17:14 +0800 Zaiyu Wang <[email protected]> wrote:
We have released a new NIC series: Amber-Lite, with two models supporting 10G/25G and 40G rates. Due to minimal hardware differences from existing 10G NICs, it remains supported within the txgbe driver.
---
v5:
- update txgbe guides, add more usage instructions
- add a short summary into 25.11 release notes
---Zaiyu Wang (21):
net/txgbe: add basic information for Amber-Lite 25G/40G NICs net/txgbe: add new SW-FW mailbox interface
net/txgbe: add identification support for new SFP/QSFP modules net/txgbe: rename raptor to sp for Sapphire-specific code net/txgbe: add basic link configuration for Amber-Lite NICs net/txgbe: add support for PHY configuration via SW-FW mailbox net/txgbe: add RX&TX support for Amber-Lite NICs net/txgbe: add hardware reset change for Amber-Lite NICs net/txgbe: add MAC reconfiguration to avoid packet loss net/txgbe: add TX head Write-Back mode for Amber-Lite NICs net/txgbe: add RX desc merge mode for Amber-Lite NICs net/txgbe: add FEC support for Amber-Lite 25G NICs net/txgbe: add GPIO configuration
net/txgbe: disable unstable features
net/txgbe: add support for TX laser enable/disable net/txgbe: add support for TX queue rate limiting net/txgbe: add support for getting PHY ID
net/txgbe: add thermal sensor configuration for Amber-Lite NICs net/txgbe: add RSS for Amber-Lite NICs
doc: update for txgbe guides
doc: update release notes for Wangxun txgbe driverdoc/guides/nics/txgbe.rst | 31 +- doc/guides/rel_notes/release_25_11.rst | 7 + drivers/net/txgbe/base/meson.build | 2 + drivers/net/txgbe/base/txgbe_aml.c | 354 ++++++++++++++++++++ drivers/net/txgbe/base/txgbe_aml.h | 22 ++ drivers/net/txgbe/base/txgbe_aml40.c | 160 +++++++++ drivers/net/txgbe/base/txgbe_aml40.h | 20 ++ drivers/net/txgbe/base/txgbe_devids.h | 9 + drivers/net/txgbe/base/txgbe_eeprom.c | 7 +- drivers/net/txgbe/base/txgbe_eeprom.h | 2 + drivers/net/txgbe/base/txgbe_hw.c | 365 ++++++++++++++++---- drivers/net/txgbe/base/txgbe_hw.h | 15 +- drivers/net/txgbe/base/txgbe_mng.c | 184 +++++++++- drivers/net/txgbe/base/txgbe_mng.h | 34 +- drivers/net/txgbe/base/txgbe_osdep.h | 2 + drivers/net/txgbe/base/txgbe_phy.c | 127 ++++++- drivers/net/txgbe/base/txgbe_phy.h | 24 ++ drivers/net/txgbe/base/txgbe_regs.h | 103 +++++- drivers/net/txgbe/base/txgbe_type.h | 70 +++- drivers/net/txgbe/base/txgbe_vf.c | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 390 ++++++++++++++++++++-- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/txgbe/txgbe_flow.c | 2 +-
Quoted 9 lines
drivers/net/txgbe/txgbe_rxtx.c | 203 ++++++++--- drivers/net/txgbe/txgbe_rxtx.h | 3 + drivers/net/txgbe/txgbe_rxtx_vec_common.h | 27 +- 27 files changed, 1967 insertions(+), 202 deletions(-) create mode 100644 drivers/net/txgbe/base/txgbe_aml.c create mode 100644 drivers/net/txgbe/base/txgbe_aml.h create mode 100644 drivers/net/txgbe/base/txgbe_aml40.c create mode 100644 drivers/net/txgbe/base/txgbe_aml40.h
Put this version in next-net