From: Albert H. <he...@us...> - 2009-10-25 18:57:08
|
Update of /cvsroot/gc-linux/linux/drivers/net/usb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32669/drivers/net/usb Modified Files: usbnet.c Log Message: Forward to v2.6.31. Index: usbnet.c =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/net/usb/usbnet.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** usbnet.c 25 Oct 2009 18:53:45 -0000 1.7 --- usbnet.c 25 Oct 2009 18:56:56 -0000 1.8 *************** *** 38,41 **** --- 38,42 ---- #include <linux/netdevice.h> #include <linux/etherdevice.h> + #include <linux/ctype.h> #include <linux/ethtool.h> #include <linux/workqueue.h> *************** *** 157,160 **** --- 158,191 ---- EXPORT_SYMBOL_GPL(usbnet_get_endpoints); + static u8 nibble(unsigned char c) + { + if (likely(isdigit(c))) + return c - '0'; + c = toupper(c); + if (likely(isxdigit(c))) + return 10 + c - 'A'; + return 0; + } + + int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress) + { + int tmp, i; + unsigned char buf [13]; + + tmp = usb_string(dev->udev, iMACAddress, buf, sizeof buf); + if (tmp != 12) { + dev_dbg(&dev->udev->dev, + "bad MAC string %d fetch, %d\n", iMACAddress, tmp); + if (tmp >= 0) + tmp = -EINVAL; + return tmp; + } + for (i = tmp = 0; i < 6; i++, tmp += 2) + dev->net->dev_addr [i] = + (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); + return 0; + } + EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr); + static void intr_complete (struct urb *urb); *************** *** 204,209 **** skb->protocol = eth_type_trans (skb, dev->net); ! dev->stats.rx_packets++; ! dev->stats.rx_bytes += skb->len; if (netif_msg_rx_status (dev)) --- 235,240 ---- skb->protocol = eth_type_trans (skb, dev->net); ! dev->net->stats.rx_packets++; ! dev->net->stats.rx_bytes += skb->len; if (netif_msg_rx_status (dev)) *************** *** 367,371 **** devdbg (dev, "drop"); error: ! dev->stats.rx_errors++; skb_queue_tail (&dev->done, skb); } --- 398,402 ---- devdbg (dev, "drop"); error: ! dev->net->stats.rx_errors++; skb_queue_tail (&dev->done, skb); } *************** *** 390,395 **** if (skb->len < dev->net->hard_header_len) { entry->state = rx_cleanup; ! dev->stats.rx_errors++; ! dev->stats.rx_length_errors++; if (netif_msg_rx_err (dev)) devdbg (dev, "rx length %d", skb->len); --- 421,426 ---- if (skb->len < dev->net->hard_header_len) { entry->state = rx_cleanup; ! dev->net->stats.rx_errors++; ! dev->net->stats.rx_length_errors++; if (netif_msg_rx_err (dev)) devdbg (dev, "rx length %d", skb->len); *************** *** 399,407 **** /* stalls need manual reset. this is rare ... except that * when going through USB 2.0 TTs, unplug appears this way. ! * we avoid the highspeed version of the ETIMEOUT/EILSEQ * storm, recovering as needed. */ case -EPIPE: ! dev->stats.rx_errors++; usbnet_defer_kevent (dev, EVENT_RX_HALT); // FALLTHROUGH --- 430,438 ---- /* stalls need manual reset. this is rare ... except that * when going through USB 2.0 TTs, unplug appears this way. ! * we avoid the highspeed version of the ETIMEDOUT/EILSEQ * storm, recovering as needed. */ case -EPIPE: ! dev->net->stats.rx_errors++; usbnet_defer_kevent (dev, EVENT_RX_HALT); // FALLTHROUGH *************** *** 421,425 **** case -ETIME: case -EILSEQ: ! dev->stats.rx_errors++; if (!timer_pending (&dev->delay)) { mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); --- 452,456 ---- case -ETIME: case -EILSEQ: ! dev->net->stats.rx_errors++; if (!timer_pending (&dev->delay)) { mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); *************** *** 435,444 **** /* data overrun ... flush fifo? */ case -EOVERFLOW: ! dev->stats.rx_over_errors++; // FALLTHROUGH default: entry->state = rx_cleanup; ! dev->stats.rx_errors++; if (netif_msg_rx_err (dev)) devdbg (dev, "rx status %d", urb_status); --- 466,475 ---- /* data overrun ... flush fifo? */ case -EOVERFLOW: ! dev->net->stats.rx_over_errors++; // FALLTHROUGH default: entry->state = rx_cleanup; ! dev->net->stats.rx_errors++; if (netif_msg_rx_err (dev)) devdbg (dev, "rx status %d", urb_status); *************** *** 553,558 **** if (netif_msg_ifdown (dev)) devinfo (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld", ! dev->stats.rx_packets, dev->stats.tx_packets, ! dev->stats.rx_errors, dev->stats.tx_errors ); --- 584,589 ---- if (netif_msg_ifdown (dev)) devinfo (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld", ! net->stats.rx_packets, net->stats.tx_packets, ! net->stats.rx_errors, net->stats.tx_errors ); *************** *** 861,868 **** if (urb->status == 0) { ! dev->stats.tx_packets++; ! dev->stats.tx_bytes += entry->length; } else { ! dev->stats.tx_errors++; switch (urb->status) { --- 892,899 ---- if (urb->status == 0) { ! dev->net->stats.tx_packets++; ! dev->net->stats.tx_bytes += entry->length; } else { ! dev->net->stats.tx_errors++; switch (urb->status) { *************** *** 990,994 **** drop: retval = NET_XMIT_SUCCESS; ! dev->stats.tx_dropped++; if (skb) dev_kfree_skb_any (skb); --- 1021,1025 ---- drop: retval = NET_XMIT_SUCCESS; ! dev->net->stats.tx_dropped++; if (skb) dev_kfree_skb_any (skb); *************** *** 1186,1195 **** net->netdev_ops = &usbnet_netdev_ops; - #ifdef CONFIG_COMPAT_NET_DEV_OPS - net->hard_start_xmit = usbnet_start_xmit; - net->open = usbnet_open; - net->stop = usbnet_stop; - net->tx_timeout = usbnet_tx_timeout; - #endif net->watchdog_timeo = TX_TIMEOUT_JIFFIES; net->ethtool_ops = &usbnet_ethtool_ops; --- 1217,1220 ---- |