Skip to contentSkip to conversation

iwl4965: fix bogus hardware scan configuration caching

PATCH In review Johannes Berg 2 participants 2 messages Dec 19, 2007 – Dec 20, 2007 Networking drivers (wireless)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 iwl4965: fix bogus hardware scan configuration caching

When iwl4965 is scanning, it needs to cache any configuration requests. This was implemented but the implementation is buggy: it uses only the *first* configuration rather than the *last* that is requested during scanning. This patch fixes that and also removes a bogus comment related to the issue.

---
This patch requires porting to iwl3965. For correctness, it needs to be applied to 2.6.24 although most likely nobody will ask to change channel twice during a single hardware scan. Duh!

Warning: patch is not even compile tested yet because I currently have a broken tree. I don't see why it shouldn't work though.

 drivers/net/wireless/iwlwifi/iwl4965-base.c |   26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)
drivers/net/wireless/iwlwifi/iwl4965-base.c +11 -15
@@ -7471,25 +7471,21 @@ static int iwl4965_mac_config(struct iee
 		goto out;
 	}
 
-	/* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only
-	 * what is exposed through include/ declarations */
 	if (unlikely(!iwl4965_param_disable_hw_scan &&
 		     test_bit(STATUS_SCANNING, &priv->status))) {
+		/*
+		 * Cache the configuration now so that we can
+		 * replay it after the hardware scan is finished.
+		 */
 
-		if (unlikely(priv->cache_conf))
-			IWL_DEBUG_MAC80211("leave - still scanning\n");
-		else {
-			/* Cache the configuration now so that we can
-			 * replay it after the hardware scan is finished. */
+		if (likely(!priv->cache_conf))
 			priv->cache_conf = kmalloc(sizeof(*conf), GFP_KERNEL);
-			if (priv->cache_conf) {
-				memcpy(priv->cache_conf, conf, sizeof(*conf));
-				IWL_DEBUG_MAC80211("leave - scanning\n");
-			} else {
-				IWL_DEBUG_MAC80211("leave - no memory\n");
-				ret = -ENOMEM;
-			}
-		}
+
+		if (likely(priv->cache_conf))
+			memcpy(priv->cache_conf, conf, sizeof(*conf));
+		else
+			ret = -ENOMEM;
+
 		mutex_unlock(&priv->mutex);
 		return ret;
 	}
#1 lore raw
Quoted 7 lines · Johannes Berg

When iwl4965 is scanning, it needs to cache any configuration requests.
This was implemented but the implementation is buggy: it uses only the *first* configuration rather than the *last* that is requested during scanning. This patch fixes that and also removes a bogus comment related to the issue.

Quoted 8 lines

---
This patch requires porting to iwl3965. For correctness, it needs to be applied to 2.6.24 although most likely nobody will ask to change channel twice during a single hardware scan. Duh!

Warning: patch is not even compile tested yet because I currently have a broken tree. I don't see why it shouldn't work though.

NACK. We have a better fix that doesn't require to alloc buffer at all in our tree. Will post it here later.
http://intellinuxwireless.org/repos/?p=iwlwifi.git;a=commitdiff;h=5f967087629a19b0c166101ddd227dee8ab2ec39

Thanks,
-yi