diff options
Diffstat (limited to 'drivers/net/wireless/ath/main.c')
-rw-r--r-- | drivers/net/wireless/ath/main.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c index 9949b11cb151..487193f1de1a 100644 --- a/drivers/net/wireless/ath/main.c +++ b/drivers/net/wireless/ath/main.c | |||
@@ -17,6 +17,42 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | 19 | ||
20 | #include "ath.h" | ||
21 | |||
20 | MODULE_AUTHOR("Atheros Communications"); | 22 | MODULE_AUTHOR("Atheros Communications"); |
21 | MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards."); | 23 | MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards."); |
22 | MODULE_LICENSE("Dual BSD/GPL"); | 24 | MODULE_LICENSE("Dual BSD/GPL"); |
25 | |||
26 | struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, | ||
27 | u32 len, | ||
28 | gfp_t gfp_mask) | ||
29 | { | ||
30 | struct sk_buff *skb; | ||
31 | u32 off; | ||
32 | |||
33 | /* | ||
34 | * Cache-line-align. This is important (for the | ||
35 | * 5210 at least) as not doing so causes bogus data | ||
36 | * in rx'd frames. | ||
37 | */ | ||
38 | |||
39 | /* Note: the kernel can allocate a value greater than | ||
40 | * what we ask it to give us. We really only need 4 KB as that | ||
41 | * is this hardware supports and in fact we need at least 3849 | ||
42 | * as that is the MAX AMSDU size this hardware supports. | ||
43 | * Unfortunately this means we may get 8 KB here from the | ||
44 | * kernel... and that is actually what is observed on some | ||
45 | * systems :( */ | ||
46 | skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask); | ||
47 | if (skb != NULL) { | ||
48 | off = ((unsigned long) skb->data) % common->cachelsz; | ||
49 | if (off != 0) | ||
50 | skb_reserve(skb, common->cachelsz - off); | ||
51 | } else { | ||
52 | printk(KERN_ERR "skbuff alloc of size %u failed\n", len); | ||
53 | return NULL; | ||
54 | } | ||
55 | |||
56 | return skb; | ||
57 | } | ||
58 | EXPORT_SYMBOL(ath_rxbuf_alloc); | ||