All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 08/11] rt2x00: Fix MAC address initialization for multiple interfaces
@ 2007-07-25 20:50 Ivo van Doorn
  0 siblings, 0 replies; only message in thread
From: Ivo van Doorn @ 2007-07-25 20:50 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, rt2400-devel

>From cd95761f3c7ad82d4759ffc8b431e9220e360226 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
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@gmail.com>
---
 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


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

only message in thread, other threads:[~2007-07-25 20:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-25 20:50 [PATCH 08/11] rt2x00: Fix MAC address initialization for multiple interfaces Ivo van Doorn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.