aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/xmit.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-15 06:55:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:11 -0400
commite039fa4a4195ac4ee895e6f3d1334beed63256fe (patch)
treecfd0762d73df96b73052378be7b157c4ac6e7035 /drivers/net/wireless/b43/xmit.c
parente24549485f859be6518929bb1c9c0257d79f033d (diff)
mac80211: move TX info into skb->cb
This patch converts mac80211 and all drivers to have transmit information and status in skb->cb rather than allocating extra memory for it and copying all the data around. To make it fit, a union is used where only data that is necessary for all steps is kept outside of the union. A number of fixes were done by Ivo, as well as the rt2x00 part of this patch. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/xmit.c')
-rw-r--r--drivers/net/wireless/b43/xmit.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 9b682a3cf5e..f9e1cff2aec 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;
@@ -205,10 +205,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
205 205
206 memset(txhdr, 0, sizeof(*txhdr)); 206 memset(txhdr, 0, sizeof(*txhdr));
207 207
208 txrate = ieee80211_get_tx_rate(dev->wl->hw, txctl); 208 txrate = ieee80211_get_tx_rate(dev->wl->hw, info);
209 rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB; 209 rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB;
210 rate_ofdm = b43_is_ofdm_rate(rate); 210 rate_ofdm = b43_is_ofdm_rate(rate);
211 fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, txctl) ? : txrate; 211 fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, info) ? : txrate;
212 rate_fb = fbrate->hw_value; 212 rate_fb = fbrate->hw_value;
213 rate_fb_ofdm = b43_is_ofdm_rate(rate_fb); 213 rate_fb_ofdm = b43_is_ofdm_rate(rate_fb);
214 214
@@ -228,15 +228,13 @@ int b43_generate_txhdr(struct b43_wldev *dev,
228 * use the original dur_id field. */ 228 * use the original dur_id field. */
229 txhdr->dur_fb = wlhdr->duration_id; 229 txhdr->dur_fb = wlhdr->duration_id;
230 } else { 230 } else {
231 txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, 231 txhdr->dur_fb = ieee80211_generic_frame_duration(
232 txctl->vif, 232 dev->wl->hw, info->control.vif, fragment_len, fbrate);
233 fragment_len,
234 fbrate);
235 } 233 }
236 234
237 plcp_fragment_len = fragment_len + FCS_LEN; 235 plcp_fragment_len = fragment_len + FCS_LEN;
238 if (use_encryption) { 236 if (use_encryption) {
239 u8 key_idx = txctl->hw_key->hw_key_idx; 237 u8 key_idx = info->control.hw_key->hw_key_idx;
240 struct b43_key *key; 238 struct b43_key *key;
241 int wlhdr_len; 239 int wlhdr_len;
242 size_t iv_len; 240 size_t iv_len;
@@ -254,7 +252,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
254 } 252 }
255 253
256 /* Hardware appends ICV. */ 254 /* Hardware appends ICV. */
257 plcp_fragment_len += txctl->icv_len; 255 plcp_fragment_len += info->control.icv_len;
258 256
259 key_idx = b43_kidx_to_fw(dev, key_idx); 257 key_idx = b43_kidx_to_fw(dev, key_idx);
260 mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) & 258 mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) &
@@ -262,7 +260,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
262 mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & 260 mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
263 B43_TXH_MAC_KEYALG; 261 B43_TXH_MAC_KEYALG;
264 wlhdr_len = ieee80211_get_hdrlen(fctl); 262 wlhdr_len = ieee80211_get_hdrlen(fctl);
265 iv_len = min((size_t) txctl->iv_len, 263 iv_len = min((size_t) info->control.iv_len,
266 ARRAY_SIZE(txhdr->iv)); 264 ARRAY_SIZE(txhdr->iv));
267 memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); 265 memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
268 } 266 }
@@ -293,10 +291,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
293 phy_ctl |= B43_TXH_PHY_ENC_OFDM; 291 phy_ctl |= B43_TXH_PHY_ENC_OFDM;
294 else 292 else
295 phy_ctl |= B43_TXH_PHY_ENC_CCK; 293 phy_ctl |= B43_TXH_PHY_ENC_CCK;
296 if (txctl->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) 294 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE)
297 phy_ctl |= B43_TXH_PHY_SHORTPRMBL; 295 phy_ctl |= B43_TXH_PHY_SHORTPRMBL;
298 296
299 switch (b43_ieee80211_antenna_sanitize(dev, txctl->antenna_sel_tx)) { 297 switch (b43_ieee80211_antenna_sanitize(dev, info->antenna_sel_tx)) {
300 case 0: /* Default */ 298 case 0: /* Default */
301 phy_ctl |= B43_TXH_PHY_ANT01AUTO; 299 phy_ctl |= B43_TXH_PHY_ANT01AUTO;
302 break; 300 break;
@@ -317,21 +315,21 @@ int b43_generate_txhdr(struct b43_wldev *dev,
317 } 315 }
318 316
319 /* MAC control */ 317 /* MAC control */
320 if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK)) 318 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
321 mac_ctl |= B43_TXH_MAC_ACK; 319 mac_ctl |= B43_TXH_MAC_ACK;
322 if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && 320 if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
323 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL))) 321 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
324 mac_ctl |= B43_TXH_MAC_HWSEQ; 322 mac_ctl |= B43_TXH_MAC_HWSEQ;
325 if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) 323 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
326 mac_ctl |= B43_TXH_MAC_STMSDU; 324 mac_ctl |= B43_TXH_MAC_STMSDU;
327 if (phy->type == B43_PHYTYPE_A) 325 if (phy->type == B43_PHYTYPE_A)
328 mac_ctl |= B43_TXH_MAC_5GHZ; 326 mac_ctl |= B43_TXH_MAC_5GHZ;
329 if (txctl->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT) 327 if (info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT)
330 mac_ctl |= B43_TXH_MAC_LONGFRAME; 328 mac_ctl |= B43_TXH_MAC_LONGFRAME;
331 329
332 /* Generate the RTS or CTS-to-self frame */ 330 /* Generate the RTS or CTS-to-self frame */
333 if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 331 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) ||
334 (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { 332 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) {
335 unsigned int len; 333 unsigned int len;
336 struct ieee80211_hdr *hdr; 334 struct ieee80211_hdr *hdr;
337 int rts_rate, rts_rate_fb; 335 int rts_rate, rts_rate_fb;
@@ -339,14 +337,14 @@ int b43_generate_txhdr(struct b43_wldev *dev,
339 struct b43_plcp_hdr6 *plcp; 337 struct b43_plcp_hdr6 *plcp;
340 struct ieee80211_rate *rts_cts_rate; 338 struct ieee80211_rate *rts_cts_rate;
341 339
342 rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, txctl); 340 rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info);
343 341
344 rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB; 342 rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB;
345 rts_rate_ofdm = b43_is_ofdm_rate(rts_rate); 343 rts_rate_ofdm = b43_is_ofdm_rate(rts_rate);
346 rts_rate_fb = b43_calc_fallback_rate(rts_rate); 344 rts_rate_fb = b43_calc_fallback_rate(rts_rate);
347 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); 345 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb);
348 346
349 if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 347 if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
350 struct ieee80211_cts *cts; 348 struct ieee80211_cts *cts;
351 349
352 if (b43_is_old_txhdr_format(dev)) { 350 if (b43_is_old_txhdr_format(dev)) {
@@ -356,9 +354,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
356 cts = (struct ieee80211_cts *) 354 cts = (struct ieee80211_cts *)
357 (txhdr->new_format.rts_frame); 355 (txhdr->new_format.rts_frame);
358 } 356 }
359 ieee80211_ctstoself_get(dev->wl->hw, txctl->vif, 357 ieee80211_ctstoself_get(dev->wl->hw, info->control.vif,
360 fragment_data, fragment_len, 358 fragment_data, fragment_len,
361 txctl, cts); 359 info, cts);
362 mac_ctl |= B43_TXH_MAC_SENDCTS; 360 mac_ctl |= B43_TXH_MAC_SENDCTS;
363 len = sizeof(struct ieee80211_cts); 361 len = sizeof(struct ieee80211_cts);
364 } else { 362 } else {
@@ -371,9 +369,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
371 rts = (struct ieee80211_rts *) 369 rts = (struct ieee80211_rts *)
372 (txhdr->new_format.rts_frame); 370 (txhdr->new_format.rts_frame);
373 } 371 }
374 ieee80211_rts_get(dev->wl->hw, txctl->vif, 372 ieee80211_rts_get(dev->wl->hw, info->control.vif,
375 fragment_data, fragment_len, 373 fragment_data, fragment_len,
376 txctl, rts); 374 info, rts);
377 mac_ctl |= B43_TXH_MAC_SENDRTS; 375 mac_ctl |= B43_TXH_MAC_SENDRTS;
378 len = sizeof(struct ieee80211_rts); 376 len = sizeof(struct ieee80211_rts);
379 } 377 }
@@ -687,27 +685,27 @@ void b43_handle_txstatus(struct b43_wldev *dev,
687/* Fill out the mac80211 TXstatus report based on the b43-specific 685/* Fill out the mac80211 TXstatus report based on the b43-specific
688 * txstatus report data. This returns a boolean whether the frame was 686 * txstatus report data. This returns a boolean whether the frame was
689 * successfully transmitted. */ 687 * successfully transmitted. */
690bool b43_fill_txstatus_report(struct ieee80211_tx_status *report, 688bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
691 const struct b43_txstatus *status) 689 const struct b43_txstatus *status)
692{ 690{
693 bool frame_success = 1; 691 bool frame_success = 1;
694 692
695 if (status->acked) { 693 if (status->acked) {
696 /* The frame was ACKed. */ 694 /* The frame was ACKed. */
697 report->flags |= IEEE80211_TX_STATUS_ACK; 695 report->flags |= IEEE80211_TX_STAT_ACK;
698 } else { 696 } else {
699 /* The frame was not ACKed... */ 697 /* The frame was not ACKed... */
700 if (!(report->control.flags & IEEE80211_TXCTL_NO_ACK)) { 698 if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) {
701 /* ...but we expected an ACK. */ 699 /* ...but we expected an ACK. */
702 frame_success = 0; 700 frame_success = 0;
703 report->excessive_retries = 1; 701 report->status.excessive_retries = 1;
704 } 702 }
705 } 703 }
706 if (status->frame_count == 0) { 704 if (status->frame_count == 0) {
707 /* The frame was not transmitted at all. */ 705 /* The frame was not transmitted at all. */
708 report->retry_count = 0; 706 report->status.retry_count = 0;
709 } else 707 } else
710 report->retry_count = status->frame_count - 1; 708 report->status.retry_count = status->frame_count - 1;
711 709
712 return frame_success; 710 return frame_success;
713} 711}