|
16 | 16 | #include <linux/net_tstamp.h> |
17 | 17 | #include <linux/netdevice.h> |
18 | 18 | #include <linux/phy.h> |
| 19 | +#include <linux/sfp.h> |
19 | 20 | #include <linux/phylink.h> |
20 | 21 | #include "altera_eth_dma.h" |
21 | 22 | #include "intel_fpga_eth_main.h" |
@@ -93,7 +94,36 @@ static void gts_gstrings(struct net_device *dev, u32 stringset, u8 *buf) |
93 | 94 | memcpy(buf, stat_gstrings, GTS_STATS_LEN * ETH_GSTRING_LEN); |
94 | 95 | } |
95 | 96 |
|
96 | | -static void gts_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, |
| 97 | +static int gts_get_module_info (struct net_device *dev, |
| 98 | + struct ethtool_modinfo *info) |
| 99 | +{ |
| 100 | + intel_fpga_xtile_eth_private *priv = netdev_priv(dev); |
| 101 | + if (!priv) |
| 102 | + return -ENODEV; |
| 103 | + |
| 104 | + if (!priv->phylink || !priv->dev || !priv->dev->sfp_bus) { |
| 105 | + return -ENODEV; |
| 106 | + } |
| 107 | + |
| 108 | + return sfp_get_module_info(priv->dev->sfp_bus, info); |
| 109 | +} |
| 110 | + |
| 111 | +static int gts_get_module_eeprom(struct net_device *dev, |
| 112 | + struct ethtool_eeprom *eeprom, u8 *data) |
| 113 | +{ |
| 114 | + intel_fpga_xtile_eth_private *priv = netdev_priv(dev); |
| 115 | + if (!priv) |
| 116 | + return -ENODEV; |
| 117 | + |
| 118 | + if (!priv->phylink || !priv->dev || !priv->dev->sfp_bus) { |
| 119 | + return -ENODEV; |
| 120 | + } |
| 121 | + |
| 122 | + return sfp_get_module_eeprom(priv->dev->sfp_bus, eeprom, data); |
| 123 | +} |
| 124 | + |
| 125 | +static void gts_fill_stats(struct net_device *dev, |
| 126 | + struct ethtool_stats *dummy, |
97 | 127 | u64 *buf) |
98 | 128 | { |
99 | 129 | intel_fpga_xtile_eth_private *priv = netdev_priv(dev); |
@@ -1598,6 +1628,8 @@ static int gts_get_ts_info(struct net_device *dev, |
1598 | 1628 | { |
1599 | 1629 | intel_fpga_xtile_eth_private *priv = netdev_priv(dev); |
1600 | 1630 |
|
| 1631 | + return -EOPNOTSUPP; |
| 1632 | + |
1601 | 1633 | info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | |
1602 | 1634 | SOF_TIMESTAMPING_RX_HARDWARE | |
1603 | 1635 | SOF_TIMESTAMPING_RAW_HARDWARE; |
@@ -1657,6 +1689,9 @@ static const struct ethtool_ops gts_ethtool_ops = { |
1657 | 1689 | .get_ts_info = gts_get_ts_info, |
1658 | 1690 | .get_link_ksettings = gts_get_link_ksettings, |
1659 | 1691 | .set_link_ksettings = gts_set_link_ksettings, |
| 1692 | + .get_module_info = gts_get_module_info, |
| 1693 | + .get_module_eeprom = gts_get_module_eeprom, |
| 1694 | + |
1660 | 1695 | }; |
1661 | 1696 |
|
1662 | 1697 | void intel_fpga_gts_set_ethtool_ops(struct net_device *netdev) |
|
0 commit comments