Skip to contentSkip to conversation

mac80211: make scan IE length more dynamic

PATCH New Johannes Berg 1 participant 1 message Apr 9, 2009 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: make scan IE length more dynamic

Generally drivers don't have all 32 possible rates, and also do not support HT. This patch adds code to calculate the scan IE length more accurately to benefit drivers that don't have all that much space for scan IEs.

---
This was supposed to be part of the patchset doing the scan IEs, but seems either I forgot to send it out or you took an older version.

 net/mac80211/ieee80211_i.h |    6 ----
 net/mac80211/main.c        |   57 ++++++++++++++++++++++++++++++---------------
 net/mac80211/scan.c        |    3 +-
 net/mac80211/util.c        |    5 +++
 4 files changed, 45 insertions(+), 26 deletions(-)
net/mac80211/ieee80211_i.h +1 -5
@@ -51,11 +51,6 @@ struct ieee80211_local;
  * increased memory use (about 2 kB of RAM per entry). */
 #define IEEE80211_FRAGMENT_MAX 4
 
-/* cfg80211 only supports 32 rates */
-#define MAC80211_PREQ_IE_LEN	( 2 + 32 /* SSID */\
-				+ 4 + 32 /* (ext) supp rates */\
-				+ sizeof(struct ieee80211_ht_cap))
-
 /*
  * Time after which we ignore scan results and no longer report/use
  * them in any way.
@@ -679,6 +674,7 @@ struct ieee80211_local {
 	const u8 *orig_ies;
 	int orig_ies_len;
 	int scan_channel_idx;
+	int scan_ies_len;
 
 	enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
 	unsigned long last_scan_completed;
net/mac80211/main.c +38 -19

90 lines not on this page · raw message

net/mac80211/scan.c +2 -1
@@ -466,7 +466,8 @@ int ieee80211_start_scan(struct ieee8021
 		u8 *ies;
 		int rc, ielen;
 
-		ies = kmalloc(MAC80211_PREQ_IE_LEN + req->ie_len, GFP_KERNEL);
+		ies = kmalloc(2 + IEEE80211_MAX_SSID_LEN +
+			      local->scan_ies_len + req->ie_len, GFP_KERNEL);
 		if (!ies)
 			return -ENOMEM;
 
net/mac80211/util.c +4 -1
@@ -877,7 +877,10 @@ int ieee80211_build_preq_ies(struct ieee
 		pos += 2 + 4 + 1; /* ext info, BF cap, antsel */
 	}
 
-	/* if adding more here, adjust MAC80211_PREQ_IE_LEN */
+	/*
+	 * If adding more here, adjust code in main.c
+	 * that calculates local->scan_ies_len.
+	 */
 
 	if (ie) {
 		memcpy(pos, ie, ie_len);