Commit e670e1e8 authored by Rahul Lakkireddy's avatar Rahul Lakkireddy Committed by Jakub Kicinski

cxgb4: allow reading unrecognized port module eeprom

Even if firmware fails to recognize the plugged-in port module type,
allow reading port module EEPROM anyway. This helps in obtaining
necessary diagnostics information for debugging and analysis.
Signed-off-by: default avatarManoj Malviya <manojmalviya@chelsio.com>
Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Link: https://lore.kernel.org/r/1637682437-31407-1-git-send-email-rahul.lakkireddy@chelsio.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5a45ab3f
...@@ -1993,6 +1993,15 @@ static int get_dump_data(struct net_device *dev, struct ethtool_dump *eth_dump, ...@@ -1993,6 +1993,15 @@ static int get_dump_data(struct net_device *dev, struct ethtool_dump *eth_dump,
return 0; return 0;
} }
static bool cxgb4_fw_mod_type_info_available(unsigned int fw_mod_type)
{
/* Read port module EEPROM as long as it is plugged-in and
* safe to read.
*/
return (fw_mod_type != FW_PORT_MOD_TYPE_NONE &&
fw_mod_type != FW_PORT_MOD_TYPE_ERROR);
}
static int cxgb4_get_module_info(struct net_device *dev, static int cxgb4_get_module_info(struct net_device *dev,
struct ethtool_modinfo *modinfo) struct ethtool_modinfo *modinfo)
{ {
...@@ -2001,7 +2010,7 @@ static int cxgb4_get_module_info(struct net_device *dev, ...@@ -2001,7 +2010,7 @@ static int cxgb4_get_module_info(struct net_device *dev,
struct adapter *adapter = pi->adapter; struct adapter *adapter = pi->adapter;
int ret; int ret;
if (!t4_is_inserted_mod_type(pi->mod_type)) if (!cxgb4_fw_mod_type_info_available(pi->mod_type))
return -EINVAL; return -EINVAL;
switch (pi->port_type) { switch (pi->port_type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment