From: Roland Dreier <roland@kernel.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
Greg KH <gregkh@linuxfoundation.org>,
netdev@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] CDC-NCM: remove "connected" log message
Date: Thu, 31 Dec 2020 10:51:09 -0800 [thread overview]
Message-ID: <CAG4TOxOOPgAqUtX14V7k-qPCbOm7+5gaHOqBvgWBYQwJkO6v8g@mail.gmail.com> (raw)
In-Reply-To: <12f345107c0832a00c43767ac6bb3aeda4241d4e.camel@suse.com>
I haven't tried these patches yet but they don't look quite right to
me. inlining the first 0001 patch:
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index 1447da1d5729..bcd17f6d6de6 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -944,7 +944,7 @@ EXPORT_SYMBOL_GPL(usbnet_open);
> * they'll probably want to use this base set.
> */
>
> -int usbnet_get_link_ksettings(struct net_device *net,
> +int usbnet_get_link_ksettings_mdio(struct net_device *net,
> struct ethtool_link_ksettings *cmd)
> {
> struct usbnet *dev = netdev_priv(net);
> @@ -956,6 +956,32 @@ int usbnet_get_link_ksettings(struct net_device *net,
>
> return 0;
> }
> +EXPORT_SYMBOL_GPL(usbnet_get_link_ksettings_mdio);
why keep and export the old function when it will have no callers?
> +int usbnet_get_link_ksettings(struct net_device *net,
> + struct ethtool_link_ksettings *cmd)
> +{
> + struct usbnet *dev = netdev_priv(net);
> +
> + /* the assumption that speed is equal on tx and rx
> + * is deeply engrained into the networking layer.
> + * For wireless stuff it is not true.
> + * We assume that rxspeed matters more.
> + */
> + if (dev->rxspeed != SPEED_UNKNOWN)
> + cmd->base.speed = dev->rxspeed / 1000000;
> + else if (dev->txspeed != SPEED_UNKNOWN)
> + cmd->base.speed = dev->txspeed / 1000000;
> + /* if a minidriver does not record speed we try to
> + * fall back on MDIO
> + */
> + else if (!dev->mii.mdio_read)
> + cmd->base.speed = SPEED_UNKNOWN;
> + else
> + mii_ethtool_get_link_ksettings(&dev->mii, cmd);
> +
> + return 0;
This is a change in behavior for every driver that doesn't set rxspeed
/ txspeed - the old get_link function would return EOPNOTSUPP if
mdio_read isn't implemented, now we give SPEED_UNKNOWN with a
successful return code.
> @@ -1661,6 +1687,8 @@ usbnet_probe (struct usb_interface *udev,
const struct usb_device_id *prod)
> dev->intf = udev;
> dev->driver_info = info;
> dev->driver_name = name;
> + dev->rxspeed = -1; /* unknown or handled by MII */
> + dev->txspeed = -1;
Minor nit: if we're going to test these against SPEED_UNKNOWN above,
then I think it's clearer to initialize them to that value via the
same constant.
> diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
> index 88a7673894d5..f748c758f82a 100644
> --- a/include/linux/usb/usbnet.h
> +++ b/include/linux/usb/usbnet.h
> @@ -267,8 +269,11 @@ extern void usbnet_purge_paused_rxq(struct usbnet *);
>
> extern int usbnet_get_link_ksettings(struct net_device *net,
> struct ethtool_link_ksettings *cmd);
> -extern int usbnet_set_link_ksettings(struct net_device *net,
> +extern int usbnet_set_link_ksettings_mdio(struct net_device *net,
> const struct ethtool_link_ksettings *cmd);
> +/* Legacy - to be used if you really need an error to be returned */
> +extern int usbnet_set_link_ksettings(struct net_device *net,
> + const struct ethtool_link_ksettings *cmd);
> extern u32 usbnet_get_link(struct net_device *net);
> extern u32 usbnet_get_msglevel(struct net_device *);
> extern void usbnet_set_msglevel(struct net_device *, u32);
I think this was meant to be changing get_link, not set_link.
Also I don't understand the "Legacy" comment. Is that referring to
the EOPNOTSUPP change I mentioned above? If so, wouldn't it be better
to preserve the legacy behavior rather than changing the behavior of
every usbnet driver all at once? Like make a new
usbnet_get_link_ksettings_nonmdio and update only cdc_ncm to use it?
- R.
next prev parent reply other threads:[~2020-12-31 18:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 17:23 cdc_ncm kernel log spam with trendnet 2.5G USB adapter Roland Dreier
2020-11-26 12:05 ` Oliver Neukum
[not found] ` <3a9b2c8c275d56d9c7904cf9b5177047b196173d.camel@neukum.org>
2020-12-01 20:42 ` Roland Dreier
2020-12-19 22:21 ` Roland Dreier
2020-12-23 2:49 ` Jakub Kicinski
2020-12-23 3:01 ` Roland Dreier
2020-12-24 3:21 ` [PATCH] CDC-NCM: remove "connected" log message Roland Dreier
2020-12-24 7:53 ` Greg KH
2020-12-28 21:30 ` Jakub Kicinski
2020-12-29 7:56 ` Roland Dreier
2020-12-29 12:30 ` Oliver Neukum
[not found] ` <24c6faa2a4f91c721d9a7f14bb7b641b89ae987d.camel@neukum.org>
2020-12-29 19:50 ` Roland Dreier
2020-12-30 11:03 ` Oliver Neukum
2020-12-31 18:51 ` Roland Dreier [this message]
2021-01-04 14:57 ` Oliver Neukum
2021-01-04 19:13 ` Roland Dreier
2021-01-05 14:04 ` Oliver Neukum
2021-01-06 0:19 ` Roland Dreier
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=CAG4TOxOOPgAqUtX14V7k-qPCbOm7+5gaHOqBvgWBYQwJkO6v8g@mail.gmail.com \
--to=roland@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.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).