cxgb4: Add T7 adapter support
Subsystems (3)
Potnuri Bharat Teja
maintainerv4 cover cxgb4: Add T7 adapter support
This series adds support for Chelsio T7 adapters to the cxgb4 driver.
The series extends the driver core to recognize and initialize T7 devices, adds support for T7-specific hardware resources and firmware interfaces, updates PCI initialization and resource management, and enables adapter operation through the existing networking stack.
In addition, the series updates several auxiliary components to support the T7 architecture, including PTP, ethtool, filter management, CUDBG, and debugfs. Support is also added for T7 multicore debugging and diagnostic infrastructure.
Testing:
1. Each patch compiled individually
2. Driver probe and initialization on T7 adapters
3. Link bring-up
4. ping
5. NIC tx and rx traffic (using neperf and iperf)
6. Reload the driver multiple times
checkpatch.pl:
- Patch 4: "missing sentinel in ID array" and "Macros with complex values should be enclosed in parentheses" warnings are reported for the macro-generated PCI device ID table. The generated table includes the required terminating entry. This error is a false-positive.
- Patch 7: Several "Avoid CamelCase" warnings are reported for standard ethtool link mode identifiers (e.g. 1000baseKX_Full, 100000baseCR4_Full), which are kernel-defined names and cannot be renamed.
Potnuri Bharat Teja (12):
cxgb4: add T7 hardware definitions and firmware interfaces
cxgb4: rework the interrupt handling framework
cxgb4: add T7 hardware management support
cxgb4: move PCI device management into cxgb4_pci.c and rework driver
helpers
cxgb4: add T7 support to the main driver
cxgb4: update PTP register access for T7
cxgb4: extend ethtool support for T7 adapters
cxgb4: Add T7 support to the filter infrastructure.
cxgb4: Add indirect register definitions for T7
cxgb4: extend CUDBG support for T7 adapters
cxgb4: extend debugfs support for T7 adapters
cxgb4: select ULD Tx and control queues by TID on T7
---
v3 -> v4
- fixed buildbot errors
---
v2 -> v3:
- rebase the patches to tot
- add ULD multicore support changes
v1 -> v2:
- split the v1 hardware management patch in two; the interrupt handling rework is not T7 specific and now lands first
- merged the PCI management patch into the one that wires it up, so each commit builds what it adds, then split off the T7 changes
- fixed per patch build failures reported by the kernel test robot
- fixed: shared static intr_info structures mutated per adapter; t4_handle_intr() clearing only enabled cause bits; IPv4 address byte order in mk_act_open_req(); cxgb4_read_tpte() sleeping under xa_lock_irq(); missing CAP_NET_ADMIN on the cudbg ioctl read commands; CXGB4_DEV_ENABLED set too late in probe
- dropped the SYN-only filter field and the unused cxgb4_pci helpers
---
drivers/net/ethernet/chelsio/cxgb4/Makefile | 2 +- drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c | 10 +- .../net/ethernet/chelsio/cxgb4/cudbg_entity.h | 114 +- drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 56 +- .../ethernet/chelsio/cxgb4/cudbg_indir_reg.h | 43 + .../chelsio/cxgb4/cudbg_indir_reg_t7.h | 1113 +++ .../net/ethernet/chelsio/cxgb4/cudbg_lib.c | 1088 ++- .../net/ethernet/chelsio/cxgb4/cudbg_lib.h | 60 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 148 +- .../net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 20 +- .../net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 19 +- .../ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 1029 ++- .../ethernet/chelsio/cxgb4/cxgb4_debugfs.h | 17 +- .../ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 381 +- .../net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 214 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 1183 +-- .../net/ethernet/chelsio/cxgb4/cxgb4_pci.c | 332 + .../net/ethernet/chelsio/cxgb4/cxgb4_pci.h | 23 + .../net/ethernet/chelsio/cxgb4/cxgb4_ptp.c | 82 +- .../net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 140 +- .../net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 5 + drivers/net/ethernet/chelsio/cxgb4/sge.c | 182 +- .../net/ethernet/chelsio/cxgb4/t4_chip_type.h | 10 + drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 6579 ++++++++++++--- drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 140 +- drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 109 +- .../ethernet/chelsio/cxgb4/t4_pci_id_tbl.h | 21 + drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 7285 ++++++++++++++--- drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h | 16 + .../net/ethernet/chelsio/cxgb4/t4_values.h | 11 + drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 88 +- .../net/ethernet/chelsio/cxgb4/t4fw_version.h | 9 + 32 files changed, 17040 insertions(+), 3489 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_indir_reg.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_indir_reg_t7.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_pci.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_pci.h
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 1/12 cxgb4: add T7 hardware definitions and firmware interfaces
Add the initial T7-specific hardware definitions required by the cxgb4 driver. This patch updates chip identification, PCI device IDs, register definitions, TCB layout definitions, firmware API interfaces, firmware version information, message formats, and related constants to provide the foundational infrastructure for upcoming T7 support.
No functional changes are introduced by this patch. It only extends the existing hardware and firmware definition headers for T7-specific driver functionality.
--- .../net/ethernet/chelsio/cxgb4/t4_chip_type.h | 10 + drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 109 +- .../ethernet/chelsio/cxgb4/t4_pci_id_tbl.h | 21 + drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 7284 ++++++++++++++--- drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h | 16 + .../net/ethernet/chelsio/cxgb4/t4_values.h | 11 + drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 83 +- .../net/ethernet/chelsio/cxgb4/t4fw_version.h | 9 + 8 files changed, 6401 insertions(+), 1142 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h +10 -0
@@ -39,6 +39,7 @@#define CHELSIO_T4 0x4#define CHELSIO_T5 0x5#define CHELSIO_T6 0x6 +#define CHELSIO_T7 0x7/* We code the Chelsio T4 Family "Chip Code" as a tuple: *
@@ -67,6 +68,11 @@ enum chip_type {T6_A0 =CHELSIO_CHIP_CODE (CHELSIO_T6 ,0 ),T6_FIRST_REV =T6_A0 ,T6_LAST_REV =T6_A0 , + +T7_A0 =CHELSIO_CHIP_CODE (CHELSIO_T7 ,0 ), +T7_B0 =CHELSIO_CHIP_CODE (CHELSIO_T7 ,1 ), +T7_FIRST_REV =T7_A0 , + T7_LAST_REV = T7_B0, };static inline int is_t4 (enum chip_type chip)
@@ -84,4 +90,8 @@ static inline int is_t6(enum chip_type chip) return (CHELSIO_CHIP_VERSION(chip) == CHELSIO_T6); } +static inline int is_t7 (enum chip_type chip) +{ +return (CHELSIO_CHIP_VERSION (chip) ==CHELSIO_T7 ); +}#endif /* __T4_CHIP_TYPE_H__ */
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +99 -10
155 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +21 -0
@@ -220,6 +220,27 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGINCH_PCI_ID_TABLE_FENTRY (0x608a ),/* Custom T62100-CR */ CH_PCI_ID_TABLE_FENTRY (0x608b ),/* Custom T6225-CR */ CH_PCI_ID_TABLE_FENTRY (0x6092 ),/* Custom T62100-CR-LOM */ + +/* T7 adapter */ +CH_PCI_ID_TABLE_FENTRY (0x7000 ),/* T7-DBG */ +CH_PCI_ID_TABLE_FENTRY (0x7001 ),/* T7250 */ +CH_PCI_ID_TABLE_FENTRY (0x7002 ),/* S7250 */ +CH_PCI_ID_TABLE_FENTRY (0x7003 ),/* T7450 */ +CH_PCI_ID_TABLE_FENTRY (0x7004 ),/* S7450 */ +CH_PCI_ID_TABLE_FENTRY (0x7005 ),/* T72200 */ +CH_PCI_ID_TABLE_FENTRY (0x7006 ),/* S72200 */ +CH_PCI_ID_TABLE_FENTRY (0x7007 ),/* T72200-FH */ +CH_PCI_ID_TABLE_FENTRY (0x7008 ),/* T71400 */ +CH_PCI_ID_TABLE_FENTRY (0x7009 ),/* S7210-BT */ +CH_PCI_ID_TABLE_FENTRY (0x700a ),/* T7450-RC */ +CH_PCI_ID_TABLE_FENTRY (0x700b ),/* T72200-RC */ +CH_PCI_ID_TABLE_FENTRY (0x700c ),/* T72200-FH-RC */ +CH_PCI_ID_TABLE_FENTRY (0x700d ),/* S72200-OCP3 */ +CH_PCI_ID_TABLE_FENTRY (0x700e ),/* S7450-OCP3 */ +CH_PCI_ID_TABLE_FENTRY (0x700f ),/* S7410-BT-OCP3 */ +CH_PCI_ID_TABLE_FENTRY (0x7010 ),/* S7210-BT-A */ +CH_PCI_ID_TABLE_FENTRY (0x7011 ),/* T7_MAYRA_7 */ +CH_PCI_ID_TABLE_FENTRY (0x7012 ),/* T7-iNIC */ CH_PCI_DEVICE_ID_TABLE_DEFINE_END ;#endif /* __T4_PCI_ID_TBL_H__ */
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +6160 -1124
2,792 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h +16 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/chelsio/cxgb4/t4_values.h +11 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +75 -8
83 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h +9 -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.39.1
Part of the diff is not shown here. View the raw message.
Potnuri Bharat Teja
maintainerPATCH v4 2/12 cxgb4: rework the interrupt handling framework
In reply to Potnuri Bharat TejaThe slow interrupt path used a per module handler that walked a table of (mask, message) pairs with t4_handle_intr_status() and printed a message for every bit it found set. Each module handler open coded the read, report and clear sequence, and there was no way to express that a cause bit should be handled by inspecting a sub-register, or that a bit is only fatal when it is also enabled.
Replace it with a data driven framework:
struct intr_info describes one cause register: its name, the cause and enable register offsets, the mask of fatal bits, a table of struct intr_details for decoding individual bits, and an optional table of struct intr_action entries naming a function to call for a given cause bit.
t4_handle_intr() implements the common read, report, dispatch and clear sequence once, so a module handler reduces to describing its registers and any nested cause registers it owns.
The module interrupt handlers now return bool rather than void so a fatal condition propagates back to t4_slow_intr_handler() instead of being signalled out of band, and t4_slow_intr_handler() takes a verbose flag controlling whether individual cause bits are decoded and logged.
This changes the interrupt path for all supported adapters. No functional change is intended for T4, T5 or T6 beyond the wording of the messages emitted.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 2 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/sge.c | 4 +- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 4435 ++++++++++++++--- 4 files changed, 3790 insertions(+), 653 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +1 -1
@@ -1788,7 +1788,7 @@ struct fw_filter_wr;void t4_intr_enable (struct adapter *adapter);void t4_intr_disable (struct adapter *adapter); -int t4_slow_intr_handler (struct adapter *adapter); +int t4_slow_intr_handler (struct adapter *adap,bool verbose);int t4_wait_dev_ready (void __iomem *regs);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -1
@@ -682,7 +682,7 @@ static irqreturn_t t4_nondata_intr(int irq, void *cookie)t4_write_reg (adap,MYPF_REG (PL_PF_INT_CAUSE_A ), v); }if (adap->flags &CXGB4_MASTER_PF ) -t4_slow_intr_handler (adap); +t4_slow_intr_handler (adap, true);return IRQ_HANDLED ; }
drivers/net/ethernet/chelsio/cxgb4/sge.c +2 -2
@@ -4193,7 +4193,7 @@ static irqreturn_t t4_intr_msi(int irq, void *cookie)struct adapter *adap = cookie;if (adap->flags &CXGB4_MASTER_PF ) -t4_slow_intr_handler (adap); +t4_slow_intr_handler (adap, true);process_intrq (adap);return IRQ_HANDLED ; }
@@ -4208,7 +4208,7 @@ static irqreturn_t t4_intr_intx(int irq, void *cookie)struct adapter *adap = cookie;t4_write_reg (adap,MYPF_REG (PCIE_PF_CLI_A ),0 ); -if (((adap->flags &CXGB4_MASTER_PF ) &&t4_slow_intr_handler (adap)) | +if (((adap->flags &CXGB4_MASTER_PF ) &&t4_slow_intr_handler (adap, true)) |process_intrq (adap))return IRQ_HANDLED ;return IRQ_NONE ;/* probably shared interrupt */
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +3786 -649
2,968 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.39.1
Part of the diff is not shown here. View the raw message.
Potnuri Bharat Teja
maintainerPATCH v4 3/12 cxgb4: add T7 hardware management support
In reply to Potnuri Bharat TejaExtend the cxgb4 hardware management layer to support T7 adapters.
Add T7 handling to hardware resource and topology discovery. The TP load balancer mode and the firmware supplied TP channel map are read into adapter_params, and t4_get_mps_bg_map() and t4_get_tp_ch_map() account for the T7 channel layout. The load balancer mode distributes the four TP channels across the active ports as four ports of one channel, two ports of two channels, or one port of four channels.
t4_get_chip_type() moves from cxgb4_main.c into t4_hw.c so that chip identification lives with the rest of the hardware layer, and learns the T7 chip version.
Add T7 flash support. The flash layout is described by a table indexed by flash location rather than by fixed FLASH_*_START_SEC and FLASH_*_NSECS constants, with t4_flash_location_start_sec(), t4_flash_location_nsecs(), t4_flash_location_start() and t4_flash_location_size() returning the bounds of a region. t4_flash_cfg_addr() now returns int so that it can report a region that does not exist on the running adapter. t4_get_flash_params() learns the flash parts used on T7 and a four byte address serial flash interface, which is required for parts larger than 16MB.
Add the T7 register ranges to t4_get_regs(), the T7 PCIE memory window registers, and T7 support to the CIM ingress and egress queue, CIM LA, SGE context, MPS trace filter, PM statistics, scheduler and I2C accessors.
T7 implements multiple uP cores. The number of enabled cores is read during device log initialisation and the per core device log parameters are kept in an array, so that the device log and the CIM queue accessors can address a specific core.
--- .../net/ethernet/chelsio/cxgb4/cudbg_lib.c | 4 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 89 +- .../ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 2 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 17 - drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2200 ++++++++++++++--- drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 139 +- 6 files changed, 2022 insertions(+), 429 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +2 -2
@@ -198,7 +198,7 @@ u32 cudbg_get_entity_length(struct adapter *adap, u32 entity) }break ;case CUDBG_DEV_LOG : - len = adap->params.devlog.size; + len = adap->params.devlogs.size;break ;case CUDBG_CIM_LA :if (is_t6 (adap->params.chip)) {
@@ -847,7 +847,7 @@ int cudbg_collect_fw_devlog(struct cudbg_init *pdbg_init,return rc; } - dparams = &padap->params.devlog; + dparams = &padap->params.devlogs; rc =cudbg_get_buff (pdbg_init, dbg_buff, dparams->size, &temp_buff);if (rc)return rc;
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +77 -12
267 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +1 -1
@@ -1081,7 +1081,7 @@ static const struct seq_operations devlog_seq_ops = {static int devlog_open (struct inode *inode,struct file *file) {struct adapter *adap = inode->i_private; -struct devlog_params *dparams = &adap->params.devlog; +struct devlog_params *dparams = &adap->params.devlogs;struct devlog_info *dinfo;unsigned int index;u32 fseqno;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +0 -17
@@ -6199,23 +6199,6 @@ static void free_some_resources(struct adapter *adapter) NETIF_F_GRO | NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)#define SEGMENT_SIZE 128 -static int t4_get_chip_type (struct adapter *adap,int ver) -{ -u32 pl_rev =REV_G (t4_read_reg (adap,PL_REV_A )); - -switch (ver) { -case CHELSIO_T4 : -return CHELSIO_CHIP_CODE (CHELSIO_T4 , pl_rev); -case CHELSIO_T5 : -return CHELSIO_CHIP_CODE (CHELSIO_T5 , pl_rev); -case CHELSIO_T6 : -return CHELSIO_CHIP_CODE (CHELSIO_T6 , pl_rev); -default : -break ; - } -return -EINVAL ; -} -#ifdef CONFIG_PCI_IOV static void cxgb4_mgmt_setup (struct net_device *dev) {
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1849 -351
2,686 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +93 -46
139 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.39.1
Part of the diff is not shown here. View the raw message.
Potnuri Bharat Teja
maintainerPATCH v4 4/12 cxgb4: move PCI device management into cxgb4_pci.c and rework driver helpers
In reply to Potnuri Bharat Tejacxgb4_main.c has accumulated all of the PCI bus glue - the device ID table, probe, remove, shutdown and the EEH error handlers - alongside the actual network driver. Split the bus-facing half out into a new cxgb4_pci.c so that adding a new chip generation does not require touching PCI enumeration code, and so that the probe path can be read as a sequence of named steps rather than one 400 line function.
init_one() becomes cxgb4_pci_init_one() (bus side) plus cxgb4_adap_probe() (driver side); remove_one() and shutdown_one() are split the same way. Resource acquisition, chip identification, memory window setup and the firmware handshake move into cxgb4_pci_resource_init(), cxgb4_pci_chip_init(), cxgb4_pci_setup_memwin{,_rdma}() and cxgb4_pci_fw_init(). The EEH handlers are renamed cxgb4_pci_eeh_* and exported so the pci_error_handlers table can live next to the pci_driver.
Because the pci_driver structure is no longer in cxgb4_main.c, the two places that identified a cxgb4 netdevice by comparing its parent device driver now compare netdev_ops against cxgb4_netdev_ops instead.
Several helpers are reworked while the code is being moved:
- cxgb4_work_queue()/cxgb4_work_cancel() and cxgb4_workqueues_{create,destroy}() replace the open coded workqueue calls.
- cxgb4_pci_msi{x,}_enabled() replace direct tests of CXGB4_USING_MSI/CXGB4_USING_MSIX, and enable_msix() now records which interrupt mode was actually selected.
- cxgb4_port_chan_to_netdev() looks a netdevice up by channel and returns NULL if none matches, so the DCB firmware event paths no longer index chan_map[] blindly.
- The HMA page size calculation picks the largest power of two page size the scatterlist actually provides instead of assuming a fixed page order.
- SGE doorbell addresses are computed once at probe and used via writel() rather than recomputed per doorbell ring.
Fixed while moving the code:
- CXGB4_DEV_ENABLED is now set in cxgb4_pci_resource_init() immediately after pci_enable_device() and cleared where the VF management PF disables the device again. Previously the flag was set late in probe, so an early probe failure left the device enabled.
- enable_msix() leaked the msix_entry array on its success path.
- free_some_resources() passed adapter->pf to t4_fw_bye() where the mailbox number is wanted.
- cxgb_udp_tunnel_set_port() now unwinds the MAC filters it allocated if a later port fails, and only programs the MPS register once every filter is in place.
No functional change is intended for T4/T5/T6 beyond the fixes listed above.
--- drivers/net/ethernet/chelsio/cxgb4/Makefile | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 18 + .../net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 19 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 647 ++++++++---------- .../net/ethernet/chelsio/cxgb4/cxgb4_pci.c | 332 +++++++++ .../net/ethernet/chelsio/cxgb4/cxgb4_pci.h | 23 + drivers/net/ethernet/chelsio/cxgb4/sge.c | 96 +-- 7 files changed, 715 insertions(+), 422 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_pci.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_pci.h
drivers/net/ethernet/chelsio/cxgb4/Makefile +1 -1
@@ -9,7 +9,7 @@ cxgb4-objs := cxgb4_main.o l2t.o smt.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o cxgb4_uld.o srq.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \ cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.o cxgb4_mps.o \ cudbg_common.o cudbg_lib.o cudbg_zlib.o cxgb4_tc_mqprio.o \ - cxgb4_tc_matchall.o + cxgb4_tc_matchall.o cxgb4_pci.o cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o cxgb4-$(CONFIG_CHELSIO_T4_FCOE) += cxgb4_fcoe.o cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +18 -0
@@ -70,6 +70,8 @@ enum dev_state {#include "cxgb4_uld.h" #include "t4fw_api.h" +#include "t4_values.h" +#include "cxgb4_pci.h" #define CH_WARN (adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)extern struct list_head adapter_list;
@@ -1636,6 +1638,9 @@ extern char cxgb4_driver_name[];void t4_os_portmod_changed (struct adapter *adap,int port_id);void t4_os_link_changed (struct adapter *adap,int port_id,int link_stat); +void cxgb4_work_queue (struct workqueue_struct *workq,struct work_struct *work); +void cxgb4_work_cancel (struct workqueue_struct *workq,struct work_struct *work); +struct net_device *cxgb4_port_chan_to_netdev (struct adapter *adap,u8 chan);void t4_free_sge_resources (struct adapter *adap);irq_handler_t t4_intr_handler (struct adapter *adap);netdev_tx_t t4_start_xmit (struct sk_buff *skb,struct net_device *dev);
@@ -2067,6 +2072,19 @@ int t4_free_mac_filt(struct adapter *adap, unsigned int mbox, const u8 **addr, bool sleep_ok);int t4_change_mac (struct adapter *adap,unsigned int mbox,unsigned int viid,int idx,const u8 *addr,bool persist,u8 *smt_idx); +int cxgb4_is_primary_pf (struct adapter *adapter); +int cxgb4_mbox_log_init (struct adapter *adap); + +pci_ers_result_t cxgb4_pci_eeh_err_detected (struct pci_dev *pdev, +pci_channel_state_t state); +pci_ers_result_t cxgb4_pci_eeh_slot_reset (struct pci_dev *pdev); +void cxgb4_pci_eeh_resume (struct pci_dev *pdev); +void cxgb4_pci_eeh_reset_prepare (struct pci_dev *pdev); +void cxgb4_pci_eeh_reset_done (struct pci_dev *pdev); +int cxgb4_iov_configure (struct pci_dev *pdev,int num_vfs); +int cxgb4_adap_probe (struct adapter *adapter); +void cxgb4_adap_remove (struct adapter *adapter); +void cxgb4_adap_shutdown (struct adapter *adapter);int t4_set_addr_hash (struct adapter *adap,unsigned int mbox,unsigned int viid,bool ucast,u64 vec,bool sleep_ok); int t4_enable_vi_params(struct adapter *adap, unsigned int mbox,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +15 -4
@@ -273,13 +273,24 @@ void cxgb4_dcb_state_fsm(struct net_device *dev,void cxgb4_dcb_handle_fw_update (struct adapter *adap,const struct fw_port_cmd *pcmd) { -const union fw_port_dcb *fwdcb = &pcmd->u.dcb;int port =FW_PORT_CMD_PORTID_G (be32_to_cpu (pcmd->op_to_portid)); -struct net_device *dev = adap->port[adap->chan_map[port]]; -struct port_info *pi =netdev_priv (dev); -struct port_dcb_info *dcb = &pi->dcb; +const union fw_port_dcb *fwdcb = &pcmd->u.dcb;int dcb_type = pcmd->u.dcb.pgid.type; +struct port_dcb_info *dcb;int dcb_running_version; +struct net_device *dev; +struct port_info *pi; + + dev =cxgb4_port_chan_to_netdev (adap, port); +if (!dev) { +dev_warn (adap->pdev_dev, +"Could not get netdevice for handling DCB FW update for port: %d\n" , + port); +return ; + } + + pi =netdev_priv (dev); + dcb = &pi->dcb;/* Handle Firmware DCB Control messages separately since they drive * our state machine.
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +271 -376
1,206 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_pci.c new file +332 -0
332 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_pci.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2026 Chelsio Communications. All rights reserved. +*/ + +#ifndef __CXGB4_PCI_H__ +#define __CXGB4_PCI_H__ + +#define CXGB4_UNIFIED_PF 0x4 + +int cxgb4_pci_resource_init (struct adapter *adap); +void cxgb4_pci_resource_free (struct adapter *adap); +int cxgb4_pci_chip_init (struct adapter *adap); +void cxgb4_pci_chip_free (struct adapter *adap); +void cxgb4_pci_setup_memwin (struct adapter *adap); +void cxgb4_pci_setup_memwin_rdma (struct adapter *adap); +int cxgb4_pci_fw_init (struct adapter *adap,enum dev_state *state); +bool cxgb4_pci_msix_enabled (struct adapter *adap); +bool cxgb4_pci_msi_enabled (struct adapter *adap); + +int cxgb4_pci_driver_register (void ); +void cxgb4_pci_driver_unregister (void ); +#endif /* __CXGB4_PCI_H__ */
drivers/net/ethernet/chelsio/cxgb4/sge.c +55 -41
241 lines not on this page · raw message
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 5/12 cxgb4: add T7 support to the main driver
In reply to Potnuri Bharat TejaEnable the T7 generation in the NIC driver proper, on top of the PCI and helper rework done in the previous patch.
Firmware and configuration:
- Add FW7_FNAME/FW7_CFNAME, the T7 entry in fw_info_array[] and the matching case in adap_init0_config().
- Bound the configuration file against the size reported by t4_flash_location_size(FLASH_LOC_CFG) rather than the fixed FLASH_CFG_MAX_SIZE, which no longer describes every generation.
- The high priority filter and PPOD EDRAM setup is enabled for T6 and later rather than T6 only.
Reporting:
- link_report() learns 200G and 400G.
- t4_os_portmod_changed() learns the LR_SIMPLEX and DR module types.
Channel programming:
- Port related firmware commands and register accesses now use the logical port number (pi->lport) rather than pi->tx_chan. These are identical on T4/T5/T6; on T7 the TP channel for a port is supplied by firmware via FW_PARAMS_PARAM_DEV_TPCHMAP and is read through cxgb4_port_chan(), which the SGE queue allocation paths now use.
- t4_set_trace_rss_control() replaces the open coded, chip conditional MPS trace RSS control register write.
UDP tunnels:
- VXLAN and GENEVE RX type registers moved on T7; select between the legacy and T7 register offsets.
Multiple uP cores:
- t4_sge_alloc_eth_txq() and t4_sge_alloc_ctrl_txq() take a queue index and program FW_EQ_{ETH,CTRL}_CMD_COREGROUP so that queues are distributed across the available cores.
- setup_sge_queues() allocates num_up_cores control queues per port, and cfg_queues()/enable_msix() size the offload queue sets and vector requirements accordingly.
SGE:
- On T7 and later the firmware derives the congestion channel map from the configured load balancer mode, so the driver passes the channel vector directly instead of building the map itself.
- t4_sge_init() handles the T7 chip version.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 4 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 248 +++++++++--------- drivers/net/ethernet/chelsio/cxgb4/sge.c | 55 ++-- 3 files changed, 168 insertions(+), 139 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +2 -2
@@ -1655,10 +1655,10 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, rspq_flush_handler_t flush_handler, int cong);int t4_sge_alloc_eth_txq (struct adapter *adap,struct sge_eth_txq *txq,struct net_device *dev,struct netdev_queue *netdevq, -unsigned int iqid,u8 dbqt); +unsigned int iqid,u8 dbqt,int index);int t4_sge_alloc_ctrl_txq (struct adapter *adap,struct sge_ctrl_txq *txq,struct net_device *dev,unsigned int iqid, -unsigned int cmplqid); +unsigned int cmplqid,int index);int t4_sge_mod_ctrl_txq (struct adapter *adap,unsigned int eqid,unsigned int cmplqid); int t4_sge_alloc_uld_txq(struct adapter *adap, struct sge_uld_txq *txq,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +128 -120
488 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/sge.c +38 -17
133 lines not on this page · raw message
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 6/12 cxgb4: update PTP register access for T7
In reply to Potnuri Bharat TejaThe MAC_PORT_TX_TS_VAL_LO/HI registers moved within the port register block on T7, and the PTP clock sum is now read from the chip global MAC_PTP_SUM_LO/HI instead of a per port register. Select the right registers by chip version and read both values with t4_read_reg64(). PTP port accesses now use the logical port number (pi->lport).
On T7 a transmitted PTP event packet is looped back with equal source and destination MAC addresses rather than an MPS timestamp header. Detect that and hand the packet to the transmit timestamp path. The loopback packet is not necessarily UDP, so the RXF_UDP_F test is dropped and cxgb4_ptp_is_ptp_rx() parses the frame itself, handling VLAN tagged and IEEE 802.3 encapsulated PTP. On transmit, ptp_classify_raw() replaces the open coded IPv4/UDP test.
--- .../net/ethernet/chelsio/cxgb4/cxgb4_ptp.c | 82 ++++++++++++++----- drivers/net/ethernet/chelsio/cxgb4/sge.c | 13 ++- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 1 + 3 files changed, 71 insertions(+), 25 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c +60 -22
@@ -57,14 +57,13 @@*/ bool cxgb4_ptp_is_ptp_tx (struct sk_buff *skb) { -struct udphdr *uh; - - uh =udp_hdr (skb); -return skb->len >=PTP_MIN_LENGTH && - skb->len <=PTP_IN_TRANSMIT_PACKET_MAXNUM && -likely (skb->protocol ==htons (ETH_P_IP )) && -ip_hdr (skb)->protocol ==IPPROTO_UDP && - uh->dest ==htons (PTP_EVENT_PORT ); +unsigned int ptp_class; + + ptp_class =ptp_classify_raw (skb); +if (ptp_class ==PTP_CLASS_NONE ) +return false; + +return true; }bool is_ptp_enabled (struct sk_buff *skb,struct net_device *dev)
@@ -83,11 +82,50 @@ bool is_ptp_enabled(struct sk_buff *skb, struct net_device *dev)*/ bool cxgb4_ptp_is_ptp_rx (struct sk_buff *skb) { -struct udphdr *uh = (struct udphdr *)(skb->data +ETH_HLEN + -IPV4_HLEN (skb->data)); +int offset =ETH_HLEN ; +struct ethhdr *eth; +__be16 proto; + +if (skb->len <ETH_HLEN ) +return false; + + eth = (struct ethhdr *)skb->data; + proto = eth->h_proto; + +if (proto ==htons (ETH_P_8021Q )) { +struct vlan_hdr *vhdr; + +if (skb->len < offset +VLAN_HLEN ) +return false; + + vhdr = (struct vlan_hdr *)(skb->data + offset); + proto = vhdr->h_vlan_encapsulated_proto; + offset +=VLAN_HLEN ; + } + +if (proto ==htons (ETH_P_1588 )) +return true; + +if (proto ==htons (ETH_P_IP )) { +struct iphdr *iph; +struct udphdr *uh; + +if (skb->len < offset +sizeof (*iph)) +return false; + iph = (struct iphdr *)(skb->data + offset); + +if (iph->protocol !=IPPROTO_UDP ) +return false; + offset += (iph->ihl *4 ); + +if (skb->len < offset +sizeof (*uh)) +return false; + uh = (struct udphdr *)(skb->data + offset); + +return uh->dest ==htons (PTP_EVENT_PORT ); + } -return uh->dest ==htons (PTP_EVENT_PORT ) && - uh->source ==htons (PTP_EVENT_PORT ); +return false; }/**
@@ -103,12 +141,11 @@ void cxgb4_ptp_read_hwstamp(struct adapter *adapter, struct port_info *pi) skb_ts =skb_hwtstamps (adapter->ptp_tx_skb); - tx_ts =t4_read_reg (adapter, -T5_PORT_REG (pi->port_id,MAC_PORT_TX_TS_VAL_LO )); +if (CHELSIO_CHIP_VERSION (adapter->params.chip) >=CHELSIO_T7 ) + tx_ts =t4_read_reg64 (adapter,T7_PORT_REG (pi->lport,T7_MAC_PORT_TX_TS_VAL_LO )); +else + tx_ts =t4_read_reg64 (adapter,T5_PORT_REG (pi->lport,MAC_PORT_TX_TS_VAL_LO )); - tx_ts |= (u64 )t4_read_reg (adapter, -T5_PORT_REG (pi->port_id, -MAC_PORT_TX_TS_VAL_HI )) <<32 ; skb_ts->hwtstamp =ns_to_ktime (tx_ts);skb_tstamp_tx (adapter->ptp_tx_skb, skb_ts);dev_kfree_skb_any (adapter->ptp_tx_skb);
@@ -183,7 +220,7 @@ int cxgb4_ptp_redirect_rx_packet(struct adapter *adapter, struct port_info *pi) c.retval_len16 =cpu_to_be32 (FW_CMD_LEN16_V (sizeof (c) /16 )); c.u.init.sc =FW_PTP_SC_RDRX_TYPE ; - c.u.init.txchan = pi->tx_chan; + c.u.init.txchan = pi->lport; c.u.init.absid =cpu_to_be16 (receive_q->rspq.abs_id); err =t4_wr_mbox (adapter, adapter->mbox, &c,sizeof (c),NULL );
@@ -319,9 +356,10 @@ static int cxgb4_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) ptp_clock_info);u64 ns; - ns =t4_read_reg (adapter,T5_PORT_REG (0 ,MAC_PORT_PTP_SUM_LO_A )); - ns |= (u64 )t4_read_reg (adapter, -T5_PORT_REG (0 ,MAC_PORT_PTP_SUM_HI_A )) <<32 ; +if (CHELSIO_CHIP_VERSION (adapter->params.chip) >=CHELSIO_T7 ) + ns =t4_read_reg64 (adapter,MAC_PTP_SUM_LO_A ); +else + ns =t4_read_reg64 (adapter,T5_PORT_REG (0 ,MAC_PORT_PTP_SUM_LO_A ));/* convert to timespec*/ *ts =ns_to_timespec64 (ns);
@@ -432,7 +470,7 @@ void cxgb4_ptp_init(struct adapter *adapter)spin_lock_init (&adapter->ptp_lock); adapter->ptp_clock =ptp_clock_register (&adapter->ptp_clock_info, - &adapter->pdev->dev); + adapter->pdev_dev);if (IS_ERR_OR_NULL (adapter->ptp_clock)) { adapter->ptp_clock =NULL ; dev_err(adapter->pdev_dev,
drivers/net/ethernet/chelsio/cxgb4/sge.c +10 -3
@@ -3483,7 +3483,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,enum {RX_NON_PTP_PKT =0 ,RX_PTP_PKT_SUC =1 , -RX_PTP_PKT_ERR =2 +RX_PTP_PKT_ERR =2 , +RX_PTP_PKT_T7 =3 };/**
@@ -3509,6 +3510,13 @@ static noinline int t4_systim_to_hwstamp(struct adapter *adapter, data = skb->data +sizeof (*cpl);skb_pull (skb,2 *sizeof (u64) +sizeof (struct cpl_rx_mps_pkt )); + +if (CHELSIO_CHIP_VERSION (adapter->params.chip) ==CHELSIO_T7 ) { +struct ethhdr *eth = (struct ethhdr *)skb->data; + +if (ether_addr_equal (eth->h_source, eth->h_dest)) +return RX_PTP_PKT_T7 ; + } offset =ETH_HLEN +IPV4_HLEN (skb->data) +UDP_HLEN ;if (skb->len < offset +OFF_PTP_SEQUENCE_ID +sizeof (short ))return RX_PTP_PKT_ERR ;
@@ -3740,8 +3748,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,__skb_pull (skb, s->pktshift);/* remove ethernet header pad */ /* Handle the PTP Event Tx Loopback packet */ -if (unlikely (pi->ptp_enable && !ret && - (pkt->l2info &htonl (RXF_UDP_F )) && +if (unlikely (pi->ptp_enable && (ret ==RX_PTP_PKT_T7 || !ret) &&cxgb4_ptp_is_ptp_rx (skb))) {if (!t4_tx_hststamp (adapter, skb, q->netdev))return 0 ;
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +1 -0
@@ -4533,6 +4533,7 @@#define MAC_PORT_EPIO_OP_A 0x8d0#define MAC_PORT_CFG2_A 0x818 +#define MAC_PTP_SUM_LO_A 0x38108#define MAC_PORT_PTP_SUM_LO_A 0x990#define MAC_PORT_PTP_SUM_HI_A 0x994
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 7/12 cxgb4: extend ethtool support for T7 adapters
In reply to Potnuri Bharat TejaUpdate the ethtool implementation to support T7-specific port types, link modes, and adapter capabilities.
Add support for new T7 port configurations including SFP56, QSFP56, 50G/100G/200G/400G backplane modes, and the associated ethtool link mode mappings. Update port statistics handling and module type reporting to account for the new hardware capabilities.
Extend RSS configuration support by implementing RSS hash key retrieval and programming through ethtool. Also update module EEPROM handling for new optical module types and CMIS-based devices.
--- .../ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 381 +++++++++++++----- 1 file changed, 278 insertions(+), 103 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +278 -103
@@ -14,6 +14,8 @@#include "cxgb4_tc_flower.h" #define EEPROM_MAGIC 0x38E2F10C +#define RSS_HASH_KEY_SIZE 40 +#define CMIS_PAGE_SELECT_REG 127static u32 get_msglevel (struct net_device *dev) {
@@ -358,7 +360,7 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,int i;u64 *p0; -t4_get_port_stats_offset (adapter, pi->tx_chan, +t4_get_port_stats_offset (adapter, pi->lport, (struct port_stats *)data, &pi->stats_base);
@@ -440,10 +442,13 @@ static int from_fw_port_mod_type(enum fw_port_type port_type, port_type ==FW_PORT_TYPE_CR4_QSFP || port_type ==FW_PORT_TYPE_CR_QSFP || port_type ==FW_PORT_TYPE_CR2_QSFP || - port_type == FW_PORT_TYPE_SFP28) { + port_type ==FW_PORT_TYPE_SFP28 || + port_type ==FW_PORT_TYPE_SFP56 || + port_type == FW_PORT_TYPE_QSFP56) { if (mod_type == FW_PORT_MOD_TYPE_LR || mod_type ==FW_PORT_MOD_TYPE_SR || mod_type ==FW_PORT_MOD_TYPE_ER || + mod_type ==FW_PORT_MOD_TYPE_DR || mod_type == FW_PORT_MOD_TYPE_LRM)return PORT_FIBRE ; else if (mod_type == FW_PORT_MOD_TYPE_TWINAX_PASSIVE ||
@@ -453,7 +458,11 @@ static int from_fw_port_mod_type(enum fw_port_type port_type,return PORT_OTHER ; }else if (port_type ==FW_PORT_TYPE_KR4_100G || port_type ==FW_PORT_TYPE_KR_SFP28 || - port_type ==FW_PORT_TYPE_KR_XLAUI ) { + port_type ==FW_PORT_TYPE_KR_XLAUI || + port_type ==FW_PORT_TYPE_KR_50G || + port_type ==FW_PORT_TYPE_KR2_100G || + port_type ==FW_PORT_TYPE_KR4_200G || + port_type ==FW_PORT_TYPE_KR8_400G ) {return PORT_NONE ; }
@@ -490,8 +499,100 @@ static unsigned int speed_to_fw_caps(int speed)return 0 ; } +enum link_medium { +LINK_MEDIUM_NONE , +LINK_MEDIUM_TP ,/* plain copper baseT */ +LINK_MEDIUM_KR ,/* electrical backplane */ +LINK_MEDIUM_CR ,/* copper direct-attach (TwinAx) */ +LINK_MEDIUM_SR , +LINK_MEDIUM_LR ,/* also covers ER FR */ +LINK_MEDIUM_DR , +LINK_MEDIUM_LRM , +}; + +static bool fw_port_is_backplane (enum fw_port_type port_type) +{ +switch (port_type) { +case FW_PORT_TYPE_KX : +case FW_PORT_TYPE_KX4 : +case FW_PORT_TYPE_BP_AP : +case FW_PORT_TYPE_BP4_AP : +case FW_PORT_TYPE_BP40_BA : +case FW_PORT_TYPE_KR : +case FW_PORT_TYPE_KR_50G : +case FW_PORT_TYPE_KR_SFP28 : +case FW_PORT_TYPE_KR_XLAUI : +case FW_PORT_TYPE_KR2_100G : +case FW_PORT_TYPE_KR4_100G : +case FW_PORT_TYPE_KR4_200G : +case FW_PORT_TYPE_KR8_400G : +return true; +default : +return false; + } +} + +static bool fw_port_is_electrical_tp (enum fw_port_type port_type) +{ +switch (port_type) { +case FW_PORT_TYPE_BT_SGMII : +case FW_PORT_TYPE_BT_XFI : +case FW_PORT_TYPE_BT_XAUI : +return true; +default : +return false; + } +} + +static bool fw_port_is_fixed_baset (enum fw_port_type port_type) +{ +switch (port_type) { +case FW_PORT_TYPE_FIBER_XFI : +case FW_PORT_TYPE_FIBER_XAUI : +return true; +default : +return fw_port_is_electrical_tp (port_type); + } +} + +static int fw_port_class_bit (enum fw_port_type port_type) +{ +if (fw_port_is_backplane (port_type)) +return ETHTOOL_LINK_MODE_Backplane_BIT; +if (fw_port_is_electrical_tp (port_type)) +return ETHTOOL_LINK_MODE_TP_BIT ; +return ETHTOOL_LINK_MODE_FIBRE_BIT ; +} + +static enum link_medium fw_port_medium (enum fw_port_type port_type, +enum fw_port_module_type mod_type) +{ +if (fw_port_is_backplane (port_type)) +return LINK_MEDIUM_KR ; +if (fw_port_is_fixed_baset (port_type)) +return LINK_MEDIUM_TP ; + +switch (mod_type) { +case FW_PORT_MOD_TYPE_TWINAX_PASSIVE : +case FW_PORT_MOD_TYPE_TWINAX_ACTIVE : +return LINK_MEDIUM_CR ; +case FW_PORT_MOD_TYPE_SR : +return LINK_MEDIUM_SR ; +case FW_PORT_MOD_TYPE_LR : +case FW_PORT_MOD_TYPE_ER : +return LINK_MEDIUM_LR ; +case FW_PORT_MOD_TYPE_DR : +return LINK_MEDIUM_DR ; +case FW_PORT_MOD_TYPE_LRM : +return LINK_MEDIUM_LRM ; +default : +return LINK_MEDIUM_NONE ;/* no module / unreadable */ + } +} +/** * fw_caps_to_lmm - translate Firmware to ethtool Link Mode Mask +* @mod_type: Firmware Module Type * @port_type: Firmware Port Type * @fw_caps: Firmware Port Capabilities * @link_mode_mask: ethtool Link Mode Mask
@@ -500,114 +601,93 @@ static unsigned int speed_to_fw_caps(int speed)* Link Mode Mask. */ static void fw_caps_to_lmm (enum fw_port_type port_type, +enum fw_port_module_type mod_type,fw_port_cap32_t fw_caps,unsigned long *link_mode_mask) { -#define SET_LMM (__lmm_name) \ - do { \ - __set_bit(ETHTOOL_LINK_MODE_ ## __lmm_name ## _BIT, \ - link_mode_mask); \ - } while (0) +enum link_medium medium =fw_port_medium (port_type, mod_type);#define FW_CAPS_TO_LMM (__fw_name, __lmm_name) \ do { \ if (fw_caps & FW_PORT_CAP32_ ## __fw_name) \ - SET_LMM(__lmm_name); \ + __set_bit(ETHTOOL_LINK_MODE_ ## __lmm_name ## _BIT, \ + link_mode_mask); \ } while (0) -switch (port_type) { -case FW_PORT_TYPE_BT_SGMII : -case FW_PORT_TYPE_BT_XFI : -case FW_PORT_TYPE_BT_XAUI : -SET_LMM (TP ); - FW_CAPS_TO_LMM(SPEED_100M, 100baseT_Full); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full); -break ; - -case FW_PORT_TYPE_KX4 : -case FW_PORT_TYPE_KX : -SET_LMM (Backplane); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKX4_Full); -break ; - -case FW_PORT_TYPE_KR : -SET_LMM (Backplane); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full); -break ; - -case FW_PORT_TYPE_BP_AP : -SET_LMM (Backplane); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseR_FEC); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full); -break ; +if (medium !=LINK_MEDIUM_NONE ) +__set_bit (fw_port_class_bit (port_type), link_mode_mask); -case FW_PORT_TYPE_BP4_AP : -SET_LMM (Backplane); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseR_FEC); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKX4_Full); +switch (medium) { +case LINK_MEDIUM_TP : + FW_CAPS_TO_LMM(SPEED_100M, 100baseT_Full); + FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full);break ; -case FW_PORT_TYPE_FIBER_XFI : -case FW_PORT_TYPE_FIBER_XAUI : -case FW_PORT_TYPE_SFP : -case FW_PORT_TYPE_QSFP_10G : -case FW_PORT_TYPE_QSA : -SET_LMM (FIBRE ); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full); +case LINK_MEDIUM_KR : + FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseKX4_Full); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseR_FEC); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full); + FW_CAPS_TO_LMM(SPEED_25G, 25000baseKR_Full); + FW_CAPS_TO_LMM(SPEED_40G, 40000baseKR4_Full); + FW_CAPS_TO_LMM(SPEED_50G, 50000baseKR_Full); + FW_CAPS_TO_LMM(SPEED_50G, 50000baseKR2_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseKR2_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseKR4_Full); + FW_CAPS_TO_LMM(SPEED_200G, 200000baseKR4_Full); + FW_CAPS_TO_LMM(SPEED_400G, 400000baseKR8_Full);break ; -case FW_PORT_TYPE_BP40_BA : -case FW_PORT_TYPE_QSFP : -SET_LMM (FIBRE ); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full); - FW_CAPS_TO_LMM(SPEED_40G, 40000baseSR4_Full); -break ; - -case FW_PORT_TYPE_CR_QSFP : -case FW_PORT_TYPE_SFP28 : -SET_LMM (FIBRE ); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full); - FW_CAPS_TO_LMM(SPEED_25G, 25000baseCR_Full); +case LINK_MEDIUM_CR : + FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseCR_Full); + FW_CAPS_TO_LMM(SPEED_25G, 25000baseCR_Full); + FW_CAPS_TO_LMM(SPEED_40G, 40000baseCR4_Full); + FW_CAPS_TO_LMM(SPEED_50G, 50000baseCR_Full); + FW_CAPS_TO_LMM(SPEED_50G, 50000baseCR2_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseCR2_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseCR4_Full); + FW_CAPS_TO_LMM(SPEED_200G, 200000baseCR4_Full); + FW_CAPS_TO_LMM(SPEED_400G, 400000baseCR8_Full);break ; -case FW_PORT_TYPE_KR_SFP28 : -SET_LMM (Backplane); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full); - FW_CAPS_TO_LMM(SPEED_25G, 25000baseKR_Full); +case LINK_MEDIUM_SR : + FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseSR_Full); + FW_CAPS_TO_LMM(SPEED_25G, 25000baseSR_Full); + FW_CAPS_TO_LMM(SPEED_40G, 40000baseSR4_Full); + FW_CAPS_TO_LMM(SPEED_50G, 50000baseSR_Full); + FW_CAPS_TO_LMM(SPEED_50G, 50000baseSR2_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseSR2_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseSR4_Full); + FW_CAPS_TO_LMM(SPEED_200G, 200000baseSR4_Full); + FW_CAPS_TO_LMM(SPEED_400G, 400000baseSR8_Full);break ; -case FW_PORT_TYPE_KR_XLAUI : -SET_LMM (Backplane); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full); - FW_CAPS_TO_LMM(SPEED_40G, 40000baseKR4_Full); +case LINK_MEDIUM_LR : + FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseLR_Full); + FW_CAPS_TO_LMM(SPEED_40G, 40000baseLR4_Full); + FW_CAPS_TO_LMM(SPEED_50G, 50000baseLR_ER_FR_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseLR2_ER2_FR2_Full); + FW_CAPS_TO_LMM(SPEED_100G, 100000baseLR4_ER4_Full); + FW_CAPS_TO_LMM(SPEED_200G, 200000baseLR4_ER4_FR4_Full); + FW_CAPS_TO_LMM(SPEED_400G, 400000baseLR8_ER8_FR8_Full);break ; -case FW_PORT_TYPE_CR2_QSFP : -SET_LMM (FIBRE ); - FW_CAPS_TO_LMM(SPEED_50G, 50000baseSR2_Full); +case LINK_MEDIUM_DR : + FW_CAPS_TO_LMM(SPEED_100G, 100000baseDR2_Full); + FW_CAPS_TO_LMM(SPEED_200G, 200000baseDR4_Full); + FW_CAPS_TO_LMM(SPEED_400G, 400000baseDR8_Full);break ; -case FW_PORT_TYPE_KR4_100G : -case FW_PORT_TYPE_CR4_QSFP : -SET_LMM (FIBRE ); - FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); - FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full); - FW_CAPS_TO_LMM(SPEED_40G, 40000baseSR4_Full); - FW_CAPS_TO_LMM(SPEED_25G, 25000baseCR_Full); - FW_CAPS_TO_LMM(SPEED_50G, 50000baseCR2_Full); - FW_CAPS_TO_LMM(SPEED_100G, 100000baseCR4_Full); +case LINK_MEDIUM_LRM : + FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full); + FW_CAPS_TO_LMM(SPEED_10G, 10000baseLRM_Full);break ; +case LINK_MEDIUM_NONE :default :break ; }
@@ -616,7 +696,7 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,FW_CAPS_TO_LMM (FEC_RS ,FEC_RS );FW_CAPS_TO_LMM (FEC_BASER_RS ,FEC_BASER ); }else { -SET_LMM (FEC_NONE ); +__set_bit (ETHTOOL_LINK_MODE_FEC_NONE_BIT , link_mode_mask); }FW_CAPS_TO_LMM (ANEG , Autoneg);
@@ -624,7 +704,6 @@ static void fw_caps_to_lmm(enum fw_port_type port_type, FW_CAPS_TO_LMM(802_3_ASM_DIR, Asym_Pause);#undef FW_CAPS_TO_LMM -#undef SET_LMM }/**
@@ -649,10 +728,46 @@ static unsigned int lmm_to_fw_caps(const unsigned long *link_mode_mask) LMM_TO_FW_CAPS(100baseT_Full, SPEED_100M); LMM_TO_FW_CAPS(1000baseT_Full, SPEED_1G); LMM_TO_FW_CAPS(10000baseT_Full, SPEED_10G); - LMM_TO_FW_CAPS(40000baseSR4_Full, SPEED_40G); + LMM_TO_FW_CAPS(10000baseKX4_Full, SPEED_10G); + LMM_TO_FW_CAPS(10000baseR_FEC, SPEED_10G); + LMM_TO_FW_CAPS(10000baseKR_Full, SPEED_10G); + LMM_TO_FW_CAPS(10000baseCR_Full, SPEED_10G); + LMM_TO_FW_CAPS(10000baseSR_Full, SPEED_10G); + LMM_TO_FW_CAPS(10000baseLR_Full, SPEED_10G); + LMM_TO_FW_CAPS(10000baseLRM_Full, SPEED_10G); + LMM_TO_FW_CAPS(25000baseKR_Full, SPEED_25G); LMM_TO_FW_CAPS(25000baseCR_Full, SPEED_25G); + LMM_TO_FW_CAPS(25000baseSR_Full, SPEED_25G); + LMM_TO_FW_CAPS(40000baseKR4_Full, SPEED_40G); + LMM_TO_FW_CAPS(40000baseCR4_Full, SPEED_40G); + LMM_TO_FW_CAPS(40000baseSR4_Full, SPEED_40G); + LMM_TO_FW_CAPS(40000baseLR4_Full, SPEED_40G); + LMM_TO_FW_CAPS(50000baseKR_Full, SPEED_50G); + LMM_TO_FW_CAPS(50000baseKR2_Full, SPEED_50G); + LMM_TO_FW_CAPS(50000baseCR_Full, SPEED_50G); LMM_TO_FW_CAPS(50000baseCR2_Full, SPEED_50G); + LMM_TO_FW_CAPS(50000baseSR_Full, SPEED_50G); + LMM_TO_FW_CAPS(50000baseSR2_Full, SPEED_50G); + LMM_TO_FW_CAPS(50000baseLR_ER_FR_Full, SPEED_50G); + LMM_TO_FW_CAPS(100000baseKR2_Full, SPEED_100G); + LMM_TO_FW_CAPS(100000baseKR4_Full, SPEED_100G); + LMM_TO_FW_CAPS(100000baseCR2_Full, SPEED_100G); LMM_TO_FW_CAPS(100000baseCR4_Full, SPEED_100G); + LMM_TO_FW_CAPS(100000baseSR2_Full, SPEED_100G); + LMM_TO_FW_CAPS(100000baseSR4_Full, SPEED_100G); + LMM_TO_FW_CAPS(100000baseLR2_ER2_FR2_Full, SPEED_100G); + LMM_TO_FW_CAPS(100000baseLR4_ER4_Full, SPEED_100G); + LMM_TO_FW_CAPS(100000baseDR2_Full, SPEED_100G); + LMM_TO_FW_CAPS(200000baseKR4_Full, SPEED_200G); + LMM_TO_FW_CAPS(200000baseCR4_Full, SPEED_200G); + LMM_TO_FW_CAPS(200000baseSR4_Full, SPEED_200G); + LMM_TO_FW_CAPS(200000baseLR4_ER4_FR4_Full, SPEED_200G); + LMM_TO_FW_CAPS(200000baseDR4_Full, SPEED_200G); + LMM_TO_FW_CAPS(400000baseKR8_Full, SPEED_400G); + LMM_TO_FW_CAPS(400000baseCR8_Full, SPEED_400G); + LMM_TO_FW_CAPS(400000baseSR8_Full, SPEED_400G); + LMM_TO_FW_CAPS(400000baseLR8_ER8_FR8_Full, SPEED_400G); + LMM_TO_FW_CAPS(400000baseDR8_Full, SPEED_400G);#undef LMM_TO_FW_CAPS
@@ -688,14 +803,14 @@ static int get_link_ksettings(struct net_device *dev, base->mdio_support =0 ; } -fw_caps_to_lmm (pi->port_type, pi->link_cfg.pcaps, +fw_caps_to_lmm (pi->port_type, pi->mod_type, pi->link_cfg.pcaps, link_ksettings->link_modes.supported); -fw_caps_to_lmm (pi->port_type, +fw_caps_to_lmm (pi->port_type, pi->mod_type,t4_link_acaps (pi->adapter, pi->lport, &pi->link_cfg), link_ksettings->link_modes.advertising); -fw_caps_to_lmm (pi->port_type, pi->link_cfg.lpacaps, +fw_caps_to_lmm (pi->port_type, pi->mod_type, pi->link_cfg.lpacaps, link_ksettings->link_modes.lp_advertising); base->speed = (netif_carrier_ok(dev)
@@ -800,7 +915,7 @@ static inline unsigned int eth_to_cc_fec(unsigned int eth_fec) {unsigned int cc_fec =0 ; -if (eth_fec ÐTOOL_FEC_OFF ) +if (eth_fec ==ETHTOOL_FEC_OFF )return cc_fec;if (eth_fec ÐTOOL_FEC_AUTO )
@@ -1576,6 +1691,11 @@ static int get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info *tsreturn 0 ; } +static u32 get_rss_key_size (struct net_device *dev) +{ +return RSS_HASH_KEY_SIZE ; +} +static u32 get_rss_table_size (struct net_device *dev) {const struct port_info *pi =netdev_priv (dev);
@@ -1590,8 +1710,19 @@ static int get_rss_table(struct net_device *dev,unsigned int n = pi->rss_size; rxfh->hfunc =ETH_RSS_HASH_TOP ; + +if (rxfh->key) { +__be32 key[10 ]; + +t4_read_rss_key (pi->adapter, (u32 *)key, true); +/* RSS hash keys are read in order TP_RSS_SECRET_KEY9..0 */ +for (int i =0 ; i <10 ; i++) + ((u32 *)rxfh->key)[i] =be32_to_cpu (key[9 - i]); + } +if (!rxfh->indir)return 0 ; +while (n--) rxfh->indir[n] = pi->rss[n];return 0 ;
@@ -1607,10 +1738,19 @@ static int set_rss_table(struct net_device *dev,/* We require at least one supported parameter to be changed and no * change in any of the unsupported parameters */ -if (rxfh->key || - (rxfh->hfunc !=ETH_RSS_HASH_NO_CHANGE && - rxfh->hfunc !=ETH_RSS_HASH_TOP )) +if (rxfh->hfunc !=ETH_RSS_HASH_NO_CHANGE && + rxfh->hfunc !=ETH_RSS_HASH_TOP )return -EOPNOTSUPP ; + +if (rxfh->key) { +__be32 key[10 ]; + +/* RSS hash keys are written in order TP_RSS_SECRET_KEY9..0 */ +for (int i =0 ; i <10 ; i++) + key[i] =cpu_to_be32 (((u32 *)rxfh->key)[9 - i]); +t4_write_rss_key (pi->adapter, (u32 *)key,-1 , true); + } +if (!rxfh->indir)return 0 ;
@@ -2022,12 +2162,13 @@ static int cxgb4_get_module_info(struct net_device *dev,case FW_PORT_TYPE_SFP :case FW_PORT_TYPE_QSA :case FW_PORT_TYPE_SFP28 : - ret =t4_i2c_rd (adapter, adapter->mbox, pi->tx_chan, +case FW_PORT_TYPE_SFP56 : + ret =t4_i2c_rd (adapter, adapter->mbox, pi->lport,I2C_DEV_ADDR_A0 ,SFF_8472_COMP_ADDR ,SFF_8472_COMP_LEN , &sff8472_comp);if (ret)return ret; - ret =t4_i2c_rd (adapter, adapter->mbox, pi->tx_chan, + ret =t4_i2c_rd (adapter, adapter->mbox, pi->lport,I2C_DEV_ADDR_A0 ,SFP_DIAG_TYPE_ADDR ,SFP_DIAG_TYPE_LEN , &sff_diag_type);if (ret)
@@ -2046,11 +2187,12 @@ static int cxgb4_get_module_info(struct net_device *dev,break ;case FW_PORT_TYPE_QSFP : +case FW_PORT_TYPE_QSFP56 :case FW_PORT_TYPE_QSFP_10G :case FW_PORT_TYPE_CR_QSFP :case FW_PORT_TYPE_CR2_QSFP :case FW_PORT_TYPE_CR4_QSFP : - ret =t4_i2c_rd (adapter, adapter->mbox, pi->tx_chan, + ret =t4_i2c_rd (adapter, adapter->mbox, pi->lport,I2C_DEV_ADDR_A0 ,SFF_REV_ADDR ,SFF_REV_LEN , &sff_rev);/* For QSFP type ports, revision value >= 3
@@ -2083,14 +2225,14 @@ static int cxgb4_get_module_eeprom(struct net_device *dev,memset (data,0 , eprom->len);if (offset + len <=I2C_PAGE_SIZE ) -return t4_i2c_rd (adapter, adapter->mbox, pi->tx_chan, +return t4_i2c_rd (adapter, adapter->mbox, pi->lport,I2C_DEV_ADDR_A0 , offset, len, data);/* offset + len spans 0xa0 and 0xa1 pages */ if (offset <=I2C_PAGE_SIZE ) {/* read 0xa0 page */ len =I2C_PAGE_SIZE - offset; - ret =t4_i2c_rd (adapter, adapter->mbox, pi->tx_chan, + ret =t4_i2c_rd (adapter, adapter->mbox, pi->lport,I2C_DEV_ADDR_A0 , offset, len, data);if (ret)return ret;
@@ -2101,10 +2243,41 @@ static int cxgb4_get_module_eeprom(struct net_device *dev, len = eprom->len - len; }/* Read additional optical diagnostics from page 0xa2 if supported */ -return t4_i2c_rd (adapter, adapter->mbox, pi->tx_chan,I2C_DEV_ADDR_A2 , +return t4_i2c_rd (adapter, adapter->mbox, pi->lport,I2C_DEV_ADDR_A2 , offset, len, &data[eprom->len - len]); } +static int +cxgb4_get_module_eeprom_by_page (struct net_device *dev, +const struct ethtool_module_eeprom *page_data, +struct netlink_ext_ack *extack) +{ +struct port_info *pi =netdev_priv (dev); +struct adapter *adapter = pi->adapter; +int ret; + +if (page_data->offset >=128 ) { +u8 page = page_data->page; +/* Before reading EEPROM data first select the page in PageSelect register */ + ret =t4_i2c_wr (adapter, adapter->mbox, pi->lport, + page_data->i2c_address <<1 , +CMIS_PAGE_SELECT_REG ,/* CMIS Page Select register */ +1 ,/* Page Select register length */ + &page); +if (ret) +return ret; + } + + ret =t4_i2c_rd (adapter, adapter->mbox, pi->lport, + page_data->i2c_address <<1 , page_data->offset, + page_data->length, page_data->data); + +if (ret) +return ret; + +return page_data->length; +} +static u32 cxgb4_get_priv_flags (struct net_device *netdev) {struct port_info *pi =netdev_priv (netdev);
@@ -2205,6 +2378,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = { .get_rxnfc = get_rxnfc, .set_rxnfc = set_rxnfc, .get_rx_ring_count = get_rx_ring_count, + .get_rxfh_key_size = get_rss_key_size, .get_rxfh_indir_size = get_rss_table_size, .get_rxfh = get_rss_table, .set_rxfh = set_rss_table,
@@ -2217,6 +2391,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = { .get_dump_data = get_dump_data, .get_module_info = cxgb4_get_module_info, .get_module_eeprom = cxgb4_get_module_eeprom, + .get_module_eeprom_by_page = cxgb4_get_module_eeprom_by_page, .get_priv_flags = cxgb4_get_priv_flags, .set_priv_flags = cxgb4_set_priv_flags, };
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 8/12 cxgb4: Add T7 support to the filter infrastructure.
In reply to Potnuri Bharat TejaT7 introduces a number of changes in filter-related register fields, firmware work request formats and CPL definitions. Update the filter code to use the appropriate T7-specific encodings while preserving existing behavior on earlier adapters.
The changes include:
- Use T7 reply channel and queue number encodings in filter-related CPL requests.
- Add T7-specific filter capability validation using the new TP filter field definitions.
- Enable validation and programming of the SYN-only filter field, which is supported on T7.
- Adjust FW_FILTER_WR construction to match T7 semantics where the RX channel is no longer programmed through the legacy field.
- Add support for T7 active-open filter requests using the T7 CPL layout and T7 filter tuple encoding.
- Update filter resource handling to work correctly across T6 and T7 devices.
--- .../net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 214 ++++++++++++------ 1 file changed, 141 insertions(+), 73 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +141 -73
@@ -66,9 +66,14 @@ static int set_tcb_field(struct adapter *adap, struct filter_entry *f, req = (struct cpl_set_tcb_field *)__skb_put_zero (skb,sizeof (*req));INIT_TP_WR_CPL (req,CPL_SET_TCB_FIELD , ftid); - req->reply_ctrl =htons (REPLY_CHAN_V (0 ) | -QUEUENO_V (adap->sge.fw_evtq.abs_id) | -NO_REPLY_V (no_reply)); +if (CHELSIO_CHIP_VERSION (adap->params.chip) >=CHELSIO_T7 ) + req->reply_ctrl =htons (T7_REPLY_CHAN_V (0 ) | +T7_QUEUENO_V (adap->sge.fw_evtq.abs_id) | +NO_REPLY_V (no_reply)); +else + req->reply_ctrl =htons (REPLY_CHAN_V (0 ) | +QUEUENO_V (adap->sge.fw_evtq.abs_id) | +NO_REPLY_V (no_reply)); req->word_cookie =htons (TCB_WORD_V (word) |TCB_COOKIE_V (ftid)); req->mask =cpu_to_be64 (mask); req->val =cpu_to_be64 (val);
@@ -249,32 +254,53 @@ static int validate_filter(struct net_device *dev, struct ch_filter_specification *fs) {struct adapter *adapter =netdev2adap (dev); -u32 fconf, iconf; +u32 fconf, iconf, chip_ver; + chip_ver =CHELSIO_CHIP_VERSION (adapter->params.chip);/* Check for unconfigured fields being used. */ iconf = adapter->params.tp.ingress_config; fconf = fs->hash ? adapter->params.tp.filter_mask : adapter->params.tp.vlan_pri_map; -if (unsupported (fconf,FCOE_F , fs->val.fcoe, fs->mask.fcoe) || -unsupported (fconf,PORT_F , fs->val.iport, fs->mask.iport) || -unsupported (fconf,TOS_F , fs->val.tos, fs->mask.tos) || -unsupported (fconf,ETHERTYPE_F , fs->val.ethtype, - fs->mask.ethtype) || -unsupported (fconf,MACMATCH_F , fs->val.macidx, fs->mask.macidx) || -unsupported (fconf,MPSHITTYPE_F , fs->val.matchtype, - fs->mask.matchtype) || -unsupported (fconf,FRAGMENTATION_F , fs->val.frag, fs->mask.frag) || -unsupported (fconf,PROTOCOL_F , fs->val.proto, fs->mask.proto) || -unsupported (fconf,VNIC_ID_F , fs->val.pfvf_vld, - fs->mask.pfvf_vld) || -unsupported (fconf,VNIC_ID_F , fs->val.ovlan_vld, - fs->mask.ovlan_vld) || -unsupported (fconf,VNIC_ID_F , fs->val.encap_vld, - fs->mask.encap_vld) || -unsupported (fconf,VLAN_F , fs->val.ivlan_vld, fs->mask.ivlan_vld)) -return -EOPNOTSUPP ; - +if (chip_ver >=CHELSIO_T7 ) { +if (unsupported (fconf,T7_FCOE_F , fs->val.fcoe, fs->mask.fcoe) || +unsupported (fconf,T7_PORT_F , fs->val.iport, fs->mask.iport) || +unsupported (fconf,T7_TOS_F , fs->val.tos, fs->mask.tos) || +unsupported (fconf,T7_ETHERTYPE_F , fs->val.ethtype, + fs->mask.ethtype) || +unsupported (fconf,T7_MACMATCH_F , fs->val.macidx, fs->mask.macidx) || +unsupported (fconf,T7_MPSHITTYPE_F , fs->val.matchtype, + fs->mask.matchtype) || +unsupported (fconf,T7_FRAGMENTATION_F , fs->val.frag, fs->mask.frag) || +unsupported (fconf,T7_PROTOCOL_F , fs->val.proto, fs->mask.proto) || +unsupported (fconf,T7_VNIC_ID_F , fs->val.pfvf_vld, + fs->mask.pfvf_vld) || +unsupported (fconf,T7_VNIC_ID_F , fs->val.ovlan_vld, + fs->mask.ovlan_vld) || +unsupported (fconf,T7_VNIC_ID_F , fs->val.encap_vld, + fs->mask.encap_vld) || +unsupported (fconf,T7_VLAN_F , fs->val.ivlan_vld, fs->mask.ivlan_vld)) +return -EOPNOTSUPP ; + }else { +if (unsupported (fconf,FCOE_F , fs->val.fcoe, fs->mask.fcoe) || +unsupported (fconf,PORT_F , fs->val.iport, fs->mask.iport) || +unsupported (fconf,TOS_F , fs->val.tos, fs->mask.tos) || +unsupported (fconf,ETHERTYPE_F , fs->val.ethtype, + fs->mask.ethtype) || +unsupported (fconf,MACMATCH_F , fs->val.macidx, fs->mask.macidx) || +unsupported (fconf,MPSHITTYPE_F , fs->val.matchtype, + fs->mask.matchtype) || +unsupported (fconf,FRAGMENTATION_F , fs->val.frag, fs->mask.frag) || +unsupported (fconf,PROTOCOL_F , fs->val.proto, fs->mask.proto) || +unsupported (fconf,VNIC_ID_F , fs->val.pfvf_vld, + fs->mask.pfvf_vld) || +unsupported (fconf,VNIC_ID_F , fs->val.ovlan_vld, + fs->mask.ovlan_vld) || +unsupported (fconf,VNIC_ID_F , fs->val.encap_vld, + fs->mask.encap_vld) || +unsupported (fconf,VLAN_F , fs->val.ivlan_vld, fs->mask.ivlan_vld)) +return -EOPNOTSUPP ; + }/* T4 inconveniently uses the same FT_VNIC_ID_W bits for both the Outer * VLAN Tag and PF/VF/VFvld fields based on VNIC_F being set * in TP_INGRESS_CONFIG. Hense the somewhat crazy checks
@@ -793,9 +819,12 @@ static int del_filter_wr(struct adapter *adapter, int fidx)int set_filter_wr (struct adapter *adapter,int fidx) {struct fw_filter2_wr *fwr; +unsigned int chip_ver;struct filter_entry *f;struct sk_buff *skb; + chip_ver =CHELSIO_CHIP_VERSION (adapter->params.chip); +if (fidx < adapter->tids.nhpftids) f = &adapter->tids.hpftid_tab[fidx];else
@@ -883,8 +912,10 @@ int set_filter_wr(struct adapter *adapter, int fidx)if (f->fs.newsmac) fwr->smac_sel = f->smt->idx; fwr->rx_chan_rx_rpl_iq = -htons (FW_FILTER_WR_RX_CHAN_V (0 ) | -FW_FILTER_WR_RX_RPL_IQ_V (adapter->sge.fw_evtq.abs_id)); +htons (FW_FILTER_WR_RX_RPL_IQ_V (adapter->sge.fw_evtq.abs_id)); +if (chip_ver <=CHELSIO_T6 ) + fwr->rx_chan_rx_rpl_iq |= +htons (FW_FILTER_WR_RX_CHAN_V (cxgb4_port_e2cchan (f->dev))); fwr->maci_to_matchtypem = htonl(FW_FILTER_WR_MACI_V(f->fs.val.macidx) | FW_FILTER_WR_MACIM_V(f->fs.mask.macidx) |
@@ -993,7 +1024,9 @@ void clear_filter(struct adapter *adap, struct filter_entry *f)t4_free_encap_mac_filt (adap, pi->viid, f->fs.val.ovlan &0x1ff ,0 ); -if ((f->fs.hash ||is_t6 (adap->params.chip)) && f->fs.type) +if ((f->fs.hash || + (CHELSIO_CHIP_VERSION (adap->params.chip) >=CHELSIO_T6 )) && + f->fs.type)cxgb4_clip_release (f->dev, (const u32 *)&f->fs.val.lip,1 );/* The zeroing of the filter rule below clears the filter valid,
@@ -1296,20 +1329,16 @@ static void mk_act_open_req6(struct filter_entry *f, struct sk_buff *skb, unsigned int qid_filterid, struct adapter *adap) { struct cpl_t6_act_open_req6 *t6req = NULL; +struct cpl_t7_act_open_req6 *t7req =NULL ;struct cpl_act_open_req6 *req =NULL ; +u32 chip_ver; +__be32 opt2; +__be64 opt0; - t6req = (struct cpl_t6_act_open_req6 *)__skb_put (skb,sizeof (*t6req)); -INIT_TP_WR (t6req,0 ); - req = (struct cpl_act_open_req6 *)t6req; -OPCODE_TID (req) =htonl (MK_OPCODE_TID (CPL_ACT_OPEN_REQ6 , qid_filterid)); - req->local_port =cpu_to_be16 (f->fs.val.lport); - req->peer_port =cpu_to_be16 (f->fs.val.fport); - req->local_ip_hi = *(__be64 *)(&f->fs.val.lip); - req->local_ip_lo = *(((__be64 *)&f->fs.val.lip) +1 ); - req->peer_ip_hi = *(__be64 *)(&f->fs.val.fip); - req->peer_ip_lo = *(((__be64 *)&f->fs.val.fip) +1 ); - req->opt0 = cpu_to_be64(NAGLE_V(f->fs.newvlan == VLAN_REMOVE || - f->fs.newvlan == VLAN_REWRITE) | + chip_ver =CHELSIO_CHIP_VERSION (adap->params.chip); + + opt0 = cpu_to_be64(NAGLE_V(f->fs.newvlan == VLAN_REMOVE || + f->fs.newvlan == VLAN_REWRITE) | DELACK_V(f->fs.hitcnts) | L2T_IDX_V(f->l2t ? f->l2t->idx : 0) | SMAC_SEL_V((cxgb4_port_viid(f->dev) &
@@ -1319,52 +1348,90 @@ static void mk_act_open_req6(struct filter_entry *f, struct sk_buff *skb,ULP_MODE_V (f->fs.nat_mode ?ULP_MODE_TCPDDP :ULP_MODE_NONE ) | TCAM_BYPASS_F | NON_OFFLOAD_F); - t6req->params =cpu_to_be64 (FILTER_TUPLE_V (hash_filter_ntuple (&f->fs, - f->dev))); - t6req->opt2 =htonl (RSS_QUEUE_VALID_F | -RSS_QUEUE_V (f->fs.iq) | -TX_QUEUE_V (f->fs.nat_mode) | -T5_OPT_2_VALID_F | -RX_CHANNEL_V (cxgb4_port_e2cchan (f->dev)) | -PACE_V ((f->fs.maskhash) | + opt2 =cpu_to_be32 (RSS_QUEUE_VALID_F | +RSS_QUEUE_V (f->fs.iq) | +TX_QUEUE_V (f->fs.nat_mode) | +T5_OPT_2_VALID_F | +RX_CHANNEL_V (cxgb4_port_e2cchan (f->dev)) | +PACE_V ((f->fs.maskhash) | ((f->fs.dirsteerhash) <<1 ))); + +if (chip_ver >=CHELSIO_T7 ) { + t7req = (struct cpl_t7_act_open_req6 *)__skb_put (skb,sizeof (*t7req)); +INIT_TP_WR (t7req,0 ); + req = (struct cpl_act_open_req6 *)t7req; + t7req->opt0 = opt0; + t7req->opt2 = opt2; + t7req->params =cpu_to_be64 (T7_FILTER_TUPLE_V (hash_filter_ntuple (&f->fs, f->dev))); + }else { + t6req = (struct cpl_t6_act_open_req6 *)__skb_put (skb,sizeof (*t6req)); +INIT_TP_WR (t6req,0 ); + req = (struct cpl_act_open_req6 *)t6req; + t6req->opt0 = opt0; + t6req->opt2 = opt2; + t6req->params =cpu_to_be64 (FILTER_TUPLE_V (hash_filter_ntuple (&f->fs, f->dev))); + } + +OPCODE_TID (req) =htonl (MK_OPCODE_TID (CPL_ACT_OPEN_REQ6 , qid_filterid)); + req->local_port =cpu_to_be16 (f->fs.val.lport); + req->peer_port =cpu_to_be16 (f->fs.val.fport); + req->local_ip_hi = *(__be64 *)(&f->fs.val.lip); + req->local_ip_lo = *(((__be64 *)&f->fs.val.lip) +1 ); + req->peer_ip_hi = *(__be64 *)(&f->fs.val.fip); + req->peer_ip_lo = *(((__be64 *)&f->fs.val.fip) +1 ); }static void mk_act_open_req (struct filter_entry *f,struct sk_buff *skb,unsigned int qid_filterid,struct adapter *adap) {struct cpl_t6_act_open_req *t6req =NULL ; +struct cpl_t7_act_open_req *t7req =NULL ;struct cpl_act_open_req *req =NULL ; +u32 chip_ver; +__be32 opt2; +__be64 opt0; + + chip_ver =CHELSIO_CHIP_VERSION (adap->params.chip); + + opt0 =cpu_to_be64 (NAGLE_V (f->fs.newvlan ==VLAN_REMOVE || + f->fs.newvlan ==VLAN_REWRITE ) | +DELACK_V (f->fs.hitcnts) | +L2T_IDX_V (f->l2t ? f->l2t->idx :0 ) | +SMAC_SEL_V ((cxgb4_port_viid (f->dev) & +0x7F ) <<1 ) | +TX_CHAN_V (f->fs.eport) | +NO_CONG_V (f->fs.rpttid) | +ULP_MODE_V (f->fs.nat_mode ? +ULP_MODE_TCPDDP :ULP_MODE_NONE ) | +TCAM_BYPASS_F |NON_OFFLOAD_F ); + opt2 =cpu_to_be32 (RSS_QUEUE_VALID_F | +RSS_QUEUE_V (f->fs.iq) | +TX_QUEUE_V (f->fs.nat_mode) | +T5_OPT_2_VALID_F | +RX_CHANNEL_V (cxgb4_port_e2cchan (f->dev)) | +PACE_V ((f->fs.maskhash) | + ((f->fs.dirsteerhash) <<1 ))); +if (chip_ver >=CHELSIO_T7 ) { + t7req = (struct cpl_t7_act_open_req *)__skb_put (skb,sizeof (*t7req)); +INIT_TP_WR (t7req,0 ); + req = (struct cpl_act_open_req *)t7req; + t7req->opt0 = opt0; + t7req->opt2 = opt2; + t7req->params =cpu_to_be64 (T7_FILTER_TUPLE_V (hash_filter_ntuple (&f->fs, f->dev))); + }else { + t6req = (struct cpl_t6_act_open_req *)__skb_put (skb,sizeof (*t6req)); +INIT_TP_WR (t6req,0 ); + req = (struct cpl_act_open_req *)t6req; + t6req->opt0 = opt0; + t6req->opt2 = opt2; + t6req->params =cpu_to_be64 (FILTER_TUPLE_V (hash_filter_ntuple (&f->fs, f->dev))); + } - t6req = (struct cpl_t6_act_open_req *)__skb_put (skb,sizeof (*t6req)); -INIT_TP_WR (t6req,0 ); - req = (struct cpl_act_open_req *)t6req;OPCODE_TID (req) =htonl (MK_OPCODE_TID (CPL_ACT_OPEN_REQ , qid_filterid)); req->local_port =cpu_to_be16 (f->fs.val.lport); req->peer_port =cpu_to_be16 (f->fs.val.fport);memcpy (&req->local_ip, f->fs.val.lip,4 );memcpy (&req->peer_ip, f->fs.val.fip,4 ); - req->opt0 =cpu_to_be64 (NAGLE_V (f->fs.newvlan ==VLAN_REMOVE || - f->fs.newvlan ==VLAN_REWRITE ) | -DELACK_V (f->fs.hitcnts) | -L2T_IDX_V (f->l2t ? f->l2t->idx :0 ) | -SMAC_SEL_V ((cxgb4_port_viid (f->dev) & -0x7F ) <<1 ) | -TX_CHAN_V (f->fs.eport) | -NO_CONG_V (f->fs.rpttid) | -ULP_MODE_V (f->fs.nat_mode ? -ULP_MODE_TCPDDP :ULP_MODE_NONE ) | -TCAM_BYPASS_F |NON_OFFLOAD_F ); - - t6req->params =cpu_to_be64 (FILTER_TUPLE_V (hash_filter_ntuple (&f->fs, - f->dev))); - t6req->opt2 =htonl (RSS_QUEUE_VALID_F | -RSS_QUEUE_V (f->fs.iq) | -TX_QUEUE_V (f->fs.nat_mode) | -T5_OPT_2_VALID_F | -RX_CHANNEL_V (cxgb4_port_e2cchan (f->dev)) | -PACE_V ((f->fs.maskhash) | - ((f->fs.dirsteerhash) <<1 ))); } static int cxgb4_set_hash_filter(struct net_device *dev,
@@ -1663,7 +1730,7 @@ int __cxgb4_set_filter(struct net_device *dev, int ftid,if (ret) goto free_tid; -if (is_t6 (adapter->params.chip) && fs->type && +if (chip_ver >=CHELSIO_T6 && fs->type &&ipv6_addr_type ((const struct in6_addr *)fs->val.lip) !=IPV6_ADDR_ANY ) { ret =cxgb4_clip_get (dev, (const u32 *)&fs->val.lip,1 );
@@ -2140,12 +2207,13 @@ void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl)void init_hash_filter (struct adapter *adap) { -u32 reg; +u32 reg, chip_ver; + chip_ver =CHELSIO_CHIP_VERSION (adap->params.chip);/* On T6, verify the necessary register configs and warn the user in * case of improper config */ -if (is_t6 (adap->params.chip)) { +if (chip_ver >=CHELSIO_T6 ) {if (is_offload (adap)) {if (!(t4_read_reg (adap,TP_GLOBAL_CONFIG_A ) &ACTIVEFILTERCOUNTS_F )) {
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 9/12 cxgb4: Add indirect register definitions for T7
In reply to Potnuri Bharat TejaAdd indirect register definition headers used by the CUDBG infrastructure.
Introduce cudbg_indir_reg.h and cudbg_indir_reg_t7.h containing the indirect registers required for cudbg register collection.
These headers will be used by subsequent patch that add indirect register handling support to cudbg.
--- .../ethernet/chelsio/cxgb4/cudbg_indir_reg.h | 43 + .../chelsio/cxgb4/cudbg_indir_reg_t7.h | 1113 +++++++++++++++++ 2 files changed, 1156 insertions(+) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_indir_reg.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_indir_reg_t7.h
drivers/net/ethernet/chelsio/cxgb4/cudbg_indir_reg.h new file +43 -0
@@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2026 Chelsio Communications. All rights reserved. +*/ + +#ifndef __CUDBG_INDIR_REG_H__ +#define __CUDBG_INDIR_REG_H__ + +enum cudbg_indir_type { +CUDBG_INDIR_TYPE_CIM_CTL , +CUDBG_INDIR_TYPE_PM_RX_DBG_CTRL , +CUDBG_INDIR_TYPE_PM_TX_DBG_CTRL , +CUDBG_INDIR_TYPE_TP_MIB_INDEX , +CUDBG_INDIR_TYPE_TP_PIO_ADDR , +CUDBG_INDIR_TYPE_TP_TM_PIO_ADDR , +CUDBG_INDIR_TYPE_UP , +CUDBG_INDIR_TYPE_HMAT6_LOCAL_DEBUG_CFG , +CUDBG_INDIR_TYPE_MA_LOCAL_DEBUG_CFG , +CUDBG_INDIR_TYPE_MA_LOCAL_DEBUG_PERF_CFG , +CUDBG_INDIR_TYPE_MAX ,/* New members need to be added at end */ +}; + +struct cudbg_indir_reg { +u32 addr; +}; + +struct cudbg_indir_type_entry { +struct cudbg_indir_reg *reg_arr; +u32 nentries; +}; + +#include "cudbg_indir_reg_t7.h" + +static inline struct cudbg_indir_type_entry * +cudbg_get_indir_reg_info (u32 chip_ver,enum cudbg_indir_type type) +{ +if (chip_ver >=CHELSIO_T7 ) +return &t7_indir_type_arr[type]; + +return NULL ; +} + +#endif /* __CUDBG_INDIR_REG_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_indir_reg_t7.h new file +1113 -0
1,113 lines not on this page · raw message
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 10/12 cxgb4: extend CUDBG support for T7 adapters
In reply to Potnuri Bharat TejaUpdate the CUDBG infrastructure to support T7-specific debug data collection.
Add support for collecting CIM IBQ and OBQ debug entities from T7 adapters, including the additional queues introduced by T7 and support for multicore.
Also add T7 indirect register collection support using the new indirect register definitions, while preserving the existing register access mechanism for T5/T6.
Debug tooling needs to read and write individual adapter registers and to read SGE contexts and queue descriptors without collecting a full cudbg dump. Add a private ioctl providing four commands
--- .../net/ethernet/chelsio/cxgb4/cudbg_entity.h | 114 +- drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 56 +- .../net/ethernet/chelsio/cxgb4/cudbg_lib.c | 1088 ++++++++++++++--- .../net/ethernet/chelsio/cxgb4/cudbg_lib.h | 60 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 1 - .../net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 20 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 242 ++++ drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 20 - drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 1 + 9 files changed, 1400 insertions(+), 202 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h +100 -14
@@ -21,13 +21,58 @@ struct cudbg_mbox_log {u32 lo[MBOX_LEN /8 ]; }; -struct cudbg_cim_qcfg { -u8 chip; -u16 base[CIM_NUM_IBQ +CIM_NUM_OBQ_T5 ]; -u16 size[CIM_NUM_IBQ +CIM_NUM_OBQ_T5 ]; -u16 thres[CIM_NUM_IBQ ]; -u32 obq_wr[2 *CIM_NUM_OBQ_T5 ]; -u32 stat[4 * (CIM_NUM_IBQ +CIM_NUM_OBQ_T5 )]; +#define CUDBG_CIM_IBQ_REV 1 + +struct cim_ibq_rev1 { +struct cudbg_ver_hdr ver_hdr; +u8 qid; +u8 coreid; +u32 data[];/* Must be last */ +}; + +#define CUDBG_CIM_OBQ_REV 1 + +struct cim_obq_rev1 { +struct cudbg_ver_hdr ver_hdr; +u8 qid; +u8 coreid; +u32 data[];/* Must be last */ +}; + +#define CUDBG_CIM_QCFG_REV 1 + +enum cudbg_entity_cim_qcfg_qtype { +CUDBG_ENTITY_CIM_QCFG_QTYPE_IBQ =0 , +CUDBG_ENTITY_CIM_QCFG_QTYPE_OBQ , +}; + +struct cim_qcfg_rev1_data { +u8 qtype; +u8 qid; +u16 base; +u16 size; +u16 thres; +u32 obq_wr[2 ]; +u32 stat[4 ]; +}; + +struct cim_qcfg_rev1 { +struct cudbg_ver_hdr ver_hdr; +u8 num_cim_ibq; +u8 num_cim_obq; +u8 coreid; +struct cim_qcfg_rev1_data data[];/* Must be last */ +}; + +#define CUDBG_CIM_LA_REV 1 + +struct cim_la_rev1 { +struct cudbg_ver_hdr ver_hdr; +u8 coreid; +u8 ncol; +u16 nrow; +u32 config; +u32 data[];/* Must be last */ };struct cudbg_rss_vf_conf {
@@ -50,6 +95,25 @@ struct cudbg_hw_sched {u32 map; }; +#define CUDBG_TP_INDIR_REG_REV 1 +#define CUDBG_PM_INDIR_REG_REV 1 +#define CUDBG_MA_INDIR_REG_REV 1 +#define CUDBG_UP_CIM_INDIR_REG_REV 1 +#define CUDBG_HMA_INDIR_REG_REV 1 + +struct cudbg_indir_reg_data { +u32 offset; +u32 data; +}; + +struct cudbg_indir_reg_entity { +struct cudbg_ver_hdr ver_hdr; +u32 indir_reg; +u32 indir_data; +u32 nentries; +struct cudbg_indir_reg_data data[]; +}; +#define SGE_QBASE_DATA_REG_NUM 4struct sge_qbase_reg_field {
@@ -91,8 +155,8 @@ static const char * const cudbg_region[] = {"Tx payload:" ,"Rx payload:" ,"LE hash:" ,"iSCSI region:" ,"TDDP region:" ,"TPT region:" ,"STAG region:" ,"RQ region:" ,"RQUDP region:" ,"PBL region:" ,"TXPBL region:" , -"DBVFIFO region:" ,"ULPRX state:" ,"ULPTX state:" , -"On-chip queues:" +"RRQ region:" ,"DBVFIFO region:" ,"ULPRX state:" , +"ULPTX state:" ,"On-chip queues:" };/* Memory region info relative to current memory (i.e. wrt 0). */
@@ -187,20 +251,42 @@ struct cudbg_tid_info_region_rev1 {struct cudbg_ver_hdr ver_hdr;struct cudbg_tid_info_region tid;u32 tid_start; -u32 reserved[16 ]; +u32 nhash; +u32 clip_base; +u32 nclip; +u32 route_base; +u32 nroute; +u32 reserved[11 ]; };#define CUDBG_LOWMEM_MAX_CTXT_QIDS 256#define CUDBG_MAX_FL_QIDS 1024 -struct cudbg_ch_cntxt { -u32 cntxt_type; -u32 cntxt_id; -u32 data[SGE_CTXT_SIZE /4 ]; +#define CUDBG_SGE_CTXT_REV 1 + +struct sge_ctxt_rev1_data { +u8 ctxt_type; +u8 size; +u32 ctxt_id; +u32 data[]; +}; + +struct sge_ctxt_rev1 { +struct cudbg_ver_hdr ver_hdr; +u32 nentries; +u8 data[];/* Must be last */ };#define CUDBG_MAX_RPLC_SIZE 128 +struct cudbg_cntxt_field { +char *name; +u32 start_bit; +u32 end_bit; +u32 shift; +u32 islog2; +}; +struct cudbg_mps_tcam {u64 mask;u32 rplc[8 ];
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +53 -3
78 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +932 -156
1,558 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h +54 -6
77 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +0 -1
@@ -1857,7 +1857,6 @@ void t4_setup_memwin(struct adapter *adap, u32 memwin_base, u32 window);int t4_memory_rw_init (struct adapter *adap,int win,int mtype,u32 *mem_off,u32 *mem_base,u32 *mem_aperture); -void t4_memory_update_win (struct adapter *adap,int win,u32 addr);void t4_memory_rw_residual (struct adapter *adap,u32 off,u32 addr,u8 *buf,int dir);#define T4_MEMORY_WRITE 0
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +18 -2
@@ -27,8 +27,8 @@ static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = { { CUDBG_CIM_IBQ_TP0, cudbg_collect_cim_ibq_tp0 }, { CUDBG_CIM_IBQ_TP1, cudbg_collect_cim_ibq_tp1 }, { CUDBG_CIM_IBQ_ULP, cudbg_collect_cim_ibq_ulp }, - { CUDBG_CIM_IBQ_SGE0, cudbg_collect_cim_ibq_sge0 }, - { CUDBG_CIM_IBQ_SGE1, cudbg_collect_cim_ibq_sge1 }, + { CUDBG_CIM_IBQ_SGE, cudbg_collect_cim_ibq_sge }, + { CUDBG_CIM_IBQ_PCIE, cudbg_collect_cim_ibq_pcie }, { CUDBG_CIM_IBQ_NCSI, cudbg_collect_cim_ibq_ncsi }, { CUDBG_CIM_OBQ_ULP0, cudbg_collect_cim_obq_ulp0 }, { CUDBG_CIM_OBQ_ULP1, cudbg_collect_cim_obq_ulp1 },
@@ -64,6 +64,22 @@ static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = { { CUDBG_UP_CIM_INDIRECT, cudbg_collect_up_cim_indirect }, { CUDBG_PBT_TABLE, cudbg_collect_pbt_tables }, { CUDBG_HMA_INDIRECT, cudbg_collect_hma_indirect }, + { CUDBG_CIM_IBQ_TP2, cudbg_collect_cim_ibq_tp2 }, + { CUDBG_CIM_IBQ_TP3, cudbg_collect_cim_ibq_tp3 }, + { CUDBG_CIM_IBQ_IPC1, cudbg_collect_cim_ibq_ipc1 }, + { CUDBG_CIM_IBQ_IPC2, cudbg_collect_cim_ibq_ipc2 }, + { CUDBG_CIM_IBQ_IPC3, cudbg_collect_cim_ibq_ipc3 }, + { CUDBG_CIM_IBQ_IPC4, cudbg_collect_cim_ibq_ipc4 }, + { CUDBG_CIM_IBQ_IPC5, cudbg_collect_cim_ibq_ipc5 }, + { CUDBG_CIM_IBQ_IPC6, cudbg_collect_cim_ibq_ipc6 }, + { CUDBG_CIM_IBQ_IPC7, cudbg_collect_cim_ibq_ipc7 }, + { CUDBG_CIM_OBQ_IPC1, cudbg_collect_cim_obq_ipc1 }, + { CUDBG_CIM_OBQ_IPC2, cudbg_collect_cim_obq_ipc2 }, + { CUDBG_CIM_OBQ_IPC3, cudbg_collect_cim_obq_ipc3 }, + { CUDBG_CIM_OBQ_IPC4, cudbg_collect_cim_obq_ipc4 }, + { CUDBG_CIM_OBQ_IPC5, cudbg_collect_cim_obq_ipc5 }, + { CUDBG_CIM_OBQ_IPC6, cudbg_collect_cim_obq_ipc6 }, + { CUDBG_CIM_OBQ_IPC7, cudbg_collect_cim_obq_ipc7 }, }; static const struct cxgb4_collect_entity cxgb4_collect_flash_dump[] = {
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +242 -0
254 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +0 -20
@@ -580,26 +580,6 @@ int t4_memory_rw_init(struct adapter *adap, int win, int mtype, u32 *mem_off,return 0 ; } -/** -* t4_memory_update_win - Move memory window to specified address. -* @adap: the adapter -* @win: PCI-E Memory Window to use -* @addr: location to move. -* -* Move memory window to specified address. -*/ -void t4_memory_update_win (struct adapter *adap,int win,u32 addr) -{ -t4_write_reg (adap, -PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_OFFSET_A , win), - addr); -/* Read it back to ensure that changes propagate before we -* attempt to use the new value. -*/ -t4_read_reg (adap, -PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_OFFSET_A , win)); -} -/** * t4_memory_rw_residual - Read/Write residual data. * @adap: the adapter
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +1 -0
@@ -80,6 +80,7 @@ enum ctxt_type {CTXT_INGRESS ,CTXT_FLM ,CTXT_CNM , + CTXT_MAX, }; enum {
Signature · 1 line
2.39.1
Potnuri Bharat Teja
maintainerPATCH v4 11/12 cxgb4: extend debugfs support for T7 adapters
In reply to Potnuri Bharat TejaUpdate the debugfs infrastructure to support T7-specific debug data and multicore adapter architectures.
Add support for collecting and displaying debug information from individual CIM cores, including CIM logic analyzer data, queue configuration, and queue state information. Update debugfs handlers to use the multicore-aware access mechanisms required by T7 devices.
Also extend debugfs support for T7-specific CIM IBQ and OBQ layouts, per-core device logs, and related debug entities.
--- drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c | 10 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 8 - .../ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 1029 ++++++++++++----- .../ethernet/chelsio/cxgb4/cxgb4_debugfs.h | 17 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 64 +- 6 files changed, 787 insertions(+), 343 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c +8 -2
@@ -17,6 +17,7 @@#include <net/addrconf.h> #include "cxgb4.h" #include "clip_tbl.h" +#include "cxgb4_debugfs.h" static inline unsigned int ipv4_clip_hash (struct clip_tbl *c,const u32 *key) {
@@ -249,12 +250,17 @@ EXPORT_SYMBOL(cxgb4_update_root_dev_clip);int clip_tbl_show (struct seq_file *seq,void *v) { -struct adapter *adapter = seq->private; -struct clip_tbl *ctbl = adapter->clipt; +struct t4_linux_debugfs_data *d = seq->private; +struct adapter *adapter = d->adap; +struct clip_tbl *ctbl;struct clip_entry *ce;char ip[60 ];int i; + ctbl = adapter->clipt; +if (!ctbl) +return 0 ; +read_lock_bh (&ctbl->lock);seq_puts (seq,"IP Address Users\n" );
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +0 -8
@@ -455,7 +455,6 @@ struct adapter_params {struct vpd_params vpd;struct pf_resources pfres;struct pci_params pci; -struct devlog_params devlogs;struct devlog_params devlog[MAX_UP_CORES ];enum pcie_memwin drv_memwin;
@@ -1957,12 +1956,8 @@ u8 t4_cim_num_ibq(struct adapter *adap);u8 t4_cim_num_obq (struct adapter *adap);void t4_read_cimq_cfg_core (struct adapter *adap,u8 coreid,u16 *base,u16 *size,u16 *thres); -int t4_read_cim_ibq (struct adapter *adap,unsigned int qid,u32 *data, -size_t n);int t4_read_cim_obq_core (struct adapter *adap,u8 coreid,u32 qid,u32 *data,size_t n); -int t4_read_cim_obq (struct adapter *adap,unsigned int qid,u32 *data, -size_t n);int t4_cim_read_core (struct adapter *adap,u8 group,u8 coreid,unsigned int addr,unsigned int n,unsigned int *valp); int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n,
@@ -1970,11 +1965,8 @@ int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n,int t4_cim_write_core (struct adapter *adap,u8 group,u8 coreid,unsigned int addr,unsigned int n,const unsigned int *valp); -int t4_cim_write (struct adapter *adap,unsigned int addr,unsigned int n, -const unsigned int *valp);int t4_cim_read_la_core (struct adapter *adap,u8 coreid,u32 *la_buf,u32 *wrptr); -int t4_cim_read_la (struct adapter *adap,u32 *la_buf,unsigned int *wrptr);void t4_cim_read_pif_la (struct adapter *adap,u32 *pif_req,u32 *pif_rsp,unsigned int *pif_req_wrptr,unsigned int *pif_rsp_wrptr);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +766 -263
1,658 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h +11 -6
@@ -37,7 +37,13 @@#include <linux/export.h> -struct t4_debugfs_entry { +struct t4_linux_debugfs_data { +struct adapter *adap; +unsigned int data; +unsigned char coreid; +}; + +struct t4_linux_debugfs_entry {const char *name;const struct file_operations *ops;umode_t mode;
@@ -61,10 +67,9 @@ struct seq_tab *seq_open_tab(struct file *f, unsigned int rows, unsigned int width, unsigned int have_header, int (*show)(struct seq_file *seq, void *v, int i)); -int t4_setup_debugfs (struct adapter *adap); -void add_debugfs_files (struct adapter *adap, -struct t4_debugfs_entry *files, -unsigned int nfiles); +void add_debugfs_files (struct adapter *adap,struct dentry *dentry, +unsigned char coreid,struct t4_linux_debugfs_entry *f, +unsigned int n);int mem_open (struct inode *inode,struct file *file); - +int cxgb4_setup_debugfs (struct adapter *adap);#endif
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -1
@@ -7190,7 +7190,7 @@ int cxgb4_adap_probe(struct adapter *adapter)const char *dir_name =pci_name (adapter->pdev); adapter->debugfs_root =debugfs_create_dir (dir_name, cxgb4_debugfs_root); -t4_setup_debugfs (adapter); +cxgb4_setup_debugfs (adapter); }if (is_uld (adapter))
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1 -63
94 lines not on this page · raw message
Signature · 1 line
2.39.1
kernel test robot
build botRe: [PATCH net-next v4 11/12] cxgb4: extend debugfs support for T7 adapters
kernel test robot noticed the following build errors:
Hi Potnuri,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v7.3-rc7 next-20261012]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Potnuri-Bharat-Teja/cxgb4-add-T7-hardware-definitions-and-firmware-interfaces/20261014-181246 base: linus/master patch link: https://lore.kernel.org/r/20261014221257.436789-12-bharat%40chelsio.com patch subject: [PATCH net-next v4 11/12] cxgb4: extend debugfs support for T7 adapters config: x86_64-randconfig-1000-20261015 (https://download.01.org/0day-ci/archive/20261015/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261015/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c: In function 'cxgb4_setup_debugfs':
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:4365:32: error: 'clip_tbl_fops' undeclared (first use in this function); did you mean 'cctrl_tbl_fops'?
4365 | { "clip_tbl", &clip_tbl_fops, 0400, 0 },
| ^~~~~~~~~~~~~
| cctrl_tbl_fops drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:4365:32: note: each undeclared identifier is reported only once for each function it appears in
vim +4365 drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
4355
4356 int cxgb4_setup_debugfs(struct adapter *adap)
4357 {
4358 static struct t4_linux_debugfs_entry cxgb4_debugfs_files[] = {
4359 { "blocked_fl", &blocked_fl_fops, 0600 },
4360 #ifdef CONFIG_CHELSIO_T4_DCB
4361 { "dcb_info", &dcb_info_debugfs_fops, 0400, 0 },
4362 #endif /* CONFIG_CHELSIO_T4_DCB */
4363 { "resources", &resources_fops, 0400, 0 },
4364 { "sge_qinfo", &sge_qinfo_debugfs_fops, 0400, 0 },
> 4365 { "clip_tbl", &clip_tbl_fops, 0400, 0 }, 4366 { "tids", &tid_info_fops, 0400, 0 },
4367 { "trace0", &mps_trc_debugfs_fops, 0600, 0 },
4368 { "trace1", &mps_trc_debugfs_fops, 0600, 1 },
4369 { "trace2", &mps_trc_debugfs_fops, 0600, 2 },
4370 { "trace3", &mps_trc_debugfs_fops, 0600, 3 },
4371 { "l2t", &t4_l2t_fops, 0400, 0 },
4372 { "crypto", &chcr_stats_fops, 0400, 0 },
4373 };
4374
4375 static struct t4_linux_debugfs_entry cxgb4_t7_debugfs_files[] = {
4376 { "trace4", &mps_trc_debugfs_fops, 0600, 4 },
4377 { "trace5", &mps_trc_debugfs_fops, 0600, 5 },
4378 { "trace6", &mps_trc_debugfs_fops, 0600, 6 },
4379 { "trace7", &mps_trc_debugfs_fops, 0600, 7 },
4380 };
4381
4382 if (IS_ERR_OR_NULL(adap->debugfs_root))
4383 return -1;
4384
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH net-next v4 11/12] cxgb4: extend debugfs support for T7 adapters
In reply to Potnuri Bharat Tejakernel test robot noticed the following build errors:
Hi Potnuri,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v7.3-rc7 next-20261012]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Potnuri-Bharat-Teja/cxgb4-add-T7-hardware-definitions-and-firmware-interfaces/20261014-181246 base: linus/master patch link: https://lore.kernel.org/r/20261014221257.436789-12-bharat%40chelsio.com patch subject: [PATCH net-next v4 11/12] cxgb4: extend debugfs support for T7 adapters config: x86_64-kexec (https://download.01.org/0day-ci/archive/20261015/[email protected]/config) compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261015/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:4365:18: error: use of undeclared identifier 'clip_tbl_fops'
4365 | { "clip_tbl", &clip_tbl_fops, 0400, 0 },
| ^~~~~~~~~~~~~
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:4390:5: error: invalid application of 'sizeof' to an incomplete type 'struct t4_linux_debugfs_entry[]'
4390 | ARRAY_SIZE(cxgb4_debugfs_files));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~2 errors generated.
vim +/clip_tbl_fops +4365 drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
4355
4356 int cxgb4_setup_debugfs(struct adapter *adap)
4357 {
4358 static struct t4_linux_debugfs_entry cxgb4_debugfs_files[] = {
4359 { "blocked_fl", &blocked_fl_fops, 0600 },
4360 #ifdef CONFIG_CHELSIO_T4_DCB
4361 { "dcb_info", &dcb_info_debugfs_fops, 0400, 0 },
4362 #endif /* CONFIG_CHELSIO_T4_DCB */
4363 { "resources", &resources_fops, 0400, 0 },
4364 { "sge_qinfo", &sge_qinfo_debugfs_fops, 0400, 0 },
> 4365 { "clip_tbl", &clip_tbl_fops, 0400, 0 },
4366 { "tids", &tid_info_fops, 0400, 0 },
4367 { "trace0", &mps_trc_debugfs_fops, 0600, 0 },
4368 { "trace1", &mps_trc_debugfs_fops, 0600, 1 },
4369 { "trace2", &mps_trc_debugfs_fops, 0600, 2 },
4370 { "trace3", &mps_trc_debugfs_fops, 0600, 3 },
4371 { "l2t", &t4_l2t_fops, 0400, 0 },
4372 { "crypto", &chcr_stats_fops, 0400, 0 },
4373 };
4374
4375 static struct t4_linux_debugfs_entry cxgb4_t7_debugfs_files[] = {
4376 { "trace4", &mps_trc_debugfs_fops, 0600, 4 },
4377 { "trace5", &mps_trc_debugfs_fops, 0600, 5 },
4378 { "trace6", &mps_trc_debugfs_fops, 0600, 6 },
4379 { "trace7", &mps_trc_debugfs_fops, 0600, 7 },
4380 };
4381
4382 if (IS_ERR_OR_NULL(adap->debugfs_root))
4383 return -1;
4384
4385 #ifdef CONFIG_DEBUG_FS
4386 t4_setup_debugfs(adap);
4387 #endif
4388
4389 cxgb4_add_debugfs_files(adap, cxgb4_debugfs_files,
> 4390 ARRAY_SIZE(cxgb4_debugfs_files));--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Potnuri Bharat Teja
maintainerPATCH v4 12/12 cxgb4: select ULD Tx and control queues by TID on T7
In reply to Potnuri Bharat TejaOn T7 adapters with more than one uP core, TIDs are distributed over core groups and a work request carrying a TID must be sent on an egress queue allocated in the core group owning that TID. Firmware reports the TID bits selecting the group through the TID_QID_SEL_MASK device parameter.
- Query TID_QID_SEL_MASK on T7 adapters with multiple cores and add helpers returning the number of core groups and the group of a TID.
- Allocate the shared ULD offload Tx queues of each port round robin over the core groups, passing the group to firmware in FW_EQ_OFLD_CMD, with at least one queue per group and port.
- Add cxgb4_uld_tid_qid_sel_update() and cxgb4_uld_tid_ctrlq_id_sel_update() for ULDs to move a connection's Tx and control queue to the TID's core group once the TID is known. Tx queues of a group are used round robin.
- Send CPL_TID_RELEASE on the control queue of the TID's group. cxgb4_remove_tid() keeps taking a port, so ULDs that do not select queues by TID release TIDs on the right queue as well.
- Control queues are now allocated num_up_cores per port. Route the completions of all of them to the RDMA response queue, stopping at the first failure, and pass num_up_cores to ULDs.
Without TID based queue selection, on T4 - T6 and single core T7, all queues stay in group 0, the number of queues is unchanged and the helpers leave queue indexes unchanged.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 28 +++- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 27 +++- .../net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 140 +++++++++++++++--- .../net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 5 + drivers/net/ethernet/chelsio/cxgb4/sge.c | 14 +- drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 5 + 6 files changed, 186 insertions(+), 33 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +27 -1
@@ -903,6 +903,7 @@ struct sge_uld_txq { /* state for an SGE offload Tx queue */struct tasklet_struct qresume_tsk;/* restarts the queue */ bool service_ofldq_running;/* service_ofldq() is processing sendq */ u8 full;/* the Tx ring is full */ +u8 tid_qid_group_id;/* uP core group of the queue */ unsigned long mapping_err;/* # of I/O MMU packet mapping errors */ }____cacheline_aligned_in_smp ;
@@ -928,6 +929,7 @@ struct sge_uld_txq_info {struct sge_uld_txq *uldtxq;/* Txq's for ULD */ atomic_t users;/* num users */ u16 ntxq;/* # of egress uld queues */ +atomic_t *tid_qid_rr;/* per port, per core group round robin */ };/* struct to maintain ULD list to reallocate ULD resources on hotplug */
@@ -1503,6 +1505,30 @@ struct filter_entry {struct ch_filter_specification fs; }; +static inline unsigned int cxgb4_tid_qid_ngroups (const struct adapter *adap) +{ +if (!adap->params.tid_qid_sel_mask) +return 1 ; +return (adap->params.tid_qid_sel_mask >> + adap->params.tid_qid_sel_shift) +1 ; +} + +static inline unsigned int cxgb4_tid_qid_group (const struct adapter *adap, +u32 tid) +{ +return (tid & adap->params.tid_qid_sel_mask) >> + adap->params.tid_qid_sel_shift; +} + +static inline u16 cxgb4_tid_ctrlq_idx (const struct adapter *adap, +unsigned int port,u32 tid) +{ +if (port >= adap->params.nports) + port =0 ; +return port * adap->params.num_up_cores + +cxgb4_tid_qid_group (adap, tid); +} +static inline int is_offload (const struct adapter *adap) {return adap->params.offload;
@@ -1662,7 +1688,7 @@ int t4_sge_mod_ctrl_txq(struct adapter *adap, unsigned int eqid, unsigned int cmplqid);int t4_sge_alloc_uld_txq (struct adapter *adap,struct sge_uld_txq *txq,struct net_device *dev,unsigned int iqid, -unsigned int uld_type); +unsigned int uld_type,u8 group);int t4_sge_alloc_ethofld_txq (struct adapter *adap,struct sge_eohw_txq *txq,struct net_device *dev,u32 iqid);void t4_sge_free_ethofld_txq (struct adapter *adap,struct sge_eohw_txq *txq);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +22 -5
@@ -1749,13 +1749,15 @@ EXPORT_SYMBOL(cxgb4_free_stid);/* * Populate a TID_RELEASE WR. Caller must properly size the skb. +* @chan is the port whose control queues are used. */ -static void mk_tid_release (struct sk_buff *skb,unsigned int chan, -unsigned int tid) +static void mk_tid_release (const struct adapter *adap,struct sk_buff *skb, +unsigned int chan,unsigned int tid) {struct cpl_tid_release *req; -set_wr_txq (skb,CPL_PRIORITY_SETUP , chan); +set_wr_txq (skb,CPL_PRIORITY_SETUP , +cxgb4_tid_ctrlq_idx (adap, chan, tid)); req =__skb_put (skb,sizeof (*req));INIT_TP_WR (req, tid);OPCODE_TID (req) =htonl (MK_OPCODE_TID (CPL_TID_RELEASE , tid));
@@ -1806,7 +1808,7 @@ static void process_tid_release_list(struct work_struct *work) GFP_KERNEL))) schedule_timeout_uninterruptible(1); -mk_tid_release (skb, chan, p - adap->tids.tid_tab); +mk_tid_release (adap, skb, chan, p - adap->tids.tid_tab);t4_ofld_send (adap, skb);spin_lock_bh (&adap->tid_release_lock); }
@@ -1847,7 +1849,7 @@ void cxgb4_remove_tid(struct tid_info *t, unsigned int chan, unsigned int tid, skb =alloc_skb (sizeof (struct cpl_tid_release ),GFP_ATOMIC );if (likely (skb)) { -mk_tid_release (skb, chan, tid); +mk_tid_release (adap, skb, chan, tid);t4_ofld_send (adap, skb); }else cxgb4_queue_tid_release (t, chan, tid);
@@ -5453,6 +5455,21 @@ static int adap_init0(struct adapter *adap, int vpd_skip) adap->vres.ddp.size = val[4 ] - val[3 ] +1 ; adap->params.ofldq_wr_cred = val[5 ]; +/* On T7 with multiple uP cores, each TID is owned by one core +* group and TID bound work requests must be sent on an egress +* queue of that group. +*/ +if (CHELSIO_CHIP_VERSION (adap->params.chip) >=CHELSIO_T7 && + adap->params.num_up_cores >1 ) { + params[0 ] =FW_PARAM_DEV (TID_QID_SEL_MASK ); + ret =t4_query_params (adap, adap->mbox, adap->pf,0 ,1 , + params, val); +if (!ret && val[0 ]) { + adap->params.tid_qid_sel_mask = val[0 ]; + adap->params.tid_qid_sel_shift =ffs (val[0 ]) -1 ; + } + } +if (caps_cmd.niccaps &htons (FW_CAPS_CONFIG_NIC_HASHFILTER )) {init_hash_filter (adap); }else {
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +118 -22
201 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +5 -0
@@ -433,6 +433,7 @@ struct cxgb4_lld_info {unsigned short nciq;/* # of concentrator IQ */ unsigned char nchan:4; /* # of channels */ unsigned char nports:4; /* # of ports */ +u8 num_up_cores;/* # of control queues per port */ unsigned char wr_cred;/* WR 16-byte credits */ unsigned char adapter_type;/* type of adapter */ unsigned char fw_api_ver;/* FW API version */
@@ -500,6 +501,10 @@ struct cxgb4_uld_info {void cxgb4_uld_enable (struct adapter *adap);void cxgb4_register_uld (enum cxgb4_uld type,const struct cxgb4_uld_info *p);int cxgb4_unregister_uld (enum cxgb4_uld type); +void cxgb4_uld_tid_ctrlq_id_sel_update (struct net_device *dev,u32 tid, +u16 *ctrlq_index); +void cxgb4_uld_tid_qid_sel_update (struct net_device *dev,enum cxgb4_uld uld, +u32 tid,u16 *qid);int cxgb4_ofld_send (struct net_device *dev,struct sk_buff *skb);int cxgb4_immdata_send (struct net_device *dev,unsigned int idx,const void *src,unsigned int len);
drivers/net/ethernet/chelsio/cxgb4/sge.c +9 -5
@@ -4779,7 +4779,8 @@ int t4_sge_mod_ctrl_txq(struct adapter *adap, unsigned int eqid, }static int t4_sge_alloc_ofld_txq (struct adapter *adap,struct sge_txq *q, -struct net_device *dev,u32 cmd,u32 iqid) +struct net_device *dev,u32 cmd,u32 iqid, +u8 group) {unsigned int chip_ver =CHELSIO_CHIP_VERSION (adap->params.chip);struct port_info *pi =netdev_priv (dev);
@@ -4807,7 +4808,8 @@ static int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_txq *q,FW_EQ_OFLD_CMD_PFN_V (adap->pf) | FW_EQ_OFLD_CMD_VFN_V(0)); c.alloc_to_len16 =htonl (FW_EQ_OFLD_CMD_ALLOC_F | -FW_EQ_OFLD_CMD_EQSTART_F |FW_LEN16 (c)); +FW_EQ_OFLD_CMD_EQSTART_F | +FW_EQ_OFLD_CMD_COREGROUP_V (group) |FW_LEN16 (c)); c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE_V(HOSTFCMODE_STATUS_PAGE_X) | FW_EQ_OFLD_CMD_PCIECHN_V(pi->tx_chan) |
@@ -4836,7 +4838,7 @@ static int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_txq *q,int t4_sge_alloc_uld_txq (struct adapter *adap,struct sge_uld_txq *txq,struct net_device *dev,unsigned int iqid, -unsigned int uld_type) +unsigned int uld_type,u8 group) {u32 cmd =FW_EQ_OFLD_CMD ;int ret;
@@ -4844,7 +4846,7 @@ int t4_sge_alloc_uld_txq(struct adapter *adap, struct sge_uld_txq *txq,if (unlikely (uld_type ==CXGB4_TX_CRYPTO )) cmd =FW_EQ_CTRL_CMD ; - ret =t4_sge_alloc_ofld_txq (adap, &txq->q, dev, cmd, iqid); + ret =t4_sge_alloc_ofld_txq (adap, &txq->q, dev, cmd, iqid, group);if (ret)return ret;
@@ -4853,6 +4855,7 @@ int t4_sge_alloc_uld_txq(struct adapter *adap, struct sge_uld_txq *txq,skb_queue_head_init (&txq->sendq);tasklet_setup (&txq->qresume_tsk, restart_ofldq); txq->full =0 ; + txq->tid_qid_group_id = group; txq->mapping_err =0 ;return 0 ; }
@@ -4862,7 +4865,8 @@ int t4_sge_alloc_ethofld_txq(struct adapter *adap, struct sge_eohw_txq *txq, {int ret; - ret =t4_sge_alloc_ofld_txq (adap, &txq->q, dev,FW_EQ_OFLD_CMD , iqid); + ret =t4_sge_alloc_ofld_txq (adap, &txq->q, dev,FW_EQ_OFLD_CMD , iqid, +0 );if (ret)return ret;
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +5 -0
@@ -1346,6 +1346,7 @@ enum fw_params_param_dev {FW_PARAMS_PARAM_DEV_NUM_TM_CLASS =0x2B ,FW_PARAMS_PARAM_DEV_FILTER =0x2E ,FW_PARAMS_PARAM_DEV_KTLS_HW =0x31 , + FW_PARAMS_PARAM_DEV_TID_QID_SEL_MASK = 0x33, };/*
@@ -2139,6 +2140,10 @@ struct fw_eq_ofld_cmd {#define FW_EQ_OFLD_CMD_EQSTART_V (x) ((x) << FW_EQ_OFLD_CMD_EQSTART_S)#define FW_EQ_OFLD_CMD_EQSTART_F FW_EQ_OFLD_CMD_EQSTART_V(1U) +#define FW_EQ_OFLD_CMD_COREGROUP_S 16 +#define FW_EQ_OFLD_CMD_COREGROUP_M 0x3f +#define FW_EQ_OFLD_CMD_COREGROUP_V (x) ((x) << FW_EQ_OFLD_CMD_COREGROUP_S) +#define FW_EQ_OFLD_CMD_EQSTOP_S 27#define FW_EQ_OFLD_CMD_EQSTOP_V (x) ((x) << FW_EQ_OFLD_CMD_EQSTOP_S)#define FW_EQ_OFLD_CMD_EQSTOP_F FW_EQ_OFLD_CMD_EQSTOP_V(1U)
Signature · 1 line
2.39.1