Message ID | 20210218102038.2996-3-oneukum@suse.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | usbnet: speed reporting for devices without MDIO | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | warning | 3 maintainers not CCed: davem@davemloft.net linux-usb@vger.kernel.org gregkh@linuxfoundation.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 49 this patch: 40 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | fail | ERROR: trailing whitespace |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 48 this patch: 39 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Thu, 18 Feb 2021 11:20:37 +0100 Oliver Neukum wrote: > The old method for reporting network speed upwards > assumed that a device uses MDIO and uses the generic phy > functions based on that. > Add a a primitive internal version not making the assumption > reporting back directly what the status operations record. > > v2: rebased on upstream > v3: changed names and made clear which units are used > > Signed-off-by: Oliver Neukum <oneukum@suse.com> > Tested-by: Roland Dreier <roland@kernel.org> ERROR: trailing whitespace #48: FILE: drivers/net/usb/usbnet.c:1690: +^Idev->tx_speed = SPEED_UNSET; $
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index f3e5ad9befd0..368428a4290b 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -971,10 +971,10 @@ int usbnet_get_link_ksettings_internal(struct net_device *net, * 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 (dev->rx_speed != SPEED_UNSET) + cmd->base.speed = dev->rx_speed / 1000000; + else if (dev->tx_speed != SPEED_UNSET) + cmd->base.speed = dev->tx_speed / 1000000; else cmd->base.speed = SPEED_UNKNOWN; @@ -1685,6 +1685,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) dev->intf = udev; dev->driver_info = info; dev->driver_name = name; + /* cannot use 0, as simplex devices may exist */ + dev->rx_speed = SPEED_UNSET; /* unknown or handled by MII */ + dev->tx_speed = SPEED_UNSET; net->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); if (!net->tstats) diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 132c1b5e14bb..7f445c1e0003 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -53,6 +53,10 @@ struct usbnet { u32 hard_mtu; /* count any extra framing */ size_t rx_urb_size; /* size for rx urbs */ struct mii_if_info mii; + /* These are bits per second unlike what ethernet uses */ + long rx_speed; /* if MII is not used */ + long tx_speed; /* if MII is not used */ +# define SPEED_UNSET -1 /* various kinds of pending driver work */ struct sk_buff_head rxq; @@ -81,8 +85,6 @@ struct usbnet { # define EVENT_LINK_CHANGE 11 # define EVENT_SET_RX_MODE 12 # define EVENT_NO_IP_ALIGN 13 - u32 rx_speed; /* in bps - NOT Mbps */ - u32 tx_speed; /* in bps - NOT Mbps */ }; static inline struct usb_driver *driver_of(struct usb_interface *intf)