diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-06-10 04:56:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-14 15:39:29 -0400 |
commit | 4efc76bdbf9bfd2b8624c4dd52b9d8ffed176b31 (patch) | |
tree | 49be6ee8edf101521f45c72773bc73a6351f11c8 /net/mac80211/driver-ops.h | |
parent | 8b58ff832df9222e1fb3c58ae7f745f95569b55e (diff) |
mac80211: bracket driver tracing
Currently, driver tracing is sometimes invoked
after and sometimes before the actual driver
callback. This is fine as long as the driver
has no tracing itself, but as soon as it does
it gets confusing.
To make traces containing such information
easier to read, introduce a return tracer in
mac80211 that essentially brackets any driver
tracing, and invoke the real trace before the
driver's callback, only showing the return
value, if any, afterwards.
Since tracing records the process, there's no
problem with overlapping calls if that should
happen.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
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 | 89 |
1 files changed, 59 insertions, 30 deletions
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index a4fcbcc4f458..965d64f68567 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -16,10 +16,11 @@ static inline int drv_start(struct ieee80211_local *local) | |||
16 | 16 | ||
17 | might_sleep(); | 17 | might_sleep(); |
18 | 18 | ||
19 | trace_drv_start(local); | ||
19 | local->started = true; | 20 | local->started = true; |
20 | smp_mb(); | 21 | smp_mb(); |
21 | ret = local->ops->start(&local->hw); | 22 | ret = local->ops->start(&local->hw); |
22 | trace_drv_start(local, ret); | 23 | trace_drv_return_int(local, ret); |
23 | return ret; | 24 | return ret; |
24 | } | 25 | } |
25 | 26 | ||
@@ -27,8 +28,9 @@ static inline void drv_stop(struct ieee80211_local *local) | |||
27 | { | 28 | { |
28 | might_sleep(); | 29 | might_sleep(); |
29 | 30 | ||
30 | local->ops->stop(&local->hw); | ||
31 | trace_drv_stop(local); | 31 | trace_drv_stop(local); |
32 | local->ops->stop(&local->hw); | ||
33 | trace_drv_return_void(local); | ||
32 | 34 | ||
33 | /* sync away all work on the tasklet before clearing started */ | 35 | /* sync away all work on the tasklet before clearing started */ |
34 | tasklet_disable(&local->tasklet); | 36 | tasklet_disable(&local->tasklet); |
@@ -46,8 +48,9 @@ static inline int drv_add_interface(struct ieee80211_local *local, | |||
46 | 48 | ||
47 | might_sleep(); | 49 | might_sleep(); |
48 | 50 | ||
51 | trace_drv_add_interface(local, vif_to_sdata(vif)); | ||
49 | ret = local->ops->add_interface(&local->hw, vif); | 52 | ret = local->ops->add_interface(&local->hw, vif); |
50 | trace_drv_add_interface(local, vif_to_sdata(vif), ret); | 53 | trace_drv_return_int(local, ret); |
51 | return ret; | 54 | return ret; |
52 | } | 55 | } |
53 | 56 | ||
@@ -56,8 +59,9 @@ static inline void drv_remove_interface(struct ieee80211_local *local, | |||
56 | { | 59 | { |
57 | might_sleep(); | 60 | might_sleep(); |
58 | 61 | ||
59 | local->ops->remove_interface(&local->hw, vif); | ||
60 | trace_drv_remove_interface(local, vif_to_sdata(vif)); | 62 | trace_drv_remove_interface(local, vif_to_sdata(vif)); |
63 | local->ops->remove_interface(&local->hw, vif); | ||
64 | trace_drv_return_void(local); | ||
61 | } | 65 | } |
62 | 66 | ||
63 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | 67 | static inline int drv_config(struct ieee80211_local *local, u32 changed) |
@@ -66,8 +70,9 @@ static inline int drv_config(struct ieee80211_local *local, u32 changed) | |||
66 | 70 | ||
67 | might_sleep(); | 71 | might_sleep(); |
68 | 72 | ||
73 | trace_drv_config(local, changed); | ||
69 | ret = local->ops->config(&local->hw, changed); | 74 | ret = local->ops->config(&local->hw, changed); |
70 | trace_drv_config(local, changed, ret); | 75 | trace_drv_return_int(local, ret); |
71 | return ret; | 76 | return ret; |
72 | } | 77 | } |
73 | 78 | ||
@@ -78,9 +83,10 @@ static inline void drv_bss_info_changed(struct ieee80211_local *local, | |||
78 | { | 83 | { |
79 | might_sleep(); | 84 | might_sleep(); |
80 | 85 | ||
86 | trace_drv_bss_info_changed(local, sdata, info, changed); | ||
81 | if (local->ops->bss_info_changed) | 87 | if (local->ops->bss_info_changed) |
82 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); | 88 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
83 | trace_drv_bss_info_changed(local, sdata, info, changed); | 89 | trace_drv_return_void(local); |
84 | } | 90 | } |
85 | 91 | ||
86 | struct in_ifaddr; | 92 | struct in_ifaddr; |
@@ -92,11 +98,11 @@ static inline int drv_configure_arp_filter(struct ieee80211_local *local, | |||
92 | 98 | ||
93 | might_sleep(); | 99 | might_sleep(); |
94 | 100 | ||
101 | trace_drv_configure_arp_filter(local, vif_to_sdata(vif)); | ||
95 | if (local->ops->configure_arp_filter) | 102 | if (local->ops->configure_arp_filter) |
96 | ret = local->ops->configure_arp_filter(&local->hw, vif, | 103 | ret = local->ops->configure_arp_filter(&local->hw, vif, |
97 | ifa_list); | 104 | ifa_list); |
98 | 105 | trace_drv_return_int(local, ret); | |
99 | trace_drv_configure_arp_filter(local, vif_to_sdata(vif), ifa_list, ret); | ||
100 | return ret; | 106 | return ret; |
101 | } | 107 | } |
102 | 108 | ||
@@ -105,10 +111,12 @@ static inline u64 drv_prepare_multicast(struct ieee80211_local *local, | |||
105 | { | 111 | { |
106 | u64 ret = 0; | 112 | u64 ret = 0; |
107 | 113 | ||
114 | trace_drv_prepare_multicast(local, mc_list->count); | ||
115 | |||
108 | if (local->ops->prepare_multicast) | 116 | if (local->ops->prepare_multicast) |
109 | ret = local->ops->prepare_multicast(&local->hw, mc_list); | 117 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
110 | 118 | ||
111 | trace_drv_prepare_multicast(local, mc_list->count, ret); | 119 | trace_drv_return_u64(local, ret); |
112 | 120 | ||
113 | return ret; | 121 | return ret; |
114 | } | 122 | } |
@@ -120,19 +128,21 @@ static inline void drv_configure_filter(struct ieee80211_local *local, | |||
120 | { | 128 | { |
121 | might_sleep(); | 129 | might_sleep(); |
122 | 130 | ||
123 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, | ||
124 | multicast); | ||
125 | trace_drv_configure_filter(local, changed_flags, total_flags, | 131 | trace_drv_configure_filter(local, changed_flags, total_flags, |
126 | multicast); | 132 | multicast); |
133 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, | ||
134 | multicast); | ||
135 | trace_drv_return_void(local); | ||
127 | } | 136 | } |
128 | 137 | ||
129 | static inline int drv_set_tim(struct ieee80211_local *local, | 138 | static inline int drv_set_tim(struct ieee80211_local *local, |
130 | struct ieee80211_sta *sta, bool set) | 139 | struct ieee80211_sta *sta, bool set) |
131 | { | 140 | { |
132 | int ret = 0; | 141 | int ret = 0; |
142 | trace_drv_set_tim(local, sta, set); | ||
133 | if (local->ops->set_tim) | 143 | if (local->ops->set_tim) |
134 | ret = local->ops->set_tim(&local->hw, sta, set); | 144 | ret = local->ops->set_tim(&local->hw, sta, set); |
135 | trace_drv_set_tim(local, sta, set, ret); | 145 | trace_drv_return_int(local, ret); |
136 | return ret; | 146 | return ret; |
137 | } | 147 | } |
138 | 148 | ||
@@ -146,8 +156,9 @@ static inline int drv_set_key(struct ieee80211_local *local, | |||
146 | 156 | ||
147 | might_sleep(); | 157 | might_sleep(); |
148 | 158 | ||
159 | trace_drv_set_key(local, cmd, sdata, sta, key); | ||
149 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); | 160 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
150 | trace_drv_set_key(local, cmd, sdata, sta, key, ret); | 161 | trace_drv_return_int(local, ret); |
151 | return ret; | 162 | return ret; |
152 | } | 163 | } |
153 | 164 | ||
@@ -162,10 +173,11 @@ static inline void drv_update_tkip_key(struct ieee80211_local *local, | |||
162 | if (sta) | 173 | if (sta) |
163 | ista = &sta->sta; | 174 | ista = &sta->sta; |
164 | 175 | ||
176 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); | ||
165 | if (local->ops->update_tkip_key) | 177 | if (local->ops->update_tkip_key) |
166 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, | 178 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
167 | ista, iv32, phase1key); | 179 | ista, iv32, phase1key); |
168 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); | 180 | trace_drv_return_void(local); |
169 | } | 181 | } |
170 | 182 | ||
171 | static inline int drv_hw_scan(struct ieee80211_local *local, | 183 | static inline int drv_hw_scan(struct ieee80211_local *local, |
@@ -176,8 +188,9 @@ static inline int drv_hw_scan(struct ieee80211_local *local, | |||
176 | 188 | ||
177 | might_sleep(); | 189 | might_sleep(); |
178 | 190 | ||
191 | trace_drv_hw_scan(local, sdata, req); | ||
179 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); | 192 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
180 | trace_drv_hw_scan(local, sdata, req, ret); | 193 | trace_drv_return_int(local, ret); |
181 | return ret; | 194 | return ret; |
182 | } | 195 | } |
183 | 196 | ||
@@ -185,18 +198,20 @@ static inline void drv_sw_scan_start(struct ieee80211_local *local) | |||
185 | { | 198 | { |
186 | might_sleep(); | 199 | might_sleep(); |
187 | 200 | ||
201 | trace_drv_sw_scan_start(local); | ||
188 | if (local->ops->sw_scan_start) | 202 | if (local->ops->sw_scan_start) |
189 | local->ops->sw_scan_start(&local->hw); | 203 | local->ops->sw_scan_start(&local->hw); |
190 | trace_drv_sw_scan_start(local); | 204 | trace_drv_return_void(local); |
191 | } | 205 | } |
192 | 206 | ||
193 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) | 207 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) |
194 | { | 208 | { |
195 | might_sleep(); | 209 | might_sleep(); |
196 | 210 | ||
211 | trace_drv_sw_scan_complete(local); | ||
197 | if (local->ops->sw_scan_complete) | 212 | if (local->ops->sw_scan_complete) |
198 | local->ops->sw_scan_complete(&local->hw); | 213 | local->ops->sw_scan_complete(&local->hw); |
199 | trace_drv_sw_scan_complete(local); | 214 | trace_drv_return_void(local); |
200 | } | 215 | } |
201 | 216 | ||
202 | static inline int drv_get_stats(struct ieee80211_local *local, | 217 | static inline int drv_get_stats(struct ieee80211_local *local, |
@@ -228,9 +243,10 @@ static inline int drv_set_rts_threshold(struct ieee80211_local *local, | |||
228 | 243 | ||
229 | might_sleep(); | 244 | might_sleep(); |
230 | 245 | ||
246 | trace_drv_set_rts_threshold(local, value); | ||
231 | if (local->ops->set_rts_threshold) | 247 | if (local->ops->set_rts_threshold) |
232 | ret = local->ops->set_rts_threshold(&local->hw, value); | 248 | ret = local->ops->set_rts_threshold(&local->hw, value); |
233 | trace_drv_set_rts_threshold(local, value, ret); | 249 | trace_drv_return_int(local, ret); |
234 | return ret; | 250 | return ret; |
235 | } | 251 | } |
236 | 252 | ||
@@ -240,12 +256,13 @@ static inline int drv_set_coverage_class(struct ieee80211_local *local, | |||
240 | int ret = 0; | 256 | int ret = 0; |
241 | might_sleep(); | 257 | might_sleep(); |
242 | 258 | ||
259 | trace_drv_set_coverage_class(local, value); | ||
243 | if (local->ops->set_coverage_class) | 260 | if (local->ops->set_coverage_class) |
244 | local->ops->set_coverage_class(&local->hw, value); | 261 | local->ops->set_coverage_class(&local->hw, value); |
245 | else | 262 | else |
246 | ret = -EOPNOTSUPP; | 263 | ret = -EOPNOTSUPP; |
247 | 264 | ||
248 | trace_drv_set_coverage_class(local, value, ret); | 265 | trace_drv_return_int(local, ret); |
249 | return ret; | 266 | return ret; |
250 | } | 267 | } |
251 | 268 | ||
@@ -254,9 +271,10 @@ static inline void drv_sta_notify(struct ieee80211_local *local, | |||
254 | enum sta_notify_cmd cmd, | 271 | enum sta_notify_cmd cmd, |
255 | struct ieee80211_sta *sta) | 272 | struct ieee80211_sta *sta) |
256 | { | 273 | { |
274 | trace_drv_sta_notify(local, sdata, cmd, sta); | ||
257 | if (local->ops->sta_notify) | 275 | if (local->ops->sta_notify) |
258 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); | 276 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
259 | trace_drv_sta_notify(local, sdata, cmd, sta); | 277 | trace_drv_return_void(local); |
260 | } | 278 | } |
261 | 279 | ||
262 | static inline int drv_sta_add(struct ieee80211_local *local, | 280 | static inline int drv_sta_add(struct ieee80211_local *local, |
@@ -267,10 +285,11 @@ static inline int drv_sta_add(struct ieee80211_local *local, | |||
267 | 285 | ||
268 | might_sleep(); | 286 | might_sleep(); |
269 | 287 | ||
288 | trace_drv_sta_add(local, sdata, sta); | ||
270 | if (local->ops->sta_add) | 289 | if (local->ops->sta_add) |
271 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); | 290 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); |
272 | 291 | ||
273 | trace_drv_sta_add(local, sdata, sta, ret); | 292 | trace_drv_return_int(local, ret); |
274 | 293 | ||
275 | return ret; | 294 | return ret; |
276 | } | 295 | } |
@@ -281,10 +300,11 @@ static inline void drv_sta_remove(struct ieee80211_local *local, | |||
281 | { | 300 | { |
282 | might_sleep(); | 301 | might_sleep(); |
283 | 302 | ||
303 | trace_drv_sta_remove(local, sdata, sta); | ||
284 | if (local->ops->sta_remove) | 304 | if (local->ops->sta_remove) |
285 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); | 305 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); |
286 | 306 | ||
287 | trace_drv_sta_remove(local, sdata, sta); | 307 | trace_drv_return_void(local); |
288 | } | 308 | } |
289 | 309 | ||
290 | static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, | 310 | static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, |
@@ -294,9 +314,10 @@ static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, | |||
294 | 314 | ||
295 | might_sleep(); | 315 | might_sleep(); |
296 | 316 | ||
317 | trace_drv_conf_tx(local, queue, params); | ||
297 | if (local->ops->conf_tx) | 318 | if (local->ops->conf_tx) |
298 | ret = local->ops->conf_tx(&local->hw, queue, params); | 319 | ret = local->ops->conf_tx(&local->hw, queue, params); |
299 | trace_drv_conf_tx(local, queue, params, ret); | 320 | trace_drv_return_int(local, ret); |
300 | return ret; | 321 | return ret; |
301 | } | 322 | } |
302 | 323 | ||
@@ -306,9 +327,10 @@ static inline u64 drv_get_tsf(struct ieee80211_local *local) | |||
306 | 327 | ||
307 | might_sleep(); | 328 | might_sleep(); |
308 | 329 | ||
330 | trace_drv_get_tsf(local); | ||
309 | if (local->ops->get_tsf) | 331 | if (local->ops->get_tsf) |
310 | ret = local->ops->get_tsf(&local->hw); | 332 | ret = local->ops->get_tsf(&local->hw); |
311 | trace_drv_get_tsf(local, ret); | 333 | trace_drv_return_u64(local, ret); |
312 | return ret; | 334 | return ret; |
313 | } | 335 | } |
314 | 336 | ||
@@ -316,18 +338,20 @@ static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) | |||
316 | { | 338 | { |
317 | might_sleep(); | 339 | might_sleep(); |
318 | 340 | ||
341 | trace_drv_set_tsf(local, tsf); | ||
319 | if (local->ops->set_tsf) | 342 | if (local->ops->set_tsf) |
320 | local->ops->set_tsf(&local->hw, tsf); | 343 | local->ops->set_tsf(&local->hw, tsf); |
321 | trace_drv_set_tsf(local, tsf); | 344 | trace_drv_return_void(local); |
322 | } | 345 | } |
323 | 346 | ||
324 | static inline void drv_reset_tsf(struct ieee80211_local *local) | 347 | static inline void drv_reset_tsf(struct ieee80211_local *local) |
325 | { | 348 | { |
326 | might_sleep(); | 349 | might_sleep(); |
327 | 350 | ||
351 | trace_drv_reset_tsf(local); | ||
328 | if (local->ops->reset_tsf) | 352 | if (local->ops->reset_tsf) |
329 | local->ops->reset_tsf(&local->hw); | 353 | local->ops->reset_tsf(&local->hw); |
330 | trace_drv_reset_tsf(local); | 354 | trace_drv_return_void(local); |
331 | } | 355 | } |
332 | 356 | ||
333 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) | 357 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) |
@@ -336,9 +360,10 @@ static inline int drv_tx_last_beacon(struct ieee80211_local *local) | |||
336 | 360 | ||
337 | might_sleep(); | 361 | might_sleep(); |
338 | 362 | ||
363 | trace_drv_tx_last_beacon(local); | ||
339 | if (local->ops->tx_last_beacon) | 364 | if (local->ops->tx_last_beacon) |
340 | ret = local->ops->tx_last_beacon(&local->hw); | 365 | ret = local->ops->tx_last_beacon(&local->hw); |
341 | trace_drv_tx_last_beacon(local, ret); | 366 | trace_drv_return_int(local, ret); |
342 | return ret; | 367 | return ret; |
343 | } | 368 | } |
344 | 369 | ||
@@ -352,11 +377,14 @@ static inline int drv_ampdu_action(struct ieee80211_local *local, | |||
352 | 377 | ||
353 | might_sleep(); | 378 | might_sleep(); |
354 | 379 | ||
380 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn); | ||
381 | |||
355 | if (local->ops->ampdu_action) | 382 | if (local->ops->ampdu_action) |
356 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, | 383 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
357 | sta, tid, ssn); | 384 | sta, tid, ssn); |
358 | 385 | ||
359 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, ret); | 386 | trace_drv_return_int(local, ret); |
387 | |||
360 | return ret; | 388 | return ret; |
361 | } | 389 | } |
362 | 390 | ||
@@ -385,6 +413,7 @@ static inline void drv_flush(struct ieee80211_local *local, bool drop) | |||
385 | trace_drv_flush(local, drop); | 413 | trace_drv_flush(local, drop); |
386 | if (local->ops->flush) | 414 | if (local->ops->flush) |
387 | local->ops->flush(&local->hw, drop); | 415 | local->ops->flush(&local->hw, drop); |
416 | trace_drv_return_void(local); | ||
388 | } | 417 | } |
389 | 418 | ||
390 | static inline void drv_channel_switch(struct ieee80211_local *local, | 419 | static inline void drv_channel_switch(struct ieee80211_local *local, |
@@ -392,9 +421,9 @@ static inline void drv_channel_switch(struct ieee80211_local *local, | |||
392 | { | 421 | { |
393 | might_sleep(); | 422 | might_sleep(); |
394 | 423 | ||
395 | local->ops->channel_switch(&local->hw, ch_switch); | ||
396 | |||
397 | trace_drv_channel_switch(local, ch_switch); | 424 | trace_drv_channel_switch(local, ch_switch); |
425 | local->ops->channel_switch(&local->hw, ch_switch); | ||
426 | trace_drv_return_void(local); | ||
398 | } | 427 | } |
399 | 428 | ||
400 | #endif /* __MAC80211_DRIVER_OPS */ | 429 | #endif /* __MAC80211_DRIVER_OPS */ |