Skip to contentSkip to conversation

eth: fbnic: Add firmware logging support

PATCH Applied Lee Trager 3 participants 9 messages Jul 2, 2025 – Jul 9, 2025

Subsystems (3)
lore
Share & tools
lore

Lee Trager

author
#0 lore raw

cover eth: fbnic: Add firmware logging support

Firmware running on fbnic generates device logs. These logs contain useful information about the device which may or may not be related to the host. Logs are stored in a ring buffer and accessible through DebugFS.

Lee Trager (6):
eth: fbnic: Fix incorrect minimum firmware version
eth: fbnic: Use FIELD_PREP to generate minimum firmware version
eth: fbnic: Create ring buffer for firmware logs
eth: fbnic: Add mailbox support for firmware logs
eth: fbnic: Enable firmware logging
eth: fbnic: Create fw_log file in DebugFS

 drivers/net/ethernet/meta/fbnic/Makefile      |   1 +
 drivers/net/ethernet/meta/fbnic/fbnic.h       |   3 +
 drivers/net/ethernet/meta/fbnic/fbnic_csr.h   |  27 ++-
 .../net/ethernet/meta/fbnic/fbnic_debugfs.c   |  29 +++
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c    | 179 +++++++++++++++++-
 drivers/net/ethernet/meta/fbnic/fbnic_fw.h    |  36 ++++
 .../net/ethernet/meta/fbnic/fbnic_fw_log.c    | 123 ++++++++++++
 .../net/ethernet/meta/fbnic/fbnic_fw_log.h    |  45 +++++
 drivers/net/ethernet/meta/fbnic/fbnic_pci.c   |  21 ++
 9 files changed, 451 insertions(+), 13 deletions(-)
 create mode 100644 drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
 create mode 100644 drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h

--
2.47.1

author
#1 lore raw

PATCH 1/6 eth: fbnic: Fix incorrect minimum firmware version

The full minimum version is 0.10.6-0. The six is now correctly defined as patch and shifted appropriately. 0.10.6-0 is a preproduction version of firmware which was released over a year and a half ago. All production devices meet this requirement.

---
 drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 4 ++--
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_csr.h +2 -2
index 9c89d5378668..e2b251eddbb3 100644
@@ -15,10 +15,10 @@
 /* Defines the minimum firmware version required by the driver */
 #define MIN_FW_MAJOR_VERSION    0
 #define MIN_FW_MINOR_VERSION    10
-#define MIN_FW_BUILD_VERSION    6
+#define MIN_FW_PATCH_VERSION    6
 #define MIN_FW_VERSION_CODE     (MIN_FW_MAJOR_VERSION * (1u << 24) + \
 				 MIN_FW_MINOR_VERSION * (1u << 16) + \
-				 MIN_FW_BUILD_VERSION)
+				 MIN_FW_PATCH_VERSION * (1u << 8))
 
 #define PCI_DEVICE_ID_META_FBNIC_ASIC		0x0013
 
drivers/net/ethernet/meta/fbnic/fbnic_fw.c +1 -1
index 1d220d8369e7..cdc1e2938a64 100644
@@ -582,7 +582,7 @@ static int fbnic_fw_parse_cap_resp(void *opaque, struct fbnic_tlv_msg **results)
 			running_ver,
 			MIN_FW_MAJOR_VERSION,
 			MIN_FW_MINOR_VERSION,
-			MIN_FW_BUILD_VERSION);
+			MIN_FW_PATCH_VERSION);
 		/* Disable TX mailbox to prevent card use until firmware is
 		 * updated.
 		 */

--
2.47.1

author
#2 lore raw

PATCH 2/6 eth: fbnic: Use FIELD_PREP to generate minimum firmware version

In reply to Lee Trager

Create a new macro based on FIELD_PREP to generate easily readable minimum firmware version ints. This macro will prevent the mistake from the previous patch from happening again.

---
 drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 13 +++++++------
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c  | 13 ++++++-------
 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_csr.h +7 -6
index e2b251eddbb3..06b9c49e51a2 100644
@@ -12,13 +12,14 @@
 #define DESC_BIT(nr)		BIT_ULL(nr)
 #define DESC_GENMASK(h, l)	GENMASK_ULL(h, l)
 
+#define FW_VER_CODE(_major, _minor, _patch, _build) (		      \
+		FIELD_PREP(FBNIC_FW_CAP_RESP_VERSION_MAJOR, _major) | \
+		FIELD_PREP(FBNIC_FW_CAP_RESP_VERSION_MINOR, _minor) | \
+		FIELD_PREP(FBNIC_FW_CAP_RESP_VERSION_PATCH, _patch) | \
+		FIELD_PREP(FBNIC_FW_CAP_RESP_VERSION_BUILD, _build))
+
 /* Defines the minimum firmware version required by the driver */
-#define MIN_FW_MAJOR_VERSION    0
-#define MIN_FW_MINOR_VERSION    10
-#define MIN_FW_PATCH_VERSION    6
-#define MIN_FW_VERSION_CODE     (MIN_FW_MAJOR_VERSION * (1u << 24) + \
-				 MIN_FW_MINOR_VERSION * (1u << 16) + \
-				 MIN_FW_PATCH_VERSION * (1u << 8))
+#define MIN_FW_VER_CODE				FW_VER_CODE(0, 10, 6, 0)
 
 #define PCI_DEVICE_ID_META_FBNIC_ASIC		0x0013
 
drivers/net/ethernet/meta/fbnic/fbnic_fw.c +6 -7
index cdc1e2938a64..ac7804a8a22c 100644
@@ -573,16 +573,15 @@ static int fbnic_fw_parse_cap_resp(void *opaque, struct fbnic_tlv_msg **results)
 	if (!fbd->fw_cap.running.mgmt.version)
 		return -EINVAL;
 
-	if (fbd->fw_cap.running.mgmt.version < MIN_FW_VERSION_CODE) {
+	if (fbd->fw_cap.running.mgmt.version < MIN_FW_VER_CODE) {
+		char required_ver[FBNIC_FW_VER_MAX_SIZE];
 		char running_ver[FBNIC_FW_VER_MAX_SIZE];
 
 		fbnic_mk_fw_ver_str(fbd->fw_cap.running.mgmt.version,
 				    running_ver);
-		dev_err(fbd->dev, "Device firmware version(%s) is older than minimum required version(%02d.%02d.%02d)\n",
-			running_ver,
-			MIN_FW_MAJOR_VERSION,
-			MIN_FW_MINOR_VERSION,
-			MIN_FW_PATCH_VERSION);
+		fbnic_mk_fw_ver_str(MIN_FW_VER_CODE, required_ver);
+		dev_err(fbd->dev, "Device firmware version(%s) is older than minimum required version(%s)\n",
+			running_ver, required_ver);
 		/* Disable TX mailbox to prevent card use until firmware is
 		 * updated.
 		 */
@@ -1167,7 +1166,7 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
 	 * to indicate we entered the polling state waiting for a response
 	 */
 	for (fbd->fw_cap.running.mgmt.version = 1;
-	     fbd->fw_cap.running.mgmt.version < MIN_FW_VERSION_CODE;) {
+	     fbd->fw_cap.running.mgmt.version < MIN_FW_VER_CODE;) {
 		if (!tx_mbx->ready)
 			err = -ENODEV;
 		if (err)

--
2.47.1

author
#3 lore raw

PATCH 3/6 eth: fbnic: Create ring buffer for firmware logs

In reply to Lee Trager

When enabled, firmware may send logs messages which are specific to the device and not the host. Create a ring buffer to store these messages which are read by a user through DebugFS. Buffer access is protected by a spinlock.

---
 drivers/net/ethernet/meta/fbnic/Makefile      |  1 +
 drivers/net/ethernet/meta/fbnic/fbnic.h       |  3 +
 .../net/ethernet/meta/fbnic/fbnic_fw_log.c    | 95 +++++++++++++++++++
 .../net/ethernet/meta/fbnic/fbnic_fw_log.h    | 43 +++++++++
 4 files changed, 142 insertions(+)
 create mode 100644 drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
 create mode 100644 drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h
drivers/net/ethernet/meta/fbnic/Makefile +1 -0
index 0dbc634adb4b..15e8ff649615 100644
@@ -12,6 +12,7 @@ fbnic-y := fbnic_csr.o \
 	   fbnic_devlink.o \
 	   fbnic_ethtool.o \
 	   fbnic_fw.o \
+	   fbnic_fw_log.o \
 	   fbnic_hw_stats.o \
 	   fbnic_hwmon.o \
 	   fbnic_irq.o \
drivers/net/ethernet/meta/fbnic/fbnic.h +3 -0
index 65815d4f379e..c376e06880c9 100644
@@ -12,6 +12,7 @@
 
 #include "fbnic_csr.h"
 #include "fbnic_fw.h"
+#include "fbnic_fw_log.h"
 #include "fbnic_hw_stats.h"
 #include "fbnic_mac.h"
 #include "fbnic_rpc.h"
@@ -85,6 +86,8 @@ struct fbnic_dev {
 
 	/* Lock protecting access to hw_stats */
 	spinlock_t hw_stats_lock;
+
+	struct fbnic_fw_log fw_log;
 };
 
 /* Reserve entry 0 in the MSI-X "others" array until we have filled all
drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c new file +95 -0

95 lines not on this page · raw message

drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h new file +43 -0

43 lines not on this page · raw message

--
2.47.1

author
#4 lore raw

PATCH 4/6 eth: fbnic: Add mailbox support for firmware logs

In reply to Lee Trager

By default firmware will not send logs to the host. This must be explicitly enabled by the driver. The mailbox has the concept of a flag which is a u32 used as a boolean. Lack of flag defaults to a value of false. When enabling logging historical logs may be optionally requested. These are log messages generated by the NIC before the driver was loaded. The driver also sends a log version to support changing the logging format in the future.

[SEND_LOGS_REQ] = {

    [SEND_LOGS]          /* flag to request log reporting */
    [SEND_LOGS_HISTORY]  /* flag to request historical logs */
    [SEND_LOGS_VERSION]  /* u32 indicating the log format version */

}

Logs may be sent to the user either one at a time, or when historical logs are requested in bulk. Firmware may not send more than 14 messages in bulk to prevent flooding the mailbox.

[LOG_MSG] = {

    [LOG_INDEX]     /* entry 0 - u64 index of log */
    [LOG_MSEC]      /* entry 0 - u32 timestamp of log */
    [LOG_MSG]       /* entry 0 - char log message up to 256 */
    [LOG_LENGTH]    /* u32 of remaining log items in arrays */
    [LOG_INDEX_ARRAY] = {
        [LOG_INDEX] /* entry 1 - u64 index of log */
	[LOG_INDEX] /* entry 2 - u64 index of log */
	...
    }
    [LOG_MSEC_ARRAY] = {
        [LOG_MSEC]  /* entry 1 - u32 timestamp of log */
	[LOG_MSEC]  /* entry 2 - u32 timestamp of log */
	...
    }
    [LOG_MSG_ARRAY] = {
        [LOG_MSG]   /* entry 1 - char log message up to 256 */
	[LOG_MSG]   /* entry 2 - char log message up to 256 */
	...
    }
}
---
 drivers/net/ethernet/meta/fbnic/fbnic_csr.h |  14 ++
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c  | 166 ++++++++++++++++++++
 drivers/net/ethernet/meta/fbnic/fbnic_fw.h  |  36 +++++
 3 files changed, 216 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic_csr.h +14 -0
index 06b9c49e51a2..a81db842aa53 100644
@@ -21,6 +21,20 @@
 /* Defines the minimum firmware version required by the driver */
 #define MIN_FW_VER_CODE				FW_VER_CODE(0, 10, 6, 0)
 
+/* Defines the minimum firmware version required for firmware logs */
+#define MIN_FW_VER_CODE_LOG			FW_VER_CODE(0, 12, 9, 0)
+
+/* Driver can request that firmware sends all cached logs in bulk. This
+ * feature was enabled on older firmware however firmware has a bug
+ * which attempted to send 30 messages per mbx message which caused an
+ * overflow flooding the mailbox. This results in a kernel warning
+ * related to corrupt mailbox messages.
+ *
+ * If firmware is new enough only request sending historical logs when
+ * the log buffer is empty to prevent duplicate logs.
+ */
+#define MIN_FW_VER_CODE_HIST			FW_VER_CODE(25, 5, 7, 0)
+
 #define PCI_DEVICE_ID_META_FBNIC_ASIC		0x0013
 
 #define FBNIC_CLOCK_FREQ	(600 * (1000 * 1000))
drivers/net/ethernet/meta/fbnic/fbnic_fw.c +166 -0

178 lines not on this page · raw message

drivers/net/ethernet/meta/fbnic/fbnic_fw.h +36 -0
index 555b231b38c1..fde331696fdd 100644
@@ -22,7 +22,20 @@ struct fbnic_fw_mbx {
 #define FBNIC_FW_VER_MAX_SIZE			32
 // Formatted version is in the format XX.YY.ZZ_RRR_COMMIT
 #define FBNIC_FW_CAP_RESP_COMMIT_MAX_SIZE	(FBNIC_FW_VER_MAX_SIZE - 13)
+#define FBNIC_FW_LOG_VERSION			1
 #define FBNIC_FW_LOG_MAX_SIZE			256
+/*
+ * The max amount of logs which can fit in a single mailbox message. Firmware
+ * assumes each mailbox message is 4096B. The amount of messages supported is
+ * calculated as 4096 minus headers for message, arrays, and length minus the
+ * size of length divided by headers for each array plus the maximum LOG size,
+ * and the size of MSEC and INDEX. Put another way:
+ *
+ * MAX_LOG_HISTORY = ((4096 - TLV_HDR_SZ * 5 - LENGTH_SZ)
+ *                    / (FBNIC_FW_LOG_MAX_SIZE + TLV_HDR_SZ * 3 + MSEC_SZ
+ *                       + INDEX_SZ))
+ */
+#define FBNIC_FW_MAX_LOG_HISTORY		14
 
 struct fbnic_fw_ver {
 	u32 version;
@@ -82,6 +95,8 @@ int fbnic_fw_xmit_fw_write_chunk(struct fbnic_dev *fbd,
 				 int cancel_error);
 int fbnic_fw_xmit_tsene_read_msg(struct fbnic_dev *fbd,
 				 struct fbnic_fw_completion *cmpl_data);
+int fbnic_fw_xmit_send_logs(struct fbnic_dev *fbd, bool enable,
+			    bool send_log_history);
 struct fbnic_fw_completion *fbnic_fw_alloc_cmpl(u32 msg_type);
 void fbnic_fw_put_cmpl(struct fbnic_fw_completion *cmpl_data);
 
@@ -125,6 +140,9 @@ enum {
 	FBNIC_TLV_MSG_ID_FW_FINISH_UPGRADE_RESP		= 0x29,
 	FBNIC_TLV_MSG_ID_TSENE_READ_REQ			= 0x3C,
 	FBNIC_TLV_MSG_ID_TSENE_READ_RESP		= 0x3D,
+	FBNIC_TLV_MSG_ID_LOG_SEND_LOGS_REQ		= 0x43,
+	FBNIC_TLV_MSG_ID_LOG_MSG_REQ			= 0x44,
+	FBNIC_TLV_MSG_ID_LOG_MSG_RESP			= 0x45,
 };
 
 #define FBNIC_FW_CAP_RESP_VERSION_MAJOR		CSR_GENMASK(31, 24)
@@ -199,4 +217,22 @@ enum {
 	FBNIC_FW_FINISH_UPGRADE_MSG_MAX
 };
 
+enum {
+	FBNIC_SEND_LOGS				= 0x0,
+	FBNIC_SEND_LOGS_VERSION			= 0x1,
+	FBNIC_SEND_LOGS_HISTORY			= 0x2,
+	FBNIC_SEND_LOGS_MSG_MAX
+};
+
+enum {
+	FBNIC_FW_LOG_MSEC			= 0x0,
+	FBNIC_FW_LOG_INDEX			= 0x1,
+	FBNIC_FW_LOG_MSG			= 0x2,
+	FBNIC_FW_LOG_LENGTH			= 0x3,
+	FBNIC_FW_LOG_MSEC_ARRAY			= 0x4,
+	FBNIC_FW_LOG_INDEX_ARRAY		= 0x5,
+	FBNIC_FW_LOG_MSG_ARRAY			= 0x6,
+	FBNIC_FW_LOG_MSG_MAX
+};
+
 #endif /* _FBNIC_FW_H_ */

--
2.47.1

author
#5 lore raw

PATCH 5/6 eth: fbnic: Enable firmware logging

In reply to Lee Trager

The firmware log buffer is enabled during probe and freed during remove. Early versions of firmware do not support sending logs. Once the mailbox is up driver will enable logging when supported firmware versions are detected. Logging is disabled before the mailbox is freed.

---
 .../net/ethernet/meta/fbnic/fbnic_fw_log.c    | 28 +++++++++++++++++++
 .../net/ethernet/meta/fbnic/fbnic_fw_log.h    |  2 ++
 drivers/net/ethernet/meta/fbnic/fbnic_pci.c   | 21 ++++++++++++++
 3 files changed, 51 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c +28 -0
index caedbe7844f7..38749d47cee6 100644
@@ -8,6 +8,31 @@
 #include "fbnic_fw.h"
 #include "fbnic_fw_log.h"
 
+void fbnic_fw_log_enable(struct fbnic_dev *fbd, bool send_hist)
+{
+	int err;
+
+	if (!fbnic_fw_log_ready(fbd))
+		return;
+
+	if (fbd->fw_cap.running.mgmt.version < MIN_FW_VER_CODE_HIST)
+		send_hist = false;
+
+	err = fbnic_fw_xmit_send_logs(fbd, true, send_hist);
+	if (err && err != -EOPNOTSUPP)
+		dev_warn(fbd->dev, "Unable to enable firmware logs: %d\n", err);
+}
+
+void fbnic_fw_log_disable(struct fbnic_dev *fbd)
+{
+	int err;
+
+	err = fbnic_fw_xmit_send_logs(fbd, false, false);
+	if (err && err != -EOPNOTSUPP)
+		dev_warn(fbd->dev, "Unable to disable firmware logs: %d\n",
+			 err);
+}
+
 int fbnic_fw_log_init(struct fbnic_dev *fbd)
 {
 	struct fbnic_fw_log *log = &fbd->fw_log;
@@ -26,6 +51,8 @@ int fbnic_fw_log_init(struct fbnic_dev *fbd)
 	log->data_start = data;
 	log->data_end = data + FBNIC_FW_LOG_SIZE;
 
+	fbnic_fw_log_enable(fbd, true);
+
 	return 0;
 }
 
@@ -36,6 +63,7 @@ void fbnic_fw_log_free(struct fbnic_dev *fbd)
 	if (!fbnic_fw_log_ready(fbd))
 		return;
 
+	fbnic_fw_log_disable(fbd);
 	INIT_LIST_HEAD(&log->entries);
 	log->size = 0;
 	vfree(log->data_start);
drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h +2 -0
index 881ee298ede7..cb6555f40a24 100644
@@ -36,6 +36,8 @@ struct fbnic_fw_log {
 
 #define fbnic_fw_log_ready(_fbd)	(!!(_fbd)->fw_log.data_start)
 
+void fbnic_fw_log_enable(struct fbnic_dev *fbd, bool send_hist);
+void fbnic_fw_log_disable(struct fbnic_dev *fbd);
 int fbnic_fw_log_init(struct fbnic_dev *fbd);
 void fbnic_fw_log_free(struct fbnic_dev *fbd);
 int fbnic_fw_log_write(struct fbnic_dev *fbd, u64 index, u32 timestamp,
drivers/net/ethernet/meta/fbnic/fbnic_pci.c +21 -0
index 249d3ef862d5..b70e4cadb37b 100644
@@ -291,6 +291,17 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto free_irqs;
 	}
 
+	/* Send the request to enable the FW logging to host. Note if this
+	 * fails we ignore the error and just display a message as it is
+	 * possible the FW is just too old to support the logging and needs
+	 * to be updated.
+	 */
+	err = fbnic_fw_log_init(fbd);
+	if (err)
+		dev_warn(fbd->dev,
+			 "Unable to initialize firmware log buffer: %d\n",
+			 err);
+
 	fbnic_devlink_register(fbd);
 	fbnic_dbg_fbd_init(fbd);
 	spin_lock_init(&fbd->hw_stats_lock);
@@ -365,6 +376,7 @@ static void fbnic_remove(struct pci_dev *pdev)
 	fbnic_hwmon_unregister(fbd);
 	fbnic_dbg_fbd_exit(fbd);
 	fbnic_devlink_unregister(fbd);
+	fbnic_fw_log_free(fbd);
 	fbnic_fw_free_mbx(fbd);
 	fbnic_free_irqs(fbd);
 
@@ -389,6 +401,8 @@ static int fbnic_pm_suspend(struct device *dev)
 	rtnl_unlock();
 
 null_uc_addr:
+	fbnic_fw_log_disable(fbd);
+
 	devl_lock(priv_to_devlink(fbd));
 
 	fbnic_fw_free_mbx(fbd);
@@ -434,6 +448,11 @@ static int __fbnic_pm_resume(struct device *dev)
 
 	devl_unlock(priv_to_devlink(fbd));
 
+	/* Only send log history if log buffer is empty to prevent duplicate
+	 * log entries.
+	 */
+	fbnic_fw_log_enable(fbd, list_empty(&fbd->fw_log.entries));
+
 	/* No netdev means there isn't a network interface to bring up */
 	if (fbnic_init_failure(fbd))
 		return 0;
@@ -455,6 +474,8 @@ static int __fbnic_pm_resume(struct device *dev)
 
 	return 0;
 err_free_mbx:
+	fbnic_fw_log_disable(fbd);
+
 	rtnl_unlock();
 	fbnic_fw_free_mbx(fbd);
 err_free_irqs:

--
2.47.1

author
#6 lore raw

PATCH 6/6 eth: fbnic: Create fw_log file in DebugFS

In reply to Lee Trager

Allow reading the firmware log in DebugFS by accessing the fw_log file. Buffer is read while a spinlock is acquired.

---
 .../net/ethernet/meta/fbnic/fbnic_debugfs.c   | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c +29 -0
index e8f2d7f2d962..b7238dd967fe 100644
@@ -170,6 +170,33 @@ static int fbnic_dbg_ipo_dst_show(struct seq_file *s, void *v)
 }
 DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_ipo_dst);
 
+static int fbnic_dbg_fw_log_show(struct seq_file *s, void *v)
+{
+	struct fbnic_dev *fbd = s->private;
+	struct fbnic_fw_log_entry *entry;
+	unsigned long flags;
+
+	if (!fbnic_fw_log_ready(fbd))
+		return -ENXIO;
+
+	spin_lock_irqsave(&fbd->fw_log.lock, flags);
+
+	list_for_each_entry_reverse(entry, &fbd->fw_log.entries, list) {
+		seq_printf(s, FBNIC_FW_LOG_FMT, entry->index,
+			   (entry->timestamp / (MSEC_PER_SEC * 60 * 60 * 24)),
+			   (entry->timestamp / (MSEC_PER_SEC * 60 * 60)) % 24,
+			   ((entry->timestamp / (MSEC_PER_SEC * 60) % 60)),
+			   ((entry->timestamp / MSEC_PER_SEC) % 60),
+			   (entry->timestamp % MSEC_PER_SEC),
+			   entry->msg);
+	}
+
+	spin_unlock_irqrestore(&fbd->fw_log.lock, flags);
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_fw_log);
+
 static int fbnic_dbg_pcie_stats_show(struct seq_file *s, void *v)
 {
 	struct fbnic_dev *fbd = s->private;
@@ -222,6 +249,8 @@ void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
 			    &fbnic_dbg_ipo_src_fops);
 	debugfs_create_file("ipo_dst", 0400, fbd->dbg_fbd, fbd,
 			    &fbnic_dbg_ipo_dst_fops);
+	debugfs_create_file("fw_log", 0400, fbd->dbg_fbd, fbd,
+			    &fbnic_dbg_fw_log_fops);
 }
 
 void fbnic_dbg_fbd_exit(struct fbnic_dev *fbd)

--
2.47.1

Reviewed-by on the v1 series
#7 lore raw
In reply to Lee Trager
Quoted 4 lines · Lee Trager

Firmware running on fbnic generates device logs. These logs contain useful information about the device which may or may not be related to the host. Logs are stored in a ring buffer and accessible through DebugFS.

Quoted 8 lines

Lee Trager (6):
eth: fbnic: Fix incorrect minimum firmware version
eth: fbnic: Use FIELD_PREP to generate minimum firmware version
eth: fbnic: Create ring buffer for firmware logs
eth: fbnic: Add mailbox support for firmware logs
eth: fbnic: Enable firmware logging
eth: fbnic: Create fw_log file in DebugFS

Everything looked straight forward to me.

Quoted 15 lines
 drivers/net/ethernet/meta/fbnic/Makefile      |   1 +
 drivers/net/ethernet/meta/fbnic/fbnic.h       |   3 +
 drivers/net/ethernet/meta/fbnic/fbnic_csr.h   |  27 ++-
 .../net/ethernet/meta/fbnic/fbnic_debugfs.c   |  29 +++
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c    | 179 +++++++++++++++++-
 drivers/net/ethernet/meta/fbnic/fbnic_fw.h    |  36 ++++
 .../net/ethernet/meta/fbnic/fbnic_fw_log.c    | 123 ++++++++++++
 .../net/ethernet/meta/fbnic/fbnic_fw_log.h    |  45 +++++
 drivers/net/ethernet/meta/fbnic/fbnic_pci.c   |  21 ++
 9 files changed, 451 insertions(+), 13 deletions(-)
 create mode 100644 drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
 create mode 100644 drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h

--
2.47.1

#8 lore raw
In reply to Lee Trager
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 12 lines · On Wed, 2 Jul 2025 12:12:06 -0700 you wrote:

Firmware running on fbnic generates device logs. These logs contain useful information about the device which may or may not be related to the host. Logs are stored in a ring buffer and accessible through DebugFS.

Lee Trager (6):
eth: fbnic: Fix incorrect minimum firmware version
eth: fbnic: Use FIELD_PREP to generate minimum firmware version
eth: fbnic: Create ring buffer for firmware logs
eth: fbnic: Add mailbox support for firmware logs
eth: fbnic: Enable firmware logging
eth: fbnic: Create fw_log file in DebugFS

Quoted 1 line

[...]

Here is the summary with links:
- [net-next,1/6] eth: fbnic: Fix incorrect minimum firmware version

    https://git.kernel.org/netdev/net-next/c/dd62e960a755
  - [net-next,2/6] eth: fbnic: Use FIELD_PREP to generate minimum firmware version
    https://git.kernel.org/netdev/net-next/c/e48f6620ee81
  - [net-next,3/6] eth: fbnic: Create ring buffer for firmware logs
    https://git.kernel.org/netdev/net-next/c/c2b93d6beca8
  - [net-next,4/6] eth: fbnic: Add mailbox support for firmware logs
    https://git.kernel.org/netdev/net-next/c/2e972f32ae5f
  - [net-next,5/6] eth: fbnic: Enable firmware logging
    https://git.kernel.org/netdev/net-next/c/ecc53b1b46c8
  - [net-next,6/6] eth: fbnic: Create fw_log file in DebugFS
    https://git.kernel.org/netdev/net-next/c/432407c86993

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html