Commit 710b523a authored by Larry Finger's avatar Larry Finger Committed by David S. Miller

kaweth: Clean up code

The driver kaweth yields a -EBUSY error when starting, and a -ETIME
error when shutting down. These errors are avoided, and the RX status
is further checked for other potential errors.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 54cb2284
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
****************************************************************/ ****************************************************************/
/* TODO: /* TODO:
* Fix in_interrupt() problem
* Develop test procedures for USB net interfaces * Develop test procedures for USB net interfaces
* Run test procedures * Run test procedures
* Fix bugs from previous two steps * Fix bugs from previous two steps
...@@ -606,14 +605,30 @@ static void kaweth_usb_receive(struct urb *urb) ...@@ -606,14 +605,30 @@ static void kaweth_usb_receive(struct urb *urb)
struct sk_buff *skb; struct sk_buff *skb;
if(unlikely(status == -ECONNRESET || status == -ESHUTDOWN)) 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 */ /* we are killed - set a flag and wake the disconnect handler */
{
kaweth->end = 1; kaweth->end = 1;
wake_up(&kaweth->term_wait); wake_up(&kaweth->term_wait);
dbg("Status was -ECONNRESET or -ESHUTDOWN.");
return; 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); spin_lock(&kaweth->device_lock);
if (IS_BLOCKED(kaweth->status)) { if (IS_BLOCKED(kaweth->status)) {
spin_unlock(&kaweth->device_lock); spin_unlock(&kaweth->device_lock);
...@@ -883,13 +898,16 @@ static void kaweth_set_rx_mode(struct net_device *net) ...@@ -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) static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
{ {
int result;
__u16 packet_filter_bitmap = kaweth->packet_filter_bitmap; __u16 packet_filter_bitmap = kaweth->packet_filter_bitmap;
kaweth->packet_filter_bitmap = 0; kaweth->packet_filter_bitmap = 0;
if (packet_filter_bitmap == 0) if (packet_filter_bitmap == 0)
return; return;
{ if (in_interrupt())
int result; return;
result = kaweth_control(kaweth, result = kaweth_control(kaweth,
usb_sndctrlpipe(kaweth->dev, 0), usb_sndctrlpipe(kaweth->dev, 0),
KAWETH_COMMAND_SET_PACKET_FILTER, KAWETH_COMMAND_SET_PACKET_FILTER,
...@@ -906,7 +924,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth) ...@@ -906,7 +924,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
else { else {
dbg("Set Rx mode to %d", packet_filter_bitmap); dbg("Set Rx mode to %d", packet_filter_bitmap);
} }
}
} }
/**************************************************************** /****************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment