17a635ea9SAndrzej Zaborowski /* 27a635ea9SAndrzej Zaborowski * Ethernet interface part of the LG VL600 LTE modem (4G dongle) 37a635ea9SAndrzej Zaborowski * 47a635ea9SAndrzej Zaborowski * Copyright (C) 2011 Intel Corporation 57a635ea9SAndrzej Zaborowski * Author: Andrzej Zaborowski <balrogg@gmail.com> 67a635ea9SAndrzej Zaborowski * 77a635ea9SAndrzej Zaborowski * This program is free software; you can redistribute it and/or modify 87a635ea9SAndrzej Zaborowski * it under the terms of the GNU General Public License as published by 97a635ea9SAndrzej Zaborowski * the Free Software Foundation; either version 2 of the License, or 107a635ea9SAndrzej Zaborowski * (at your option) any later version. 117a635ea9SAndrzej Zaborowski * 127a635ea9SAndrzej Zaborowski * This program is distributed in the hope that it will be useful, 137a635ea9SAndrzej Zaborowski * but WITHOUT ANY WARRANTY; without even the implied warranty of 147a635ea9SAndrzej Zaborowski * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 157a635ea9SAndrzej Zaborowski * GNU General Public License for more details. 167a635ea9SAndrzej Zaborowski * 177a635ea9SAndrzej Zaborowski * You should have received a copy of the GNU General Public License 187a635ea9SAndrzej Zaborowski * along with this program; if not, write to the Free Software 197a635ea9SAndrzej Zaborowski * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 207a635ea9SAndrzej Zaborowski */ 217a635ea9SAndrzej Zaborowski #include <linux/etherdevice.h> 227a635ea9SAndrzej Zaborowski #include <linux/ethtool.h> 237a635ea9SAndrzej Zaborowski #include <linux/mii.h> 247a635ea9SAndrzej Zaborowski #include <linux/usb.h> 257a635ea9SAndrzej Zaborowski #include <linux/usb/cdc.h> 267a635ea9SAndrzej Zaborowski #include <linux/usb/usbnet.h> 277a635ea9SAndrzej Zaborowski #include <linux/if_ether.h> 287a635ea9SAndrzej Zaborowski #include <linux/if_arp.h> 297a635ea9SAndrzej Zaborowski #include <linux/inetdevice.h> 309d9779e7SPaul Gortmaker #include <linux/module.h> 317a635ea9SAndrzej Zaborowski 327a635ea9SAndrzej Zaborowski /* 337a635ea9SAndrzej Zaborowski * The device has a CDC ACM port for modem control (it claims to be 347a635ea9SAndrzej Zaborowski * CDC ACM anyway) and a CDC Ethernet port for actual network data. 357a635ea9SAndrzej Zaborowski * It will however ignore data on both ports that is not encapsulated 367a635ea9SAndrzej Zaborowski * in a specific way, any data returned is also encapsulated the same 377a635ea9SAndrzej Zaborowski * way. The headers don't seem to follow any popular standard. 387a635ea9SAndrzej Zaborowski * 397a635ea9SAndrzej Zaborowski * This driver adds and strips these headers from the ethernet frames 407a635ea9SAndrzej Zaborowski * sent/received from the CDC Ethernet port. The proprietary header 417a635ea9SAndrzej Zaborowski * replaces the standard ethernet header in a packet so only actual 427a635ea9SAndrzej Zaborowski * ethernet frames are allowed. The headers allow some form of 437a635ea9SAndrzej Zaborowski * multiplexing by using non standard values of the .h_proto field. 447a635ea9SAndrzej Zaborowski * Windows/Mac drivers do send a couple of such frames to the device 457a635ea9SAndrzej Zaborowski * during initialisation, with protocol set to 0x0906 or 0x0b06 and (what 467a635ea9SAndrzej Zaborowski * seems to be) a flag in the .dummy_flags. This doesn't seem necessary 477a635ea9SAndrzej Zaborowski * for modem operation but can possibly be used for GPS or other funcitons. 487a635ea9SAndrzej Zaborowski */ 497a635ea9SAndrzej Zaborowski 507a635ea9SAndrzej Zaborowski struct vl600_frame_hdr { 517a635ea9SAndrzej Zaborowski __le32 len; 527a635ea9SAndrzej Zaborowski __le32 serial; 537a635ea9SAndrzej Zaborowski __le32 pkt_cnt; 547a635ea9SAndrzej Zaborowski __le32 dummy_flags; 557a635ea9SAndrzej Zaborowski __le32 dummy; 567a635ea9SAndrzej Zaborowski __le32 magic; 577a635ea9SAndrzej Zaborowski } __attribute__((packed)); 587a635ea9SAndrzej Zaborowski 597a635ea9SAndrzej Zaborowski struct vl600_pkt_hdr { 607a635ea9SAndrzej Zaborowski __le32 dummy[2]; 617a635ea9SAndrzej Zaborowski __le32 len; 627a635ea9SAndrzej Zaborowski __be16 h_proto; 637a635ea9SAndrzej Zaborowski } __attribute__((packed)); 647a635ea9SAndrzej Zaborowski 657a635ea9SAndrzej Zaborowski struct vl600_state { 667a635ea9SAndrzej Zaborowski struct sk_buff *current_rx_buf; 677a635ea9SAndrzej Zaborowski }; 687a635ea9SAndrzej Zaborowski 697a635ea9SAndrzej Zaborowski static int vl600_bind(struct usbnet *dev, struct usb_interface *intf) 707a635ea9SAndrzej Zaborowski { 717a635ea9SAndrzej Zaborowski int ret; 727a635ea9SAndrzej Zaborowski struct vl600_state *s = kzalloc(sizeof(struct vl600_state), GFP_KERNEL); 737a635ea9SAndrzej Zaborowski 747a635ea9SAndrzej Zaborowski if (!s) 757a635ea9SAndrzej Zaborowski return -ENOMEM; 767a635ea9SAndrzej Zaborowski 777a635ea9SAndrzej Zaborowski ret = usbnet_cdc_bind(dev, intf); 787a635ea9SAndrzej Zaborowski if (ret) { 797a635ea9SAndrzej Zaborowski kfree(s); 807a635ea9SAndrzej Zaborowski return ret; 817a635ea9SAndrzej Zaborowski } 827a635ea9SAndrzej Zaborowski 837a635ea9SAndrzej Zaborowski dev->driver_priv = s; 847a635ea9SAndrzej Zaborowski 857a635ea9SAndrzej Zaborowski /* ARP packets don't go through, but they're also of no use. The 867a635ea9SAndrzej Zaborowski * subnet has only two hosts anyway: us and the gateway / DHCP 877a635ea9SAndrzej Zaborowski * server (probably simulated by modem firmware or network operator) 887a635ea9SAndrzej Zaborowski * whose address changes everytime we connect to the intarwebz and 897a635ea9SAndrzej Zaborowski * who doesn't bother answering ARP requests either. So hardware 907a635ea9SAndrzej Zaborowski * addresses have no meaning, the destination and the source of every 917a635ea9SAndrzej Zaborowski * packet depend only on whether it is on the IN or OUT endpoint. */ 927a635ea9SAndrzej Zaborowski dev->net->flags |= IFF_NOARP; 932ae40ee9SMark Kamichoff /* IPv6 NDP relies on multicast. Enable it by default. */ 942ae40ee9SMark Kamichoff dev->net->flags |= IFF_MULTICAST; 957a635ea9SAndrzej Zaborowski 967a635ea9SAndrzej Zaborowski return ret; 977a635ea9SAndrzej Zaborowski } 987a635ea9SAndrzej Zaborowski 997a635ea9SAndrzej Zaborowski static void vl600_unbind(struct usbnet *dev, struct usb_interface *intf) 1007a635ea9SAndrzej Zaborowski { 1017a635ea9SAndrzej Zaborowski struct vl600_state *s = dev->driver_priv; 1027a635ea9SAndrzej Zaborowski 1037a635ea9SAndrzej Zaborowski if (s->current_rx_buf) 1047a635ea9SAndrzej Zaborowski dev_kfree_skb(s->current_rx_buf); 1057a635ea9SAndrzej Zaborowski 1067a635ea9SAndrzej Zaborowski kfree(s); 1077a635ea9SAndrzej Zaborowski 1087a635ea9SAndrzej Zaborowski return usbnet_cdc_unbind(dev, intf); 1097a635ea9SAndrzej Zaborowski } 1107a635ea9SAndrzej Zaborowski 1117a635ea9SAndrzej Zaborowski static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb) 1127a635ea9SAndrzej Zaborowski { 1137a635ea9SAndrzej Zaborowski struct vl600_frame_hdr *frame; 1147a635ea9SAndrzej Zaborowski struct vl600_pkt_hdr *packet; 1157a635ea9SAndrzej Zaborowski struct ethhdr *ethhdr; 1167a635ea9SAndrzej Zaborowski int packet_len, count; 1177a635ea9SAndrzej Zaborowski struct sk_buff *buf = skb; 1187a635ea9SAndrzej Zaborowski struct sk_buff *clone; 1197a635ea9SAndrzej Zaborowski struct vl600_state *s = dev->driver_priv; 1207a635ea9SAndrzej Zaborowski 1217a635ea9SAndrzej Zaborowski /* Frame lengths are generally 4B multiplies but every couple of 1227a635ea9SAndrzej Zaborowski * hours there's an odd number of bytes sized yet correct frame, 1237a635ea9SAndrzej Zaborowski * so don't require this. */ 1247a635ea9SAndrzej Zaborowski 1257a635ea9SAndrzej Zaborowski /* Allow a packet (or multiple packets batched together) to be 1267a635ea9SAndrzej Zaborowski * split across many frames. We don't allow a new batch to 1277a635ea9SAndrzej Zaborowski * begin in the same frame another one is ending however, and no 1287a635ea9SAndrzej Zaborowski * leading or trailing pad bytes. */ 1297a635ea9SAndrzej Zaborowski if (s->current_rx_buf) { 1307a635ea9SAndrzej Zaborowski frame = (struct vl600_frame_hdr *) s->current_rx_buf->data; 1317a635ea9SAndrzej Zaborowski if (skb->len + s->current_rx_buf->len > 1327a635ea9SAndrzej Zaborowski le32_to_cpup(&frame->len)) { 1337a635ea9SAndrzej Zaborowski netif_err(dev, ifup, dev->net, "Fragment too long\n"); 1347a635ea9SAndrzej Zaborowski dev->net->stats.rx_length_errors++; 1357a635ea9SAndrzej Zaborowski goto error; 1367a635ea9SAndrzej Zaborowski } 1377a635ea9SAndrzej Zaborowski 1387a635ea9SAndrzej Zaborowski buf = s->current_rx_buf; 1397a635ea9SAndrzej Zaborowski memcpy(skb_put(buf, skb->len), skb->data, skb->len); 1407a635ea9SAndrzej Zaborowski } else if (skb->len < 4) { 1417a635ea9SAndrzej Zaborowski netif_err(dev, ifup, dev->net, "Frame too short\n"); 1427a635ea9SAndrzej Zaborowski dev->net->stats.rx_length_errors++; 1437a635ea9SAndrzej Zaborowski goto error; 1447a635ea9SAndrzej Zaborowski } 1457a635ea9SAndrzej Zaborowski 1467a635ea9SAndrzej Zaborowski frame = (struct vl600_frame_hdr *) buf->data; 1477a635ea9SAndrzej Zaborowski /* NOTE: Should check that frame->magic == 0x53544448? 1487a635ea9SAndrzej Zaborowski * Otherwise if we receive garbage at the beginning of the frame 1497a635ea9SAndrzej Zaborowski * we may end up allocating a huge buffer and saving all the 1507a635ea9SAndrzej Zaborowski * future incoming data into it. */ 1517a635ea9SAndrzej Zaborowski 1527a635ea9SAndrzej Zaborowski if (buf->len < sizeof(*frame) || 1537a635ea9SAndrzej Zaborowski buf->len != le32_to_cpup(&frame->len)) { 1547a635ea9SAndrzej Zaborowski /* Save this fragment for later assembly */ 1557a635ea9SAndrzej Zaborowski if (s->current_rx_buf) 1567a635ea9SAndrzej Zaborowski return 0; 1577a635ea9SAndrzej Zaborowski 1587a635ea9SAndrzej Zaborowski s->current_rx_buf = skb_copy_expand(skb, 0, 1597a635ea9SAndrzej Zaborowski le32_to_cpup(&frame->len), GFP_ATOMIC); 1607a635ea9SAndrzej Zaborowski if (!s->current_rx_buf) { 1617a635ea9SAndrzej Zaborowski netif_err(dev, ifup, dev->net, "Reserving %i bytes " 1627a635ea9SAndrzej Zaborowski "for packet assembly failed.\n", 1637a635ea9SAndrzej Zaborowski le32_to_cpup(&frame->len)); 1647a635ea9SAndrzej Zaborowski dev->net->stats.rx_errors++; 1657a635ea9SAndrzej Zaborowski } 1667a635ea9SAndrzej Zaborowski 1677a635ea9SAndrzej Zaborowski return 0; 1687a635ea9SAndrzej Zaborowski } 1697a635ea9SAndrzej Zaborowski 1707a635ea9SAndrzej Zaborowski count = le32_to_cpup(&frame->pkt_cnt); 1717a635ea9SAndrzej Zaborowski 1727a635ea9SAndrzej Zaborowski skb_pull(buf, sizeof(*frame)); 1737a635ea9SAndrzej Zaborowski 1747a635ea9SAndrzej Zaborowski while (count--) { 1757a635ea9SAndrzej Zaborowski if (buf->len < sizeof(*packet)) { 1767a635ea9SAndrzej Zaborowski netif_err(dev, ifup, dev->net, "Packet too short\n"); 1777a635ea9SAndrzej Zaborowski goto error; 1787a635ea9SAndrzej Zaborowski } 1797a635ea9SAndrzej Zaborowski 1807a635ea9SAndrzej Zaborowski packet = (struct vl600_pkt_hdr *) buf->data; 1817a635ea9SAndrzej Zaborowski packet_len = sizeof(*packet) + le32_to_cpup(&packet->len); 1827a635ea9SAndrzej Zaborowski if (packet_len > buf->len) { 1837a635ea9SAndrzej Zaborowski netif_err(dev, ifup, dev->net, 1847a635ea9SAndrzej Zaborowski "Bad packet length stored in header\n"); 1857a635ea9SAndrzej Zaborowski goto error; 1867a635ea9SAndrzej Zaborowski } 1877a635ea9SAndrzej Zaborowski 1887a635ea9SAndrzej Zaborowski /* Packet header is same size as the ethernet header 1897a635ea9SAndrzej Zaborowski * (sizeof(*packet) == sizeof(*ethhdr)), additionally 1907a635ea9SAndrzej Zaborowski * the h_proto field is in the same place so we just leave it 1917a635ea9SAndrzej Zaborowski * alone and fill in the remaining fields. 1927a635ea9SAndrzej Zaborowski */ 1937a635ea9SAndrzej Zaborowski ethhdr = (struct ethhdr *) skb->data; 1947a635ea9SAndrzej Zaborowski if (be16_to_cpup(ðhdr->h_proto) == ETH_P_ARP && 1957a635ea9SAndrzej Zaborowski buf->len > 0x26) { 1967a635ea9SAndrzej Zaborowski /* Copy the addresses from packet contents */ 1977a635ea9SAndrzej Zaborowski memcpy(ethhdr->h_source, 1987a635ea9SAndrzej Zaborowski &buf->data[sizeof(*ethhdr) + 0x8], 1997a635ea9SAndrzej Zaborowski ETH_ALEN); 2007a635ea9SAndrzej Zaborowski memcpy(ethhdr->h_dest, 2017a635ea9SAndrzej Zaborowski &buf->data[sizeof(*ethhdr) + 0x12], 2027a635ea9SAndrzej Zaborowski ETH_ALEN); 2037a635ea9SAndrzej Zaborowski } else { 2047a635ea9SAndrzej Zaborowski memset(ethhdr->h_source, 0, ETH_ALEN); 2057a635ea9SAndrzej Zaborowski memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN); 2062ae40ee9SMark Kamichoff 2072ae40ee9SMark Kamichoff /* Inbound IPv6 packets have an IPv4 ethertype (0x800) 2082ae40ee9SMark Kamichoff * for some reason. Peek at the L3 header to check 2092ae40ee9SMark Kamichoff * for IPv6 packets, and set the ethertype to IPv6 2102ae40ee9SMark Kamichoff * (0x86dd) so Linux can understand it. 2112ae40ee9SMark Kamichoff */ 2122ae40ee9SMark Kamichoff if ((buf->data[sizeof(*ethhdr)] & 0xf0) == 0x60) 2132ae40ee9SMark Kamichoff ethhdr->h_proto = __constant_htons(ETH_P_IPV6); 2147a635ea9SAndrzej Zaborowski } 2157a635ea9SAndrzej Zaborowski 2167a635ea9SAndrzej Zaborowski if (count) { 2177a635ea9SAndrzej Zaborowski /* Not the last packet in this batch */ 2187a635ea9SAndrzej Zaborowski clone = skb_clone(buf, GFP_ATOMIC); 2197a635ea9SAndrzej Zaborowski if (!clone) 2207a635ea9SAndrzej Zaborowski goto error; 2217a635ea9SAndrzej Zaborowski 2227a635ea9SAndrzej Zaborowski skb_trim(clone, packet_len); 2237a635ea9SAndrzej Zaborowski usbnet_skb_return(dev, clone); 2247a635ea9SAndrzej Zaborowski 2257a635ea9SAndrzej Zaborowski skb_pull(buf, (packet_len + 3) & ~3); 2267a635ea9SAndrzej Zaborowski } else { 2277a635ea9SAndrzej Zaborowski skb_trim(buf, packet_len); 2287a635ea9SAndrzej Zaborowski 2297a635ea9SAndrzej Zaborowski if (s->current_rx_buf) { 2307a635ea9SAndrzej Zaborowski usbnet_skb_return(dev, buf); 2317a635ea9SAndrzej Zaborowski s->current_rx_buf = NULL; 2327a635ea9SAndrzej Zaborowski return 0; 2337a635ea9SAndrzej Zaborowski } 2347a635ea9SAndrzej Zaborowski 2357a635ea9SAndrzej Zaborowski return 1; 2367a635ea9SAndrzej Zaborowski } 2377a635ea9SAndrzej Zaborowski } 2387a635ea9SAndrzej Zaborowski 2397a635ea9SAndrzej Zaborowski error: 2407a635ea9SAndrzej Zaborowski if (s->current_rx_buf) { 2417a635ea9SAndrzej Zaborowski dev_kfree_skb_any(s->current_rx_buf); 2427a635ea9SAndrzej Zaborowski s->current_rx_buf = NULL; 2437a635ea9SAndrzej Zaborowski } 2447a635ea9SAndrzej Zaborowski dev->net->stats.rx_errors++; 2457a635ea9SAndrzej Zaborowski return 0; 2467a635ea9SAndrzej Zaborowski } 2477a635ea9SAndrzej Zaborowski 2487a635ea9SAndrzej Zaborowski static struct sk_buff *vl600_tx_fixup(struct usbnet *dev, 2497a635ea9SAndrzej Zaborowski struct sk_buff *skb, gfp_t flags) 2507a635ea9SAndrzej Zaborowski { 2517a635ea9SAndrzej Zaborowski struct sk_buff *ret; 2527a635ea9SAndrzej Zaborowski struct vl600_frame_hdr *frame; 2537a635ea9SAndrzej Zaborowski struct vl600_pkt_hdr *packet; 2547a635ea9SAndrzej Zaborowski static uint32_t serial = 1; 2557a635ea9SAndrzej Zaborowski int orig_len = skb->len - sizeof(struct ethhdr); 2567a635ea9SAndrzej Zaborowski int full_len = (skb->len + sizeof(struct vl600_frame_hdr) + 3) & ~3; 2577a635ea9SAndrzej Zaborowski 2587a635ea9SAndrzej Zaborowski frame = (struct vl600_frame_hdr *) skb->data; 2597a635ea9SAndrzej Zaborowski if (skb->len > sizeof(*frame) && skb->len == le32_to_cpup(&frame->len)) 2607a635ea9SAndrzej Zaborowski return skb; /* Already encapsulated? */ 2617a635ea9SAndrzej Zaborowski 2627a635ea9SAndrzej Zaborowski if (skb->len < sizeof(struct ethhdr)) 2637a635ea9SAndrzej Zaborowski /* Drop, device can only deal with ethernet packets */ 2647a635ea9SAndrzej Zaborowski return NULL; 2657a635ea9SAndrzej Zaborowski 2667a635ea9SAndrzej Zaborowski if (!skb_cloned(skb)) { 2677a635ea9SAndrzej Zaborowski int headroom = skb_headroom(skb); 2687a635ea9SAndrzej Zaborowski int tailroom = skb_tailroom(skb); 2697a635ea9SAndrzej Zaborowski 2707a635ea9SAndrzej Zaborowski if (tailroom >= full_len - skb->len - sizeof(*frame) && 2717a635ea9SAndrzej Zaborowski headroom >= sizeof(*frame)) 2727a635ea9SAndrzej Zaborowski /* There's enough head and tail room */ 2737a635ea9SAndrzej Zaborowski goto encapsulate; 2747a635ea9SAndrzej Zaborowski 2757a635ea9SAndrzej Zaborowski if (headroom + tailroom + skb->len >= full_len) { 2767a635ea9SAndrzej Zaborowski /* There's enough total room, just readjust */ 2777a635ea9SAndrzej Zaborowski skb->data = memmove(skb->head + sizeof(*frame), 2787a635ea9SAndrzej Zaborowski skb->data, skb->len); 2797a635ea9SAndrzej Zaborowski skb_set_tail_pointer(skb, skb->len); 2807a635ea9SAndrzej Zaborowski goto encapsulate; 2817a635ea9SAndrzej Zaborowski } 2827a635ea9SAndrzej Zaborowski } 2837a635ea9SAndrzej Zaborowski 2847a635ea9SAndrzej Zaborowski /* Alloc a new skb with the required size */ 2857a635ea9SAndrzej Zaborowski ret = skb_copy_expand(skb, sizeof(struct vl600_frame_hdr), full_len - 2867a635ea9SAndrzej Zaborowski skb->len - sizeof(struct vl600_frame_hdr), flags); 2877a635ea9SAndrzej Zaborowski dev_kfree_skb_any(skb); 2887a635ea9SAndrzej Zaborowski if (!ret) 2897a635ea9SAndrzej Zaborowski return ret; 2907a635ea9SAndrzej Zaborowski skb = ret; 2917a635ea9SAndrzej Zaborowski 2927a635ea9SAndrzej Zaborowski encapsulate: 2937a635ea9SAndrzej Zaborowski /* Packet header is same size as ethernet packet header 2947a635ea9SAndrzej Zaborowski * (sizeof(*packet) == sizeof(struct ethhdr)), additionally the 2957a635ea9SAndrzej Zaborowski * h_proto field is in the same place so we just leave it alone and 2967a635ea9SAndrzej Zaborowski * overwrite the remaining fields. 2977a635ea9SAndrzej Zaborowski */ 2987a635ea9SAndrzej Zaborowski packet = (struct vl600_pkt_hdr *) skb->data; 2997a635ea9SAndrzej Zaborowski memset(&packet->dummy, 0, sizeof(packet->dummy)); 3007a635ea9SAndrzej Zaborowski packet->len = cpu_to_le32(orig_len); 3017a635ea9SAndrzej Zaborowski 3027a635ea9SAndrzej Zaborowski frame = (struct vl600_frame_hdr *) skb_push(skb, sizeof(*frame)); 3037a635ea9SAndrzej Zaborowski memset(frame, 0, sizeof(*frame)); 3047a635ea9SAndrzej Zaborowski frame->len = cpu_to_le32(full_len); 3057a635ea9SAndrzej Zaborowski frame->serial = cpu_to_le32(serial++); 3067a635ea9SAndrzej Zaborowski frame->pkt_cnt = cpu_to_le32(1); 3077a635ea9SAndrzej Zaborowski 3087a635ea9SAndrzej Zaborowski if (skb->len < full_len) /* Pad */ 3097a635ea9SAndrzej Zaborowski skb_put(skb, full_len - skb->len); 3107a635ea9SAndrzej Zaborowski 3112ae40ee9SMark Kamichoff /* The VL600 wants IPv6 packets to have an IPv4 ethertype 3122ae40ee9SMark Kamichoff * Check if this is an IPv6 packet, and set the ethertype 3132ae40ee9SMark Kamichoff * to 0x800 3142ae40ee9SMark Kamichoff */ 3152ae40ee9SMark Kamichoff if ((skb->data[sizeof(struct vl600_pkt_hdr *) + 0x22] & 0xf0) == 0x60) { 3162ae40ee9SMark Kamichoff skb->data[sizeof(struct vl600_pkt_hdr *) + 0x20] = 0x08; 3172ae40ee9SMark Kamichoff skb->data[sizeof(struct vl600_pkt_hdr *) + 0x21] = 0; 3182ae40ee9SMark Kamichoff } 3192ae40ee9SMark Kamichoff 3207a635ea9SAndrzej Zaborowski return skb; 3217a635ea9SAndrzej Zaborowski } 3227a635ea9SAndrzej Zaborowski 3237a635ea9SAndrzej Zaborowski static const struct driver_info vl600_info = { 3247a635ea9SAndrzej Zaborowski .description = "LG VL600 modem", 3257a635ea9SAndrzej Zaborowski .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE, 3267a635ea9SAndrzej Zaborowski .bind = vl600_bind, 3277a635ea9SAndrzej Zaborowski .unbind = vl600_unbind, 3287a635ea9SAndrzej Zaborowski .status = usbnet_cdc_status, 3297a635ea9SAndrzej Zaborowski .rx_fixup = vl600_rx_fixup, 3307a635ea9SAndrzej Zaborowski .tx_fixup = vl600_tx_fixup, 3317a635ea9SAndrzej Zaborowski }; 3327a635ea9SAndrzej Zaborowski 3337a635ea9SAndrzej Zaborowski static const struct usb_device_id products[] = { 3347a635ea9SAndrzej Zaborowski { 3357a635ea9SAndrzej Zaborowski USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, 3367a635ea9SAndrzej Zaborowski USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), 3377a635ea9SAndrzej Zaborowski .driver_info = (unsigned long) &vl600_info, 3387a635ea9SAndrzej Zaborowski }, 3397a635ea9SAndrzej Zaborowski {}, /* End */ 3407a635ea9SAndrzej Zaborowski }; 3417a635ea9SAndrzej Zaborowski MODULE_DEVICE_TABLE(usb, products); 3427a635ea9SAndrzej Zaborowski 3437a635ea9SAndrzej Zaborowski static struct usb_driver lg_vl600_driver = { 3447a635ea9SAndrzej Zaborowski .name = "lg-vl600", 3457a635ea9SAndrzej Zaborowski .id_table = products, 3467a635ea9SAndrzej Zaborowski .probe = usbnet_probe, 3477a635ea9SAndrzej Zaborowski .disconnect = usbnet_disconnect, 3487a635ea9SAndrzej Zaborowski .suspend = usbnet_suspend, 3497a635ea9SAndrzej Zaborowski .resume = usbnet_resume, 3507a635ea9SAndrzej Zaborowski }; 3517a635ea9SAndrzej Zaborowski 352*d632eb1bSGreg Kroah-Hartman module_usb_driver(lg_vl600_driver); 3537a635ea9SAndrzej Zaborowski 3547a635ea9SAndrzej Zaborowski MODULE_AUTHOR("Anrzej Zaborowski"); 3557a635ea9SAndrzej Zaborowski MODULE_DESCRIPTION("LG-VL600 modem's ethernet link"); 3567a635ea9SAndrzej Zaborowski MODULE_LICENSE("GPL"); 357