nfp: fix absolute rtsym handling in debug dump

In TLV-based ethtool debug dumps, don't do a CPP read for absolute
rtsyms, use the addr field in the symbol table directly as the value.

Without this fix rtsym gro_release_ring_0 is 4 bytes of zeros.
With this fix the correct value, 0x0000004a 0x00000000 is reported.

The values may be read using ethtool debug level 2.
 # ethtool -W <netdev> 2
 # ethtool -w <netdev> data dump.dat

Fixes: e1e798e3fd ("nfp: dump rtsyms")
Signed-off-by: Carl Heymann <carl.heymann@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Carl Heymann 2017-12-14 10:50:25 +01:00 committed by David S. Miller
parent 9463b2f72e
commit da762863ed
1 changed files with 26 additions and 16 deletions

View File

@ -265,6 +265,7 @@ nfp_calc_rtsym_dump_sz(struct nfp_pf *pf, struct nfp_dump_tl *spec)
struct nfp_dumpspec_rtsym *spec_rtsym; struct nfp_dumpspec_rtsym *spec_rtsym;
const struct nfp_rtsym *sym; const struct nfp_rtsym *sym;
u32 tl_len, key_len; u32 tl_len, key_len;
u32 size;
spec_rtsym = (struct nfp_dumpspec_rtsym *)spec; spec_rtsym = (struct nfp_dumpspec_rtsym *)spec;
tl_len = be32_to_cpu(spec->length); tl_len = be32_to_cpu(spec->length);
@ -276,8 +277,13 @@ nfp_calc_rtsym_dump_sz(struct nfp_pf *pf, struct nfp_dump_tl *spec)
if (!sym) if (!sym)
return nfp_dump_error_tlv_size(spec); return nfp_dump_error_tlv_size(spec);
if (sym->type == NFP_RTSYM_TYPE_ABS)
size = sizeof(sym->addr);
else
size = sym->size;
return ALIGN8(offsetof(struct nfp_dump_rtsym, rtsym) + key_len + 1) + return ALIGN8(offsetof(struct nfp_dump_rtsym, rtsym) + key_len + 1) +
ALIGN8(sym->size); ALIGN8(size);
} }
static int static int
@ -654,21 +660,25 @@ nfp_dump_single_rtsym(struct nfp_pf *pf, struct nfp_dumpspec_rtsym *spec,
header_size - offsetof(struct nfp_dump_rtsym, rtsym); header_size - offsetof(struct nfp_dump_rtsym, rtsym);
memcpy(dump_header->rtsym, spec->rtsym, key_len + 1); memcpy(dump_header->rtsym, spec->rtsym, key_len + 1);
cpp_params.target = sym->target; if (sym->type == NFP_RTSYM_TYPE_ABS) {
cpp_params.action = NFP_CPP_ACTION_RW; dump_header->cpp.dump_length = cpu_to_be32(sizeof(sym->addr));
cpp_params.token = 0; *(u64 *)dest = sym->addr;
cpp_params.island = sym->domain; } else {
cpp_id = nfp_get_numeric_cpp_id(&cpp_params); cpp_params.target = sym->target;
cpp_params.action = NFP_CPP_ACTION_RW;
dump_header->cpp.cpp_id = cpp_params; cpp_params.token = 0;
dump_header->cpp.offset = cpu_to_be32(sym->addr); cpp_params.island = sym->domain;
dump_header->cpp.dump_length = cpu_to_be32(sym->size); cpp_id = nfp_get_numeric_cpp_id(&cpp_params);
dump_header->cpp.cpp_id = cpp_params;
bytes_read = nfp_cpp_read(pf->cpp, cpp_id, sym->addr, dest, sym->size); dump_header->cpp.offset = cpu_to_be32(sym->addr);
if (bytes_read != sym->size) { dump_header->cpp.dump_length = cpu_to_be32(sym->size);
if (bytes_read >= 0) bytes_read = nfp_cpp_read(pf->cpp, cpp_id, sym->addr, dest,
bytes_read = -EIO; sym->size);
dump_header->error = cpu_to_be32(bytes_read); if (bytes_read != sym->size) {
if (bytes_read >= 0)
bytes_read = -EIO;
dump_header->error = cpu_to_be32(bytes_read);
}
} }
return 0; return 0;