Skip to content

Commit 4ca110b

Browse files
chelsiocudbgdavem330
authored andcommitted
cxgb4: fix eeprom len when diagnostics not implemented
Ensure diagnostics monitoring support is implemented for the SFF 8472 compliant port module and set the correct length for ethtool port module eeprom read. Fixes: f56ec67 ("cxgb4: Add support for ethtool i2c dump") Signed-off-by: Manoj Malviya <[email protected]> Signed-off-by: Rahul Lakkireddy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0315a07 commit 4ca110b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,12 +2015,15 @@ static int cxgb4_get_module_info(struct net_device *dev,
20152015
if (ret)
20162016
return ret;
20172017

2018-
if (!sff8472_comp || (sff_diag_type & 4)) {
2018+
if (!sff8472_comp || (sff_diag_type & SFP_DIAG_ADDRMODE)) {
20192019
modinfo->type = ETH_MODULE_SFF_8079;
20202020
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
20212021
} else {
20222022
modinfo->type = ETH_MODULE_SFF_8472;
2023-
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
2023+
if (sff_diag_type & SFP_DIAG_IMPLEMENTED)
2024+
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
2025+
else
2026+
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN / 2;
20242027
}
20252028
break;
20262029

drivers/net/ethernet/chelsio/cxgb4/t4_hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ enum {
293293
#define I2C_PAGE_SIZE 0x100
294294
#define SFP_DIAG_TYPE_ADDR 0x5c
295295
#define SFP_DIAG_TYPE_LEN 0x1
296+
#define SFP_DIAG_ADDRMODE BIT(2)
297+
#define SFP_DIAG_IMPLEMENTED BIT(6)
296298
#define SFF_8472_COMP_ADDR 0x5e
297299
#define SFF_8472_COMP_LEN 0x1
298300
#define SFF_REV_ADDR 0x1

0 commit comments

Comments
 (0)