rt2x00: FIF_PSPOLL filter flag support
authorIgor Perminov <igor.perminov@inbox.ru>
Sat, 8 Aug 2009 21:55:55 +0000 (23:55 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 14 Aug 2009 13:13:53 +0000 (09:13 -0400)
This patch implements FIF_PSPOLL filter flag support in rt2x00 drivers,
which has been introduced in mac80211 (see
http://marc.info/?l=linux-wireless&m=124897986330807&w=2).

Signed-off-by: Igor Perminov <igor.perminov@inbox.ru>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 9efb417105085785b48ecb3757be6560dd3a4fee..2de0389d823d0ba5024805100f6a162f9c73a2e1 100644 (file)
@@ -518,7 +518,7 @@ static void rt2800usb_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_RTS,
                           !(filter_flags & FIF_CONTROL));
        rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PSPOLL,
-                          !(filter_flags & FIF_CONTROL));
+                          !(filter_flags & FIF_PSPOLL));
        rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BA, 1);
        rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BAR, 0);
        rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_CNTL,
@@ -2623,6 +2623,13 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
        if (retval)
                return retval;
 
+       /*
+        * This device has multiple filters for control frames
+        * and has a separate filter for PS Poll frames.
+        */
+       __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+       __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags);
+
        /*
         * This device requires firmware.
         */
index 7c74c4efcb0f7eddc6ffc9438943a8692101303f..5bc100db28d4774d2c59020b13f70d53cc150412 100644 (file)
@@ -624,6 +624,8 @@ enum rt2x00_flags {
         */
        CONFIG_SUPPORT_HW_BUTTON,
        CONFIG_SUPPORT_HW_CRYPTO,
+       DRIVER_SUPPORT_CONTROL_FILTERS,
+       DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL,
 
        /*
         * Driver configuration
index 74451f9672d97bb5d41c63f7840730fdd976f527..cb7b6d4593312f8d32354734af1d143c711daf74 100644 (file)
@@ -392,6 +392,7 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
            FIF_FCSFAIL |
            FIF_PLCPFAIL |
            FIF_CONTROL |
+           FIF_PSPOLL |
            FIF_OTHER_BSS |
            FIF_PROMISC_IN_BSS;
 
@@ -406,6 +407,22 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
            *total_flags & FIF_PROMISC_IN_BSS)
                *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
 
+       /*
+        * If the device has a single filter for all control frames,
+        * FIF_CONTROL and FIF_PSPOLL flags imply each other.
+        * And if the device has more than one filter for control frames
+        * of different types, but has no a separate filter for PS Poll frames,
+        * FIF_CONTROL flag implies FIF_PSPOLL.
+        */
+       if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags)) {
+               if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL)
+                       *total_flags |= FIF_CONTROL | FIF_PSPOLL;
+       }
+       if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags)) {
+               if (*total_flags & FIF_CONTROL)
+                       *total_flags |= FIF_PSPOLL;
+       }
+
        /*
         * Check if there is any work left for us.
         */
index e20dd7431f211f2e0b6ce47c29a5eabbf104d15f..3447997fc71a077b9a8c036085399e36a705cafb 100644 (file)
@@ -530,7 +530,7 @@ static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_PHYSICAL,
                           !(filter_flags & FIF_PLCPFAIL));
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
-                          !(filter_flags & FIF_CONTROL));
+                          !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
        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,
@@ -2623,6 +2623,12 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
        if (retval)
                return retval;
 
+       /*
+        * This device has multiple filters for control frames,
+        * but has no a separate filter for PS Poll frames.
+        */
+       __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+
        /*
         * This device requires firmware and DMA mapped skbs.
         */
index 4f9b1772e1a106323627520b33672c717803b14b..4b9955b1c70e565b5899c0ab901f3f6851ea2c31 100644 (file)
@@ -493,7 +493,7 @@ static void rt73usb_config_filter(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_PHYSICAL,
                           !(filter_flags & FIF_PLCPFAIL));
        rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
-                          !(filter_flags & FIF_CONTROL));
+                          !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
        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,
@@ -2143,6 +2143,12 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
        if (retval)
                return retval;
 
+       /*
+        * This device has multiple filters for control frames,
+        * but has no a separate filter for PS Poll frames.
+        */
+       __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+
        /*
         * This device requires firmware.
         */