blob: 2e025ddcef210bc888dd8a8ff81473a32c3dd154 [file] [log] [blame]
Greg Suarez9bf211a32012-10-22 10:56:36 +00001/*
2 * Copyright (c) 2012 Smith Micro Software, Inc.
3 * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
4 *
5 * This driver is based on and reuse most of cdc_ncm, which is
6 * Copyright (C) ST-Ericsson 2010-2012
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/netdevice.h>
15#include <linux/ethtool.h>
Bjørn Morka82c7ce2012-10-22 10:56:39 +000016#include <linux/if_vlan.h>
Greg Suarez9bf211a32012-10-22 10:56:36 +000017#include <linux/ip.h>
18#include <linux/mii.h>
19#include <linux/usb.h>
20#include <linux/usb/cdc.h>
21#include <linux/usb/usbnet.h>
22#include <linux/usb/cdc-wdm.h>
23#include <linux/usb/cdc_ncm.h>
Bjørn Mork5b8f15f2013-10-31 15:56:10 +010024#include <net/ipv6.h>
25#include <net/addrconf.h>
Greg Suarez9bf211a32012-10-22 10:56:36 +000026
27/* driver specific data - must match cdc_ncm usage */
28struct cdc_mbim_state {
29 struct cdc_ncm_ctx *ctx;
30 atomic_t pmcount;
31 struct usb_driver *subdriver;
32 struct usb_interface *control;
33 struct usb_interface *data;
34};
35
36/* using a counter to merge subdriver requests with our own into a combined state */
37static int cdc_mbim_manage_power(struct usbnet *dev, int on)
38{
39 struct cdc_mbim_state *info = (void *)&dev->data;
40 int rv = 0;
41
42 dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on);
43
44 if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) {
45 /* need autopm_get/put here to ensure the usbcore sees the new value */
46 rv = usb_autopm_get_interface(dev->intf);
Greg Suarez9bf211a32012-10-22 10:56:36 +000047 dev->intf->needs_remote_wakeup = on;
Bjørn Mork04d948a2013-11-01 14:18:52 +010048 if (!rv)
49 usb_autopm_put_interface(dev->intf);
Greg Suarez9bf211a32012-10-22 10:56:36 +000050 }
Bjørn Mork04d948a2013-11-01 14:18:52 +010051 return 0;
Greg Suarez9bf211a32012-10-22 10:56:36 +000052}
53
54static int cdc_mbim_wdm_manage_power(struct usb_interface *intf, int status)
55{
56 struct usbnet *dev = usb_get_intfdata(intf);
57
58 /* can be called while disconnecting */
59 if (!dev)
60 return 0;
61
62 return cdc_mbim_manage_power(dev, status);
63}
64
65
66static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf)
67{
68 struct cdc_ncm_ctx *ctx;
69 struct usb_driver *subdriver = ERR_PTR(-ENODEV);
70 int ret = -ENODEV;
Bjørn Mork1e8bbe62013-03-14 01:05:13 +000071 u8 data_altsetting = cdc_ncm_select_altsetting(dev, intf);
Greg Suarez9bf211a32012-10-22 10:56:36 +000072 struct cdc_mbim_state *info = (void *)&dev->data;
73
Greg Suarez9bf211a32012-10-22 10:56:36 +000074 /* Probably NCM, defer for cdc_ncm_bind */
75 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
76 goto err;
77
78 ret = cdc_ncm_bind_common(dev, intf, data_altsetting);
79 if (ret)
80 goto err;
81
82 ctx = info->ctx;
83
84 /* The MBIM descriptor and the status endpoint are required */
85 if (ctx->mbim_desc && dev->status)
86 subdriver = usb_cdc_wdm_register(ctx->control,
87 &dev->status->desc,
88 le16_to_cpu(ctx->mbim_desc->wMaxControlMessage),
89 cdc_mbim_wdm_manage_power);
90 if (IS_ERR(subdriver)) {
91 ret = PTR_ERR(subdriver);
92 cdc_ncm_unbind(dev, intf);
93 goto err;
94 }
95
96 /* can't let usbnet use the interrupt endpoint */
97 dev->status = NULL;
98 info->subdriver = subdriver;
99
100 /* MBIM cannot do ARP */
101 dev->net->flags |= IFF_NOARP;
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000102
103 /* no need to put the VLAN tci in the packet headers */
Patrick McHardyf6469682013-04-19 02:04:27 +0000104 dev->net->features |= NETIF_F_HW_VLAN_CTAG_TX;
Greg Suarez9bf211a32012-10-22 10:56:36 +0000105err:
106 return ret;
107}
108
109static void cdc_mbim_unbind(struct usbnet *dev, struct usb_interface *intf)
110{
111 struct cdc_mbim_state *info = (void *)&dev->data;
112 struct cdc_ncm_ctx *ctx = info->ctx;
113
114 /* disconnect subdriver from control interface */
115 if (info->subdriver && info->subdriver->disconnect)
116 info->subdriver->disconnect(ctx->control);
117 info->subdriver = NULL;
118
119 /* let NCM unbind clean up both control and data interface */
120 cdc_ncm_unbind(dev, intf);
121}
122
Bjørn Mork6b5eeb72014-05-09 14:45:00 +0200123/* verify that the ethernet protocol is IPv4 or IPv6 */
124static bool is_ip_proto(__be16 proto)
125{
126 switch (proto) {
127 case htons(ETH_P_IP):
128 case htons(ETH_P_IPV6):
129 return true;
130 }
131 return false;
132}
Greg Suarez9bf211a32012-10-22 10:56:36 +0000133
134static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
135{
136 struct sk_buff *skb_out;
137 struct cdc_mbim_state *info = (void *)&dev->data;
138 struct cdc_ncm_ctx *ctx = info->ctx;
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000139 __le32 sign = cpu_to_le32(USB_CDC_MBIM_NDP16_IPS_SIGN);
140 u16 tci = 0;
Bjørn Mork6b5eeb72014-05-09 14:45:00 +0200141 bool is_ip;
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000142 u8 *c;
Greg Suarez9bf211a32012-10-22 10:56:36 +0000143
144 if (!ctx)
145 goto error;
146
147 if (skb) {
Bjørn Mork32b161a2013-04-16 00:17:07 +0000148 if (skb->len <= ETH_HLEN)
Greg Suarez9bf211a32012-10-22 10:56:36 +0000149 goto error;
150
Bjørn Mork6b5eeb72014-05-09 14:45:00 +0200151 /* Some applications using e.g. packet sockets will
152 * bypass the VLAN acceleration and create tagged
153 * ethernet frames directly. We primarily look for
154 * the accelerated out-of-band tag, but fall back if
155 * required
156 */
157 skb_reset_mac_header(skb);
158 if (vlan_get_tag(skb, &tci) < 0 && skb->len > VLAN_ETH_HLEN &&
159 __vlan_get_tag(skb, &tci) == 0) {
160 is_ip = is_ip_proto(vlan_eth_hdr(skb)->h_vlan_encapsulated_proto);
161 skb_pull(skb, VLAN_ETH_HLEN);
162 } else {
163 is_ip = is_ip_proto(eth_hdr(skb)->h_proto);
164 skb_pull(skb, ETH_HLEN);
165 }
166
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000167 /* mapping VLANs to MBIM sessions:
168 * no tag => IPS session <0>
169 * 1 - 255 => IPS session <vlanid>
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000170 * 256 - 511 => DSS session <vlanid - 256>
171 * 512 - 4095 => unsupported, drop
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000172 */
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000173 switch (tci & 0x0f00) {
174 case 0x0000: /* VLAN ID 0 - 255 */
Bjørn Mork6b5eeb72014-05-09 14:45:00 +0200175 if (!is_ip)
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000176 goto error;
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000177 c = (u8 *)&sign;
178 c[3] = tci;
179 break;
180 case 0x0100: /* VLAN ID 256 - 511 */
181 sign = cpu_to_le32(USB_CDC_MBIM_NDP16_DSS_SIGN);
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000182 c = (u8 *)&sign;
183 c[3] = tci;
184 break;
185 default:
186 netif_err(dev, tx_err, dev->net,
187 "unsupported tci=0x%04x\n", tci);
188 goto error;
189 }
Greg Suarez9bf211a32012-10-22 10:56:36 +0000190 }
191
192 spin_lock_bh(&ctx->mtx);
Bjørn Morkbed6f762013-11-01 11:16:42 +0100193 skb_out = cdc_ncm_fill_tx_frame(dev, skb, sign);
Greg Suarez9bf211a32012-10-22 10:56:36 +0000194 spin_unlock_bh(&ctx->mtx);
195 return skb_out;
196
197error:
198 if (skb)
199 dev_kfree_skb_any(skb);
200
201 return NULL;
202}
203
Bjørn Mork5b8f15f2013-10-31 15:56:10 +0100204/* Some devices are known to send Neigbor Solicitation messages and
205 * require Neigbor Advertisement replies. The IPv6 core will not
206 * respond since IFF_NOARP is set, so we must handle them ourselves.
207 */
208static void do_neigh_solicit(struct usbnet *dev, u8 *buf, u16 tci)
209{
210 struct ipv6hdr *iph = (void *)buf;
211 struct nd_msg *msg = (void *)(iph + 1);
212 struct net_device *netdev;
213 struct inet6_dev *in6_dev;
214 bool is_router;
215
216 /* we'll only respond to requests from unicast addresses to
217 * our solicited node addresses.
218 */
219 if (!ipv6_addr_is_solict_mult(&iph->daddr) ||
220 !(ipv6_addr_type(&iph->saddr) & IPV6_ADDR_UNICAST))
221 return;
222
223 /* need to send the NA on the VLAN dev, if any */
Bjørn Mork4f4178f2014-05-03 16:12:47 +0200224 rcu_read_lock();
225 if (tci) {
Bjørn Mork5b8f15f2013-10-31 15:56:10 +0100226 netdev = __vlan_find_dev_deep(dev->net, htons(ETH_P_8021Q),
227 tci);
Bjørn Mork4f4178f2014-05-03 16:12:47 +0200228 if (!netdev) {
229 rcu_read_unlock();
230 return;
231 }
232 } else {
Bjørn Mork5b8f15f2013-10-31 15:56:10 +0100233 netdev = dev->net;
Bjørn Mork4f4178f2014-05-03 16:12:47 +0200234 }
235 dev_hold(netdev);
236 rcu_read_unlock();
Bjørn Mork5b8f15f2013-10-31 15:56:10 +0100237
238 in6_dev = in6_dev_get(netdev);
239 if (!in6_dev)
Bjørn Mork4f4178f2014-05-03 16:12:47 +0200240 goto out;
Bjørn Mork5b8f15f2013-10-31 15:56:10 +0100241 is_router = !!in6_dev->cnf.forwarding;
242 in6_dev_put(in6_dev);
243
244 /* ipv6_stub != NULL if in6_dev_get returned an inet6_dev */
245 ipv6_stub->ndisc_send_na(netdev, NULL, &iph->saddr, &msg->target,
246 is_router /* router */,
247 true /* solicited */,
248 false /* override */,
249 true /* inc_opt */);
Bjørn Mork4f4178f2014-05-03 16:12:47 +0200250out:
251 dev_put(netdev);
Bjørn Mork5b8f15f2013-10-31 15:56:10 +0100252}
253
254static bool is_neigh_solicit(u8 *buf, size_t len)
255{
256 struct ipv6hdr *iph = (void *)buf;
257 struct nd_msg *msg = (void *)(iph + 1);
258
259 return (len >= sizeof(struct ipv6hdr) + sizeof(struct nd_msg) &&
260 iph->nexthdr == IPPROTO_ICMPV6 &&
261 msg->icmph.icmp6_code == 0 &&
262 msg->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION);
263}
264
265
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000266static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_t len, u16 tci)
Greg Suarez9bf211a32012-10-22 10:56:36 +0000267{
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000268 __be16 proto = htons(ETH_P_802_3);
Greg Suarez9bf211a32012-10-22 10:56:36 +0000269 struct sk_buff *skb = NULL;
270
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000271 if (tci < 256) { /* IPS session? */
272 if (len < sizeof(struct iphdr))
273 goto err;
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000274
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000275 switch (*buf & 0xf0) {
276 case 0x40:
277 proto = htons(ETH_P_IP);
278 break;
279 case 0x60:
Bjørn Mork5b8f15f2013-10-31 15:56:10 +0100280 if (is_neigh_solicit(buf, len))
281 do_neigh_solicit(dev, buf, tci);
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000282 proto = htons(ETH_P_IPV6);
283 break;
284 default:
285 goto err;
286 }
Greg Suarez9bf211a32012-10-22 10:56:36 +0000287 }
288
289 skb = netdev_alloc_skb_ip_align(dev->net, len + ETH_HLEN);
290 if (!skb)
291 goto err;
292
293 /* add an ethernet header */
294 skb_put(skb, ETH_HLEN);
295 skb_reset_mac_header(skb);
296 eth_hdr(skb)->h_proto = proto;
297 memset(eth_hdr(skb)->h_source, 0, ETH_ALEN);
298 memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN);
299
300 /* add datagram */
301 memcpy(skb_put(skb, len), buf, len);
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000302
303 /* map MBIM session to VLAN */
304 if (tci)
Patrick McHardy86a9bad2013-04-19 02:04:30 +0000305 vlan_put_tag(skb, htons(ETH_P_8021Q), tci);
Greg Suarez9bf211a32012-10-22 10:56:36 +0000306err:
307 return skb;
308}
309
310static int cdc_mbim_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
311{
312 struct sk_buff *skb;
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000313 struct cdc_mbim_state *info = (void *)&dev->data;
314 struct cdc_ncm_ctx *ctx = info->ctx;
Greg Suarez9bf211a32012-10-22 10:56:36 +0000315 int len;
316 int nframes;
317 int x;
318 int offset;
319 struct usb_cdc_ncm_ndp16 *ndp16;
320 struct usb_cdc_ncm_dpe16 *dpe16;
321 int ndpoffset;
322 int loopcount = 50; /* arbitrary max preventing infinite loop */
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000323 u8 *c;
324 u16 tci;
Greg Suarez9bf211a32012-10-22 10:56:36 +0000325
326 ndpoffset = cdc_ncm_rx_verify_nth16(ctx, skb_in);
327 if (ndpoffset < 0)
328 goto error;
329
330next_ndp:
331 nframes = cdc_ncm_rx_verify_ndp16(skb_in, ndpoffset);
332 if (nframes < 0)
333 goto error;
334
335 ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb_in->data + ndpoffset);
336
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000337 switch (ndp16->dwSignature & cpu_to_le32(0x00ffffff)) {
Greg Suarez9bf211a32012-10-22 10:56:36 +0000338 case cpu_to_le32(USB_CDC_MBIM_NDP16_IPS_SIGN):
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000339 c = (u8 *)&ndp16->dwSignature;
340 tci = c[3];
Greg Suarez9bf211a32012-10-22 10:56:36 +0000341 break;
Bjørn Mork9f651ca2012-10-22 10:56:40 +0000342 case cpu_to_le32(USB_CDC_MBIM_NDP16_DSS_SIGN):
343 c = (u8 *)&ndp16->dwSignature;
344 tci = c[3] + 256;
345 break;
Greg Suarez9bf211a32012-10-22 10:56:36 +0000346 default:
347 netif_dbg(dev, rx_err, dev->net,
348 "unsupported NDP signature <0x%08x>\n",
349 le32_to_cpu(ndp16->dwSignature));
350 goto err_ndp;
351
352 }
353
354 dpe16 = ndp16->dpe16;
355 for (x = 0; x < nframes; x++, dpe16++) {
356 offset = le16_to_cpu(dpe16->wDatagramIndex);
357 len = le16_to_cpu(dpe16->wDatagramLength);
358
359 /*
360 * CDC NCM ch. 3.7
361 * All entries after first NULL entry are to be ignored
362 */
363 if ((offset == 0) || (len == 0)) {
364 if (!x)
365 goto err_ndp; /* empty NTB */
366 break;
367 }
368
369 /* sanity checking */
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000370 if (((offset + len) > skb_in->len) || (len > ctx->rx_max)) {
Greg Suarez9bf211a32012-10-22 10:56:36 +0000371 netif_dbg(dev, rx_err, dev->net,
372 "invalid frame detected (ignored) offset[%u]=%u, length=%u, skb=%p\n",
373 x, offset, len, skb_in);
374 if (!x)
375 goto err_ndp;
376 break;
377 } else {
Bjørn Morka82c7ce2012-10-22 10:56:39 +0000378 skb = cdc_mbim_process_dgram(dev, skb_in->data + offset, len, tci);
Greg Suarez9bf211a32012-10-22 10:56:36 +0000379 if (!skb)
380 goto error;
381 usbnet_skb_return(dev, skb);
382 }
383 }
384err_ndp:
385 /* are there more NDPs to process? */
386 ndpoffset = le16_to_cpu(ndp16->wNextNdpIndex);
387 if (ndpoffset && loopcount--)
388 goto next_ndp;
389
390 return 1;
391error:
392 return 0;
393}
394
395static int cdc_mbim_suspend(struct usb_interface *intf, pm_message_t message)
396{
Bjørn Morke62416e2013-11-01 14:18:56 +0100397 int ret = -ENODEV;
Greg Suarez9bf211a32012-10-22 10:56:36 +0000398 struct usbnet *dev = usb_get_intfdata(intf);
399 struct cdc_mbim_state *info = (void *)&dev->data;
400 struct cdc_ncm_ctx *ctx = info->ctx;
401
Bjørn Morke62416e2013-11-01 14:18:56 +0100402 if (!ctx)
Greg Suarez9bf211a32012-10-22 10:56:36 +0000403 goto error;
Greg Suarez9bf211a32012-10-22 10:56:36 +0000404
Ming Lei9a443122013-03-15 12:08:56 +0800405 /*
406 * Both usbnet_suspend() and subdriver->suspend() MUST return 0
407 * in system sleep context, otherwise, the resume callback has
408 * to recover device from previous suspend failure.
409 */
Greg Suarez9bf211a32012-10-22 10:56:36 +0000410 ret = usbnet_suspend(intf, message);
411 if (ret < 0)
412 goto error;
413
414 if (intf == ctx->control && info->subdriver && info->subdriver->suspend)
415 ret = info->subdriver->suspend(intf, message);
416 if (ret < 0)
417 usbnet_resume(intf);
418
419error:
420 return ret;
421}
422
423static int cdc_mbim_resume(struct usb_interface *intf)
424{
425 int ret = 0;
426 struct usbnet *dev = usb_get_intfdata(intf);
427 struct cdc_mbim_state *info = (void *)&dev->data;
428 struct cdc_ncm_ctx *ctx = info->ctx;
429 bool callsub = (intf == ctx->control && info->subdriver && info->subdriver->resume);
430
431 if (callsub)
432 ret = info->subdriver->resume(intf);
433 if (ret < 0)
434 goto err;
435 ret = usbnet_resume(intf);
Bjørn Morkc37ac9b2013-11-01 14:18:55 +0100436 if (ret < 0 && callsub)
Greg Suarez9bf211a32012-10-22 10:56:36 +0000437 info->subdriver->suspend(intf, PMSG_SUSPEND);
438err:
439 return ret;
440}
441
442static const struct driver_info cdc_mbim_info = {
443 .description = "CDC MBIM",
Bjørn Mork844e88f2013-01-23 00:57:02 +0000444 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN,
445 .bind = cdc_mbim_bind,
446 .unbind = cdc_mbim_unbind,
447 .manage_power = cdc_mbim_manage_power,
448 .rx_fixup = cdc_mbim_rx_fixup,
449 .tx_fixup = cdc_mbim_tx_fixup,
450};
451
452/* MBIM and NCM devices should not need a ZLP after NTBs with
Bjørn Morkc1a2e9542013-10-31 15:56:11 +0100453 * dwNtbOutMaxSize length. Nevertheless, a number of devices from
454 * different vendor IDs will fail unless we send ZLPs, forcing us
455 * to make this the default.
456 *
457 * This default may cause a performance penalty for spec conforming
458 * devices wanting to take advantage of optimizations possible without
459 * ZLPs. A whitelist is added in an attempt to avoid this for devices
460 * known to conform to the MBIM specification.
461 *
462 * All known devices supporting NCM compatibility mode are also
463 * conforming to the NCM and MBIM specifications. For this reason, the
464 * NCM subclass entry is also in the ZLP whitelist.
Bjørn Mork844e88f2013-01-23 00:57:02 +0000465 */
466static const struct driver_info cdc_mbim_info_zlp = {
467 .description = "CDC MBIM",
Bjørn Mork328d7b82013-01-21 05:50:39 +0000468 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN | FLAG_SEND_ZLP,
Greg Suarez9bf211a32012-10-22 10:56:36 +0000469 .bind = cdc_mbim_bind,
470 .unbind = cdc_mbim_unbind,
471 .manage_power = cdc_mbim_manage_power,
472 .rx_fixup = cdc_mbim_rx_fixup,
473 .tx_fixup = cdc_mbim_tx_fixup,
474};
475
476static const struct usb_device_id mbim_devs[] = {
477 /* This duplicate NCM entry is intentional. MBIM devices can
478 * be disguised as NCM by default, and this is necessary to
479 * allow us to bind the correct driver_info to such devices.
480 *
481 * bind() will sort out this for us, selecting the correct
482 * entry and reject the other
483 */
484 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
485 .driver_info = (unsigned long)&cdc_mbim_info,
486 },
Bjørn Morkc1a2e9542013-10-31 15:56:11 +0100487 /* ZLP conformance whitelist: All Ericsson MBIM devices */
488 { USB_VENDOR_AND_INTERFACE_INFO(0x0bdb, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
Greg Suarez9bf211a32012-10-22 10:56:36 +0000489 .driver_info = (unsigned long)&cdc_mbim_info,
490 },
Bjørn Morkc1a2e9542013-10-31 15:56:11 +0100491 /* default entry */
492 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
493 .driver_info = (unsigned long)&cdc_mbim_info_zlp,
494 },
Greg Suarez9bf211a32012-10-22 10:56:36 +0000495 {
496 },
497};
498MODULE_DEVICE_TABLE(usb, mbim_devs);
499
500static struct usb_driver cdc_mbim_driver = {
501 .name = "cdc_mbim",
502 .id_table = mbim_devs,
503 .probe = usbnet_probe,
504 .disconnect = usbnet_disconnect,
505 .suspend = cdc_mbim_suspend,
506 .resume = cdc_mbim_resume,
507 .reset_resume = cdc_mbim_resume,
508 .supports_autosuspend = 1,
509 .disable_hub_initiated_lpm = 1,
510};
511module_usb_driver(cdc_mbim_driver);
512
513MODULE_AUTHOR("Greg Suarez <gsuarez@smithmicro.com>");
514MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
515MODULE_DESCRIPTION("USB CDC MBIM host driver");
516MODULE_LICENSE("GPL");