linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] mac80211: ieee80211_ibss_add_sta called uneccessarily
@ 2011-01-19 13:43 Alexander Simon
  0 siblings, 0 replies; only message in thread
From: Alexander Simon @ 2011-01-19 13:43 UTC (permalink / raw)
  To: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]

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

Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>

[-- Attachment #2: fix_ieee80211_ibss_add_sta_call.patch --]
[-- Type: text/x-patch, Size: 656 bytes --]

diff -Nrup compat-wireless-2011-01-17.orig/net/mac80211/rx.c compat-wireless-2011-01-17/net/mac80211/rx.c
--- compat-wireless-2011-01-17.orig/net/mac80211/rx.c	2011-01-17 21:03:26.000000000 +0100
+++ compat-wireless-2011-01-17/net/mac80211/rx.c	2011-01-18 15:42:46.000000000 +0100
@@ -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;

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

only message in thread, other threads:[~2011-01-19 13:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-19 13:43 [RFC] mac80211: ieee80211_ibss_add_sta called uneccessarily Alexander Simon

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