All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: ethtool 5.7: --change commands fail
       [not found] <20200725064936.GB125759@manjaro>
@ 2020-07-25 12:54 ` Michal Kubecek
  2020-07-25 15:26   ` علي محمد جبار
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Kubecek @ 2020-07-25 12:54 UTC (permalink / raw)
  To: Ali MJ Al-Nasrawy; +Cc: netdev, Florian Fainelli

On Sat, Jul 25, 2020 at 09:49:36AM +0300, Ali MJ Al-Nasrawy wrote:
> ethtool: v5.7
> kernel: v5.4.52
> driver: r8169 + libphy
> 
> Starting from v5.7, all ethtool --change commands fail to apply and
> show the following error message:
> 
> $ ethtool -s ens5 autoneg off
> netlink error: No such file or directory
> Cannot set new settings: No such file or directory
>   not setting autoneg
> 
> 'git bisect' points to:
> 8bb9a04 (ethtool.c: Report transceiver correctly)
> 
> After debugging I found that this commit sets deprecated.transceiver
> and then do_ioctl_slinksettings() checks for it and returns -1.
> errno is thus invalid and the the error message is bogus.
> 
> With debugging enabled:
> 
> $ ethtool --debug 0xffff -s ens5 autoneg off
> sending genetlink packet (32 bytes):
>     msg length 32 genl-ctrl
>     CTRL_CMD_GETFAMILY
>         CTRL_ATTR_FAMILY_NAME = "ethtool"
> <message dump/>
> received genetlink packet (52 bytes):
>     msg length 52 error errno=-2
> <message dump/>
> netlink error: No such file or directory
> offending message:
>     ETHTOOL_MSG_LINKINFO_SET
>         ETHTOOL_A_LINKINFO_PORT = 101
> Cannot set new settings: No such file or directory
>   not setting autoneg

Kernel 5.4.x does not support ethtool netlink so that we fall back to
ioctl. While we want to report transceiver in "ethtool <dev>" output, we
must not pass the value retrieved from kernel back to kernel when
"ethtool -s <dev> ..." command is executed.

Does the patch below help in your setup?

Michal


diff --git a/ethtool.c b/ethtool.c
index d37c223dcc04..1b99ac91dcbf 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2906,6 +2906,8 @@ static int do_sset(struct cmd_context *ctx)
 		struct ethtool_link_usettings *link_usettings;
 
 		link_usettings = do_ioctl_glinksettings(ctx);
+		memset(&link_usettings->deprecated, 0,
+		       sizeof(link_usettings->deprecated));
 		if (link_usettings == NULL)
 			link_usettings = do_ioctl_gset(ctx);
 		if (link_usettings == NULL) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: ethtool 5.7: --change commands fail
  2020-07-25 12:54 ` ethtool 5.7: --change commands fail Michal Kubecek
@ 2020-07-25 15:26   ` علي محمد جبار
  0 siblings, 0 replies; 3+ messages in thread
From: علي محمد جبار @ 2020-07-25 15:26 UTC (permalink / raw)
  To: Michal Kubecek; +Cc: netdev, Florian Fainelli

On Sat, Jul 25, 2020 at 3:54 PM Michal Kubecek <mkubecek@suse.cz> wrote:
>
> On Sat, Jul 25, 2020 at 09:49:36AM +0300, Ali MJ Al-Nasrawy wrote:
> > ethtool: v5.7
> > kernel: v5.4.52
> > driver: r8169 + libphy
> >
> > Starting from v5.7, all ethtool --change commands fail to apply and
> > show the following error message:
> >
> > $ ethtool -s ens5 autoneg off
> > netlink error: No such file or directory
> > Cannot set new settings: No such file or directory
> >   not setting autoneg
> >
> > 'git bisect' points to:
> > 8bb9a04 (ethtool.c: Report transceiver correctly)
> >
> > After debugging I found that this commit sets deprecated.transceiver
> > and then do_ioctl_slinksettings() checks for it and returns -1.
> > errno is thus invalid and the the error message is bogus.
> >
> > With debugging enabled:
> >
> > $ ethtool --debug 0xffff -s ens5 autoneg off
> > sending genetlink packet (32 bytes):
> >     msg length 32 genl-ctrl
> >     CTRL_CMD_GETFAMILY
> >         CTRL_ATTR_FAMILY_NAME = "ethtool"
> > <message dump/>
> > received genetlink packet (52 bytes):
> >     msg length 52 error errno=-2
> > <message dump/>
> > netlink error: No such file or directory
> > offending message:
> >     ETHTOOL_MSG_LINKINFO_SET
> >         ETHTOOL_A_LINKINFO_PORT = 101
> > Cannot set new settings: No such file or directory
> >   not setting autoneg
>
> Kernel 5.4.x does not support ethtool netlink so that we fall back to
> ioctl. While we want to report transceiver in "ethtool <dev>" output, we
> must not pass the value retrieved from kernel back to kernel when
> "ethtool -s <dev> ..." command is executed.
>
> Does the patch below help in your setup?

Yes, it fixed the issue. Thank you.

Ali

>
> Michal
>
>
> diff --git a/ethtool.c b/ethtool.c
> index d37c223dcc04..1b99ac91dcbf 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -2906,6 +2906,8 @@ static int do_sset(struct cmd_context *ctx)
>                 struct ethtool_link_usettings *link_usettings;
>
>                 link_usettings = do_ioctl_glinksettings(ctx);
> +               memset(&link_usettings->deprecated, 0,
> +                      sizeof(link_usettings->deprecated));
>                 if (link_usettings == NULL)
>                         link_usettings = do_ioctl_gset(ctx);
>                 if (link_usettings == NULL) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* ethtool 5.7: --change commands fail
@ 2020-07-25 11:43 Ali MJ Al-Nasrawy
  0 siblings, 0 replies; 3+ messages in thread
From: Ali MJ Al-Nasrawy @ 2020-07-25 11:43 UTC (permalink / raw)
  To: netdev; +Cc: Michal Kubecek, Florian Fainelli, Ali MJ Al-Nasrawy

ethtool: v5.7
kernel: v5.4.52
driver: r8169 + libphy

Starting from v5.7, all ethtool --change commands fail to apply and
show the following error message:

$ ethtool -s ens5 autoneg off
netlink error: No such file or directory
Cannot set new settings: No such file or directory
  not setting autoneg

'git bisect' points to:
8bb9a04 (ethtool.c: Report transceiver correctly)

After debugging I found that this commit sets deprecated.transceiver
and then do_ioctl_slinksettings() checks for it and returns -1.
errno is thus invalid and the the error message is bogus.

With debugging enabled:

$ ethtool --debug 0xffff -s ens5 autoneg off
sending genetlink packet (32 bytes):
    msg length 32 genl-ctrl
    CTRL_CMD_GETFAMILY
        CTRL_ATTR_FAMILY_NAME = "ethtool"
<message dump/>
received genetlink packet (52 bytes):
    msg length 52 error errno=-2
<message dump/>
netlink error: No such file or directory
offending message:
    ETHTOOL_MSG_LINKINFO_SET
        ETHTOOL_A_LINKINFO_PORT = 101
Cannot set new settings: No such file or directory
  not setting autoneg

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-25 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200725064936.GB125759@manjaro>
2020-07-25 12:54 ` ethtool 5.7: --change commands fail Michal Kubecek
2020-07-25 15:26   ` علي محمد جبار
2020-07-25 11:43 Ali MJ Al-Nasrawy

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.