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: 4d03e00a21
("ionic: Add initial ethtool support")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ba8fb6c844
commit
840eef5986
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
|
#include <linux/sfp.h>
|
||||||
|
|
||||||
#include "ionic.h"
|
#include "ionic.h"
|
||||||
#include "ionic_bus.h"
|
#include "ionic_bus.h"
|
||||||
|
@ -677,23 +678,27 @@ static int ionic_get_module_info(struct net_device *netdev,
|
||||||
struct ionic_lif *lif = netdev_priv(netdev);
|
struct ionic_lif *lif = netdev_priv(netdev);
|
||||||
struct ionic_dev *idev = &lif->ionic->idev;
|
struct ionic_dev *idev = &lif->ionic->idev;
|
||||||
struct ionic_xcvr_status *xcvr;
|
struct ionic_xcvr_status *xcvr;
|
||||||
|
struct sfp_eeprom_base *sfp;
|
||||||
|
|
||||||
xcvr = &idev->port_info->status.xcvr;
|
xcvr = &idev->port_info->status.xcvr;
|
||||||
|
sfp = (struct sfp_eeprom_base *) xcvr->sprom;
|
||||||
|
|
||||||
/* report the module data type and length */
|
/* report the module data type and length */
|
||||||
switch (xcvr->sprom[0]) {
|
switch (sfp->phys_id) {
|
||||||
case 0x03: /* SFP */
|
case SFF8024_ID_SFP:
|
||||||
modinfo->type = ETH_MODULE_SFF_8079;
|
modinfo->type = ETH_MODULE_SFF_8079;
|
||||||
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
|
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
|
||||||
break;
|
break;
|
||||||
case 0x0D: /* QSFP */
|
case SFF8024_ID_QSFP_8436_8636:
|
||||||
case 0x11: /* QSFP28 */
|
case SFF8024_ID_QSFP28_8636:
|
||||||
modinfo->type = ETH_MODULE_SFF_8436;
|
modinfo->type = ETH_MODULE_SFF_8436;
|
||||||
modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN;
|
modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
netdev_info(netdev, "unknown xcvr type 0x%02x\n",
|
netdev_info(netdev, "unknown xcvr type 0x%02x\n",
|
||||||
xcvr->sprom[0]);
|
xcvr->sprom[0]);
|
||||||
|
modinfo->type = 0;
|
||||||
|
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue