Re: D-Link DWL-120 / Belkin F5D5060 tx timeout problem

Joerg Albert <[email protected]>
Newsgroups gmane.linux.drivers.at76c503a.user
Message-ID <[email protected]>
Hi Sander,


On Mon, 19 Jul 2004, Sander Zegers wrote:

> Well the signal strength is ~50/100, and the distance of  the NIC and
> the AP is 'bout 2-3 meters.
> I'm asking myself if there is an option to set the TX timeout value.

if you referred to increasing the beacon timeout,
look for BEACON_TIMEOUT (in seconds) in at76c503.c.
The tx timeout is controlled by netdev->watchdog_timeo (in jiffies), set
it somewhere in init_new_device() (see attached patch).

But the first error is:

> /root/at76c503a/at76c503.c: wlan0: error in tx submit urb: -22

What's the time  between this line and the beacon timeout?

One reason for -22 = -EINVAL from the call to submit_urb in at76c503_tx()
could be a re-use of the tx urb while it is still used by the usb core.
Which the driver should avoid by using the netif stopped/running
states.

Please apply the attached patch, which should give more information
(and sets the tx timeout to 2 seconds) and re-try.
A syslog with timestamp would be nice.

What puzzles me, too, is the answer from your access point (which brand?)
to a subsequent authentication request:

> >> /root/at76c503a/at76c503.c: wlan0: state 1 -> 6 (JOINING)
> >> /root/at76c503a/at76c503.c: wlan0 find_matching_bss: returned c18a80d8
> >> /root/at76c503a/at76c503.c: wlan0 join addr 00:05:5d:6d:37:d9 ssid
> >> default type 2 ch 6 timeout 2000
> >> /root/at76c503a/at76c503.c: wlan0: state 6 -> 2 (AUTHENTICATING)
> >> /root/at76c503a/at76c503.c: wlan0: rx DeAuth bssid 00:05:5d:6d:37:d9
> >> reason x0006 destination 00:30:BD:60:C9:CF

reason 6 is "Class 2 frame received from nonauthenticated station", while
the AuthReq sent isn't a class 2 frame, but class 1.

Try to power-cycle the access point after the first error happened.

/Jörg
tx_submit_dbg.patch (text/plain, 1.9 KB)
Index: at76c503.c
===================================================================
RCS file: /cvsroot/at76c503a/at76c503a/at76c503.c,v
retrieving revision 1.61
diff -u -r1.61 at76c503.c
--- at76c503.c	29 Jun 2004 21:26:24 -0000	1.61
+++ at76c503.c	19 Jul 2004 22:04:00 -0000
@@ -3985,7 +3985,7 @@
 {
 	struct at76c503 *dev = (struct at76c503 *)(netdev->priv);
 	struct net_device_stats *stats = &dev->stats;
-	int ret;
+	int ret = 0;
 	int wlen;
 	int submit_len;
 	struct at76c503_tx_buffer *tx_buffer =
@@ -3994,6 +3994,22 @@
 		(struct ieee802_11_hdr *)&(tx_buffer->packet);
 	u8 *payload = tx_buffer->packet + sizeof(struct ieee802_11_hdr);
 
+	if (netif_queue_stopped(netdev)) {
+		err("%s: %s called while netdev is stopped", netdev->name,
+		    __FUNCTION__);
+		//skip this packet
+		dev_kfree_skb(skb);
+		return 0;
+	}
+
+	if (dev->write_urb->status == USB_ST_URB_PENDING) {
+		err("%s: %s called while dev->write_urb is pending for tx",
+		    netdev->name, __FUNCTION__);
+		//skip this packet
+		dev_kfree_skb(skb);
+		return 0;
+	}
+
 	if (skb->len < 2*ETH_ALEN) {
 		err("%s: %s: skb too short (%d)", dev->netdev->name,
 		    __FUNCTION__, skb->len);
@@ -4091,6 +4107,11 @@
 	if(ret){
 		stats->tx_errors++;
 		err("%s: error in tx submit urb: %d", netdev->name, ret);
+		if (ret == -EINVAL)
+			err("-EINVAL: urb %p urb->hcpriv %p urb->complete %p",
+			    dev->write_urb,
+			    dev->write_urb ? dev->write_urb->hcpriv : (void *)-1,
+			    dev->write_urb ? dev->write_urb->complete : (void *)-1);
 		goto err;
 	}
 
@@ -6583,6 +6604,7 @@
 	netdev->get_wireless_stats = at76c503_get_wireless_stats;
 	netdev->hard_start_xmit = at76c503_tx;
 	netdev->tx_timeout = at76c503_tx_timeout;
+	netdev->watchdog_timeo = 2 * HZ;
 #if WIRELESS_EXT > 12
 	netdev->wireless_handlers = 
 		(struct iw_handler_def*)&at76c503_handler_def;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.