Hi Andrew,
On Mon, Aug 31, 2026 at 02:24:54PM +0200, Andrew Lunn wrote:
> > +static int nsim_get_link_ksettings(struct net_device *dev,
> > + struct ethtool_link_ksettings *cmd)
> > +{
> > + struct netdevsim *ns = netdev_priv(dev);
> > +
> > + cmd->base.speed = ns->ethtool.speed;
> > + cmd->base.duplex = ns->ethtool.duplex;
> > + cmd->base.port = PORT_OTHER;
> > + cmd->base.autoneg = AUTONEG_DISABLE;
>
> Here you hard code autoneg as disabled.
>
> > +static int nsim_set_link_ksettings(struct net_device *dev,
> > + const struct ethtool_link_ksettings *cmd)
> > +{
> > + struct netdevsim *ns = netdev_priv(dev);
> > +
> > + if (cmd->base.speed > NSIM_LINK_SPEED_MAX)
> > + return -EINVAL;
> > +
> > + return ethtool_virtdev_set_link_ksettings(dev, cmd, &ns->ethtool.speed,
> > + &ns->ethtool.duplex);
>
> but here you don't appear to block enabling autoneg. I would expect a
> test and EOPNOTSUPP.
ethtool_virtdev_set_link_ksettings will check the cmds and only allow user
to set speed and duplex. If a user tries to set autoneg it will return
-EINVAL. Do you want nsim to return -EOPNOTSUPP specifically?
Thanks
Hangbin