aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c19
2 files changed, 25 insertions, 1 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 103a122bc9c3..218068bf0ef8 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -32,6 +32,7 @@
32#include <linux/workqueue.h> 32#include <linux/workqueue.h>
33#include <linux/firmware.h> 33#include <linux/firmware.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/etherdevice.h>
35 36
36#include <net/mac80211.h> 37#include <net/mac80211.h>
37 38
@@ -149,6 +150,12 @@ static inline int is_probe_resp(u16 fc)
149 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP)); 150 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP));
150} 151}
151 152
153static inline int is_beacon(u16 fc)
154{
155 return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
156 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON));
157}
158
152/* 159/*
153 * Chipset identification 160 * Chipset identification
154 * The chipset on the device is composed of a RT and RF chip. 161 * The chipset on the device is composed of a RT and RF chip.
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index bd7b73824d0f..a771a092434b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -526,11 +526,14 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
526 struct rxdata_entry_desc *desc) 526 struct rxdata_entry_desc *desc)
527{ 527{
528 struct rt2x00_dev *rt2x00dev = entry->ring->rt2x00dev; 528 struct rt2x00_dev *rt2x00dev = entry->ring->rt2x00dev;
529 struct interface *intf = &rt2x00dev->interface;
529 struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status; 530 struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status;
530 struct ieee80211_hw_mode *mode; 531 struct ieee80211_hw_mode *mode;
531 struct ieee80211_rate *rate; 532 struct ieee80211_rate *rate;
533 struct ieee80211_hdr *hdr;
532 unsigned int i; 534 unsigned int i;
533 int val = 0; 535 int val = 0;
536 u16 fc;
534 537
535 /* 538 /*
536 * Update RX statistics. 539 * Update RX statistics.
@@ -555,7 +558,21 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
555 } 558 }
556 } 559 }
557 560
558 rt2x00lib_update_link_stats(&rt2x00dev->link, desc->rssi); 561 /*
562 * Only update link status if this is a beacon frame carrying our
563 * bssid.
564 */
565 hdr = (struct ieee80211_hdr *) skb->data;
566 if (skb->len >= sizeof(struct ieee80211_hdr *)) {
567 fc = le16_to_cpu(hdr->frame_control);
568 if ((intf->type == IEEE80211_IF_TYPE_STA
569 || intf->type == IEEE80211_IF_TYPE_IBSS)
570 && is_beacon(fc)
571 && compare_ether_addr(hdr->addr3, intf->bssid) == 0)
572 rt2x00lib_update_link_stats(&rt2x00dev->link,
573 desc->rssi);
574 }
575
559 rt2x00dev->link.qual.rx_success++; 576 rt2x00dev->link.qual.rx_success++;
560 577
561 rx_status->rate = val; 578 rx_status->rate = val;