]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net: ethtool: Allow write mechanism of LPL and both LPL and EPL
authorDanielle Ratson <danieller@nvidia.com>
Mon, 12 Aug 2024 14:08:24 +0000 (17:08 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 15 Aug 2024 10:20:14 +0000 (12:20 +0200)
CMIS 5.2 standard section 9.4.2 defines four types of firmware update
supported mechanism: None, only LPL, only EPL, both LPL and EPL.

Currently, only LPL (Local Payload) type of write firmware block is
supported. However, if the module supports both LPL and EPL the flashing
process wrongly fails for no supporting LPL.

Fix that, by allowing the write mechanism to be LPL or both LPL and
EPL.

Fixes: c4f78134d45c ("ethtool: cmis_fw_update: add a layer for supporting firmware update using CDB")
Reported-by: Vladyslav Mykhaliuk <vmykhaliuk@nvidia.com>
Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Link: https://patch.msgid.link/20240812140824.3718826-1-danieller@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/ethtool/cmis_fw_update.c

index ae4b4b28a6014f5b18cce788a14b0e8d78224084..655ff5224ffa30ff721998f38e2b22b1545c68fa 100644 (file)
@@ -35,7 +35,10 @@ struct cmis_cdb_fw_mng_features_rpl {
        __be16  resv7;
 };
 
-#define CMIS_CDB_FW_WRITE_MECHANISM_LPL        0x01
+enum cmis_cdb_fw_write_mechanism {
+       CMIS_CDB_FW_WRITE_MECHANISM_LPL         = 0x01,
+       CMIS_CDB_FW_WRITE_MECHANISM_BOTH        = 0x11,
+};
 
 static int
 cmis_fw_update_fw_mng_features_get(struct ethtool_cmis_cdb *cdb,
@@ -64,7 +67,8 @@ cmis_fw_update_fw_mng_features_get(struct ethtool_cmis_cdb *cdb,
        }
 
        rpl = (struct cmis_cdb_fw_mng_features_rpl *)args.req.payload;
-       if (!(rpl->write_mechanism == CMIS_CDB_FW_WRITE_MECHANISM_LPL)) {
+       if (!(rpl->write_mechanism == CMIS_CDB_FW_WRITE_MECHANISM_LPL ||
+             rpl->write_mechanism == CMIS_CDB_FW_WRITE_MECHANISM_BOTH)) {
                ethnl_module_fw_flash_ntf_err(dev, ntf_params,
                                              "Write LPL is not supported",
                                              NULL);