aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00/libipw_tx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ipw2x00/libipw_tx.c')
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_tx.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/net/wireless/ipw2x00/libipw_tx.c b/drivers/net/wireless/ipw2x00/libipw_tx.c
index 2e8f84fb29fa..ce1855f32b7d 100644
--- a/drivers/net/wireless/ipw2x00/libipw_tx.c
+++ b/drivers/net/wireless/ipw2x00/libipw_tx.c
@@ -41,7 +41,7 @@
41#include <linux/etherdevice.h> 41#include <linux/etherdevice.h>
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43 43
44#include "ieee80211.h" 44#include "libipw.h"
45 45
46/* 46/*
47 47
@@ -126,12 +126,12 @@ payload of each frame is reduced to 492 bytes.
126static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; 126static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
127static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; 127static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
128 128
129static int ieee80211_copy_snap(u8 * data, __be16 h_proto) 129static int libipw_copy_snap(u8 * data, __be16 h_proto)
130{ 130{
131 struct ieee80211_snap_hdr *snap; 131 struct libipw_snap_hdr *snap;
132 u8 *oui; 132 u8 *oui;
133 133
134 snap = (struct ieee80211_snap_hdr *)data; 134 snap = (struct libipw_snap_hdr *)data;
135 snap->dsap = 0xaa; 135 snap->dsap = 0xaa;
136 snap->ssap = 0xaa; 136 snap->ssap = 0xaa;
137 snap->ctrl = 0x03; 137 snap->ctrl = 0x03;
@@ -149,7 +149,7 @@ static int ieee80211_copy_snap(u8 * data, __be16 h_proto)
149 return SNAP_SIZE + sizeof(u16); 149 return SNAP_SIZE + sizeof(u16);
150} 150}
151 151
152static int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, 152static int libipw_encrypt_fragment(struct libipw_device *ieee,
153 struct sk_buff *frag, int hdr_len) 153 struct sk_buff *frag, int hdr_len)
154{ 154{
155 struct lib80211_crypt_data *crypt = 155 struct lib80211_crypt_data *crypt =
@@ -177,7 +177,7 @@ static int ieee80211_encrypt_fragment(struct ieee80211_device *ieee,
177 return 0; 177 return 0;
178} 178}
179 179
180void ieee80211_txb_free(struct ieee80211_txb *txb) 180void libipw_txb_free(struct libipw_txb *txb)
181{ 181{
182 int i; 182 int i;
183 if (unlikely(!txb)) 183 if (unlikely(!txb))
@@ -188,17 +188,17 @@ void ieee80211_txb_free(struct ieee80211_txb *txb)
188 kfree(txb); 188 kfree(txb);
189} 189}
190 190
191static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, 191static struct libipw_txb *libipw_alloc_txb(int nr_frags, int txb_size,
192 int headroom, gfp_t gfp_mask) 192 int headroom, gfp_t gfp_mask)
193{ 193{
194 struct ieee80211_txb *txb; 194 struct libipw_txb *txb;
195 int i; 195 int i;
196 txb = kmalloc(sizeof(struct ieee80211_txb) + (sizeof(u8 *) * nr_frags), 196 txb = kmalloc(sizeof(struct libipw_txb) + (sizeof(u8 *) * nr_frags),
197 gfp_mask); 197 gfp_mask);
198 if (!txb) 198 if (!txb)
199 return NULL; 199 return NULL;
200 200
201 memset(txb, 0, sizeof(struct ieee80211_txb)); 201 memset(txb, 0, sizeof(struct libipw_txb));
202 txb->nr_frags = nr_frags; 202 txb->nr_frags = nr_frags;
203 txb->frag_size = txb_size; 203 txb->frag_size = txb_size;
204 204
@@ -220,7 +220,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
220 return txb; 220 return txb;
221} 221}
222 222
223static int ieee80211_classify(struct sk_buff *skb) 223static int libipw_classify(struct sk_buff *skb)
224{ 224{
225 struct ethhdr *eth; 225 struct ethhdr *eth;
226 struct iphdr *ip; 226 struct iphdr *ip;
@@ -252,11 +252,11 @@ static int ieee80211_classify(struct sk_buff *skb)
252 252
253/* Incoming skb is converted to a txb which consists of 253/* Incoming skb is converted to a txb which consists of
254 * a block of 802.11 fragment packets (stored as skbs) */ 254 * a block of 802.11 fragment packets (stored as skbs) */
255int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) 255int libipw_xmit(struct sk_buff *skb, struct net_device *dev)
256{ 256{
257 struct ieee80211_device *ieee = netdev_priv(dev); 257 struct libipw_device *ieee = netdev_priv(dev);
258 struct ieee80211_txb *txb = NULL; 258 struct libipw_txb *txb = NULL;
259 struct ieee80211_hdr_3addrqos *frag_hdr; 259 struct libipw_hdr_3addrqos *frag_hdr;
260 int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size, 260 int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size,
261 rts_required; 261 rts_required;
262 unsigned long flags; 262 unsigned long flags;
@@ -264,7 +264,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
264 __be16 ether_type; 264 __be16 ether_type;
265 int bytes, fc, hdr_len; 265 int bytes, fc, hdr_len;
266 struct sk_buff *skb_frag; 266 struct sk_buff *skb_frag;
267 struct ieee80211_hdr_3addrqos header = {/* Ensure zero initialized */ 267 struct libipw_hdr_3addrqos header = {/* Ensure zero initialized */
268 .duration_id = 0, 268 .duration_id = 0,
269 .seq_ctl = 0, 269 .seq_ctl = 0,
270 .qos_ctl = 0 270 .qos_ctl = 0
@@ -331,14 +331,14 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
331 memcpy(header.addr2, src, ETH_ALEN); 331 memcpy(header.addr2, src, ETH_ALEN);
332 memcpy(header.addr3, ieee->bssid, ETH_ALEN); 332 memcpy(header.addr3, ieee->bssid, ETH_ALEN);
333 } 333 }
334 hdr_len = IEEE80211_3ADDR_LEN; 334 hdr_len = LIBIPW_3ADDR_LEN;
335 335
336 if (ieee->is_qos_active && ieee->is_qos_active(dev, skb)) { 336 if (ieee->is_qos_active && ieee->is_qos_active(dev, skb)) {
337 fc |= IEEE80211_STYPE_QOS_DATA; 337 fc |= IEEE80211_STYPE_QOS_DATA;
338 hdr_len += 2; 338 hdr_len += 2;
339 339
340 skb->priority = ieee80211_classify(skb); 340 skb->priority = libipw_classify(skb);
341 header.qos_ctl |= cpu_to_le16(skb->priority & IEEE80211_QCTL_TID); 341 header.qos_ctl |= cpu_to_le16(skb->priority & LIBIPW_QCTL_TID);
342 } 342 }
343 header.frame_ctl = cpu_to_le16(fc); 343 header.frame_ctl = cpu_to_le16(fc);
344 344
@@ -362,12 +362,12 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
362 skb_reserve(skb_new, crypt->ops->extra_msdu_prefix_len); 362 skb_reserve(skb_new, crypt->ops->extra_msdu_prefix_len);
363 memcpy(skb_put(skb_new, hdr_len), &header, hdr_len); 363 memcpy(skb_put(skb_new, hdr_len), &header, hdr_len);
364 snapped = 1; 364 snapped = 1;
365 ieee80211_copy_snap(skb_put(skb_new, SNAP_SIZE + sizeof(u16)), 365 libipw_copy_snap(skb_put(skb_new, SNAP_SIZE + sizeof(u16)),
366 ether_type); 366 ether_type);
367 skb_copy_from_linear_data(skb, skb_put(skb_new, skb->len), skb->len); 367 skb_copy_from_linear_data(skb, skb_put(skb_new, skb->len), skb->len);
368 res = crypt->ops->encrypt_msdu(skb_new, hdr_len, crypt->priv); 368 res = crypt->ops->encrypt_msdu(skb_new, hdr_len, crypt->priv);
369 if (res < 0) { 369 if (res < 0) {
370 IEEE80211_ERROR("msdu encryption failed\n"); 370 LIBIPW_ERROR("msdu encryption failed\n");
371 dev_kfree_skb_any(skb_new); 371 dev_kfree_skb_any(skb_new);
372 goto failed; 372 goto failed;
373 } 373 }
@@ -393,8 +393,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
393 * for it when determining the amount of payload space. */ 393 * for it when determining the amount of payload space. */
394 bytes_per_frag = frag_size - hdr_len; 394 bytes_per_frag = frag_size - hdr_len;
395 if (ieee->config & 395 if (ieee->config &
396 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) 396 (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS))
397 bytes_per_frag -= IEEE80211_FCS_LEN; 397 bytes_per_frag -= LIBIPW_FCS_LEN;
398 398
399 /* Each fragment may need to have room for encryptiong 399 /* Each fragment may need to have room for encryptiong
400 * pre/postfix */ 400 * pre/postfix */
@@ -417,14 +417,14 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
417 } 417 }
418 418
419 rts_required = (frag_size > ieee->rts 419 rts_required = (frag_size > ieee->rts
420 && ieee->config & CFG_IEEE80211_RTS); 420 && ieee->config & CFG_LIBIPW_RTS);
421 if (rts_required) 421 if (rts_required)
422 nr_frags++; 422 nr_frags++;
423 423
424 /* When we allocate the TXB we allocate enough space for the reserve 424 /* When we allocate the TXB we allocate enough space for the reserve
425 * and full fragment bytes (bytes_per_frag doesn't include prefix, 425 * and full fragment bytes (bytes_per_frag doesn't include prefix,
426 * postfix, header, FCS, etc.) */ 426 * postfix, header, FCS, etc.) */
427 txb = ieee80211_alloc_txb(nr_frags, frag_size, 427 txb = libipw_alloc_txb(nr_frags, frag_size,
428 ieee->tx_headroom, GFP_ATOMIC); 428 ieee->tx_headroom, GFP_ATOMIC);
429 if (unlikely(!txb)) { 429 if (unlikely(!txb)) {
430 printk(KERN_WARNING "%s: Could not allocate TXB\n", 430 printk(KERN_WARNING "%s: Could not allocate TXB\n",
@@ -441,7 +441,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
441 if (rts_required) { 441 if (rts_required) {
442 skb_frag = txb->fragments[0]; 442 skb_frag = txb->fragments[0];
443 frag_hdr = 443 frag_hdr =
444 (struct ieee80211_hdr_3addrqos *)skb_put(skb_frag, hdr_len); 444 (struct libipw_hdr_3addrqos *)skb_put(skb_frag, hdr_len);
445 445
446 /* 446 /*
447 * Set header frame_ctl to the RTS. 447 * Set header frame_ctl to the RTS.
@@ -456,7 +456,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
456 header.frame_ctl = cpu_to_le16(fc); 456 header.frame_ctl = cpu_to_le16(fc);
457 457
458 if (ieee->config & 458 if (ieee->config &
459 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) 459 (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS))
460 skb_put(skb_frag, 4); 460 skb_put(skb_frag, 4);
461 461
462 txb->rts_included = 1; 462 txb->rts_included = 1;
@@ -472,7 +472,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
472 crypt->ops->extra_mpdu_prefix_len); 472 crypt->ops->extra_mpdu_prefix_len);
473 473
474 frag_hdr = 474 frag_hdr =
475 (struct ieee80211_hdr_3addrqos *)skb_put(skb_frag, hdr_len); 475 (struct libipw_hdr_3addrqos *)skb_put(skb_frag, hdr_len);
476 memcpy(frag_hdr, &header, hdr_len); 476 memcpy(frag_hdr, &header, hdr_len);
477 477
478 /* If this is not the last fragment, then add the MOREFRAGS 478 /* If this is not the last fragment, then add the MOREFRAGS
@@ -487,7 +487,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
487 } 487 }
488 488
489 if (i == 0 && !snapped) { 489 if (i == 0 && !snapped) {
490 ieee80211_copy_snap(skb_put 490 libipw_copy_snap(skb_put
491 (skb_frag, SNAP_SIZE + sizeof(u16)), 491 (skb_frag, SNAP_SIZE + sizeof(u16)),
492 ether_type); 492 ether_type);
493 bytes -= SNAP_SIZE + sizeof(u16); 493 bytes -= SNAP_SIZE + sizeof(u16);
@@ -501,7 +501,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
501 /* Encryption routine will move the header forward in order 501 /* Encryption routine will move the header forward in order
502 * to insert the IV between the header and the payload */ 502 * to insert the IV between the header and the payload */
503 if (host_encrypt) 503 if (host_encrypt)
504 ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); 504 libipw_encrypt_fragment(ieee, skb_frag, hdr_len);
505 else if (host_build_iv) { 505 else if (host_build_iv) {
506 atomic_inc(&crypt->refcnt); 506 atomic_inc(&crypt->refcnt);
507 if (crypt->ops->build_iv) 507 if (crypt->ops->build_iv)
@@ -513,7 +513,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
513 } 513 }
514 514
515 if (ieee->config & 515 if (ieee->config &
516 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) 516 (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS))
517 skb_put(skb_frag, 4); 517 skb_put(skb_frag, 4);
518 } 518 }
519 519
@@ -530,7 +530,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
530 return NETDEV_TX_OK; 530 return NETDEV_TX_OK;
531 } 531 }
532 532
533 ieee80211_txb_free(txb); 533 libipw_txb_free(txb);
534 } 534 }
535 535
536 return NETDEV_TX_OK; 536 return NETDEV_TX_OK;
@@ -541,6 +541,6 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
541 dev->stats.tx_errors++; 541 dev->stats.tx_errors++;
542 return NETDEV_TX_BUSY; 542 return NETDEV_TX_BUSY;
543} 543}
544EXPORT_SYMBOL(ieee80211_xmit); 544EXPORT_SYMBOL(libipw_xmit);
545 545
546EXPORT_SYMBOL(ieee80211_txb_free); 546EXPORT_SYMBOL(libipw_txb_free);