linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Schurig <holgerschurig@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Samuel Ortiz <sameo@linux.intel.com>, Dan Williams <dcbw@redhat.com>
Subject: [PATCH] libertas+cfg80211: better disconnect support
Date: Thu, 4 Feb 2010 14:44:36 +0100	[thread overview]
Message-ID: <201002041444.36131.holgerschurig@gmail.com> (raw)
In-Reply-To: <20100202000934.GA19847@sortiz.org>

Hi Samuel !

This patch was necessary for me to make

   while true; iw wlan0 link; sleep 0.1; done

not hang in "iw" when moving out-of-reach of an AP.


--------------------------

An issue with "iw wlan0 link" hanging when moving out-of-reach of
an AP was observed. The reason was that lbs_get_signal()
returned "1" in case of an error from the firmware and that this
value was given back to cfg80211.

However a cfg80211-operation method should return standard -Exxx
error codes, not posive values. The positive value ended up in
iw, where a line like "while (ret > 0) ..." was looping endless.


For error recovery, it also helped to report link loss much
earlier to user-space. I actually have Cisco APs lying around, so
I know that the one-second delay doesn't upset neither an Cisco
1231/1241 nor wpa_supplicant 0.7.1 (at least not in -Dnl80211
mode). This made wpa_supplicant scan one second earlier and
re-connect therefore faster to another suitable AP.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>

---
 drivers/net/wireless/libertas/cfg.c     |   10 ++++++++--
 drivers/net/wireless/libertas/cmdresp.c |    5 -----
 2 files changed, 8 insertions(+), 7 deletions(-)

--- linux-wl.orig/drivers/net/wireless/libertas/cfg.c
+++ linux-wl/drivers/net/wireless/libertas/cfg.c
@@ -1478,6 +1478,7 @@ struct cmd_rssi {
 	__le16 avg_nf;
 } __attribute__ ((packed));
 
+
 static int lbs_get_signal(struct lbs_private *priv, s8 *signal, 
s8 *noise)
 {
 	struct cmd_rssi cmd;
@@ -1492,6 +1493,7 @@ static int lbs_get_signal(struct lbs_pri
 				le16_to_cpu(cmd.nf));
 		*noise  = CAL_NF(le16_to_cpu(cmd.nf));
 	}
+
 	return ret;
 }
 
@@ -1516,7 +1518,9 @@ static int lbs_cfg_get_station(struct wi
 
 	/* Get current RSSI */
 	ret = lbs_get_signal(priv, &signal, &noise);
-	if (ret == 0) {
+	if (ret)
+		ret = -EBUSY;
+	else {
 		sinfo->signal = signal;
 		sinfo->filled |= STATION_INFO_SIGNAL;
 	}
@@ -1564,7 +1568,9 @@ static int lbs_get_survey(struct wiphy *
 		ieee80211_channel_to_frequency(priv->channel));
 
 	ret = lbs_get_signal(priv, &signal, &noise);
-	if (ret == 0) {
+	if (ret)
+		ret = -EBUSY;
+	else {
 		survey->filled = SURVEY_INFO_NOISE_DBM;
 		survey->noise = noise;
 	}
--- linux-wl.orig/drivers/net/wireless/libertas/cmdresp.c
+++ linux-wl/drivers/net/wireless/libertas/cmdresp.c
@@ -25,11 +25,6 @@ void lbs_mac_event_disconnected(struct l
 
 	lbs_deb_enter(LBS_DEB_ASSOC);
 
-	/*
-	 * Cisco AP sends EAP failure and de-auth in less than 0.5 ms.
-	 * It causes problem in the Supplicant
-	 */
-	msleep_interruptible(1000);
 	lbs_send_disconnect_notification(priv);
 
 	/* report disconnect to upper layer */


-- 
http://www.holgerschurig.de

  parent reply	other threads:[~2010-02-04 13:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02  0:09 [PATCH] libertas: cfg80211 support Samuel Ortiz
2010-02-02 20:36 ` John W. Linville
2010-02-03  9:31   ` Holger Schurig
2010-02-03 12:04     ` Samuel Ortiz
2010-02-03 15:32       ` Holger Schurig
2010-02-03 20:30         ` Dan Williams
2010-02-04  7:28           ` Holger Schurig
2010-02-04 21:49             ` Dan Williams
2010-02-04  9:52 ` Holger Schurig
2010-02-11 12:01   ` Samuel Ortiz
2010-02-11 12:24     ` Holger Schurig
2010-02-04 10:11 ` Holger Schurig
2010-02-11 12:03   ` Samuel Ortiz
2010-02-04 13:44 ` Holger Schurig [this message]
2010-02-15 10:46 ` Holger Schurig
     [not found]   ` <cdd918981002240005o1fa50956yfb2a692716c06a55@mail.gmail.com>
2010-02-24 23:35     ` Dan Williams
2010-02-25  8:42       ` David MOUSSAUD
2010-02-25  8:48         ` Johannes Berg
2010-02-25 18:05           ` Andrey Yurovsky
2010-03-07 17:32             ` Kalle Valo
2010-03-07 17:52               ` Gábor Stefanik
2010-02-24  8:22 ` David MOUSSAUD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002041444.36131.holgerschurig@gmail.com \
    --to=holgerschurig@gmail.com \
    --cc=dcbw@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).