eth: fbnic: Accept minimum anti-rollback version from firmware
authorLee Trager <lee@trager.us>
Mon, 12 May 2025 18:53:58 +0000 (11:53 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 15 May 2025 10:59:18 +0000 (12:59 +0200)
fbnic supports applying firmware which may not be rolled back. This is
implemented in firmware however it is useful for the driver to know the
minimum supported firmware version. This will enable the driver validate
new firmware before it is sent to the NIC. If it is too old the driver can
provide a clear message that the version is too old.

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250512190109.2475614-3-lee@trager.us
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/meta/fbnic/fbnic_fw.c
drivers/net/ethernet/meta/fbnic/fbnic_fw.h

index 3d9636a..e4f72fb 100644 (file)
@@ -464,6 +464,7 @@ static const struct fbnic_tlv_index fbnic_fw_cap_resp_index[] = {
        FBNIC_TLV_ATTR_U32(FBNIC_FW_CAP_RESP_UEFI_VERSION),
        FBNIC_TLV_ATTR_STRING(FBNIC_FW_CAP_RESP_UEFI_COMMIT_STR,
                              FBNIC_FW_CAP_RESP_COMMIT_MAX_SIZE),
+       FBNIC_TLV_ATTR_U32(FBNIC_FW_CAP_RESP_ANTI_ROLLBACK_VERSION),
        FBNIC_TLV_ATTR_LAST
 };
 
@@ -586,6 +587,9 @@ static int fbnic_fw_parse_cap_resp(void *opaque, struct fbnic_tlv_msg **results)
        if (results[FBNIC_FW_CAP_RESP_BMC_ALL_MULTI] || !bmc_present)
                fbd->fw_cap.all_multi = all_multi;
 
+       fbd->fw_cap.anti_rollback_version =
+               fta_get_uint(results, FBNIC_FW_CAP_RESP_ANTI_ROLLBACK_VERSION);
+
        return 0;
 }
 
index a3618e7..692dfd8 100644 (file)
@@ -42,6 +42,7 @@ struct fbnic_fw_cap {
        u8      all_multi       : 1;
        u8      link_speed;
        u8      link_fec;
+       u32     anti_rollback_version;
 };
 
 struct fbnic_fw_completion {
@@ -122,6 +123,7 @@ enum {
        FBNIC_FW_CAP_RESP_STORED_CMRT_COMMIT_STR        = 0x10,
        FBNIC_FW_CAP_RESP_UEFI_VERSION                  = 0x11,
        FBNIC_FW_CAP_RESP_UEFI_COMMIT_STR               = 0x12,
+       FBNIC_FW_CAP_RESP_ANTI_ROLLBACK_VERSION         = 0x15,
        FBNIC_FW_CAP_RESP_MSG_MAX
 };