From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Michal Kubecek <mkubecek@suse.cz>,
Woojung.Huh@microchip.com,
Arun Ramadoss <arun.ramadoss@microchip.com>,
Jiri Pirko <jiri@resnulli.us>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com,
Eric Dumazet <edumazet@google.com>,
kernel@pengutronix.de, netdev@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net v1 1/1] ethtool: netlink: do not return SQI value if link is down
Date: Fri, 5 Jul 2024 09:05:31 +0200 [thread overview]
Message-ID: <ZoebO_i6P33iX4B1@pengutronix.de> (raw)
In-Reply-To: <dbfa3bc1-fff0-4dc7-a9f2-6cd304d4eaf8@lunn.ch>
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 |
next prev parent reply other threads:[~2024-07-05 7:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 5:40 [PATCH net v1 1/1] ethtool: netlink: do not return SQI value if link is down Oleksij Rempel
2024-07-04 14:01 ` Andrew Lunn
2024-07-05 7:05 ` Oleksij Rempel [this message]
2024-07-08 13:29 ` Andrew Lunn
2024-07-06 1:00 ` Jakub Kicinski
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=ZoebO_i6P33iX4B1@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=Woojung.Huh@microchip.com \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).