From: Grant Grundler <grundler@chromium.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: netdev <netdev@vger.kernel.org>,
Grant Grundler <grundler@chromium.org>,
Andrew Lunn <andrew@lunn.ch>,
davem@davemloft.org, Hayes Wang <hayeswang@realtek.com>,
Jakub Kicinski <kuba@kernel.org>,
Roland Dreier <roland@kernel.org>,
nic_swsd <nic_swsd@realtek.com>
Subject: Re: [PATCHv3 3/3] CDC-NCM: record speed in status method
Date: Fri, 19 Feb 2021 07:30:29 +0000 [thread overview]
Message-ID: <CANEJEGvsYPmnxx2sV89aLPJzK_SgWEW8FPhgo2zNk2d5zijK2Q@mail.gmail.com> (raw)
In-Reply-To: <20210218102038.2996-4-oneukum@suse.com>
On Thu, Feb 18, 2021 at 10:21 AM Oliver Neukum <oneukum@suse.com> wrote:
>
> The driver has a status method for receiving speed updates.
> The framework, however, had support functions only for devices
> that reported their speed upon an explicit query over a MDIO
> interface.
> CDC_NCM however gets direct notifications from the device.
> As new support functions have become available, we shall now
> record such notifications and tell the usbnet framework
> to make direct use of them without going through the PHY layer.
Since this patch is missing the hunks that landed in the previous
patch and needs a v4, I'll offer my version of the commit message in
case you like it better:
net: cdc_ncm: record speed in status method
Until very recently, the usbnet framework only had support functions
for devices which reported the link speed by explicitly querying the
PHY over a MDIO interface. However, the cdc_ncm devices send
notifications when the link state or link speeds change and do not
expose the PHY (or modem) directly.
Support functions (e.g. usbnet_get_link_ksettings_internal()) to directly
query state recorded by the cdc_ncm driver were added in a previous patch.
So instead of cdc_ncm spewing the link speed into the dmesg buffer,
record the link speed encoded in these notifications and tell the
usbnet framework to use the new functions to get link speed.
This is especially useful given all existing RTL8156 devices emit
a connection/speed status notification every 32ms and this would
fill the dmesg buffer. This implementation replaces the one
recently submitted in de658a195ee23ca6aaffe197d1d2ea040beea0a2 :
"net: usb: cdc_ncm: don't spew notifications"
cheers,
grant
> v2: rebased on upstream
> v3: changed variable names
>
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> Tested-by: Roland Dreier <roland@kernel.org>
> ---
> drivers/net/usb/cdc_ncm.c | 23 +----------------------
> 1 file changed, 1 insertion(+), 22 deletions(-)
>
> diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
> index 0d26cbeb6e04..74c1a86b1a71 100644
> --- a/drivers/net/usb/cdc_ncm.c
> +++ b/drivers/net/usb/cdc_ncm.c
> @@ -1829,30 +1829,9 @@ cdc_ncm_speed_change(struct usbnet *dev,
> uint32_t rx_speed = le32_to_cpu(data->DLBitRRate);
> uint32_t tx_speed = le32_to_cpu(data->ULBitRate);
>
> - /* if the speed hasn't changed, don't report it.
> - * RTL8156 shipped before 2021 sends notification about every 32ms.
> - */
> - if (dev->rx_speed == rx_speed && dev->tx_speed == tx_speed)
> - return;
> -
> + /* RTL8156 shipped before 2021 sends notification about every 32ms. */
> dev->rx_speed = rx_speed;
> dev->tx_speed = tx_speed;
> -
> - /*
> - * Currently the USB-NET API does not support reporting the actual
> - * device speed. Do print it instead.
> - */
> - if ((tx_speed > 1000000) && (rx_speed > 1000000)) {
> - netif_info(dev, link, dev->net,
> - "%u mbit/s downlink %u mbit/s uplink\n",
> - (unsigned int)(rx_speed / 1000000U),
> - (unsigned int)(tx_speed / 1000000U));
> - } else {
> - netif_info(dev, link, dev->net,
> - "%u kbit/s downlink %u kbit/s uplink\n",
> - (unsigned int)(rx_speed / 1000U),
> - (unsigned int)(tx_speed / 1000U));
> - }
> }
>
> static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
> --
> 2.26.2
>
next prev parent reply other threads:[~2021-02-19 7:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 10:20 [PATCHv3 0/3]usbnet: speed reporting for devices without MDIO Oliver Neukum
2021-02-18 10:20 ` [PATCHv3 1/3] usbnet: specify naming of usbnet_set/get_link_ksettings Oliver Neukum
2021-02-18 19:06 ` Jakub Kicinski
2021-02-18 19:31 ` Grant Grundler
2021-02-18 19:50 ` Andrew Lunn
2021-02-19 7:12 ` Grant Grundler
2021-02-18 10:20 ` [PATCHv3 2/3] usbnet: add method for reporting speed without MDIO Oliver Neukum
2021-02-18 19:06 ` Jakub Kicinski
2021-02-18 10:20 ` [PATCHv3 3/3] CDC-NCM: record speed in status method Oliver Neukum
2021-02-19 7:30 ` Grant Grundler [this message]
2021-02-22 10:14 ` Oliver Neukum
2021-02-24 5:24 ` Grant Grundler
2021-03-20 5:24 ` Grant Grundler
2021-02-19 7:43 ` Grant Grundler
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=CANEJEGvsYPmnxx2sV89aLPJzK_SgWEW8FPhgo2zNk2d5zijK2Q@mail.gmail.com \
--to=grundler@chromium.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.org \
--cc=hayeswang@realtek.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=oneukum@suse.com \
--cc=roland@kernel.org \
/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).