* [PATCH net-next 1/2] nfp: fix absolute rtsym handling in debug dump
2017-12-14 9:50 [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling in debug dump Simon Horman
@ 2017-12-14 9:50 ` Simon Horman
2017-12-14 9:50 ` [PATCH net-next 2/2] nfp: fix XPB register reads " Simon Horman
2017-12-15 14:18 ` [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling " Simon Horman
2 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2017-12-14 9:50 UTC (permalink / raw)
To: David Miller, Jakub Kicinski
Cc: netdev, oss-drivers, Carl Heymann, Simon Horman
From: Carl Heymann <carl.heymann@netronome.com>
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: e1e798e3fd93 ("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>
---
.../net/ethernet/netronome/nfp/nfp_net_debugdump.c | 42 +++++++++++++---------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
index cbff0adad235..315bd22819ff 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
@@ -265,6 +265,7 @@ nfp_calc_rtsym_dump_sz(struct nfp_pf *pf, struct nfp_dump_tl *spec)
struct nfp_dumpspec_rtsym *spec_rtsym;
const struct nfp_rtsym *sym;
u32 tl_len, key_len;
+ u32 size;
spec_rtsym = (struct nfp_dumpspec_rtsym *)spec;
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)
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) +
- ALIGN8(sym->size);
+ ALIGN8(size);
}
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);
memcpy(dump_header->rtsym, spec->rtsym, key_len + 1);
- cpp_params.target = sym->target;
- cpp_params.action = NFP_CPP_ACTION_RW;
- cpp_params.token = 0;
- cpp_params.island = sym->domain;
- cpp_id = nfp_get_numeric_cpp_id(&cpp_params);
-
- dump_header->cpp.cpp_id = cpp_params;
- dump_header->cpp.offset = cpu_to_be32(sym->addr);
- dump_header->cpp.dump_length = cpu_to_be32(sym->size);
-
- bytes_read = nfp_cpp_read(pf->cpp, cpp_id, sym->addr, dest, sym->size);
- if (bytes_read != sym->size) {
- if (bytes_read >= 0)
- bytes_read = -EIO;
- dump_header->error = cpu_to_be32(bytes_read);
+ if (sym->type == NFP_RTSYM_TYPE_ABS) {
+ dump_header->cpp.dump_length = cpu_to_be32(sizeof(sym->addr));
+ *(u64 *)dest = sym->addr;
+ } else {
+ cpp_params.target = sym->target;
+ cpp_params.action = NFP_CPP_ACTION_RW;
+ cpp_params.token = 0;
+ cpp_params.island = sym->domain;
+ cpp_id = nfp_get_numeric_cpp_id(&cpp_params);
+ dump_header->cpp.cpp_id = cpp_params;
+ dump_header->cpp.offset = cpu_to_be32(sym->addr);
+ dump_header->cpp.dump_length = cpu_to_be32(sym->size);
+ bytes_read = nfp_cpp_read(pf->cpp, cpp_id, sym->addr, dest,
+ sym->size);
+ if (bytes_read != sym->size) {
+ if (bytes_read >= 0)
+ bytes_read = -EIO;
+ dump_header->error = cpu_to_be32(bytes_read);
+ }
}
return 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH net-next 2/2] nfp: fix XPB register reads in debug dump
2017-12-14 9:50 [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling in debug dump Simon Horman
2017-12-14 9:50 ` [PATCH net-next 1/2] nfp: fix absolute rtsym " Simon Horman
@ 2017-12-14 9:50 ` Simon Horman
2017-12-15 14:18 ` [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling " Simon Horman
2 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2017-12-14 9:50 UTC (permalink / raw)
To: David Miller, Jakub Kicinski
Cc: netdev, oss-drivers, Carl Heymann, Simon Horman
From: Carl Heymann <carl.heymann@netronome.com>
For XPB registers reads, some island IDs require special handling (e.g.
ARM island), which is already taken care of in nfp_xpb_readl(), so use
that instead of a straight CPP read.
Without this fix all "xpbm:ArmIsldXpbmMap.*" registers are reported as
0xffffffff. It has also been observed to cause a system reboot.
With this fix correct values are reported, none of which are 0xffffffff.
The values may be read using ethtool debug level 2.
# ethtool -W <netdev> 2
# ethtool -w <netdev> data dump.dat
Fixes: 0e6c4955e149 ("nfp: dump CPP, XPB and direct ME CSRs")
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>
---
drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
index 315bd22819ff..173646e17e94 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
@@ -38,6 +38,7 @@
#include "nfp_main.h"
#include "nfpcore/nfp.h"
#include "nfpcore/nfp_nffw.h"
+#include "nfpcore/nfp6000/nfp6000.h"
#define NFP_DUMP_SPEC_RTSYM "_abi_dump_spec"
@@ -478,6 +479,12 @@ static int nfp_dump_hwinfo_field(struct nfp_pf *pf, struct nfp_dump_tl *spec,
return 0;
}
+static bool is_xpb_read(struct nfp_dumpspec_cpp_isl_id *cpp_id)
+{
+ return cpp_id->target == NFP_CPP_TARGET_ISLAND_XPB &&
+ cpp_id->action == 0 && cpp_id->token == 0;
+}
+
static int
nfp_dump_csr_range(struct nfp_pf *pf, struct nfp_dumpspec_csr *spec_csr,
struct nfp_dump_state *dump)
@@ -511,8 +518,12 @@ nfp_dump_csr_range(struct nfp_pf *pf, struct nfp_dumpspec_csr *spec_csr,
max_rd_addr = cpp_rd_addr + be32_to_cpu(spec_csr->cpp.dump_length);
while (cpp_rd_addr < max_rd_addr) {
- bytes_read = nfp_cpp_read(pf->cpp, cpp_id, cpp_rd_addr, dest,
- reg_sz);
+ if (is_xpb_read(&spec_csr->cpp.cpp_id))
+ bytes_read = nfp_xpb_readl(pf->cpp, cpp_rd_addr,
+ (u32 *)dest);
+ else
+ bytes_read = nfp_cpp_read(pf->cpp, cpp_id, cpp_rd_addr,
+ dest, reg_sz);
if (bytes_read != reg_sz) {
if (bytes_read >= 0)
bytes_read = -EIO;
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling in debug dump
2017-12-14 9:50 [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling in debug dump Simon Horman
2017-12-14 9:50 ` [PATCH net-next 1/2] nfp: fix absolute rtsym " Simon Horman
2017-12-14 9:50 ` [PATCH net-next 2/2] nfp: fix XPB register reads " Simon Horman
@ 2017-12-15 14:18 ` Simon Horman
2017-12-15 17:49 ` David Miller
2 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2017-12-15 14:18 UTC (permalink / raw)
To: David Miller, Jakub Kicinski; +Cc: netdev, oss-drivers, Carl Heymann
On Thu, Dec 14, 2017 at 10:50:24AM +0100, Simon Horman wrote:
> Hi,
>
> this series resolves two problems in the recently added debug dump facility.
>
> * Correctly handle reading absolute rtysms
> * Correctly handle special-case PB register reads
>
> These fixes are for code only present in net-next.
Hi Dave,
It seems that I made a thinko in the title of the cover letter. s/XDP/XPB/
These changes do not relate to XDP.
> Carl Heymann (2):
> nfp: fix absolute rtsym handling in debug dump
> nfp: fix XPB register reads in debug dump
>
> .../net/ethernet/netronome/nfp/nfp_net_debugdump.c | 57 +++++++++++++++-------
> 1 file changed, 39 insertions(+), 18 deletions(-)
>
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling in debug dump
2017-12-15 14:18 ` [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling " Simon Horman
@ 2017-12-15 17:49 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-12-15 17:49 UTC (permalink / raw)
To: simon.horman; +Cc: jakub.kicinski, netdev, oss-drivers, carl.heymann
From: Simon Horman <simon.horman@netronome.com>
Date: Fri, 15 Dec 2017 15:18:29 +0100
> On Thu, Dec 14, 2017 at 10:50:24AM +0100, Simon Horman wrote:
>> Hi,
>>
>> this series resolves two problems in the recently added debug dump facility.
>>
>> * Correctly handle reading absolute rtysms
>> * Correctly handle special-case PB register reads
>>
>> These fixes are for code only present in net-next.
>
> Hi Dave,
>
> It seems that I made a thinko in the title of the cover letter. s/XDP/XPB/
> These changes do not relate to XDP.
Series applied with this fixed, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread