26 #include <linux/compiler.h>
27 #include <linux/errno.h>
28 #include <linux/if_arp.h>
29 #include <linux/in6.h>
32 #include <linux/kernel.h>
33 #include <linux/module.h>
34 #include <linux/netdevice.h>
37 #include <linux/slab.h>
38 #include <linux/tcp.h>
39 #include <linux/types.h>
40 #include <linux/wireless.h>
42 #include <asm/uaccess.h>
143 snap->
oui[0] = oui[0];
144 snap->
oui[1] = oui[1];
145 snap->
oui[2] = oui[2];
152 static int libipw_encrypt_fragment(
struct libipw_device *ieee,
166 if (crypt->
ops && crypt->
ops->encrypt_mpdu)
167 res = crypt->
ops->encrypt_mpdu(frag, hdr_len, crypt->
priv);
172 ieee->
dev->name, frag->
len);
206 txb->
fragments[
i] = __dev_alloc_skb(txb_size + headroom,
212 skb_reserve(txb->
fragments[i], headroom);
223 static int libipw_classify(
struct sk_buff *
skb)
233 switch (ip->
tos & 0xfc) {
260 int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size,
263 int encrypt, host_encrypt, host_encrypt_msdu;
291 ieee->
dev->name, skb->
len);
295 ether_type = ((
struct ethhdr *)skb->
data)->h_proto;
307 dev->
stats.tx_dropped++;
312 skb_copy_from_linear_data(skb, dest,
ETH_ALEN);
339 skb->
priority = libipw_classify(skb);
351 if ((host_encrypt || host_encrypt_msdu) &&
352 crypt && crypt->
ops && crypt->
ops->encrypt_msdu) {
354 int len = bytes + hdr_len + crypt->
ops->extra_msdu_prefix_len +
355 crypt->
ops->extra_msdu_postfix_len;
356 struct sk_buff *skb_new = dev_alloc_skb(len);
361 skb_reserve(skb_new, crypt->
ops->extra_msdu_prefix_len);
366 skb_copy_from_linear_data(skb,
skb_put(skb_new, skb->
len), skb->
len);
367 res = crypt->
ops->encrypt_msdu(skb_new, hdr_len, crypt->
priv);
375 bytes += crypt->
ops->extra_msdu_prefix_len +
376 crypt->
ops->extra_msdu_postfix_len;
383 if (is_multicast_ether_addr(dest) ||
384 is_broadcast_ether_addr(dest))
387 frag_size = ieee->
fts;
393 bytes_per_frag = frag_size -
hdr_len;
401 bytes_per_frag -= crypt->
ops->extra_mpdu_prefix_len +
402 crypt->
ops->extra_mpdu_postfix_len;
406 nr_frags = bytes / bytes_per_frag;
407 bytes_last_frag = bytes % bytes_per_frag;
411 bytes_last_frag = bytes_per_frag;
414 bytes_per_frag = bytes_last_frag =
bytes;
418 rts_required = (frag_size > ieee->
rts
426 txb = libipw_alloc_txb(nr_frags, frag_size,
450 memcpy(frag_hdr, &header, hdr_len);
466 for (; i < nr_frags; i++) {
470 skb_reserve(skb_frag,
471 crypt->
ops->extra_mpdu_prefix_len);
475 memcpy(frag_hdr, &header, hdr_len);
479 if (i != nr_frags - 1) {
482 bytes = bytes_per_frag;
485 bytes = bytes_last_frag;
488 if (i == 0 && !snapped) {
495 skb_copy_from_linear_data(skb,
skb_put(skb_frag, bytes), bytes);
503 libipw_encrypt_fragment(ieee, skb_frag, hdr_len);
511 spin_unlock_irqrestore(&ieee->
lock, flags);
518 dev->
stats.tx_packets++;
529 spin_unlock_irqrestore(&ieee->
lock, flags);
530 netif_stop_queue(dev);
531 dev->
stats.tx_errors++;