Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-block.git] / drivers / net / usb / kaweth.c
index 3d0d0b0b37c53d71be8396e3a2a2965bcaf01edd..200fe3d525ca5a1ddc04499c265133a51a1db9fe 100644 (file)
@@ -31,7 +31,6 @@
  ****************************************************************/
 
 /* TODO:
- * Fix in_interrupt() problem
  * Develop test procedures for USB net interfaces
  * Run test procedures
  * Fix bugs from previous two steps
@@ -606,14 +605,30 @@ static void kaweth_usb_receive(struct urb *urb)
 
        struct sk_buff *skb;
 
-       if(unlikely(status == -ECONNRESET || status == -ESHUTDOWN))
-       /* we are killed - set a flag and wake the disconnect handler */
-       {
+       if (unlikely(status == -EPIPE)) {
+               kaweth->stats.rx_errors++;
                kaweth->end = 1;
                wake_up(&kaweth->term_wait);
+               dbg("Status was -EPIPE.");
                return;
        }
-
+       if (unlikely(status == -ECONNRESET || status == -ESHUTDOWN)) {
+               /* we are killed - set a flag and wake the disconnect handler */
+               kaweth->end = 1;
+               wake_up(&kaweth->term_wait);
+               dbg("Status was -ECONNRESET or -ESHUTDOWN.");
+               return;
+       }
+       if (unlikely(status == -EPROTO || status == -ETIME ||
+                    status == -EILSEQ)) {
+               kaweth->stats.rx_errors++;
+               dbg("Status was -EPROTO, -ETIME, or -EILSEQ.");
+               return;
+       }
+       if (unlikely(status == -EOVERFLOW)) {
+               kaweth->stats.rx_errors++;
+               dbg("Status was -EOVERFLOW.");
+       }
        spin_lock(&kaweth->device_lock);
        if (IS_BLOCKED(kaweth->status)) {
                spin_unlock(&kaweth->device_lock);
@@ -814,7 +829,7 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
                        kaweth->stats.tx_errors++;
                        netif_start_queue(net);
                        spin_unlock_irq(&kaweth->device_lock);
-                       return 0;
+                       return NETDEV_TX_OK;
                }
        }
 
@@ -849,7 +864,7 @@ skip:
 
        spin_unlock_irq(&kaweth->device_lock);
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /****************************************************************
@@ -883,13 +898,16 @@ static void kaweth_set_rx_mode(struct net_device *net)
  ****************************************************************/
 static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
 {
+       int result;
        __u16 packet_filter_bitmap = kaweth->packet_filter_bitmap;
+
        kaweth->packet_filter_bitmap = 0;
        if (packet_filter_bitmap == 0)
                return;
 
-       {
-       int result;
+       if (in_interrupt())
+               return;
+
        result = kaweth_control(kaweth,
                                usb_sndctrlpipe(kaweth->dev, 0),
                                KAWETH_COMMAND_SET_PACKET_FILTER,
@@ -906,7 +924,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
        else {
                dbg("Set Rx mode to %d", packet_filter_bitmap);
        }
-       }
 }
 
 /****************************************************************
@@ -982,6 +999,9 @@ static const struct net_device_ops kaweth_netdev_ops = {
        .ndo_tx_timeout =               kaweth_tx_timeout,
        .ndo_set_multicast_list =       kaweth_set_rx_mode,
        .ndo_get_stats =                kaweth_netdev_stats,
+       .ndo_change_mtu =               eth_change_mtu,
+       .ndo_set_mac_address =          eth_mac_addr,
+       .ndo_validate_addr =            eth_validate_addr,
 };
 
 static int kaweth_probe(