p54: add more rx filters
authorChristian Lamparter <chunkeey@web.de>
Sat, 6 Sep 2008 00:56:12 +0000 (02:56 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 11 Sep 2008 19:53:31 +0000 (15:53 -0400)
This patch adds new filters settings to make the card more useful in monitor mode.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/p54common.c

index 36b8e584c6cf39f107968b86516baa4f22a85afc..ea72b65428ec44b540a4ee2700817e2b00de5ffd 100644 (file)
@@ -80,6 +80,7 @@ struct p54_common {
        struct pda_channel_output_limit *output_limit;
        unsigned int output_limit_len;
        struct pda_pa_curve_data *curve_data;
+       unsigned int filter_flags;
        u16 rxhw;
        u8 version;
        u8 rx_antenna;
index 526d3a282b7a24e54005c9bc57e100d81ff6b1ba..300f97b1bfe4e95dc6d6763e33efb174f87313f1 100644 (file)
@@ -433,6 +433,13 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
        size_t header_len = sizeof(*hdr);
        u32 tsf32;
 
+       if (!(hdr->magic & cpu_to_le16(0x0001))) {
+               if (priv->filter_flags & FIF_FCSFAIL)
+                       rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
+               else
+                       return 0;
+       }
+
        rx_status.signal = hdr->rssi;
        /* XX correct? */
        rx_status.qual = (100 * hdr->rssi) / 127;
@@ -1127,13 +1134,26 @@ static void p54_configure_filter(struct ieee80211_hw *dev,
 {
        struct p54_common *priv = dev->priv;
 
-       *total_flags &= FIF_BCN_PRBRESP_PROMISC;
+       *total_flags &= FIF_BCN_PRBRESP_PROMISC |
+                       FIF_PROMISC_IN_BSS |
+                       FIF_FCSFAIL;
+
+       priv->filter_flags = *total_flags;
 
        if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
                if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
-                       p54_set_filter(dev, 0, NULL);
+                       p54_set_filter(dev, priv->filter_type, NULL);
+               else
+                       p54_set_filter(dev, priv->filter_type, priv->bssid);
+       }
+
+       if (changed_flags & FIF_PROMISC_IN_BSS) {
+               if (*total_flags & FIF_PROMISC_IN_BSS)
+                       p54_set_filter(dev, priv->filter_type |
+                               cpu_to_le16(0x8), NULL);
                else
-                       p54_set_filter(dev, 0, priv->bssid);
+                       p54_set_filter(dev, priv->filter_type &
+                               ~cpu_to_le16(0x8), priv->bssid);
        }
 }