rt2x00: add/remove interface fix
Subsystems (3)
PATCH 4/10 rt2x00: add/remove interface fix
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 <[email protected]>
---
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +25 -6
@@ -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); }
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +25 -6
@@ -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); }
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +25 -6
@@ -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); }
drivers/net/wireless/d80211/rt2x00/rt61pci.c +25 -6
@@ -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); }
drivers/net/wireless/d80211/rt2x00/rt73usb.c +25 -6
@@ -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); }