mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
modules/mqnic: fix SFP EEPROM readout to support optical module diagnosis
* fix offset check for allowing an offset of exactly 256 Bytes * fix allowing the I2C address of 0x51 to access the optical SFP modules diagnosis information, see SFF8472 rev 12.4 p. 8
This commit is contained in:
parent
448fa8eb4c
commit
6bd8ae031f
@ -339,21 +339,22 @@ static int mqnic_query_module_eeprom_by_page(struct net_device *ndev,
|
||||
case SFF_MODULE_ID_SFP:
|
||||
if (page > 0 || bank > 0)
|
||||
return -EINVAL;
|
||||
if (i2c_addr != 0x50 && i2c_addr != 0x51)
|
||||
return -EINVAL;
|
||||
break;
|
||||
case SFF_MODULE_ID_QSFP:
|
||||
case SFF_MODULE_ID_QSFP_PLUS:
|
||||
case SFF_MODULE_ID_QSFP28:
|
||||
if (page > 3 || bank > 0)
|
||||
return -EINVAL;
|
||||
if (i2c_addr != 0x50)
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
netdev_err(ndev, "%s: Unknown module ID (0x%x)", __func__, module_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (i2c_addr != 0x50)
|
||||
return -EINVAL;
|
||||
|
||||
// set page
|
||||
switch (module_id) {
|
||||
case SFF_MODULE_ID_SFP:
|
||||
@ -396,7 +397,7 @@ static int mqnic_query_module_eeprom(struct net_device *ndev,
|
||||
case SFF_MODULE_ID_SFP:
|
||||
i2c_addr = 0x50;
|
||||
page = 0;
|
||||
if (offset > 256) {
|
||||
if (offset >= 256) {
|
||||
offset -= 256;
|
||||
i2c_addr = 0x51;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user