diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-04-23 12:52:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-06 15:14:37 -0400 |
commit | 2448798133d747ad339e57099e32a1d1e68aca1c (patch) | |
tree | ee09385f5dca9e243c38f5f888baa02605423bd7 /net/mac80211/driver-ops.h | |
parent | 2d0ddec5b2b859f06116f631fc0ffe94fbceb556 (diff) |
mac80211: add driver ops wrappers
In order to later add tracing or verifications to the driver
calls mac80211 makes, this patch adds static inline wrappers
for all operations.
All calls are now written as
drv_<op>(local, ...);
instead of
local->ops-><op>(&local->hw, ...);
Where necessary, the wrappers also do existence checking and
return default values as appropriate.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/driver-ops.h')
-rw-r--r-- | net/mac80211/driver-ops.h | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h new file mode 100644 index 000000000000..3912b5334b9c --- /dev/null +++ b/net/mac80211/driver-ops.h | |||
@@ -0,0 +1,184 @@ | |||
1 | #ifndef __MAC80211_DRIVER_OPS | ||
2 | #define __MAC80211_DRIVER_OPS | ||
3 | |||
4 | #include <net/mac80211.h> | ||
5 | #include "ieee80211_i.h" | ||
6 | |||
7 | static inline int drv_tx(struct ieee80211_local *local, struct sk_buff *skb) | ||
8 | { | ||
9 | return local->ops->tx(&local->hw, skb); | ||
10 | } | ||
11 | |||
12 | static inline int drv_start(struct ieee80211_local *local) | ||
13 | { | ||
14 | return local->ops->start(&local->hw); | ||
15 | } | ||
16 | |||
17 | static inline void drv_stop(struct ieee80211_local *local) | ||
18 | { | ||
19 | local->ops->stop(&local->hw); | ||
20 | } | ||
21 | |||
22 | static inline int drv_add_interface(struct ieee80211_local *local, | ||
23 | struct ieee80211_if_init_conf *conf) | ||
24 | { | ||
25 | return local->ops->add_interface(&local->hw, conf); | ||
26 | } | ||
27 | |||
28 | static inline void drv_remove_interface(struct ieee80211_local *local, | ||
29 | struct ieee80211_if_init_conf *conf) | ||
30 | { | ||
31 | local->ops->remove_interface(&local->hw, conf); | ||
32 | } | ||
33 | |||
34 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | ||
35 | { | ||
36 | return local->ops->config(&local->hw, changed); | ||
37 | } | ||
38 | |||
39 | static inline void drv_bss_info_changed(struct ieee80211_local *local, | ||
40 | struct ieee80211_vif *vif, | ||
41 | struct ieee80211_bss_conf *info, | ||
42 | u32 changed) | ||
43 | { | ||
44 | if (local->ops->bss_info_changed) | ||
45 | local->ops->bss_info_changed(&local->hw, vif, info, changed); | ||
46 | } | ||
47 | |||
48 | static inline void drv_configure_filter(struct ieee80211_local *local, | ||
49 | unsigned int changed_flags, | ||
50 | unsigned int *total_flags, | ||
51 | int mc_count, | ||
52 | struct dev_addr_list *mc_list) | ||
53 | { | ||
54 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, | ||
55 | mc_count, mc_list); | ||
56 | } | ||
57 | |||
58 | static inline int drv_set_tim(struct ieee80211_local *local, | ||
59 | struct ieee80211_sta *sta, bool set) | ||
60 | { | ||
61 | if (local->ops->set_tim) | ||
62 | return local->ops->set_tim(&local->hw, sta, set); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static inline int drv_set_key(struct ieee80211_local *local, | ||
67 | enum set_key_cmd cmd, struct ieee80211_vif *vif, | ||
68 | struct ieee80211_sta *sta, | ||
69 | struct ieee80211_key_conf *key) | ||
70 | { | ||
71 | return local->ops->set_key(&local->hw, cmd, vif, sta, key); | ||
72 | } | ||
73 | |||
74 | static inline void drv_update_tkip_key(struct ieee80211_local *local, | ||
75 | struct ieee80211_key_conf *conf, | ||
76 | const u8 *address, u32 iv32, | ||
77 | u16 *phase1key) | ||
78 | { | ||
79 | if (local->ops->update_tkip_key) | ||
80 | local->ops->update_tkip_key(&local->hw, conf, address, | ||
81 | iv32, phase1key); | ||
82 | } | ||
83 | |||
84 | static inline int drv_hw_scan(struct ieee80211_local *local, | ||
85 | struct cfg80211_scan_request *req) | ||
86 | { | ||
87 | return local->ops->hw_scan(&local->hw, req); | ||
88 | } | ||
89 | |||
90 | static inline void drv_sw_scan_start(struct ieee80211_local *local) | ||
91 | { | ||
92 | if (local->ops->sw_scan_start) | ||
93 | local->ops->sw_scan_start(&local->hw); | ||
94 | } | ||
95 | |||
96 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) | ||
97 | { | ||
98 | if (local->ops->sw_scan_complete) | ||
99 | local->ops->sw_scan_complete(&local->hw); | ||
100 | } | ||
101 | |||
102 | static inline int drv_get_stats(struct ieee80211_local *local, | ||
103 | struct ieee80211_low_level_stats *stats) | ||
104 | { | ||
105 | if (!local->ops->get_stats) | ||
106 | return -EOPNOTSUPP; | ||
107 | return local->ops->get_stats(&local->hw, stats); | ||
108 | } | ||
109 | |||
110 | static inline void drv_get_tkip_seq(struct ieee80211_local *local, | ||
111 | u8 hw_key_idx, u32 *iv32, u16 *iv16) | ||
112 | { | ||
113 | if (local->ops->get_tkip_seq) | ||
114 | local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); | ||
115 | } | ||
116 | |||
117 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, | ||
118 | u32 value) | ||
119 | { | ||
120 | if (local->ops->set_rts_threshold) | ||
121 | return local->ops->set_rts_threshold(&local->hw, value); | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static inline void drv_sta_notify(struct ieee80211_local *local, | ||
126 | struct ieee80211_vif *vif, | ||
127 | enum sta_notify_cmd cmd, | ||
128 | struct ieee80211_sta *sta) | ||
129 | { | ||
130 | if (local->ops->sta_notify) | ||
131 | local->ops->sta_notify(&local->hw, vif, cmd, sta); | ||
132 | } | ||
133 | |||
134 | static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, | ||
135 | const struct ieee80211_tx_queue_params *params) | ||
136 | { | ||
137 | if (local->ops->conf_tx) | ||
138 | return local->ops->conf_tx(&local->hw, queue, params); | ||
139 | return -EOPNOTSUPP; | ||
140 | } | ||
141 | |||
142 | static inline int drv_get_tx_stats(struct ieee80211_local *local, | ||
143 | struct ieee80211_tx_queue_stats *stats) | ||
144 | { | ||
145 | return local->ops->get_tx_stats(&local->hw, stats); | ||
146 | } | ||
147 | |||
148 | static inline u64 drv_get_tsf(struct ieee80211_local *local) | ||
149 | { | ||
150 | if (local->ops->get_tsf) | ||
151 | return local->ops->get_tsf(&local->hw); | ||
152 | return -1ULL; | ||
153 | } | ||
154 | |||
155 | static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) | ||
156 | { | ||
157 | if (local->ops->set_tsf) | ||
158 | local->ops->set_tsf(&local->hw, tsf); | ||
159 | } | ||
160 | |||
161 | static inline void drv_reset_tsf(struct ieee80211_local *local) | ||
162 | { | ||
163 | if (local->ops->reset_tsf) | ||
164 | local->ops->reset_tsf(&local->hw); | ||
165 | } | ||
166 | |||
167 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) | ||
168 | { | ||
169 | if (local->ops->tx_last_beacon) | ||
170 | return local->ops->tx_last_beacon(&local->hw); | ||
171 | return 1; | ||
172 | } | ||
173 | |||
174 | static inline int drv_ampdu_action(struct ieee80211_local *local, | ||
175 | enum ieee80211_ampdu_mlme_action action, | ||
176 | struct ieee80211_sta *sta, u16 tid, | ||
177 | u16 *ssn) | ||
178 | { | ||
179 | if (local->ops->ampdu_action) | ||
180 | return local->ops->ampdu_action(&local->hw, action, | ||
181 | sta, tid, ssn); | ||
182 | return -EOPNOTSUPP; | ||
183 | } | ||
184 | #endif /* __MAC80211_DRIVER_OPS */ | ||