Skip to contentSkip to conversation

mac80211: ieee80211_ibss_add_sta called uneccessarily

RFC New Alexander Simon 1 participant 1 message Jan 19, 2011 mac80211

lore
Share & tools
lore
#0 lore raw

RFC 1/1 mac80211: ieee80211_ibss_add_sta called uneccessarily

Hi,

while creating a patch for IEEE802.11n with IBSS, i found that ieee80211_ibss_add_sta is called way to often by prepare_for_handlers in net/mac80211/rx.c.

In net/mac80211/rx.c we check if the IBSSs match with ieee80211_bssid_match(). If they dont and we are not scanning, we are leaving.
But ieee80211_bssid_match() will also return true if our BSSID is set to broadcast. And the interface is set to broadcast if we are scanning witch happens if we created an IBSS and are still "alone". So we will never return.

So i would change !ieee80211_bssid_match just into compare_ether_addr.

Well, this only affects CPU (and my printk output) as ieee80211_ibss_add_sta checks the BSSIDs on its own again, but we safe some needless function calls.

Hope i could give a understandable explanation of my patch

net/mac80211/rx.c +1 -1
diff -Nrup compat-wireless-2011-01-17.orig/net/mac80211/rx.c compat-wireless-2011-01-17/net/mac80211/rx.c
@@ -2601,7 +2601,7 @@ static int prepare_for_handlers(struct i
 		if (ieee80211_is_beacon(hdr->frame_control)) {
 			return 1;
 		}
-		else if (!ieee80211_bssid_match(bssid, sdata->u.ibss.bssid)) {
+		else if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) {
 			if (!(status->rx_flags & IEEE80211_RX_IN_SCAN))
 				return 0;
 			status->rx_flags &= ~IEEE80211_RX_RA_MATCH;