[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZoebO_i6P33iX4B1@pengutronix.de>
Date: Fri, 5 Jul 2024 09:05:31 +0200
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: Andrew Lunn <andrew@...n.ch>
Cc: Michal Kubecek <mkubecek@...e.cz>, Woojung.Huh@...rochip.com,
Arun Ramadoss <arun.ramadoss@...rochip.com>,
Jiri Pirko <jiri@...nulli.us>,
Vladimir Oltean <vladimir.oltean@....com>,
linux-kernel@...r.kernel.org, UNGLinuxDriver@...rochip.com,
Eric Dumazet <edumazet@...gle.com>, kernel@...gutronix.de,
netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net v1 1/1] ethtool: netlink: do not return SQI value if
link is down
On Thu, Jul 04, 2024 at 04:01:31PM +0200, Andrew Lunn wrote:
...
> > ret = linkstate_get_sqi(dev);
> > - if (ret < 0 && ret != -EOPNOTSUPP)
> > + if (ret < 0 && ret != -EOPNOTSUPP && ret != -ENETDOWN)
> > goto out;
> > data->sqi = ret;
>
> So data->sqi becomes -ENETDOWN
>
>
> > - if (data->sqi != -EOPNOTSUPP &&
> > + if (data->sqi != -EOPNOTSUPP && data->sqi != -ENETDOWN &&
> > nla_put_u32(skb, ETHTOOL_A_LINKSTATE_SQI, data->sqi))
> > return -EMSGSIZE;
>
> Thinking about the old code, if the driver returned something other
> than -EOPNOTSUPP, it looks like the error code would make it to user
> space. Is ethtool/iproute2 setup to correctly handle this? If it is,
> maybe pass the -ENETDOWN to user space?
In current state with ethtool v6.5 i'll get following results.
If no -ENETDOWN is returned:
Settings for spe4:
Supported ports: [ TP ]
Supported link modes: 100baseT1/Full
Supported pause frame use: No
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: 100baseT1/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 100Mb/s
Duplex: Full
Auto-negotiation: off
master-slave cfg: forced slave
master-slave status: unknown
Port: Twisted Pair
PHYAD: 6
Transceiver: external
MDI-X: Unknown
Supports Wake-on: d
Wake-on: d
Link detected: no
If -ENETDOWN is returned:
Settings for spe4:
Supported ports: [ TP ]
Supported link modes: 100baseT1/Fulli
Supported pause frame use: No
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: 100baseT1/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 100Mb/s
Duplex: Full
Auto-negotiation: off
master-slave cfg: forced slave
master-slave status: unknown
Port: Twisted Pair
PHYAD: 6
Transceiver: external
MDI-X: Unknown
Supports Wake-on: d
Wake-on: d
netlink error: Network is down
Instead of "Link detected: no", we will get netlink error.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists