Search Linux Wireless

[PATCH 08/11] rt2x00: Fix MAC address initialization for multiple interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From cd95761f3c7ad82d4759ffc8b431e9220e360226 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@xxxxxxxxx>
Date: Tue, 24 Jul 2007 19:46:22 +0200
Subject: [PATCH 08/11] rt2x00: Fix MAC address initialization for multiple interfaces

MAC address initialization was broken when the first
interface which was loaded was a monitor interface and a
real interface was loaded after that.

Only configure the MAC address when a non-monitor interface
is being added. This required splitting the initialization
steps in add_interface up.

Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>
---
 drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c |   38 ++++++++++++----------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c b/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c
index 247ea4e..c39c1f2 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c
@@ -145,6 +145,17 @@ int rt2x00lib_add_interface(struct ieee80211_hw *hw,
 		return -ENOBUFS;
 
 	/*
+	 * If this is the first interface which is added,
+	 * we should load the firmware now.
+	 */
+	if (!test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags) &&
+	    test_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags)) {
+		status = rt2x00lib_load_firmware(rt2x00dev);
+		if (status)
+			return status;
+	}
+
+	/*
 	 * We support muliple monitor mode interfaces.
 	 * All we need to do is increase the monitor_count.
 	 */
@@ -156,29 +167,22 @@ int rt2x00lib_add_interface(struct ieee80211_hw *hw,
 		if (conf->type == IEEE80211_IF_TYPE_AP)
 			memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN);
 		intf->promisc = 0;
-	}
 
-	/*
-	 * Initialize interface, and enable the radio when this
-	 * is the first interface that is brought up.
-	 */
-	if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) {
 		/*
-		 * We must load firmware before we can safely continue.
-		 */
-		if (test_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags)) {
-			status = rt2x00lib_load_firmware(rt2x00dev);
-			if (status)
-				return status;
-		}
-
-		/*
-		 * Before initialization, the mac address should
-		 * be configured.
+		 * We should configure the MAC address before
+		 * the initialization starts. Note that the mac_addr
+		 * field is NULL when adding a monitor interface,
+		 * so we can only set the mac address here.
 		 */
 		rt2x00dev->ops->lib->config_mac_addr(rt2x00dev,
 			conf->mac_addr);
+	}
 
+	/*
+	 * Initialize interface, and enable the radio when this
+	 * is the first interface that is brought up.
+	 */
+	if (!test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) {
 		/*
 		 * Initialize the device.
 		 */
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux