diff options
Diffstat (limited to 'drivers/net/wireless/b43/xmit.c')
-rw-r--r-- | drivers/net/wireless/b43/xmit.c | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 19aefbfb2c93..8d54502222a6 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -185,15 +185,15 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
185 | u8 *_txhdr, | 185 | u8 *_txhdr, |
186 | const unsigned char *fragment_data, | 186 | const unsigned char *fragment_data, |
187 | unsigned int fragment_len, | 187 | unsigned int fragment_len, |
188 | const struct ieee80211_tx_control *txctl, | 188 | const struct ieee80211_tx_info *info, |
189 | u16 cookie) | 189 | u16 cookie) |
190 | { | 190 | { |
191 | struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr; | 191 | struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr; |
192 | const struct b43_phy *phy = &dev->phy; | 192 | const struct b43_phy *phy = &dev->phy; |
193 | const struct ieee80211_hdr *wlhdr = | 193 | const struct ieee80211_hdr *wlhdr = |
194 | (const struct ieee80211_hdr *)fragment_data; | 194 | (const struct ieee80211_hdr *)fragment_data; |
195 | int use_encryption = (!(txctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)); | 195 | int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)); |
196 | u16 fctl = le16_to_cpu(wlhdr->frame_control); | 196 | __le16 fctl = wlhdr->frame_control; |
197 | struct ieee80211_rate *fbrate; | 197 | struct ieee80211_rate *fbrate; |
198 | u8 rate, rate_fb; | 198 | u8 rate, rate_fb; |
199 | int rate_ofdm, rate_fb_ofdm; | 199 | int rate_ofdm, rate_fb_ofdm; |
@@ -201,13 +201,14 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
201 | u32 mac_ctl = 0; | 201 | u32 mac_ctl = 0; |
202 | u16 phy_ctl = 0; | 202 | u16 phy_ctl = 0; |
203 | u8 extra_ft = 0; | 203 | u8 extra_ft = 0; |
204 | struct ieee80211_rate *txrate; | ||
204 | 205 | ||
205 | memset(txhdr, 0, sizeof(*txhdr)); | 206 | memset(txhdr, 0, sizeof(*txhdr)); |
206 | 207 | ||
207 | WARN_ON(!txctl->tx_rate); | 208 | txrate = ieee80211_get_tx_rate(dev->wl->hw, info); |
208 | rate = txctl->tx_rate ? txctl->tx_rate->hw_value : B43_CCK_RATE_1MB; | 209 | rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB; |
209 | rate_ofdm = b43_is_ofdm_rate(rate); | 210 | rate_ofdm = b43_is_ofdm_rate(rate); |
210 | fbrate = txctl->alt_retry_rate ? : txctl->tx_rate; | 211 | fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, info) ? : txrate; |
211 | rate_fb = fbrate->hw_value; | 212 | rate_fb = fbrate->hw_value; |
212 | rate_fb_ofdm = b43_is_ofdm_rate(rate_fb); | 213 | rate_fb_ofdm = b43_is_ofdm_rate(rate_fb); |
213 | 214 | ||
@@ -227,15 +228,13 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
227 | * use the original dur_id field. */ | 228 | * use the original dur_id field. */ |
228 | txhdr->dur_fb = wlhdr->duration_id; | 229 | txhdr->dur_fb = wlhdr->duration_id; |
229 | } else { | 230 | } else { |
230 | txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, | 231 | txhdr->dur_fb = ieee80211_generic_frame_duration( |
231 | txctl->vif, | 232 | dev->wl->hw, info->control.vif, fragment_len, fbrate); |
232 | fragment_len, | ||
233 | fbrate); | ||
234 | } | 233 | } |
235 | 234 | ||
236 | plcp_fragment_len = fragment_len + FCS_LEN; | 235 | plcp_fragment_len = fragment_len + FCS_LEN; |
237 | if (use_encryption) { | 236 | if (use_encryption) { |
238 | u8 key_idx = (u16) (txctl->key_idx); | 237 | u8 key_idx = info->control.hw_key->hw_key_idx; |
239 | struct b43_key *key; | 238 | struct b43_key *key; |
240 | int wlhdr_len; | 239 | int wlhdr_len; |
241 | size_t iv_len; | 240 | size_t iv_len; |
@@ -253,15 +252,15 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
253 | } | 252 | } |
254 | 253 | ||
255 | /* Hardware appends ICV. */ | 254 | /* Hardware appends ICV. */ |
256 | plcp_fragment_len += txctl->icv_len; | 255 | plcp_fragment_len += info->control.icv_len; |
257 | 256 | ||
258 | key_idx = b43_kidx_to_fw(dev, key_idx); | 257 | key_idx = b43_kidx_to_fw(dev, key_idx); |
259 | mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) & | 258 | mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) & |
260 | B43_TXH_MAC_KEYIDX; | 259 | B43_TXH_MAC_KEYIDX; |
261 | mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & | 260 | mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & |
262 | B43_TXH_MAC_KEYALG; | 261 | B43_TXH_MAC_KEYALG; |
263 | wlhdr_len = ieee80211_get_hdrlen(fctl); | 262 | wlhdr_len = ieee80211_hdrlen(fctl); |
264 | iv_len = min((size_t) txctl->iv_len, | 263 | iv_len = min((size_t) info->control.iv_len, |
265 | ARRAY_SIZE(txhdr->iv)); | 264 | ARRAY_SIZE(txhdr->iv)); |
266 | memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); | 265 | memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); |
267 | } | 266 | } |
@@ -292,10 +291,10 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
292 | phy_ctl |= B43_TXH_PHY_ENC_OFDM; | 291 | phy_ctl |= B43_TXH_PHY_ENC_OFDM; |
293 | else | 292 | else |
294 | phy_ctl |= B43_TXH_PHY_ENC_CCK; | 293 | phy_ctl |= B43_TXH_PHY_ENC_CCK; |
295 | if (txctl->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) | 294 | if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) |
296 | phy_ctl |= B43_TXH_PHY_SHORTPRMBL; | 295 | phy_ctl |= B43_TXH_PHY_SHORTPRMBL; |
297 | 296 | ||
298 | switch (b43_ieee80211_antenna_sanitize(dev, txctl->antenna_sel_tx)) { | 297 | switch (b43_ieee80211_antenna_sanitize(dev, info->antenna_sel_tx)) { |
299 | case 0: /* Default */ | 298 | case 0: /* Default */ |
300 | phy_ctl |= B43_TXH_PHY_ANT01AUTO; | 299 | phy_ctl |= B43_TXH_PHY_ANT01AUTO; |
301 | break; | 300 | break; |
@@ -316,34 +315,36 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
316 | } | 315 | } |
317 | 316 | ||
318 | /* MAC control */ | 317 | /* MAC control */ |
319 | if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK)) | 318 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) |
320 | mac_ctl |= B43_TXH_MAC_ACK; | 319 | mac_ctl |= B43_TXH_MAC_ACK; |
321 | if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && | 320 | /* use hardware sequence counter as the non-TID counter */ |
322 | ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL))) | 321 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) |
323 | mac_ctl |= B43_TXH_MAC_HWSEQ; | 322 | mac_ctl |= B43_TXH_MAC_HWSEQ; |
324 | if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) | 323 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
325 | mac_ctl |= B43_TXH_MAC_STMSDU; | 324 | mac_ctl |= B43_TXH_MAC_STMSDU; |
326 | if (phy->type == B43_PHYTYPE_A) | 325 | if (phy->type == B43_PHYTYPE_A) |
327 | mac_ctl |= B43_TXH_MAC_5GHZ; | 326 | mac_ctl |= B43_TXH_MAC_5GHZ; |
328 | if (txctl->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT) | 327 | if (info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT) |
329 | mac_ctl |= B43_TXH_MAC_LONGFRAME; | 328 | mac_ctl |= B43_TXH_MAC_LONGFRAME; |
330 | 329 | ||
331 | /* Generate the RTS or CTS-to-self frame */ | 330 | /* Generate the RTS or CTS-to-self frame */ |
332 | if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || | 331 | if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || |
333 | (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { | 332 | (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) { |
334 | unsigned int len; | 333 | unsigned int len; |
335 | struct ieee80211_hdr *hdr; | 334 | struct ieee80211_hdr *hdr; |
336 | int rts_rate, rts_rate_fb; | 335 | int rts_rate, rts_rate_fb; |
337 | int rts_rate_ofdm, rts_rate_fb_ofdm; | 336 | int rts_rate_ofdm, rts_rate_fb_ofdm; |
338 | struct b43_plcp_hdr6 *plcp; | 337 | struct b43_plcp_hdr6 *plcp; |
338 | struct ieee80211_rate *rts_cts_rate; | ||
339 | 339 | ||
340 | WARN_ON(!txctl->rts_cts_rate); | 340 | rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info); |
341 | rts_rate = txctl->rts_cts_rate ? txctl->rts_cts_rate->hw_value : B43_CCK_RATE_1MB; | 341 | |
342 | rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB; | ||
342 | rts_rate_ofdm = b43_is_ofdm_rate(rts_rate); | 343 | rts_rate_ofdm = b43_is_ofdm_rate(rts_rate); |
343 | rts_rate_fb = b43_calc_fallback_rate(rts_rate); | 344 | rts_rate_fb = b43_calc_fallback_rate(rts_rate); |
344 | rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); | 345 | rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); |
345 | 346 | ||
346 | if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { | 347 | if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { |
347 | struct ieee80211_cts *cts; | 348 | struct ieee80211_cts *cts; |
348 | 349 | ||
349 | if (b43_is_old_txhdr_format(dev)) { | 350 | if (b43_is_old_txhdr_format(dev)) { |
@@ -353,9 +354,9 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
353 | cts = (struct ieee80211_cts *) | 354 | cts = (struct ieee80211_cts *) |
354 | (txhdr->new_format.rts_frame); | 355 | (txhdr->new_format.rts_frame); |
355 | } | 356 | } |
356 | ieee80211_ctstoself_get(dev->wl->hw, txctl->vif, | 357 | ieee80211_ctstoself_get(dev->wl->hw, info->control.vif, |
357 | fragment_data, fragment_len, | 358 | fragment_data, fragment_len, |
358 | txctl, cts); | 359 | info, cts); |
359 | mac_ctl |= B43_TXH_MAC_SENDCTS; | 360 | mac_ctl |= B43_TXH_MAC_SENDCTS; |
360 | len = sizeof(struct ieee80211_cts); | 361 | len = sizeof(struct ieee80211_cts); |
361 | } else { | 362 | } else { |
@@ -368,9 +369,9 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
368 | rts = (struct ieee80211_rts *) | 369 | rts = (struct ieee80211_rts *) |
369 | (txhdr->new_format.rts_frame); | 370 | (txhdr->new_format.rts_frame); |
370 | } | 371 | } |
371 | ieee80211_rts_get(dev->wl->hw, txctl->vif, | 372 | ieee80211_rts_get(dev->wl->hw, info->control.vif, |
372 | fragment_data, fragment_len, | 373 | fragment_data, fragment_len, |
373 | txctl, rts); | 374 | info, rts); |
374 | mac_ctl |= B43_TXH_MAC_SENDRTS; | 375 | mac_ctl |= B43_TXH_MAC_SENDRTS; |
375 | len = sizeof(struct ieee80211_rts); | 376 | len = sizeof(struct ieee80211_rts); |
376 | } | 377 | } |
@@ -508,7 +509,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
508 | struct b43_plcp_hdr6 *plcp; | 509 | struct b43_plcp_hdr6 *plcp; |
509 | struct ieee80211_hdr *wlhdr; | 510 | struct ieee80211_hdr *wlhdr; |
510 | const struct b43_rxhdr_fw4 *rxhdr = _rxhdr; | 511 | const struct b43_rxhdr_fw4 *rxhdr = _rxhdr; |
511 | u16 fctl; | 512 | __le16 fctl; |
512 | u16 phystat0, phystat3, chanstat, mactime; | 513 | u16 phystat0, phystat3, chanstat, mactime; |
513 | u32 macstat; | 514 | u32 macstat; |
514 | u16 chanid; | 515 | u16 chanid; |
@@ -548,7 +549,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
548 | goto drop; | 549 | goto drop; |
549 | } | 550 | } |
550 | wlhdr = (struct ieee80211_hdr *)(skb->data); | 551 | wlhdr = (struct ieee80211_hdr *)(skb->data); |
551 | fctl = le16_to_cpu(wlhdr->frame_control); | 552 | fctl = wlhdr->frame_control; |
552 | 553 | ||
553 | if (macstat & B43_RX_MAC_DEC) { | 554 | if (macstat & B43_RX_MAC_DEC) { |
554 | unsigned int keyidx; | 555 | unsigned int keyidx; |
@@ -563,7 +564,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
563 | B43_WARN_ON(keyidx >= dev->max_nr_keys); | 564 | B43_WARN_ON(keyidx >= dev->max_nr_keys); |
564 | 565 | ||
565 | if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) { | 566 | if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) { |
566 | wlhdr_len = ieee80211_get_hdrlen(fctl); | 567 | wlhdr_len = ieee80211_hdrlen(fctl); |
567 | if (unlikely(skb->len < (wlhdr_len + 3))) { | 568 | if (unlikely(skb->len < (wlhdr_len + 3))) { |
568 | b43dbg(dev->wl, | 569 | b43dbg(dev->wl, |
569 | "RX: Packet size underrun (3)\n"); | 570 | "RX: Packet size underrun (3)\n"); |
@@ -581,12 +582,11 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
581 | // and also find out what the maximum possible value is. | 582 | // and also find out what the maximum possible value is. |
582 | // Fill status.ssi and status.signal fields. | 583 | // Fill status.ssi and status.signal fields. |
583 | } else { | 584 | } else { |
584 | status.ssi = b43_rssi_postprocess(dev, rxhdr->jssi, | 585 | status.signal = b43_rssi_postprocess(dev, rxhdr->jssi, |
585 | (phystat0 & B43_RX_PHYST0_OFDM), | 586 | (phystat0 & B43_RX_PHYST0_OFDM), |
586 | (phystat0 & B43_RX_PHYST0_GAINCTL), | 587 | (phystat0 & B43_RX_PHYST0_GAINCTL), |
587 | (phystat3 & B43_RX_PHYST3_TRSTATE)); | 588 | (phystat3 & B43_RX_PHYST3_TRSTATE)); |
588 | /* the next line looks wrong, but is what mac80211 wants */ | 589 | status.qual = (rxhdr->jssi * 100) / B43_RX_MAX_SSI; |
589 | status.signal = (rxhdr->jssi * 100) / B43_RX_MAX_SSI; | ||
590 | } | 590 | } |
591 | 591 | ||
592 | if (phystat0 & B43_RX_PHYST0_OFDM) | 592 | if (phystat0 & B43_RX_PHYST0_OFDM) |
@@ -604,9 +604,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
604 | * of timestamp, i.e. about 65 milliseconds after the PHY received | 604 | * of timestamp, i.e. about 65 milliseconds after the PHY received |
605 | * the first symbol. | 605 | * the first symbol. |
606 | */ | 606 | */ |
607 | if (((fctl & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) | 607 | if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) { |
608 | == (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) || | ||
609 | dev->wl->radiotap_enabled) { | ||
610 | u16 low_mactime_now; | 608 | u16 low_mactime_now; |
611 | 609 | ||
612 | b43_tsf_read(dev, &status.mactime); | 610 | b43_tsf_read(dev, &status.mactime); |
@@ -685,27 +683,27 @@ void b43_handle_txstatus(struct b43_wldev *dev, | |||
685 | /* Fill out the mac80211 TXstatus report based on the b43-specific | 683 | /* Fill out the mac80211 TXstatus report based on the b43-specific |
686 | * txstatus report data. This returns a boolean whether the frame was | 684 | * txstatus report data. This returns a boolean whether the frame was |
687 | * successfully transmitted. */ | 685 | * successfully transmitted. */ |
688 | bool b43_fill_txstatus_report(struct ieee80211_tx_status *report, | 686 | bool b43_fill_txstatus_report(struct ieee80211_tx_info *report, |
689 | const struct b43_txstatus *status) | 687 | const struct b43_txstatus *status) |
690 | { | 688 | { |
691 | bool frame_success = 1; | 689 | bool frame_success = 1; |
692 | 690 | ||
693 | if (status->acked) { | 691 | if (status->acked) { |
694 | /* The frame was ACKed. */ | 692 | /* The frame was ACKed. */ |
695 | report->flags |= IEEE80211_TX_STATUS_ACK; | 693 | report->flags |= IEEE80211_TX_STAT_ACK; |
696 | } else { | 694 | } else { |
697 | /* The frame was not ACKed... */ | 695 | /* The frame was not ACKed... */ |
698 | if (!(report->control.flags & IEEE80211_TXCTL_NO_ACK)) { | 696 | if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) { |
699 | /* ...but we expected an ACK. */ | 697 | /* ...but we expected an ACK. */ |
700 | frame_success = 0; | 698 | frame_success = 0; |
701 | report->excessive_retries = 1; | 699 | report->status.excessive_retries = 1; |
702 | } | 700 | } |
703 | } | 701 | } |
704 | if (status->frame_count == 0) { | 702 | if (status->frame_count == 0) { |
705 | /* The frame was not transmitted at all. */ | 703 | /* The frame was not transmitted at all. */ |
706 | report->retry_count = 0; | 704 | report->status.retry_count = 0; |
707 | } else | 705 | } else |
708 | report->retry_count = status->frame_count - 1; | 706 | report->status.retry_count = status->frame_count - 1; |
709 | 707 | ||
710 | return frame_success; | 708 | return frame_success; |
711 | } | 709 | } |