Thread (38 messages) 38 messages, 4 authors, 2020-05-28

Re: [RFC next-next v2 3/5] net: marvell: prestera: Add ethtool interface support

From: Jiri Pirko <jiri@resnulli.us>
Date: 2020-05-11 17:31:22

Fri, May 01, 2020 at 01:20:50AM 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
No double space.

exists:

   - port media type should be configured before speed setting
   - ethtool –m option is not supported
   - ethtool –p option is not supported
Those are some odd dashes...

   - 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
[...]

+static const struct ethtool_ops ethtool_ops = {
+	.get_drvinfo = prestera_port_get_drvinfo,
+	.get_link_ksettings = prestera_port_get_link_ksettings,
+	.set_link_ksettings = prestera_port_set_link_ksettings,
+	.get_fecparam = prestera_port_get_fecparam,
+	.set_fecparam = prestera_port_set_fecparam,
+	.get_sset_count = prestera_port_get_sset_count,
+	.get_strings = prestera_port_get_strings,
+	.get_ethtool_stats = prestera_port_get_ethtool_stats,
+	.get_link = ethtool_op_get_link,
+	.nway_reset = prestera_port_nway_reset
+};
I wonder, wouldn't it be better to put the ethtool bits into a separate
.c file. You have a separate .c file for less :)

quoted hunk ↗ jump to hunk
+
static int prestera_port_create(struct prestera_switch *sw, u32 id)
{
	struct prestera_port *port;
@@ -264,6 +1023,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 = &ethtool_ops;

	netif_carrier_off(dev);
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help