All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Hangbin Liu <liuhangbin@kylinos.cn>
Subject: Re: [PATCH net-next 1/2] netdevsim: add link speed support
Date: Tue, 1 Sep 2026 14:31:06 +0800	[thread overview]
Message-ID: <apZxKhKJbopty6wY@fedora> (raw)
In-Reply-To: <043abd17-c896-40a7-901d-a3fc943151bc@lunn.ch>

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

  reply	other threads:[~2026-09-01  6:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  3:28 [PATCH net-next 0/2] netdevsim: add link speed support Hangbin Liu
2026-08-31  3:28 ` [PATCH net-next 1/2] " Hangbin Liu
2026-08-31 12:16   ` Andrew Lunn
2026-09-01  6:39     ` Hangbin Liu
2026-09-01 12:43       ` Andrew Lunn
2026-09-02  1:53         ` Hangbin Liu
2026-09-02 12:38           ` Andrew Lunn
2026-08-31 12:24   ` Andrew Lunn
2026-09-01  6:31     ` Hangbin Liu [this message]
2026-08-31 22:08   ` Jakub Kicinski
2026-09-01  6:58     ` Hangbin Liu
2026-09-01  8:23       ` Hangbin Liu
2026-09-01 14:21         ` Andrew Lunn
2026-09-02  2:01           ` Hangbin Liu
2026-09-02 12:49             ` Andrew Lunn
2026-09-01 14:18       ` Andrew Lunn
2026-08-31  3:28 ` [PATCH net-next 2/2] selftests: netdevsim: add speed testing Hangbin Liu
2026-08-31 22:06   ` Jakub Kicinski
2026-09-01  6:42     ` Hangbin Liu
2026-09-01 15:06       ` Jakub Kicinski
2026-09-02  2:04         ` Hangbin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=apZxKhKJbopty6wY@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.