linux_dsm_epyc7002/drivers/net/usb
Kristian Evensen bfe9b9d2df cdc_ether: Improve ZTE MF823/831/910 handling
The firmware in several ZTE devices (at least the MF823/831/910
modems/mifis) use OS fingerprinting to determine which type of device to
export. In addition, these devices export a REST API which can be used to
control the type of device. So far, on Linux, the devices have been seen as
RNDIS or CDC Ether.

When CDC Ether is used, devices of the same type are, as with RNDIS,
exported with the same, bogus random MAC address. In addition, the devices
(at least on all firmware revisions I have found) use the bogus MAC when
sending traffic routed from external networks. And as a final feature, the
devices sometimes export the link state incorrectly. There are also
references online to several other ZTE devices displaying this behavior,
with several different PIDs and MAC addresses.

This patch tries to improve the handling of ZTE devices by doing the
following:

* Create a new driver_info-struct that is used by ZTE devices that do not
have an explicit entry in the product table. This struct is the same as the
default cdc_ether driver info, but a new bind- and an rx_fixup-function
have been added.

* In the new bind function, we check if we have read a random MAC from the
device. If we have, then we generate a new random MAC address. This will
ensure that all devices get a unique MAC.

* The rx_fixup-function replaces the destination MAC address in the skb
with that of the device. I have not seen a revision of these devices that
behaves correctly (i.e., sets the right destination MAC), so I chose not to
do any comparison with for example the known, bogus addresses.

* The MF823/MF832/MF910 sometimes export cdc carrier on twice on connect
(the correct behavior is off then on). Work around this by manually setting
carrier to off if an on-notification is received and the NOCARRIER-bit is
not set.

This change will affect all devices, but it should take care of similar
mistakes made by other manufacturers. I tried to think of/look/test for
problems/regressions that could be introduced by this behavior, but could
not find any. However, my familiarity with this code path is not that
great, so there could be something I have overlooked.

I have tested this patch with multiple revisions of all three devices, and
they behave as expected. In other words, they all got a valid, random MAC,
the correct operational state and I can receive/sent traffic without
problems. I also tested with some other cdc_ether devices I have and did
not find any problems/regressions caused by the two general changes.

v3->v4:
* Forgot to remove unused variables, sorry about that (thanks David
Miller).

v2->v3:
* I had forgot to remove the random MAC generation from usbnet_cdc_bind()
(thanks Oliver).
* Rework logic in the ZTE bind-function a bit.

v1->v2:
* Only generate random MAC for ZTE devices (thanks Oliver Neukum).
* Set random MAC and do RX fixup for all ZTE devices that do not have a
product-entry, as the bogus MAC have been seen on devices with several
different PIDs/MAC addresses. In other words, it seems to be the default
behavior of ZTE CDC Ether devices (thanks Lars Melin).

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-24 22:16:03 -07: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 net: usb: ax88172x: use phy_ethtool_{get|set}_link_ksettings 2016-07-16 21:54:40 -07:00
ax88179_178a.c ax88179_178a: fix bonding failure 2014-10-20 00:53:30 -04:00
catc.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
cdc_eem.c drivers/net: delete non-required instances of include <linux/init.h> 2014-01-16 11:53:26 -08:00
cdc_ether.c cdc_ether: Improve ZTE MF823/831/910 handling 2016-07-24 22:16:03 -07: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 cdc_ncm: workaround for EM7455 "silent" data interface 2016-07-04 16:12:03 -07:00
cdc_subset.c cdc_subset: deal with a device that needs reset for timeout 2014-08-02 15:44:18 -07:00
cdc-phonet.c cdc-phonet: use common parser 2015-09-15 12:43:49 -07:00
ch9200.c net: usb: ch9200: use kmemdup 2016-05-20 19:50:07 -04:00
cx82310_eth.c cx82310_eth: fix semicolon.cocci warnings 2015-03-24 14:56:02 -04:00
dm9601.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
gl620a.c usbnet: remove generic hard_header_len check 2014-02-17 14:35:46 -05:00
hso.c tty: Replace TTY_THROTTLED bit tests with tty_throttled() 2016-04-30 09:26:55 -07:00
huawei_cdc_ncm.c cdc_ncm: Add support for moving NDP to end of NCM frame 2015-07-09 14:58:31 -07:00
int51x1.c usb: Fix FSF address in file headers 2013-12-06 12:37:55 -05:00
ipheth.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-06-03 23:32:12 -07:00
kalmia.c drivers/net: delete non-required instances of include <linux/init.h> 2014-01-16 11:53:26 -08:00
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 net: usb: Use eth_<foo>_addr instead of memset 2015-03-03 17:01:36 -05:00
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 usbnet: remove generic hard_header_len check 2014-02-17 14:35:46 -05:00
pegasus.c net: pegasus: simplify logical constraint 2016-05-23 13:48:45 -07:00
pegasus.h drivers: net: usb: pegasus: fix control urb submission 2013-04-29 13:57:50 -04:00
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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-07-24 00:53:32 -04:00
rndis_host.c rndis_host: Set valid random MAC on buggy devices 2016-07-16 20:03:04 -07:00
rtl8150.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
sierra_net.c usb: Fix FSF address in file headers 2013-12-06 12:37:55 -05:00
smsc75xx.c usbnet/smsc75xx: silence uninitialized variable warning 2016-05-04 16:58:56 -04:00
smsc75xx.h usb: Fix FSF address in file headers 2013-12-06 12:37:55 -05:00
smsc95xx.c usbnet: smsc95xx: fix link detection for disabled autonegotiation 2016-05-31 14:22:23 -07:00
smsc95xx.h usb: Fix FSF address in file headers 2013-12-06 12:37:55 -05:00
sr9700.c net: usb: sr9700: Use 'SR_' prefix for the common register macros 2015-02-04 13:53:02 -08:00
sr9700.h net: usb: sr9700: Use 'SR_' prefix for the common register macros 2015-02-04 13:53:02 -08:00
sr9800.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
sr9800.h USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support 2014-02-10 16:53:06 -08:00
usbnet.c usbnet: Stop RX Q on MTU change 2016-06-30 09:05:05 -04:00
zaurus.c drivers/net: delete non-required instances of include <linux/init.h> 2014-01-16 11:53:26 -08:00