Skip to content

Commit 710b523

Browse files
lwfingerdavem330
authored andcommitted
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: Larry Finger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 54cb228 commit 710b523

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

drivers/net/usb/kaweth.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
****************************************************************/
3232

3333
/* TODO:
34-
* Fix in_interrupt() problem
3534
* Develop test procedures for USB net interfaces
3635
* Run test procedures
3736
* Fix bugs from previous two steps
@@ -606,14 +605,30 @@ static void kaweth_usb_receive(struct urb *urb)
606605

607606
struct sk_buff *skb;
608607

609-
if(unlikely(status == -ECONNRESET || status == -ESHUTDOWN))
610-
/* we are killed - set a flag and wake the disconnect handler */
611-
{
608+
if (unlikely(status == -EPIPE)) {
609+
kaweth->stats.rx_errors++;
612610
kaweth->end = 1;
613611
wake_up(&kaweth->term_wait);
612+
dbg("Status was -EPIPE.");
614613
return;
615614
}
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+
}
617632
spin_lock(&kaweth->device_lock);
618633
if (IS_BLOCKED(kaweth->status)) {
619634
spin_unlock(&kaweth->device_lock);
@@ -883,13 +898,16 @@ static void kaweth_set_rx_mode(struct net_device *net)
883898
****************************************************************/
884899
static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
885900
{
901+
int result;
886902
__u16 packet_filter_bitmap = kaweth->packet_filter_bitmap;
903+
887904
kaweth->packet_filter_bitmap = 0;
888905
if (packet_filter_bitmap == 0)
889906
return;
890907

891-
{
892-
int result;
908+
if (in_interrupt())
909+
return;
910+
893911
result = kaweth_control(kaweth,
894912
usb_sndctrlpipe(kaweth->dev, 0),
895913
KAWETH_COMMAND_SET_PACKET_FILTER,
@@ -906,7 +924,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
906924
else {
907925
dbg("Set Rx mode to %d", packet_filter_bitmap);
908926
}
909-
}
910927
}
911928

912929
/****************************************************************

0 commit comments

Comments
 (0)