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 | 011ad0e | 2012-06-22 12:55:52 +0200 | [diff] [blame] | 6 | #include "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 | { |
Ben Greear | d17087e | 2012-03-15 16:22:05 -0700 | [diff] [blame] | 10 | WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), |
| 11 | "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", |
Johannes Berg | f142c6b | 2012-06-18 20:07:15 +0200 | [diff] [blame] | 12 | sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 13 | } |
| 14 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 15 | static inline struct ieee80211_sub_if_data * |
| 16 | get_bss_sdata(struct ieee80211_sub_if_data *sdata) |
| 17 | { |
| 18 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
| 19 | sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, |
| 20 | u.ap); |
| 21 | |
| 22 | return sdata; |
| 23 | } |
| 24 | |
Thomas Huehn | 36323f8 | 2012-07-23 21:33:42 +0200 | [diff] [blame] | 25 | static inline void drv_tx(struct ieee80211_local *local, |
| 26 | struct ieee80211_tx_control *control, |
| 27 | struct sk_buff *skb) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 28 | { |
Thomas Huehn | 36323f8 | 2012-07-23 21:33:42 +0200 | [diff] [blame] | 29 | local->ops->tx(&local->hw, control, skb); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 30 | } |
| 31 | |
Ben Greear | e352114 | 2012-04-23 12:50:31 -0700 | [diff] [blame] | 32 | static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata, |
| 33 | u32 sset, u8 *data) |
| 34 | { |
| 35 | struct ieee80211_local *local = sdata->local; |
| 36 | if (local->ops->get_et_strings) { |
| 37 | trace_drv_get_et_strings(local, sset); |
| 38 | local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data); |
| 39 | trace_drv_return_void(local); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata, |
| 44 | struct ethtool_stats *stats, |
| 45 | u64 *data) |
| 46 | { |
| 47 | struct ieee80211_local *local = sdata->local; |
| 48 | if (local->ops->get_et_stats) { |
| 49 | trace_drv_get_et_stats(local); |
| 50 | local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data); |
| 51 | trace_drv_return_void(local); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata, |
| 56 | int sset) |
| 57 | { |
| 58 | struct ieee80211_local *local = sdata->local; |
| 59 | int rv = 0; |
| 60 | if (local->ops->get_et_sset_count) { |
| 61 | trace_drv_get_et_sset_count(local, sset); |
| 62 | rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif, |
| 63 | sset); |
| 64 | trace_drv_return_int(local, rv); |
| 65 | } |
| 66 | return rv; |
| 67 | } |
| 68 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 69 | static inline int drv_start(struct ieee80211_local *local) |
| 70 | { |
Johannes Berg | ea77f12 | 2009-08-21 14:44:45 +0200 | [diff] [blame] | 71 | int ret; |
| 72 | |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 73 | might_sleep(); |
| 74 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 75 | trace_drv_start(local); |
Johannes Berg | ea77f12 | 2009-08-21 14:44:45 +0200 | [diff] [blame] | 76 | local->started = true; |
| 77 | smp_mb(); |
| 78 | ret = local->ops->start(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 79 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 80 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | static inline void drv_stop(struct ieee80211_local *local) |
| 84 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 85 | might_sleep(); |
| 86 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 87 | trace_drv_stop(local); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 88 | local->ops->stop(&local->hw); |
| 89 | trace_drv_return_void(local); |
Johannes Berg | ea77f12 | 2009-08-21 14:44:45 +0200 | [diff] [blame] | 90 | |
| 91 | /* sync away all work on the tasklet before clearing started */ |
| 92 | tasklet_disable(&local->tasklet); |
| 93 | tasklet_enable(&local->tasklet); |
| 94 | |
| 95 | barrier(); |
| 96 | |
| 97 | local->started = false; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 98 | } |
| 99 | |
Johannes Berg | eecc480 | 2011-05-04 15:37:29 +0200 | [diff] [blame] | 100 | #ifdef CONFIG_PM |
| 101 | static inline int drv_suspend(struct ieee80211_local *local, |
| 102 | struct cfg80211_wowlan *wowlan) |
| 103 | { |
| 104 | int ret; |
| 105 | |
| 106 | might_sleep(); |
| 107 | |
| 108 | trace_drv_suspend(local); |
| 109 | ret = local->ops->suspend(&local->hw, wowlan); |
| 110 | trace_drv_return_int(local, ret); |
| 111 | return ret; |
| 112 | } |
| 113 | |
| 114 | static inline int drv_resume(struct ieee80211_local *local) |
| 115 | { |
| 116 | int ret; |
| 117 | |
| 118 | might_sleep(); |
| 119 | |
| 120 | trace_drv_resume(local); |
| 121 | ret = local->ops->resume(&local->hw); |
| 122 | trace_drv_return_int(local, ret); |
| 123 | return ret; |
| 124 | } |
Johannes Berg | 6d52563 | 2012-04-04 15:05:25 +0200 | [diff] [blame] | 125 | |
| 126 | static inline void drv_set_wakeup(struct ieee80211_local *local, |
| 127 | bool enabled) |
| 128 | { |
| 129 | might_sleep(); |
| 130 | |
| 131 | if (!local->ops->set_wakeup) |
| 132 | return; |
| 133 | |
| 134 | trace_drv_set_wakeup(local, enabled); |
| 135 | local->ops->set_wakeup(&local->hw, enabled); |
| 136 | trace_drv_return_void(local); |
| 137 | } |
Johannes Berg | eecc480 | 2011-05-04 15:37:29 +0200 | [diff] [blame] | 138 | #endif |
| 139 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 140 | static inline int drv_add_interface(struct ieee80211_local *local, |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 141 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 142 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 143 | int ret; |
| 144 | |
| 145 | might_sleep(); |
| 146 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 147 | if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
Johannes Berg | 4b6f1dd | 2012-04-03 14:35:57 +0200 | [diff] [blame] | 148 | (sdata->vif.type == NL80211_IFTYPE_MONITOR && |
| 149 | !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)))) |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 150 | return -EINVAL; |
| 151 | |
| 152 | trace_drv_add_interface(local, sdata); |
| 153 | ret = local->ops->add_interface(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 154 | trace_drv_return_int(local, ret); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 155 | |
| 156 | if (ret == 0) |
| 157 | sdata->flags |= IEEE80211_SDATA_IN_DRIVER; |
| 158 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 159 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 160 | } |
| 161 | |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 162 | static inline int drv_change_interface(struct ieee80211_local *local, |
| 163 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2ca27bc | 2010-09-16 14:58:23 +0200 | [diff] [blame] | 164 | enum nl80211_iftype type, bool p2p) |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 165 | { |
| 166 | int ret; |
| 167 | |
| 168 | might_sleep(); |
| 169 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 170 | check_sdata_in_driver(sdata); |
| 171 | |
Johannes Berg | 2ca27bc | 2010-09-16 14:58:23 +0200 | [diff] [blame] | 172 | trace_drv_change_interface(local, sdata, type, p2p); |
| 173 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 174 | trace_drv_return_int(local, ret); |
| 175 | return ret; |
| 176 | } |
| 177 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 178 | static inline void drv_remove_interface(struct ieee80211_local *local, |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 179 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 180 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 181 | might_sleep(); |
| 182 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 183 | check_sdata_in_driver(sdata); |
| 184 | |
| 185 | trace_drv_remove_interface(local, sdata); |
| 186 | local->ops->remove_interface(&local->hw, &sdata->vif); |
| 187 | sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 188 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | static inline int drv_config(struct ieee80211_local *local, u32 changed) |
| 192 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 193 | int ret; |
| 194 | |
| 195 | might_sleep(); |
| 196 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 197 | trace_drv_config(local, changed); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 198 | ret = local->ops->config(&local->hw, changed); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 199 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 200 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | static inline void drv_bss_info_changed(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 204 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 205 | struct ieee80211_bss_conf *info, |
| 206 | u32 changed) |
| 207 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 208 | might_sleep(); |
| 209 | |
Johannes Berg | b8dc1a3 | 2012-12-14 14:22:10 +0100 | [diff] [blame^] | 210 | WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON | |
| 211 | BSS_CHANGED_BEACON_ENABLED) && |
| 212 | sdata->vif.type != NL80211_IFTYPE_AP && |
| 213 | sdata->vif.type != NL80211_IFTYPE_ADHOC && |
| 214 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT); |
| 215 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 216 | check_sdata_in_driver(sdata); |
| 217 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 218 | trace_drv_bss_info_changed(local, sdata, info, changed); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 219 | if (local->ops->bss_info_changed) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 220 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 221 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 222 | } |
| 223 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 224 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 225 | struct netdev_hw_addr_list *mc_list) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 226 | { |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 227 | u64 ret = 0; |
| 228 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 229 | trace_drv_prepare_multicast(local, mc_list->count); |
| 230 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 231 | if (local->ops->prepare_multicast) |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 232 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 233 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 234 | trace_drv_return_u64(local, ret); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 235 | |
| 236 | return ret; |
| 237 | } |
| 238 | |
| 239 | static inline void drv_configure_filter(struct ieee80211_local *local, |
| 240 | unsigned int changed_flags, |
| 241 | unsigned int *total_flags, |
| 242 | u64 multicast) |
| 243 | { |
| 244 | might_sleep(); |
| 245 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 246 | trace_drv_configure_filter(local, changed_flags, total_flags, |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 247 | multicast); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 248 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
| 249 | multicast); |
| 250 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | static inline int drv_set_tim(struct ieee80211_local *local, |
| 254 | struct ieee80211_sta *sta, bool set) |
| 255 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 256 | int ret = 0; |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 257 | trace_drv_set_tim(local, sta, set); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 258 | if (local->ops->set_tim) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 259 | ret = local->ops->set_tim(&local->hw, sta, set); |
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 int drv_set_key(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 265 | enum set_key_cmd cmd, |
| 266 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 267 | struct ieee80211_sta *sta, |
| 268 | struct ieee80211_key_conf *key) |
| 269 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 270 | int ret; |
| 271 | |
| 272 | might_sleep(); |
| 273 | |
Johannes Berg | 077f493 | 2012-01-20 13:55:18 +0100 | [diff] [blame] | 274 | sdata = get_bss_sdata(sdata); |
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_set_key(local, cmd, sdata, sta, key); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 278 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 279 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 280 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | static inline void drv_update_tkip_key(struct ieee80211_local *local, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 284 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 285 | struct ieee80211_key_conf *conf, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 286 | struct sta_info *sta, u32 iv32, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 287 | u16 *phase1key) |
| 288 | { |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 289 | struct ieee80211_sta *ista = NULL; |
| 290 | |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 291 | if (sta) |
| 292 | ista = &sta->sta; |
| 293 | |
Johannes Berg | 077f493 | 2012-01-20 13:55:18 +0100 | [diff] [blame] | 294 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 295 | check_sdata_in_driver(sdata); |
| 296 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 297 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 298 | if (local->ops->update_tkip_key) |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 299 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
| 300 | ista, iv32, phase1key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 301 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | static inline int drv_hw_scan(struct ieee80211_local *local, |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 305 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 306 | struct cfg80211_scan_request *req) |
| 307 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 308 | int ret; |
| 309 | |
| 310 | might_sleep(); |
| 311 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 312 | check_sdata_in_driver(sdata); |
| 313 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 314 | trace_drv_hw_scan(local, sdata); |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 315 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 316 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 317 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 318 | } |
| 319 | |
Eliad Peller | b856439 | 2011-06-13 12:47:30 +0300 | [diff] [blame] | 320 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
| 321 | struct ieee80211_sub_if_data *sdata) |
| 322 | { |
| 323 | might_sleep(); |
| 324 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 325 | check_sdata_in_driver(sdata); |
| 326 | |
Eliad Peller | b856439 | 2011-06-13 12:47:30 +0300 | [diff] [blame] | 327 | trace_drv_cancel_hw_scan(local, sdata); |
| 328 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); |
| 329 | trace_drv_return_void(local); |
| 330 | } |
| 331 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 332 | static inline int |
| 333 | drv_sched_scan_start(struct ieee80211_local *local, |
| 334 | struct ieee80211_sub_if_data *sdata, |
| 335 | struct cfg80211_sched_scan_request *req, |
| 336 | struct ieee80211_sched_scan_ies *ies) |
| 337 | { |
| 338 | int ret; |
| 339 | |
| 340 | might_sleep(); |
| 341 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 342 | check_sdata_in_driver(sdata); |
| 343 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 344 | trace_drv_sched_scan_start(local, sdata); |
| 345 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, |
| 346 | req, ies); |
| 347 | trace_drv_return_int(local, ret); |
| 348 | return ret; |
| 349 | } |
| 350 | |
| 351 | static inline void drv_sched_scan_stop(struct ieee80211_local *local, |
| 352 | struct ieee80211_sub_if_data *sdata) |
| 353 | { |
| 354 | might_sleep(); |
| 355 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 356 | check_sdata_in_driver(sdata); |
| 357 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 358 | trace_drv_sched_scan_stop(local, sdata); |
| 359 | local->ops->sched_scan_stop(&local->hw, &sdata->vif); |
| 360 | trace_drv_return_void(local); |
| 361 | } |
| 362 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 363 | static inline void drv_sw_scan_start(struct ieee80211_local *local) |
| 364 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 365 | might_sleep(); |
| 366 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 367 | trace_drv_sw_scan_start(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 368 | if (local->ops->sw_scan_start) |
| 369 | local->ops->sw_scan_start(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 370 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) |
| 374 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 375 | might_sleep(); |
| 376 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 377 | trace_drv_sw_scan_complete(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 378 | if (local->ops->sw_scan_complete) |
| 379 | local->ops->sw_scan_complete(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 380 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | static inline int drv_get_stats(struct ieee80211_local *local, |
| 384 | struct ieee80211_low_level_stats *stats) |
| 385 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 386 | int ret = -EOPNOTSUPP; |
| 387 | |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 388 | might_sleep(); |
| 389 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 390 | if (local->ops->get_stats) |
| 391 | ret = local->ops->get_stats(&local->hw, stats); |
| 392 | trace_drv_get_stats(local, stats, ret); |
| 393 | |
| 394 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | static inline void drv_get_tkip_seq(struct ieee80211_local *local, |
| 398 | u8 hw_key_idx, u32 *iv32, u16 *iv16) |
| 399 | { |
| 400 | if (local->ops->get_tkip_seq) |
| 401 | local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 402 | trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 403 | } |
| 404 | |
Arik Nemtsov | f23a478 | 2010-11-08 11:51:06 +0200 | [diff] [blame] | 405 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
| 406 | u32 value) |
| 407 | { |
| 408 | int ret = 0; |
| 409 | |
| 410 | might_sleep(); |
| 411 | |
| 412 | trace_drv_set_frag_threshold(local, value); |
| 413 | if (local->ops->set_frag_threshold) |
| 414 | ret = local->ops->set_frag_threshold(&local->hw, value); |
| 415 | trace_drv_return_int(local, ret); |
| 416 | return ret; |
| 417 | } |
| 418 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 419 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
| 420 | u32 value) |
| 421 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 422 | int ret = 0; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 423 | |
| 424 | might_sleep(); |
| 425 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 426 | trace_drv_set_rts_threshold(local, value); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 427 | if (local->ops->set_rts_threshold) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 428 | ret = local->ops->set_rts_threshold(&local->hw, value); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 429 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 430 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 431 | } |
| 432 | |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 433 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
| 434 | u8 value) |
| 435 | { |
| 436 | int ret = 0; |
| 437 | might_sleep(); |
| 438 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 439 | trace_drv_set_coverage_class(local, value); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 440 | if (local->ops->set_coverage_class) |
| 441 | local->ops->set_coverage_class(&local->hw, value); |
| 442 | else |
| 443 | ret = -EOPNOTSUPP; |
| 444 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 445 | trace_drv_return_int(local, ret); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 446 | return ret; |
| 447 | } |
| 448 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 449 | static inline void drv_sta_notify(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 450 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 451 | enum sta_notify_cmd cmd, |
| 452 | struct ieee80211_sta *sta) |
| 453 | { |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 454 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 455 | check_sdata_in_driver(sdata); |
| 456 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 457 | trace_drv_sta_notify(local, sdata, cmd, sta); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 458 | if (local->ops->sta_notify) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 459 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 460 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 461 | } |
| 462 | |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 463 | static inline int drv_sta_add(struct ieee80211_local *local, |
| 464 | struct ieee80211_sub_if_data *sdata, |
| 465 | struct ieee80211_sta *sta) |
| 466 | { |
| 467 | int ret = 0; |
| 468 | |
| 469 | might_sleep(); |
| 470 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 471 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 472 | check_sdata_in_driver(sdata); |
| 473 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 474 | trace_drv_sta_add(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 475 | if (local->ops->sta_add) |
| 476 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 477 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 478 | trace_drv_return_int(local, ret); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 479 | |
| 480 | return ret; |
| 481 | } |
| 482 | |
| 483 | static inline void drv_sta_remove(struct ieee80211_local *local, |
| 484 | struct ieee80211_sub_if_data *sdata, |
| 485 | struct ieee80211_sta *sta) |
| 486 | { |
| 487 | might_sleep(); |
| 488 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 489 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 490 | check_sdata_in_driver(sdata); |
| 491 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 492 | trace_drv_sta_remove(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 493 | if (local->ops->sta_remove) |
| 494 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 495 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 496 | trace_drv_return_void(local); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 497 | } |
| 498 | |
Sujith Manoharan | 77d2ece | 2012-11-20 08:46:02 +0530 | [diff] [blame] | 499 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 500 | static inline void drv_sta_add_debugfs(struct ieee80211_local *local, |
| 501 | struct ieee80211_sub_if_data *sdata, |
| 502 | struct ieee80211_sta *sta, |
| 503 | struct dentry *dir) |
| 504 | { |
| 505 | might_sleep(); |
| 506 | |
| 507 | sdata = get_bss_sdata(sdata); |
| 508 | check_sdata_in_driver(sdata); |
| 509 | |
| 510 | if (local->ops->sta_add_debugfs) |
| 511 | local->ops->sta_add_debugfs(&local->hw, &sdata->vif, |
| 512 | sta, dir); |
| 513 | } |
| 514 | |
| 515 | static inline void drv_sta_remove_debugfs(struct ieee80211_local *local, |
| 516 | struct ieee80211_sub_if_data *sdata, |
| 517 | struct ieee80211_sta *sta, |
| 518 | struct dentry *dir) |
| 519 | { |
| 520 | might_sleep(); |
| 521 | |
| 522 | sdata = get_bss_sdata(sdata); |
| 523 | check_sdata_in_driver(sdata); |
| 524 | |
| 525 | if (local->ops->sta_remove_debugfs) |
| 526 | local->ops->sta_remove_debugfs(&local->hw, &sdata->vif, |
| 527 | sta, dir); |
| 528 | } |
| 529 | #endif |
| 530 | |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 531 | static inline __must_check |
| 532 | int drv_sta_state(struct ieee80211_local *local, |
| 533 | struct ieee80211_sub_if_data *sdata, |
| 534 | struct sta_info *sta, |
| 535 | enum ieee80211_sta_state old_state, |
| 536 | enum ieee80211_sta_state new_state) |
| 537 | { |
| 538 | int ret = 0; |
| 539 | |
| 540 | might_sleep(); |
| 541 | |
| 542 | sdata = get_bss_sdata(sdata); |
| 543 | check_sdata_in_driver(sdata); |
| 544 | |
| 545 | trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); |
Johannes Berg | a4ec45a | 2012-01-20 13:55:22 +0100 | [diff] [blame] | 546 | if (local->ops->sta_state) { |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 547 | ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta, |
| 548 | old_state, new_state); |
Johannes Berg | a4ec45a | 2012-01-20 13:55:22 +0100 | [diff] [blame] | 549 | } else if (old_state == IEEE80211_STA_AUTH && |
| 550 | new_state == IEEE80211_STA_ASSOC) { |
| 551 | ret = drv_sta_add(local, sdata, &sta->sta); |
| 552 | if (ret == 0) |
| 553 | sta->uploaded = true; |
| 554 | } else if (old_state == IEEE80211_STA_ASSOC && |
| 555 | new_state == IEEE80211_STA_AUTH) { |
| 556 | drv_sta_remove(local, sdata, &sta->sta); |
| 557 | } |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 558 | trace_drv_return_int(local, ret); |
| 559 | return ret; |
| 560 | } |
| 561 | |
Johannes Berg | 8f727ef | 2012-03-30 08:43:32 +0200 | [diff] [blame] | 562 | static inline void drv_sta_rc_update(struct ieee80211_local *local, |
| 563 | struct ieee80211_sub_if_data *sdata, |
| 564 | struct ieee80211_sta *sta, u32 changed) |
| 565 | { |
| 566 | sdata = get_bss_sdata(sdata); |
| 567 | check_sdata_in_driver(sdata); |
| 568 | |
Antonio Quartulli | e687f61 | 2012-08-12 18:24:55 +0200 | [diff] [blame] | 569 | WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED && |
| 570 | sdata->vif.type != NL80211_IFTYPE_ADHOC); |
| 571 | |
Johannes Berg | 8f727ef | 2012-03-30 08:43:32 +0200 | [diff] [blame] | 572 | trace_drv_sta_rc_update(local, sdata, sta, changed); |
| 573 | if (local->ops->sta_rc_update) |
| 574 | local->ops->sta_rc_update(&local->hw, &sdata->vif, |
| 575 | sta, changed); |
| 576 | |
| 577 | trace_drv_return_void(local); |
| 578 | } |
| 579 | |
Eliad Peller | f6f3def | 2011-09-25 20:06:54 +0300 | [diff] [blame] | 580 | static inline int drv_conf_tx(struct ieee80211_local *local, |
Johannes Berg | a3304b0 | 2012-03-28 11:04:24 +0200 | [diff] [blame] | 581 | struct ieee80211_sub_if_data *sdata, u16 ac, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 582 | const struct ieee80211_tx_queue_params *params) |
| 583 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 584 | int ret = -EOPNOTSUPP; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 585 | |
| 586 | might_sleep(); |
| 587 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 588 | check_sdata_in_driver(sdata); |
| 589 | |
Johannes Berg | a3304b0 | 2012-03-28 11:04:24 +0200 | [diff] [blame] | 590 | trace_drv_conf_tx(local, sdata, ac, params); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 591 | if (local->ops->conf_tx) |
Eliad Peller | 8a3a3c8 | 2011-10-02 10:15:52 +0200 | [diff] [blame] | 592 | ret = local->ops->conf_tx(&local->hw, &sdata->vif, |
Johannes Berg | a3304b0 | 2012-03-28 11:04:24 +0200 | [diff] [blame] | 593 | ac, params); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 594 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 595 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 596 | } |
| 597 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 598 | static inline u64 drv_get_tsf(struct ieee80211_local *local, |
| 599 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 600 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 601 | u64 ret = -1ULL; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 602 | |
| 603 | might_sleep(); |
| 604 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 605 | check_sdata_in_driver(sdata); |
| 606 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 607 | trace_drv_get_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 608 | if (local->ops->get_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 609 | ret = local->ops->get_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 610 | trace_drv_return_u64(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 611 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 612 | } |
| 613 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 614 | static inline void drv_set_tsf(struct ieee80211_local *local, |
| 615 | struct ieee80211_sub_if_data *sdata, |
| 616 | u64 tsf) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 617 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 618 | might_sleep(); |
| 619 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 620 | check_sdata_in_driver(sdata); |
| 621 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 622 | trace_drv_set_tsf(local, sdata, tsf); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 623 | if (local->ops->set_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 624 | local->ops->set_tsf(&local->hw, &sdata->vif, tsf); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 625 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 626 | } |
| 627 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 628 | static inline void drv_reset_tsf(struct ieee80211_local *local, |
| 629 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 630 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 631 | might_sleep(); |
| 632 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 633 | check_sdata_in_driver(sdata); |
| 634 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 635 | trace_drv_reset_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 636 | if (local->ops->reset_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 637 | local->ops->reset_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 638 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) |
| 642 | { |
Masanari Iida | 02582e9 | 2012-08-22 19:11:26 +0900 | [diff] [blame] | 643 | int ret = 0; /* default unsupported op for less congestion */ |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 644 | |
| 645 | might_sleep(); |
| 646 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 647 | trace_drv_tx_last_beacon(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 648 | if (local->ops->tx_last_beacon) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 649 | ret = local->ops->tx_last_beacon(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 650 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 651 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 652 | } |
| 653 | |
| 654 | static inline int drv_ampdu_action(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 655 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 656 | enum ieee80211_ampdu_mlme_action action, |
| 657 | struct ieee80211_sta *sta, u16 tid, |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 658 | u16 *ssn, u8 buf_size) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 659 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 660 | int ret = -EOPNOTSUPP; |
Johannes Berg | cfcdbde | 2010-06-10 10:21:48 +0200 | [diff] [blame] | 661 | |
| 662 | might_sleep(); |
| 663 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 664 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 665 | check_sdata_in_driver(sdata); |
| 666 | |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 667 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 668 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 669 | if (local->ops->ampdu_action) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 670 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 671 | sta, tid, ssn, buf_size); |
Johannes Berg | 85ad181 | 2010-06-10 10:21:49 +0200 | [diff] [blame] | 672 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 673 | trace_drv_return_int(local, ret); |
| 674 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 675 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 676 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 677 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 678 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
| 679 | struct survey_info *survey) |
| 680 | { |
| 681 | int ret = -EOPNOTSUPP; |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 682 | |
| 683 | trace_drv_get_survey(local, idx, survey); |
| 684 | |
Holger Schurig | 35dd050 | 2010-06-07 16:33:49 +0200 | [diff] [blame] | 685 | if (local->ops->get_survey) |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 686 | ret = local->ops->get_survey(&local->hw, idx, survey); |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 687 | |
| 688 | trace_drv_return_int(local, ret); |
| 689 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 690 | return ret; |
| 691 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 692 | |
| 693 | static inline void drv_rfkill_poll(struct ieee80211_local *local) |
| 694 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 695 | might_sleep(); |
| 696 | |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 697 | if (local->ops->rfkill_poll) |
| 698 | local->ops->rfkill_poll(&local->hw); |
| 699 | } |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 700 | |
| 701 | static inline void drv_flush(struct ieee80211_local *local, bool drop) |
| 702 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 703 | might_sleep(); |
| 704 | |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 705 | trace_drv_flush(local, drop); |
| 706 | if (local->ops->flush) |
| 707 | local->ops->flush(&local->hw, drop); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 708 | trace_drv_return_void(local); |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 709 | } |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 710 | |
| 711 | static inline void drv_channel_switch(struct ieee80211_local *local, |
| 712 | struct ieee80211_channel_switch *ch_switch) |
| 713 | { |
| 714 | might_sleep(); |
| 715 | |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 716 | trace_drv_channel_switch(local, ch_switch); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 717 | local->ops->channel_switch(&local->hw, ch_switch); |
| 718 | trace_drv_return_void(local); |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 719 | } |
| 720 | |
Bruno Randolf | 15d9675 | 2010-11-10 12:50:56 +0900 | [diff] [blame] | 721 | |
| 722 | static inline int drv_set_antenna(struct ieee80211_local *local, |
| 723 | u32 tx_ant, u32 rx_ant) |
| 724 | { |
| 725 | int ret = -EOPNOTSUPP; |
| 726 | might_sleep(); |
| 727 | if (local->ops->set_antenna) |
| 728 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); |
| 729 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); |
| 730 | return ret; |
| 731 | } |
| 732 | |
| 733 | static inline int drv_get_antenna(struct ieee80211_local *local, |
| 734 | u32 *tx_ant, u32 *rx_ant) |
| 735 | { |
| 736 | int ret = -EOPNOTSUPP; |
| 737 | might_sleep(); |
| 738 | if (local->ops->get_antenna) |
| 739 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); |
| 740 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); |
| 741 | return ret; |
| 742 | } |
| 743 | |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 744 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
Eliad Peller | 4988456 | 2012-11-19 17:05:09 +0200 | [diff] [blame] | 745 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 746 | struct ieee80211_channel *chan, |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 747 | unsigned int duration) |
| 748 | { |
| 749 | int ret; |
| 750 | |
| 751 | might_sleep(); |
| 752 | |
Johannes Berg | 42d97a5 | 2012-11-08 18:31:02 +0100 | [diff] [blame] | 753 | trace_drv_remain_on_channel(local, sdata, chan, duration); |
Eliad Peller | 4988456 | 2012-11-19 17:05:09 +0200 | [diff] [blame] | 754 | ret = local->ops->remain_on_channel(&local->hw, &sdata->vif, |
Johannes Berg | 42d97a5 | 2012-11-08 18:31:02 +0100 | [diff] [blame] | 755 | chan, duration); |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 756 | trace_drv_return_int(local, ret); |
| 757 | |
| 758 | return ret; |
| 759 | } |
| 760 | |
| 761 | static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) |
| 762 | { |
| 763 | int ret; |
| 764 | |
| 765 | might_sleep(); |
| 766 | |
| 767 | trace_drv_cancel_remain_on_channel(local); |
| 768 | ret = local->ops->cancel_remain_on_channel(&local->hw); |
| 769 | trace_drv_return_int(local, ret); |
| 770 | |
| 771 | return ret; |
| 772 | } |
| 773 | |
John W. Linville | 38c0915 | 2011-03-07 16:19:18 -0500 | [diff] [blame] | 774 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
| 775 | u32 tx, u32 rx) |
| 776 | { |
| 777 | int ret = -ENOTSUPP; |
| 778 | |
| 779 | might_sleep(); |
| 780 | |
| 781 | trace_drv_set_ringparam(local, tx, rx); |
| 782 | if (local->ops->set_ringparam) |
| 783 | ret = local->ops->set_ringparam(&local->hw, tx, rx); |
| 784 | trace_drv_return_int(local, ret); |
| 785 | |
| 786 | return ret; |
| 787 | } |
| 788 | |
| 789 | static inline void drv_get_ringparam(struct ieee80211_local *local, |
| 790 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) |
| 791 | { |
| 792 | might_sleep(); |
| 793 | |
| 794 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); |
| 795 | if (local->ops->get_ringparam) |
| 796 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); |
| 797 | trace_drv_return_void(local); |
| 798 | } |
| 799 | |
Vivek Natarajan | e8306f9 | 2011-04-06 11:41:10 +0530 | [diff] [blame] | 800 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
| 801 | { |
| 802 | bool ret = false; |
| 803 | |
| 804 | might_sleep(); |
| 805 | |
| 806 | trace_drv_tx_frames_pending(local); |
| 807 | if (local->ops->tx_frames_pending) |
| 808 | ret = local->ops->tx_frames_pending(&local->hw); |
| 809 | trace_drv_return_bool(local, ret); |
| 810 | |
| 811 | return ret; |
| 812 | } |
Sujith Manoharan | bdbfd6b | 2011-04-27 16:56:51 +0530 | [diff] [blame] | 813 | |
| 814 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, |
| 815 | struct ieee80211_sub_if_data *sdata, |
| 816 | const struct cfg80211_bitrate_mask *mask) |
| 817 | { |
| 818 | int ret = -EOPNOTSUPP; |
| 819 | |
| 820 | might_sleep(); |
| 821 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 822 | check_sdata_in_driver(sdata); |
| 823 | |
Sujith Manoharan | bdbfd6b | 2011-04-27 16:56:51 +0530 | [diff] [blame] | 824 | trace_drv_set_bitrate_mask(local, sdata, mask); |
| 825 | if (local->ops->set_bitrate_mask) |
| 826 | ret = local->ops->set_bitrate_mask(&local->hw, |
| 827 | &sdata->vif, mask); |
| 828 | trace_drv_return_int(local, ret); |
| 829 | |
| 830 | return ret; |
| 831 | } |
| 832 | |
Johannes Berg | c68f4b8 | 2011-07-05 16:35:41 +0200 | [diff] [blame] | 833 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
| 834 | struct ieee80211_sub_if_data *sdata, |
| 835 | struct cfg80211_gtk_rekey_data *data) |
| 836 | { |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 837 | check_sdata_in_driver(sdata); |
| 838 | |
Johannes Berg | c68f4b8 | 2011-07-05 16:35:41 +0200 | [diff] [blame] | 839 | trace_drv_set_rekey_data(local, sdata, data); |
| 840 | if (local->ops->set_rekey_data) |
| 841 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); |
| 842 | trace_drv_return_void(local); |
| 843 | } |
| 844 | |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 845 | static inline void drv_rssi_callback(struct ieee80211_local *local, |
| 846 | const enum ieee80211_rssi_event event) |
| 847 | { |
| 848 | trace_drv_rssi_callback(local, event); |
| 849 | if (local->ops->rssi_callback) |
| 850 | local->ops->rssi_callback(&local->hw, event); |
| 851 | trace_drv_return_void(local); |
| 852 | } |
Johannes Berg | 4049e09 | 2011-09-29 16:04:32 +0200 | [diff] [blame] | 853 | |
| 854 | static inline void |
| 855 | drv_release_buffered_frames(struct ieee80211_local *local, |
| 856 | struct sta_info *sta, u16 tids, int num_frames, |
| 857 | enum ieee80211_frame_release_type reason, |
| 858 | bool more_data) |
| 859 | { |
| 860 | trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, |
| 861 | reason, more_data); |
| 862 | if (local->ops->release_buffered_frames) |
| 863 | local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, |
| 864 | num_frames, reason, |
| 865 | more_data); |
| 866 | trace_drv_return_void(local); |
| 867 | } |
Johannes Berg | 40b9640 | 2011-09-29 16:04:38 +0200 | [diff] [blame] | 868 | |
| 869 | static inline void |
| 870 | drv_allow_buffered_frames(struct ieee80211_local *local, |
| 871 | struct sta_info *sta, u16 tids, int num_frames, |
| 872 | enum ieee80211_frame_release_type reason, |
| 873 | bool more_data) |
| 874 | { |
| 875 | trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, |
| 876 | reason, more_data); |
| 877 | if (local->ops->allow_buffered_frames) |
| 878 | local->ops->allow_buffered_frames(&local->hw, &sta->sta, |
| 879 | tids, num_frames, reason, |
| 880 | more_data); |
| 881 | trace_drv_return_void(local); |
| 882 | } |
Victor Goldenshtein | 66572cf | 2012-06-21 10:56:46 +0300 | [diff] [blame] | 883 | |
| 884 | static inline int drv_get_rssi(struct ieee80211_local *local, |
| 885 | struct ieee80211_sub_if_data *sdata, |
| 886 | struct ieee80211_sta *sta, |
| 887 | s8 *rssi_dbm) |
| 888 | { |
| 889 | int ret; |
| 890 | |
| 891 | might_sleep(); |
| 892 | |
| 893 | ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm); |
| 894 | trace_drv_get_rssi(local, sta, *rssi_dbm, ret); |
| 895 | |
| 896 | return ret; |
| 897 | } |
Johannes Berg | a1845fc | 2012-06-27 13:18:36 +0200 | [diff] [blame] | 898 | |
| 899 | static inline void drv_mgd_prepare_tx(struct ieee80211_local *local, |
| 900 | struct ieee80211_sub_if_data *sdata) |
| 901 | { |
| 902 | might_sleep(); |
| 903 | |
| 904 | check_sdata_in_driver(sdata); |
| 905 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); |
| 906 | |
| 907 | trace_drv_mgd_prepare_tx(local, sdata); |
| 908 | if (local->ops->mgd_prepare_tx) |
| 909 | local->ops->mgd_prepare_tx(&local->hw, &sdata->vif); |
| 910 | trace_drv_return_void(local); |
| 911 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 912 | |
| 913 | static inline int drv_add_chanctx(struct ieee80211_local *local, |
| 914 | struct ieee80211_chanctx *ctx) |
| 915 | { |
| 916 | int ret = -EOPNOTSUPP; |
| 917 | |
| 918 | trace_drv_add_chanctx(local, ctx); |
| 919 | if (local->ops->add_chanctx) |
| 920 | ret = local->ops->add_chanctx(&local->hw, &ctx->conf); |
| 921 | trace_drv_return_int(local, ret); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 922 | if (!ret) |
| 923 | ctx->driver_present = true; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 924 | |
| 925 | return ret; |
| 926 | } |
| 927 | |
| 928 | static inline void drv_remove_chanctx(struct ieee80211_local *local, |
| 929 | struct ieee80211_chanctx *ctx) |
| 930 | { |
| 931 | trace_drv_remove_chanctx(local, ctx); |
| 932 | if (local->ops->remove_chanctx) |
| 933 | local->ops->remove_chanctx(&local->hw, &ctx->conf); |
| 934 | trace_drv_return_void(local); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 935 | ctx->driver_present = false; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 936 | } |
| 937 | |
| 938 | static inline void drv_change_chanctx(struct ieee80211_local *local, |
| 939 | struct ieee80211_chanctx *ctx, |
| 940 | u32 changed) |
| 941 | { |
| 942 | trace_drv_change_chanctx(local, ctx, changed); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 943 | if (local->ops->change_chanctx) { |
| 944 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 945 | local->ops->change_chanctx(&local->hw, &ctx->conf, changed); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 946 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 947 | trace_drv_return_void(local); |
| 948 | } |
| 949 | |
| 950 | static inline int drv_assign_vif_chanctx(struct ieee80211_local *local, |
| 951 | struct ieee80211_sub_if_data *sdata, |
| 952 | struct ieee80211_chanctx *ctx) |
| 953 | { |
| 954 | int ret = 0; |
| 955 | |
| 956 | check_sdata_in_driver(sdata); |
| 957 | |
| 958 | trace_drv_assign_vif_chanctx(local, sdata, ctx); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 959 | if (local->ops->assign_vif_chanctx) { |
| 960 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 961 | ret = local->ops->assign_vif_chanctx(&local->hw, |
| 962 | &sdata->vif, |
| 963 | &ctx->conf); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 964 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 965 | trace_drv_return_int(local, ret); |
| 966 | |
| 967 | return ret; |
| 968 | } |
| 969 | |
| 970 | static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local, |
| 971 | struct ieee80211_sub_if_data *sdata, |
| 972 | struct ieee80211_chanctx *ctx) |
| 973 | { |
| 974 | check_sdata_in_driver(sdata); |
| 975 | |
| 976 | trace_drv_unassign_vif_chanctx(local, sdata, ctx); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 977 | if (local->ops->unassign_vif_chanctx) { |
| 978 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 979 | local->ops->unassign_vif_chanctx(&local->hw, |
| 980 | &sdata->vif, |
| 981 | &ctx->conf); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 982 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 983 | trace_drv_return_void(local); |
| 984 | } |
| 985 | |
Johannes Berg | 1041638 | 2012-10-19 15:44:42 +0200 | [diff] [blame] | 986 | static inline int drv_start_ap(struct ieee80211_local *local, |
| 987 | struct ieee80211_sub_if_data *sdata) |
| 988 | { |
| 989 | int ret = 0; |
| 990 | |
| 991 | check_sdata_in_driver(sdata); |
| 992 | |
| 993 | trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf); |
| 994 | if (local->ops->start_ap) |
| 995 | ret = local->ops->start_ap(&local->hw, &sdata->vif); |
| 996 | trace_drv_return_int(local, ret); |
| 997 | return ret; |
| 998 | } |
| 999 | |
| 1000 | static inline void drv_stop_ap(struct ieee80211_local *local, |
| 1001 | struct ieee80211_sub_if_data *sdata) |
| 1002 | { |
| 1003 | check_sdata_in_driver(sdata); |
| 1004 | |
| 1005 | trace_drv_stop_ap(local, sdata); |
| 1006 | if (local->ops->stop_ap) |
| 1007 | local->ops->stop_ap(&local->hw, &sdata->vif); |
| 1008 | trace_drv_return_void(local); |
| 1009 | } |
| 1010 | |
Johannes Berg | 9214ad7 | 2012-11-06 19:18:13 +0100 | [diff] [blame] | 1011 | static inline void drv_restart_complete(struct ieee80211_local *local) |
| 1012 | { |
| 1013 | might_sleep(); |
| 1014 | |
| 1015 | trace_drv_restart_complete(local); |
| 1016 | if (local->ops->restart_complete) |
| 1017 | local->ops->restart_complete(&local->hw); |
| 1018 | trace_drv_return_void(local); |
| 1019 | } |
| 1020 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 1021 | #endif /* __MAC80211_DRIVER_OPS */ |