diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:55:21 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:55:21 -0400 |
commit | bbb20089a3275a19e475dbc21320c3742e3ca423 (patch) | |
tree | 216fdc1cbef450ca688135c5b8969169482d9a48 /drivers/net/usb | |
parent | 3e48e656903e9fd8bc805c6a2c4264d7808d315b (diff) | |
parent | 657a77fa7284d8ae28dfa48f1dc5d919bf5b2843 (diff) |
Merge branch 'dmaengine' into async-tx-next
Conflicts:
crypto/async_tx/async_xor.c
drivers/dma/ioat/dma_v2.h
drivers/dma/ioat/pci.c
drivers/md/raid5.c
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/Kconfig | 12 | ||||
-rw-r--r-- | drivers/net/usb/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/usb/cdc_ether.c | 58 | ||||
-rw-r--r-- | drivers/net/usb/cdc_subset.c | 7 | ||||
-rw-r--r-- | drivers/net/usb/dm9601.c | 12 | ||||
-rw-r--r-- | drivers/net/usb/hso.c | 53 | ||||
-rw-r--r-- | drivers/net/usb/int51x1.c | 253 | ||||
-rw-r--r-- | drivers/net/usb/kaweth.c | 33 | ||||
-rw-r--r-- | drivers/net/usb/pegasus.c | 29 | ||||
-rw-r--r-- | drivers/net/usb/rtl8150.c | 9 | ||||
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 4 | ||||
-rw-r--r-- | drivers/net/usb/usbnet.c | 39 |
12 files changed, 410 insertions, 100 deletions
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index dfc6cf765fbd..a906d3998131 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -169,10 +169,12 @@ config USB_NET_CDCETHER | |||
169 | The Linux-USB CDC Ethernet Gadget driver is an open implementation. | 169 | The Linux-USB CDC Ethernet Gadget driver is an open implementation. |
170 | This driver should work with at least the following devices: | 170 | This driver should work with at least the following devices: |
171 | 171 | ||
172 | * Dell Wireless 5530 HSPA | ||
172 | * Ericsson PipeRider (all variants) | 173 | * Ericsson PipeRider (all variants) |
174 | * Ericsson Mobile Broadband Module (all variants) | ||
173 | * Motorola (DM100 and SB4100) | 175 | * Motorola (DM100 and SB4100) |
174 | * Broadcom Cable Modem (reference design) | 176 | * Broadcom Cable Modem (reference design) |
175 | * Toshiba PCX1100U | 177 | * Toshiba (PCX1100U and F3507g) |
176 | * ... | 178 | * ... |
177 | 179 | ||
178 | This driver creates an interface named "ethX", where X depends on | 180 | This driver creates an interface named "ethX", where X depends on |
@@ -359,4 +361,12 @@ config USB_HSO | |||
359 | To compile this driver as a module, choose M here: the | 361 | To compile this driver as a module, choose M here: the |
360 | module will be called hso. | 362 | module will be called hso. |
361 | 363 | ||
364 | config USB_NET_INT51X1 | ||
365 | tristate "Intellon PLC based usb adapter" | ||
366 | depends on USB_USBNET | ||
367 | help | ||
368 | Choose this option if you're using a 14Mb USB-based PLC | ||
369 | (Powerline Communications) solution with an Intellon | ||
370 | INT51x1/INT5200 chip, like the "devolo dLan duo". | ||
371 | |||
362 | endmenu | 372 | endmenu |
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile index c8aef62cf2b7..b870b0b1cbe0 100644 --- a/drivers/net/usb/Makefile +++ b/drivers/net/usb/Makefile | |||
@@ -20,4 +20,5 @@ obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o | |||
20 | obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o | 20 | obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o |
21 | obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o | 21 | obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o |
22 | obj-$(CONFIG_USB_USBNET) += usbnet.o | 22 | obj-$(CONFIG_USB_USBNET) += usbnet.o |
23 | obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o | ||
23 | 24 | ||
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 55e8ecc3a9e5..4a6aff579403 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
27 | #include <linux/etherdevice.h> | 27 | #include <linux/etherdevice.h> |
28 | #include <linux/ctype.h> | ||
29 | #include <linux/ethtool.h> | 28 | #include <linux/ethtool.h> |
30 | #include <linux/workqueue.h> | 29 | #include <linux/workqueue.h> |
31 | #include <linux/mii.h> | 30 | #include <linux/mii.h> |
@@ -389,36 +388,6 @@ static void cdc_status(struct usbnet *dev, struct urb *urb) | |||
389 | } | 388 | } |
390 | } | 389 | } |
391 | 390 | ||
392 | static u8 nibble(unsigned char c) | ||
393 | { | ||
394 | if (likely(isdigit(c))) | ||
395 | return c - '0'; | ||
396 | c = toupper(c); | ||
397 | if (likely(isxdigit(c))) | ||
398 | return 10 + c - 'A'; | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static inline int | ||
403 | get_ethernet_addr(struct usbnet *dev, struct usb_cdc_ether_desc *e) | ||
404 | { | ||
405 | int tmp, i; | ||
406 | unsigned char buf [13]; | ||
407 | |||
408 | tmp = usb_string(dev->udev, e->iMACAddress, buf, sizeof buf); | ||
409 | if (tmp != 12) { | ||
410 | dev_dbg(&dev->udev->dev, | ||
411 | "bad MAC string %d fetch, %d\n", e->iMACAddress, tmp); | ||
412 | if (tmp >= 0) | ||
413 | tmp = -EINVAL; | ||
414 | return tmp; | ||
415 | } | ||
416 | for (i = tmp = 0; i < 6; i++, tmp += 2) | ||
417 | dev->net->dev_addr [i] = | ||
418 | (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); | ||
419 | return 0; | ||
420 | } | ||
421 | |||
422 | static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) | 391 | static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) |
423 | { | 392 | { |
424 | int status; | 393 | int status; |
@@ -428,7 +397,7 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
428 | if (status < 0) | 397 | if (status < 0) |
429 | return status; | 398 | return status; |
430 | 399 | ||
431 | status = get_ethernet_addr(dev, info->ether); | 400 | status = usbnet_get_ethernet_addr(dev, info->ether->iMACAddress); |
432 | if (status < 0) { | 401 | if (status < 0) { |
433 | usb_set_intfdata(info->data, NULL); | 402 | usb_set_intfdata(info->data, NULL); |
434 | usb_driver_release_interface(driver_of(intf), info->data); | 403 | usb_driver_release_interface(driver_of(intf), info->data); |
@@ -564,6 +533,31 @@ static const struct usb_device_id products [] = { | |||
564 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM, | 533 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM, |
565 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 534 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
566 | .driver_info = (unsigned long) &cdc_info, | 535 | .driver_info = (unsigned long) &cdc_info, |
536 | }, { | ||
537 | /* Ericsson F3507g ver. 2 */ | ||
538 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM, | ||
539 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
540 | .driver_info = (unsigned long) &cdc_info, | ||
541 | }, { | ||
542 | /* Ericsson F3607gw */ | ||
543 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM, | ||
544 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
545 | .driver_info = (unsigned long) &cdc_info, | ||
546 | }, { | ||
547 | /* Ericsson F3307 */ | ||
548 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM, | ||
549 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
550 | .driver_info = (unsigned long) &cdc_info, | ||
551 | }, { | ||
552 | /* Toshiba F3507g */ | ||
553 | USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM, | ||
554 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
555 | .driver_info = (unsigned long) &cdc_info, | ||
556 | }, { | ||
557 | /* Dell F3507g */ | ||
558 | USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM, | ||
559 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
560 | .driver_info = (unsigned long) &cdc_info, | ||
567 | }, | 561 | }, |
568 | { }, // END | 562 | { }, // END |
569 | }; | 563 | }; |
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index c66b9c324f54..ca39ace0b0eb 100644 --- a/drivers/net/usb/cdc_subset.c +++ b/drivers/net/usb/cdc_subset.c | |||
@@ -307,9 +307,10 @@ static const struct usb_device_id products [] = { | |||
307 | USB_DEVICE (0x1286, 0x8001), // "blob" bootloader | 307 | USB_DEVICE (0x1286, 0x8001), // "blob" bootloader |
308 | .driver_info = (unsigned long) &blob_info, | 308 | .driver_info = (unsigned long) &blob_info, |
309 | }, { | 309 | }, { |
310 | // Linux Ethernet/RNDIS gadget on pxa210/25x/26x, second config | 310 | // Linux Ethernet/RNDIS gadget, mostly on PXA, second config |
311 | // e.g. Gumstix, current OpenZaurus, ... | 311 | // e.g. Gumstix, current OpenZaurus, ... or anything else |
312 | USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203), | 312 | // that just enables this gadget option. |
313 | USB_DEVICE (0x0525, 0xa4a2), | ||
313 | .driver_info = (unsigned long) &linuxdev_info, | 314 | .driver_info = (unsigned long) &linuxdev_info, |
314 | }, | 315 | }, |
315 | #endif | 316 | #endif |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 6fc4f82b0beb..7ae82446b93a 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -497,10 +497,10 @@ static int dm9601_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
497 | int len; | 497 | int len; |
498 | 498 | ||
499 | /* format: | 499 | /* format: |
500 | b0: rx status | 500 | b1: rx status |
501 | b1: packet length (incl crc) low | 501 | b2: packet length (incl crc) low |
502 | b2: packet length (incl crc) high | 502 | b3: packet length (incl crc) high |
503 | b3..n-4: packet data | 503 | b4..n-4: packet data |
504 | bn-3..bn: ethernet crc | 504 | bn-3..bn: ethernet crc |
505 | */ | 505 | */ |
506 | 506 | ||
@@ -533,8 +533,8 @@ static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
533 | int len; | 533 | int len; |
534 | 534 | ||
535 | /* format: | 535 | /* format: |
536 | b0: packet length low | 536 | b1: packet length low |
537 | b1: packet length high | 537 | b2: packet length high |
538 | b3..n: packet data | 538 | b3..n: packet data |
539 | */ | 539 | */ |
540 | 540 | ||
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index f84b78d94c40..f8c6d7ea7264 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -482,7 +482,7 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev, | |||
482 | struct device_attribute *attr, | 482 | struct device_attribute *attr, |
483 | char *buf) | 483 | char *buf) |
484 | { | 484 | { |
485 | struct hso_device *hso_dev = dev->driver_data; | 485 | struct hso_device *hso_dev = dev_get_drvdata(dev); |
486 | char *port_name; | 486 | char *port_name; |
487 | 487 | ||
488 | if (!hso_dev) | 488 | if (!hso_dev) |
@@ -816,7 +816,7 @@ static int hso_net_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
816 | } | 816 | } |
817 | dev_kfree_skb(skb); | 817 | dev_kfree_skb(skb); |
818 | /* we're done */ | 818 | /* we're done */ |
819 | return result; | 819 | return NETDEV_TX_OK; |
820 | } | 820 | } |
821 | 821 | ||
822 | static void hso_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) | 822 | static void hso_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) |
@@ -899,15 +899,14 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, | |||
899 | continue; | 899 | continue; |
900 | } | 900 | } |
901 | /* Allocate an sk_buff */ | 901 | /* Allocate an sk_buff */ |
902 | odev->skb_rx_buf = dev_alloc_skb(frame_len); | 902 | odev->skb_rx_buf = netdev_alloc_skb(odev->net, |
903 | frame_len); | ||
903 | if (!odev->skb_rx_buf) { | 904 | if (!odev->skb_rx_buf) { |
904 | /* We got no receive buffer. */ | 905 | /* We got no receive buffer. */ |
905 | D1("could not allocate memory"); | 906 | D1("could not allocate memory"); |
906 | odev->rx_parse_state = WAIT_SYNC; | 907 | odev->rx_parse_state = WAIT_SYNC; |
907 | return; | 908 | return; |
908 | } | 909 | } |
909 | /* Here's where it came from */ | ||
910 | odev->skb_rx_buf->dev = odev->net; | ||
911 | 910 | ||
912 | /* Copy what we got so far. make room for iphdr | 911 | /* Copy what we got so far. make room for iphdr |
913 | * after tail. */ | 912 | * after tail. */ |
@@ -2313,7 +2312,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, | |||
2313 | serial->parent->dev = tty_register_device(tty_drv, minor, | 2312 | serial->parent->dev = tty_register_device(tty_drv, minor, |
2314 | &serial->parent->interface->dev); | 2313 | &serial->parent->interface->dev); |
2315 | dev = serial->parent->dev; | 2314 | dev = serial->parent->dev; |
2316 | dev->driver_data = serial->parent; | 2315 | dev_set_drvdata(dev, serial->parent); |
2317 | i = device_create_file(dev, &dev_attr_hsotype); | 2316 | i = device_create_file(dev, &dev_attr_hsotype); |
2318 | 2317 | ||
2319 | /* fill in specific data for later use */ | 2318 | /* fill in specific data for later use */ |
@@ -2481,10 +2480,10 @@ static int add_net_device(struct hso_device *hso_dev) | |||
2481 | return 0; | 2480 | return 0; |
2482 | } | 2481 | } |
2483 | 2482 | ||
2484 | static int hso_radio_toggle(void *data, enum rfkill_state state) | 2483 | static int hso_rfkill_set_block(void *data, bool blocked) |
2485 | { | 2484 | { |
2486 | struct hso_device *hso_dev = data; | 2485 | struct hso_device *hso_dev = data; |
2487 | int enabled = (state == RFKILL_STATE_ON); | 2486 | int enabled = !blocked; |
2488 | int rv; | 2487 | int rv; |
2489 | 2488 | ||
2490 | mutex_lock(&hso_dev->mutex); | 2489 | mutex_lock(&hso_dev->mutex); |
@@ -2498,6 +2497,10 @@ static int hso_radio_toggle(void *data, enum rfkill_state state) | |||
2498 | return rv; | 2497 | return rv; |
2499 | } | 2498 | } |
2500 | 2499 | ||
2500 | static const struct rfkill_ops hso_rfkill_ops = { | ||
2501 | .set_block = hso_rfkill_set_block, | ||
2502 | }; | ||
2503 | |||
2501 | /* Creates and sets up everything for rfkill */ | 2504 | /* Creates and sets up everything for rfkill */ |
2502 | static void hso_create_rfkill(struct hso_device *hso_dev, | 2505 | static void hso_create_rfkill(struct hso_device *hso_dev, |
2503 | struct usb_interface *interface) | 2506 | struct usb_interface *interface) |
@@ -2506,29 +2509,25 @@ static void hso_create_rfkill(struct hso_device *hso_dev, | |||
2506 | struct device *dev = &hso_net->net->dev; | 2509 | struct device *dev = &hso_net->net->dev; |
2507 | char *rfkn; | 2510 | char *rfkn; |
2508 | 2511 | ||
2509 | hso_net->rfkill = rfkill_allocate(&interface_to_usbdev(interface)->dev, | ||
2510 | RFKILL_TYPE_WWAN); | ||
2511 | if (!hso_net->rfkill) { | ||
2512 | dev_err(dev, "%s - Out of memory\n", __func__); | ||
2513 | return; | ||
2514 | } | ||
2515 | rfkn = kzalloc(20, GFP_KERNEL); | 2512 | rfkn = kzalloc(20, GFP_KERNEL); |
2516 | if (!rfkn) { | 2513 | if (!rfkn) |
2517 | rfkill_free(hso_net->rfkill); | ||
2518 | hso_net->rfkill = NULL; | ||
2519 | dev_err(dev, "%s - Out of memory\n", __func__); | 2514 | dev_err(dev, "%s - Out of memory\n", __func__); |
2520 | return; | 2515 | |
2521 | } | ||
2522 | snprintf(rfkn, 20, "hso-%d", | 2516 | snprintf(rfkn, 20, "hso-%d", |
2523 | interface->altsetting->desc.bInterfaceNumber); | 2517 | interface->altsetting->desc.bInterfaceNumber); |
2524 | hso_net->rfkill->name = rfkn; | 2518 | |
2525 | hso_net->rfkill->state = RFKILL_STATE_ON; | 2519 | hso_net->rfkill = rfkill_alloc(rfkn, |
2526 | hso_net->rfkill->data = hso_dev; | 2520 | &interface_to_usbdev(interface)->dev, |
2527 | hso_net->rfkill->toggle_radio = hso_radio_toggle; | 2521 | RFKILL_TYPE_WWAN, |
2522 | &hso_rfkill_ops, hso_dev); | ||
2523 | if (!hso_net->rfkill) { | ||
2524 | dev_err(dev, "%s - Out of memory\n", __func__); | ||
2525 | kfree(rfkn); | ||
2526 | return; | ||
2527 | } | ||
2528 | if (rfkill_register(hso_net->rfkill) < 0) { | 2528 | if (rfkill_register(hso_net->rfkill) < 0) { |
2529 | rfkill_destroy(hso_net->rfkill); | ||
2529 | kfree(rfkn); | 2530 | kfree(rfkn); |
2530 | hso_net->rfkill->name = NULL; | ||
2531 | rfkill_free(hso_net->rfkill); | ||
2532 | hso_net->rfkill = NULL; | 2531 | hso_net->rfkill = NULL; |
2533 | dev_err(dev, "%s - Failed to register rfkill\n", __func__); | 2532 | dev_err(dev, "%s - Failed to register rfkill\n", __func__); |
2534 | return; | 2533 | return; |
@@ -3165,8 +3164,10 @@ static void hso_free_interface(struct usb_interface *interface) | |||
3165 | hso_stop_net_device(network_table[i]); | 3164 | hso_stop_net_device(network_table[i]); |
3166 | cancel_work_sync(&network_table[i]->async_put_intf); | 3165 | cancel_work_sync(&network_table[i]->async_put_intf); |
3167 | cancel_work_sync(&network_table[i]->async_get_intf); | 3166 | cancel_work_sync(&network_table[i]->async_get_intf); |
3168 | if (rfk) | 3167 | if (rfk) { |
3169 | rfkill_unregister(rfk); | 3168 | rfkill_unregister(rfk); |
3169 | rfkill_destroy(rfk); | ||
3170 | } | ||
3170 | hso_free_net_device(network_table[i]); | 3171 | hso_free_net_device(network_table[i]); |
3171 | } | 3172 | } |
3172 | } | 3173 | } |
diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c new file mode 100644 index 000000000000..55cf7081de10 --- /dev/null +++ b/drivers/net/usb/int51x1.c | |||
@@ -0,0 +1,253 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2009 Peter Holik | ||
3 | * | ||
4 | * Intellon usb PLC (Powerline Communications) usb net driver | ||
5 | * | ||
6 | * http://www.tandel.be/downloads/INT51X1_Datasheet.pdf | ||
7 | * | ||
8 | * Based on the work of Jan 'RedBully' Seiffert | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or. | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/ctype.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/etherdevice.h> | ||
31 | #include <linux/ethtool.h> | ||
32 | #include <linux/mii.h> | ||
33 | #include <linux/usb.h> | ||
34 | #include <linux/usb/usbnet.h> | ||
35 | |||
36 | #define INT51X1_VENDOR_ID 0x09e1 | ||
37 | #define INT51X1_PRODUCT_ID 0x5121 | ||
38 | |||
39 | #define INT51X1_HEADER_SIZE 2 /* 2 byte header */ | ||
40 | |||
41 | #define PACKET_TYPE_PROMISCUOUS (1 << 0) | ||
42 | #define PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */ | ||
43 | #define PACKET_TYPE_DIRECTED (1 << 2) | ||
44 | #define PACKET_TYPE_BROADCAST (1 << 3) | ||
45 | #define PACKET_TYPE_MULTICAST (1 << 4) /* filtered */ | ||
46 | |||
47 | #define SET_ETHERNET_PACKET_FILTER 0x43 | ||
48 | |||
49 | static int int51x1_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
50 | { | ||
51 | int len; | ||
52 | |||
53 | if (!(pskb_may_pull(skb, INT51X1_HEADER_SIZE))) { | ||
54 | deverr(dev, "unexpected tiny rx frame"); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | len = le16_to_cpu(*(__le16 *)&skb->data[skb->len - 2]); | ||
59 | |||
60 | skb_trim(skb, len); | ||
61 | |||
62 | return 1; | ||
63 | } | ||
64 | |||
65 | static struct sk_buff *int51x1_tx_fixup(struct usbnet *dev, | ||
66 | struct sk_buff *skb, gfp_t flags) | ||
67 | { | ||
68 | int pack_len = skb->len; | ||
69 | int pack_with_header_len = pack_len + INT51X1_HEADER_SIZE; | ||
70 | int headroom = skb_headroom(skb); | ||
71 | int tailroom = skb_tailroom(skb); | ||
72 | int need_tail = 0; | ||
73 | __le16 *len; | ||
74 | |||
75 | /* if packet and our header is smaler than 64 pad to 64 (+ ZLP) */ | ||
76 | if ((pack_with_header_len) < dev->maxpacket) | ||
77 | need_tail = dev->maxpacket - pack_with_header_len + 1; | ||
78 | /* | ||
79 | * usbnet would send a ZLP if packetlength mod urbsize == 0 for us, | ||
80 | * but we need to know ourself, because this would add to the length | ||
81 | * we send down to the device... | ||
82 | */ | ||
83 | else if (!(pack_with_header_len % dev->maxpacket)) | ||
84 | need_tail = 1; | ||
85 | |||
86 | if (!skb_cloned(skb) && | ||
87 | (headroom + tailroom >= need_tail + INT51X1_HEADER_SIZE)) { | ||
88 | if (headroom < INT51X1_HEADER_SIZE || tailroom < need_tail) { | ||
89 | skb->data = memmove(skb->head + INT51X1_HEADER_SIZE, | ||
90 | skb->data, skb->len); | ||
91 | skb_set_tail_pointer(skb, skb->len); | ||
92 | } | ||
93 | } else { | ||
94 | struct sk_buff *skb2; | ||
95 | |||
96 | skb2 = skb_copy_expand(skb, | ||
97 | INT51X1_HEADER_SIZE, | ||
98 | need_tail, | ||
99 | flags); | ||
100 | dev_kfree_skb_any(skb); | ||
101 | if (!skb2) | ||
102 | return NULL; | ||
103 | skb = skb2; | ||
104 | } | ||
105 | |||
106 | pack_len += need_tail; | ||
107 | pack_len &= 0x07ff; | ||
108 | |||
109 | len = (__le16 *) __skb_push(skb, INT51X1_HEADER_SIZE); | ||
110 | *len = cpu_to_le16(pack_len); | ||
111 | |||
112 | if(need_tail) | ||
113 | memset(__skb_put(skb, need_tail), 0, need_tail); | ||
114 | |||
115 | return skb; | ||
116 | } | ||
117 | |||
118 | static void int51x1_async_cmd_callback(struct urb *urb) | ||
119 | { | ||
120 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; | ||
121 | int status = urb->status; | ||
122 | |||
123 | if (status < 0) | ||
124 | dev_warn(&urb->dev->dev, "async callback failed with %d\n", status); | ||
125 | |||
126 | kfree(req); | ||
127 | usb_free_urb(urb); | ||
128 | } | ||
129 | |||
130 | static void int51x1_set_multicast(struct net_device *netdev) | ||
131 | { | ||
132 | struct usb_ctrlrequest *req; | ||
133 | int status; | ||
134 | struct urb *urb; | ||
135 | struct usbnet *dev = netdev_priv(netdev); | ||
136 | u16 filter = PACKET_TYPE_DIRECTED | PACKET_TYPE_BROADCAST; | ||
137 | |||
138 | if (netdev->flags & IFF_PROMISC) { | ||
139 | /* do not expect to see traffic of other PLCs */ | ||
140 | filter |= PACKET_TYPE_PROMISCUOUS; | ||
141 | devinfo(dev, "promiscuous mode enabled"); | ||
142 | } else if (netdev->mc_count || | ||
143 | (netdev->flags & IFF_ALLMULTI)) { | ||
144 | filter |= PACKET_TYPE_ALL_MULTICAST; | ||
145 | devdbg(dev, "receive all multicast enabled"); | ||
146 | } else { | ||
147 | /* ~PROMISCUOUS, ~MULTICAST */ | ||
148 | devdbg(dev, "receive own packets only"); | ||
149 | } | ||
150 | |||
151 | urb = usb_alloc_urb(0, GFP_ATOMIC); | ||
152 | if (!urb) { | ||
153 | devwarn(dev, "Error allocating URB"); | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | req = kmalloc(sizeof(*req), GFP_ATOMIC); | ||
158 | if (!req) { | ||
159 | devwarn(dev, "Error allocating control msg"); | ||
160 | goto out; | ||
161 | } | ||
162 | |||
163 | req->bRequestType = USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE; | ||
164 | req->bRequest = SET_ETHERNET_PACKET_FILTER; | ||
165 | req->wValue = cpu_to_le16(filter); | ||
166 | req->wIndex = 0; | ||
167 | req->wLength = 0; | ||
168 | |||
169 | usb_fill_control_urb(urb, dev->udev, usb_sndctrlpipe(dev->udev, 0), | ||
170 | (void *)req, NULL, 0, | ||
171 | int51x1_async_cmd_callback, | ||
172 | (void *)req); | ||
173 | |||
174 | status = usb_submit_urb(urb, GFP_ATOMIC); | ||
175 | if (status < 0) { | ||
176 | devwarn(dev, "Error submitting control msg, sts=%d", status); | ||
177 | goto out1; | ||
178 | } | ||
179 | return; | ||
180 | out1: | ||
181 | kfree(req); | ||
182 | out: | ||
183 | usb_free_urb(urb); | ||
184 | } | ||
185 | |||
186 | static const struct net_device_ops int51x1_netdev_ops = { | ||
187 | .ndo_open = usbnet_open, | ||
188 | .ndo_stop = usbnet_stop, | ||
189 | .ndo_start_xmit = usbnet_start_xmit, | ||
190 | .ndo_tx_timeout = usbnet_tx_timeout, | ||
191 | .ndo_change_mtu = usbnet_change_mtu, | ||
192 | .ndo_set_mac_address = eth_mac_addr, | ||
193 | .ndo_validate_addr = eth_validate_addr, | ||
194 | .ndo_set_multicast_list = int51x1_set_multicast, | ||
195 | }; | ||
196 | |||
197 | static int int51x1_bind(struct usbnet *dev, struct usb_interface *intf) | ||
198 | { | ||
199 | int status = usbnet_get_ethernet_addr(dev, 3); | ||
200 | |||
201 | if (status) | ||
202 | return status; | ||
203 | |||
204 | dev->net->hard_header_len += INT51X1_HEADER_SIZE; | ||
205 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
206 | dev->net->netdev_ops = &int51x1_netdev_ops; | ||
207 | |||
208 | return usbnet_get_endpoints(dev, intf); | ||
209 | } | ||
210 | |||
211 | static const struct driver_info int51x1_info = { | ||
212 | .description = "Intellon usb powerline adapter", | ||
213 | .bind = int51x1_bind, | ||
214 | .rx_fixup = int51x1_rx_fixup, | ||
215 | .tx_fixup = int51x1_tx_fixup, | ||
216 | .in = 1, | ||
217 | .out = 2, | ||
218 | .flags = FLAG_ETHER, | ||
219 | }; | ||
220 | |||
221 | static const struct usb_device_id products[] = { | ||
222 | { | ||
223 | USB_DEVICE(INT51X1_VENDOR_ID, INT51X1_PRODUCT_ID), | ||
224 | .driver_info = (unsigned long) &int51x1_info, | ||
225 | }, | ||
226 | {}, | ||
227 | }; | ||
228 | MODULE_DEVICE_TABLE(usb, products); | ||
229 | |||
230 | static struct usb_driver int51x1_driver = { | ||
231 | .name = "int51x1", | ||
232 | .id_table = products, | ||
233 | .probe = usbnet_probe, | ||
234 | .disconnect = usbnet_disconnect, | ||
235 | .suspend = usbnet_suspend, | ||
236 | .resume = usbnet_resume, | ||
237 | }; | ||
238 | |||
239 | static int __init int51x1_init(void) | ||
240 | { | ||
241 | return usb_register(&int51x1_driver); | ||
242 | } | ||
243 | module_init(int51x1_init); | ||
244 | |||
245 | static void __exit int51x1_exit(void) | ||
246 | { | ||
247 | usb_deregister(&int51x1_driver); | ||
248 | } | ||
249 | module_exit(int51x1_exit); | ||
250 | |||
251 | MODULE_AUTHOR("Peter Holik"); | ||
252 | MODULE_DESCRIPTION("Intellon usb powerline adapter"); | ||
253 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 3d0d0b0b37c5..e01314789718 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -31,7 +31,6 @@ | |||
31 | ****************************************************************/ | 31 | ****************************************************************/ |
32 | 32 | ||
33 | /* TODO: | 33 | /* TODO: |
34 | * Fix in_interrupt() problem | ||
35 | * Develop test procedures for USB net interfaces | 34 | * Develop test procedures for USB net interfaces |
36 | * Run test procedures | 35 | * Run test procedures |
37 | * Fix bugs from previous two steps | 36 | * Fix bugs from previous two steps |
@@ -606,14 +605,30 @@ static void kaweth_usb_receive(struct urb *urb) | |||
606 | 605 | ||
607 | struct sk_buff *skb; | 606 | struct sk_buff *skb; |
608 | 607 | ||
609 | if(unlikely(status == -ECONNRESET || status == -ESHUTDOWN)) | 608 | if (unlikely(status == -EPIPE)) { |
610 | /* we are killed - set a flag and wake the disconnect handler */ | 609 | kaweth->stats.rx_errors++; |
611 | { | ||
612 | kaweth->end = 1; | 610 | kaweth->end = 1; |
613 | wake_up(&kaweth->term_wait); | 611 | wake_up(&kaweth->term_wait); |
612 | dbg("Status was -EPIPE."); | ||
614 | return; | 613 | return; |
615 | } | 614 | } |
616 | 615 | if (unlikely(status == -ECONNRESET || status == -ESHUTDOWN)) { | |
616 | /* we are killed - set a flag and wake the disconnect handler */ | ||
617 | kaweth->end = 1; | ||
618 | wake_up(&kaweth->term_wait); | ||
619 | dbg("Status was -ECONNRESET or -ESHUTDOWN."); | ||
620 | return; | ||
621 | } | ||
622 | if (unlikely(status == -EPROTO || status == -ETIME || | ||
623 | status == -EILSEQ)) { | ||
624 | kaweth->stats.rx_errors++; | ||
625 | dbg("Status was -EPROTO, -ETIME, or -EILSEQ."); | ||
626 | return; | ||
627 | } | ||
628 | if (unlikely(status == -EOVERFLOW)) { | ||
629 | kaweth->stats.rx_errors++; | ||
630 | dbg("Status was -EOVERFLOW."); | ||
631 | } | ||
617 | spin_lock(&kaweth->device_lock); | 632 | spin_lock(&kaweth->device_lock); |
618 | if (IS_BLOCKED(kaweth->status)) { | 633 | if (IS_BLOCKED(kaweth->status)) { |
619 | spin_unlock(&kaweth->device_lock); | 634 | spin_unlock(&kaweth->device_lock); |
@@ -883,13 +898,16 @@ static void kaweth_set_rx_mode(struct net_device *net) | |||
883 | ****************************************************************/ | 898 | ****************************************************************/ |
884 | static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth) | 899 | static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth) |
885 | { | 900 | { |
901 | int result; | ||
886 | __u16 packet_filter_bitmap = kaweth->packet_filter_bitmap; | 902 | __u16 packet_filter_bitmap = kaweth->packet_filter_bitmap; |
903 | |||
887 | kaweth->packet_filter_bitmap = 0; | 904 | kaweth->packet_filter_bitmap = 0; |
888 | if (packet_filter_bitmap == 0) | 905 | if (packet_filter_bitmap == 0) |
889 | return; | 906 | return; |
890 | 907 | ||
891 | { | 908 | if (in_interrupt()) |
892 | int result; | 909 | return; |
910 | |||
893 | result = kaweth_control(kaweth, | 911 | result = kaweth_control(kaweth, |
894 | usb_sndctrlpipe(kaweth->dev, 0), | 912 | usb_sndctrlpipe(kaweth->dev, 0), |
895 | KAWETH_COMMAND_SET_PACKET_FILTER, | 913 | KAWETH_COMMAND_SET_PACKET_FILTER, |
@@ -906,7 +924,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth) | |||
906 | else { | 924 | else { |
907 | dbg("Set Rx mode to %d", packet_filter_bitmap); | 925 | dbg("Set Rx mode to %d", packet_filter_bitmap); |
908 | } | 926 | } |
909 | } | ||
910 | } | 927 | } |
911 | 928 | ||
912 | /**************************************************************** | 929 | /**************************************************************** |
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index 2138535f2339..73acbd244aa1 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -297,7 +297,7 @@ static int update_eth_regs_async(pegasus_t * pegasus) | |||
297 | 297 | ||
298 | pegasus->dr.bRequestType = PEGASUS_REQT_WRITE; | 298 | pegasus->dr.bRequestType = PEGASUS_REQT_WRITE; |
299 | pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS; | 299 | pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS; |
300 | pegasus->dr.wValue = 0; | 300 | pegasus->dr.wValue = cpu_to_le16(0); |
301 | pegasus->dr.wIndex = cpu_to_le16(EthCtrl0); | 301 | pegasus->dr.wIndex = cpu_to_le16(EthCtrl0); |
302 | pegasus->dr.wLength = cpu_to_le16(3); | 302 | pegasus->dr.wLength = cpu_to_le16(3); |
303 | pegasus->ctrl_urb->transfer_buffer_length = 3; | 303 | pegasus->ctrl_urb->transfer_buffer_length = 3; |
@@ -446,11 +446,12 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data) | |||
446 | int i; | 446 | int i; |
447 | __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE }; | 447 | __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE }; |
448 | int ret; | 448 | int ret; |
449 | __le16 le_data = cpu_to_le16(data); | ||
449 | 450 | ||
450 | set_registers(pegasus, EpromOffset, 4, d); | 451 | set_registers(pegasus, EpromOffset, 4, d); |
451 | enable_eprom_write(pegasus); | 452 | enable_eprom_write(pegasus); |
452 | set_register(pegasus, EpromOffset, index); | 453 | set_register(pegasus, EpromOffset, index); |
453 | set_registers(pegasus, EpromData, 2, &data); | 454 | set_registers(pegasus, EpromData, 2, &le_data); |
454 | set_register(pegasus, EpromCtrl, EPROM_WRITE); | 455 | set_register(pegasus, EpromCtrl, EPROM_WRITE); |
455 | 456 | ||
456 | for (i = 0; i < REG_TIMEOUT; i++) { | 457 | for (i = 0; i < REG_TIMEOUT; i++) { |
@@ -923,29 +924,32 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev) | |||
923 | 924 | ||
924 | static inline void disable_net_traffic(pegasus_t * pegasus) | 925 | static inline void disable_net_traffic(pegasus_t * pegasus) |
925 | { | 926 | { |
926 | int tmp = 0; | 927 | __le16 tmp = cpu_to_le16(0); |
927 | 928 | ||
928 | set_registers(pegasus, EthCtrl0, 2, &tmp); | 929 | set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp); |
929 | } | 930 | } |
930 | 931 | ||
931 | static inline void get_interrupt_interval(pegasus_t * pegasus) | 932 | static inline void get_interrupt_interval(pegasus_t * pegasus) |
932 | { | 933 | { |
933 | __u8 data[2]; | 934 | u16 data; |
935 | u8 interval; | ||
934 | 936 | ||
935 | read_eprom_word(pegasus, 4, (__u16 *) data); | 937 | read_eprom_word(pegasus, 4, &data); |
938 | interval = data >> 8; | ||
936 | if (pegasus->usb->speed != USB_SPEED_HIGH) { | 939 | if (pegasus->usb->speed != USB_SPEED_HIGH) { |
937 | if (data[1] < 0x80) { | 940 | if (interval < 0x80) { |
938 | if (netif_msg_timer(pegasus)) | 941 | if (netif_msg_timer(pegasus)) |
939 | dev_info(&pegasus->intf->dev, "intr interval " | 942 | dev_info(&pegasus->intf->dev, "intr interval " |
940 | "changed from %ums to %ums\n", | 943 | "changed from %ums to %ums\n", |
941 | data[1], 0x80); | 944 | interval, 0x80); |
942 | data[1] = 0x80; | 945 | interval = 0x80; |
946 | data = (data & 0x00FF) | ((u16)interval << 8); | ||
943 | #ifdef PEGASUS_WRITE_EEPROM | 947 | #ifdef PEGASUS_WRITE_EEPROM |
944 | write_eprom_word(pegasus, 4, *(__u16 *) data); | 948 | write_eprom_word(pegasus, 4, data); |
945 | #endif | 949 | #endif |
946 | } | 950 | } |
947 | } | 951 | } |
948 | pegasus->intr_interval = data[1]; | 952 | pegasus->intr_interval = interval; |
949 | } | 953 | } |
950 | 954 | ||
951 | static void set_carrier(struct net_device *net) | 955 | static void set_carrier(struct net_device *net) |
@@ -1299,7 +1303,8 @@ static int pegasus_blacklisted(struct usb_device *udev) | |||
1299 | /* Special quirk to keep the driver from handling the Belkin Bluetooth | 1303 | /* Special quirk to keep the driver from handling the Belkin Bluetooth |
1300 | * dongle which happens to have the same ID. | 1304 | * dongle which happens to have the same ID. |
1301 | */ | 1305 | */ |
1302 | if ((udd->idVendor == VENDOR_BELKIN && udd->idProduct == 0x0121) && | 1306 | if ((udd->idVendor == cpu_to_le16(VENDOR_BELKIN)) && |
1307 | (udd->idProduct == cpu_to_le16(0x0121)) && | ||
1303 | (udd->bDeviceClass == USB_CLASS_WIRELESS_CONTROLLER) && | 1308 | (udd->bDeviceClass == USB_CLASS_WIRELESS_CONTROLLER) && |
1304 | (udd->bDeviceProtocol == 1)) | 1309 | (udd->bDeviceProtocol == 1)) |
1305 | return 1; | 1310 | return 1; |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index f9fb454ffa8b..fcc6fa0905d1 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -221,7 +221,8 @@ static void ctrl_callback(struct urb *urb) | |||
221 | case -ENOENT: | 221 | case -ENOENT: |
222 | break; | 222 | break; |
223 | default: | 223 | default: |
224 | dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status); | 224 | if (printk_ratelimit()) |
225 | dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status); | ||
225 | } | 226 | } |
226 | dev = urb->context; | 227 | dev = urb->context; |
227 | clear_bit(RX_REG_SET, &dev->flags); | 228 | clear_bit(RX_REG_SET, &dev->flags); |
@@ -442,10 +443,12 @@ static void read_bulk_callback(struct urb *urb) | |||
442 | case -ENOENT: | 443 | case -ENOENT: |
443 | return; /* the urb is in unlink state */ | 444 | return; /* the urb is in unlink state */ |
444 | case -ETIME: | 445 | case -ETIME: |
445 | dev_warn(&urb->dev->dev, "may be reset is needed?..\n"); | 446 | if (printk_ratelimit()) |
447 | dev_warn(&urb->dev->dev, "may be reset is needed?..\n"); | ||
446 | goto goon; | 448 | goto goon; |
447 | default: | 449 | default: |
448 | dev_warn(&urb->dev->dev, "Rx status %d\n", status); | 450 | if (printk_ratelimit()) |
451 | dev_warn(&urb->dev->dev, "Rx status %d\n", status); | ||
449 | goto goon; | 452 | goto goon; |
450 | } | 453 | } |
451 | 454 | ||
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 5a7283372b53..89a91f8c22de 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -1134,7 +1134,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
1134 | if (skb->len == size) { | 1134 | if (skb->len == size) { |
1135 | if (pdata->use_rx_csum) | 1135 | if (pdata->use_rx_csum) |
1136 | smsc95xx_rx_csum_offload(skb); | 1136 | smsc95xx_rx_csum_offload(skb); |
1137 | 1137 | skb_trim(skb, skb->len - 4); /* remove fcs */ | |
1138 | skb->truesize = size + sizeof(struct sk_buff); | 1138 | skb->truesize = size + sizeof(struct sk_buff); |
1139 | 1139 | ||
1140 | return 1; | 1140 | return 1; |
@@ -1152,7 +1152,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
1152 | 1152 | ||
1153 | if (pdata->use_rx_csum) | 1153 | if (pdata->use_rx_csum) |
1154 | smsc95xx_rx_csum_offload(ax_skb); | 1154 | smsc95xx_rx_csum_offload(ax_skb); |
1155 | 1155 | skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ | |
1156 | ax_skb->truesize = size + sizeof(struct sk_buff); | 1156 | ax_skb->truesize = size + sizeof(struct sk_buff); |
1157 | 1157 | ||
1158 | usbnet_skb_return(dev, ax_skb); | 1158 | usbnet_skb_return(dev, ax_skb); |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index f3a2fce6166c..22c0585a0319 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
39 | #include <linux/etherdevice.h> | 39 | #include <linux/etherdevice.h> |
40 | #include <linux/ctype.h> | ||
40 | #include <linux/ethtool.h> | 41 | #include <linux/ethtool.h> |
41 | #include <linux/workqueue.h> | 42 | #include <linux/workqueue.h> |
42 | #include <linux/mii.h> | 43 | #include <linux/mii.h> |
@@ -156,6 +157,36 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf) | |||
156 | } | 157 | } |
157 | EXPORT_SYMBOL_GPL(usbnet_get_endpoints); | 158 | EXPORT_SYMBOL_GPL(usbnet_get_endpoints); |
158 | 159 | ||
160 | static u8 nibble(unsigned char c) | ||
161 | { | ||
162 | if (likely(isdigit(c))) | ||
163 | return c - '0'; | ||
164 | c = toupper(c); | ||
165 | if (likely(isxdigit(c))) | ||
166 | return 10 + c - 'A'; | ||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress) | ||
171 | { | ||
172 | int tmp, i; | ||
173 | unsigned char buf [13]; | ||
174 | |||
175 | tmp = usb_string(dev->udev, iMACAddress, buf, sizeof buf); | ||
176 | if (tmp != 12) { | ||
177 | dev_dbg(&dev->udev->dev, | ||
178 | "bad MAC string %d fetch, %d\n", iMACAddress, tmp); | ||
179 | if (tmp >= 0) | ||
180 | tmp = -EINVAL; | ||
181 | return tmp; | ||
182 | } | ||
183 | for (i = tmp = 0; i < 6; i++, tmp += 2) | ||
184 | dev->net->dev_addr [i] = | ||
185 | (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); | ||
186 | return 0; | ||
187 | } | ||
188 | EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr); | ||
189 | |||
159 | static void intr_complete (struct urb *urb); | 190 | static void intr_complete (struct urb *urb); |
160 | 191 | ||
161 | static int init_status (struct usbnet *dev, struct usb_interface *intf) | 192 | static int init_status (struct usbnet *dev, struct usb_interface *intf) |
@@ -398,7 +429,7 @@ static void rx_complete (struct urb *urb) | |||
398 | 429 | ||
399 | /* stalls need manual reset. this is rare ... except that | 430 | /* stalls need manual reset. this is rare ... except that |
400 | * when going through USB 2.0 TTs, unplug appears this way. | 431 | * when going through USB 2.0 TTs, unplug appears this way. |
401 | * we avoid the highspeed version of the ETIMEOUT/EILSEQ | 432 | * we avoid the highspeed version of the ETIMEDOUT/EILSEQ |
402 | * storm, recovering as needed. | 433 | * storm, recovering as needed. |
403 | */ | 434 | */ |
404 | case -EPIPE: | 435 | case -EPIPE: |
@@ -1185,12 +1216,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1185 | #endif | 1216 | #endif |
1186 | 1217 | ||
1187 | net->netdev_ops = &usbnet_netdev_ops; | 1218 | net->netdev_ops = &usbnet_netdev_ops; |
1188 | #ifdef CONFIG_COMPAT_NET_DEV_OPS | ||
1189 | net->hard_start_xmit = usbnet_start_xmit; | ||
1190 | net->open = usbnet_open; | ||
1191 | net->stop = usbnet_stop; | ||
1192 | net->tx_timeout = usbnet_tx_timeout; | ||
1193 | #endif | ||
1194 | net->watchdog_timeo = TX_TIMEOUT_JIFFIES; | 1219 | net->watchdog_timeo = TX_TIMEOUT_JIFFIES; |
1195 | net->ethtool_ops = &usbnet_ethtool_ops; | 1220 | net->ethtool_ops = &usbnet_ethtool_ops; |
1196 | 1221 | ||