diff mbox

[RFC,2/5] mac80211: return new mac address as soon as possible

Message ID 1370612179-24385-3-git-send-email-moorray3@wp.pl (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jakub Kici?ski June 7, 2013, 1:36 p.m. UTC
From: Jakub Kicinski <kubakici@wp.pl>

Once one of wiphy->addresses is found to be unused
we can return from __ieee80211_assign_perm_addr and
use it. The same for masked addresses.

Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
---
 net/mac80211/iface.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index dbee397..38898b3 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1449,7 +1449,7 @@  static void __ieee80211_assign_perm_addr(struct ieee80211_local *local,
 		if (!used) {
 			memcpy(perm_addr, local->hw.wiphy->addresses[i].addr,
 			       ETH_ALEN);
-			break;
+			return;
 		}
 	}
 
@@ -1507,10 +1507,12 @@  static void __ieee80211_assign_perm_addr(struct ieee80211_local *local,
 
 		if (!used) {
 			memcpy(perm_addr, tmp_addr, ETH_ALEN);
-			break;
+			return;
 		}
 		addr = (start & ~mask) | (val & mask);
 	} while (addr != start);
+
+	pr_debug("no free address found - using default\n");
 }
 
 static void ieee80211_assign_perm_addr(struct ieee80211_local *local,