Skip to content

Commit 840eef5

Browse files
emuslndavem330
authored andcommitted
ionic: print data for unknown xcvr type
If we don't recognize the transceiver type, set the xcvr type and data length such that ethtool can at least print the first 256 bytes and the reader can figure out why the transceiver is not recognized. While we're here, we can update the phy_id type values to use the enum values in sfp.h. Fixes: 4d03e00 ("ionic: Add initial ethtool support") Signed-off-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ba8fb6c commit 840eef5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/net/ethernet/pensando/ionic/ionic_ethtool.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <linux/module.h>
55
#include <linux/netdevice.h>
6+
#include <linux/sfp.h>
67

78
#include "ionic.h"
89
#include "ionic_bus.h"
@@ -677,23 +678,27 @@ static int ionic_get_module_info(struct net_device *netdev,
677678
struct ionic_lif *lif = netdev_priv(netdev);
678679
struct ionic_dev *idev = &lif->ionic->idev;
679680
struct ionic_xcvr_status *xcvr;
681+
struct sfp_eeprom_base *sfp;
680682

681683
xcvr = &idev->port_info->status.xcvr;
684+
sfp = (struct sfp_eeprom_base *) xcvr->sprom;
682685

683686
/* report the module data type and length */
684-
switch (xcvr->sprom[0]) {
685-
case 0x03: /* SFP */
687+
switch (sfp->phys_id) {
688+
case SFF8024_ID_SFP:
686689
modinfo->type = ETH_MODULE_SFF_8079;
687690
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
688691
break;
689-
case 0x0D: /* QSFP */
690-
case 0x11: /* QSFP28 */
692+
case SFF8024_ID_QSFP_8436_8636:
693+
case SFF8024_ID_QSFP28_8636:
691694
modinfo->type = ETH_MODULE_SFF_8436;
692695
modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN;
693696
break;
694697
default:
695698
netdev_info(netdev, "unknown xcvr type 0x%02x\n",
696699
xcvr->sprom[0]);
700+
modinfo->type = 0;
701+
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
697702
break;
698703
}
699704

0 commit comments

Comments
 (0)