Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 1 | #ifndef __MAC80211_DRIVER_OPS |
| 2 | #define __MAC80211_DRIVER_OPS |
| 3 | |
| 4 | #include <net/mac80211.h> |
| 5 | #include "ieee80211_i.h" |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 6 | #include "driver-trace.h" |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 7 | |
Johannes Berg | 7bb4568 | 2011-02-24 14:42:06 +0100 | [diff] [blame] | 8 | static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 9 | { |
Johannes Berg | 7bb4568 | 2011-02-24 14:42:06 +0100 | [diff] [blame] | 10 | local->ops->tx(&local->hw, skb); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | static inline int drv_start(struct ieee80211_local *local) |
| 14 | { |
Johannes Berg | ea77f12 | 2009-08-21 14:44:45 +0200 | [diff] [blame] | 15 | int ret; |
| 16 | |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 17 | might_sleep(); |
| 18 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 19 | trace_drv_start(local); |
Johannes Berg | ea77f12 | 2009-08-21 14:44:45 +0200 | [diff] [blame] | 20 | local->started = true; |
| 21 | smp_mb(); |
| 22 | ret = local->ops->start(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 23 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 24 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | static inline void drv_stop(struct ieee80211_local *local) |
| 28 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 29 | might_sleep(); |
| 30 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 31 | trace_drv_stop(local); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 32 | local->ops->stop(&local->hw); |
| 33 | trace_drv_return_void(local); |
Johannes Berg | ea77f12 | 2009-08-21 14:44:45 +0200 | [diff] [blame] | 34 | |
| 35 | /* sync away all work on the tasklet before clearing started */ |
| 36 | tasklet_disable(&local->tasklet); |
| 37 | tasklet_enable(&local->tasklet); |
| 38 | |
| 39 | barrier(); |
| 40 | |
| 41 | local->started = false; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 42 | } |
| 43 | |
Johannes Berg | eecc480 | 2011-05-04 15:37:29 +0200 | [diff] [blame] | 44 | #ifdef CONFIG_PM |
| 45 | static inline int drv_suspend(struct ieee80211_local *local, |
| 46 | struct cfg80211_wowlan *wowlan) |
| 47 | { |
| 48 | int ret; |
| 49 | |
| 50 | might_sleep(); |
| 51 | |
| 52 | trace_drv_suspend(local); |
| 53 | ret = local->ops->suspend(&local->hw, wowlan); |
| 54 | trace_drv_return_int(local, ret); |
| 55 | return ret; |
| 56 | } |
| 57 | |
| 58 | static inline int drv_resume(struct ieee80211_local *local) |
| 59 | { |
| 60 | int ret; |
| 61 | |
| 62 | might_sleep(); |
| 63 | |
| 64 | trace_drv_resume(local); |
| 65 | ret = local->ops->resume(&local->hw); |
| 66 | trace_drv_return_int(local, ret); |
| 67 | return ret; |
| 68 | } |
| 69 | #endif |
| 70 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 71 | static inline int drv_add_interface(struct ieee80211_local *local, |
Johannes Berg | 1ed32e4 | 2009-12-23 13:15:45 +0100 | [diff] [blame] | 72 | struct ieee80211_vif *vif) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 73 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 74 | int ret; |
| 75 | |
| 76 | might_sleep(); |
| 77 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 78 | trace_drv_add_interface(local, vif_to_sdata(vif)); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 79 | ret = local->ops->add_interface(&local->hw, vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 80 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 81 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 82 | } |
| 83 | |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 84 | static inline int drv_change_interface(struct ieee80211_local *local, |
| 85 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2ca27bc | 2010-09-16 14:58:23 +0200 | [diff] [blame] | 86 | enum nl80211_iftype type, bool p2p) |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 87 | { |
| 88 | int ret; |
| 89 | |
| 90 | might_sleep(); |
| 91 | |
Johannes Berg | 2ca27bc | 2010-09-16 14:58:23 +0200 | [diff] [blame] | 92 | trace_drv_change_interface(local, sdata, type, p2p); |
| 93 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 94 | trace_drv_return_int(local, ret); |
| 95 | return ret; |
| 96 | } |
| 97 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 98 | static inline void drv_remove_interface(struct ieee80211_local *local, |
Johannes Berg | 1ed32e4 | 2009-12-23 13:15:45 +0100 | [diff] [blame] | 99 | struct ieee80211_vif *vif) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 100 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 101 | might_sleep(); |
| 102 | |
Johannes Berg | 1ed32e4 | 2009-12-23 13:15:45 +0100 | [diff] [blame] | 103 | trace_drv_remove_interface(local, vif_to_sdata(vif)); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 104 | local->ops->remove_interface(&local->hw, vif); |
| 105 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | static inline int drv_config(struct ieee80211_local *local, u32 changed) |
| 109 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 110 | int ret; |
| 111 | |
| 112 | might_sleep(); |
| 113 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 114 | trace_drv_config(local, changed); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 115 | ret = local->ops->config(&local->hw, changed); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 116 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 117 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | static inline void drv_bss_info_changed(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 121 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 122 | struct ieee80211_bss_conf *info, |
| 123 | u32 changed) |
| 124 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 125 | might_sleep(); |
| 126 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 127 | trace_drv_bss_info_changed(local, sdata, info, changed); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 128 | if (local->ops->bss_info_changed) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 129 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 130 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 131 | } |
| 132 | |
Johannes Berg | b2abb6e | 2011-07-19 10:39:53 +0200 | [diff] [blame] | 133 | static inline int drv_tx_sync(struct ieee80211_local *local, |
| 134 | struct ieee80211_sub_if_data *sdata, |
| 135 | const u8 *bssid, |
| 136 | enum ieee80211_tx_sync_type type) |
| 137 | { |
| 138 | int ret = 0; |
| 139 | |
| 140 | might_sleep(); |
| 141 | |
| 142 | trace_drv_tx_sync(local, sdata, bssid, type); |
| 143 | if (local->ops->tx_sync) |
| 144 | ret = local->ops->tx_sync(&local->hw, &sdata->vif, |
| 145 | bssid, type); |
| 146 | trace_drv_return_int(local, ret); |
| 147 | return ret; |
| 148 | } |
| 149 | |
| 150 | static inline void drv_finish_tx_sync(struct ieee80211_local *local, |
| 151 | struct ieee80211_sub_if_data *sdata, |
| 152 | const u8 *bssid, |
| 153 | enum ieee80211_tx_sync_type type) |
| 154 | { |
| 155 | might_sleep(); |
| 156 | |
| 157 | trace_drv_finish_tx_sync(local, sdata, bssid, type); |
| 158 | if (local->ops->finish_tx_sync) |
| 159 | local->ops->finish_tx_sync(&local->hw, &sdata->vif, |
| 160 | bssid, type); |
| 161 | trace_drv_return_void(local); |
| 162 | } |
| 163 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 164 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 165 | struct netdev_hw_addr_list *mc_list) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 166 | { |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 167 | u64 ret = 0; |
| 168 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 169 | trace_drv_prepare_multicast(local, mc_list->count); |
| 170 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 171 | if (local->ops->prepare_multicast) |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 172 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 173 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 174 | trace_drv_return_u64(local, ret); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 175 | |
| 176 | return ret; |
| 177 | } |
| 178 | |
| 179 | static inline void drv_configure_filter(struct ieee80211_local *local, |
| 180 | unsigned int changed_flags, |
| 181 | unsigned int *total_flags, |
| 182 | u64 multicast) |
| 183 | { |
| 184 | might_sleep(); |
| 185 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 186 | trace_drv_configure_filter(local, changed_flags, total_flags, |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 187 | multicast); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 188 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
| 189 | multicast); |
| 190 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | static inline int drv_set_tim(struct ieee80211_local *local, |
| 194 | struct ieee80211_sta *sta, bool set) |
| 195 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 196 | int ret = 0; |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 197 | trace_drv_set_tim(local, sta, set); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 198 | if (local->ops->set_tim) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 199 | ret = local->ops->set_tim(&local->hw, sta, set); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 200 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 201 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | static inline int drv_set_key(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 205 | enum set_key_cmd cmd, |
| 206 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 207 | struct ieee80211_sta *sta, |
| 208 | struct ieee80211_key_conf *key) |
| 209 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 210 | int ret; |
| 211 | |
| 212 | might_sleep(); |
| 213 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 214 | trace_drv_set_key(local, cmd, sdata, sta, key); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 215 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 216 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 217 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | static inline void drv_update_tkip_key(struct ieee80211_local *local, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 221 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 222 | struct ieee80211_key_conf *conf, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 223 | struct sta_info *sta, u32 iv32, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 224 | u16 *phase1key) |
| 225 | { |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 226 | struct ieee80211_sta *ista = NULL; |
| 227 | |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 228 | if (sta) |
| 229 | ista = &sta->sta; |
| 230 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 231 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 232 | if (local->ops->update_tkip_key) |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 233 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
| 234 | ista, iv32, phase1key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 235 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | static inline int drv_hw_scan(struct ieee80211_local *local, |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 239 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 240 | struct cfg80211_scan_request *req) |
| 241 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 242 | int ret; |
| 243 | |
| 244 | might_sleep(); |
| 245 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 246 | trace_drv_hw_scan(local, sdata); |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 247 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 248 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 249 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 250 | } |
| 251 | |
Eliad Peller | b856439 | 2011-06-13 12:47:30 +0300 | [diff] [blame] | 252 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
| 253 | struct ieee80211_sub_if_data *sdata) |
| 254 | { |
| 255 | might_sleep(); |
| 256 | |
| 257 | trace_drv_cancel_hw_scan(local, sdata); |
| 258 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); |
| 259 | trace_drv_return_void(local); |
| 260 | } |
| 261 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 262 | static inline int |
| 263 | drv_sched_scan_start(struct ieee80211_local *local, |
| 264 | struct ieee80211_sub_if_data *sdata, |
| 265 | struct cfg80211_sched_scan_request *req, |
| 266 | struct ieee80211_sched_scan_ies *ies) |
| 267 | { |
| 268 | int ret; |
| 269 | |
| 270 | might_sleep(); |
| 271 | |
| 272 | trace_drv_sched_scan_start(local, sdata); |
| 273 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, |
| 274 | req, ies); |
| 275 | trace_drv_return_int(local, ret); |
| 276 | return ret; |
| 277 | } |
| 278 | |
| 279 | static inline void drv_sched_scan_stop(struct ieee80211_local *local, |
| 280 | struct ieee80211_sub_if_data *sdata) |
| 281 | { |
| 282 | might_sleep(); |
| 283 | |
| 284 | trace_drv_sched_scan_stop(local, sdata); |
| 285 | local->ops->sched_scan_stop(&local->hw, &sdata->vif); |
| 286 | trace_drv_return_void(local); |
| 287 | } |
| 288 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 289 | static inline void drv_sw_scan_start(struct ieee80211_local *local) |
| 290 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 291 | might_sleep(); |
| 292 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 293 | trace_drv_sw_scan_start(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 294 | if (local->ops->sw_scan_start) |
| 295 | local->ops->sw_scan_start(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 296 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) |
| 300 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 301 | might_sleep(); |
| 302 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 303 | trace_drv_sw_scan_complete(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 304 | if (local->ops->sw_scan_complete) |
| 305 | local->ops->sw_scan_complete(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 306 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | static inline int drv_get_stats(struct ieee80211_local *local, |
| 310 | struct ieee80211_low_level_stats *stats) |
| 311 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 312 | int ret = -EOPNOTSUPP; |
| 313 | |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 314 | might_sleep(); |
| 315 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 316 | if (local->ops->get_stats) |
| 317 | ret = local->ops->get_stats(&local->hw, stats); |
| 318 | trace_drv_get_stats(local, stats, ret); |
| 319 | |
| 320 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | static inline void drv_get_tkip_seq(struct ieee80211_local *local, |
| 324 | u8 hw_key_idx, u32 *iv32, u16 *iv16) |
| 325 | { |
| 326 | if (local->ops->get_tkip_seq) |
| 327 | local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 328 | trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 329 | } |
| 330 | |
Arik Nemtsov | f23a478 | 2010-11-08 11:51:06 +0200 | [diff] [blame] | 331 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
| 332 | u32 value) |
| 333 | { |
| 334 | int ret = 0; |
| 335 | |
| 336 | might_sleep(); |
| 337 | |
| 338 | trace_drv_set_frag_threshold(local, value); |
| 339 | if (local->ops->set_frag_threshold) |
| 340 | ret = local->ops->set_frag_threshold(&local->hw, value); |
| 341 | trace_drv_return_int(local, ret); |
| 342 | return ret; |
| 343 | } |
| 344 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 345 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
| 346 | u32 value) |
| 347 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 348 | int ret = 0; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 349 | |
| 350 | might_sleep(); |
| 351 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 352 | trace_drv_set_rts_threshold(local, value); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 353 | if (local->ops->set_rts_threshold) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 354 | ret = local->ops->set_rts_threshold(&local->hw, value); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 355 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 356 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 357 | } |
| 358 | |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 359 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
| 360 | u8 value) |
| 361 | { |
| 362 | int ret = 0; |
| 363 | might_sleep(); |
| 364 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 365 | trace_drv_set_coverage_class(local, value); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 366 | if (local->ops->set_coverage_class) |
| 367 | local->ops->set_coverage_class(&local->hw, value); |
| 368 | else |
| 369 | ret = -EOPNOTSUPP; |
| 370 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 371 | trace_drv_return_int(local, ret); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 372 | return ret; |
| 373 | } |
| 374 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 375 | static inline void drv_sta_notify(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 376 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 377 | enum sta_notify_cmd cmd, |
| 378 | struct ieee80211_sta *sta) |
| 379 | { |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 380 | trace_drv_sta_notify(local, sdata, cmd, sta); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 381 | if (local->ops->sta_notify) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 382 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 383 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 384 | } |
| 385 | |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 386 | static inline int drv_sta_add(struct ieee80211_local *local, |
| 387 | struct ieee80211_sub_if_data *sdata, |
| 388 | struct ieee80211_sta *sta) |
| 389 | { |
| 390 | int ret = 0; |
| 391 | |
| 392 | might_sleep(); |
| 393 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 394 | trace_drv_sta_add(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 395 | if (local->ops->sta_add) |
| 396 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 397 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 398 | trace_drv_return_int(local, ret); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 399 | |
| 400 | return ret; |
| 401 | } |
| 402 | |
| 403 | static inline void drv_sta_remove(struct ieee80211_local *local, |
| 404 | struct ieee80211_sub_if_data *sdata, |
| 405 | struct ieee80211_sta *sta) |
| 406 | { |
| 407 | might_sleep(); |
| 408 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 409 | trace_drv_sta_remove(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 410 | if (local->ops->sta_remove) |
| 411 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 412 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 413 | trace_drv_return_void(local); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 414 | } |
| 415 | |
Eliad Peller | f6f3def | 2011-09-25 20:06:54 +0300 | [diff] [blame] | 416 | static inline int drv_conf_tx(struct ieee80211_local *local, |
| 417 | struct ieee80211_sub_if_data *sdata, u16 queue, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 418 | const struct ieee80211_tx_queue_params *params) |
| 419 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 420 | int ret = -EOPNOTSUPP; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 421 | |
| 422 | might_sleep(); |
| 423 | |
Eliad Peller | f6f3def | 2011-09-25 20:06:54 +0300 | [diff] [blame] | 424 | trace_drv_conf_tx(local, sdata, queue, params); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 425 | if (local->ops->conf_tx) |
Eliad Peller | 8a3a3c8 | 2011-10-02 10:15:52 +0200 | [diff] [blame] | 426 | ret = local->ops->conf_tx(&local->hw, &sdata->vif, |
| 427 | queue, params); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 428 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 429 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 430 | } |
| 431 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 432 | static inline u64 drv_get_tsf(struct ieee80211_local *local, |
| 433 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 434 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 435 | u64 ret = -1ULL; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 436 | |
| 437 | might_sleep(); |
| 438 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 439 | trace_drv_get_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 440 | if (local->ops->get_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 441 | ret = local->ops->get_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 442 | trace_drv_return_u64(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 443 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 444 | } |
| 445 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 446 | static inline void drv_set_tsf(struct ieee80211_local *local, |
| 447 | struct ieee80211_sub_if_data *sdata, |
| 448 | u64 tsf) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 449 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 450 | might_sleep(); |
| 451 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 452 | trace_drv_set_tsf(local, sdata, tsf); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 453 | if (local->ops->set_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 454 | local->ops->set_tsf(&local->hw, &sdata->vif, tsf); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 455 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 456 | } |
| 457 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 458 | static inline void drv_reset_tsf(struct ieee80211_local *local, |
| 459 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 460 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 461 | might_sleep(); |
| 462 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 463 | trace_drv_reset_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 464 | if (local->ops->reset_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 465 | local->ops->reset_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 466 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 467 | } |
| 468 | |
| 469 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) |
| 470 | { |
Tim Harvey | 91f44b0 | 2010-12-09 13:15:45 -0800 | [diff] [blame] | 471 | int ret = 0; /* default unsuported op for less congestion */ |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 472 | |
| 473 | might_sleep(); |
| 474 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 475 | trace_drv_tx_last_beacon(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 476 | if (local->ops->tx_last_beacon) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 477 | ret = local->ops->tx_last_beacon(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 478 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 479 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | static inline int drv_ampdu_action(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 483 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 484 | enum ieee80211_ampdu_mlme_action action, |
| 485 | struct ieee80211_sta *sta, u16 tid, |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 486 | u16 *ssn, u8 buf_size) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 487 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 488 | int ret = -EOPNOTSUPP; |
Johannes Berg | cfcdbde | 2010-06-10 10:21:48 +0200 | [diff] [blame] | 489 | |
| 490 | might_sleep(); |
| 491 | |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 492 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 493 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 494 | if (local->ops->ampdu_action) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 495 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 496 | sta, tid, ssn, buf_size); |
Johannes Berg | 85ad181 | 2010-06-10 10:21:49 +0200 | [diff] [blame] | 497 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 498 | trace_drv_return_int(local, ret); |
| 499 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 500 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 501 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 502 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 503 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
| 504 | struct survey_info *survey) |
| 505 | { |
| 506 | int ret = -EOPNOTSUPP; |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 507 | |
| 508 | trace_drv_get_survey(local, idx, survey); |
| 509 | |
Holger Schurig | 35dd050 | 2010-06-07 16:33:49 +0200 | [diff] [blame] | 510 | if (local->ops->get_survey) |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 511 | ret = local->ops->get_survey(&local->hw, idx, survey); |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 512 | |
| 513 | trace_drv_return_int(local, ret); |
| 514 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 515 | return ret; |
| 516 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 517 | |
| 518 | static inline void drv_rfkill_poll(struct ieee80211_local *local) |
| 519 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 520 | might_sleep(); |
| 521 | |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 522 | if (local->ops->rfkill_poll) |
| 523 | local->ops->rfkill_poll(&local->hw); |
| 524 | } |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 525 | |
| 526 | static inline void drv_flush(struct ieee80211_local *local, bool drop) |
| 527 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 528 | might_sleep(); |
| 529 | |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 530 | trace_drv_flush(local, drop); |
| 531 | if (local->ops->flush) |
| 532 | local->ops->flush(&local->hw, drop); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 533 | trace_drv_return_void(local); |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 534 | } |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 535 | |
| 536 | static inline void drv_channel_switch(struct ieee80211_local *local, |
| 537 | struct ieee80211_channel_switch *ch_switch) |
| 538 | { |
| 539 | might_sleep(); |
| 540 | |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 541 | trace_drv_channel_switch(local, ch_switch); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 542 | local->ops->channel_switch(&local->hw, ch_switch); |
| 543 | trace_drv_return_void(local); |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 544 | } |
| 545 | |
Bruno Randolf | 15d9675 | 2010-11-10 12:50:56 +0900 | [diff] [blame] | 546 | |
| 547 | static inline int drv_set_antenna(struct ieee80211_local *local, |
| 548 | u32 tx_ant, u32 rx_ant) |
| 549 | { |
| 550 | int ret = -EOPNOTSUPP; |
| 551 | might_sleep(); |
| 552 | if (local->ops->set_antenna) |
| 553 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); |
| 554 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); |
| 555 | return ret; |
| 556 | } |
| 557 | |
| 558 | static inline int drv_get_antenna(struct ieee80211_local *local, |
| 559 | u32 *tx_ant, u32 *rx_ant) |
| 560 | { |
| 561 | int ret = -EOPNOTSUPP; |
| 562 | might_sleep(); |
| 563 | if (local->ops->get_antenna) |
| 564 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); |
| 565 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); |
| 566 | return ret; |
| 567 | } |
| 568 | |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 569 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
| 570 | struct ieee80211_channel *chan, |
| 571 | enum nl80211_channel_type chantype, |
| 572 | unsigned int duration) |
| 573 | { |
| 574 | int ret; |
| 575 | |
| 576 | might_sleep(); |
| 577 | |
| 578 | trace_drv_remain_on_channel(local, chan, chantype, duration); |
| 579 | ret = local->ops->remain_on_channel(&local->hw, chan, chantype, |
| 580 | duration); |
| 581 | trace_drv_return_int(local, ret); |
| 582 | |
| 583 | return ret; |
| 584 | } |
| 585 | |
| 586 | static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) |
| 587 | { |
| 588 | int ret; |
| 589 | |
| 590 | might_sleep(); |
| 591 | |
| 592 | trace_drv_cancel_remain_on_channel(local); |
| 593 | ret = local->ops->cancel_remain_on_channel(&local->hw); |
| 594 | trace_drv_return_int(local, ret); |
| 595 | |
| 596 | return ret; |
| 597 | } |
| 598 | |
John W. Linville | 38c0915 | 2011-03-07 16:19:18 -0500 | [diff] [blame] | 599 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
| 600 | u32 tx, u32 rx) |
| 601 | { |
| 602 | int ret = -ENOTSUPP; |
| 603 | |
| 604 | might_sleep(); |
| 605 | |
| 606 | trace_drv_set_ringparam(local, tx, rx); |
| 607 | if (local->ops->set_ringparam) |
| 608 | ret = local->ops->set_ringparam(&local->hw, tx, rx); |
| 609 | trace_drv_return_int(local, ret); |
| 610 | |
| 611 | return ret; |
| 612 | } |
| 613 | |
| 614 | static inline void drv_get_ringparam(struct ieee80211_local *local, |
| 615 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) |
| 616 | { |
| 617 | might_sleep(); |
| 618 | |
| 619 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); |
| 620 | if (local->ops->get_ringparam) |
| 621 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); |
| 622 | trace_drv_return_void(local); |
| 623 | } |
| 624 | |
Vivek Natarajan | e8306f9 | 2011-04-06 11:41:10 +0530 | [diff] [blame] | 625 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
| 626 | { |
| 627 | bool ret = false; |
| 628 | |
| 629 | might_sleep(); |
| 630 | |
| 631 | trace_drv_tx_frames_pending(local); |
| 632 | if (local->ops->tx_frames_pending) |
| 633 | ret = local->ops->tx_frames_pending(&local->hw); |
| 634 | trace_drv_return_bool(local, ret); |
| 635 | |
| 636 | return ret; |
| 637 | } |
Sujith Manoharan | bdbfd6b | 2011-04-27 16:56:51 +0530 | [diff] [blame] | 638 | |
| 639 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, |
| 640 | struct ieee80211_sub_if_data *sdata, |
| 641 | const struct cfg80211_bitrate_mask *mask) |
| 642 | { |
| 643 | int ret = -EOPNOTSUPP; |
| 644 | |
| 645 | might_sleep(); |
| 646 | |
| 647 | trace_drv_set_bitrate_mask(local, sdata, mask); |
| 648 | if (local->ops->set_bitrate_mask) |
| 649 | ret = local->ops->set_bitrate_mask(&local->hw, |
| 650 | &sdata->vif, mask); |
| 651 | trace_drv_return_int(local, ret); |
| 652 | |
| 653 | return ret; |
| 654 | } |
| 655 | |
Johannes Berg | c68f4b8 | 2011-07-05 16:35:41 +0200 | [diff] [blame] | 656 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
| 657 | struct ieee80211_sub_if_data *sdata, |
| 658 | struct cfg80211_gtk_rekey_data *data) |
| 659 | { |
| 660 | trace_drv_set_rekey_data(local, sdata, data); |
| 661 | if (local->ops->set_rekey_data) |
| 662 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); |
| 663 | trace_drv_return_void(local); |
| 664 | } |
| 665 | |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 666 | static inline void drv_rssi_callback(struct ieee80211_local *local, |
| 667 | const enum ieee80211_rssi_event event) |
| 668 | { |
| 669 | trace_drv_rssi_callback(local, event); |
| 670 | if (local->ops->rssi_callback) |
| 671 | local->ops->rssi_callback(&local->hw, event); |
| 672 | trace_drv_return_void(local); |
| 673 | } |
Johannes Berg | 4049e09 | 2011-09-29 16:04:32 +0200 | [diff] [blame] | 674 | |
| 675 | static inline void |
| 676 | drv_release_buffered_frames(struct ieee80211_local *local, |
| 677 | struct sta_info *sta, u16 tids, int num_frames, |
| 678 | enum ieee80211_frame_release_type reason, |
| 679 | bool more_data) |
| 680 | { |
| 681 | trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, |
| 682 | reason, more_data); |
| 683 | if (local->ops->release_buffered_frames) |
| 684 | local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, |
| 685 | num_frames, reason, |
| 686 | more_data); |
| 687 | trace_drv_return_void(local); |
| 688 | } |
Johannes Berg | 40b9640 | 2011-09-29 16:04:38 +0200 | [diff] [blame] | 689 | |
| 690 | static inline void |
| 691 | drv_allow_buffered_frames(struct ieee80211_local *local, |
| 692 | struct sta_info *sta, u16 tids, int num_frames, |
| 693 | enum ieee80211_frame_release_type reason, |
| 694 | bool more_data) |
| 695 | { |
| 696 | trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, |
| 697 | reason, more_data); |
| 698 | if (local->ops->allow_buffered_frames) |
| 699 | local->ops->allow_buffered_frames(&local->hw, &sta->sta, |
| 700 | tids, num_frames, reason, |
| 701 | more_data); |
| 702 | trace_drv_return_void(local); |
| 703 | } |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 704 | #endif /* __MAC80211_DRIVER_OPS */ |