xref: /openbmc/linux/drivers/net/usb/lg-vl600.c (revision 762f99f4f3cb41a775b5157dd761217beba65873)
11ccea77eSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
27a635ea9SAndrzej Zaborowski /*
37a635ea9SAndrzej Zaborowski  * Ethernet interface part of the LG VL600 LTE modem (4G dongle)
47a635ea9SAndrzej Zaborowski  *
57a635ea9SAndrzej Zaborowski  * Copyright (C) 2011 Intel Corporation
67a635ea9SAndrzej Zaborowski  * Author: Andrzej Zaborowski <balrogg@gmail.com>
77a635ea9SAndrzej Zaborowski  */
87a635ea9SAndrzej Zaborowski #include <linux/etherdevice.h>
97a635ea9SAndrzej Zaborowski #include <linux/ethtool.h>
107a635ea9SAndrzej Zaborowski #include <linux/mii.h>
117a635ea9SAndrzej Zaborowski #include <linux/usb.h>
127a635ea9SAndrzej Zaborowski #include <linux/usb/cdc.h>
137a635ea9SAndrzej Zaborowski #include <linux/usb/usbnet.h>
147a635ea9SAndrzej Zaborowski #include <linux/if_ether.h>
157a635ea9SAndrzej Zaborowski #include <linux/if_arp.h>
167a635ea9SAndrzej Zaborowski #include <linux/inetdevice.h>
179d9779e7SPaul Gortmaker #include <linux/module.h>
187a635ea9SAndrzej Zaborowski 
197a635ea9SAndrzej Zaborowski /*
207a635ea9SAndrzej Zaborowski  * The device has a CDC ACM port for modem control (it claims to be
217a635ea9SAndrzej Zaborowski  * CDC ACM anyway) and a CDC Ethernet port for actual network data.
227a635ea9SAndrzej Zaborowski  * It will however ignore data on both ports that is not encapsulated
237a635ea9SAndrzej Zaborowski  * in a specific way, any data returned is also encapsulated the same
247a635ea9SAndrzej Zaborowski  * way.  The headers don't seem to follow any popular standard.
257a635ea9SAndrzej Zaborowski  *
267a635ea9SAndrzej Zaborowski  * This driver adds and strips these headers from the ethernet frames
277a635ea9SAndrzej Zaborowski  * sent/received from the CDC Ethernet port.  The proprietary header
287a635ea9SAndrzej Zaborowski  * replaces the standard ethernet header in a packet so only actual
297a635ea9SAndrzej Zaborowski  * ethernet frames are allowed.  The headers allow some form of
307a635ea9SAndrzej Zaborowski  * multiplexing by using non standard values of the .h_proto field.
317a635ea9SAndrzej Zaborowski  * Windows/Mac drivers do send a couple of such frames to the device
327a635ea9SAndrzej Zaborowski  * during initialisation, with protocol set to 0x0906 or 0x0b06 and (what
337a635ea9SAndrzej Zaborowski  * seems to be) a flag in the .dummy_flags.  This doesn't seem necessary
34*f62c4f38SZheng Yongjun  * for modem operation but can possibly be used for GPS or other functions.
357a635ea9SAndrzej Zaborowski  */
367a635ea9SAndrzej Zaborowski 
377a635ea9SAndrzej Zaborowski struct vl600_frame_hdr {
387a635ea9SAndrzej Zaborowski 	__le32 len;
397a635ea9SAndrzej Zaborowski 	__le32 serial;
407a635ea9SAndrzej Zaborowski 	__le32 pkt_cnt;
417a635ea9SAndrzej Zaborowski 	__le32 dummy_flags;
427a635ea9SAndrzej Zaborowski 	__le32 dummy;
437a635ea9SAndrzej Zaborowski 	__le32 magic;
447a635ea9SAndrzej Zaborowski } __attribute__((packed));
457a635ea9SAndrzej Zaborowski 
467a635ea9SAndrzej Zaborowski struct vl600_pkt_hdr {
477a635ea9SAndrzej Zaborowski 	__le32 dummy[2];
487a635ea9SAndrzej Zaborowski 	__le32 len;
497a635ea9SAndrzej Zaborowski 	__be16 h_proto;
507a635ea9SAndrzej Zaborowski } __attribute__((packed));
517a635ea9SAndrzej Zaborowski 
527a635ea9SAndrzej Zaborowski struct vl600_state {
537a635ea9SAndrzej Zaborowski 	struct sk_buff *current_rx_buf;
547a635ea9SAndrzej Zaborowski };
557a635ea9SAndrzej Zaborowski 
vl600_bind(struct usbnet * dev,struct usb_interface * intf)567a635ea9SAndrzej Zaborowski static int vl600_bind(struct usbnet *dev, struct usb_interface *intf)
577a635ea9SAndrzej Zaborowski {
587a635ea9SAndrzej Zaborowski 	int ret;
597a635ea9SAndrzej Zaborowski 	struct vl600_state *s = kzalloc(sizeof(struct vl600_state), GFP_KERNEL);
607a635ea9SAndrzej Zaborowski 
617a635ea9SAndrzej Zaborowski 	if (!s)
627a635ea9SAndrzej Zaborowski 		return -ENOMEM;
637a635ea9SAndrzej Zaborowski 
647a635ea9SAndrzej Zaborowski 	ret = usbnet_cdc_bind(dev, intf);
657a635ea9SAndrzej Zaborowski 	if (ret) {
667a635ea9SAndrzej Zaborowski 		kfree(s);
677a635ea9SAndrzej Zaborowski 		return ret;
687a635ea9SAndrzej Zaborowski 	}
697a635ea9SAndrzej Zaborowski 
707a635ea9SAndrzej Zaborowski 	dev->driver_priv = s;
717a635ea9SAndrzej Zaborowski 
727a635ea9SAndrzej Zaborowski 	/* ARP packets don't go through, but they're also of no use.  The
737a635ea9SAndrzej Zaborowski 	 * subnet has only two hosts anyway: us and the gateway / DHCP
747a635ea9SAndrzej Zaborowski 	 * server (probably simulated by modem firmware or network operator)
757a635ea9SAndrzej Zaborowski 	 * whose address changes every time we connect to the intarwebz and
767a635ea9SAndrzej Zaborowski 	 * who doesn't bother answering ARP requests either.  So hardware
777a635ea9SAndrzej Zaborowski 	 * addresses have no meaning, the destination and the source of every
787a635ea9SAndrzej Zaborowski 	 * packet depend only on whether it is on the IN or OUT endpoint.  */
797a635ea9SAndrzej Zaborowski 	dev->net->flags |= IFF_NOARP;
802ae40ee9SMark Kamichoff 	/* IPv6 NDP relies on multicast.  Enable it by default. */
812ae40ee9SMark Kamichoff 	dev->net->flags |= IFF_MULTICAST;
827a635ea9SAndrzej Zaborowski 
837a635ea9SAndrzej Zaborowski 	return ret;
847a635ea9SAndrzej Zaborowski }
857a635ea9SAndrzej Zaborowski 
vl600_unbind(struct usbnet * dev,struct usb_interface * intf)867a635ea9SAndrzej Zaborowski static void vl600_unbind(struct usbnet *dev, struct usb_interface *intf)
877a635ea9SAndrzej Zaborowski {
887a635ea9SAndrzej Zaborowski 	struct vl600_state *s = dev->driver_priv;
897a635ea9SAndrzej Zaborowski 
907a635ea9SAndrzej Zaborowski 	dev_kfree_skb(s->current_rx_buf);
917a635ea9SAndrzej Zaborowski 	kfree(s);
927a635ea9SAndrzej Zaborowski 
937a635ea9SAndrzej Zaborowski 	return usbnet_cdc_unbind(dev, intf);
947a635ea9SAndrzej Zaborowski }
957a635ea9SAndrzej Zaborowski 
vl600_rx_fixup(struct usbnet * dev,struct sk_buff * skb)967a635ea9SAndrzej Zaborowski static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
977a635ea9SAndrzej Zaborowski {
987a635ea9SAndrzej Zaborowski 	struct vl600_frame_hdr *frame;
997a635ea9SAndrzej Zaborowski 	struct vl600_pkt_hdr *packet;
1007a635ea9SAndrzej Zaborowski 	struct ethhdr *ethhdr;
1017a635ea9SAndrzej Zaborowski 	int packet_len, count;
1027a635ea9SAndrzej Zaborowski 	struct sk_buff *buf = skb;
1037a635ea9SAndrzej Zaborowski 	struct sk_buff *clone;
1047a635ea9SAndrzej Zaborowski 	struct vl600_state *s = dev->driver_priv;
1057a635ea9SAndrzej Zaborowski 
1067a635ea9SAndrzej Zaborowski 	/* Frame lengths are generally 4B multiplies but every couple of
1077a635ea9SAndrzej Zaborowski 	 * hours there's an odd number of bytes sized yet correct frame,
1087a635ea9SAndrzej Zaborowski 	 * so don't require this.  */
1097a635ea9SAndrzej Zaborowski 
1107a635ea9SAndrzej Zaborowski 	/* Allow a packet (or multiple packets batched together) to be
1117a635ea9SAndrzej Zaborowski 	 * split across many frames.  We don't allow a new batch to
1127a635ea9SAndrzej Zaborowski 	 * begin in the same frame another one is ending however, and no
1137a635ea9SAndrzej Zaborowski 	 * leading or trailing pad bytes.  */
1147a635ea9SAndrzej Zaborowski 	if (s->current_rx_buf) {
1157a635ea9SAndrzej Zaborowski 		frame = (struct vl600_frame_hdr *) s->current_rx_buf->data;
1167a635ea9SAndrzej Zaborowski 		if (skb->len + s->current_rx_buf->len >
1177a635ea9SAndrzej Zaborowski 				le32_to_cpup(&frame->len)) {
1187a635ea9SAndrzej Zaborowski 			netif_err(dev, ifup, dev->net, "Fragment too long\n");
1197a635ea9SAndrzej Zaborowski 			dev->net->stats.rx_length_errors++;
1207a635ea9SAndrzej Zaborowski 			goto error;
1217a635ea9SAndrzej Zaborowski 		}
1227a635ea9SAndrzej Zaborowski 
1237a635ea9SAndrzej Zaborowski 		buf = s->current_rx_buf;
12459ae1d12SJohannes Berg 		skb_put_data(buf, skb->data, skb->len);
1257a635ea9SAndrzej Zaborowski 	} else if (skb->len < 4) {
1267a635ea9SAndrzej Zaborowski 		netif_err(dev, ifup, dev->net, "Frame too short\n");
1277a635ea9SAndrzej Zaborowski 		dev->net->stats.rx_length_errors++;
1287a635ea9SAndrzej Zaborowski 		goto error;
1297a635ea9SAndrzej Zaborowski 	}
1307a635ea9SAndrzej Zaborowski 
1317a635ea9SAndrzej Zaborowski 	frame = (struct vl600_frame_hdr *) buf->data;
1326d74eb94SMark Kamichoff 	/* Yes, check that frame->magic == 0x53544448 (or 0x44544d48),
1336d74eb94SMark Kamichoff 	 * otherwise we may run out of memory w/a bad packet */
1346d74eb94SMark Kamichoff 	if (ntohl(frame->magic) != 0x53544448 &&
1356d74eb94SMark Kamichoff 			ntohl(frame->magic) != 0x44544d48)
1366d74eb94SMark Kamichoff 		goto error;
1377a635ea9SAndrzej Zaborowski 
1387a635ea9SAndrzej Zaborowski 	if (buf->len < sizeof(*frame) ||
1397a635ea9SAndrzej Zaborowski 			buf->len != le32_to_cpup(&frame->len)) {
1407a635ea9SAndrzej Zaborowski 		/* Save this fragment for later assembly */
1417a635ea9SAndrzej Zaborowski 		if (s->current_rx_buf)
1427a635ea9SAndrzej Zaborowski 			return 0;
1437a635ea9SAndrzej Zaborowski 
1447a635ea9SAndrzej Zaborowski 		s->current_rx_buf = skb_copy_expand(skb, 0,
1457a635ea9SAndrzej Zaborowski 				le32_to_cpup(&frame->len), GFP_ATOMIC);
1460c3d5a96SJoe Perches 		if (!s->current_rx_buf)
1477a635ea9SAndrzej Zaborowski 			dev->net->stats.rx_errors++;
1487a635ea9SAndrzej Zaborowski 
1497a635ea9SAndrzej Zaborowski 		return 0;
1507a635ea9SAndrzej Zaborowski 	}
1517a635ea9SAndrzej Zaborowski 
1527a635ea9SAndrzej Zaborowski 	count = le32_to_cpup(&frame->pkt_cnt);
1537a635ea9SAndrzej Zaborowski 
1547a635ea9SAndrzej Zaborowski 	skb_pull(buf, sizeof(*frame));
1557a635ea9SAndrzej Zaborowski 
1567a635ea9SAndrzej Zaborowski 	while (count--) {
1577a635ea9SAndrzej Zaborowski 		if (buf->len < sizeof(*packet)) {
1587a635ea9SAndrzej Zaborowski 			netif_err(dev, ifup, dev->net, "Packet too short\n");
1597a635ea9SAndrzej Zaborowski 			goto error;
1607a635ea9SAndrzej Zaborowski 		}
1617a635ea9SAndrzej Zaborowski 
1627a635ea9SAndrzej Zaborowski 		packet = (struct vl600_pkt_hdr *) buf->data;
1637a635ea9SAndrzej Zaborowski 		packet_len = sizeof(*packet) + le32_to_cpup(&packet->len);
1647a635ea9SAndrzej Zaborowski 		if (packet_len > buf->len) {
1657a635ea9SAndrzej Zaborowski 			netif_err(dev, ifup, dev->net,
1667a635ea9SAndrzej Zaborowski 					"Bad packet length stored in header\n");
1677a635ea9SAndrzej Zaborowski 			goto error;
1687a635ea9SAndrzej Zaborowski 		}
1697a635ea9SAndrzej Zaborowski 
1707a635ea9SAndrzej Zaborowski 		/* Packet header is same size as the ethernet header
1717a635ea9SAndrzej Zaborowski 		 * (sizeof(*packet) == sizeof(*ethhdr)), additionally
1727a635ea9SAndrzej Zaborowski 		 * the h_proto field is in the same place so we just leave it
1737a635ea9SAndrzej Zaborowski 		 * alone and fill in the remaining fields.
1747a635ea9SAndrzej Zaborowski 		 */
1757a635ea9SAndrzej Zaborowski 		ethhdr = (struct ethhdr *) skb->data;
1767a635ea9SAndrzej Zaborowski 		if (be16_to_cpup(&ethhdr->h_proto) == ETH_P_ARP &&
1777a635ea9SAndrzej Zaborowski 				buf->len > 0x26) {
1787a635ea9SAndrzej Zaborowski 			/* Copy the addresses from packet contents */
1797a635ea9SAndrzej Zaborowski 			memcpy(ethhdr->h_source,
1807a635ea9SAndrzej Zaborowski 					&buf->data[sizeof(*ethhdr) + 0x8],
1817a635ea9SAndrzej Zaborowski 					ETH_ALEN);
1827a635ea9SAndrzej Zaborowski 			memcpy(ethhdr->h_dest,
1837a635ea9SAndrzej Zaborowski 					&buf->data[sizeof(*ethhdr) + 0x12],
1847a635ea9SAndrzej Zaborowski 					ETH_ALEN);
1857a635ea9SAndrzej Zaborowski 		} else {
186519983b1SJoe Perches 			eth_zero_addr(ethhdr->h_source);
1877a635ea9SAndrzej Zaborowski 			memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN);
1882ae40ee9SMark Kamichoff 
1892ae40ee9SMark Kamichoff 			/* Inbound IPv6 packets have an IPv4 ethertype (0x800)
1902ae40ee9SMark Kamichoff 			 * for some reason.  Peek at the L3 header to check
1912ae40ee9SMark Kamichoff 			 * for IPv6 packets, and set the ethertype to IPv6
1922ae40ee9SMark Kamichoff 			 * (0x86dd) so Linux can understand it.
1932ae40ee9SMark Kamichoff 			 */
1942ae40ee9SMark Kamichoff 			if ((buf->data[sizeof(*ethhdr)] & 0xf0) == 0x60)
1951f36fc74SJoe Perches 				ethhdr->h_proto = htons(ETH_P_IPV6);
1967a635ea9SAndrzej Zaborowski 		}
1977a635ea9SAndrzej Zaborowski 
1987a635ea9SAndrzej Zaborowski 		if (count) {
1997a635ea9SAndrzej Zaborowski 			/* Not the last packet in this batch */
2007a635ea9SAndrzej Zaborowski 			clone = skb_clone(buf, GFP_ATOMIC);
2017a635ea9SAndrzej Zaborowski 			if (!clone)
2027a635ea9SAndrzej Zaborowski 				goto error;
2037a635ea9SAndrzej Zaborowski 
2047a635ea9SAndrzej Zaborowski 			skb_trim(clone, packet_len);
2057a635ea9SAndrzej Zaborowski 			usbnet_skb_return(dev, clone);
2067a635ea9SAndrzej Zaborowski 
2077a635ea9SAndrzej Zaborowski 			skb_pull(buf, (packet_len + 3) & ~3);
2087a635ea9SAndrzej Zaborowski 		} else {
2097a635ea9SAndrzej Zaborowski 			skb_trim(buf, packet_len);
2107a635ea9SAndrzej Zaborowski 
2117a635ea9SAndrzej Zaborowski 			if (s->current_rx_buf) {
2127a635ea9SAndrzej Zaborowski 				usbnet_skb_return(dev, buf);
2137a635ea9SAndrzej Zaborowski 				s->current_rx_buf = NULL;
2147a635ea9SAndrzej Zaborowski 				return 0;
2157a635ea9SAndrzej Zaborowski 			}
2167a635ea9SAndrzej Zaborowski 
2177a635ea9SAndrzej Zaborowski 			return 1;
2187a635ea9SAndrzej Zaborowski 		}
2197a635ea9SAndrzej Zaborowski 	}
2207a635ea9SAndrzej Zaborowski 
2217a635ea9SAndrzej Zaborowski error:
2227a635ea9SAndrzej Zaborowski 	if (s->current_rx_buf) {
2237a635ea9SAndrzej Zaborowski 		dev_kfree_skb_any(s->current_rx_buf);
2247a635ea9SAndrzej Zaborowski 		s->current_rx_buf = NULL;
2257a635ea9SAndrzej Zaborowski 	}
2267a635ea9SAndrzej Zaborowski 	dev->net->stats.rx_errors++;
2277a635ea9SAndrzej Zaborowski 	return 0;
2287a635ea9SAndrzej Zaborowski }
2297a635ea9SAndrzej Zaborowski 
vl600_tx_fixup(struct usbnet * dev,struct sk_buff * skb,gfp_t flags)2307a635ea9SAndrzej Zaborowski static struct sk_buff *vl600_tx_fixup(struct usbnet *dev,
2317a635ea9SAndrzej Zaborowski 		struct sk_buff *skb, gfp_t flags)
2327a635ea9SAndrzej Zaborowski {
2337a635ea9SAndrzej Zaborowski 	struct sk_buff *ret;
2347a635ea9SAndrzej Zaborowski 	struct vl600_frame_hdr *frame;
2357a635ea9SAndrzej Zaborowski 	struct vl600_pkt_hdr *packet;
2367a635ea9SAndrzej Zaborowski 	static uint32_t serial = 1;
2377a635ea9SAndrzej Zaborowski 	int orig_len = skb->len - sizeof(struct ethhdr);
2387a635ea9SAndrzej Zaborowski 	int full_len = (skb->len + sizeof(struct vl600_frame_hdr) + 3) & ~3;
2397a635ea9SAndrzej Zaborowski 
2407a635ea9SAndrzej Zaborowski 	frame = (struct vl600_frame_hdr *) skb->data;
2417a635ea9SAndrzej Zaborowski 	if (skb->len > sizeof(*frame) && skb->len == le32_to_cpup(&frame->len))
2427a635ea9SAndrzej Zaborowski 		return skb; /* Already encapsulated? */
2437a635ea9SAndrzej Zaborowski 
2447a635ea9SAndrzej Zaborowski 	if (skb->len < sizeof(struct ethhdr))
2457a635ea9SAndrzej Zaborowski 		/* Drop, device can only deal with ethernet packets */
2467a635ea9SAndrzej Zaborowski 		return NULL;
2477a635ea9SAndrzej Zaborowski 
2487a635ea9SAndrzej Zaborowski 	if (!skb_cloned(skb)) {
2497a635ea9SAndrzej Zaborowski 		int headroom = skb_headroom(skb);
2507a635ea9SAndrzej Zaborowski 		int tailroom = skb_tailroom(skb);
2517a635ea9SAndrzej Zaborowski 
2527a635ea9SAndrzej Zaborowski 		if (tailroom >= full_len - skb->len - sizeof(*frame) &&
2537a635ea9SAndrzej Zaborowski 				headroom >= sizeof(*frame))
2547a635ea9SAndrzej Zaborowski 			/* There's enough head and tail room */
2557a635ea9SAndrzej Zaborowski 			goto encapsulate;
2567a635ea9SAndrzej Zaborowski 
2577a635ea9SAndrzej Zaborowski 		if (headroom + tailroom + skb->len >= full_len) {
2587a635ea9SAndrzej Zaborowski 			/* There's enough total room, just readjust */
2597a635ea9SAndrzej Zaborowski 			skb->data = memmove(skb->head + sizeof(*frame),
2607a635ea9SAndrzej Zaborowski 					skb->data, skb->len);
2617a635ea9SAndrzej Zaborowski 			skb_set_tail_pointer(skb, skb->len);
2627a635ea9SAndrzej Zaborowski 			goto encapsulate;
2637a635ea9SAndrzej Zaborowski 		}
2647a635ea9SAndrzej Zaborowski 	}
2657a635ea9SAndrzej Zaborowski 
2667a635ea9SAndrzej Zaborowski 	/* Alloc a new skb with the required size */
2677a635ea9SAndrzej Zaborowski 	ret = skb_copy_expand(skb, sizeof(struct vl600_frame_hdr), full_len -
2687a635ea9SAndrzej Zaborowski 			skb->len - sizeof(struct vl600_frame_hdr), flags);
2697a635ea9SAndrzej Zaborowski 	dev_kfree_skb_any(skb);
2707a635ea9SAndrzej Zaborowski 	if (!ret)
2717a635ea9SAndrzej Zaborowski 		return ret;
2727a635ea9SAndrzej Zaborowski 	skb = ret;
2737a635ea9SAndrzej Zaborowski 
2747a635ea9SAndrzej Zaborowski encapsulate:
2757a635ea9SAndrzej Zaborowski 	/* Packet header is same size as ethernet packet header
2767a635ea9SAndrzej Zaborowski 	 * (sizeof(*packet) == sizeof(struct ethhdr)), additionally the
2777a635ea9SAndrzej Zaborowski 	 * h_proto field is in the same place so we just leave it alone and
2787a635ea9SAndrzej Zaborowski 	 * overwrite the remaining fields.
2797a635ea9SAndrzej Zaborowski 	 */
2807a635ea9SAndrzej Zaborowski 	packet = (struct vl600_pkt_hdr *) skb->data;
2816d74eb94SMark Kamichoff 	/* The VL600 wants IPv6 packets to have an IPv4 ethertype
2826d74eb94SMark Kamichoff 	 * Since this modem only supports IPv4 and IPv6, just set all
2836d74eb94SMark Kamichoff 	 * frames to 0x0800 (ETH_P_IP)
2846d74eb94SMark Kamichoff 	 */
2856d74eb94SMark Kamichoff 	packet->h_proto = htons(ETH_P_IP);
2867a635ea9SAndrzej Zaborowski 	memset(&packet->dummy, 0, sizeof(packet->dummy));
2877a635ea9SAndrzej Zaborowski 	packet->len = cpu_to_le32(orig_len);
2887a635ea9SAndrzej Zaborowski 
289d58ff351SJohannes Berg 	frame = skb_push(skb, sizeof(*frame));
2907a635ea9SAndrzej Zaborowski 	memset(frame, 0, sizeof(*frame));
2917a635ea9SAndrzej Zaborowski 	frame->len = cpu_to_le32(full_len);
2927a635ea9SAndrzej Zaborowski 	frame->serial = cpu_to_le32(serial++);
2937a635ea9SAndrzej Zaborowski 	frame->pkt_cnt = cpu_to_le32(1);
2947a635ea9SAndrzej Zaborowski 
2957a635ea9SAndrzej Zaborowski 	if (skb->len < full_len) /* Pad */
2967a635ea9SAndrzej Zaborowski 		skb_put(skb, full_len - skb->len);
2977a635ea9SAndrzej Zaborowski 
2987a635ea9SAndrzej Zaborowski 	return skb;
2997a635ea9SAndrzej Zaborowski }
3007a635ea9SAndrzej Zaborowski 
3017a635ea9SAndrzej Zaborowski static const struct driver_info	vl600_info = {
3027a635ea9SAndrzej Zaborowski 	.description	= "LG VL600 modem",
3036d74eb94SMark Kamichoff 	.flags		= FLAG_RX_ASSEMBLE | FLAG_WWAN,
3047a635ea9SAndrzej Zaborowski 	.bind		= vl600_bind,
3057a635ea9SAndrzej Zaborowski 	.unbind		= vl600_unbind,
3067a635ea9SAndrzej Zaborowski 	.status		= usbnet_cdc_status,
3077a635ea9SAndrzej Zaborowski 	.rx_fixup	= vl600_rx_fixup,
3087a635ea9SAndrzej Zaborowski 	.tx_fixup	= vl600_tx_fixup,
3097a635ea9SAndrzej Zaborowski };
3107a635ea9SAndrzej Zaborowski 
3117a635ea9SAndrzej Zaborowski static const struct usb_device_id products[] = {
3127a635ea9SAndrzej Zaborowski 	{
3137a635ea9SAndrzej Zaborowski 		USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
3147a635ea9SAndrzej Zaborowski 				USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
3157a635ea9SAndrzej Zaborowski 		.driver_info	= (unsigned long) &vl600_info,
3167a635ea9SAndrzej Zaborowski 	},
3177a635ea9SAndrzej Zaborowski 	{},	/* End */
3187a635ea9SAndrzej Zaborowski };
3197a635ea9SAndrzej Zaborowski MODULE_DEVICE_TABLE(usb, products);
3207a635ea9SAndrzej Zaborowski 
3217a635ea9SAndrzej Zaborowski static struct usb_driver lg_vl600_driver = {
3227a635ea9SAndrzej Zaborowski 	.name		= "lg-vl600",
3237a635ea9SAndrzej Zaborowski 	.id_table	= products,
3247a635ea9SAndrzej Zaborowski 	.probe		= usbnet_probe,
3257a635ea9SAndrzej Zaborowski 	.disconnect	= usbnet_disconnect,
3267a635ea9SAndrzej Zaborowski 	.suspend	= usbnet_suspend,
3277a635ea9SAndrzej Zaborowski 	.resume		= usbnet_resume,
328e1f12eb6SSarah Sharp 	.disable_hub_initiated_lpm = 1,
3297a635ea9SAndrzej Zaborowski };
3307a635ea9SAndrzej Zaborowski 
331d632eb1bSGreg Kroah-Hartman module_usb_driver(lg_vl600_driver);
3327a635ea9SAndrzej Zaborowski 
3337a635ea9SAndrzej Zaborowski MODULE_AUTHOR("Anrzej Zaborowski");
3347a635ea9SAndrzej Zaborowski MODULE_DESCRIPTION("LG-VL600 modem's ethernet link");
3357a635ea9SAndrzej Zaborowski MODULE_LICENSE("GPL");
336