Skip to content

Commit a87853f

Browse files
Jakub Kicinskidavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2ed4b36 commit a87853f

File tree

1 file changed

+8
-0
lines changed
  • drivers/net/ethernet/netronome/nfp/nfpcore

1 file changed

+8
-0
lines changed

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,14 @@ static int nfp_nsp_command_buf(struct nfp_nsp *nsp, u16 code, u32 option,
419419
if (err < 0)
420420
return err;
421421
}
422+
/* Zero out remaining part of the buffer */
423+
if (out_buf && out_size && out_size > in_size) {
424+
memset(out_buf, 0, out_size - in_size);
425+
err = nfp_cpp_write(cpp, cpp_id, cpp_buf + in_size,
426+
out_buf, out_size - in_size);
427+
if (err < 0)
428+
return err;
429+
}
422430

423431
ret = nfp_nsp_command(nsp, code, option, cpp_id, cpp_buf);
424432
if (ret < 0)

0 commit comments

Comments
 (0)