diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-03-26 06:53:11 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-31 14:39:11 -0400 |
commit | f876bb9aafc71d8ea395eec99666faaffec5df49 (patch) | |
tree | db19cff09cdb3ffe237c8031b00788a4c79d8192 /drivers/net/wireless/wl12xx/wl1271_rx.c | |
parent | 7fdd50d07fed198b2c6ccdca96ab5537014597d8 (diff) |
wl1271: Clean up RX rate reporting
Clean up the code to convert a firmware rate class index into an index
for the rate configuration table.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_rx.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_rx.c | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c index b824c6cc2cc5..a1a7953e475a 100644 --- a/drivers/net/wireless/wl12xx/wl1271_rx.c +++ b/drivers/net/wireless/wl12xx/wl1271_rx.c | |||
@@ -41,66 +41,6 @@ static u32 wl1271_rx_get_buf_size(struct wl1271_fw_status *status, | |||
41 | RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV; | 41 | RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV; |
42 | } | 42 | } |
43 | 43 | ||
44 | /* The values of this table must match the wl1271_rates[] array */ | ||
45 | static u8 wl1271_rx_rate_to_idx[] = { | ||
46 | /* MCS rates are used only with 11n */ | ||
47 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS7 */ | ||
48 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS6 */ | ||
49 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS5 */ | ||
50 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS4 */ | ||
51 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS3 */ | ||
52 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS2 */ | ||
53 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS1 */ | ||
54 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS0 */ | ||
55 | |||
56 | 11, /* WL1271_RATE_54 */ | ||
57 | 10, /* WL1271_RATE_48 */ | ||
58 | 9, /* WL1271_RATE_36 */ | ||
59 | 8, /* WL1271_RATE_24 */ | ||
60 | |||
61 | /* TI-specific rate */ | ||
62 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_22 */ | ||
63 | |||
64 | 7, /* WL1271_RATE_18 */ | ||
65 | 6, /* WL1271_RATE_12 */ | ||
66 | 3, /* WL1271_RATE_11 */ | ||
67 | 5, /* WL1271_RATE_9 */ | ||
68 | 4, /* WL1271_RATE_6 */ | ||
69 | 2, /* WL1271_RATE_5_5 */ | ||
70 | 1, /* WL1271_RATE_2 */ | ||
71 | 0 /* WL1271_RATE_1 */ | ||
72 | }; | ||
73 | |||
74 | /* The values of this table must match the wl1271_rates[] array */ | ||
75 | static u8 wl1271_5_ghz_rx_rate_to_idx[] = { | ||
76 | /* MCS rates are used only with 11n */ | ||
77 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS7 */ | ||
78 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS6 */ | ||
79 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS5 */ | ||
80 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS4 */ | ||
81 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS3 */ | ||
82 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS2 */ | ||
83 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS1 */ | ||
84 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS0 */ | ||
85 | |||
86 | 7, /* WL1271_RATE_54 */ | ||
87 | 6, /* WL1271_RATE_48 */ | ||
88 | 5, /* WL1271_RATE_36 */ | ||
89 | 4, /* WL1271_RATE_24 */ | ||
90 | |||
91 | /* TI-specific rate */ | ||
92 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_22 */ | ||
93 | |||
94 | 3, /* WL1271_RATE_18 */ | ||
95 | 2, /* WL1271_RATE_12 */ | ||
96 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_11 */ | ||
97 | 1, /* WL1271_RATE_9 */ | ||
98 | 0, /* WL1271_RATE_6 */ | ||
99 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_5_5 */ | ||
100 | WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_2 */ | ||
101 | WL1271_RX_RATE_UNSUPPORTED /* WL1271_RATE_1 */ | ||
102 | }; | ||
103 | |||
104 | static void wl1271_rx_status(struct wl1271 *wl, | 44 | static void wl1271_rx_status(struct wl1271 *wl, |
105 | struct wl1271_rx_descriptor *desc, | 45 | struct wl1271_rx_descriptor *desc, |
106 | struct ieee80211_rx_status *status, | 46 | struct ieee80211_rx_status *status, |
@@ -108,20 +48,8 @@ static void wl1271_rx_status(struct wl1271 *wl, | |||
108 | { | 48 | { |
109 | memset(status, 0, sizeof(struct ieee80211_rx_status)); | 49 | memset(status, 0, sizeof(struct ieee80211_rx_status)); |
110 | 50 | ||
111 | if ((desc->flags & WL1271_RX_DESC_BAND_MASK) == | 51 | status->band = wl->band; |
112 | WL1271_RX_DESC_BAND_BG) { | 52 | status->rate_idx = wl1271_rate_to_idx(wl, desc->rate); |
113 | status->band = IEEE80211_BAND_2GHZ; | ||
114 | status->rate_idx = wl1271_rx_rate_to_idx[desc->rate]; | ||
115 | } else if ((desc->flags & WL1271_RX_DESC_BAND_MASK) == | ||
116 | WL1271_RX_DESC_BAND_A) { | ||
117 | status->band = IEEE80211_BAND_5GHZ; | ||
118 | status->rate_idx = wl1271_5_ghz_rx_rate_to_idx[desc->rate]; | ||
119 | } else | ||
120 | wl1271_warning("unsupported band 0x%x", | ||
121 | desc->flags & WL1271_RX_DESC_BAND_MASK); | ||
122 | |||
123 | if (unlikely(status->rate_idx == WL1271_RX_RATE_UNSUPPORTED)) | ||
124 | wl1271_warning("unsupported rate"); | ||
125 | 53 | ||
126 | /* | 54 | /* |
127 | * FIXME: Add mactime handling. For IBSS (ad-hoc) we need to get the | 55 | * FIXME: Add mactime handling. For IBSS (ad-hoc) we need to get the |