@@ -694,7 +694,7 @@ static int ionic_get_module_info(struct net_device *netdev,
default:
netdev_info(netdev, "unknown xcvr type 0x%02x\n",
xcvr->sprom[0]);
- break;
+ return -EINVAL;
}
return 0;
@@ -714,7 +714,19 @@ static int ionic_get_module_eeprom(struct net_device *netdev,
/* The NIC keeps the module prom up-to-date in the DMA space
* so we can simply copy the module bytes into the data buffer.
*/
+
xcvr = &idev->port_info->status.xcvr;
+ switch (xcvr->sprom[0]) {
+ case 0x03: /* SFP */
+ case 0x0D: /* QSFP */
+ case 0x11: /* QSFP28 */
+ break;
+ default:
+ netdev_info(netdev, "unknown xcvr type 0x%02x\n",
+ xcvr->sprom[0]);
+ return -EINVAL;
+ }
+
len = min_t(u32, sizeof(xcvr->sprom), ee->len);
do {
If we don't recognize the transceiver type, return an error so that ethtool doesn't try dumping bogus eeprom contents. Fixes: 4d03e00a2140 ("ionic: Add initial ethtool support") Signed-off-by: Shannon Nelson <snelson@pensando.io> --- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)