1*1ccea77eSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later 2eb4fd8cdSElina Pasheva /* 3eb4fd8cdSElina Pasheva * USB-to-WWAN Driver for Sierra Wireless modems 4eb4fd8cdSElina Pasheva * 5eb4fd8cdSElina Pasheva * Copyright (C) 2008, 2009, 2010 Paxton Smith, Matthew Safar, Rory Filer 6eb4fd8cdSElina Pasheva * <linux@sierrawireless.com> 7eb4fd8cdSElina Pasheva * 8eb4fd8cdSElina Pasheva * Portions of this based on the cdc_ether driver by David Brownell (2003-2005) 9eb4fd8cdSElina Pasheva * and Ole Andre Vadla Ravnas (ActiveSync) (2006). 10eb4fd8cdSElina Pasheva * 11eb4fd8cdSElina Pasheva * IMPORTANT DISCLAIMER: This driver is not commercially supported by 12eb4fd8cdSElina Pasheva * Sierra Wireless. Use at your own risk. 13eb4fd8cdSElina Pasheva */ 14eb4fd8cdSElina Pasheva 15eb4fd8cdSElina Pasheva #define DRIVER_VERSION "v.2.0" 16eb4fd8cdSElina Pasheva #define DRIVER_AUTHOR "Paxton Smith, Matthew Safar, Rory Filer" 17eb4fd8cdSElina Pasheva #define DRIVER_DESC "USB-to-WWAN Driver for Sierra Wireless modems" 18eb4fd8cdSElina Pasheva static const char driver_name[] = "sierra_net"; 19eb4fd8cdSElina Pasheva 20eb4fd8cdSElina Pasheva /* if defined debug messages enabled */ 21eb4fd8cdSElina Pasheva /*#define DEBUG*/ 22eb4fd8cdSElina Pasheva 23eb4fd8cdSElina Pasheva #include <linux/module.h> 24eb4fd8cdSElina Pasheva #include <linux/etherdevice.h> 25eb4fd8cdSElina Pasheva #include <linux/ethtool.h> 26eb4fd8cdSElina Pasheva #include <linux/mii.h> 27eb4fd8cdSElina Pasheva #include <linux/sched.h> 28eb4fd8cdSElina Pasheva #include <linux/timer.h> 29eb4fd8cdSElina Pasheva #include <linux/usb.h> 30eb4fd8cdSElina Pasheva #include <linux/usb/cdc.h> 31eb4fd8cdSElina Pasheva #include <net/ip.h> 32eb4fd8cdSElina Pasheva #include <net/udp.h> 33eb4fd8cdSElina Pasheva #include <asm/unaligned.h> 34eb4fd8cdSElina Pasheva #include <linux/usb/usbnet.h> 35eb4fd8cdSElina Pasheva 36eb4fd8cdSElina Pasheva #define SWI_USB_REQUEST_GET_FW_ATTR 0x06 37eb4fd8cdSElina Pasheva #define SWI_GET_FW_ATTR_MASK 0x08 38eb4fd8cdSElina Pasheva 39eb4fd8cdSElina Pasheva /* atomic counter partially included in MAC address to make sure 2 devices 40eb4fd8cdSElina Pasheva * do not end up with the same MAC - concept breaks in case of > 255 ifaces 41eb4fd8cdSElina Pasheva */ 42eb4fd8cdSElina Pasheva static atomic_t iface_counter = ATOMIC_INIT(0); 43eb4fd8cdSElina Pasheva 44eb4fd8cdSElina Pasheva /* 45eb4fd8cdSElina Pasheva * SYNC Timer Delay definition used to set the expiry time 46eb4fd8cdSElina Pasheva */ 47eb4fd8cdSElina Pasheva #define SIERRA_NET_SYNCDELAY (2*HZ) 48eb4fd8cdSElina Pasheva 49eb4fd8cdSElina Pasheva /* Max. MTU supported. The modem buffers are limited to 1500 */ 50eb4fd8cdSElina Pasheva #define SIERRA_NET_MAX_SUPPORTED_MTU 1500 51eb4fd8cdSElina Pasheva 52eb4fd8cdSElina Pasheva /* The SIERRA_NET_USBCTL_BUF_LEN defines a buffer size allocated for control 53eb4fd8cdSElina Pasheva * message reception ... and thus the max. received packet. 54eb4fd8cdSElina Pasheva * (May be the cause for parse_hip returning -EINVAL) 55eb4fd8cdSElina Pasheva */ 56eb4fd8cdSElina Pasheva #define SIERRA_NET_USBCTL_BUF_LEN 1024 57eb4fd8cdSElina Pasheva 585aee0728SBjørn Mork /* Overriding the default usbnet rx_urb_size */ 595aee0728SBjørn Mork #define SIERRA_NET_RX_URB_SIZE (8 * 1024) 60eb4fd8cdSElina Pasheva 61eb4fd8cdSElina Pasheva /* Private data structure */ 62eb4fd8cdSElina Pasheva struct sierra_net_data { 63eb4fd8cdSElina Pasheva 64eb4fd8cdSElina Pasheva u16 link_up; /* air link up or down */ 65eb4fd8cdSElina Pasheva u8 tx_hdr_template[4]; /* part of HIP hdr for tx'd packets */ 66eb4fd8cdSElina Pasheva 67eb4fd8cdSElina Pasheva u8 sync_msg[4]; /* SYNC message */ 68eb4fd8cdSElina Pasheva u8 shdwn_msg[4]; /* Shutdown message */ 69eb4fd8cdSElina Pasheva 70eb4fd8cdSElina Pasheva /* Backpointer to the container */ 71eb4fd8cdSElina Pasheva struct usbnet *usbnet; 72eb4fd8cdSElina Pasheva 73eb4fd8cdSElina Pasheva u8 ifnum; /* interface number */ 74eb4fd8cdSElina Pasheva 75eb4fd8cdSElina Pasheva /* Bit masks, must be a power of 2 */ 76eb4fd8cdSElina Pasheva #define SIERRA_NET_EVENT_RESP_AVAIL 0x01 77eb4fd8cdSElina Pasheva #define SIERRA_NET_TIMER_EXPIRY 0x02 78eb4fd8cdSElina Pasheva unsigned long kevent_flags; 79eb4fd8cdSElina Pasheva struct work_struct sierra_net_kevent; 80eb4fd8cdSElina Pasheva struct timer_list sync_timer; /* For retrying SYNC sequence */ 81eb4fd8cdSElina Pasheva }; 82eb4fd8cdSElina Pasheva 83eb4fd8cdSElina Pasheva struct param { 84eb4fd8cdSElina Pasheva int is_present; 85eb4fd8cdSElina Pasheva union { 86eb4fd8cdSElina Pasheva void *ptr; 87eb4fd8cdSElina Pasheva u32 dword; 88eb4fd8cdSElina Pasheva u16 word; 89eb4fd8cdSElina Pasheva u8 byte; 90eb4fd8cdSElina Pasheva }; 91eb4fd8cdSElina Pasheva }; 92eb4fd8cdSElina Pasheva 93eb4fd8cdSElina Pasheva /* HIP message type */ 94eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_EXTENDEDID 0x7F 95eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_HSYNC_ID 0x60 /* Modem -> host */ 96eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_RESTART_ID 0x62 /* Modem -> host */ 97eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_MSYNC_ID 0x20 /* Host -> modem */ 98eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_SHUTD_ID 0x26 /* Host -> modem */ 99eb4fd8cdSElina Pasheva 100eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_EXT_IP_IN_ID 0x0202 101eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_EXT_IP_OUT_ID 0x0002 102eb4fd8cdSElina Pasheva 103eb4fd8cdSElina Pasheva /* 3G UMTS Link Sense Indication definitions */ 104eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_LSI_UMTSID 0x78 105eb4fd8cdSElina Pasheva 106eb4fd8cdSElina Pasheva /* Reverse Channel Grant Indication HIP message */ 107eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_RCGI 0x64 108eb4fd8cdSElina Pasheva 109eb4fd8cdSElina Pasheva /* LSI Protocol types */ 110eb4fd8cdSElina Pasheva #define SIERRA_NET_PROTOCOL_UMTS 0x01 1115a70348eSStefan Brüns #define SIERRA_NET_PROTOCOL_UMTS_DS 0x04 112eb4fd8cdSElina Pasheva /* LSI Coverage */ 113eb4fd8cdSElina Pasheva #define SIERRA_NET_COVERAGE_NONE 0x00 114eb4fd8cdSElina Pasheva #define SIERRA_NET_COVERAGE_NOPACKET 0x01 115eb4fd8cdSElina Pasheva 116eb4fd8cdSElina Pasheva /* LSI Session */ 117eb4fd8cdSElina Pasheva #define SIERRA_NET_SESSION_IDLE 0x00 118eb4fd8cdSElina Pasheva /* LSI Link types */ 1195a70348eSStefan Brüns #define SIERRA_NET_AS_LINK_TYPE_IPV4 0x00 1205a70348eSStefan Brüns #define SIERRA_NET_AS_LINK_TYPE_IPV6 0x02 121eb4fd8cdSElina Pasheva 122eb4fd8cdSElina Pasheva struct lsi_umts { 123eb4fd8cdSElina Pasheva u8 protocol; 124eb4fd8cdSElina Pasheva u8 unused1; 125eb4fd8cdSElina Pasheva __be16 length; 126eb4fd8cdSElina Pasheva /* eventually use a union for the rest - assume umts for now */ 127eb4fd8cdSElina Pasheva u8 coverage; 1285a70348eSStefan Brüns u8 network_len; /* network name len */ 1295a70348eSStefan Brüns u8 network[40]; /* network name (UCS2, bigendian) */ 130eb4fd8cdSElina Pasheva u8 session_state; 131eb4fd8cdSElina Pasheva u8 unused3[33]; 1325a70348eSStefan Brüns } __packed; 1335a70348eSStefan Brüns 1345a70348eSStefan Brüns struct lsi_umts_single { 1355a70348eSStefan Brüns struct lsi_umts lsi; 136eb4fd8cdSElina Pasheva u8 link_type; 137eb4fd8cdSElina Pasheva u8 pdp_addr_len; /* NW-supplied PDP address len */ 138eb4fd8cdSElina Pasheva u8 pdp_addr[16]; /* NW-supplied PDP address (bigendian)) */ 139eb4fd8cdSElina Pasheva u8 unused4[23]; 140eb4fd8cdSElina Pasheva u8 dns1_addr_len; /* NW-supplied 1st DNS address len (bigendian) */ 141eb4fd8cdSElina Pasheva u8 dns1_addr[16]; /* NW-supplied 1st DNS address */ 142eb4fd8cdSElina Pasheva u8 dns2_addr_len; /* NW-supplied 2nd DNS address len */ 143eb4fd8cdSElina Pasheva u8 dns2_addr[16]; /* NW-supplied 2nd DNS address (bigendian)*/ 144eb4fd8cdSElina Pasheva u8 wins1_addr_len; /* NW-supplied 1st Wins address len */ 145eb4fd8cdSElina Pasheva u8 wins1_addr[16]; /* NW-supplied 1st Wins address (bigendian)*/ 146eb4fd8cdSElina Pasheva u8 wins2_addr_len; /* NW-supplied 2nd Wins address len */ 147eb4fd8cdSElina Pasheva u8 wins2_addr[16]; /* NW-supplied 2nd Wins address (bigendian) */ 148eb4fd8cdSElina Pasheva u8 unused5[4]; 149eb4fd8cdSElina Pasheva u8 gw_addr_len; /* NW-supplied GW address len */ 150eb4fd8cdSElina Pasheva u8 gw_addr[16]; /* NW-supplied GW address (bigendian) */ 151eb4fd8cdSElina Pasheva u8 reserved[8]; 152ba2d3587SEric Dumazet } __packed; 153eb4fd8cdSElina Pasheva 1545a70348eSStefan Brüns struct lsi_umts_dual { 1555a70348eSStefan Brüns struct lsi_umts lsi; 1565a70348eSStefan Brüns u8 pdp_addr4_len; /* NW-supplied PDP IPv4 address len */ 1575a70348eSStefan Brüns u8 pdp_addr4[4]; /* NW-supplied PDP IPv4 address (bigendian)) */ 1585a70348eSStefan Brüns u8 pdp_addr6_len; /* NW-supplied PDP IPv6 address len */ 1595a70348eSStefan Brüns u8 pdp_addr6[16]; /* NW-supplied PDP IPv6 address (bigendian)) */ 1605a70348eSStefan Brüns u8 unused4[23]; 1615a70348eSStefan Brüns u8 dns1_addr4_len; /* NW-supplied 1st DNS v4 address len (bigendian) */ 1625a70348eSStefan Brüns u8 dns1_addr4[4]; /* NW-supplied 1st DNS v4 address */ 1635a70348eSStefan Brüns u8 dns1_addr6_len; /* NW-supplied 1st DNS v6 address len */ 1645a70348eSStefan Brüns u8 dns1_addr6[16]; /* NW-supplied 1st DNS v6 address (bigendian)*/ 1655a70348eSStefan Brüns u8 dns2_addr4_len; /* NW-supplied 2nd DNS v4 address len (bigendian) */ 1665a70348eSStefan Brüns u8 dns2_addr4[4]; /* NW-supplied 2nd DNS v4 address */ 1675a70348eSStefan Brüns u8 dns2_addr6_len; /* NW-supplied 2nd DNS v6 address len */ 1685a70348eSStefan Brüns u8 dns2_addr6[16]; /* NW-supplied 2nd DNS v6 address (bigendian)*/ 1695a70348eSStefan Brüns u8 unused5[68]; 1705a70348eSStefan Brüns } __packed; 1715a70348eSStefan Brüns 172eb4fd8cdSElina Pasheva #define SIERRA_NET_LSI_COMMON_LEN 4 1735a70348eSStefan Brüns #define SIERRA_NET_LSI_UMTS_LEN (sizeof(struct lsi_umts_single)) 174eb4fd8cdSElina Pasheva #define SIERRA_NET_LSI_UMTS_STATUS_LEN \ 175eb4fd8cdSElina Pasheva (SIERRA_NET_LSI_UMTS_LEN - SIERRA_NET_LSI_COMMON_LEN) 1765a70348eSStefan Brüns #define SIERRA_NET_LSI_UMTS_DS_LEN (sizeof(struct lsi_umts_dual)) 1775a70348eSStefan Brüns #define SIERRA_NET_LSI_UMTS_DS_STATUS_LEN \ 1785a70348eSStefan Brüns (SIERRA_NET_LSI_UMTS_DS_LEN - SIERRA_NET_LSI_COMMON_LEN) 179eb4fd8cdSElina Pasheva 180eb4fd8cdSElina Pasheva /* Our own net device operations structure */ 181eb4fd8cdSElina Pasheva static const struct net_device_ops sierra_net_device_ops = { 182eb4fd8cdSElina Pasheva .ndo_open = usbnet_open, 183eb4fd8cdSElina Pasheva .ndo_stop = usbnet_stop, 184eb4fd8cdSElina Pasheva .ndo_start_xmit = usbnet_start_xmit, 185eb4fd8cdSElina Pasheva .ndo_tx_timeout = usbnet_tx_timeout, 186f77f0aeeSJarod Wilson .ndo_change_mtu = usbnet_change_mtu, 187c8b5d129SGreg Ungerer .ndo_get_stats64 = usbnet_get_stats64, 188eb4fd8cdSElina Pasheva .ndo_set_mac_address = eth_mac_addr, 189eb4fd8cdSElina Pasheva .ndo_validate_addr = eth_validate_addr, 190eb4fd8cdSElina Pasheva }; 191eb4fd8cdSElina Pasheva 192eb4fd8cdSElina Pasheva /* get private data associated with passed in usbnet device */ 193eb4fd8cdSElina Pasheva static inline struct sierra_net_data *sierra_net_get_private(struct usbnet *dev) 194eb4fd8cdSElina Pasheva { 195eb4fd8cdSElina Pasheva return (struct sierra_net_data *)dev->data[0]; 196eb4fd8cdSElina Pasheva } 197eb4fd8cdSElina Pasheva 198eb4fd8cdSElina Pasheva /* set private data associated with passed in usbnet device */ 199eb4fd8cdSElina Pasheva static inline void sierra_net_set_private(struct usbnet *dev, 200eb4fd8cdSElina Pasheva struct sierra_net_data *priv) 201eb4fd8cdSElina Pasheva { 202eb4fd8cdSElina Pasheva dev->data[0] = (unsigned long)priv; 203eb4fd8cdSElina Pasheva } 204eb4fd8cdSElina Pasheva 2055a70348eSStefan Brüns /* is packet IPv4/IPv6 */ 206eb4fd8cdSElina Pasheva static inline int is_ip(struct sk_buff *skb) 207eb4fd8cdSElina Pasheva { 2085a70348eSStefan Brüns return skb->protocol == cpu_to_be16(ETH_P_IP) || 2095a70348eSStefan Brüns skb->protocol == cpu_to_be16(ETH_P_IPV6); 210eb4fd8cdSElina Pasheva } 211eb4fd8cdSElina Pasheva 212eb4fd8cdSElina Pasheva /* 213eb4fd8cdSElina Pasheva * check passed in packet and make sure that: 214eb4fd8cdSElina Pasheva * - it is linear (no scatter/gather) 215eb4fd8cdSElina Pasheva * - it is ethernet (mac_header properly set) 216eb4fd8cdSElina Pasheva */ 217eb4fd8cdSElina Pasheva static int check_ethip_packet(struct sk_buff *skb, struct usbnet *dev) 218eb4fd8cdSElina Pasheva { 219eb4fd8cdSElina Pasheva skb_reset_mac_header(skb); /* ethernet header */ 220eb4fd8cdSElina Pasheva 221eb4fd8cdSElina Pasheva if (skb_is_nonlinear(skb)) { 222eb4fd8cdSElina Pasheva netdev_err(dev->net, "Non linear buffer-dropping\n"); 223eb4fd8cdSElina Pasheva return 0; 224eb4fd8cdSElina Pasheva } 225eb4fd8cdSElina Pasheva 226eb4fd8cdSElina Pasheva if (!pskb_may_pull(skb, ETH_HLEN)) 227eb4fd8cdSElina Pasheva return 0; 228eb4fd8cdSElina Pasheva skb->protocol = eth_hdr(skb)->h_proto; 229eb4fd8cdSElina Pasheva 230eb4fd8cdSElina Pasheva return 1; 231eb4fd8cdSElina Pasheva } 232eb4fd8cdSElina Pasheva 233eb4fd8cdSElina Pasheva static const u8 *save16bit(struct param *p, const u8 *datap) 234eb4fd8cdSElina Pasheva { 235eb4fd8cdSElina Pasheva p->is_present = 1; 236eb4fd8cdSElina Pasheva p->word = get_unaligned_be16(datap); 237eb4fd8cdSElina Pasheva return datap + sizeof(p->word); 238eb4fd8cdSElina Pasheva } 239eb4fd8cdSElina Pasheva 240eb4fd8cdSElina Pasheva static const u8 *save8bit(struct param *p, const u8 *datap) 241eb4fd8cdSElina Pasheva { 242eb4fd8cdSElina Pasheva p->is_present = 1; 243eb4fd8cdSElina Pasheva p->byte = *datap; 244eb4fd8cdSElina Pasheva return datap + sizeof(p->byte); 245eb4fd8cdSElina Pasheva } 246eb4fd8cdSElina Pasheva 247eb4fd8cdSElina Pasheva /*----------------------------------------------------------------------------* 248eb4fd8cdSElina Pasheva * BEGIN HIP * 249eb4fd8cdSElina Pasheva *----------------------------------------------------------------------------*/ 250eb4fd8cdSElina Pasheva /* HIP header */ 251eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_HDR_LEN 4 252eb4fd8cdSElina Pasheva /* Extended HIP header */ 253eb4fd8cdSElina Pasheva #define SIERRA_NET_HIP_EXT_HDR_LEN 6 254eb4fd8cdSElina Pasheva 255eb4fd8cdSElina Pasheva struct hip_hdr { 256eb4fd8cdSElina Pasheva int hdrlen; 257eb4fd8cdSElina Pasheva struct param payload_len; 258eb4fd8cdSElina Pasheva struct param msgid; 259eb4fd8cdSElina Pasheva struct param msgspecific; 260eb4fd8cdSElina Pasheva struct param extmsgid; 261eb4fd8cdSElina Pasheva }; 262eb4fd8cdSElina Pasheva 263eb4fd8cdSElina Pasheva static int parse_hip(const u8 *buf, const u32 buflen, struct hip_hdr *hh) 264eb4fd8cdSElina Pasheva { 265eb4fd8cdSElina Pasheva const u8 *curp = buf; 266eb4fd8cdSElina Pasheva int padded; 267eb4fd8cdSElina Pasheva 268eb4fd8cdSElina Pasheva if (buflen < SIERRA_NET_HIP_HDR_LEN) 269eb4fd8cdSElina Pasheva return -EPROTO; 270eb4fd8cdSElina Pasheva 271eb4fd8cdSElina Pasheva curp = save16bit(&hh->payload_len, curp); 272eb4fd8cdSElina Pasheva curp = save8bit(&hh->msgid, curp); 273eb4fd8cdSElina Pasheva curp = save8bit(&hh->msgspecific, curp); 274eb4fd8cdSElina Pasheva 275eb4fd8cdSElina Pasheva padded = hh->msgid.byte & 0x80; 276eb4fd8cdSElina Pasheva hh->msgid.byte &= 0x7F; /* 7 bits */ 277eb4fd8cdSElina Pasheva 278eb4fd8cdSElina Pasheva hh->extmsgid.is_present = (hh->msgid.byte == SIERRA_NET_HIP_EXTENDEDID); 279eb4fd8cdSElina Pasheva if (hh->extmsgid.is_present) { 280eb4fd8cdSElina Pasheva if (buflen < SIERRA_NET_HIP_EXT_HDR_LEN) 281eb4fd8cdSElina Pasheva return -EPROTO; 282eb4fd8cdSElina Pasheva 283eb4fd8cdSElina Pasheva hh->payload_len.word &= 0x3FFF; /* 14 bits */ 284eb4fd8cdSElina Pasheva 285eb4fd8cdSElina Pasheva curp = save16bit(&hh->extmsgid, curp); 286eb4fd8cdSElina Pasheva hh->extmsgid.word &= 0x03FF; /* 10 bits */ 287eb4fd8cdSElina Pasheva 288eb4fd8cdSElina Pasheva hh->hdrlen = SIERRA_NET_HIP_EXT_HDR_LEN; 289eb4fd8cdSElina Pasheva } else { 290eb4fd8cdSElina Pasheva hh->payload_len.word &= 0x07FF; /* 11 bits */ 291eb4fd8cdSElina Pasheva hh->hdrlen = SIERRA_NET_HIP_HDR_LEN; 292eb4fd8cdSElina Pasheva } 293eb4fd8cdSElina Pasheva 294eb4fd8cdSElina Pasheva if (padded) { 295eb4fd8cdSElina Pasheva hh->hdrlen++; 296eb4fd8cdSElina Pasheva hh->payload_len.word--; 297eb4fd8cdSElina Pasheva } 298eb4fd8cdSElina Pasheva 299eb4fd8cdSElina Pasheva /* if real packet shorter than the claimed length */ 300eb4fd8cdSElina Pasheva if (buflen < (hh->hdrlen + hh->payload_len.word)) 301eb4fd8cdSElina Pasheva return -EINVAL; 302eb4fd8cdSElina Pasheva 303eb4fd8cdSElina Pasheva return 0; 304eb4fd8cdSElina Pasheva } 305eb4fd8cdSElina Pasheva 306eb4fd8cdSElina Pasheva static void build_hip(u8 *buf, const u16 payloadlen, 307eb4fd8cdSElina Pasheva struct sierra_net_data *priv) 308eb4fd8cdSElina Pasheva { 309eb4fd8cdSElina Pasheva /* the following doesn't have the full functionality. We 310eb4fd8cdSElina Pasheva * currently build only one kind of header, so it is faster this way 311eb4fd8cdSElina Pasheva */ 312eb4fd8cdSElina Pasheva put_unaligned_be16(payloadlen, buf); 313eb4fd8cdSElina Pasheva memcpy(buf+2, priv->tx_hdr_template, sizeof(priv->tx_hdr_template)); 314eb4fd8cdSElina Pasheva } 315eb4fd8cdSElina Pasheva /*----------------------------------------------------------------------------* 316eb4fd8cdSElina Pasheva * END HIP * 317eb4fd8cdSElina Pasheva *----------------------------------------------------------------------------*/ 318eb4fd8cdSElina Pasheva 319eb4fd8cdSElina Pasheva static int sierra_net_send_cmd(struct usbnet *dev, 320eb4fd8cdSElina Pasheva u8 *cmd, int cmdlen, const char * cmd_name) 321eb4fd8cdSElina Pasheva { 322eb4fd8cdSElina Pasheva struct sierra_net_data *priv = sierra_net_get_private(dev); 323eb4fd8cdSElina Pasheva int status; 324eb4fd8cdSElina Pasheva 325f7385ec9SMing Lei status = usbnet_write_cmd(dev, USB_CDC_SEND_ENCAPSULATED_COMMAND, 326f7385ec9SMing Lei USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE, 327f7385ec9SMing Lei 0, priv->ifnum, cmd, cmdlen); 328eb4fd8cdSElina Pasheva 329eb4fd8cdSElina Pasheva if (status != cmdlen && status != -ENODEV) 330eb4fd8cdSElina Pasheva netdev_err(dev->net, "Submit %s failed %d\n", cmd_name, status); 331eb4fd8cdSElina Pasheva 332eb4fd8cdSElina Pasheva return status; 333eb4fd8cdSElina Pasheva } 334eb4fd8cdSElina Pasheva 335eb4fd8cdSElina Pasheva static int sierra_net_send_sync(struct usbnet *dev) 336eb4fd8cdSElina Pasheva { 337eb4fd8cdSElina Pasheva int status; 338eb4fd8cdSElina Pasheva struct sierra_net_data *priv = sierra_net_get_private(dev); 339eb4fd8cdSElina Pasheva 340eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 341eb4fd8cdSElina Pasheva 342eb4fd8cdSElina Pasheva status = sierra_net_send_cmd(dev, priv->sync_msg, 343eb4fd8cdSElina Pasheva sizeof(priv->sync_msg), "SYNC"); 344eb4fd8cdSElina Pasheva 345eb4fd8cdSElina Pasheva return status; 346eb4fd8cdSElina Pasheva } 347eb4fd8cdSElina Pasheva 348eb4fd8cdSElina Pasheva static void sierra_net_set_ctx_index(struct sierra_net_data *priv, u8 ctx_ix) 349eb4fd8cdSElina Pasheva { 350eb4fd8cdSElina Pasheva dev_dbg(&(priv->usbnet->udev->dev), "%s %d", __func__, ctx_ix); 351eb4fd8cdSElina Pasheva priv->tx_hdr_template[0] = 0x3F; 352eb4fd8cdSElina Pasheva priv->tx_hdr_template[1] = ctx_ix; 353a932657fSBjørn Mork *((__be16 *)&priv->tx_hdr_template[2]) = 354eb4fd8cdSElina Pasheva cpu_to_be16(SIERRA_NET_HIP_EXT_IP_OUT_ID); 355eb4fd8cdSElina Pasheva } 356eb4fd8cdSElina Pasheva 357eb4fd8cdSElina Pasheva static inline int sierra_net_is_valid_addrlen(u8 len) 358eb4fd8cdSElina Pasheva { 359807540baSEric Dumazet return len == sizeof(struct in_addr); 360eb4fd8cdSElina Pasheva } 361eb4fd8cdSElina Pasheva 362eb4fd8cdSElina Pasheva static int sierra_net_parse_lsi(struct usbnet *dev, char *data, int datalen) 363eb4fd8cdSElina Pasheva { 364eb4fd8cdSElina Pasheva struct lsi_umts *lsi = (struct lsi_umts *)data; 3655a70348eSStefan Brüns u32 expected_length; 366eb4fd8cdSElina Pasheva 3675a70348eSStefan Brüns if (datalen < sizeof(struct lsi_umts_single)) { 3685b5e0928SAlexey Dobriyan netdev_err(dev->net, "%s: Data length %d, exp >= %zu\n", 3695a70348eSStefan Brüns __func__, datalen, sizeof(struct lsi_umts_single)); 370eb4fd8cdSElina Pasheva return -1; 371eb4fd8cdSElina Pasheva } 372eb4fd8cdSElina Pasheva 373764895d3SStefan Brüns /* Validate the session state */ 374764895d3SStefan Brüns if (lsi->session_state == SIERRA_NET_SESSION_IDLE) { 375764895d3SStefan Brüns netdev_err(dev->net, "Session idle, 0x%02x\n", 376764895d3SStefan Brüns lsi->session_state); 377764895d3SStefan Brüns return 0; 378764895d3SStefan Brüns } 379764895d3SStefan Brüns 380eb4fd8cdSElina Pasheva /* Validate the protocol - only support UMTS for now */ 3815a70348eSStefan Brüns if (lsi->protocol == SIERRA_NET_PROTOCOL_UMTS) { 3825a70348eSStefan Brüns struct lsi_umts_single *single = (struct lsi_umts_single *)lsi; 3835a70348eSStefan Brüns 3845a70348eSStefan Brüns /* Validate the link type */ 3855a70348eSStefan Brüns if (single->link_type != SIERRA_NET_AS_LINK_TYPE_IPV4 && 3865a70348eSStefan Brüns single->link_type != SIERRA_NET_AS_LINK_TYPE_IPV6) { 3875a70348eSStefan Brüns netdev_err(dev->net, "Link type unsupported: 0x%02x\n", 3885a70348eSStefan Brüns single->link_type); 3895a70348eSStefan Brüns return -1; 3905a70348eSStefan Brüns } 3915a70348eSStefan Brüns expected_length = SIERRA_NET_LSI_UMTS_STATUS_LEN; 3925a70348eSStefan Brüns } else if (lsi->protocol == SIERRA_NET_PROTOCOL_UMTS_DS) { 3935a70348eSStefan Brüns expected_length = SIERRA_NET_LSI_UMTS_DS_STATUS_LEN; 3945a70348eSStefan Brüns } else { 395eb4fd8cdSElina Pasheva netdev_err(dev->net, "Protocol unsupported, 0x%02x\n", 396eb4fd8cdSElina Pasheva lsi->protocol); 397eb4fd8cdSElina Pasheva return -1; 398eb4fd8cdSElina Pasheva } 399eb4fd8cdSElina Pasheva 4005a70348eSStefan Brüns if (be16_to_cpu(lsi->length) != expected_length) { 4015a70348eSStefan Brüns netdev_err(dev->net, "%s: LSI_UMTS_STATUS_LEN %d, exp %u\n", 4025a70348eSStefan Brüns __func__, be16_to_cpu(lsi->length), expected_length); 403eb4fd8cdSElina Pasheva return -1; 404eb4fd8cdSElina Pasheva } 405eb4fd8cdSElina Pasheva 406eb4fd8cdSElina Pasheva /* Validate the coverage */ 4075a70348eSStefan Brüns if (lsi->coverage == SIERRA_NET_COVERAGE_NONE || 4085a70348eSStefan Brüns lsi->coverage == SIERRA_NET_COVERAGE_NOPACKET) { 409eb4fd8cdSElina Pasheva netdev_err(dev->net, "No coverage, 0x%02x\n", lsi->coverage); 410eb4fd8cdSElina Pasheva return 0; 411eb4fd8cdSElina Pasheva } 412eb4fd8cdSElina Pasheva 413eb4fd8cdSElina Pasheva /* Set link_sense true */ 414eb4fd8cdSElina Pasheva return 1; 415eb4fd8cdSElina Pasheva } 416eb4fd8cdSElina Pasheva 417eb4fd8cdSElina Pasheva static void sierra_net_handle_lsi(struct usbnet *dev, char *data, 418eb4fd8cdSElina Pasheva struct hip_hdr *hh) 419eb4fd8cdSElina Pasheva { 420eb4fd8cdSElina Pasheva struct sierra_net_data *priv = sierra_net_get_private(dev); 421eb4fd8cdSElina Pasheva int link_up; 422eb4fd8cdSElina Pasheva 423eb4fd8cdSElina Pasheva link_up = sierra_net_parse_lsi(dev, data + hh->hdrlen, 424eb4fd8cdSElina Pasheva hh->payload_len.word); 425eb4fd8cdSElina Pasheva if (link_up < 0) { 426eb4fd8cdSElina Pasheva netdev_err(dev->net, "Invalid LSI\n"); 427eb4fd8cdSElina Pasheva return; 428eb4fd8cdSElina Pasheva } 429eb4fd8cdSElina Pasheva if (link_up) { 430eb4fd8cdSElina Pasheva sierra_net_set_ctx_index(priv, hh->msgspecific.byte); 431eb4fd8cdSElina Pasheva priv->link_up = 1; 432eb4fd8cdSElina Pasheva } else { 433eb4fd8cdSElina Pasheva priv->link_up = 0; 434eb4fd8cdSElina Pasheva } 4359ef2c441SMing Lei usbnet_link_change(dev, link_up, 0); 436eb4fd8cdSElina Pasheva } 437eb4fd8cdSElina Pasheva 438eb4fd8cdSElina Pasheva static void sierra_net_dosync(struct usbnet *dev) 439eb4fd8cdSElina Pasheva { 440eb4fd8cdSElina Pasheva int status; 441eb4fd8cdSElina Pasheva struct sierra_net_data *priv = sierra_net_get_private(dev); 442eb4fd8cdSElina Pasheva 443eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 444eb4fd8cdSElina Pasheva 4457b0c5f21SDan Williams /* The SIERRA_NET_HIP_MSYNC_ID command appears to request that the 4467b0c5f21SDan Williams * firmware restart itself. After restarting, the modem will respond 4477b0c5f21SDan Williams * with the SIERRA_NET_HIP_RESTART_ID indication. The driver continues 4487b0c5f21SDan Williams * sending MSYNC commands every few seconds until it receives the 4497b0c5f21SDan Williams * RESTART event from the firmware 4507b0c5f21SDan Williams */ 4517b0c5f21SDan Williams 452eb4fd8cdSElina Pasheva /* tell modem we are ready */ 453eb4fd8cdSElina Pasheva status = sierra_net_send_sync(dev); 454eb4fd8cdSElina Pasheva if (status < 0) 455eb4fd8cdSElina Pasheva netdev_err(dev->net, 456eb4fd8cdSElina Pasheva "Send SYNC failed, status %d\n", status); 457eb4fd8cdSElina Pasheva status = sierra_net_send_sync(dev); 458eb4fd8cdSElina Pasheva if (status < 0) 459eb4fd8cdSElina Pasheva netdev_err(dev->net, 460eb4fd8cdSElina Pasheva "Send SYNC failed, status %d\n", status); 461eb4fd8cdSElina Pasheva 462eb4fd8cdSElina Pasheva /* Now, start a timer and make sure we get the Restart Indication */ 463eb4fd8cdSElina Pasheva priv->sync_timer.expires = jiffies + SIERRA_NET_SYNCDELAY; 464eb4fd8cdSElina Pasheva add_timer(&priv->sync_timer); 465eb4fd8cdSElina Pasheva } 466eb4fd8cdSElina Pasheva 467eb4fd8cdSElina Pasheva static void sierra_net_kevent(struct work_struct *work) 468eb4fd8cdSElina Pasheva { 469eb4fd8cdSElina Pasheva struct sierra_net_data *priv = 470eb4fd8cdSElina Pasheva container_of(work, struct sierra_net_data, sierra_net_kevent); 471eb4fd8cdSElina Pasheva struct usbnet *dev = priv->usbnet; 472eb4fd8cdSElina Pasheva int len; 473eb4fd8cdSElina Pasheva int err; 474eb4fd8cdSElina Pasheva u8 *buf; 475eb4fd8cdSElina Pasheva u8 ifnum; 476eb4fd8cdSElina Pasheva 477eb4fd8cdSElina Pasheva if (test_bit(SIERRA_NET_EVENT_RESP_AVAIL, &priv->kevent_flags)) { 478eb4fd8cdSElina Pasheva clear_bit(SIERRA_NET_EVENT_RESP_AVAIL, &priv->kevent_flags); 479eb4fd8cdSElina Pasheva 480eb4fd8cdSElina Pasheva /* Query the modem for the LSI message */ 481eb4fd8cdSElina Pasheva buf = kzalloc(SIERRA_NET_USBCTL_BUF_LEN, GFP_KERNEL); 48238673c82SJoe Perches if (!buf) 483eb4fd8cdSElina Pasheva return; 48438673c82SJoe Perches 485eb4fd8cdSElina Pasheva ifnum = priv->ifnum; 486eb4fd8cdSElina Pasheva len = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), 487eb4fd8cdSElina Pasheva USB_CDC_GET_ENCAPSULATED_RESPONSE, 488eb4fd8cdSElina Pasheva USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE, 489eb4fd8cdSElina Pasheva 0, ifnum, buf, SIERRA_NET_USBCTL_BUF_LEN, 490eb4fd8cdSElina Pasheva USB_CTRL_SET_TIMEOUT); 491eb4fd8cdSElina Pasheva 492eb4fd8cdSElina Pasheva if (len < 0) { 493eb4fd8cdSElina Pasheva netdev_err(dev->net, 494eb4fd8cdSElina Pasheva "usb_control_msg failed, status %d\n", len); 495eb4fd8cdSElina Pasheva } else { 496eb4fd8cdSElina Pasheva struct hip_hdr hh; 497eb4fd8cdSElina Pasheva 498eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s: Received status message," 499eb4fd8cdSElina Pasheva " %04x bytes", __func__, len); 500eb4fd8cdSElina Pasheva 501eb4fd8cdSElina Pasheva err = parse_hip(buf, len, &hh); 502eb4fd8cdSElina Pasheva if (err) { 503eb4fd8cdSElina Pasheva netdev_err(dev->net, "%s: Bad packet," 504eb4fd8cdSElina Pasheva " parse result %d\n", __func__, err); 505eb4fd8cdSElina Pasheva kfree(buf); 506eb4fd8cdSElina Pasheva return; 507eb4fd8cdSElina Pasheva } 508eb4fd8cdSElina Pasheva 509eb4fd8cdSElina Pasheva /* Validate packet length */ 510eb4fd8cdSElina Pasheva if (len != hh.hdrlen + hh.payload_len.word) { 511eb4fd8cdSElina Pasheva netdev_err(dev->net, "%s: Bad packet, received" 512eb4fd8cdSElina Pasheva " %d, expected %d\n", __func__, len, 513eb4fd8cdSElina Pasheva hh.hdrlen + hh.payload_len.word); 514eb4fd8cdSElina Pasheva kfree(buf); 515eb4fd8cdSElina Pasheva return; 516eb4fd8cdSElina Pasheva } 517eb4fd8cdSElina Pasheva 518eb4fd8cdSElina Pasheva /* Switch on received message types */ 519eb4fd8cdSElina Pasheva switch (hh.msgid.byte) { 520eb4fd8cdSElina Pasheva case SIERRA_NET_HIP_LSI_UMTSID: 521eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "LSI for ctx:%d", 522eb4fd8cdSElina Pasheva hh.msgspecific.byte); 523eb4fd8cdSElina Pasheva sierra_net_handle_lsi(dev, buf, &hh); 524eb4fd8cdSElina Pasheva break; 525eb4fd8cdSElina Pasheva case SIERRA_NET_HIP_RESTART_ID: 526eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "Restart reported: %d," 527eb4fd8cdSElina Pasheva " stopping sync timer", 528eb4fd8cdSElina Pasheva hh.msgspecific.byte); 529eb4fd8cdSElina Pasheva /* Got sync resp - stop timer & clear mask */ 530eb4fd8cdSElina Pasheva del_timer_sync(&priv->sync_timer); 531eb4fd8cdSElina Pasheva clear_bit(SIERRA_NET_TIMER_EXPIRY, 532eb4fd8cdSElina Pasheva &priv->kevent_flags); 533eb4fd8cdSElina Pasheva break; 534eb4fd8cdSElina Pasheva case SIERRA_NET_HIP_HSYNC_ID: 535eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "SYNC received"); 536eb4fd8cdSElina Pasheva err = sierra_net_send_sync(dev); 537eb4fd8cdSElina Pasheva if (err < 0) 538eb4fd8cdSElina Pasheva netdev_err(dev->net, 539eb4fd8cdSElina Pasheva "Send SYNC failed %d\n", err); 540eb4fd8cdSElina Pasheva break; 541eb4fd8cdSElina Pasheva case SIERRA_NET_HIP_EXTENDEDID: 542eb4fd8cdSElina Pasheva netdev_err(dev->net, "Unrecognized HIP msg, " 543eb4fd8cdSElina Pasheva "extmsgid 0x%04x\n", hh.extmsgid.word); 544eb4fd8cdSElina Pasheva break; 545eb4fd8cdSElina Pasheva case SIERRA_NET_HIP_RCGI: 546eb4fd8cdSElina Pasheva /* Ignored */ 547eb4fd8cdSElina Pasheva break; 548eb4fd8cdSElina Pasheva default: 549eb4fd8cdSElina Pasheva netdev_err(dev->net, "Unrecognized HIP msg, " 550eb4fd8cdSElina Pasheva "msgid 0x%02x\n", hh.msgid.byte); 551eb4fd8cdSElina Pasheva break; 552eb4fd8cdSElina Pasheva } 553eb4fd8cdSElina Pasheva } 554eb4fd8cdSElina Pasheva kfree(buf); 555eb4fd8cdSElina Pasheva } 556eb4fd8cdSElina Pasheva /* The sync timer bit might be set */ 557eb4fd8cdSElina Pasheva if (test_bit(SIERRA_NET_TIMER_EXPIRY, &priv->kevent_flags)) { 558eb4fd8cdSElina Pasheva clear_bit(SIERRA_NET_TIMER_EXPIRY, &priv->kevent_flags); 559eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "Deferred sync timer expiry"); 560eb4fd8cdSElina Pasheva sierra_net_dosync(priv->usbnet); 561eb4fd8cdSElina Pasheva } 562eb4fd8cdSElina Pasheva 563eb4fd8cdSElina Pasheva if (priv->kevent_flags) 564eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "sierra_net_kevent done, " 565eb4fd8cdSElina Pasheva "kevent_flags = 0x%lx", priv->kevent_flags); 566eb4fd8cdSElina Pasheva } 567eb4fd8cdSElina Pasheva 568eb4fd8cdSElina Pasheva static void sierra_net_defer_kevent(struct usbnet *dev, int work) 569eb4fd8cdSElina Pasheva { 570eb4fd8cdSElina Pasheva struct sierra_net_data *priv = sierra_net_get_private(dev); 571eb4fd8cdSElina Pasheva 572eb4fd8cdSElina Pasheva set_bit(work, &priv->kevent_flags); 573eb4fd8cdSElina Pasheva schedule_work(&priv->sierra_net_kevent); 574eb4fd8cdSElina Pasheva } 575eb4fd8cdSElina Pasheva 576eb4fd8cdSElina Pasheva /* 577eb4fd8cdSElina Pasheva * Sync Retransmit Timer Handler. On expiry, kick the work queue 578eb4fd8cdSElina Pasheva */ 579d28bb967SKees Cook static void sierra_sync_timer(struct timer_list *t) 580eb4fd8cdSElina Pasheva { 581d28bb967SKees Cook struct sierra_net_data *priv = from_timer(priv, t, sync_timer); 582d28bb967SKees Cook struct usbnet *dev = priv->usbnet; 583eb4fd8cdSElina Pasheva 584eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 585eb4fd8cdSElina Pasheva /* Kick the tasklet */ 586eb4fd8cdSElina Pasheva sierra_net_defer_kevent(dev, SIERRA_NET_TIMER_EXPIRY); 587eb4fd8cdSElina Pasheva } 588eb4fd8cdSElina Pasheva 589eb4fd8cdSElina Pasheva static void sierra_net_status(struct usbnet *dev, struct urb *urb) 590eb4fd8cdSElina Pasheva { 591eb4fd8cdSElina Pasheva struct usb_cdc_notification *event; 592eb4fd8cdSElina Pasheva 593eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 594eb4fd8cdSElina Pasheva 595eb4fd8cdSElina Pasheva if (urb->actual_length < sizeof *event) 596eb4fd8cdSElina Pasheva return; 597eb4fd8cdSElina Pasheva 598eb4fd8cdSElina Pasheva /* Add cases to handle other standard notifications. */ 599eb4fd8cdSElina Pasheva event = urb->transfer_buffer; 600eb4fd8cdSElina Pasheva switch (event->bNotificationType) { 601eb4fd8cdSElina Pasheva case USB_CDC_NOTIFY_NETWORK_CONNECTION: 602eb4fd8cdSElina Pasheva case USB_CDC_NOTIFY_SPEED_CHANGE: 603eb4fd8cdSElina Pasheva /* USB 305 sends those */ 604eb4fd8cdSElina Pasheva break; 605eb4fd8cdSElina Pasheva case USB_CDC_NOTIFY_RESPONSE_AVAILABLE: 606eb4fd8cdSElina Pasheva sierra_net_defer_kevent(dev, SIERRA_NET_EVENT_RESP_AVAIL); 607eb4fd8cdSElina Pasheva break; 608eb4fd8cdSElina Pasheva default: 609eb4fd8cdSElina Pasheva netdev_err(dev->net, ": unexpected notification %02x!\n", 610eb4fd8cdSElina Pasheva event->bNotificationType); 611eb4fd8cdSElina Pasheva break; 612eb4fd8cdSElina Pasheva } 613eb4fd8cdSElina Pasheva } 614eb4fd8cdSElina Pasheva 615eb4fd8cdSElina Pasheva static void sierra_net_get_drvinfo(struct net_device *net, 616eb4fd8cdSElina Pasheva struct ethtool_drvinfo *info) 617eb4fd8cdSElina Pasheva { 618eb4fd8cdSElina Pasheva /* Inherit standard device info */ 619eb4fd8cdSElina Pasheva usbnet_get_drvinfo(net, info); 6207826d43fSJiri Pirko strlcpy(info->driver, driver_name, sizeof(info->driver)); 6217826d43fSJiri Pirko strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); 622eb4fd8cdSElina Pasheva } 623eb4fd8cdSElina Pasheva 624eb4fd8cdSElina Pasheva static u32 sierra_net_get_link(struct net_device *net) 625eb4fd8cdSElina Pasheva { 626eb4fd8cdSElina Pasheva struct usbnet *dev = netdev_priv(net); 627eb4fd8cdSElina Pasheva /* Report link is down whenever the interface is down */ 628eb4fd8cdSElina Pasheva return sierra_net_get_private(dev)->link_up && netif_running(net); 629eb4fd8cdSElina Pasheva } 630eb4fd8cdSElina Pasheva 631bc689c97Sstephen hemminger static const struct ethtool_ops sierra_net_ethtool_ops = { 632eb4fd8cdSElina Pasheva .get_drvinfo = sierra_net_get_drvinfo, 633eb4fd8cdSElina Pasheva .get_link = sierra_net_get_link, 634eb4fd8cdSElina Pasheva .get_msglevel = usbnet_get_msglevel, 635eb4fd8cdSElina Pasheva .set_msglevel = usbnet_set_msglevel, 636eb4fd8cdSElina Pasheva .nway_reset = usbnet_nway_reset, 63790a8e95eSPhilippe Reynes .get_link_ksettings = usbnet_get_link_ksettings, 63890a8e95eSPhilippe Reynes .set_link_ksettings = usbnet_set_link_ksettings, 639eb4fd8cdSElina Pasheva }; 640eb4fd8cdSElina Pasheva 641eb4fd8cdSElina Pasheva static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap) 642eb4fd8cdSElina Pasheva { 643eb4fd8cdSElina Pasheva int result = 0; 644a932657fSBjørn Mork __le16 attrdata; 645eb4fd8cdSElina Pasheva 646f7385ec9SMing Lei result = usbnet_read_cmd(dev, 647eb4fd8cdSElina Pasheva /* _u8 vendor specific request */ 648eb4fd8cdSElina Pasheva SWI_USB_REQUEST_GET_FW_ATTR, 649eb4fd8cdSElina Pasheva USB_DIR_IN | USB_TYPE_VENDOR, /* __u8 request type */ 650eb4fd8cdSElina Pasheva 0x0000, /* __u16 value not used */ 651eb4fd8cdSElina Pasheva 0x0000, /* __u16 index not used */ 652f7385ec9SMing Lei &attrdata, /* char *data */ 653f7385ec9SMing Lei sizeof(attrdata) /* __u16 size */ 654f7385ec9SMing Lei ); 655eb4fd8cdSElina Pasheva 656f7385ec9SMing Lei if (result < 0) 657eb4fd8cdSElina Pasheva return -EIO; 658eb4fd8cdSElina Pasheva 659f7385ec9SMing Lei *datap = le16_to_cpu(attrdata); 660eb4fd8cdSElina Pasheva return result; 661eb4fd8cdSElina Pasheva } 662eb4fd8cdSElina Pasheva 663eb4fd8cdSElina Pasheva /* 664eb4fd8cdSElina Pasheva * collects the bulk endpoints, the status endpoint. 665eb4fd8cdSElina Pasheva */ 666eb4fd8cdSElina Pasheva static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf) 667eb4fd8cdSElina Pasheva { 668eb4fd8cdSElina Pasheva u8 ifacenum; 669eb4fd8cdSElina Pasheva u8 numendpoints; 670eb4fd8cdSElina Pasheva u16 fwattr = 0; 671eb4fd8cdSElina Pasheva int status; 672eb4fd8cdSElina Pasheva struct sierra_net_data *priv; 673eb4fd8cdSElina Pasheva static const u8 sync_tmplate[sizeof(priv->sync_msg)] = { 674eb4fd8cdSElina Pasheva 0x00, 0x00, SIERRA_NET_HIP_MSYNC_ID, 0x00}; 675eb4fd8cdSElina Pasheva static const u8 shdwn_tmplate[sizeof(priv->shdwn_msg)] = { 676eb4fd8cdSElina Pasheva 0x00, 0x00, SIERRA_NET_HIP_SHUTD_ID, 0x00}; 677eb4fd8cdSElina Pasheva 678eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 679eb4fd8cdSElina Pasheva 680eb4fd8cdSElina Pasheva ifacenum = intf->cur_altsetting->desc.bInterfaceNumber; 681eb4fd8cdSElina Pasheva numendpoints = intf->cur_altsetting->desc.bNumEndpoints; 682eb4fd8cdSElina Pasheva /* We have three endpoints, bulk in and out, and a status */ 683eb4fd8cdSElina Pasheva if (numendpoints != 3) { 684eb4fd8cdSElina Pasheva dev_err(&dev->udev->dev, "Expected 3 endpoints, found: %d", 685eb4fd8cdSElina Pasheva numendpoints); 686eb4fd8cdSElina Pasheva return -ENODEV; 687eb4fd8cdSElina Pasheva } 688eb4fd8cdSElina Pasheva /* Status endpoint set in usbnet_get_endpoints() */ 689eb4fd8cdSElina Pasheva dev->status = NULL; 690eb4fd8cdSElina Pasheva status = usbnet_get_endpoints(dev, intf); 691eb4fd8cdSElina Pasheva if (status < 0) { 692eb4fd8cdSElina Pasheva dev_err(&dev->udev->dev, "Error in usbnet_get_endpoints (%d)", 693eb4fd8cdSElina Pasheva status); 694eb4fd8cdSElina Pasheva return -ENODEV; 695eb4fd8cdSElina Pasheva } 696eb4fd8cdSElina Pasheva /* Initialize sierra private data */ 697eb4fd8cdSElina Pasheva priv = kzalloc(sizeof *priv, GFP_KERNEL); 69838673c82SJoe Perches if (!priv) 699eb4fd8cdSElina Pasheva return -ENOMEM; 700eb4fd8cdSElina Pasheva 701eb4fd8cdSElina Pasheva priv->usbnet = dev; 702eb4fd8cdSElina Pasheva priv->ifnum = ifacenum; 703eb4fd8cdSElina Pasheva dev->net->netdev_ops = &sierra_net_device_ops; 704eb4fd8cdSElina Pasheva 705eb4fd8cdSElina Pasheva /* change MAC addr to include, ifacenum, and to be unique */ 706eb4fd8cdSElina Pasheva dev->net->dev_addr[ETH_ALEN-2] = atomic_inc_return(&iface_counter); 707eb4fd8cdSElina Pasheva dev->net->dev_addr[ETH_ALEN-1] = ifacenum; 708eb4fd8cdSElina Pasheva 709eb4fd8cdSElina Pasheva /* prepare shutdown message template */ 710eb4fd8cdSElina Pasheva memcpy(priv->shdwn_msg, shdwn_tmplate, sizeof(priv->shdwn_msg)); 711eb4fd8cdSElina Pasheva /* set context index initially to 0 - prepares tx hdr template */ 712eb4fd8cdSElina Pasheva sierra_net_set_ctx_index(priv, 0); 713eb4fd8cdSElina Pasheva 7147b0c5f21SDan Williams /* prepare sync message template */ 7157b0c5f21SDan Williams memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg)); 7167b0c5f21SDan Williams 717eb4fd8cdSElina Pasheva /* decrease the rx_urb_size and max_tx_size to 4k on USB 1.1 */ 7185aee0728SBjørn Mork dev->rx_urb_size = SIERRA_NET_RX_URB_SIZE; 719eb4fd8cdSElina Pasheva if (dev->udev->speed != USB_SPEED_HIGH) 7205aee0728SBjørn Mork dev->rx_urb_size = min_t(size_t, 4096, SIERRA_NET_RX_URB_SIZE); 721eb4fd8cdSElina Pasheva 722eb4fd8cdSElina Pasheva dev->net->hard_header_len += SIERRA_NET_HIP_EXT_HDR_LEN; 723eb4fd8cdSElina Pasheva dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 724f77f0aeeSJarod Wilson dev->net->max_mtu = SIERRA_NET_MAX_SUPPORTED_MTU; 725eb4fd8cdSElina Pasheva 726eb4fd8cdSElina Pasheva /* Set up the netdev */ 727eb4fd8cdSElina Pasheva dev->net->flags |= IFF_NOARP; 728eb4fd8cdSElina Pasheva dev->net->ethtool_ops = &sierra_net_ethtool_ops; 729eb4fd8cdSElina Pasheva netif_carrier_off(dev->net); 730eb4fd8cdSElina Pasheva 731eb4fd8cdSElina Pasheva sierra_net_set_private(dev, priv); 732eb4fd8cdSElina Pasheva 733eb4fd8cdSElina Pasheva priv->kevent_flags = 0; 734eb4fd8cdSElina Pasheva 735eb4fd8cdSElina Pasheva /* Use the shared workqueue */ 736eb4fd8cdSElina Pasheva INIT_WORK(&priv->sierra_net_kevent, sierra_net_kevent); 737eb4fd8cdSElina Pasheva 738eb4fd8cdSElina Pasheva /* Only need to do this once */ 739d28bb967SKees Cook timer_setup(&priv->sync_timer, sierra_sync_timer, 0); 740eb4fd8cdSElina Pasheva 741eb4fd8cdSElina Pasheva /* verify fw attributes */ 742eb4fd8cdSElina Pasheva status = sierra_net_get_fw_attr(dev, &fwattr); 743eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "Fw attr: %x\n", fwattr); 744eb4fd8cdSElina Pasheva 745eb4fd8cdSElina Pasheva /* test whether firmware supports DHCP */ 746eb4fd8cdSElina Pasheva if (!(status == sizeof(fwattr) && (fwattr & SWI_GET_FW_ATTR_MASK))) { 747eb4fd8cdSElina Pasheva /* found incompatible firmware version */ 748eb4fd8cdSElina Pasheva dev_err(&dev->udev->dev, "Incompatible driver and firmware" 749eb4fd8cdSElina Pasheva " versions\n"); 750eb4fd8cdSElina Pasheva kfree(priv); 751eb4fd8cdSElina Pasheva return -ENODEV; 752eb4fd8cdSElina Pasheva } 7536f1464bfSElina Pasheva 754eb4fd8cdSElina Pasheva return 0; 755eb4fd8cdSElina Pasheva } 756eb4fd8cdSElina Pasheva 757eb4fd8cdSElina Pasheva static void sierra_net_unbind(struct usbnet *dev, struct usb_interface *intf) 758eb4fd8cdSElina Pasheva { 759eb4fd8cdSElina Pasheva int status; 760eb4fd8cdSElina Pasheva struct sierra_net_data *priv = sierra_net_get_private(dev); 761eb4fd8cdSElina Pasheva 762eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 763eb4fd8cdSElina Pasheva 76423f333a2STejun Heo /* kill the timer and work */ 765eb4fd8cdSElina Pasheva del_timer_sync(&priv->sync_timer); 76623f333a2STejun Heo cancel_work_sync(&priv->sierra_net_kevent); 767eb4fd8cdSElina Pasheva 768eb4fd8cdSElina Pasheva /* tell modem we are going away */ 769eb4fd8cdSElina Pasheva status = sierra_net_send_cmd(dev, priv->shdwn_msg, 770eb4fd8cdSElina Pasheva sizeof(priv->shdwn_msg), "Shutdown"); 771eb4fd8cdSElina Pasheva if (status < 0) 772eb4fd8cdSElina Pasheva netdev_err(dev->net, 773eb4fd8cdSElina Pasheva "usb_control_msg failed, status %d\n", status); 774eb4fd8cdSElina Pasheva 7757b0c5f21SDan Williams usbnet_status_stop(dev); 776eb4fd8cdSElina Pasheva 7777b0c5f21SDan Williams sierra_net_set_private(dev, NULL); 778eb4fd8cdSElina Pasheva kfree(priv); 779eb4fd8cdSElina Pasheva } 780eb4fd8cdSElina Pasheva 781eb4fd8cdSElina Pasheva static struct sk_buff *sierra_net_skb_clone(struct usbnet *dev, 782eb4fd8cdSElina Pasheva struct sk_buff *skb, int len) 783eb4fd8cdSElina Pasheva { 784eb4fd8cdSElina Pasheva struct sk_buff *new_skb; 785eb4fd8cdSElina Pasheva 786eb4fd8cdSElina Pasheva /* clone skb */ 787eb4fd8cdSElina Pasheva new_skb = skb_clone(skb, GFP_ATOMIC); 788eb4fd8cdSElina Pasheva 789eb4fd8cdSElina Pasheva /* remove len bytes from original */ 790eb4fd8cdSElina Pasheva skb_pull(skb, len); 791eb4fd8cdSElina Pasheva 792eb4fd8cdSElina Pasheva /* trim next packet to it's length */ 793eb4fd8cdSElina Pasheva if (new_skb) { 794eb4fd8cdSElina Pasheva skb_trim(new_skb, len); 795eb4fd8cdSElina Pasheva } else { 796eb4fd8cdSElina Pasheva if (netif_msg_rx_err(dev)) 797eb4fd8cdSElina Pasheva netdev_err(dev->net, "failed to get skb\n"); 798eb4fd8cdSElina Pasheva dev->net->stats.rx_dropped++; 799eb4fd8cdSElina Pasheva } 800eb4fd8cdSElina Pasheva 801eb4fd8cdSElina Pasheva return new_skb; 802eb4fd8cdSElina Pasheva } 803eb4fd8cdSElina Pasheva 804eb4fd8cdSElina Pasheva /* ---------------------------- Receive data path ----------------------*/ 805eb4fd8cdSElina Pasheva static int sierra_net_rx_fixup(struct usbnet *dev, struct sk_buff *skb) 806eb4fd8cdSElina Pasheva { 807eb4fd8cdSElina Pasheva int err; 808eb4fd8cdSElina Pasheva struct hip_hdr hh; 809eb4fd8cdSElina Pasheva struct sk_buff *new_skb; 810eb4fd8cdSElina Pasheva 811eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 812eb4fd8cdSElina Pasheva 813eb4fd8cdSElina Pasheva /* could contain multiple packets */ 814eb4fd8cdSElina Pasheva while (likely(skb->len)) { 815eb4fd8cdSElina Pasheva err = parse_hip(skb->data, skb->len, &hh); 816eb4fd8cdSElina Pasheva if (err) { 817eb4fd8cdSElina Pasheva if (netif_msg_rx_err(dev)) 818eb4fd8cdSElina Pasheva netdev_err(dev->net, "Invalid HIP header %d\n", 819eb4fd8cdSElina Pasheva err); 820eb4fd8cdSElina Pasheva /* dev->net->stats.rx_errors incremented by caller */ 821eb4fd8cdSElina Pasheva dev->net->stats.rx_length_errors++; 822eb4fd8cdSElina Pasheva return 0; 823eb4fd8cdSElina Pasheva } 824eb4fd8cdSElina Pasheva 825eb4fd8cdSElina Pasheva /* Validate Extended HIP header */ 826eb4fd8cdSElina Pasheva if (!hh.extmsgid.is_present 827eb4fd8cdSElina Pasheva || hh.extmsgid.word != SIERRA_NET_HIP_EXT_IP_IN_ID) { 828eb4fd8cdSElina Pasheva if (netif_msg_rx_err(dev)) 829eb4fd8cdSElina Pasheva netdev_err(dev->net, "HIP/ETH: Invalid pkt\n"); 830eb4fd8cdSElina Pasheva 831eb4fd8cdSElina Pasheva dev->net->stats.rx_frame_errors++; 832e966c8ecSPeter Senna Tschudin /* dev->net->stats.rx_errors incremented by caller */ 833eb4fd8cdSElina Pasheva return 0; 834eb4fd8cdSElina Pasheva } 835eb4fd8cdSElina Pasheva 836eb4fd8cdSElina Pasheva skb_pull(skb, hh.hdrlen); 837eb4fd8cdSElina Pasheva 8385a70348eSStefan Brüns /* We are going to accept this packet, prepare it. 8395a70348eSStefan Brüns * In case protocol is IPv6, keep it, otherwise force IPv4. 8405a70348eSStefan Brüns */ 8415a70348eSStefan Brüns skb_reset_mac_header(skb); 8425a70348eSStefan Brüns if (eth_hdr(skb)->h_proto != cpu_to_be16(ETH_P_IPV6)) 8435a70348eSStefan Brüns eth_hdr(skb)->h_proto = cpu_to_be16(ETH_P_IP); 8445a70348eSStefan Brüns eth_zero_addr(eth_hdr(skb)->h_source); 8455a70348eSStefan Brüns memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN); 846eb4fd8cdSElina Pasheva 847eb4fd8cdSElina Pasheva /* Last packet in batch handled by usbnet */ 848eb4fd8cdSElina Pasheva if (hh.payload_len.word == skb->len) 849eb4fd8cdSElina Pasheva return 1; 850eb4fd8cdSElina Pasheva 851eb4fd8cdSElina Pasheva new_skb = sierra_net_skb_clone(dev, skb, hh.payload_len.word); 852eb4fd8cdSElina Pasheva if (new_skb) 853eb4fd8cdSElina Pasheva usbnet_skb_return(dev, new_skb); 854eb4fd8cdSElina Pasheva 855eb4fd8cdSElina Pasheva } /* while */ 856eb4fd8cdSElina Pasheva 857eb4fd8cdSElina Pasheva return 0; 858eb4fd8cdSElina Pasheva } 859eb4fd8cdSElina Pasheva 860eb4fd8cdSElina Pasheva /* ---------------------------- Transmit data path ----------------------*/ 8619625e5faSBjørn Mork static struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, 8629625e5faSBjørn Mork struct sk_buff *skb, gfp_t flags) 863eb4fd8cdSElina Pasheva { 864eb4fd8cdSElina Pasheva struct sierra_net_data *priv = sierra_net_get_private(dev); 865eb4fd8cdSElina Pasheva u16 len; 866eb4fd8cdSElina Pasheva bool need_tail; 867eb4fd8cdSElina Pasheva 868d632eb1bSGreg Kroah-Hartman BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data) 869d632eb1bSGreg Kroah-Hartman < sizeof(struct cdc_state)); 870d632eb1bSGreg Kroah-Hartman 871eb4fd8cdSElina Pasheva dev_dbg(&dev->udev->dev, "%s", __func__); 872eb4fd8cdSElina Pasheva if (priv->link_up && check_ethip_packet(skb, dev) && is_ip(skb)) { 873eb4fd8cdSElina Pasheva /* enough head room as is? */ 874eb4fd8cdSElina Pasheva if (SIERRA_NET_HIP_EXT_HDR_LEN <= skb_headroom(skb)) { 875eb4fd8cdSElina Pasheva /* Save the Eth/IP length and set up HIP hdr */ 876eb4fd8cdSElina Pasheva len = skb->len; 877eb4fd8cdSElina Pasheva skb_push(skb, SIERRA_NET_HIP_EXT_HDR_LEN); 878eb4fd8cdSElina Pasheva /* Handle ZLP issue */ 879eb4fd8cdSElina Pasheva need_tail = ((len + SIERRA_NET_HIP_EXT_HDR_LEN) 880eb4fd8cdSElina Pasheva % dev->maxpacket == 0); 881eb4fd8cdSElina Pasheva if (need_tail) { 882eb4fd8cdSElina Pasheva if (unlikely(skb_tailroom(skb) == 0)) { 883eb4fd8cdSElina Pasheva netdev_err(dev->net, "tx_fixup:" 884eb4fd8cdSElina Pasheva "no room for packet\n"); 885eb4fd8cdSElina Pasheva dev_kfree_skb_any(skb); 886eb4fd8cdSElina Pasheva return NULL; 887eb4fd8cdSElina Pasheva } else { 888eb4fd8cdSElina Pasheva skb->data[skb->len] = 0; 889eb4fd8cdSElina Pasheva __skb_put(skb, 1); 890eb4fd8cdSElina Pasheva len = len + 1; 891eb4fd8cdSElina Pasheva } 892eb4fd8cdSElina Pasheva } 893eb4fd8cdSElina Pasheva build_hip(skb->data, len, priv); 894eb4fd8cdSElina Pasheva return skb; 895eb4fd8cdSElina Pasheva } else { 896eb4fd8cdSElina Pasheva /* 897eb4fd8cdSElina Pasheva * compensate in the future if necessary 898eb4fd8cdSElina Pasheva */ 899eb4fd8cdSElina Pasheva netdev_err(dev->net, "tx_fixup: no room for HIP\n"); 900eb4fd8cdSElina Pasheva } /* headroom */ 901eb4fd8cdSElina Pasheva } 902eb4fd8cdSElina Pasheva 903eb4fd8cdSElina Pasheva if (!priv->link_up) 904eb4fd8cdSElina Pasheva dev->net->stats.tx_carrier_errors++; 905eb4fd8cdSElina Pasheva 906eb4fd8cdSElina Pasheva /* tx_dropped incremented by usbnet */ 907eb4fd8cdSElina Pasheva 908eb4fd8cdSElina Pasheva /* filter the packet out, release it */ 909eb4fd8cdSElina Pasheva dev_kfree_skb_any(skb); 910eb4fd8cdSElina Pasheva return NULL; 911eb4fd8cdSElina Pasheva } 912eb4fd8cdSElina Pasheva 913dd03cff2SBjørn Mork static const struct driver_info sierra_net_info_direct_ip = { 914eb4fd8cdSElina Pasheva .description = "Sierra Wireless USB-to-WWAN Modem", 915eb4fd8cdSElina Pasheva .flags = FLAG_WWAN | FLAG_SEND_ZLP, 916eb4fd8cdSElina Pasheva .bind = sierra_net_bind, 917eb4fd8cdSElina Pasheva .unbind = sierra_net_unbind, 918eb4fd8cdSElina Pasheva .status = sierra_net_status, 919eb4fd8cdSElina Pasheva .rx_fixup = sierra_net_rx_fixup, 920eb4fd8cdSElina Pasheva .tx_fixup = sierra_net_tx_fixup, 921eb4fd8cdSElina Pasheva }; 922eb4fd8cdSElina Pasheva 9237b0c5f21SDan Williams static int 9247b0c5f21SDan Williams sierra_net_probe(struct usb_interface *udev, const struct usb_device_id *prod) 9257b0c5f21SDan Williams { 9267b0c5f21SDan Williams int ret; 9277b0c5f21SDan Williams 9287b0c5f21SDan Williams ret = usbnet_probe(udev, prod); 9297b0c5f21SDan Williams if (ret == 0) { 9307b0c5f21SDan Williams struct usbnet *dev = usb_get_intfdata(udev); 9317b0c5f21SDan Williams 9327b0c5f21SDan Williams ret = usbnet_status_start(dev, GFP_KERNEL); 9337b0c5f21SDan Williams if (ret == 0) { 9347b0c5f21SDan Williams /* Interrupt URB now set up; initiate sync sequence */ 9357b0c5f21SDan Williams sierra_net_dosync(dev); 9367b0c5f21SDan Williams } 9377b0c5f21SDan Williams } 9387b0c5f21SDan Williams return ret; 9397b0c5f21SDan Williams } 9407b0c5f21SDan Williams 941aefe5c00SBjørn Mork #define DIRECT_IP_DEVICE(vend, prod) \ 942aefe5c00SBjørn Mork {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 7), \ 943aefe5c00SBjørn Mork .driver_info = (unsigned long)&sierra_net_info_direct_ip}, \ 944aefe5c00SBjørn Mork {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 10), \ 945aefe5c00SBjørn Mork .driver_info = (unsigned long)&sierra_net_info_direct_ip}, \ 946aefe5c00SBjørn Mork {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 11), \ 947aefe5c00SBjørn Mork .driver_info = (unsigned long)&sierra_net_info_direct_ip} 948aefe5c00SBjørn Mork 949eb4fd8cdSElina Pasheva static const struct usb_device_id products[] = { 950aefe5c00SBjørn Mork DIRECT_IP_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ 951aefe5c00SBjørn Mork DIRECT_IP_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */ 952aefe5c00SBjørn Mork DIRECT_IP_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */ 953aefe5c00SBjørn Mork DIRECT_IP_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */ 954eb4fd8cdSElina Pasheva 955eb4fd8cdSElina Pasheva {}, /* last item */ 956eb4fd8cdSElina Pasheva }; 957eb4fd8cdSElina Pasheva MODULE_DEVICE_TABLE(usb, products); 958eb4fd8cdSElina Pasheva 959eb4fd8cdSElina Pasheva /* We are based on usbnet, so let it handle the USB driver specifics */ 960eb4fd8cdSElina Pasheva static struct usb_driver sierra_net_driver = { 961eb4fd8cdSElina Pasheva .name = "sierra_net", 962eb4fd8cdSElina Pasheva .id_table = products, 9637b0c5f21SDan Williams .probe = sierra_net_probe, 964eb4fd8cdSElina Pasheva .disconnect = usbnet_disconnect, 965eb4fd8cdSElina Pasheva .suspend = usbnet_suspend, 966eb4fd8cdSElina Pasheva .resume = usbnet_resume, 967eb4fd8cdSElina Pasheva .no_dynamic_id = 1, 968e1f12eb6SSarah Sharp .disable_hub_initiated_lpm = 1, 969eb4fd8cdSElina Pasheva }; 970eb4fd8cdSElina Pasheva 971d632eb1bSGreg Kroah-Hartman module_usb_driver(sierra_net_driver); 972eb4fd8cdSElina Pasheva 973eb4fd8cdSElina Pasheva MODULE_AUTHOR(DRIVER_AUTHOR); 974eb4fd8cdSElina Pasheva MODULE_DESCRIPTION(DRIVER_DESC); 975eb4fd8cdSElina Pasheva MODULE_VERSION(DRIVER_VERSION); 976eb4fd8cdSElina Pasheva MODULE_LICENSE("GPL"); 977