Messages in this thread |  | | Date | Sun, 26 Jul 2020 11:46:27 +0200 | From | Jiri Pirko <> | Subject | Re: [net-next v3 4/6] net: marvell: prestera: Add ethtool interface support |
| |
Sat, Jul 25, 2020 at 05:06:49PM CEST, vadym.kochan@plvision.eu wrote: >The ethtool API provides support for the configuration of the following >features: speed and duplex, auto-negotiation, MDI-x, forward error >correction, port media type. The API also provides information about the >port status, hardware and software statistic. The following limitation >exists: > > - port media type should be configured before speed setting > - ethtool -m option is not supported > - ethtool -p option is not supported > - ethtool -r option is supported for RJ45 port only > - the following combination of parameters is not supported: > > ethtool -s sw1pX port XX autoneg on > > - forward error correction feature is supported only on SFP ports, 10G > speed > > - auto-negotiation and MDI-x features are not supported on > Copper-to-Fiber SFP module > >Signed-off-by: Andrii Savka <andrii.savka@plvision.eu> >Signed-off-by: Serhiy Boiko <serhiy.boiko@plvision.eu> >Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu> >---
[...]
>+ >+void prestera_ethtool_get_stats(struct net_device *dev, >+ struct ethtool_stats *stats, u64 *data) >+{ >+ struct prestera_port *port = netdev_priv(dev); >+ struct prestera_port_stats *port_stats; >+ >+ port_stats = &port->cached_hw_stats.stats; >+ >+ memcpy((u8 *)data, port_stats, sizeof(*port_stats));
Avoid the needless cast.
[...]
>+static const struct ethtool_ops ethtool_ops = { >+ .get_drvinfo = prestera_ethtool_get_drvinfo, >+ .get_link_ksettings = prestera_ethtool_get_link_ksettings, >+ .set_link_ksettings = prestera_ethtool_set_link_ksettings, >+ .get_fecparam = prestera_ethtool_get_fecparam, >+ .set_fecparam = prestera_ethtool_set_fecparam, >+ .get_sset_count = prestera_ethtool_get_sset_count, >+ .get_strings = prestera_ethtool_get_strings, >+ .get_ethtool_stats = prestera_ethtool_get_stats, >+ .get_link = ethtool_op_get_link, >+ .nway_reset = prestera_ethtool_nway_reset >+};
Have the struct in prestera_ethtool.c and export just the struct instead of all the callbacks.
>+ > static int prestera_port_create(struct prestera_switch *sw, u32 id) > { > struct prestera_port *port; >@@ -235,6 +266,7 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id) > > dev->features |= NETIF_F_NETNS_LOCAL; > dev->netdev_ops = &netdev_ops; >+ dev->ethtool_ops = ðtool_ops; > > netif_carrier_off(dev); > >-- >2.17.1 >
|  |