cxgb4: add support to get hardware debug logs via ethtool
Subsystems (3)
v2 cover cxgb4: add support to get hardware debug logs via ethtool
This series of patches add support to collect hardware debug logs via ethtool --get-dump facility.
Currently supports:
Memory dumps - Collects on-chip EDC0 and EDC1 dumps. Hardware dumps - Collects firmware and hardware dumps.
Patch 1 adds ethtool set/get dump data. It also adds template header that precedes dump data. This template header gives additional information needed for extracting and decoding the collected dump data.
Patch 2 adds base to collect dumps. Also collects regdump.
Patch 3 collects on-chip EDC0 and EDC1 memory dumps.
Patch 4 collects firmware mbox log and device log.
Patch 5 updates base API for accessing TP indirect registers.
Patch 6 collects hardware TP module dump.
Patch 7 collects hardware SGE, PCIE, PM, UP CIM, MA, and HMA module dumps.
Patch 8 collects hardware IBQ and OBQ dump.
Thanks,
Rahul
---
v2:
- Prefix symbols that pollute global namespace in files starting with cxgb4_* with "cxgb4_"
- Prefix symbols that pollute global namespace in files starting with cudbg_* with "cudbg_"
- Make cudbg_collect_mem_info() static.
Rahul Lakkireddy (8):
cxgb4: implement ethtool dump data operations
cxgb4: collect register dump
cxgb4: collect on-chip memory dump
cxgb4: collect firmware mbox and device log dump
cxgb4: update API for TP indirect register access
cxgb4: collect TP dump
cxgb4: collect hardware module dumps
cxgb4: collect IBQ and OBQ dumps
drivers/net/ethernet/chelsio/cxgb4/Makefile | 3 +- drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c | 54 ++ drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h | 181 +++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 69 ++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 867 +++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h | 103 +++ .../net/ethernet/chelsio/cxgb4/cudbg_lib_common.h | 81 ++ drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 41 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 296 +++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h | 44 ++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 13 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 70 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 7 +- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 332 +++++--- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 2 + 15 files changed, 2021 insertions(+), 142 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h
Signature · 1 line
2.14.1
PATCH v2 1/8 cxgb4: implement ethtool dump data operations
Implement operations to set/get dump data via ethtool. Also add template header that precedes dump data, which helps in decoding and extracting the dump data.
---
v2:
- Renamed init_ethtool_dump() to cxgb4_init_ethtool_dump().
drivers/net/ethernet/chelsio/cxgb4/Makefile | 2 +- drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 33 ++++++++++ .../net/ethernet/chelsio/cxgb4/cudbg_lib_common.h | 65 +++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 3 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 73 ++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h | 32 ++++++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 56 ++++++++++++++++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 3 + 8 files changed, 265 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h
drivers/net/ethernet/chelsio/cxgb4/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-$(CONFIG_CHELSIO_T4) += cxgb4.o cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o \ cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \ - cxgb4_ptp.o cxgb4_tc_flower.o + cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.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/cudbg_if.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright (C) 2017 Chelsio Communications. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* The full GNU General Public License is included in this distribution in +* the file called "COPYING". +* +*/ + +#ifndef __CUDBG_IF_H__ +#define __CUDBG_IF_H__ + +#define CUDBG_MAJOR_VERSION 1 +#define CUDBG_MINOR_VERSION 14 + +enum cudbg_dbg_entity_type { +CUDBG_MAX_ENTITY =70 , +}; + +struct cudbg_init { +struct adapter *adap;/* Pointer to adapter structure */ +void *outbuf;/* Output buffer */ +u32 outbuf_size;/* Output buffer size */ +}; +#endif /* __CUDBG_IF_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h new file +65 -0
65 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +3 -0
@@ -909,6 +909,9 @@ struct adapter {/* TC flower offload */ DECLARE_HASHTABLE (flower_anymatch_tbl,9 );struct timer_list flower_stats_timer; + +/* Ethtool Dump */ +struct ethtool_dump eth_dump; };/* Support for "sched-class" command to allow a TX Scheduling Class to be
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c new file +73 -0
73 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright (C) 2017 Chelsio Communications. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* The full GNU General Public License is included in this distribution in +* the file called "COPYING". +* +*/ + +#ifndef __CXGB4_CUDBG_H__ +#define __CXGB4_CUDBG_H__ + +#include "cudbg_if.h" +#include "cudbg_lib_common.h" + +enum CXGB4_ETHTOOL_DUMP_FLAGS { +CXGB4_ETH_DUMP_NONE =ETH_FW_DUMP_DISABLE , +}; + +u32 cxgb4_get_dump_length (struct adapter *adap,u32 flag); +int cxgb4_cudbg_collect (struct adapter *adap,void *buf,u32 *buf_size, +u32 flag); +void cxgb4_init_ethtool_dump (struct adapter *adapter); +#endif /* __CXGB4_CUDBG_H__ */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +55 -1
74 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +3 -0
@@ -81,6 +81,7 @@#include "cxgb4_tc_u32.h" #include "cxgb4_tc_flower.h" #include "cxgb4_ptp.h" +#include "cxgb4_cudbg.h" char cxgb4_driver_name[] =KBUILD_MODNAME ;
@@ -5035,6 +5036,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)cxgb4_set_ethtool_ops (netdev); } +cxgb4_init_ethtool_dump (adapter); +pci_set_drvdata (pdev, adapter);if (adapter->flags &FW_OK ) {
Signature · 1 line
2.14.1
PATCH v2 2/8 cxgb4: collect register dump
In reply to Rahul LakkireddyAdd base to collect dump entities. Collect register dump and update template header accordingly.
---
v2:
- Prefix symbols in cxgb4_*.c files with cxgb4_
- Prefix symbols in cudbg_* files with cudbg_
drivers/net/ethernet/chelsio/cxgb4/Makefile | 3 +- drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c | 54 +++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 5 ++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 79 ++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h | 28 +++++++ .../net/ethernet/chelsio/cxgb4/cudbg_lib_common.h | 13 +++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 94 +++++++++++++++++++++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h | 11 +++ 8 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h
drivers/net/ethernet/chelsio/cxgb4/Makefile +2 -1
@@ -6,7 +6,8 @@ obj-$(CONFIG_CHELSIO_T4) += cxgb4.o cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o \ cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \ - cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.o + cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.o \ + cudbg_common.o cudbg_lib.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/cudbg_common.c new file +54 -0
54 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +5 -0
@@ -18,10 +18,15 @@#ifndef __CUDBG_IF_H__#define __CUDBG_IF_H__ +/* Error codes */ +#define CUDBG_STATUS_NO_MEM -19 +#define CUDBG_SYSTEM_ERROR -29 +#define CUDBG_MAJOR_VERSION 1#define CUDBG_MINOR_VERSION 14enum cudbg_dbg_entity_type { +CUDBG_REG_DUMP =1 ,CUDBG_MAX_ENTITY =70 , };
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c new file +79 -0
79 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright (C) 2017 Chelsio Communications. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* The full GNU General Public License is included in this distribution in +* the file called "COPYING". +* +*/ + +#ifndef __CUDBG_LIB_H__ +#define __CUDBG_LIB_H__ + +int cudbg_collect_reg_dump (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err); + +struct cudbg_entity_hdr *cudbg_get_entity_hdr (void *outbuf,int i); +void cudbg_align_debug_buffer (struct cudbg_buffer *dbg_buff, +struct cudbg_entity_hdr *entity_hdr); +#endif /* __CUDBG_LIB_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h +13 -0
@@ -62,4 +62,17 @@ struct cudbg_buffer {u32 offset; char *data; }; + +struct cudbg_error { +int sys_err; +int sys_warn; +int app_err; +}; + +int cudbg_get_buff (struct cudbg_buffer *pdbg_buff,u32 size, +struct cudbg_buffer *pin_buff); +void cudbg_put_buff (struct cudbg_buffer *pin_buff, +struct cudbg_buffer *pdbg_buff); +void cudbg_update_buff (struct cudbg_buffer *pin_buff, +struct cudbg_buffer *pout_buff);#endif /* __CUDBG_LIB_COMMON_H__ */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +93 -1
108 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h +11 -0
@@ -20,9 +20,20 @@#include "cudbg_if.h" #include "cudbg_lib_common.h" +#include "cudbg_lib.h" + +typedef int (*cudbg_collect_callback_t )(struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err); + +struct cxgb4_collect_entity { +enum cudbg_dbg_entity_type entity; +cudbg_collect_callback_t collect_cb; +};enum CXGB4_ETHTOOL_DUMP_FLAGS {CXGB4_ETH_DUMP_NONE =ETH_FW_DUMP_DISABLE , +CXGB4_ETH_DUMP_HW = (1 <<1 ),/* various FW and HW dumps */ };u32 cxgb4_get_dump_length (struct adapter *adap,u32 flag);
Signature · 1 line
2.14.1
PATCH v2 3/8 cxgb4: collect on-chip memory dump
In reply to Rahul LakkireddyCollect EDC0 and EDC1 memory dump.
---
v2:
- Prefix symbols in cxgb4_*.c files with cxgb4_
- Prefix symbols in cudbg_* files with cudbg_
- Make cudbg_collect_mem_info() static.
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h | 29 +++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 8 ++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 136 +++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h | 6 + .../net/ethernet/chelsio/cxgb4/cudbg_lib_common.h | 3 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 38 +++++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h | 1 + 7 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (C) 2017 Chelsio Communications. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* The full GNU General Public License is included in this distribution in +* the file called "COPYING". +* +*/ + +#ifndef __CUDBG_ENTITY_H__ +#define __CUDBG_ENTITY_H__ + +#define EDC0_FLAG 3 +#define EDC1_FLAG 4 + +struct card_mem { +u16 size_edc0; +u16 size_edc1; +u16 mem_flag; +}; +#endif /* __CUDBG_ENTITY_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +8 -0
@@ -20,6 +20,7 @@/* Error codes */ #define CUDBG_STATUS_NO_MEM -19 +#define CUDBG_STATUS_ENTITY_NOT_FOUND -24#define CUDBG_SYSTEM_ERROR -29#define CUDBG_MAJOR_VERSION 1
@@ -27,6 +28,8 @@enum cudbg_dbg_entity_type {CUDBG_REG_DUMP =1 , +CUDBG_EDC0 =18 , +CUDBG_EDC1 =19 ,CUDBG_MAX_ENTITY =70 , };
@@ -35,4 +38,9 @@ struct cudbg_init {void *outbuf;/* Output buffer */ u32 outbuf_size; /* Output buffer size */ }; + +static inline unsigned int cudbg_mbytes_to_bytes (unsigned int size) +{ +return size *1024 *1024 ; +}#endif /* __CUDBG_IF_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +136 -0
155 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h +6 -0
@@ -21,6 +21,12 @@int cudbg_collect_reg_dump (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err); +int cudbg_collect_edc0_meminfo (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err); +int cudbg_collect_edc1_meminfo (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err);struct cudbg_entity_hdr *cudbg_get_entity_hdr (void *outbuf,int i); void cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff,
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h +3 -0
@@ -69,6 +69,9 @@ struct cudbg_error {int app_err; }; +#define CDUMP_MAX_COMP_BUF_SIZE ((64 * 1024) - 1) +#define CUDBG_CHUNK_SIZE ((CDUMP_MAX_COMP_BUF_SIZE / 1024) * 1024) +int cudbg_get_buff (struct cudbg_buffer *pdbg_buff,u32 size,struct cudbg_buffer *pin_buff); void cudbg_put_buff(struct cudbg_buffer *pin_buff,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +37 -1
@@ -15,16 +15,22 @@* */ +#include "t4_regs.h" #include "cxgb4.h" #include "cxgb4_cudbg.h" +static const struct cxgb4_collect_entity cxgb4_collect_mem_dump[] = { + {CUDBG_EDC0 , cudbg_collect_edc0_meminfo }, + {CUDBG_EDC1 , cudbg_collect_edc1_meminfo }, +}; +static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = { {CUDBG_REG_DUMP , cudbg_collect_reg_dump }, };static u32 cxgb4_get_entity_length (struct adapter *adap,u32 entity) { -u32 len =0 ; +u32 value, len =0 ;switch (entity) {case CUDBG_REG_DUMP :
@@ -40,6 +46,22 @@ static u32 cxgb4_get_entity_length(struct adapter *adap, u32 entity)break ; }break ; +case CUDBG_EDC0 : + value =t4_read_reg (adap,MA_TARGET_MEM_ENABLE_A ); +if (value &EDRAM0_ENABLE_F ) { + value =t4_read_reg (adap,MA_EDRAM0_BAR_A ); + len =EDRAM0_SIZE_G (value); + } + len =cudbg_mbytes_to_bytes (len); +break ; +case CUDBG_EDC1 : + value =t4_read_reg (adap,MA_TARGET_MEM_ENABLE_A ); +if (value &EDRAM1_ENABLE_F ) { + value =t4_read_reg (adap,MA_EDRAM1_BAR_A ); + len =EDRAM1_SIZE_G (value); + } + len =cudbg_mbytes_to_bytes (len); +break ;default :break ; }
@@ -59,6 +81,13 @@ u32 cxgb4_get_dump_length(struct adapter *adap, u32 flag) } } +if (flag &CXGB4_ETH_DUMP_MEM ) { +for (i =0 ; i <ARRAY_SIZE (cxgb4_collect_mem_dump); i++) { + entity = cxgb4_collect_mem_dump[i].entity; + len +=cxgb4_get_entity_length (adap, entity); + } + } +return len; }
@@ -152,6 +181,13 @@ int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size, buf, &total_size); +if (flag &CXGB4_ETH_DUMP_MEM ) +cxgb4_cudbg_collect_entity (&cudbg_init, &dbg_buff, + cxgb4_collect_mem_dump, +ARRAY_SIZE (cxgb4_collect_mem_dump), + buf, + &total_size); + cudbg_hdr->data_len = total_size; *buf_size = total_size;return 0 ;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h +1 -0
@@ -33,6 +33,7 @@ struct cxgb4_collect_entity {enum CXGB4_ETHTOOL_DUMP_FLAGS {CXGB4_ETH_DUMP_NONE =ETH_FW_DUMP_DISABLE , +CXGB4_ETH_DUMP_MEM = (1 <<0 ),/* On-Chip Memory Dumps */ CXGB4_ETH_DUMP_HW = (1 <<1 ),/* various FW and HW dumps */ };
Signature · 1 line
2.14.1
PATCH v2 4/8 cxgb4: collect firmware mbox and device log dump
In reply to Rahul LakkireddyCollect firmware mbox and device logs before collecting the rest of the hardware dumps to snap the firmware state before the mailbox logs are updated by other hardware dumps.
---
v2:
- Prefix symbols in cudbg_* files with cudbg_
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h | 6 ++ drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 2 + drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 84 +++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h | 6 ++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 9 +++ 5 files changed, 107 insertions(+)
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h +6 -0
@@ -26,4 +26,10 @@ struct card_mem {u16 size_edc1; u16 mem_flag; }; + +struct cudbg_mbox_log { +struct mbox_cmd entry; +u32 hi[MBOX_LEN /8 ]; +u32 lo[MBOX_LEN /8 ]; +};#endif /* __CUDBG_ENTITY_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +2 -0
@@ -28,8 +28,10 @@enum cudbg_dbg_entity_type {CUDBG_REG_DUMP =1 , +CUDBG_DEV_LOG =2 ,CUDBG_EDC0 =18 ,CUDBG_EDC1 =19 , +CUDBG_MBOX_LOG =66 ,CUDBG_MAX_ENTITY =70 , };
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +84 -0
93 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h +6 -0
@@ -21,12 +21,18 @@int cudbg_collect_reg_dump (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err); +int cudbg_collect_fw_devlog (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err);int cudbg_collect_edc0_meminfo (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err);int cudbg_collect_edc1_meminfo (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err); +int cudbg_collect_mbox_log (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err);struct cudbg_entity_hdr *cudbg_get_entity_hdr (void *outbuf,int i); void cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +9 -0
@@ -18,6 +18,7 @@#include "t4_regs.h" #include "cxgb4.h" #include "cxgb4_cudbg.h" +#include "cudbg_entity.h" static const struct cxgb4_collect_entity cxgb4_collect_mem_dump[] = { {CUDBG_EDC0 , cudbg_collect_edc0_meminfo },
@@ -25,6 +26,8 @@ static const struct cxgb4_collect_entity cxgb4_collect_mem_dump[] = { };static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = { + {CUDBG_MBOX_LOG , cudbg_collect_mbox_log }, + {CUDBG_DEV_LOG , cudbg_collect_fw_devlog }, {CUDBG_REG_DUMP , cudbg_collect_reg_dump }, };
@@ -46,6 +49,9 @@ static u32 cxgb4_get_entity_length(struct adapter *adap, u32 entity)break ; }break ; +case CUDBG_DEV_LOG : + len = adap->params.devlog.size; +break ;case CUDBG_EDC0 : value =t4_read_reg (adap,MA_TARGET_MEM_ENABLE_A );if (value &EDRAM0_ENABLE_F ) {
@@ -62,6 +68,9 @@ static u32 cxgb4_get_entity_length(struct adapter *adap, u32 entity) } len =cudbg_mbytes_to_bytes (len);break ; +case CUDBG_MBOX_LOG : + len =sizeof (struct cudbg_mbox_log ) * adap->mbox_log->size; +break ;default :break ; }
Signature · 1 line
2.14.1
PATCH v2 5/8 cxgb4: update API for TP indirect register access
In reply to Rahul LakkireddyTry to access TP indirect registers via firmware first. If this fails, fallback and access them directly. This ensures that driver and firmware do not conflict each other while accessing the TP indirect registers.
---
v2:
- No changes.
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 36 ++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 13 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 14 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 +- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 312 +++++++++++++-------- 5 files changed, 239 insertions(+), 140 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +23 -13
@@ -1459,7 +1459,7 @@ unsigned int qtimer_val(const struct adapter *adap,int t4_init_devlog_params (struct adapter *adapter);int t4_init_sge_params (struct adapter *adapter); -int t4_init_tp_params (struct adapter *adap); +int t4_init_tp_params (struct adapter *adap,bool sleep_ok);int t4_filter_field_shift (const struct adapter *adap,int filter_sel);int t4_init_rss_mode (struct adapter *adap,int mbox); int t4_init_portinfo(struct port_info *pi, int mbox,
@@ -1473,14 +1473,15 @@ int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode,int t4_config_vi_rss (struct adapter *adapter,int mbox,unsigned int viid,unsigned int flags,unsigned int defq);int t4_read_rss (struct adapter *adapter,u16 *entries); -void t4_read_rss_key (struct adapter *adapter,u32 *key); -void t4_write_rss_key (struct adapter *adap,const u32 *key,int idx); +void t4_read_rss_key (struct adapter *adapter,u32 *key,bool sleep_ok); +void t4_write_rss_key (struct adapter *adap,const u32 *key,int idx, +bool sleep_ok);void t4_read_rss_pf_config (struct adapter *adapter,unsigned int index, -u32 *valp); +u32 *valp,bool sleep_ok);void t4_read_rss_vf_config (struct adapter *adapter,unsigned int index, -u32 *vfl,u32 *vfh); -u32 t4_read_rss_pf_map (struct adapter *adapter); -u32 t4_read_rss_pf_mask (struct adapter *adapter); +u32 *vfl,u32 *vfh,bool sleep_ok); +u32 t4_read_rss_pf_map (struct adapter *adapter,bool sleep_ok); +u32 t4_read_rss_pf_mask (struct adapter *adapter,bool sleep_ok);unsigned int t4_get_mps_bg_map (struct adapter *adapter,int pidx);unsigned int t4_get_tp_ch_map (struct adapter *adapter,int pidx);
@@ -1511,14 +1512,18 @@ void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]);void t4_tp_wr_bits_indirect (struct adapter *adap,unsigned int addr,unsigned int mask,unsigned int val);void t4_tp_read_la (struct adapter *adap,u64 *la_buf,unsigned int *wrptr); -void t4_tp_get_err_stats (struct adapter *adap,struct tp_err_stats *st); -void t4_tp_get_cpl_stats (struct adapter *adap,struct tp_cpl_stats *st); -void t4_tp_get_rdma_stats (struct adapter *adap,struct tp_rdma_stats *st); -void t4_get_usm_stats (struct adapter *adap,struct tp_usm_stats *st); +void t4_tp_get_err_stats (struct adapter *adap,struct tp_err_stats *st, +bool sleep_ok); +void t4_tp_get_cpl_stats (struct adapter *adap,struct tp_cpl_stats *st, +bool sleep_ok); +void t4_tp_get_rdma_stats (struct adapter *adap,struct tp_rdma_stats *st, +bool sleep_ok); +void t4_get_usm_stats (struct adapter *adap,struct tp_usm_stats *st, +bool sleep_ok);void t4_tp_get_tcp_stats (struct adapter *adap,struct tp_tcp_stats *v4, -struct tp_tcp_stats *v6); +struct tp_tcp_stats *v6,bool sleep_ok);void t4_get_fcoe_stats (struct adapter *adap,unsigned int idx, -struct tp_fcoe_stats *st); +struct tp_fcoe_stats *st,bool sleep_ok);void t4_load_mtus (struct adapter *adap,const unsigned short *mtus,const unsigned short *alpha,const unsigned short *beta);
@@ -1627,6 +1632,11 @@ void t4_idma_monitor(struct adapter *adapter, int hz, int ticks);int t4_set_vf_mac_acl (struct adapter *adapter,unsigned int vf,unsigned int naddr,u8 *addr); +void t4_tp_pio_read (struct adapter *adap,u32 *buff,u32 nregs, +u32 start_index,bool sleep_ok); +void t4_tp_mib_read (struct adapter *adap,u32 *buff,u32 nregs, +u32 start_index,bool sleep_ok); +void t4_uld_mem_free (struct adapter *adap);int t4_uld_mem_alloc (struct adapter *adap);void t4_uld_clean_up (struct adapter *adap);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +7 -6
@@ -2211,7 +2211,7 @@ static int rss_key_show(struct seq_file *seq, void *v) {u32 key[10 ]; -t4_read_rss_key (seq->private, key); +t4_read_rss_key (seq->private, key, true);seq_printf (seq,"%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x\n" , key[9 ], key[8 ], key[7 ], key[6 ], key[5 ], key[4 ], key[3 ], key[2 ], key[1 ], key[0 ]);
@@ -2248,7 +2248,7 @@ static ssize_t rss_key_write(struct file *file, const char __user *buf, } } -t4_write_rss_key (adap, key,-1 ); +t4_write_rss_key (adap, key,-1 , true);return count; }
@@ -2325,12 +2325,13 @@ static int rss_pf_config_open(struct inode *inode, struct file *file)return -ENOMEM ; pfconf = (struct rss_pf_conf *)p->data; - rss_pf_map =t4_read_rss_pf_map (adapter); - rss_pf_mask =t4_read_rss_pf_mask (adapter); + rss_pf_map =t4_read_rss_pf_map (adapter, true); + rss_pf_mask =t4_read_rss_pf_mask (adapter, true);for (pf =0 ; pf <8 ; pf++) { pfconf[pf].rss_pf_map = rss_pf_map; pfconf[pf].rss_pf_mask = rss_pf_mask; -t4_read_rss_pf_config (adapter, pf, &pfconf[pf].rss_pf_config); +t4_read_rss_pf_config (adapter, pf, &pfconf[pf].rss_pf_config, + true); }return 0 ; }
@@ -2393,7 +2394,7 @@ static int rss_vf_config_open(struct inode *inode, struct file *file) vfconf = (struct rss_vf_conf *)p->data;for (vf =0 ; vf < vfcount; vf++) {t4_read_rss_vf_config (adapter, vf, &vfconf[vf].rss_vf_vfl, - &vfconf[vf].rss_vf_vfh); + &vfconf[vf].rss_vf_vfh, true); }return 0 ; }
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +7 -7
@@ -336,10 +336,10 @@ static void collect_adapter_stats(struct adapter *adap, struct adapter_stats *s)memset (s,0 ,sizeof (*s));spin_lock (&adap->stats_lock); -t4_tp_get_tcp_stats (adap, &v4, &v6); -t4_tp_get_rdma_stats (adap, &rdma_stats); -t4_get_usm_stats (adap, &usm_stats); -t4_tp_get_err_stats (adap, &err_stats); +t4_tp_get_tcp_stats (adap, &v4, &v6, false); +t4_tp_get_rdma_stats (adap, &rdma_stats, false); +t4_get_usm_stats (adap, &usm_stats, false); +t4_tp_get_err_stats (adap, &err_stats, false);spin_unlock (&adap->stats_lock); s->db_drop = adap->db_stats.db_drop;
@@ -389,9 +389,9 @@ static void collect_channel_stats(struct adapter *adap, struct channel_stats *s,memset (s,0 ,sizeof (*s));spin_lock (&adap->stats_lock); -t4_tp_get_cpl_stats (adap, &cpl_stats); -t4_tp_get_err_stats (adap, &err_stats); -t4_get_fcoe_stats (adap, i, &fcoe_stats); +t4_tp_get_cpl_stats (adap, &cpl_stats, false); +t4_tp_get_err_stats (adap, &err_stats, false); +t4_get_fcoe_stats (adap, i, &fcoe_stats, false);spin_unlock (&adap->stats_lock); s->cpl_req = cpl_stats.req[i];
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +2 -2
@@ -1639,7 +1639,7 @@ void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4,struct adapter *adap =pci_get_drvdata (pdev);spin_lock (&adap->stats_lock); -t4_tp_get_tcp_stats (adap, v4, v6); +t4_tp_get_tcp_stats (adap, v4, v6, false);spin_unlock (&adap->stats_lock); }EXPORT_SYMBOL (cxgb4_get_tcp_stats);
@@ -4077,7 +4077,7 @@ static int adap_init0(struct adapter *adap) }t4_init_sge_params (adap); adap->flags |=FW_OK ; -t4_init_tp_params (adap); +t4_init_tp_params (adap, true);return 0 ;/*
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +200 -112
508 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH v2 6/8 cxgb4: collect TP dump
In reply to Rahul Lakkireddy---
v2:
- Prefix symbols in cudbg_* files with cudbg_
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h | 72 ++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 1 + drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 114 ++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h | 3 + drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 2 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 21 +++- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 20 ++++ drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 2 + 8 files changed, 234 insertions(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h +72 -0
@@ -32,4 +32,76 @@ struct cudbg_mbox_log {u32 hi[MBOX_LEN /8 ];u32 lo[MBOX_LEN /8 ]; }; + +struct ireg_field { +u32 ireg_addr; +u32 ireg_data; +u32 ireg_local_offset; +u32 ireg_offset_range; +}; + +struct ireg_buf { +struct ireg_field tp_pio; +u32 outbuf[32 ]; +}; + +#define IREG_NUM_ELEM 4 + +static const u32 t6_tp_pio_array[][IREG_NUM_ELEM ] = { + {0x7e40 ,0x7e44 ,0x020 ,28 },/* t6_tp_pio_regs_20_to_3b */ + {0x7e40 ,0x7e44 ,0x040 ,10 },/* t6_tp_pio_regs_40_to_49 */ + {0x7e40 ,0x7e44 ,0x050 ,10 },/* t6_tp_pio_regs_50_to_59 */ + {0x7e40 ,0x7e44 ,0x060 ,14 },/* t6_tp_pio_regs_60_to_6d */ + {0x7e40 ,0x7e44 ,0x06F ,1 },/* t6_tp_pio_regs_6f */ + {0x7e40 ,0x7e44 ,0x070 ,6 },/* t6_tp_pio_regs_70_to_75 */ + {0x7e40 ,0x7e44 ,0x130 ,18 },/* t6_tp_pio_regs_130_to_141 */ + {0x7e40 ,0x7e44 ,0x145 ,19 },/* t6_tp_pio_regs_145_to_157 */ + {0x7e40 ,0x7e44 ,0x160 ,1 },/* t6_tp_pio_regs_160 */ + {0x7e40 ,0x7e44 ,0x230 ,25 },/* t6_tp_pio_regs_230_to_248 */ + {0x7e40 ,0x7e44 ,0x24a ,3 },/* t6_tp_pio_regs_24c */ + {0x7e40 ,0x7e44 ,0x8C0 ,1 }/* t6_tp_pio_regs_8c0 */ +}; + +static const u32 t5_tp_pio_array[][IREG_NUM_ELEM ] = { + {0x7e40 ,0x7e44 ,0x020 ,28 },/* t5_tp_pio_regs_20_to_3b */ + {0x7e40 ,0x7e44 ,0x040 ,19 },/* t5_tp_pio_regs_40_to_52 */ + {0x7e40 ,0x7e44 ,0x054 ,2 },/* t5_tp_pio_regs_54_to_55 */ + {0x7e40 ,0x7e44 ,0x060 ,13 },/* t5_tp_pio_regs_60_to_6c */ + {0x7e40 ,0x7e44 ,0x06F ,1 },/* t5_tp_pio_regs_6f */ + {0x7e40 ,0x7e44 ,0x120 ,4 },/* t5_tp_pio_regs_120_to_123 */ + {0x7e40 ,0x7e44 ,0x12b ,2 },/* t5_tp_pio_regs_12b_to_12c */ + {0x7e40 ,0x7e44 ,0x12f ,21 },/* t5_tp_pio_regs_12f_to_143 */ + {0x7e40 ,0x7e44 ,0x145 ,19 },/* t5_tp_pio_regs_145_to_157 */ + {0x7e40 ,0x7e44 ,0x230 ,25 },/* t5_tp_pio_regs_230_to_248 */ + {0x7e40 ,0x7e44 ,0x8C0 ,1 }/* t5_tp_pio_regs_8c0 */ +}; + +static const u32 t6_tp_tm_pio_array[][IREG_NUM_ELEM ] = { + {0x7e18 ,0x7e1c ,0x0 ,12 } +}; + +static const u32 t5_tp_tm_pio_array[][IREG_NUM_ELEM ] = { + {0x7e18 ,0x7e1c ,0x0 ,12 } +}; + +static const u32 t6_tp_mib_index_array[6 ][IREG_NUM_ELEM ] = { + {0x7e50 ,0x7e54 ,0x0 ,13 }, + {0x7e50 ,0x7e54 ,0x10 ,6 }, + {0x7e50 ,0x7e54 ,0x18 ,21 }, + {0x7e50 ,0x7e54 ,0x30 ,32 }, + {0x7e50 ,0x7e54 ,0x50 ,22 }, + {0x7e50 ,0x7e54 ,0x68 ,12 } +}; + +static const u32 t5_tp_mib_index_array[9 ][IREG_NUM_ELEM ] = { + {0x7e50 ,0x7e54 ,0x0 ,13 }, + {0x7e50 ,0x7e54 ,0x10 ,6 }, + {0x7e50 ,0x7e54 ,0x18 ,8 }, + {0x7e50 ,0x7e54 ,0x20 ,13 }, + {0x7e50 ,0x7e54 ,0x30 ,16 }, + {0x7e50 ,0x7e54 ,0x40 ,16 }, + {0x7e50 ,0x7e54 ,0x50 ,16 }, + {0x7e50 ,0x7e54 ,0x60 ,6 }, + {0x7e50 ,0x7e54 ,0x68 ,4 } +};#endif /* __CUDBG_ENTITY_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +1 -0
@@ -31,6 +31,7 @@ enum cudbg_dbg_entity_type {CUDBG_DEV_LOG =2 ,CUDBG_EDC0 =18 ,CUDBG_EDC1 =19 , +CUDBG_TP_INDIRECT =36 ,CUDBG_MBOX_LOG =66 , CUDBG_MAX_ENTITY = 70, };
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +114 -0
120 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h +3 -0
@@ -30,6 +30,9 @@ int cudbg_collect_edc0_meminfo(struct cudbg_init *pdbg_init,int cudbg_collect_edc1_meminfo (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err); +int cudbg_collect_tp_indirect (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err);int cudbg_collect_mbox_log (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err);
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +2 -0
@@ -1634,6 +1634,8 @@ int t4_set_vf_mac_acl(struct adapter *adapter, unsigned int vf, unsigned int naddr, u8 *addr);void t4_tp_pio_read (struct adapter *adap,u32 *buff,u32 nregs,u32 start_index,bool sleep_ok); +void t4_tp_tm_pio_read (struct adapter *adap,u32 *buff,u32 nregs, +u32 start_index,bool sleep_ok);void t4_tp_mib_read (struct adapter *adap,u32 *buff,u32 nregs,u32 start_index,bool sleep_ok);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +20 -1
@@ -29,11 +29,12 @@ static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = { { CUDBG_MBOX_LOG, cudbg_collect_mbox_log }, { CUDBG_DEV_LOG, cudbg_collect_fw_devlog }, { CUDBG_REG_DUMP, cudbg_collect_reg_dump }, + { CUDBG_TP_INDIRECT, cudbg_collect_tp_indirect }, };static u32 cxgb4_get_entity_length (struct adapter *adap,u32 entity) { -u32 value, len =0 ; +u32 value, n =0 , len =0 ;switch (entity) {case CUDBG_REG_DUMP :
@@ -68,6 +69,24 @@ static u32 cxgb4_get_entity_length(struct adapter *adap, u32 entity) } len =cudbg_mbytes_to_bytes (len);break ; +case CUDBG_TP_INDIRECT : +switch (CHELSIO_CHIP_VERSION (adap->params.chip)) { +case CHELSIO_T5 : + n =sizeof (t5_tp_pio_array) + +sizeof (t5_tp_tm_pio_array) + +sizeof (t5_tp_mib_index_array); +break ; +case CHELSIO_T6 : + n =sizeof (t6_tp_pio_array) + +sizeof (t6_tp_tm_pio_array) + +sizeof (t6_tp_mib_index_array); +break ; +default : +break ; + } + n = n / (IREG_NUM_ELEM *sizeof (u32)); + len =sizeof (struct ireg_buf ) * n; +break ;case CUDBG_MBOX_LOG : len =sizeof (struct cudbg_mbox_log ) * adap->mbox_log->size;break ;
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +20 -0
@@ -5118,6 +5118,9 @@ static void t4_tp_indirect_rw(struct adapter *adap, u32 reg_addr, u32 reg_data,case TP_PIO_ADDR_A : cmd =FW_LDST_ADDRSPC_TP_PIO ;break ; +case TP_TM_PIO_ADDR_A : + cmd =FW_LDST_ADDRSPC_TP_TM_PIO ; +break ;case TP_MIB_INDEX_A : cmd =FW_LDST_ADDRSPC_TP_MIB ;break ;
@@ -5175,6 +5178,23 @@ static void t4_tp_pio_write(struct adapter *adap, u32 *buff, u32 nregs, start_index, 0, sleep_ok); } +/** +* t4_tp_tm_pio_read - Read TP TM PIO registers +* @adap: the adapter +* @buff: where the indirect register values are written +* @nregs: how many indirect registers to read +* @start_index: index of first indirect register to read +* @sleep_ok: if true we may sleep while awaiting command completion +* +* Read TP TM PIO Registers +**/ +void t4_tp_tm_pio_read (struct adapter *adap,u32 *buff,u32 nregs, +u32 start_index,bool sleep_ok) +{ +t4_tp_indirect_rw (adap,TP_TM_PIO_ADDR_A ,TP_TM_PIO_DATA_A , buff, + nregs, start_index,1 , sleep_ok); +} +/** * t4_tp_mib_read - Read TP MIB registers * @adap: the adapter
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +2 -0
@@ -1447,6 +1447,8 @@#define LKPTBLQUEUE0_M 0x3ffU#define LKPTBLQUEUE0_G (x) (((x) >> LKPTBLQUEUE0_S) & LKPTBLQUEUE0_M) +#define TP_TM_PIO_ADDR_A 0x7e18 +#define TP_TM_PIO_DATA_A 0x7e1c#define TP_PIO_ADDR_A 0x7e40#define TP_PIO_DATA_A 0x7e44#define TP_MIB_INDEX_A 0x7e50
Signature · 1 line
2.14.1
PATCH v2 7/8 cxgb4: collect hardware module dumps
In reply to Rahul LakkireddyCollect SGE, PCIE, PM, UP CIM, MA and HMA dumps.
---
v2:
- Prefix symbols in cudbg_* files with cudbg_
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h | 74 ++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 6 + drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 289 ++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h | 18 ++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 35 +++ 5 files changed, 422 insertions(+)
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h +74 -0
@@ -104,4 +104,78 @@ static const u32 t5_tp_mib_index_array[9][IREG_NUM_ELEM] = { {0x7e50, 0x7e54, 0x60, 6}, {0x7e50, 0x7e54, 0x68, 4} }; + +static const u32 t5_sge_dbg_index_array[2][IREG_NUM_ELEM] = { + {0x10cc, 0x10d0, 0x0, 16}, + {0x10cc, 0x10d4, 0x0, 16}, +}; + +static const u32 t5_pcie_pdbg_array[][IREG_NUM_ELEM] = { + {0x5a04, 0x5a0c, 0x00, 0x20}, /* t5_pcie_pdbg_regs_00_to_20 */ + {0x5a04, 0x5a0c, 0x21, 0x20}, /* t5_pcie_pdbg_regs_21_to_40 */ + {0x5a04, 0x5a0c, 0x41, 0x10}, /* t5_pcie_pdbg_regs_41_to_50 */ +}; + +static const u32 t5_pcie_cdbg_array[][IREG_NUM_ELEM] = { + {0x5a10, 0x5a18, 0x00, 0x20}, /* t5_pcie_cdbg_regs_00_to_20 */ + {0x5a10, 0x5a18, 0x21, 0x18}, /* t5_pcie_cdbg_regs_21_to_37 */ +}; + +static const u32 t5_pm_rx_array[][IREG_NUM_ELEM] = { + {0x8FD0, 0x8FD4, 0x10000, 0x20}, /* t5_pm_rx_regs_10000_to_10020 */ + {0x8FD0, 0x8FD4, 0x10021, 0x0D}, /* t5_pm_rx_regs_10021_to_1002c */ +}; + +static const u32 t5_pm_tx_array[][IREG_NUM_ELEM] = { + {0x8FF0, 0x8FF4, 0x10000, 0x20}, /* t5_pm_tx_regs_10000_to_10020 */ + {0x8FF0, 0x8FF4, 0x10021, 0x1D}, /* t5_pm_tx_regs_10021_to_1003c */ +}; + +static const u32 t6_ma_ireg_array[][IREG_NUM_ELEM] = { + {0x78f8, 0x78fc, 0xa000, 23}, /* t6_ma_regs_a000_to_a016 */ + {0x78f8, 0x78fc, 0xa400, 30}, /* t6_ma_regs_a400_to_a41e */ + {0x78f8, 0x78fc, 0xa800, 20} /* t6_ma_regs_a800_to_a813 */ +}; + +static const u32 t6_ma_ireg_array2[][IREG_NUM_ELEM] = { + {0x78f8, 0x78fc, 0xe400, 17}, /* t6_ma_regs_e400_to_e600 */ + {0x78f8, 0x78fc, 0xe640, 13} /* t6_ma_regs_e640_to_e7c0 */ +}; + +static const u32 t6_up_cim_reg_array[][IREG_NUM_ELEM] = { + {0x7b50, 0x7b54, 0x2000, 0x20}, /* up_cim_2000_to_207c */ + {0x7b50, 0x7b54, 0x2080, 0x1d}, /* up_cim_2080_to_20fc */ + {0x7b50, 0x7b54, 0x00, 0x20}, /* up_cim_00_to_7c */ + {0x7b50, 0x7b54, 0x80, 0x20}, /* up_cim_80_to_fc */ + {0x7b50, 0x7b54, 0x100, 0x11}, /* up_cim_100_to_14c */ + {0x7b50, 0x7b54, 0x200, 0x10}, /* up_cim_200_to_23c */ + {0x7b50, 0x7b54, 0x240, 0x2}, /* up_cim_240_to_244 */ + {0x7b50, 0x7b54, 0x250, 0x2}, /* up_cim_250_to_254 */ + {0x7b50, 0x7b54, 0x260, 0x2}, /* up_cim_260_to_264 */ + {0x7b50, 0x7b54, 0x270, 0x2}, /* up_cim_270_to_274 */ + {0x7b50, 0x7b54, 0x280, 0x20}, /* up_cim_280_to_2fc */ + {0x7b50, 0x7b54, 0x300, 0x20}, /* up_cim_300_to_37c */ + {0x7b50, 0x7b54, 0x380, 0x14}, /* up_cim_380_to_3cc */ + +}; + +static const u32 t5_up_cim_reg_array[][IREG_NUM_ELEM] = { + {0x7b50, 0x7b54, 0x2000, 0x20}, /* up_cim_2000_to_207c */ + {0x7b50, 0x7b54, 0x2080, 0x19}, /* up_cim_2080_to_20ec */ + {0x7b50, 0x7b54, 0x00, 0x20}, /* up_cim_00_to_7c */ + {0x7b50, 0x7b54, 0x80, 0x20}, /* up_cim_80_to_fc */ + {0x7b50, 0x7b54, 0x100, 0x11}, /* up_cim_100_to_14c */ + {0x7b50, 0x7b54, 0x200, 0x10}, /* up_cim_200_to_23c */ + {0x7b50, 0x7b54, 0x240, 0x2}, /* up_cim_240_to_244 */ + {0x7b50, 0x7b54, 0x250, 0x2}, /* up_cim_250_to_254 */ + {0x7b50, 0x7b54, 0x260, 0x2}, /* up_cim_260_to_264 */ + {0x7b50, 0x7b54, 0x270, 0x2}, /* up_cim_270_to_274 */ + {0x7b50, 0x7b54, 0x280, 0x20}, /* up_cim_280_to_2fc */ + {0x7b50, 0x7b54, 0x300, 0x20}, /* up_cim_300_to_37c */ + {0x7b50, 0x7b54, 0x380, 0x14}, /* up_cim_380_to_3cc */ +}; + +static const u32 t6_hma_ireg_array[][IREG_NUM_ELEM] = { + {0x51320, 0x51324, 0xa000, 32} /* t6_hma_regs_a000_to_a01f */ +}; #endif /* __CUDBG_ENTITY_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +6 -0
@@ -32,7 +32,13 @@ enum cudbg_dbg_entity_type {CUDBG_EDC0 =18 ,CUDBG_EDC1 =19 ,CUDBG_TP_INDIRECT =36 , +CUDBG_SGE_INDIRECT =37 , +CUDBG_PCIE_INDIRECT =50 , +CUDBG_PM_INDIRECT =51 , +CUDBG_MA_INDIRECT =61 , +CUDBG_UP_CIM_INDIRECT =64 ,CUDBG_MBOX_LOG =66 , +CUDBG_HMA_INDIRECT =67 , CUDBG_MAX_ENTITY = 70, };
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +289 -0
298 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h +18 -0
@@ -33,9 +33,27 @@ int cudbg_collect_edc1_meminfo(struct cudbg_init *pdbg_init,int cudbg_collect_tp_indirect (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err); +int cudbg_collect_sge_indirect (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err); +int cudbg_collect_pcie_indirect (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err); +int cudbg_collect_pm_indirect (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err); +int cudbg_collect_ma_indirect (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err); +int cudbg_collect_up_cim_indirect (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err);int cudbg_collect_mbox_log (struct cudbg_init *pdbg_init,struct cudbg_buffer *dbg_buff,struct cudbg_error *cudbg_err); +int cudbg_collect_hma_indirect (struct cudbg_init *pdbg_init, +struct cudbg_buffer *dbg_buff, +struct cudbg_error *cudbg_err);struct cudbg_entity_hdr *cudbg_get_entity_hdr (void *outbuf,int i); void cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +35 -0
@@ -30,6 +30,12 @@ static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = { { CUDBG_DEV_LOG, cudbg_collect_fw_devlog }, { CUDBG_REG_DUMP, cudbg_collect_reg_dump }, { CUDBG_TP_INDIRECT, cudbg_collect_tp_indirect }, + { CUDBG_SGE_INDIRECT, cudbg_collect_sge_indirect }, + { CUDBG_PCIE_INDIRECT, cudbg_collect_pcie_indirect }, + { CUDBG_PM_INDIRECT, cudbg_collect_pm_indirect }, + { CUDBG_MA_INDIRECT, cudbg_collect_ma_indirect }, + { CUDBG_UP_CIM_INDIRECT, cudbg_collect_up_cim_indirect }, + { CUDBG_HMA_INDIRECT, cudbg_collect_hma_indirect }, };static u32 cxgb4_get_entity_length (struct adapter *adap,u32 entity)
@@ -87,9 +93,38 @@ static u32 cxgb4_get_entity_length(struct adapter *adap, u32 entity) n = n / (IREG_NUM_ELEM *sizeof (u32)); len =sizeof (struct ireg_buf ) * n;break ; +case CUDBG_SGE_INDIRECT : + len =sizeof (struct ireg_buf ) *2 ; +break ; +case CUDBG_PCIE_INDIRECT : + n =sizeof (t5_pcie_pdbg_array) / (IREG_NUM_ELEM *sizeof (u32)); + len =sizeof (struct ireg_buf ) * n *2 ; +break ; +case CUDBG_PM_INDIRECT : + n =sizeof (t5_pm_rx_array) / (IREG_NUM_ELEM *sizeof (u32)); + len =sizeof (struct ireg_buf ) * n *2 ; +break ; +case CUDBG_MA_INDIRECT : +if (CHELSIO_CHIP_VERSION (adap->params.chip) >CHELSIO_T5 ) { + n =sizeof (t6_ma_ireg_array) / + (IREG_NUM_ELEM *sizeof (u32)); + len =sizeof (struct ireg_buf ) * n *2 ; + } +break ; +case CUDBG_UP_CIM_INDIRECT : + n =sizeof (t5_up_cim_reg_array) / (IREG_NUM_ELEM *sizeof (u32)); + len =sizeof (struct ireg_buf ) * n; +break ;case CUDBG_MBOX_LOG : len =sizeof (struct cudbg_mbox_log ) * adap->mbox_log->size;break ; +case CUDBG_HMA_INDIRECT : +if (CHELSIO_CHIP_VERSION (adap->params.chip) >CHELSIO_T5 ) { + n =sizeof (t6_hma_ireg_array) / + (IREG_NUM_ELEM *sizeof (u32)); + len =sizeof (struct ireg_buf ) * n; + } +break ;default :break ; }
Signature · 1 line
2.14.1
PATCH v2 8/8 cxgb4: collect IBQ and OBQ dumps
In reply to Rahul Lakkireddy---
v2:
- Prefix symbols in cudbg_* files with cudbg_
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h | 14 ++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 165 +++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h | 42 ++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 32 +++++ 4 files changed, 253 insertions(+)
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +14 -0
@@ -29,10 +29,24 @@enum cudbg_dbg_entity_type {CUDBG_REG_DUMP =1 ,CUDBG_DEV_LOG =2 , +CUDBG_CIM_IBQ_TP0 =6 , +CUDBG_CIM_IBQ_TP1 =7 , +CUDBG_CIM_IBQ_ULP =8 , +CUDBG_CIM_IBQ_SGE0 =9 , +CUDBG_CIM_IBQ_SGE1 =10 , +CUDBG_CIM_IBQ_NCSI =11 , +CUDBG_CIM_OBQ_ULP0 =12 , +CUDBG_CIM_OBQ_ULP1 =13 , +CUDBG_CIM_OBQ_ULP2 =14 , +CUDBG_CIM_OBQ_ULP3 =15 , +CUDBG_CIM_OBQ_SGE =16 , +CUDBG_CIM_OBQ_NCSI =17 ,CUDBG_EDC0 =18 ,CUDBG_EDC1 =19 ,CUDBG_TP_INDIRECT =36 ,CUDBG_SGE_INDIRECT =37 , +CUDBG_CIM_OBQ_RXQ0 =47 , +CUDBG_CIM_OBQ_RXQ1 =48 ,CUDBG_PCIE_INDIRECT =50 ,CUDBG_PM_INDIRECT =51 ,CUDBG_MA_INDIRECT =61 ,
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +165 -0
171 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h +42 -0
54 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +32 -0
@@ -29,8 +29,22 @@ static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = { { CUDBG_MBOX_LOG, cudbg_collect_mbox_log }, { CUDBG_DEV_LOG, cudbg_collect_fw_devlog }, { CUDBG_REG_DUMP, cudbg_collect_reg_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_NCSI, cudbg_collect_cim_ibq_ncsi }, + { CUDBG_CIM_OBQ_ULP0, cudbg_collect_cim_obq_ulp0 }, + { CUDBG_CIM_OBQ_ULP1, cudbg_collect_cim_obq_ulp1 }, + { CUDBG_CIM_OBQ_ULP2, cudbg_collect_cim_obq_ulp2 }, + { CUDBG_CIM_OBQ_ULP3, cudbg_collect_cim_obq_ulp3 }, + { CUDBG_CIM_OBQ_SGE, cudbg_collect_cim_obq_sge }, + { CUDBG_CIM_OBQ_NCSI, cudbg_collect_cim_obq_ncsi }, { CUDBG_TP_INDIRECT, cudbg_collect_tp_indirect }, { CUDBG_SGE_INDIRECT, cudbg_collect_sge_indirect }, + { CUDBG_CIM_OBQ_RXQ0, cudbg_collect_obq_sge_rx_q0 }, + { CUDBG_CIM_OBQ_RXQ1, cudbg_collect_obq_sge_rx_q1 }, { CUDBG_PCIE_INDIRECT, cudbg_collect_pcie_indirect }, { CUDBG_PM_INDIRECT, cudbg_collect_pm_indirect }, { CUDBG_MA_INDIRECT, cudbg_collect_ma_indirect },
@@ -59,6 +73,24 @@ static u32 cxgb4_get_entity_length(struct adapter *adap, u32 entity)case CUDBG_DEV_LOG : len = adap->params.devlog.size;break ; +case CUDBG_CIM_IBQ_TP0 : +case CUDBG_CIM_IBQ_TP1 : +case CUDBG_CIM_IBQ_ULP : +case CUDBG_CIM_IBQ_SGE0 : +case CUDBG_CIM_IBQ_SGE1 : +case CUDBG_CIM_IBQ_NCSI : + len =CIM_IBQ_SIZE *4 *sizeof (u32); +break ; +case CUDBG_CIM_OBQ_ULP0 : +case CUDBG_CIM_OBQ_ULP1 : +case CUDBG_CIM_OBQ_ULP2 : +case CUDBG_CIM_OBQ_ULP3 : +case CUDBG_CIM_OBQ_SGE : +case CUDBG_CIM_OBQ_NCSI : +case CUDBG_CIM_OBQ_RXQ0 : +case CUDBG_CIM_OBQ_RXQ1 : + len =6 *CIM_OBQ_SIZE *4 *sizeof (u32); +break ;case CUDBG_EDC0 : value =t4_read_reg (adap,MA_TARGET_MEM_ENABLE_A );if (value &EDRAM0_ENABLE_F ) {
Signature · 1 line
2.14.1
David Miller
maintainerFrom: Rahul Lakkireddy <[email protected]>
Date: Fri, 13 Oct 2017 18:48:12 +0530
Quoted 2 lines
This series of patches add support to collect hardware debug logs via ethtool --get-dump facility.
Series applied, thank you.