rt2x00: Determine MY_BSS from descriptor
authorIvo van Doorn <ivdoorn@gmail.com>
Sun, 6 Jan 2008 22:41:28 +0000 (23:41 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:09:27 +0000 (15:09 -0800)
Use the MY_BSS descriptor field to determine if the
received frame belongs to the same BSS as the interface.
This can be used by rxdone to determine if the frame
should be updated or not.

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/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00ring.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index ffc7e208f9b247af68715e6ef9ae3c9022e3a46a..95db2ccbc9a65ca0c9e46c05722ece4b57952f44 100644 (file)
@@ -1117,6 +1117,7 @@ static void rt2400pci_fill_rxdone(struct data_entry *entry,
            entry->ring->rt2x00dev->rssi_offset;
        desc->ofdm = 0;
        desc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
+       desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
 }
 
 /*
index 81a48e88f2a0e702a0c71e257c605146a89ee412..133967e81f6f429b8cb5e839641af897c0043662 100644 (file)
@@ -1264,6 +1264,7 @@ static void rt2500pci_fill_rxdone(struct data_entry *entry,
            entry->ring->rt2x00dev->rssi_offset;
        desc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
        desc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
+       desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
 }
 
 /*
index 86eefb45360657d68860c61f76924e7418825772..86549d5b64b38ee493357fa7159b94098da84ec6 100644 (file)
@@ -1138,8 +1138,7 @@ static void rt2500usb_fill_rxdone(struct data_entry *entry,
            entry->ring->rt2x00dev->rssi_offset;
        desc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
        desc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
-
-       return;
+       desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
 }
 
 /*
index a95cf531f083210c5ce7d07419e22096fbe465b7..a11421274f797fc64bc4d802deb433c068bb8fbb 100644 (file)
@@ -526,7 +526,6 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
                      struct rxdata_entry_desc *desc)
 {
        struct rt2x00_dev *rt2x00dev = entry->ring->rt2x00dev;
-       struct interface *intf = &rt2x00dev->interface;
        struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status;
        struct ieee80211_hw_mode *mode;
        struct ieee80211_rate *rate;
@@ -559,19 +558,12 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
        }
 
        /*
-        * Only update link status if this is a beacon frame carrying our
-        * bssid.
+        * Only update link status if this is a beacon frame carrying our bssid.
         */
-       hdr = (struct ieee80211_hdr *) skb->data;
-       if (skb->len >= sizeof(struct ieee80211_hdr *)) {
-               fc = le16_to_cpu(hdr->frame_control);
-               if ((intf->type == IEEE80211_IF_TYPE_STA
-                    || intf->type == IEEE80211_IF_TYPE_IBSS)
-                   && is_beacon(fc)
-                   && compare_ether_addr(hdr->addr3, intf->bssid) == 0)
-                       rt2x00lib_update_link_stats(&rt2x00dev->link,
-                                                   desc->rssi);
-       }
+       hdr = (struct ieee80211_hdr*)skb->data;
+       fc = le16_to_cpu(hdr->frame_control);
+       if (is_beacon(fc) && desc->my_bss)
+               rt2x00lib_update_link_stats(&rt2x00dev->link, desc->rssi);
 
        rt2x00dev->link.qual.rx_success++;
 
index e9a564863127f4d76ab0791273708bedf0fa91d8..1caa6d688c402f74f4244a1ec0365d3f7096880f 100644 (file)
@@ -59,6 +59,7 @@ struct rxdata_entry_desc {
        int ofdm;
        int size;
        int flags;
+       int my_bss;
 };
 
 /*
index 35e7607cf16418a86aeee819b4782ac125621985..eb8102486b5bdd49bd78fbfce20fda755c8a8ce4 100644 (file)
@@ -1695,8 +1695,7 @@ static void rt61pci_fill_rxdone(struct data_entry *entry,
        desc->rssi = rt61pci_agc_to_rssi(entry->ring->rt2x00dev, word1);
        desc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
        desc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
-
-       return;
+       desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
 }
 
 /*
index 29824701e7036f7f79fdf2874c9fa0079922d0fb..beaa264f6af79e8786c70de0b8685c5675b4c95e 100644 (file)
@@ -1396,13 +1396,12 @@ static void rt73usb_fill_rxdone(struct data_entry *entry,
        desc->rssi = rt73usb_agc_to_rssi(entry->ring->rt2x00dev, word1);
        desc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
        desc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
+       desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
 
        /*
         * Pull the skb to clear the descriptor area.
         */
        skb_pull(entry->skb, entry->ring->desc_size);
-
-       return;
 }
 
 /*