Skip to content

Commit 716425d

Browse files
daniellertskuba-moo
authored andcommitted
net: ethtool: Enhance error messages sent to user space
During the firmware flashing process, notifications are sent to user space to provide progress updates. When an error occurs, an error message is sent to indicate what went wrong. In some cases, appropriate error messages are missing. Add relevant error messages where applicable, allowing user space to better understand the issues encountered. Signed-off-by: Danielle Ratson <[email protected]> Reviewed-by: Petr Machata <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6503734 commit 716425d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

net/ethtool/cmis_cdb.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ static u8 cmis_cdb_advert_rpl_inst_supported(struct cmis_cdb_advert_rpl *rpl)
100100
}
101101

102102
static int cmis_cdb_advertisement_get(struct ethtool_cmis_cdb *cdb,
103-
struct net_device *dev)
103+
struct net_device *dev,
104+
struct ethnl_module_fw_flash_ntf_params *ntf_params)
104105
{
105106
const struct ethtool_ops *ops = dev->ethtool_ops;
106107
struct ethtool_module_eeprom page_data = {};
@@ -119,8 +120,12 @@ static int cmis_cdb_advertisement_get(struct ethtool_cmis_cdb *cdb,
119120
return err;
120121
}
121122

122-
if (!cmis_cdb_advert_rpl_inst_supported(&rpl))
123+
if (!cmis_cdb_advert_rpl_inst_supported(&rpl)) {
124+
ethnl_module_fw_flash_ntf_err(dev, ntf_params,
125+
"CDB functionality is not supported",
126+
NULL);
123127
return -EOPNOTSUPP;
128+
}
124129

125130
cdb->read_write_len_ext = rpl.read_write_len_ext;
126131

@@ -282,7 +287,7 @@ ethtool_cmis_cdb_init(struct net_device *dev,
282287
goto err;
283288
}
284289

285-
err = cmis_cdb_advertisement_get(cdb, dev);
290+
err = cmis_cdb_advertisement_get(cdb, dev, ntf_params);
286291
if (err < 0)
287292
goto err;
288293

@@ -444,6 +449,9 @@ static void cmis_cdb_status_fail_msg_get(u8 status, char **err_msg)
444449
case 0b01000101:
445450
*err_msg = "CDB status failed: CdbChkCode error";
446451
break;
452+
case 0b01000110:
453+
*err_msg = "CDB status failed: Password error";
454+
break;
447455
default:
448456
*err_msg = "Unknown failure reason";
449457
}

0 commit comments

Comments
 (0)