aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/xmit.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/xmit.c')
-rw-r--r--drivers/net/wireless/b43/xmit.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index afce9338d83a..f9e1cff2aecb 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -185,14 +185,14 @@ 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 u16 fctl = le16_to_cpu(wlhdr->frame_control);
197 struct ieee80211_rate *fbrate; 197 struct ieee80211_rate *fbrate;
198 u8 rate, rate_fb; 198 u8 rate, rate_fb;
@@ -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 = txctl->hw_key->hw_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,7 +252,7 @@ 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) &
@@ -261,7 +260,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
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_get_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 if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
322 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL))) 321 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
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 }
@@ -684,27 +685,27 @@ void b43_handle_txstatus(struct b43_wldev *dev,
684/* Fill out the mac80211 TXstatus report based on the b43-specific 685/* Fill out the mac80211 TXstatus report based on the b43-specific
685 * txstatus report data. This returns a boolean whether the frame was 686 * txstatus report data. This returns a boolean whether the frame was
686 * successfully transmitted. */ 687 * successfully transmitted. */
687bool b43_fill_txstatus_report(struct ieee80211_tx_status *report, 688bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
688 const struct b43_txstatus *status) 689 const struct b43_txstatus *status)
689{ 690{
690 bool frame_success = 1; 691 bool frame_success = 1;
691 692
692 if (status->acked) { 693 if (status->acked) {
693 /* The frame was ACKed. */ 694 /* The frame was ACKed. */
694 report->flags |= IEEE80211_TX_STATUS_ACK; 695 report->flags |= IEEE80211_TX_STAT_ACK;
695 } else { 696 } else {
696 /* The frame was not ACKed... */ 697 /* The frame was not ACKed... */
697 if (!(report->control.flags & IEEE80211_TXCTL_NO_ACK)) { 698 if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) {
698 /* ...but we expected an ACK. */ 699 /* ...but we expected an ACK. */
699 frame_success = 0; 700 frame_success = 0;
700 report->excessive_retries = 1; 701 report->status.excessive_retries = 1;
701 } 702 }
702 } 703 }
703 if (status->frame_count == 0) { 704 if (status->frame_count == 0) {
704 /* The frame was not transmitted at all. */ 705 /* The frame was not transmitted at all. */
705 report->retry_count = 0; 706 report->status.retry_count = 0;
706 } else 707 } else
707 report->retry_count = status->frame_count - 1; 708 report->status.retry_count = status->frame_count - 1;
708 709
709 return frame_success; 710 return frame_success;
710} 711}