aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_rx.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_rx.c57
1 files changed, 46 insertions, 11 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index 66b83e92290..1dd84582ef3 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -70,6 +70,36 @@ static u8 wl1271_rx_rate_to_idx[] = {
70 0 /* WL1271_RATE_1 */ 70 0 /* WL1271_RATE_1 */
71}; 71};
72 72
73/* The values of this table must match the wl1271_rates[] array */
74static u8 wl1271_5_ghz_rx_rate_to_idx[] = {
75 /* MCS rates are used only with 11n */
76 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS7 */
77 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS6 */
78 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS5 */
79 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS4 */
80 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS3 */
81 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS2 */
82 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS1 */
83 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS0 */
84
85 7, /* WL1271_RATE_54 */
86 6, /* WL1271_RATE_48 */
87 5, /* WL1271_RATE_36 */
88 4, /* WL1271_RATE_24 */
89
90 /* TI-specific rate */
91 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_22 */
92
93 3, /* WL1271_RATE_18 */
94 2, /* WL1271_RATE_12 */
95 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_11 */
96 1, /* WL1271_RATE_9 */
97 0, /* WL1271_RATE_6 */
98 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_5_5 */
99 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_2 */
100 WL1271_RX_RATE_UNSUPPORTED /* WL1271_RATE_1 */
101};
102
73static void wl1271_rx_status(struct wl1271 *wl, 103static void wl1271_rx_status(struct wl1271 *wl,
74 struct wl1271_rx_descriptor *desc, 104 struct wl1271_rx_descriptor *desc,
75 struct ieee80211_rx_status *status, 105 struct ieee80211_rx_status *status,
@@ -77,15 +107,21 @@ static void wl1271_rx_status(struct wl1271 *wl,
77{ 107{
78 memset(status, 0, sizeof(struct ieee80211_rx_status)); 108 memset(status, 0, sizeof(struct ieee80211_rx_status));
79 109
80 if ((desc->flags & WL1271_RX_DESC_BAND_MASK) == WL1271_RX_DESC_BAND_BG) 110 if ((desc->flags & WL1271_RX_DESC_BAND_MASK) ==
111 WL1271_RX_DESC_BAND_BG) {
81 status->band = IEEE80211_BAND_2GHZ; 112 status->band = IEEE80211_BAND_2GHZ;
82 else if ((desc->flags & WL1271_RX_DESC_BAND_MASK) == 113 status->rate_idx = wl1271_rx_rate_to_idx[desc->rate];
83 WL1271_RX_DESC_BAND_A) 114 } else if ((desc->flags & WL1271_RX_DESC_BAND_MASK) ==
115 WL1271_RX_DESC_BAND_A) {
84 status->band = IEEE80211_BAND_5GHZ; 116 status->band = IEEE80211_BAND_5GHZ;
85 else 117 status->rate_idx = wl1271_5_ghz_rx_rate_to_idx[desc->rate];
118 } else
86 wl1271_warning("unsupported band 0x%x", 119 wl1271_warning("unsupported band 0x%x",
87 desc->flags & WL1271_RX_DESC_BAND_MASK); 120 desc->flags & WL1271_RX_DESC_BAND_MASK);
88 121
122 if (unlikely(status->rate_idx == WL1271_RX_RATE_UNSUPPORTED))
123 wl1271_warning("unsupported rate");
124
89 /* 125 /*
90 * FIXME: Add mactime handling. For IBSS (ad-hoc) we need to get the 126 * FIXME: Add mactime handling. For IBSS (ad-hoc) we need to get the
91 * timestamp from the beacon (acx_tsf_info). In BSS mode (infra) we 127 * timestamp from the beacon (acx_tsf_info). In BSS mode (infra) we
@@ -108,15 +144,14 @@ static void wl1271_rx_status(struct wl1271 *wl,
108 144
109 if (likely(!(desc->flags & WL1271_RX_DESC_DECRYPT_FAIL))) 145 if (likely(!(desc->flags & WL1271_RX_DESC_DECRYPT_FAIL)))
110 status->flag |= RX_FLAG_DECRYPTED; 146 status->flag |= RX_FLAG_DECRYPTED;
111 147 /* FIXME: Flag should be also set when using 5 GHz band.
148 * At the moment chip reports MIC failed on all packets,
149 * so flag is silently discarded.
150 */
112 if (unlikely(desc->flags & WL1271_RX_DESC_MIC_FAIL)) 151 if (unlikely(desc->flags & WL1271_RX_DESC_MIC_FAIL))
113 status->flag |= RX_FLAG_MMIC_ERROR; 152 if (status->band != IEEE80211_BAND_5GHZ)
153 status->flag |= RX_FLAG_MMIC_ERROR;
114 } 154 }
115
116 status->rate_idx = wl1271_rx_rate_to_idx[desc->rate];
117
118 if (status->rate_idx == WL1271_RX_RATE_UNSUPPORTED)
119 wl1271_warning("unsupported rate");
120} 155}
121 156
122static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length) 157static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length)