net: mvneta: add module EEPROM reading support
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 2 Jan 2018 17:25:15 +0000 (17:25 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Jan 2018 15:38:54 +0000 (10:38 -0500)
Add support for reading the SFF module's EEPROM via the ethtool API.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c

index 6a018cfa36f61a60809977b1aa02267d8f4f8b95..25e9a551cc8c3e726ad23234f5de5c20ec0caec6 100644 (file)
@@ -4073,6 +4073,22 @@ static int mvneta_ethtool_set_wol(struct net_device *dev,
        return ret;
 }
 
+static int mvneta_ethtool_get_module_info(struct net_device *dev,
+                                         struct ethtool_modinfo *modinfo)
+{
+       struct mvneta_port *pp = netdev_priv(dev);
+
+       return phylink_ethtool_get_module_info(pp->phylink, modinfo);
+}
+
+static int mvneta_ethtool_get_module_eeprom(struct net_device *dev,
+                                           struct ethtool_eeprom *ee, u8 *buf)
+{
+       struct mvneta_port *pp = netdev_priv(dev);
+
+       return phylink_ethtool_get_module_eeprom(pp->phylink, ee, buf);
+}
+
 static int mvneta_ethtool_get_eee(struct net_device *dev,
                                  struct ethtool_eee *eee)
 {
@@ -4147,6 +4163,8 @@ static const struct ethtool_ops mvneta_eth_tool_ops = {
        .set_link_ksettings = mvneta_ethtool_set_link_ksettings,
        .get_wol        = mvneta_ethtool_get_wol,
        .set_wol        = mvneta_ethtool_set_wol,
+       .get_module_info = mvneta_ethtool_get_module_info,
+       .get_module_eeprom = mvneta_ethtool_get_module_eeprom,
        .get_eee        = mvneta_ethtool_get_eee,
        .set_eee        = mvneta_ethtool_set_eee,
 };