Re: [PATCH net 2/2] net: macb: reject an unknown link speed in the taprio setup

From: Aleksei Sviridkin

Date: Fri Sep 04 2026 - 19:46:13 EST


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.