diff options
Diffstat (limited to 'drivers/net/wireless/b43legacy/xmit.c')
-rw-r--r-- | drivers/net/wireless/b43legacy/xmit.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index d84408a82db9..47e130e9fdf2 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c | |||
@@ -37,45 +37,48 @@ | |||
37 | 37 | ||
38 | 38 | ||
39 | /* Extract the bitrate out of a CCK PLCP header. */ | 39 | /* Extract the bitrate out of a CCK PLCP header. */ |
40 | static u8 b43legacy_plcp_get_bitrate_cck(struct b43legacy_plcp_hdr6 *plcp) | 40 | static u8 b43legacy_plcp_get_bitrate_idx_cck(struct b43legacy_plcp_hdr6 *plcp) |
41 | { | 41 | { |
42 | switch (plcp->raw[0]) { | 42 | switch (plcp->raw[0]) { |
43 | case 0x0A: | 43 | case 0x0A: |
44 | return B43legacy_CCK_RATE_1MB; | 44 | return 0; |
45 | case 0x14: | 45 | case 0x14: |
46 | return B43legacy_CCK_RATE_2MB; | 46 | return 1; |
47 | case 0x37: | 47 | case 0x37: |
48 | return B43legacy_CCK_RATE_5MB; | 48 | return 2; |
49 | case 0x6E: | 49 | case 0x6E: |
50 | return B43legacy_CCK_RATE_11MB; | 50 | return 3; |
51 | } | 51 | } |
52 | B43legacy_BUG_ON(1); | 52 | B43legacy_BUG_ON(1); |
53 | return 0; | 53 | return -1; |
54 | } | 54 | } |
55 | 55 | ||
56 | /* Extract the bitrate out of an OFDM PLCP header. */ | 56 | /* Extract the bitrate out of an OFDM PLCP header. */ |
57 | static u8 b43legacy_plcp_get_bitrate_ofdm(struct b43legacy_plcp_hdr6 *plcp) | 57 | static u8 b43legacy_plcp_get_bitrate_idx_ofdm(struct b43legacy_plcp_hdr6 *plcp, |
58 | bool aphy) | ||
58 | { | 59 | { |
60 | int base = aphy ? 0 : 4; | ||
61 | |||
59 | switch (plcp->raw[0] & 0xF) { | 62 | switch (plcp->raw[0] & 0xF) { |
60 | case 0xB: | 63 | case 0xB: |
61 | return B43legacy_OFDM_RATE_6MB; | 64 | return base + 0; |
62 | case 0xF: | 65 | case 0xF: |
63 | return B43legacy_OFDM_RATE_9MB; | 66 | return base + 1; |
64 | case 0xA: | 67 | case 0xA: |
65 | return B43legacy_OFDM_RATE_12MB; | 68 | return base + 2; |
66 | case 0xE: | 69 | case 0xE: |
67 | return B43legacy_OFDM_RATE_18MB; | 70 | return base + 3; |
68 | case 0x9: | 71 | case 0x9: |
69 | return B43legacy_OFDM_RATE_24MB; | 72 | return base + 4; |
70 | case 0xD: | 73 | case 0xD: |
71 | return B43legacy_OFDM_RATE_36MB; | 74 | return base + 5; |
72 | case 0x8: | 75 | case 0x8: |
73 | return B43legacy_OFDM_RATE_48MB; | 76 | return base + 6; |
74 | case 0xC: | 77 | case 0xC: |
75 | return B43legacy_OFDM_RATE_54MB; | 78 | return base + 7; |
76 | } | 79 | } |
77 | B43legacy_BUG_ON(1); | 80 | B43legacy_BUG_ON(1); |
78 | return 0; | 81 | return -1; |
79 | } | 82 | } |
80 | 83 | ||
81 | u8 b43legacy_plcp_get_ratecode_cck(const u8 bitrate) | 84 | u8 b43legacy_plcp_get_ratecode_cck(const u8 bitrate) |
@@ -192,7 +195,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev, | |||
192 | int use_encryption = (!(txctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)); | 195 | int use_encryption = (!(txctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)); |
193 | u16 fctl; | 196 | u16 fctl; |
194 | u8 rate; | 197 | u8 rate; |
195 | u8 rate_fb; | 198 | struct ieee80211_rate *rate_fb; |
196 | int rate_ofdm; | 199 | int rate_ofdm; |
197 | int rate_fb_ofdm; | 200 | int rate_fb_ofdm; |
198 | unsigned int plcp_fragment_len; | 201 | unsigned int plcp_fragment_len; |
@@ -204,16 +207,16 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev, | |||
204 | 207 | ||
205 | memset(txhdr, 0, sizeof(*txhdr)); | 208 | memset(txhdr, 0, sizeof(*txhdr)); |
206 | 209 | ||
207 | rate = txctl->tx_rate; | 210 | rate = txctl->tx_rate->hw_value; |
208 | rate_ofdm = b43legacy_is_ofdm_rate(rate); | 211 | rate_ofdm = b43legacy_is_ofdm_rate(rate); |
209 | rate_fb = (txctl->alt_retry_rate == -1) ? rate : txctl->alt_retry_rate; | 212 | rate_fb = txctl->alt_retry_rate ? : txctl->tx_rate; |
210 | rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb); | 213 | rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value); |
211 | 214 | ||
212 | txhdr->mac_frame_ctl = wlhdr->frame_control; | 215 | txhdr->mac_frame_ctl = wlhdr->frame_control; |
213 | memcpy(txhdr->tx_receiver, wlhdr->addr1, 6); | 216 | memcpy(txhdr->tx_receiver, wlhdr->addr1, 6); |
214 | 217 | ||
215 | /* Calculate duration for fallback rate */ | 218 | /* Calculate duration for fallback rate */ |
216 | if ((rate_fb == rate) || | 219 | if ((rate_fb->hw_value == rate) || |
217 | (wlhdr->duration_id & cpu_to_le16(0x8000)) || | 220 | (wlhdr->duration_id & cpu_to_le16(0x8000)) || |
218 | (wlhdr->duration_id == cpu_to_le16(0))) { | 221 | (wlhdr->duration_id == cpu_to_le16(0))) { |
219 | /* If the fallback rate equals the normal rate or the | 222 | /* If the fallback rate equals the normal rate or the |
@@ -221,11 +224,10 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev, | |||
221 | * use the original dur_id field. */ | 224 | * use the original dur_id field. */ |
222 | txhdr->dur_fb = wlhdr->duration_id; | 225 | txhdr->dur_fb = wlhdr->duration_id; |
223 | } else { | 226 | } else { |
224 | int fbrate_base100kbps = B43legacy_RATE_TO_100KBPS(rate_fb); | ||
225 | txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, | 227 | txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, |
226 | txctl->vif, | 228 | txctl->vif, |
227 | fragment_len, | 229 | fragment_len, |
228 | fbrate_base100kbps); | 230 | rate_fb); |
229 | } | 231 | } |
230 | 232 | ||
231 | plcp_fragment_len = fragment_len + FCS_LEN; | 233 | plcp_fragment_len = fragment_len + FCS_LEN; |
@@ -266,7 +268,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev, | |||
266 | rate); | 268 | rate); |
267 | b43legacy_generate_plcp_hdr((struct b43legacy_plcp_hdr4 *) | 269 | b43legacy_generate_plcp_hdr((struct b43legacy_plcp_hdr4 *) |
268 | (&txhdr->plcp_fb), plcp_fragment_len, | 270 | (&txhdr->plcp_fb), plcp_fragment_len, |
269 | rate_fb); | 271 | rate_fb->hw_value); |
270 | 272 | ||
271 | /* PHY TX Control word */ | 273 | /* PHY TX Control word */ |
272 | if (rate_ofdm) | 274 | if (rate_ofdm) |
@@ -310,7 +312,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev, | |||
310 | int rts_rate_ofdm; | 312 | int rts_rate_ofdm; |
311 | int rts_rate_fb_ofdm; | 313 | int rts_rate_fb_ofdm; |
312 | 314 | ||
313 | rts_rate = txctl->rts_cts_rate; | 315 | rts_rate = txctl->rts_cts_rate->hw_value; |
314 | rts_rate_ofdm = b43legacy_is_ofdm_rate(rts_rate); | 316 | rts_rate_ofdm = b43legacy_is_ofdm_rate(rts_rate); |
315 | rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate); | 317 | rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate); |
316 | rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb); | 318 | rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb); |
@@ -536,10 +538,11 @@ void b43legacy_rx(struct b43legacy_wldev *dev, | |||
536 | (phystat3 & B43legacy_RX_PHYST3_TRSTATE)); | 538 | (phystat3 & B43legacy_RX_PHYST3_TRSTATE)); |
537 | status.noise = dev->stats.link_noise; | 539 | status.noise = dev->stats.link_noise; |
538 | status.signal = (jssi * 100) / B43legacy_RX_MAX_SSI; | 540 | status.signal = (jssi * 100) / B43legacy_RX_MAX_SSI; |
541 | /* change to support A PHY */ | ||
539 | if (phystat0 & B43legacy_RX_PHYST0_OFDM) | 542 | if (phystat0 & B43legacy_RX_PHYST0_OFDM) |
540 | status.rate = b43legacy_plcp_get_bitrate_ofdm(plcp); | 543 | status.rate_idx = b43legacy_plcp_get_bitrate_idx_ofdm(plcp, false); |
541 | else | 544 | else |
542 | status.rate = b43legacy_plcp_get_bitrate_cck(plcp); | 545 | status.rate_idx = b43legacy_plcp_get_bitrate_idx_cck(plcp); |
543 | status.antenna = !!(phystat0 & B43legacy_RX_PHYST0_ANT); | 546 | status.antenna = !!(phystat0 & B43legacy_RX_PHYST0_ANT); |
544 | 547 | ||
545 | /* | 548 | /* |
@@ -564,14 +567,9 @@ void b43legacy_rx(struct b43legacy_wldev *dev, | |||
564 | B43legacy_RX_CHAN_ID_SHIFT; | 567 | B43legacy_RX_CHAN_ID_SHIFT; |
565 | switch (chanstat & B43legacy_RX_CHAN_PHYTYPE) { | 568 | switch (chanstat & B43legacy_RX_CHAN_PHYTYPE) { |
566 | case B43legacy_PHYTYPE_B: | 569 | case B43legacy_PHYTYPE_B: |
567 | status.phymode = MODE_IEEE80211B; | ||
568 | status.freq = chanid + 2400; | ||
569 | status.channel = b43legacy_freq_to_channel_bg(chanid + 2400); | ||
570 | break; | ||
571 | case B43legacy_PHYTYPE_G: | 570 | case B43legacy_PHYTYPE_G: |
572 | status.phymode = MODE_IEEE80211G; | 571 | status.band = IEEE80211_BAND_2GHZ; |
573 | status.freq = chanid + 2400; | 572 | status.freq = chanid + 2400; |
574 | status.channel = b43legacy_freq_to_channel_bg(chanid + 2400); | ||
575 | break; | 573 | break; |
576 | default: | 574 | default: |
577 | b43legacywarn(dev->wl, "Unexpected value for chanstat (0x%X)\n", | 575 | b43legacywarn(dev->wl, "Unexpected value for chanstat (0x%X)\n", |