Skip to content

Commit 045203e

Browse files
committed
Merge branch 'nfp-enhanced-debug-dump-via-ethtool'
Simon Horman says: ==================== nfp: enhanced debug dump via ethtool Add debug dump implementation to the NFP driver. This makes use of existing ethtool infrastructure. ethtool -W is used to select the dump level and ethtool -w is used to dump NFP state. The existing behaviour of dump level 0, dumping the arm.diag resource, is preserved. Dump levels greater than 0 are implemented by this patchset and optionally supported by firmware providing a _abi_dump_spec rtsym. This rtsym provides a specification, in TLV format, of the information to be dumped from the NFP at each supported dump level. Dumps are also structured using a TLVs. They consist a prolog and the data described int he corresponding dump. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents efbf789 + 60b84a9 commit 045203e

File tree

8 files changed

+892
-8
lines changed

8 files changed

+892
-8
lines changed

drivers/net/ethernet/netronome/nfp/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ nfp-objs := \
2222
nfp_hwmon.o \
2323
nfp_main.o \
2424
nfp_net_common.o \
25+
nfp_net_debugdump.o \
2526
nfp_net_ethtool.o \
2627
nfp_net_main.o \
2728
nfp_net_repr.o \

drivers/net/ethernet/netronome/nfp/nfp_asm.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ enum lcsr_wr_src {
262262
#define OP_CARB_BASE 0x0e000000000ULL
263263
#define OP_CARB_OR 0x00000010000ULL
264264

265+
#define NFP_CSR_CTX_PTR 0x20
265266
#define NFP_CSR_ACT_LM_ADDR0 0x64
266267
#define NFP_CSR_ACT_LM_ADDR1 0x6c
267268
#define NFP_CSR_ACT_LM_ADDR2 0x94
@@ -382,4 +383,13 @@ int swreg_to_restricted(swreg dst, swreg lreg, swreg rreg,
382383
int nfp_ustore_check_valid_no_ecc(u64 insn);
383384
u64 nfp_ustore_calc_ecc_insn(u64 insn);
384385

386+
#define NFP_IND_ME_REFL_WR_SIG_INIT 3
387+
#define NFP_IND_ME_CTX_PTR_BASE_MASK GENMASK(9, 0)
388+
#define NFP_IND_NUM_CONTEXTS 8
389+
390+
static inline u32 nfp_get_ind_csr_ctx_ptr_offs(u32 read_offset)
391+
{
392+
return (read_offset & ~NFP_IND_ME_CTX_PTR_BASE_MASK) | NFP_CSR_CTX_PTR;
393+
}
394+
385395
#endif

drivers/net/ethernet/netronome/nfp/nfp_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <linux/pci.h>
4646
#include <linux/firmware.h>
4747
#include <linux/vermagic.h>
48+
#include <linux/vmalloc.h>
4849
#include <net/devlink.h>
4950

5051
#include "nfpcore/nfp.h"
@@ -509,6 +510,9 @@ static int nfp_pci_probe(struct pci_dev *pdev,
509510
pf->mip = nfp_mip_open(pf->cpp);
510511
pf->rtbl = __nfp_rtsym_table_read(pf->cpp, pf->mip);
511512

513+
pf->dump_flag = NFP_DUMP_NSP_DIAG;
514+
pf->dumpspec = nfp_net_dump_load_dumpspec(pf->cpp, pf->rtbl);
515+
512516
err = nfp_pcie_sriov_read_nfd_limit(pf);
513517
if (err)
514518
goto err_fw_unload;
@@ -544,6 +548,7 @@ static int nfp_pci_probe(struct pci_dev *pdev,
544548
nfp_fw_unload(pf);
545549
kfree(pf->eth_tbl);
546550
kfree(pf->nspi);
551+
vfree(pf->dumpspec);
547552
err_devlink_unreg:
548553
devlink_unregister(devlink);
549554
err_hwinfo_free:
@@ -579,6 +584,7 @@ static void nfp_pci_remove(struct pci_dev *pdev)
579584

580585
devlink_unregister(devlink);
581586

587+
vfree(pf->dumpspec);
582588
kfree(pf->rtbl);
583589
nfp_mip_close(pf->mip);
584590
if (pf->fw_loaded)

drivers/net/ethernet/netronome/nfp/nfp_main.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#ifndef NFP_MAIN_H
4040
#define NFP_MAIN_H
4141

42+
#include <linux/ethtool.h>
4243
#include <linux/list.h>
4344
#include <linux/types.h>
4445
#include <linux/msi.h>
@@ -61,6 +62,17 @@ struct nfp_nsp_identify;
6162
struct nfp_port;
6263
struct nfp_rtsym_table;
6364

65+
/**
66+
* struct nfp_dumpspec - NFP FW dump specification structure
67+
* @size: Size of the data
68+
* @data: Sequence of TLVs, each being an instruction to dump some data
69+
* from FW
70+
*/
71+
struct nfp_dumpspec {
72+
u32 size;
73+
u8 data[0];
74+
};
75+
6476
/**
6577
* struct nfp_pf - NFP PF-specific device structure
6678
* @pdev: Backpointer to PCI device
@@ -83,6 +95,9 @@ struct nfp_rtsym_table;
8395
* @mip: MIP handle
8496
* @rtbl: RTsym table
8597
* @hwinfo: HWInfo table
98+
* @dumpspec: Debug dump specification
99+
* @dump_flag: Store dump flag between set_dump and get_dump_flag
100+
* @dump_len: Store dump length between set_dump and get_dump_flag
86101
* @eth_tbl: NSP ETH table
87102
* @nspi: NSP identification info
88103
* @hwmon_dev: pointer to hwmon device
@@ -124,6 +139,9 @@ struct nfp_pf {
124139
const struct nfp_mip *mip;
125140
struct nfp_rtsym_table *rtbl;
126141
struct nfp_hwinfo *hwinfo;
142+
struct nfp_dumpspec *dumpspec;
143+
u32 dump_flag;
144+
u32 dump_len;
127145
struct nfp_eth_table *eth_tbl;
128146
struct nfp_nsp_identify *nspi;
129147

@@ -157,4 +175,15 @@ void nfp_net_get_mac_addr(struct nfp_pf *pf, struct nfp_port *port);
157175

158176
bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb);
159177

178+
enum nfp_dump_diag {
179+
NFP_DUMP_NSP_DIAG = 0,
180+
};
181+
182+
struct nfp_dumpspec *
183+
nfp_net_dump_load_dumpspec(struct nfp_cpp *cpp, struct nfp_rtsym_table *rtbl);
184+
s64 nfp_net_dump_calculate_size(struct nfp_pf *pf, struct nfp_dumpspec *spec,
185+
u32 flag);
186+
int nfp_net_dump_populate_buffer(struct nfp_pf *pf, struct nfp_dumpspec *spec,
187+
struct ethtool_dump *dump_param, void *dest);
188+
160189
#endif /* NFP_MAIN_H */

0 commit comments

Comments
 (0)