.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * CDC Ethernet based networking peripherals |
---|
3 | 4 | * Copyright (C) 2003-2005 by David Brownell |
---|
4 | 5 | * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync) |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
---|
18 | 6 | */ |
---|
19 | 7 | |
---|
20 | 8 | // #define DEBUG // error path messages, extra info |
---|
.. | .. |
---|
75 | 63 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, |
---|
76 | 64 | }; |
---|
77 | 65 | |
---|
78 | | -static void usbnet_cdc_update_filter(struct usbnet *dev) |
---|
| 66 | +void usbnet_cdc_update_filter(struct usbnet *dev) |
---|
79 | 67 | { |
---|
80 | | - struct cdc_state *info = (void *) &dev->data; |
---|
81 | | - struct usb_interface *intf = info->control; |
---|
82 | 68 | struct net_device *net = dev->net; |
---|
83 | 69 | |
---|
84 | 70 | u16 cdc_filter = USB_CDC_PACKET_TYPE_DIRECTED |
---|
.. | .. |
---|
98 | 84 | USB_CDC_SET_ETHERNET_PACKET_FILTER, |
---|
99 | 85 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
---|
100 | 86 | cdc_filter, |
---|
101 | | - intf->cur_altsetting->desc.bInterfaceNumber, |
---|
| 87 | + dev->intf->cur_altsetting->desc.bInterfaceNumber, |
---|
102 | 88 | NULL, |
---|
103 | 89 | 0, |
---|
104 | 90 | USB_CTRL_SET_TIMEOUT |
---|
105 | 91 | ); |
---|
106 | 92 | } |
---|
| 93 | +EXPORT_SYMBOL_GPL(usbnet_cdc_update_filter); |
---|
107 | 94 | |
---|
108 | 95 | /* probes control interface, claims data interface, collects the bulk |
---|
109 | 96 | * endpoints, activates data interface (if needed), maybe sets MTU. |
---|
.. | .. |
---|
179 | 166 | * probed with) and a slave/data interface; union |
---|
180 | 167 | * descriptors sort this all out. |
---|
181 | 168 | */ |
---|
182 | | - info->control = usb_ifnum_to_if(dev->udev, |
---|
183 | | - info->u->bMasterInterface0); |
---|
184 | | - info->data = usb_ifnum_to_if(dev->udev, |
---|
185 | | - info->u->bSlaveInterface0); |
---|
| 169 | + info->control = usb_ifnum_to_if(dev->udev, info->u->bMasterInterface0); |
---|
| 170 | + info->data = usb_ifnum_to_if(dev->udev, info->u->bSlaveInterface0); |
---|
186 | 171 | if (!info->control || !info->data) { |
---|
187 | 172 | dev_dbg(&intf->dev, |
---|
188 | 173 | "master #%u/%p slave #%u/%p\n", |
---|
.. | .. |
---|
216 | 201 | /* a data interface altsetting does the real i/o */ |
---|
217 | 202 | d = &info->data->cur_altsetting->desc; |
---|
218 | 203 | if (d->bInterfaceClass != USB_CLASS_CDC_DATA) { |
---|
219 | | - dev_dbg(&intf->dev, "slave class %u\n", |
---|
220 | | - d->bInterfaceClass); |
---|
| 204 | + dev_dbg(&intf->dev, "slave class %u\n", d->bInterfaceClass); |
---|
221 | 205 | goto bad_desc; |
---|
222 | 206 | } |
---|
223 | 207 | skip: |
---|
.. | .. |
---|
231 | 215 | if (rndis && is_rndis(&intf->cur_altsetting->desc) && |
---|
232 | 216 | header.usb_cdc_acm_descriptor && |
---|
233 | 217 | header.usb_cdc_acm_descriptor->bmCapabilities) { |
---|
234 | | - dev_dbg(&intf->dev, |
---|
235 | | - "ACM capabilities %02x, not really RNDIS?\n", |
---|
236 | | - header.usb_cdc_acm_descriptor->bmCapabilities); |
---|
237 | | - goto bad_desc; |
---|
| 218 | + dev_dbg(&intf->dev, |
---|
| 219 | + "ACM capabilities %02x, not really RNDIS?\n", |
---|
| 220 | + header.usb_cdc_acm_descriptor->bmCapabilities); |
---|
| 221 | + goto bad_desc; |
---|
238 | 222 | } |
---|
239 | 223 | |
---|
240 | 224 | if (header.usb_cdc_ether_desc && info->ether->wMaxSegmentSize) { |
---|
.. | .. |
---|
245 | 229 | } |
---|
246 | 230 | |
---|
247 | 231 | if (header.usb_cdc_mdlm_desc && |
---|
248 | | - memcmp(header.usb_cdc_mdlm_desc->bGUID, mbm_guid, 16)) { |
---|
| 232 | + memcmp(header.usb_cdc_mdlm_desc->bGUID, mbm_guid, 16)) { |
---|
249 | 233 | dev_dbg(&intf->dev, "GUID doesn't match\n"); |
---|
250 | 234 | goto bad_desc; |
---|
251 | 235 | } |
---|
.. | .. |
---|
309 | 293 | if (info->control->cur_altsetting->desc.bNumEndpoints == 1) { |
---|
310 | 294 | struct usb_endpoint_descriptor *desc; |
---|
311 | 295 | |
---|
312 | | - dev->status = &info->control->cur_altsetting->endpoint [0]; |
---|
| 296 | + dev->status = &info->control->cur_altsetting->endpoint[0]; |
---|
313 | 297 | desc = &dev->status->desc; |
---|
314 | 298 | if (!usb_endpoint_is_int_in(desc) || |
---|
315 | 299 | (le16_to_cpu(desc->wMaxPacketSize) |
---|
.. | .. |
---|
554 | 538 | .manage_power = usbnet_manage_power, |
---|
555 | 539 | }; |
---|
556 | 540 | |
---|
557 | | -static const struct driver_info lte_info = { |
---|
558 | | - .description = "CDC Ethernet Device(lte)", |
---|
559 | | - .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_LTE, |
---|
560 | | - .bind = usbnet_cdc_bind, |
---|
561 | | - .unbind = usbnet_cdc_unbind, |
---|
562 | | - .status = usbnet_cdc_status, |
---|
563 | | - .set_rx_mode = usbnet_cdc_update_filter, |
---|
564 | | - .manage_power = usbnet_manage_power, |
---|
565 | | -}; |
---|
566 | | - |
---|
567 | 541 | /*-------------------------------------------------------------------------*/ |
---|
568 | 542 | |
---|
569 | 543 | #define HUAWEI_VENDOR_ID 0x12D1 |
---|
.. | .. |
---|
579 | 553 | #define MICROSOFT_VENDOR_ID 0x045e |
---|
580 | 554 | #define UBLOX_VENDOR_ID 0x1546 |
---|
581 | 555 | #define TPLINK_VENDOR_ID 0x2357 |
---|
| 556 | +#define AQUANTIA_VENDOR_ID 0x2eca |
---|
| 557 | +#define ASIX_VENDOR_ID 0x0b95 |
---|
582 | 558 | |
---|
583 | 559 | static const struct usb_device_id products[] = { |
---|
584 | 560 | /* BLACKLIST !! |
---|
.. | .. |
---|
628 | 604 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
---|
629 | 605 | | USB_DEVICE_ID_MATCH_DEVICE, |
---|
630 | 606 | .idVendor = 0x04DD, |
---|
| 607 | + .idProduct = 0x8005, /* A-300 */ |
---|
| 608 | + ZAURUS_FAKE_INTERFACE, |
---|
| 609 | + .driver_info = 0, |
---|
| 610 | +}, { |
---|
| 611 | + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
---|
| 612 | + | USB_DEVICE_ID_MATCH_DEVICE, |
---|
| 613 | + .idVendor = 0x04DD, |
---|
631 | 614 | .idProduct = 0x8006, /* B-500/SL-5600 */ |
---|
632 | 615 | ZAURUS_MASTER_INTERFACE, |
---|
633 | 616 | .driver_info = 0, |
---|
.. | .. |
---|
635 | 618 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
---|
636 | 619 | | USB_DEVICE_ID_MATCH_DEVICE, |
---|
637 | 620 | .idVendor = 0x04DD, |
---|
| 621 | + .idProduct = 0x8006, /* B-500/SL-5600 */ |
---|
| 622 | + ZAURUS_FAKE_INTERFACE, |
---|
| 623 | + .driver_info = 0, |
---|
| 624 | +}, { |
---|
| 625 | + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
---|
| 626 | + | USB_DEVICE_ID_MATCH_DEVICE, |
---|
| 627 | + .idVendor = 0x04DD, |
---|
638 | 628 | .idProduct = 0x8007, /* C-700 */ |
---|
639 | 629 | ZAURUS_MASTER_INTERFACE, |
---|
640 | 630 | .driver_info = 0, |
---|
| 631 | +}, { |
---|
| 632 | + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
---|
| 633 | + | USB_DEVICE_ID_MATCH_DEVICE, |
---|
| 634 | + .idVendor = 0x04DD, |
---|
| 635 | + .idProduct = 0x8007, /* C-700 */ |
---|
| 636 | + ZAURUS_FAKE_INTERFACE, |
---|
| 637 | + .driver_info = 0, |
---|
641 | 638 | }, { |
---|
642 | 639 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
---|
643 | 640 | | USB_DEVICE_ID_MATCH_DEVICE, |
---|
.. | .. |
---|
787 | 784 | }, |
---|
788 | 785 | #endif |
---|
789 | 786 | |
---|
| 787 | +/* Lenovo ThinkPad OneLink+ Dock (based on Realtek RTL8153) */ |
---|
| 788 | +{ |
---|
| 789 | + USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x3054, USB_CLASS_COMM, |
---|
| 790 | + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), |
---|
| 791 | + .driver_info = 0, |
---|
| 792 | +}, |
---|
| 793 | + |
---|
790 | 794 | /* ThinkPad USB-C Dock (based on Realtek RTL8153) */ |
---|
791 | 795 | { |
---|
792 | 796 | USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x3062, USB_CLASS_COMM, |
---|
.. | .. |
---|
797 | 801 | /* ThinkPad Thunderbolt 3 Dock (based on Realtek RTL8153) */ |
---|
798 | 802 | { |
---|
799 | 803 | USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x3069, USB_CLASS_COMM, |
---|
| 804 | + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), |
---|
| 805 | + .driver_info = 0, |
---|
| 806 | +}, |
---|
| 807 | + |
---|
| 808 | +/* ThinkPad Thunderbolt 3 Dock Gen 2 (based on Realtek RTL8153) */ |
---|
| 809 | +{ |
---|
| 810 | + USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x3082, USB_CLASS_COMM, |
---|
800 | 811 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), |
---|
801 | 812 | .driver_info = 0, |
---|
802 | 813 | }, |
---|
.. | .. |
---|
868 | 879 | { |
---|
869 | 880 | USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, 0x0601, USB_CLASS_COMM, |
---|
870 | 881 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), |
---|
| 882 | + .driver_info = 0, |
---|
| 883 | +}, |
---|
| 884 | + |
---|
| 885 | +/* Aquantia AQtion USB to 5GbE Controller (based on AQC111U) */ |
---|
| 886 | +{ |
---|
| 887 | + USB_DEVICE_AND_INTERFACE_INFO(AQUANTIA_VENDOR_ID, 0xc101, |
---|
| 888 | + USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, |
---|
| 889 | + USB_CDC_PROTO_NONE), |
---|
| 890 | + .driver_info = 0, |
---|
| 891 | +}, |
---|
| 892 | + |
---|
| 893 | +/* ASIX USB 3.1 Gen1 to 5G Multi-Gigabit Ethernet Adapter(based on AQC111U) */ |
---|
| 894 | +{ |
---|
| 895 | + USB_DEVICE_AND_INTERFACE_INFO(ASIX_VENDOR_ID, 0x2790, USB_CLASS_COMM, |
---|
| 896 | + USB_CDC_SUBCLASS_ETHERNET, |
---|
| 897 | + USB_CDC_PROTO_NONE), |
---|
| 898 | + .driver_info = 0, |
---|
| 899 | +}, |
---|
| 900 | + |
---|
| 901 | +/* ASIX USB 3.1 Gen1 to 2.5G Multi-Gigabit Ethernet Adapter(based on AQC112U) */ |
---|
| 902 | +{ |
---|
| 903 | + USB_DEVICE_AND_INTERFACE_INFO(ASIX_VENDOR_ID, 0x2791, USB_CLASS_COMM, |
---|
| 904 | + USB_CDC_SUBCLASS_ETHERNET, |
---|
| 905 | + USB_CDC_PROTO_NONE), |
---|
| 906 | + .driver_info = 0, |
---|
| 907 | +}, |
---|
| 908 | + |
---|
| 909 | +/* USB-C 3.1 to 5GBASE-T Ethernet Adapter (based on AQC111U) */ |
---|
| 910 | +{ |
---|
| 911 | + USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0xe05a, USB_CLASS_COMM, |
---|
| 912 | + USB_CDC_SUBCLASS_ETHERNET, |
---|
| 913 | + USB_CDC_PROTO_NONE), |
---|
| 914 | + .driver_info = 0, |
---|
| 915 | +}, |
---|
| 916 | + |
---|
| 917 | +/* QNAP QNA-UC5G1T USB to 5GbE Adapter (based on AQC111U) */ |
---|
| 918 | +{ |
---|
| 919 | + USB_DEVICE_AND_INTERFACE_INFO(0x1c04, 0x0015, USB_CLASS_COMM, |
---|
| 920 | + USB_CDC_SUBCLASS_ETHERNET, |
---|
| 921 | + USB_CDC_PROTO_NONE), |
---|
871 | 922 | .driver_info = 0, |
---|
872 | 923 | }, |
---|
873 | 924 | |
---|
.. | .. |
---|
957 | 1008 | USB_CDC_SUBCLASS_ETHERNET, |
---|
958 | 1009 | USB_CDC_PROTO_NONE), |
---|
959 | 1010 | .driver_info = (unsigned long)&wwan_info, |
---|
960 | | -}, { |
---|
961 | | - /* RM310 modules*/ |
---|
962 | | - USB_DEVICE_AND_INTERFACE_INFO(0x1286, 0x4E3C, USB_CLASS_COMM, |
---|
963 | | - USB_CDC_SUBCLASS_ETHERNET, |
---|
964 | | - USB_CDC_PROTO_NONE), |
---|
965 | | - .driver_info = (unsigned long)<e_info, |
---|
966 | 1011 | }, { |
---|
967 | 1012 | USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, |
---|
968 | 1013 | USB_CDC_PROTO_NONE), |
---|