eth: fbnic: Add mailbox support for firmware logs
authorLee Trager <lee@trager.us>
Wed, 2 Jul 2025 19:12:10 +0000 (12:12 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 9 Jul 2025 00:05:46 +0000 (17:05 -0700)
commit2e972f32ae5ff7a5592c627932f0001b8fe04a36
tree02de0dea5f8bfa2a8b5fdcbc0151a7b9fc5123ef
parentc2b93d6beca8526fb38ccc834def1c987afe24fc
eth: fbnic: Add mailbox support for firmware logs

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>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250702192207.697368-5-lee@trager.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/meta/fbnic/fbnic_csr.h
drivers/net/ethernet/meta/fbnic/fbnic_fw.c
drivers/net/ethernet/meta/fbnic/fbnic_fw.h