aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2009-10-22 14:20:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-11-04 18:44:46 -0500
commit5dfd3e2c6fb69cf4295ec139107f4ebd3f7fbff0 (patch)
treeccef828f4386c567772dad3aa7586f601f56e4a0
parent22995b2411d4c5bbd832a54c4ef6ad3e24a2a34b (diff)
mwl8k: report rate and other information for received frames
When receiving a frame, report the antenna info, long/short preamble status, 20/40 MHz flag, long/short guard interval status, MCS/legacy rate status, and MCS/legacy rate index to the stack. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/mwl8k.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 76c9263f70ac..75c9261abad8 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -169,7 +169,7 @@ struct mwl8k_priv {
169 /* PHY parameters */ 169 /* PHY parameters */
170 struct ieee80211_supported_band band; 170 struct ieee80211_supported_band band;
171 struct ieee80211_channel channels[14]; 171 struct ieee80211_channel channels[14];
172 struct ieee80211_rate rates[12]; 172 struct ieee80211_rate rates[13];
173 173
174 bool radio_on; 174 bool radio_on;
175 bool radio_short_preamble; 175 bool radio_short_preamble;
@@ -208,7 +208,7 @@ struct mwl8k_vif {
208 * Subset of supported legacy rates. 208 * Subset of supported legacy rates.
209 * Intersection of AP and STA supported rates. 209 * Intersection of AP and STA supported rates.
210 */ 210 */
211 struct ieee80211_rate legacy_rates[12]; 211 struct ieee80211_rate legacy_rates[13];
212 212
213 /* number of supported legacy rates */ 213 /* number of supported legacy rates */
214 u8 legacy_nrates; 214 u8 legacy_nrates;
@@ -240,9 +240,10 @@ static const struct ieee80211_rate mwl8k_rates[] = {
240 { .bitrate = 10, .hw_value = 2, }, 240 { .bitrate = 10, .hw_value = 2, },
241 { .bitrate = 20, .hw_value = 4, }, 241 { .bitrate = 20, .hw_value = 4, },
242 { .bitrate = 55, .hw_value = 11, }, 242 { .bitrate = 55, .hw_value = 11, },
243 { .bitrate = 110, .hw_value = 22, },
244 { .bitrate = 220, .hw_value = 44, },
243 { .bitrate = 60, .hw_value = 12, }, 245 { .bitrate = 60, .hw_value = 12, },
244 { .bitrate = 90, .hw_value = 18, }, 246 { .bitrate = 90, .hw_value = 18, },
245 { .bitrate = 110, .hw_value = 22, },
246 { .bitrate = 120, .hw_value = 24, }, 247 { .bitrate = 120, .hw_value = 24, },
247 { .bitrate = 180, .hw_value = 36, }, 248 { .bitrate = 180, .hw_value = 36, },
248 { .bitrate = 240, .hw_value = 48, }, 249 { .bitrate = 240, .hw_value = 48, },
@@ -601,7 +602,7 @@ struct ewc_ht_info {
601/* Peer Entry flags - used to define the type of the peer node */ 602/* Peer Entry flags - used to define the type of the peer node */
602#define MWL8K_PEER_TYPE_ACCESSPOINT 2 603#define MWL8K_PEER_TYPE_ACCESSPOINT 2
603 604
604#define MWL8K_IEEE_LEGACY_DATA_RATES 12 605#define MWL8K_IEEE_LEGACY_DATA_RATES 13
605#define MWL8K_MCS_BITMAP_SIZE 16 606#define MWL8K_MCS_BITMAP_SIZE 16
606 607
607struct peer_capability_info { 608struct peer_capability_info {
@@ -751,6 +752,13 @@ struct mwl8k_rx_desc {
751#define MWL8K_RX_DESCS 256 752#define MWL8K_RX_DESCS 256
752#define MWL8K_RX_MAXSZ 3800 753#define MWL8K_RX_MAXSZ 3800
753 754
755#define RATE_INFO_SHORTPRE 0x8000
756#define RATE_INFO_ANTSELECT(x) (((x) >> 11) & 0x3)
757#define RATE_INFO_RATEID(x) (((x) >> 3) & 0x3f)
758#define RATE_INFO_40MHZ 0x0004
759#define RATE_INFO_SHORTGI 0x0002
760#define RATE_INFO_MCS_FORMAT 0x0001
761
754static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index) 762static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index)
755{ 763{
756 struct mwl8k_priv *priv = hw->priv; 764 struct mwl8k_priv *priv = hw->priv;
@@ -907,6 +915,7 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit)
907 struct ieee80211_rx_status status; 915 struct ieee80211_rx_status status;
908 unsigned long addr; 916 unsigned long addr;
909 struct ieee80211_hdr *wh; 917 struct ieee80211_hdr *wh;
918 u16 rate_info;
910 919
911 rx_desc = rxq->rx_desc_area + rxq->rx_head; 920 rx_desc = rxq->rx_desc_area + rxq->rx_head;
912 if (!(rx_desc->rx_ctrl & MWL8K_RX_CTRL_OWNED_BY_HOST)) 921 if (!(rx_desc->rx_ctrl & MWL8K_RX_CTRL_OWNED_BY_HOST))
@@ -938,14 +947,24 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit)
938 if (mwl8k_capture_bssid(priv, wh)) 947 if (mwl8k_capture_bssid(priv, wh))
939 mwl8k_save_beacon(hw, skb); 948 mwl8k_save_beacon(hw, skb);
940 949
950 rate_info = le16_to_cpu(rx_desc->rate_info);
951
941 memset(&status, 0, sizeof(status)); 952 memset(&status, 0, sizeof(status));
942 status.mactime = 0; 953 status.mactime = 0;
943 status.signal = -rx_desc->rssi; 954 status.signal = -rx_desc->rssi;
944 status.noise = -rx_desc->noise_level; 955 status.noise = -rx_desc->noise_level;
945 status.qual = rx_desc->link_quality; 956 status.qual = rx_desc->link_quality;
946 status.antenna = 1; 957 status.antenna = RATE_INFO_ANTSELECT(rate_info);
947 status.rate_idx = 1; 958 status.rate_idx = RATE_INFO_RATEID(rate_info);
948 status.flag = 0; 959 status.flag = 0;
960 if (rate_info & RATE_INFO_SHORTPRE)
961 status.flag |= RX_FLAG_SHORTPRE;
962 if (rate_info & RATE_INFO_40MHZ)
963 status.flag |= RX_FLAG_40MHZ;
964 if (rate_info & RATE_INFO_SHORTGI)
965 status.flag |= RX_FLAG_SHORT_GI;
966 if (rate_info & RATE_INFO_MCS_FORMAT)
967 status.flag |= RX_FLAG_HT;
949 status.band = IEEE80211_BAND_2GHZ; 968 status.band = IEEE80211_BAND_2GHZ;
950 status.freq = ieee80211_channel_to_frequency(rx_desc->channel); 969 status.freq = ieee80211_channel_to_frequency(rx_desc->channel);
951 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); 970 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));