linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/6] eth: fbnic: Add firmware logging support
@ 2025-07-02 19:12 Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 1/6] eth: fbnic: Fix incorrect minimum firmware version Lee Trager
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Lee Trager @ 2025-07-02 19:12 UTC (permalink / raw)
  To: Alexander Duyck, Jakub Kicinski, kernel-team, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Kees Cook,
	Gustavo A. R. Silva, Sanman Pradhan, Mohsin Bashir, Su Hui,
	Vadim Fedorenko, Simon Horman, Lee Trager, Kalesh AP,
	Jacob Keller
  Cc: Andrew Lunn, linux-kernel, netdev, linux-hardening

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

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

* [PATCH net-next 1/6] eth: fbnic: Fix incorrect minimum firmware version
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
@ 2025-07-02 19:12 ` Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 2/6] eth: fbnic: Use FIELD_PREP to generate " Lee Trager
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Lee Trager @ 2025-07-02 19:12 UTC (permalink / raw)
  To: Alexander Duyck, Jakub Kicinski, kernel-team, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Kees Cook,
	Gustavo A. R. Silva, Mohsin Bashir, Sanman Pradhan,
	Vadim Fedorenko, Su Hui, Simon Horman, Lee Trager, Jacob Keller
  Cc: Andrew Lunn, Kalesh AP, linux-kernel, netdev, linux-hardening

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.

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 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(-)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index 9c89d5378668..e2b251eddbb3 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -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

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
index 1d220d8369e7..cdc1e2938a64 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
@@ -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

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

* [PATCH net-next 2/6] eth: fbnic: Use FIELD_PREP to generate minimum firmware version
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 1/6] eth: fbnic: Fix incorrect minimum firmware version Lee Trager
@ 2025-07-02 19:12 ` Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 3/6] eth: fbnic: Create ring buffer for firmware logs Lee Trager
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Lee Trager @ 2025-07-02 19:12 UTC (permalink / raw)
  To: Alexander Duyck, Jakub Kicinski, kernel-team, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Kees Cook,
	Gustavo A. R. Silva, Sanman Pradhan, Mohsin Bashir,
	Vadim Fedorenko, Su Hui, Simon Horman, Lee Trager, Jacob Keller
  Cc: Andrew Lunn, Kalesh AP, linux-kernel, netdev, linux-hardening

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.

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 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(-)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index e2b251eddbb3..06b9c49e51a2 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -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

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
index cdc1e2938a64..ac7804a8a22c 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
@@ -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

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

* [PATCH net-next 3/6] eth: fbnic: Create ring buffer for firmware logs
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 1/6] eth: fbnic: Fix incorrect minimum firmware version Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 2/6] eth: fbnic: Use FIELD_PREP to generate " Lee Trager
@ 2025-07-02 19:12 ` Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 4/6] eth: fbnic: Add mailbox support " Lee Trager
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Lee Trager @ 2025-07-02 19:12 UTC (permalink / raw)
  To: Alexander Duyck, Jakub Kicinski, kernel-team, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Kees Cook,
	Gustavo A. R. Silva, Mohsin Bashir, Sanman Pradhan, Su Hui,
	Vadim Fedorenko, Simon Horman, Lee Trager, Kalesh AP,
	Jacob Keller
  Cc: Andrew Lunn, linux-kernel, netdev, linux-hardening

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.

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 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

diff --git a/drivers/net/ethernet/meta/fbnic/Makefile b/drivers/net/ethernet/meta/fbnic/Makefile
index 0dbc634adb4b..15e8ff649615 100644
--- a/drivers/net/ethernet/meta/fbnic/Makefile
+++ b/drivers/net/ethernet/meta/fbnic/Makefile
@@ -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 \
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic.h b/drivers/net/ethernet/meta/fbnic/fbnic.h
index 65815d4f379e..c376e06880c9 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic.h
@@ -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
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
new file mode 100644
index 000000000000..caedbe7844f7
--- /dev/null
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) Meta Platforms, Inc. and affiliates. */
+
+#include <linux/spinlock.h>
+#include <linux/vmalloc.h>
+
+#include "fbnic.h"
+#include "fbnic_fw.h"
+#include "fbnic_fw_log.h"
+
+int fbnic_fw_log_init(struct fbnic_dev *fbd)
+{
+	struct fbnic_fw_log *log = &fbd->fw_log;
+	void *data;
+
+	if (WARN_ON_ONCE(fbnic_fw_log_ready(fbd)))
+		return -EEXIST;
+
+	data = vmalloc(FBNIC_FW_LOG_SIZE);
+	if (!data)
+		return -ENOMEM;
+
+	spin_lock_init(&fbd->fw_log.lock);
+	INIT_LIST_HEAD(&log->entries);
+	log->size = FBNIC_FW_LOG_SIZE;
+	log->data_start = data;
+	log->data_end = data + FBNIC_FW_LOG_SIZE;
+
+	return 0;
+}
+
+void fbnic_fw_log_free(struct fbnic_dev *fbd)
+{
+	struct fbnic_fw_log *log = &fbd->fw_log;
+
+	if (!fbnic_fw_log_ready(fbd))
+		return;
+
+	INIT_LIST_HEAD(&log->entries);
+	log->size = 0;
+	vfree(log->data_start);
+	log->data_start = NULL;
+	log->data_end = NULL;
+}
+
+int fbnic_fw_log_write(struct fbnic_dev *fbd, u64 index, u32 timestamp,
+		       char *msg)
+{
+	struct fbnic_fw_log_entry *entry, *head, *tail, *next;
+	struct fbnic_fw_log *log = &fbd->fw_log;
+	size_t msg_len = strlen(msg) + 1;
+	unsigned long flags;
+	void *entry_end;
+
+	if (!fbnic_fw_log_ready(fbd)) {
+		dev_err(fbd->dev, "Firmware sent log entry without being requested!\n");
+		return -ENOSPC;
+	}
+
+	spin_lock_irqsave(&log->lock, flags);
+
+	if (list_empty(&log->entries)) {
+		entry = log->data_start;
+	} else {
+		head = list_first_entry(&log->entries, typeof(*head), list);
+		entry = (struct fbnic_fw_log_entry *)&head->msg[head->len + 1];
+		entry = PTR_ALIGN(entry, 8);
+	}
+
+	entry_end = &entry->msg[msg_len + 1];
+
+	/* We've reached the end of the buffer, wrap around */
+	if (entry_end > log->data_end) {
+		entry = log->data_start;
+		entry_end = &entry->msg[msg_len + 1];
+	}
+
+	/* Make room for entry by removing from tail. */
+	list_for_each_entry_safe_reverse(tail, next, &log->entries, list) {
+		if (entry <= tail && entry_end > (void *)tail)
+			list_del(&tail->list);
+		else
+			break;
+	}
+
+	entry->index = index;
+	entry->timestamp = timestamp;
+	entry->len = msg_len;
+	strscpy(entry->msg, msg, entry->len);
+	list_add(&entry->list, &log->entries);
+
+	spin_unlock_irqrestore(&log->lock, flags);
+
+	return 0;
+}
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h
new file mode 100644
index 000000000000..881ee298ede7
--- /dev/null
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) Meta Platforms, Inc. and affiliates. */
+
+#ifndef _FBNIC_FW_LOG_H_
+#define _FBNIC_FW_LOG_H_
+
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+/* A 512K log buffer was chosen fairly arbitrarily */
+#define FBNIC_FW_LOG_SIZE	(512 * 1024) /* bytes */
+
+/* Firmware log output is prepended with log index followed by a timestamp.
+ * The timestamp is similar to Zephyr's format DD:HH:MM:SS.MMM
+ */
+#define FBNIC_FW_LOG_FMT	"[%5lld] [%02ld:%02ld:%02ld:%02ld.%03ld] %s\n"
+
+struct fbnic_dev;
+
+struct fbnic_fw_log_entry {
+	struct list_head	list;
+	u64			index;
+	u32			timestamp;
+	u16			len;
+	char			msg[] __counted_by(len);
+};
+
+struct fbnic_fw_log {
+	void			*data_start;
+	void			*data_end;
+	size_t			size;
+	struct list_head	entries;
+	/* Spin lock for accessing or modifying entries */
+	spinlock_t		lock;
+};
+
+#define fbnic_fw_log_ready(_fbd)	(!!(_fbd)->fw_log.data_start)
+
+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,
+		       char *msg);
+#endif /* _FBNIC_FW_LOG_H_ */
--
2.47.1

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

* [PATCH net-next 4/6] eth: fbnic: Add mailbox support for firmware logs
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
                   ` (2 preceding siblings ...)
  2025-07-02 19:12 ` [PATCH net-next 3/6] eth: fbnic: Create ring buffer for firmware logs Lee Trager
@ 2025-07-02 19:12 ` Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 5/6] eth: fbnic: Enable firmware logging Lee Trager
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Lee Trager @ 2025-07-02 19:12 UTC (permalink / raw)
  To: Alexander Duyck, Jakub Kicinski, kernel-team, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Kees Cook,
	Gustavo A. R. Silva, Mohsin Bashir, Sanman Pradhan,
	Vadim Fedorenko, Su Hui, Simon Horman, Lee Trager, Kalesh AP,
	Jacob Keller
  Cc: Andrew Lunn, linux-kernel, netdev, linux-hardening

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 */
	...
    }
}

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 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(+)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index 06b9c49e51a2..a81db842aa53 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -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))
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
index ac7804a8a22c..0c55be7d2547 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
@@ -1034,6 +1034,169 @@ static int fbnic_fw_parse_tsene_read_resp(void *opaque,
 	return err;
 }

+static const struct fbnic_tlv_index fbnic_fw_log_req_index[] = {
+	FBNIC_TLV_ATTR_U32(FBNIC_FW_LOG_MSEC),
+	FBNIC_TLV_ATTR_U64(FBNIC_FW_LOG_INDEX),
+	FBNIC_TLV_ATTR_STRING(FBNIC_FW_LOG_MSG, FBNIC_FW_LOG_MAX_SIZE),
+	FBNIC_TLV_ATTR_U32(FBNIC_FW_LOG_LENGTH),
+	FBNIC_TLV_ATTR_ARRAY(FBNIC_FW_LOG_MSEC_ARRAY),
+	FBNIC_TLV_ATTR_ARRAY(FBNIC_FW_LOG_INDEX_ARRAY),
+	FBNIC_TLV_ATTR_ARRAY(FBNIC_FW_LOG_MSG_ARRAY),
+	FBNIC_TLV_ATTR_LAST
+};
+
+static int fbnic_fw_process_log_array(struct fbnic_tlv_msg **results,
+				      u16 length, u16 arr_type_idx,
+				      u16 attr_type_idx,
+				      struct fbnic_tlv_msg **tlv_array_out)
+{
+	struct fbnic_tlv_msg *attr;
+	int attr_len;
+	int err;
+
+	if (!results[attr_type_idx])
+		return -EINVAL;
+
+	tlv_array_out[0] = results[attr_type_idx];
+
+	if (!length)
+		return 0;
+
+	if (!results[arr_type_idx])
+		return -EINVAL;
+
+	attr = results[arr_type_idx];
+	attr_len = le16_to_cpu(attr->hdr.len) / sizeof(u32) - 1;
+	err = fbnic_tlv_attr_parse_array(&attr[1], attr_len, &tlv_array_out[1],
+					 fbnic_fw_log_req_index,
+					 attr_type_idx,
+					 length);
+	if (err)
+		return err;
+
+	return 0;
+}
+
+static int fbnic_fw_parse_logs(struct fbnic_dev *fbd,
+			       struct fbnic_tlv_msg **msec_tlv,
+			       struct fbnic_tlv_msg **index_tlv,
+			       struct fbnic_tlv_msg **log_tlv,
+			       int count)
+{
+	int i;
+
+	for (i = 0; i < count; i++) {
+		char log[FBNIC_FW_LOG_MAX_SIZE];
+		ssize_t len;
+		u64 index;
+		u32 msec;
+		int err;
+
+		if (!msec_tlv[i] || !index_tlv[i] || !log_tlv[i]) {
+			dev_warn(fbd->dev, "Received log message with missing attributes!\n");
+			return -EINVAL;
+		}
+
+		index = fbnic_tlv_attr_get_signed(index_tlv[i], 0);
+		msec = fbnic_tlv_attr_get_signed(msec_tlv[i], 0);
+		len = fbnic_tlv_attr_get_string(log_tlv[i], log,
+						FBNIC_FW_LOG_MAX_SIZE);
+		if (len < 0)
+			return len;
+
+		err = fbnic_fw_log_write(fbd, index, msec, log);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+static int fbnic_fw_parse_log_req(void *opaque,
+				  struct fbnic_tlv_msg **results)
+{
+	struct fbnic_tlv_msg *index_tlv[FBNIC_FW_MAX_LOG_HISTORY];
+	struct fbnic_tlv_msg *msec_tlv[FBNIC_FW_MAX_LOG_HISTORY];
+	struct fbnic_tlv_msg *log_tlv[FBNIC_FW_MAX_LOG_HISTORY];
+	struct fbnic_dev *fbd = opaque;
+	u16 length;
+	int err;
+
+	length = fta_get_uint(results, FBNIC_FW_LOG_LENGTH);
+	if (length >= FBNIC_FW_MAX_LOG_HISTORY)
+		return -E2BIG;
+
+	err = fbnic_fw_process_log_array(results, length,
+					 FBNIC_FW_LOG_MSEC_ARRAY,
+					 FBNIC_FW_LOG_MSEC, msec_tlv);
+	if (err)
+		return err;
+
+	err = fbnic_fw_process_log_array(results, length,
+					 FBNIC_FW_LOG_INDEX_ARRAY,
+					 FBNIC_FW_LOG_INDEX, index_tlv);
+	if (err)
+		return err;
+
+	err = fbnic_fw_process_log_array(results, length,
+					 FBNIC_FW_LOG_MSG_ARRAY,
+					 FBNIC_FW_LOG_MSG, log_tlv);
+	if (err)
+		return err;
+
+	err = fbnic_fw_parse_logs(fbd, msec_tlv, index_tlv, log_tlv,
+				  length + 1);
+	if (err)
+		return err;
+
+	return 0;
+}
+
+int fbnic_fw_xmit_send_logs(struct fbnic_dev *fbd, bool enable,
+			    bool send_log_history)
+{
+	struct fbnic_tlv_msg *msg;
+	int err;
+
+	if (fbd->fw_cap.running.mgmt.version < MIN_FW_VER_CODE_LOG) {
+		dev_warn(fbd->dev, "Firmware version is too old to support firmware logs!\n");
+		return -EOPNOTSUPP;
+	}
+
+	msg = fbnic_tlv_msg_alloc(FBNIC_TLV_MSG_ID_LOG_SEND_LOGS_REQ);
+	if (!msg)
+		return -ENOMEM;
+
+	if (enable) {
+		err = fbnic_tlv_attr_put_flag(msg, FBNIC_SEND_LOGS);
+		if (err)
+			goto free_message;
+
+		/* Report request for version 1 of logs */
+		err = fbnic_tlv_attr_put_int(msg, FBNIC_SEND_LOGS_VERSION,
+					     FBNIC_FW_LOG_VERSION);
+		if (err)
+			goto free_message;
+
+		if (send_log_history) {
+			err = fbnic_tlv_attr_put_flag(msg,
+						      FBNIC_SEND_LOGS_HISTORY);
+			if (err)
+				goto free_message;
+		}
+	}
+
+	err = fbnic_mbx_map_tlv_msg(fbd, msg);
+	if (err)
+		goto free_message;
+
+	return 0;
+
+free_message:
+	free_page((unsigned long)msg);
+	return err;
+}
+
 static const struct fbnic_tlv_parser fbnic_fw_tlv_parser[] = {
 	FBNIC_TLV_PARSER(FW_CAP_RESP, fbnic_fw_cap_resp_index,
 			 fbnic_fw_parse_cap_resp),
@@ -1053,6 +1216,9 @@ static const struct fbnic_tlv_parser fbnic_fw_tlv_parser[] = {
 	FBNIC_TLV_PARSER(TSENE_READ_RESP,
 			 fbnic_tsene_read_resp_index,
 			 fbnic_fw_parse_tsene_read_resp),
+	FBNIC_TLV_PARSER(LOG_MSG_REQ,
+			 fbnic_fw_log_req_index,
+			 fbnic_fw_parse_log_req),
 	FBNIC_TLV_MSG_ERROR
 };

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.h b/drivers/net/ethernet/meta/fbnic/fbnic_fw.h
index 555b231b38c1..fde331696fdd 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.h
@@ -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

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

* [PATCH net-next 5/6] eth: fbnic: Enable firmware logging
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
                   ` (3 preceding siblings ...)
  2025-07-02 19:12 ` [PATCH net-next 4/6] eth: fbnic: Add mailbox support " Lee Trager
@ 2025-07-02 19:12 ` Lee Trager
  2025-07-02 19:12 ` [PATCH net-next 6/6] eth: fbnic: Create fw_log file in DebugFS Lee Trager
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Lee Trager @ 2025-07-02 19:12 UTC (permalink / raw)
  To: Alexander Duyck, Jakub Kicinski, kernel-team, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Kees Cook,
	Gustavo A. R. Silva, Sanman Pradhan, Mohsin Bashir, Su Hui,
	Vadim Fedorenko, Simon Horman, Lee Trager, Kalesh AP,
	Jacob Keller
  Cc: Andrew Lunn, linux-kernel, netdev, linux-hardening

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.

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 .../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(+)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
index caedbe7844f7..38749d47cee6 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.c
@@ -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);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h
index 881ee298ede7..cb6555f40a24 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h
@@ -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,
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
index 249d3ef862d5..b70e4cadb37b 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
@@ -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

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

* [PATCH net-next 6/6] eth: fbnic: Create fw_log file in DebugFS
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
                   ` (4 preceding siblings ...)
  2025-07-02 19:12 ` [PATCH net-next 5/6] eth: fbnic: Enable firmware logging Lee Trager
@ 2025-07-02 19:12 ` Lee Trager
  2025-07-02 20:45 ` [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Jacob Keller
  2025-07-09  0:20 ` patchwork-bot+netdevbpf
  7 siblings, 0 replies; 9+ messages in thread
From: Lee Trager @ 2025-07-02 19:12 UTC (permalink / raw)
  To: Alexander Duyck, Jakub Kicinski, kernel-team, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Kees Cook,
	Gustavo A. R. Silva, Sanman Pradhan, Mohsin Bashir,
	Vadim Fedorenko, Su Hui, Simon Horman, Lee Trager, Kalesh AP,
	Jacob Keller
  Cc: Andrew Lunn, linux-kernel, netdev, linux-hardening

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

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 .../net/ethernet/meta/fbnic/fbnic_debugfs.c   | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c b/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
index e8f2d7f2d962..b7238dd967fe 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
@@ -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

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

* Re: [PATCH net-next 0/6] eth: fbnic: Add firmware logging support
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
                   ` (5 preceding siblings ...)
  2025-07-02 19:12 ` [PATCH net-next 6/6] eth: fbnic: Create fw_log file in DebugFS Lee Trager
@ 2025-07-02 20:45 ` Jacob Keller
  2025-07-09  0:20 ` patchwork-bot+netdevbpf
  7 siblings, 0 replies; 9+ messages in thread
From: Jacob Keller @ 2025-07-02 20:45 UTC (permalink / raw)
  To: Lee Trager, Alexander Duyck, Jakub Kicinski, kernel-team,
	Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Kees Cook, Gustavo A. R. Silva, Sanman Pradhan, Mohsin Bashir,
	Su Hui, Vadim Fedorenko, Simon Horman, Kalesh AP
  Cc: Andrew Lunn, linux-kernel, netdev, linux-hardening


[-- Attachment #1.1: Type: text/plain, Size: 1500 bytes --]



On 7/2/2025 12:12 PM, Lee Trager 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
> 

Everything looked straight forward to me.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: [PATCH net-next 0/6] eth: fbnic: Add firmware logging support
  2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
                   ` (6 preceding siblings ...)
  2025-07-02 20:45 ` [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Jacob Keller
@ 2025-07-09  0:20 ` patchwork-bot+netdevbpf
  7 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-09  0:20 UTC (permalink / raw)
  To: Lee Trager
  Cc: alexanderduyck, kuba, kernel-team, andrew+netdev, davem, edumazet,
	pabeni, kees, gustavoars, sanman.p211993, mohsin.bashr, suhui,
	vadim.fedorenko, horms, kalesh-anakkur.purayil, jacob.e.keller,
	andrew, linux-kernel, netdev, linux-hardening

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-07-09  0:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 19:12 [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Lee Trager
2025-07-02 19:12 ` [PATCH net-next 1/6] eth: fbnic: Fix incorrect minimum firmware version Lee Trager
2025-07-02 19:12 ` [PATCH net-next 2/6] eth: fbnic: Use FIELD_PREP to generate " Lee Trager
2025-07-02 19:12 ` [PATCH net-next 3/6] eth: fbnic: Create ring buffer for firmware logs Lee Trager
2025-07-02 19:12 ` [PATCH net-next 4/6] eth: fbnic: Add mailbox support " Lee Trager
2025-07-02 19:12 ` [PATCH net-next 5/6] eth: fbnic: Enable firmware logging Lee Trager
2025-07-02 19:12 ` [PATCH net-next 6/6] eth: fbnic: Create fw_log file in DebugFS Lee Trager
2025-07-02 20:45 ` [PATCH net-next 0/6] eth: fbnic: Add firmware logging support Jacob Keller
2025-07-09  0:20 ` patchwork-bot+netdevbpf

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).