This source file includes following definitions.
- ath_rxbuf_alloc
- ath_is_mybeacon
- ath_printk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
19 #include <linux/kernel.h>
20 #include <linux/module.h>
21
22 #include "ath.h"
23 #include "trace.h"
24
25 MODULE_AUTHOR("Atheros Communications");
26 MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards.");
27 MODULE_LICENSE("Dual BSD/GPL");
28
29 struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
30 u32 len,
31 gfp_t gfp_mask)
32 {
33 struct sk_buff *skb;
34 u32 off;
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask);
50 if (skb != NULL) {
51 off = ((unsigned long) skb->data) % common->cachelsz;
52 if (off != 0)
53 skb_reserve(skb, common->cachelsz - off);
54 } else {
55 pr_err("skbuff alloc of size %u failed\n", len);
56 return NULL;
57 }
58
59 return skb;
60 }
61 EXPORT_SYMBOL(ath_rxbuf_alloc);
62
63 bool ath_is_mybeacon(struct ath_common *common, struct ieee80211_hdr *hdr)
64 {
65 return ieee80211_is_beacon(hdr->frame_control) &&
66 !is_zero_ether_addr(common->curbssid) &&
67 ether_addr_equal_64bits(hdr->addr3, common->curbssid);
68 }
69 EXPORT_SYMBOL(ath_is_mybeacon);
70
71 void ath_printk(const char *level, const struct ath_common* common,
72 const char *fmt, ...)
73 {
74 struct va_format vaf;
75 va_list args;
76
77 va_start(args, fmt);
78
79 vaf.fmt = fmt;
80 vaf.va = &args;
81
82 if (common && common->hw && common->hw->wiphy) {
83 printk("%sath: %s: %pV",
84 level, wiphy_name(common->hw->wiphy), &vaf);
85 trace_ath_log(common->hw->wiphy, &vaf);
86 } else {
87 printk("%sath: %pV", level, &vaf);
88 }
89
90 va_end(args);
91 }
92 EXPORT_SYMBOL(ath_printk);
93
94 const char *ath_bus_type_strings[] = {
95 [ATH_PCI] = "pci",
96 [ATH_AHB] = "ahb",
97 [ATH_USB] = "usb",
98 };
99 EXPORT_SYMBOL(ath_bus_type_strings);