mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2 V2] kaweth: Clean up code
@ 2009-03-31 18:47 Larry Finger
  2009-03-31 21:49 ` Oliver Neukum
  0 siblings, 1 reply; 2+ messages in thread
From: Larry Finger @ 2009-03-31 18:47 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-kernel, netdev, oliver

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 <Larry.Finger@lwfinger.net>
---

Jeff,

As the listed authors of this driver have not touched it in several years,
I have taken the liberty of sending it to you as networking drivers maintainer.
I hope this is OK.

Larry
---

Index: wireless-testing/drivers/net/usb/kaweth.c
===================================================================
--- wireless-testing.orig/drivers/net/usb/kaweth.c
+++ wireless-testing/drivers/net/usb/kaweth.c
@@ -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 ur
 
 	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);
@@ -883,13 +898,16 @@ static void kaweth_set_rx_mode(struct ne
  ****************************************************************/
 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,
@@ -900,13 +918,10 @@ static void kaweth_async_set_rx_mode(str
 				0,
 				KAWETH_CONTROL_TIMEOUT);
 
-	if(result < 0) {
-		err("Failed to set Rx mode: %d", result);
-	}
-	else {
-		dbg("Set Rx mode to %d", packet_filter_bitmap);
-	}
-	}
+	if (result < 0)
+		err("Failed to set Rx mode: 0x%X", result);
+	else
+		dbg("Set Rx mode to 0x%X", packet_filter_bitmap);
 }
 
 /****************************************************************

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2 V2] kaweth: Clean up code
  2009-03-31 18:47 [PATCH 2/2 V2] kaweth: Clean up code Larry Finger
@ 2009-03-31 21:49 ` Oliver Neukum
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2009-03-31 21:49 UTC (permalink / raw)
  To: Larry Finger; +Cc: jgarzik, linux-kernel, netdev

Am Dienstag 31 März 2009 20:47:13 schrieb Larry Finger:
> 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.

Why the different treatment with respect to the error counter?
Isn't enough to print the numerical error? This takes a lot of
memory.

	Regards
		Oliver


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-31 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-31 18:47 [PATCH 2/2 V2] kaweth: Clean up code Larry Finger
2009-03-31 21:49 ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®