All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, rt2400-devel@lists.sourceforge.net
Subject: [PATCH 08/11] rt2x00: Fix MAC address initialization for multiple interfaces
Date: Wed, 25 Jul 2007 22:50:22 +0200	[thread overview]
Message-ID: <200707252250.22190.IvDoorn@gmail.com> (raw)

>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


                 reply	other threads:[~2007-07-25 20:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707252250.22190.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rt2400-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.