linux/drivers/net/usb
John Stultz cd9e2e5d3f asix: Fix offset calculation in asix_rx_fixup() causing slow transmissions
In testing with HiKey, we found that since
commit 3f30b158eb ("asix: On RX avoid creating bad Ethernet
frames"),
we're seeing lots of noise during network transfers:

[  239.027993] asix 1-1.1:1.0 eth0: asix_rx_fixup() Data Header synchronisation was lost, remaining 988
[  239.037310] asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0x54ebb5ec, offset 4
[  239.045519] asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0xcdffe7a2, offset 4
[  239.275044] asix 1-1.1:1.0 eth0: asix_rx_fixup() Data Header synchronisation was lost, remaining 988
[  239.284355] asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0x1d36f59d, offset 4
[  239.292541] asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0xaef3c1e9, offset 4
[  239.518996] asix 1-1.1:1.0 eth0: asix_rx_fixup() Data Header synchronisation was lost, remaining 988
[  239.528300] asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0x2881912, offset 4
[  239.536413] asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0x5638f7e2, offset 4

And network throughput ends up being pretty bursty and slow with
a overall throughput of at best ~30kB/s (where as previously we
got 1.1MB/s with the slower USB1.1 "full speed" host).

We found the issue also was reproducible on a x86_64 system,
using a "high-speed" USB2.0 port but the throughput did not
measurably drop (possibly due to the scp transfer being cpu
bound on my slow test hardware).

After lots of debugging, I found the check added in the
problematic commit seems to be calculating the offset
incorrectly.

In the normal case, in the main loop of the function, we do:
(where offset is zero, or set to "offset += (copy_length + 1) &
0xfffe" in the previous loop)
    rx->header = get_unaligned_le32(skb->data +
                                    offset);
    offset += sizeof(u32);

But the problematic patch calculates:
    offset = ((rx->remaining + 1) & 0xfffe) + sizeof(u32);
    rx->header = get_unaligned_le32(skb->data + offset);

Adding some debug logic to check those offset calculation used
to find rx->header, the one in problematic code is always too
large by sizeof(u32).

Thus, this patch removes the incorrect " + sizeof(u32)" addition
in the problematic calculation, and resolves the issue.

Cc: Dean Jenkins <Dean_Jenkins@mentor.com>
Cc: "David B. Robins" <linux@davidrobins.net>
Cc: Mark Craske <Mark_Craske@mentor.com>
Cc: Emil Goode <emilgoode@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: YongQin Liu <yongqin.liu@linaro.org>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Ivan Vecera <ivecera@redhat.com>
Cc: linux-usb@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: stable <stable@vger.kernel.org> #4.4+
Reported-by: Yongqin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-05-17 14:02:33 -04:00
..
asix_common.c asix: Fix offset calculation in asix_rx_fixup() causing slow transmissions 2016-05-17 14:02:33 -04:00
asix_devices.c net: asix: add support for the Billionton GUSB2AM-1G-B USB adapter 2015-10-18 19:36:04 -07:00
asix.h asix: Rename remaining and size for clarity 2015-10-05 06:58:38 -07:00
ax88172a.c asix: do not free array priv->mdio->irq 2016-03-06 22:56:48 -05:00
ax88179_178a.c
catc.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
cdc_eem.c
cdc_ether.c cdc-acm: fix NULL pointer reference 2016-01-09 21:00:24 -05:00
cdc_mbim.c cdc_mbim: apply "NDP to end" quirk to all Huawei devices 2016-04-14 21:04:04 -04:00
cdc_ncm.c net: usb: cdc_ncm: adding Telit LE910 V2 mobile broadband card 2016-03-31 17:15:35 -04:00
cdc_subset.c
cdc-phonet.c cdc-phonet: use common parser 2015-09-15 12:43:49 -07:00
ch9200.c ch9200: Convert to use module_usb_driver 2015-09-22 17:34:57 -07:00
cx82310_eth.c
dm9601.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
gl620a.c
hso.c
huawei_cdc_ncm.c
int51x1.c
ipheth.c
kalmia.c
kaweth.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
Kconfig USB: cdc_subset: only build when one driver is enabled 2016-02-18 15:59:45 -05:00
lan78xx.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
lan78xx.h lan78xx: replace devid to chipid & chiprev 2016-02-29 17:12:07 -05:00
lg-vl600.c
Makefile USB: cdc_subset: only build when one driver is enabled 2016-02-18 15:59:45 -05:00
mcs7830.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
net1080.c
pegasus.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
pegasus.h
plusb.c drivers/net/usb/plusb.c: Fix typo 2016-03-27 22:33:56 -04:00
qmi_wwan.c qmi_wwan: add "D-Link DWM-221 B1" device id 2016-03-28 20:12:01 -04:00
r8152.c rtl8152: correct speed testing 2016-05-03 15:49:34 -04:00
rndis_host.c
rtl8150.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
sierra_net.c
smsc75xx.c usbnet/smsc75xx: silence uninitialized variable warning 2016-05-04 16:58:56 -04:00
smsc75xx.h
smsc95xx.c usbnet: smsc95xx: silence an uninitialized variable warning 2016-05-04 16:58:57 -04:00
smsc95xx.h
sr9700.c
sr9700.h
sr9800.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
sr9800.h
usbnet.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
zaurus.c