rt2x00: TO_DS filter depends on intf_ap_count
authorIvo van Doorn <ivdoorn@gmail.com>
Mon, 31 Mar 2008 13:24:53 +0000 (15:24 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 1 Apr 2008 21:14:08 +0000 (17:14 -0400)
The TO_DS filter does not only depend on the FIF_PROMISC_IN_BSS flag
provided by mac80211, but also on the intf_ap_count count.
This makes sense, since when Master mode is active, we should all frames
that are send to the active AP (the device itself).

This means that when an interface is added we should force the
packet filter to be updated during the next mac80211 call of
configure_filter() to make sure the intf_ap_count field is checked.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index a6e9c89c802abb9861af9db59ca02e02ae01b719..9abdfb84697cc2f478eaadb12fbf47716b188329 100644 (file)
@@ -290,7 +290,8 @@ static void rt2400pci_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
                           !(filter_flags & FIF_PROMISC_IN_BSS));
        rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
-                          !(filter_flags & FIF_PROMISC_IN_BSS));
+                          !(filter_flags & FIF_PROMISC_IN_BSS) &&
+                          !rt2x00dev->intf_ap_count);
        rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
        rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
 }
index 1bdb873b65f284fd97b3489d0a47efb6c8c0ef28..54c9a75b549b169cbe11c93081037026f9430fdf 100644 (file)
@@ -291,7 +291,8 @@ static void rt2500pci_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
                           !(filter_flags & FIF_PROMISC_IN_BSS));
        rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
-                          !(filter_flags & FIF_PROMISC_IN_BSS));
+                          !(filter_flags & FIF_PROMISC_IN_BSS) &&
+                          !rt2x00dev->intf_ap_count);
        rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
        rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
                           !(filter_flags & FIF_ALLMULTI));
index f5c18f011e9352ca37ebc9b5a55c5cc5dd83971b..28fdf191e956190e6025a27c0bcff565d86cfcb9 100644 (file)
@@ -337,7 +337,8 @@ static void rt2500usb_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
                           !(filter_flags & FIF_PROMISC_IN_BSS));
        rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
-                          !(filter_flags & FIF_PROMISC_IN_BSS));
+                          !(filter_flags & FIF_PROMISC_IN_BSS) &&
+                          !rt2x00dev->intf_ap_count);
        rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
        rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
                           !(filter_flags & FIF_ALLMULTI));
index a0adf5a04aa0f6f553f4343d786e9e80c2ec4e4a..dc70e7aedfffbe2d442daf3be68803c8db43254b 100644 (file)
@@ -253,6 +253,13 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
         */
        rt2x00lib_config_intf(rt2x00dev, intf, conf->type, intf->mac, NULL);
 
+       /*
+        * Some filters depend on the current working mode. We can force
+        * an update during the next configure_filter() run by mac80211 by
+        * resetting the current packet_filter state.
+        */
+       rt2x00dev->packet_filter = 0;
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_add_interface);
index 0d2e6f7dd69272e0f8b8fbbe2b0841310bf632fa..c5c625143335a0d52765d959e98b609a365fad9c 100644 (file)
@@ -342,7 +342,8 @@ static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
                           !(filter_flags & FIF_PROMISC_IN_BSS));
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
-                          !(filter_flags & FIF_PROMISC_IN_BSS));
+                          !(filter_flags & FIF_PROMISC_IN_BSS) &&
+                          !rt2x00dev->intf_ap_count);
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
                           !(filter_flags & FIF_ALLMULTI));
index b3c8462234321418ebd397765686f377239f9d37..796cf2990b72fdc690cf9d07bfb2f772d64ef191 100644 (file)
@@ -354,7 +354,8 @@ static void rt73usb_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
                           !(filter_flags & FIF_PROMISC_IN_BSS));
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
-                          !(filter_flags & FIF_PROMISC_IN_BSS));
+                          !(filter_flags & FIF_PROMISC_IN_BSS) &&
+                          !rt2x00dev->intf_ap_count);
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
                           !(filter_flags & FIF_ALLMULTI));