From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Horman Subject: [PATCH net-next 02/10] nfp: load debug dump spec Date: Mon, 4 Dec 2017 23:34:13 +0100 Message-ID: <20171204223421.19174-3-simon.horman@netronome.com> References: <20171204223421.19174-1-simon.horman@netronome.com> Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, Carl Heymann , Simon Horman To: David Miller , Jakub Kicinski Return-path: Received: from mail-wm0-f66.google.com ([74.125.82.66]:44778 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751628AbdLDWed (ORCPT ); Mon, 4 Dec 2017 17:34:33 -0500 Received: by mail-wm0-f66.google.com with SMTP id t8so8668578wmc.3 for ; Mon, 04 Dec 2017 14:34:33 -0800 (PST) In-Reply-To: <20171204223421.19174-1-simon.horman@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Carl Heymann Load the TLV-based binary specification of what needs to be included in a dump, from the "_abi_dump_spec" rtsymbol. If the symbol is not defined, then dumps for levels >= 1 are not supported. Signed-off-by: Carl Heymann Reviewed-by: Jakub Kicinski Signed-off-by: Simon Horman --- .../net/ethernet/netronome/nfp/nfp_net_debugdump.c | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c index a7061b6c609d..15b6623ef0b2 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c @@ -32,13 +32,45 @@ */ #include +#include #include "nfp_main.h" +#include "nfpcore/nfp.h" +#include "nfpcore/nfp_nffw.h" + +#define NFP_DUMP_SPEC_RTSYM "_abi_dump_spec" struct nfp_dumpspec * nfp_net_dump_load_dumpspec(struct nfp_cpp *cpp, struct nfp_rtsym_table *rtbl) { - return NULL; + const struct nfp_rtsym *specsym; + struct nfp_dumpspec *dumpspec; + int bytes_read; + u32 cpp_id; + + specsym = nfp_rtsym_lookup(rtbl, NFP_DUMP_SPEC_RTSYM); + if (!specsym) + return NULL; + + /* expected size of this buffer is in the order of tens of kilobytes */ + dumpspec = vmalloc(sizeof(*dumpspec) + specsym->size); + if (!dumpspec) + return NULL; + + dumpspec->size = specsym->size; + + cpp_id = NFP_CPP_ISLAND_ID(specsym->target, NFP_CPP_ACTION_RW, 0, + specsym->domain); + + bytes_read = nfp_cpp_read(cpp, cpp_id, specsym->addr, dumpspec->data, + specsym->size); + if (bytes_read != specsym->size) { + vfree(dumpspec); + nfp_warn(cpp, "Debug dump specification read failed.\n"); + return NULL; + } + + return dumpspec; } s64 nfp_net_dump_calculate_size(struct nfp_pf *pf, struct nfp_dumpspec *spec, -- 2.11.0