Netdev List
 help / color / mirror / Atom feed
* [net PATCH 0/3] fbnic: FW coredump fixes
@ 2026-11-24 21:44 Alexander Duyck
  2026-11-24 21:44 ` [net PATCH 1/3] fbnic: Limit TLV_MAX_DATA to the firmware's 4K page Alexander Duyck
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexander Duyck @ 2026-11-24 21:44 UTC (permalink / raw)
  To: netdev; +Cc: andrew+netdev, davem, edumazet, horms, kernel-team, kuba, pabeni

Fixes for reading and reporting the FW coredump.

Patch 1 limits TLV_MAX_DATA to the 4K page the firmware uses. On hosts
with 64K pages it was derived from PAGE_SIZE, so coredump reads asked
for more data than the firmware can return and failed.

Patch 2 stops the coredump info response handler from returning the
error the FW reports. The mailbox Rx path logged that as a message it
could not process, with a hex dump. The error still reaches the request
through the completion.

Patch 3 only lets a user request create a coredump. A dump taken for a
reported fault, such as a missed heartbeat, made the FW create one from
its current state and write it to flash, giving a crash dump for a FW
that had not crashed.

Patches 1 and 3 came from missed heartbeats on fleet hosts. A missed
heartbeat under memory pressure was reported as a FW fault and left a
coredump from FW that was still running. On an arm64 system with 64K
pages the coredump read for such a fault then failed. Patch 2 was found
while testing patch 3.

Testing was done in QEMU with the Terminus FW running in its own
emulator. Patch 1 was tested on x86 with the mailbox buffers sized as
on a 64K page host. Without the patch the coredump read failed, with
it the full dump was read back.

For patches 2 and 3 a FW fault was reported through the health
reporter. With patch 1 only, each report created a coredump. With
patches 1 and 3, no coredump was created, but each report logged
"Unable to process message: -2" and a hex dump. With all three applied
nothing was logged and no coredump was created.

---

Alexander Duyck (3):
      fbnic: Limit TLV_MAX_DATA to the firmware's 4K page
      fbnic: Do not report a FW coredump info error as a parse failure
      fbnic: Only create a FW coredump when the user asks for one


 drivers/net/ethernet/meta/fbnic/fbnic_devlink.c | 3 ++-
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c      | 2 +-
 drivers/net/ethernet/meta/fbnic/fbnic_tlv.h     | 4 +++-
 3 files changed, 6 insertions(+), 3 deletions(-)

--


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [net PATCH 1/3] fbnic: Limit TLV_MAX_DATA to the firmware's 4K page
  2026-11-24 21:44 [net PATCH 0/3] fbnic: FW coredump fixes Alexander Duyck
@ 2026-11-24 21:44 ` Alexander Duyck
  2026-11-24 21:44 ` [net PATCH 2/3] fbnic: Do not report a FW coredump info error as a parse failure Alexander Duyck
  2026-11-24 21:44 ` [net PATCH 3/3] fbnic: Only create a FW coredump when the user asks for one Alexander Duyck
  2 siblings, 0 replies; 5+ messages in thread
From: Alexander Duyck @ 2026-11-24 21:44 UTC (permalink / raw)
  To: netdev; +Cc: andrew+netdev, davem, edumazet, horms, kernel-team, kuba, pabeni

From: Alexander Duyck <alexanderduyck@fb.com>

The firmware builds and parses mailbox messages in a 4K page, but
TLV_MAX_DATA is derived from PAGE_SIZE. With 64K pages it becomes 65024
bytes, so FW core dump reads fail with "No data for core dump chunk"
and the dump is split into fmsg items larger than devlink allows.

Base TLV_MAX_DATA on the 4K firmware page instead. Nothing changes on
hosts with 4K pages.

Fixes: c6203e678cc9 ("eth: fbnic: Add message parsing for FW messages")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/meta/fbnic/fbnic_tlv.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_tlv.h b/drivers/net/ethernet/meta/fbnic/fbnic_tlv.h
index 9c4e4759394a..92d2817d0291 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_tlv.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_tlv.h
@@ -7,6 +7,7 @@
 #include <asm/byteorder.h>
 #include <linux/bits.h>
 #include <linux/const.h>
+#include <linux/sizes.h>
 #include <linux/types.h>
 
 struct fbnic_dev;
@@ -82,7 +83,8 @@ struct fbnic_tlv_index {
 	enum fbnic_tlv_type	type;
 };
 
-#define TLV_MAX_DATA			((PAGE_SIZE - 512) & 0xFFFF)
+/* FW mailbox messages are limited to a 4K page */
+#define TLV_MAX_DATA			(SZ_4K - 512)
 #define FBNIC_TLV_ATTR_ID_UNKNOWN	USHRT_MAX
 #define FBNIC_TLV_ATTR_STRING(id, len)	{ id, len, FBNIC_TLV_STRING }
 #define FBNIC_TLV_ATTR_FLAG(id)		{ id, 0, FBNIC_TLV_FLAG }



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [net PATCH 2/3] fbnic: Do not report a FW coredump info error as a parse failure
  2026-11-24 21:44 [net PATCH 0/3] fbnic: FW coredump fixes Alexander Duyck
  2026-11-24 21:44 ` [net PATCH 1/3] fbnic: Limit TLV_MAX_DATA to the firmware's 4K page Alexander Duyck
@ 2026-11-24 21:44 ` Alexander Duyck
  2026-11-27  9:44   ` netdev-bot+sashiko
  2026-11-24 21:44 ` [net PATCH 3/3] fbnic: Only create a FW coredump when the user asks for one Alexander Duyck
  2 siblings, 1 reply; 5+ messages in thread
From: Alexander Duyck @ 2026-11-24 21:44 UTC (permalink / raw)
  To: netdev; +Cc: andrew+netdev, davem, edumazet, horms, kernel-team, kuba, pabeni

From: Alexander Duyck <alexanderduyck@fb.com>

The coredump info response handler returns the error the FW reports, or
-ENOENT when no coredump is available. The mailbox Rx path treats any
error from a handler as a message it could not process, and logs a
warning with a hex dump of the message.

The error is already passed to the waiting request through the
completion. Return 0 once the completion is filled in, as the TSENE
and FW upgrade response handlers do.

Fixes: 5df1d0a08483 ("eth: fbnic: support FW communication for core dump")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
index e00d626f6438..9a3df3767442 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
@@ -960,7 +960,7 @@ fbnic_fw_parse_coredump_info_resp(void *opaque, struct fbnic_tlv_msg **results)
 	complete(&cmpl_data->done);
 	fbnic_fw_put_cmpl(cmpl_data);
 
-	return err;
+	return 0;
 }
 
 /**



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [net PATCH 3/3] fbnic: Only create a FW coredump when the user asks for one
  2026-11-24 21:44 [net PATCH 0/3] fbnic: FW coredump fixes Alexander Duyck
  2026-11-24 21:44 ` [net PATCH 1/3] fbnic: Limit TLV_MAX_DATA to the firmware's 4K page Alexander Duyck
  2026-11-24 21:44 ` [net PATCH 2/3] fbnic: Do not report a FW coredump info error as a parse failure Alexander Duyck
@ 2026-11-24 21:44 ` Alexander Duyck
  2 siblings, 0 replies; 5+ messages in thread
From: Alexander Duyck @ 2026-11-24 21:44 UTC (permalink / raw)
  To: netdev; +Cc: andrew+netdev, davem, edumazet, horms, kernel-team, kuba, pabeni

From: Alexander Duyck <alexanderduyck@fb.com>

When a fault is reported to the FW health reporter, devlink takes a dump
and the dump callback requests the FW coredump with the create flag set.
If the FW has no stored coredump, it creates one from its current state
and writes it to flash. A missed heartbeat on a healthy FW, for example
while the host is stalled, then produces a coredump that looks like a
crash.

devlink passes the report context to the dump callback for a reported
fault and NULL for a dump the user requests. Only set the create flag
when the context is NULL, so an automatic dump returns the stored
coredump or fails if there is none.

Fixes: 005a54722e9d ("eth: fbnic: add FW health reporter")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/meta/fbnic/fbnic_devlink.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
index 0b653c4c20a7..1f7e6e78ac92 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
@@ -385,7 +385,8 @@ static int fbnic_fw_reporter_dump(struct devlink_health_reporter *reporter,
 	if (!fw_cmpl)
 		return -ENOMEM;
 
-	err = fbnic_fw_xmit_coredump_info_msg(fbd, fw_cmpl, true);
+	/* Only create a new coredump when the user asks for one */
+	err = fbnic_fw_xmit_coredump_info_msg(fbd, fw_cmpl, !priv_ctx);
 	if (err) {
 		NL_SET_ERR_MSG_MOD(extack,
 				   "Failed to transmit core dump info msg");



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [net PATCH 2/3] fbnic: Do not report a FW coredump info error as a parse failure
  2026-11-24 21:44 ` [net PATCH 2/3] fbnic: Do not report a FW coredump info error as a parse failure Alexander Duyck
@ 2026-11-27  9:44   ` netdev-bot+sashiko
  0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27  9:44 UTC (permalink / raw)
  To: alexander.duyck
  Cc: netdev, andrew+netdev, davem, edumazet, horms, kernel-team, kuba,
	pabeni

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The fix is incomplete.

--

fbnic: Do not report a FW coredump info error as a parse failure

This patch makes fbnic_fw_parse_coredump_info_resp() return 0 once the
completion has been filled in. A firmware-reported error, or -ENOENT when
no coredump is available, then no longer reaches the mailbox Rx path,
which would log it as an unprocessable message with a hex dump.

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
> index e00d626f64384..9a3df37674424 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
> @@ -960,7 +960,7 @@ fbnic_fw_parse_coredump_info_resp(void *opaque, struct fbnic_tlv_msg **results)
>  	complete(&cmpl_data->done);
>  	fbnic_fw_put_cmpl(cmpl_data);
>  
> -	return err;
> +	return 0;
>  }

[Severity: Medium]

This fixes the coredump info handler. Is the same problem still present in
fbnic_fw_parse_coredump_resp()? That handler came in with the same Fixes:
commit and runs in the same devlink health dump flow,
fbnic_fw_reporter_dump():

fbnic_fw_parse_coredump_resp() {
    ...
	err = fta_get_sint(results, FBNIC_FW_COREDUMP_READ_ERROR);
	if (err)
		goto msg_err;
    ...
msg_err:
	cmpl_data->result = err;
	complete(&cmpl_data->done);
	fbnic_fw_put_cmpl(cmpl_data);

	return err;
}

fbnic_fw_parse_qsfp_read_resp() does the same thing with
FBNIC_FW_QSFP_ERROR. It stores the error in cmpl_data->result, completes
the request, and then returns err.

fbnic_tlv_msg_parse() returns the handler's value unchanged, and
fbnic_mbx_process_rx_msgs() then does this:

		err = fbnic_tlv_msg_parse(fbd, msg, fbnic_fw_tlv_parser);
		if (err) {
			dev_warn(fbd->dev, "Unable to process message: %d\n",
				 err);
			print_hex_dump(KERN_WARNING, "fbnic:",
				       DUMP_PREFIX_OFFSET, 16, 2,
				       msg, length, true);
		}

So when the firmware reports an error on a coredump read chunk or a QSFP
EEPROM read, the driver still logs the parse-failure warning and hex dump.
The callers already get the error through the completion. The later
patches in the series do not touch fbnic_fw.c, so both handlers are
unchanged at the end of the series.

Both handlers also have real malformed-message paths: -EINVAL for an
offset, length, bank or page mismatch, and -ENODATA for missing data. A
blanket return 0 would hide useful warnings in those cases.

Could these handlers follow the fbnic_fw_parse_tsene_read_resp() pattern
the commit message mentions? That handler keeps the firmware error in a
separate err_resp that only goes into the completion, and still returns
local validation errors:

	err_resp = fta_get_sint(results, FBNIC_FW_TSENE_ERROR);
	if (err_resp)
		goto msg_err;
    ...
msg_err:
	cmpl_data->result = err_resp ? : err;
	complete(&cmpl_data->done);
	fbnic_fw_put_cmpl(cmpl_data);

	return err;

>  
>  /**

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179555657536.7867.497419917946087787.stgit%40ahduyck-xeon-server.home.arpa

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-27  9:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 21:44 [net PATCH 0/3] fbnic: FW coredump fixes Alexander Duyck
2026-11-24 21:44 ` [net PATCH 1/3] fbnic: Limit TLV_MAX_DATA to the firmware's 4K page Alexander Duyck
2026-11-24 21:44 ` [net PATCH 2/3] fbnic: Do not report a FW coredump info error as a parse failure Alexander Duyck
2026-11-27  9:44   ` netdev-bot+sashiko
2026-11-24 21:44 ` [net PATCH 3/3] fbnic: Only create a FW coredump when the user asks for one Alexander Duyck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox