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