From: Ivo van Doorn <ivdoorn@gmail.com>
To: netdev@vger.kernel.org
Cc: linville@tuxdriver.com
Subject: [PATCH 4/10] rt2x00: add/remove interface fix
Date: Sun, 27 Aug 2006 17:39:13 +0200 [thread overview]
Message-ID: <200608271739.13694.IvDoorn@gmail.com> (raw)
Allow correct configuration of the register depending on working mode.
This can only be done by configuring the register before calling
rt2x00_add_interface.
Second fix is to disable the radio when all monitor interfaces
_and_ the non-monitor interface has been removed.
Signed-off-by Ivo van Doorn <ivdoorn@gmail.com>
---
diff -rU3 wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt2400pci.c wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
--- wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt2400pci.c 2006-08-27 16:08:49.000000000 +0200
+++ wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt2400pci.c 2006-08-27 16:11:40.000000000 +0200
@@ -2001,10 +2001,6 @@
GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return -ENOBUFS;
- SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
-
- rt2x00_add_interface(&rt2x00dev->interface, conf);
-
/*
* Enable configuration.
*/
@@ -2020,6 +2016,19 @@
}
/*
+ * Add the new interface.
+ */
+ rt2x00_add_interface(&rt2x00dev->interface, conf);
+
+ /*
+ * When this is a non-monitor mode,
+ * set the INTERFACE_INITIALIZED FLAG to prevent
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+
+ /*
* Enable radio when this is the first
* interface that is brought up.
*/
@@ -2041,15 +2050,25 @@
!GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return;
+ /*
+ * Remove the interface.
+ */
rt2x00_remove_interface(&rt2x00dev->interface, conf);
- CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+ /*
+ * When this is a non-monitor mode,
+ * clear the INTERFACE_INITIALIZED FLAG to allow
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
/*
* Disable radio if this was the last interface
* that was working with this device.
*/
- if (!rt2x00dev->interface.monitor_count)
+ if (!rt2x00dev->interface.monitor_count &&
+ !GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
rt2400pci_disable_radio(rt2x00dev);
}
diff -rU3 wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt2500pci.c wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
--- wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt2500pci.c 2006-08-27 16:06:12.000000000 +0200
+++ wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt2500pci.c 2006-08-27 16:12:03.000000000 +0200
@@ -2146,10 +2146,6 @@
GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return -ENOBUFS;
- SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
-
- rt2x00_add_interface(&rt2x00dev->interface, conf);
-
/*
* Enable configuration.
*/
@@ -2165,6 +2161,19 @@
}
/*
+ * Add the new interface.
+ */
+ rt2x00_add_interface(&rt2x00dev->interface, conf);
+
+ /*
+ * When this is a non-monitor mode,
+ * set the INTERFACE_INITIALIZED FLAG to prevent
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+
+ /*
* Enable radio when this is the first
* interface that is brought up.
*/
@@ -2186,15 +2195,25 @@
!GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return;
+ /*
+ * Remove the interface.
+ */
rt2x00_remove_interface(&rt2x00dev->interface, conf);
- CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+ /*
+ * When this is a non-monitor mode,
+ * clear the INTERFACE_INITIALIZED FLAG to allow
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
/*
* Disable radio if this was the last interface
* that was working with this device.
*/
- if (!rt2x00dev->interface.monitor_count)
+ if (!rt2x00dev->interface.monitor_count &&
+ !GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
rt2500pci_disable_radio(rt2x00dev);
}
diff -rU3 wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt2500usb.c wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
--- wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt2500usb.c 2006-08-27 16:06:31.000000000 +0200
+++ wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt2500usb.c 2006-08-27 16:12:24.000000000 +0200
@@ -1862,10 +1862,6 @@
GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return -ENOBUFS;
- SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
-
- rt2x00_add_interface(&rt2x00dev->interface, conf);
-
/*
* Enable configuration.
*/
@@ -1881,6 +1877,19 @@
}
/*
+ * Add the new interface.
+ */
+ rt2x00_add_interface(&rt2x00dev->interface, conf);
+
+ /*
+ * When this is a non-monitor mode,
+ * set the INTERFACE_INITIALIZED FLAG to prevent
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+
+ /*
* Enable radio when this is the first
* interface that is brought up.
*/
@@ -1902,15 +1911,25 @@
!GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return;
+ /*
+ * Remove the interface.
+ */
rt2x00_remove_interface(&rt2x00dev->interface, conf);
- CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+ /*
+ * When this is a non-monitor mode,
+ * clear the INTERFACE_INITIALIZED FLAG to allow
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
/*
* Disable radio if this was the last interface
* that was working with this device.
*/
- if (!rt2x00dev->interface.monitor_count)
+ if (!rt2x00dev->interface.monitor_count &&
+ !GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
rt2500usb_disable_radio(rt2x00dev);
}
diff -rU3 wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt61pci.c wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt61pci.c
--- wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt61pci.c 2006-08-27 16:06:48.000000000 +0200
+++ wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt61pci.c 2006-08-27 16:12:45.000000000 +0200
@@ -2624,10 +2624,6 @@
GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return -ENOBUFS;
- SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
-
- rt2x00_add_interface(&rt2x00dev->interface, conf);
-
/*
* Enable configuration.
*/
@@ -2643,6 +2639,19 @@
}
/*
+ * Add the new interface.
+ */
+ rt2x00_add_interface(&rt2x00dev->interface, conf);
+
+ /*
+ * When this is a non-monitor mode,
+ * set the INTERFACE_INITIALIZED FLAG to prevent
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+
+ /*
* Enable radio when this is the first
* interface that is brought up.
*/
@@ -2664,15 +2673,25 @@
!GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return;
+ /*
+ * Remove the interface.
+ */
rt2x00_remove_interface(&rt2x00dev->interface, conf);
- CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+ /*
+ * When this is a non-monitor mode,
+ * clear the INTERFACE_INITIALIZED FLAG to allow
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
/*
* Disable radio if this was the last interface
* that was working with this device.
*/
- if (!rt2x00dev->interface.monitor_count)
+ if (!rt2x00dev->interface.monitor_count &&
+ !GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
rt61pci_disable_radio(rt2x00dev);
}
diff -rU3 wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt73usb.c wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt73usb.c
--- wireless-dev-rt2x00-mac/drivers/net/wireless/d80211/rt2x00/rt73usb.c 2006-08-27 16:07:02.000000000 +0200
+++ wireless-dev-rt2x00-interface/drivers/net/wireless/d80211/rt2x00/rt73usb.c 2006-08-27 16:13:06.000000000 +0200
@@ -2145,10 +2145,6 @@
GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return -ENOBUFS;
- SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
-
- rt2x00_add_interface(&rt2x00dev->interface, conf);
-
/*
* Enable configuration.
*/
@@ -2164,6 +2160,19 @@
}
/*
+ * Add the new interface.
+ */
+ rt2x00_add_interface(&rt2x00dev->interface, conf);
+
+ /*
+ * When this is a non-monitor mode,
+ * set the INTERFACE_INITIALIZED FLAG to prevent
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ SET_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+
+ /*
* Enable radio when this is the first
* interface that is brought up.
*/
@@ -2185,15 +2194,25 @@
!GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
return;
+ /*
+ * Remove the interface.
+ */
rt2x00_remove_interface(&rt2x00dev->interface, conf);
- CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
+ /*
+ * When this is a non-monitor mode,
+ * clear the INTERFACE_INITIALIZED FLAG to allow
+ * new non-monitor interfaces to be added.
+ */
+ if (conf->type != IEEE80211_IF_TYPE_MNTR)
+ CLEAR_FLAG(rt2x00dev, INTERFACE_INITIALIZED);
/*
* Disable radio if this was the last interface
* that was working with this device.
*/
- if (!rt2x00dev->interface.monitor_count)
+ if (!rt2x00dev->interface.monitor_count &&
+ !GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
rt73usb_disable_radio(rt2x00dev);
}
reply other threads:[~2006-08-27 15:39 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=200608271739.13694.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
/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.