diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-05-28 17:52:59 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-30 11:27:05 -0400 |
commit | a87853f383afd6cb1cbda982d895e9cadf435098 (patch) | |
tree | 99cd036c47f59082b1d6c6d9ccdbc7a45f3c63cf | |
parent | 2ed4b36d03f9f6e71fe0c5a15941b2ff0bac99ad (diff) | |
download | linux-a87853f383afd6cb1cbda982d895e9cadf435098.tar.gz linux-a87853f383afd6cb1cbda982d895e9cadf435098.tar.bz2 linux-a87853f383afd6cb1cbda982d895e9cadf435098.zip |
nfp: support variable NSP response lengths
We want to support extendable commands, where newer versions
of the management FW may provide more information. Zero out
the communication buffer before passing control to NSP. This
way if management FW is old and only fills in first N bytes,
the remaining ones will be zeros which extended ABI fields
should reserve as not supported/not available.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c index 2fa9247bb23d..58cc3d532769 100644 --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c @@ -419,6 +419,14 @@ static int nfp_nsp_command_buf(struct nfp_nsp *nsp, u16 code, u32 option, if (err < 0) return err; } + /* Zero out remaining part of the buffer */ + if (out_buf && out_size && out_size > in_size) { + memset(out_buf, 0, out_size - in_size); + err = nfp_cpp_write(cpp, cpp_id, cpp_buf + in_size, + out_buf, out_size - in_size); + if (err < 0) + return err; + } ret = nfp_nsp_command(nsp, code, option, cpp_id, cpp_buf); if (ret < 0) |