From: Simon Horman <simon.horman@netronome.com>
To: David Miller <davem@davemloft.net>,
Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
Carl Heymann <carl.heymann@netronome.com>,
Simon Horman <simon.horman@netronome.com>
Subject: [PATCH net-next 02/10] nfp: load debug dump spec
Date: Mon, 4 Dec 2017 23:34:13 +0100 [thread overview]
Message-ID: <20171204223421.19174-3-simon.horman@netronome.com> (raw)
In-Reply-To: <20171204223421.19174-1-simon.horman@netronome.com>
From: Carl Heymann <carl.heymann@netronome.com>
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 <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 | 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 <linux/ethtool.h>
+#include <linux/vmalloc.h>
#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
next prev parent reply other threads:[~2017-12-04 22:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 22:34 [PATCH net-next 00/10] nfp: enhanced debug dump via ethtool Simon Horman
2017-12-04 22:34 ` [PATCH net-next 01/10] nfp: debug dump ethtool ops Simon Horman
2017-12-04 22:34 ` Simon Horman [this message]
2017-12-04 22:34 ` [PATCH net-next 03/10] nfp: dump prolog Simon Horman
2017-12-04 22:34 ` [PATCH net-next 04/10] nfp: dumpspec TLV traversal Simon Horman
2017-12-04 22:34 ` [PATCH net-next 05/10] nfp: dump rtsyms Simon Horman
2017-12-04 22:34 ` [PATCH net-next 06/10] nfp: dump all hwinfo Simon Horman
2017-12-04 22:34 ` [PATCH net-next 07/10] nfp: dump single hwinfo field by key Simon Horman
2017-12-04 22:34 ` [PATCH net-next 08/10] nfp: dump firmware name Simon Horman
2017-12-04 22:34 ` [PATCH net-next 09/10] nfp: dump CPP, XPB and direct ME CSRs Simon Horman
2017-12-04 22:34 ` [PATCH net-next 10/10] nfp: dump indirect " Simon Horman
2017-12-05 20:01 ` [PATCH net-next 00/10] nfp: enhanced debug dump via ethtool David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171204223421.19174-3-simon.horman@netronome.com \
--to=simon.horman@netronome.com \
--cc=carl.heymann@netronome.com \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).