Re: [PATCH net v1 1/1] ethtool: netlink: do not return SQI value if link is down

From: Jakub Kicinski
Date: Fri Jul 05 2024 - 21:00:24 EST


On Thu, 4 Jul 2024 07:40:07 +0200 Oleksij Rempel wrote:
> if (!phydev->drv || !phydev->drv->get_sqi)
> ret = -EOPNOTSUPP;
> + else if (!phydev->link)
> + ret = -ENETDOWN;

Can we stick to EOPNOTSUPP for the link down case as well?
We're consuming the error, the exact value doesn't matter.
Or let's add a helper which checks the int sqi in all it's
incarnations for validity:

static bool linkstate_sqi_no_data(int sqi)
{
return sqi == -EOPNOTSUPP || sqi == -ENETDOWN;
}