linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* airo: SIOCSIWAP (airo_set_wap) breaks scan
@ 2015-10-03 20:29 Ondrej Zary
  0 siblings, 0 replies; only message in thread
From: Ondrej Zary @ 2015-10-03 20:29 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless

Hello,
found a weird problem while testing airo with multiple APs: the first scan
correctly shows all APs. After associating to one of them, subsequent scans
only show this single AP.

Tracked the problem down to SIOCSIWAP (airo_set_wap) - the APList rid affects
scan results. 

Clearing APList before starting scan and setting it back after scan completes
makes it work (see the patch below). Is that an acceptable solution?

BTW. Instead of being dynamically allocated, APList should be a member of
struct airo_info and track the real card's state. That would simplify this
work-around and also suspend/resume.

diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 8ae838d..b4f79a7 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -3042,6 +3042,11 @@ static void airo_process_scan_results (struct airo_info *ai) {
 	}
 
 out:
+	if (ai->APList) {
+		disable_MAC(ai, 0);
+		writeAPListRid(ai, ai->APList, 0);
+		enable_MAC(ai, 0);
+	}
 	ai->scan_timeout = 0;
 	clear_bit(JOB_SCAN_RESULTS, &ai->jobs);
 	up(&ai->sem);
@@ -7233,6 +7238,7 @@ static int airo_set_scan(struct net_device *dev,
 	Cmd cmd;
 	Resp rsp;
 	int wake = 0;
+	APListRid APList_rid_empty;
 
 	/* Note : you may have realised that, as this is a SET operation,
 	 * this is privileged and therefore a normal user can't
@@ -7242,6 +7248,12 @@ static int airo_set_scan(struct net_device *dev,
 	 * Jean II */
 	if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN;
 
+	if (!ai->APList)
+		ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL);
+	if (!ai->APList)
+		return -ENOMEM;
+	readAPListRid(ai, ai->APList);
+
 	if (down_interruptible(&ai->sem))
 		return -ERESTARTSYS;
 
@@ -7250,6 +7262,13 @@ static int airo_set_scan(struct net_device *dev,
 	if (ai->scan_timeout > 0)
 		goto out;
 
+	/* Clear APList as it affects scan results */
+	memset(&APList_rid_empty, 0, sizeof(APList_rid_empty));
+	APList_rid_empty.len = cpu_to_le16(sizeof(APList_rid_empty));
+	disable_MAC(ai, 0);
+	writeAPListRid(ai, &APList_rid_empty, 0);
+	enable_MAC(ai, 0);
+
 	/* Initiate a scan command */
 	ai->scan_timeout = RUN_AT(3*HZ);
 	memset(&cmd, 0, sizeof(cmd));

-- 
Ondrej Zary

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-03 20:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-03 20:29 airo: SIOCSIWAP (airo_set_wap) breaks scan Ondrej Zary

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).