All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksei Sviridkin <f@lex.la>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Théo Lebrun" <theo.lebrun@bootlin.com>,
	"Conor Dooley" <conor.dooley@microchip.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Vineeth Karumanchi" <vineeth.karumanchi@amd.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 2/2] net: macb: reject an unknown link speed in the taprio setup
Date: Fri,  4 Sep 2026 23:45:34 +0000	[thread overview]
Message-ID: <20260904234534.407633-1-f@lex.la> (raw)
In-Reply-To: <cb6da9c8-aea0-4740-9709-d718462481e9@lunn.ch>

On Wed, 2 Sep 2026 18:37, Andrew Lunn wrote:
> Can ethtool_validate_speed() be used?

No, it returns true for SPEED_UNKNOWN:

	static inline int ethtool_validate_speed(__u32 speed)
	{
		return speed <= __KERNEL_INT_MAX || speed == (__u32)SPEED_UNKNOWN;
	}

It answers "is this a legal encoding of a speed", which is the question
you want when a speed arrives from userspace, and that is where its
callers use it: net/ethtool/ioctl.c and otx2_ethtool.c both validate
what was passed in.

Here the speed goes the other way. We read it back and need it usable,
and SPEED_UNKNOWN is a legal encoding of something unusable, so the
helper would accept the one value the patch exists to reject.

v2 is coming with the commit message Théo asked for.

      parent reply	other threads:[~2026-09-04 23:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  8:05 [PATCH net 0/2] net: macb: fix the link speed the taprio setup reads Aleksei Sviridkin
2026-09-02  8:05 ` [PATCH net 1/2] net: macb: zero the link settings taprio reads back Aleksei Sviridkin
2026-09-02  8:32   ` Théo Lebrun
2026-09-02  8:05 ` [PATCH net 2/2] net: macb: reject an unknown link speed in the taprio setup Aleksei Sviridkin
2026-09-02  8:57   ` Théo Lebrun
2026-09-02 16:37   ` Andrew Lunn
2026-09-03 12:36     ` Aleksei Sviridkin
2026-09-04 23:45     ` Aleksei Sviridkin [this message]

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=20260904234534.407633-1-f@lex.la \
    --to=f@lex.la \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor.dooley@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=theo.lebrun@bootlin.com \
    --cc=vineeth.karumanchi@amd.com \
    /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.