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 | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 8 | static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 9 | { |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 10 | return !WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), |
| 11 | "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", |
| 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 && |
Johannes Berg | 30686bf | 2015-06-02 21:39:54 +0200 | [diff] [blame] | 149 | !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) && |
Felix Fietkau | 31eba5b | 2013-05-28 13:01:53 +0200 | [diff] [blame] | 150 | !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)))) |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 151 | return -EINVAL; |
| 152 | |
| 153 | trace_drv_add_interface(local, sdata); |
| 154 | ret = local->ops->add_interface(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 155 | trace_drv_return_int(local, ret); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 156 | |
| 157 | if (ret == 0) |
| 158 | sdata->flags |= IEEE80211_SDATA_IN_DRIVER; |
| 159 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 160 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 161 | } |
| 162 | |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 163 | static inline int drv_change_interface(struct ieee80211_local *local, |
| 164 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2ca27bc | 2010-09-16 14:58:23 +0200 | [diff] [blame] | 165 | enum nl80211_iftype type, bool p2p) |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 166 | { |
| 167 | int ret; |
| 168 | |
| 169 | might_sleep(); |
| 170 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 171 | if (!check_sdata_in_driver(sdata)) |
| 172 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 173 | |
Johannes Berg | 2ca27bc | 2010-09-16 14:58:23 +0200 | [diff] [blame] | 174 | trace_drv_change_interface(local, sdata, type, p2p); |
| 175 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); |
Johannes Berg | 34d4bc4 | 2010-08-27 12:35:58 +0200 | [diff] [blame] | 176 | trace_drv_return_int(local, ret); |
| 177 | return ret; |
| 178 | } |
| 179 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 180 | static inline void drv_remove_interface(struct ieee80211_local *local, |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 181 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 182 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 183 | might_sleep(); |
| 184 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 185 | if (!check_sdata_in_driver(sdata)) |
| 186 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 187 | |
| 188 | trace_drv_remove_interface(local, sdata); |
| 189 | local->ops->remove_interface(&local->hw, &sdata->vif); |
| 190 | sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 191 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | static inline int drv_config(struct ieee80211_local *local, u32 changed) |
| 195 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 196 | int ret; |
| 197 | |
| 198 | might_sleep(); |
| 199 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 200 | trace_drv_config(local, changed); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 201 | ret = local->ops->config(&local->hw, changed); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 202 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 203 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | static inline void drv_bss_info_changed(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 207 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 208 | struct ieee80211_bss_conf *info, |
| 209 | u32 changed) |
| 210 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 211 | might_sleep(); |
| 212 | |
Johannes Berg | 5bbe754d | 2013-02-13 13:50:51 +0100 | [diff] [blame] | 213 | if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON | |
| 214 | BSS_CHANGED_BEACON_ENABLED) && |
| 215 | sdata->vif.type != NL80211_IFTYPE_AP && |
| 216 | sdata->vif.type != NL80211_IFTYPE_ADHOC && |
Rostislav Lisovy | 239281f | 2014-11-03 10:33:19 +0100 | [diff] [blame] | 217 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
| 218 | sdata->vif.type != NL80211_IFTYPE_OCB)) |
Johannes Berg | 5bbe754d | 2013-02-13 13:50:51 +0100 | [diff] [blame] | 219 | return; |
| 220 | |
| 221 | if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE || |
| 222 | sdata->vif.type == NL80211_IFTYPE_MONITOR)) |
| 223 | return; |
Johannes Berg | b8dc1a3 | 2012-12-14 14:22:10 +0100 | [diff] [blame] | 224 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 225 | if (!check_sdata_in_driver(sdata)) |
| 226 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 227 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 228 | trace_drv_bss_info_changed(local, sdata, info, changed); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 229 | if (local->ops->bss_info_changed) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 230 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 231 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 232 | } |
| 233 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 234 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 235 | struct netdev_hw_addr_list *mc_list) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 236 | { |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 237 | u64 ret = 0; |
| 238 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 239 | trace_drv_prepare_multicast(local, mc_list->count); |
| 240 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 241 | if (local->ops->prepare_multicast) |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 242 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 243 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 244 | trace_drv_return_u64(local, ret); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 245 | |
| 246 | return ret; |
| 247 | } |
| 248 | |
| 249 | static inline void drv_configure_filter(struct ieee80211_local *local, |
| 250 | unsigned int changed_flags, |
| 251 | unsigned int *total_flags, |
| 252 | u64 multicast) |
| 253 | { |
| 254 | might_sleep(); |
| 255 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 256 | trace_drv_configure_filter(local, changed_flags, total_flags, |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 257 | multicast); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 258 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
| 259 | multicast); |
| 260 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 261 | } |
| 262 | |
Andrei Otcheretianski | 1b09b55 | 2015-08-15 22:39:50 +0300 | [diff] [blame] | 263 | static inline void drv_config_iface_filter(struct ieee80211_local *local, |
| 264 | struct ieee80211_sub_if_data *sdata, |
| 265 | unsigned int filter_flags, |
| 266 | unsigned int changed_flags) |
| 267 | { |
| 268 | might_sleep(); |
| 269 | |
| 270 | trace_drv_config_iface_filter(local, sdata, filter_flags, |
| 271 | changed_flags); |
| 272 | if (local->ops->config_iface_filter) |
| 273 | local->ops->config_iface_filter(&local->hw, &sdata->vif, |
| 274 | filter_flags, |
| 275 | changed_flags); |
| 276 | trace_drv_return_void(local); |
| 277 | } |
| 278 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 279 | static inline int drv_set_tim(struct ieee80211_local *local, |
| 280 | struct ieee80211_sta *sta, bool set) |
| 281 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 282 | int ret = 0; |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 283 | trace_drv_set_tim(local, sta, set); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 284 | if (local->ops->set_tim) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 285 | ret = local->ops->set_tim(&local->hw, sta, set); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 286 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 287 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | static inline int drv_set_key(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 291 | enum set_key_cmd cmd, |
| 292 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 293 | struct ieee80211_sta *sta, |
| 294 | struct ieee80211_key_conf *key) |
| 295 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 296 | int ret; |
| 297 | |
| 298 | might_sleep(); |
| 299 | |
Johannes Berg | 077f493 | 2012-01-20 13:55:18 +0100 | [diff] [blame] | 300 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 301 | if (!check_sdata_in_driver(sdata)) |
| 302 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 303 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 304 | trace_drv_set_key(local, cmd, sdata, sta, key); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 305 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 306 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 307 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | static inline void drv_update_tkip_key(struct ieee80211_local *local, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 311 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 312 | struct ieee80211_key_conf *conf, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 313 | struct sta_info *sta, u32 iv32, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 314 | u16 *phase1key) |
| 315 | { |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 316 | struct ieee80211_sta *ista = NULL; |
| 317 | |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 318 | if (sta) |
| 319 | ista = &sta->sta; |
| 320 | |
Johannes Berg | 077f493 | 2012-01-20 13:55:18 +0100 | [diff] [blame] | 321 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 322 | if (!check_sdata_in_driver(sdata)) |
| 323 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 324 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 325 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 326 | if (local->ops->update_tkip_key) |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 327 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
| 328 | ista, iv32, phase1key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 329 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | static inline int drv_hw_scan(struct ieee80211_local *local, |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 333 | struct ieee80211_sub_if_data *sdata, |
David Spinadel | c56ef67 | 2014-02-05 15:21:13 +0200 | [diff] [blame] | 334 | struct ieee80211_scan_request *req) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 335 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 336 | int ret; |
| 337 | |
| 338 | might_sleep(); |
| 339 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 340 | if (!check_sdata_in_driver(sdata)) |
| 341 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 342 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 343 | trace_drv_hw_scan(local, sdata); |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 344 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 345 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 346 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 347 | } |
| 348 | |
Eliad Peller | b856439 | 2011-06-13 12:47:30 +0300 | [diff] [blame] | 349 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
| 350 | struct ieee80211_sub_if_data *sdata) |
| 351 | { |
| 352 | might_sleep(); |
| 353 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 354 | if (!check_sdata_in_driver(sdata)) |
| 355 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 356 | |
Eliad Peller | b856439 | 2011-06-13 12:47:30 +0300 | [diff] [blame] | 357 | trace_drv_cancel_hw_scan(local, sdata); |
| 358 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); |
| 359 | trace_drv_return_void(local); |
| 360 | } |
| 361 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 362 | static inline int |
| 363 | drv_sched_scan_start(struct ieee80211_local *local, |
| 364 | struct ieee80211_sub_if_data *sdata, |
| 365 | struct cfg80211_sched_scan_request *req, |
David Spinadel | 633e271 | 2014-02-06 16:15:23 +0200 | [diff] [blame] | 366 | struct ieee80211_scan_ies *ies) |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 367 | { |
| 368 | int ret; |
| 369 | |
| 370 | might_sleep(); |
| 371 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 372 | if (!check_sdata_in_driver(sdata)) |
| 373 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 374 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 375 | trace_drv_sched_scan_start(local, sdata); |
| 376 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, |
| 377 | req, ies); |
| 378 | trace_drv_return_int(local, ret); |
| 379 | return ret; |
| 380 | } |
| 381 | |
Johannes Berg | 37e3308 | 2014-02-17 10:48:17 +0100 | [diff] [blame] | 382 | static inline int drv_sched_scan_stop(struct ieee80211_local *local, |
| 383 | struct ieee80211_sub_if_data *sdata) |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 384 | { |
Johannes Berg | 37e3308 | 2014-02-17 10:48:17 +0100 | [diff] [blame] | 385 | int ret; |
| 386 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 387 | might_sleep(); |
| 388 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 389 | if (!check_sdata_in_driver(sdata)) |
| 390 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 391 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 392 | trace_drv_sched_scan_stop(local, sdata); |
Johannes Berg | 37e3308 | 2014-02-17 10:48:17 +0100 | [diff] [blame] | 393 | ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif); |
| 394 | trace_drv_return_int(local, ret); |
| 395 | |
| 396 | return ret; |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 397 | } |
| 398 | |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 399 | static inline void drv_sw_scan_start(struct ieee80211_local *local, |
| 400 | struct ieee80211_sub_if_data *sdata, |
| 401 | const u8 *mac_addr) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 402 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 403 | might_sleep(); |
| 404 | |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 405 | trace_drv_sw_scan_start(local, sdata, mac_addr); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 406 | if (local->ops->sw_scan_start) |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 407 | local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 408 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 409 | } |
| 410 | |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 411 | static inline void drv_sw_scan_complete(struct ieee80211_local *local, |
| 412 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 413 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 414 | might_sleep(); |
| 415 | |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 416 | trace_drv_sw_scan_complete(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 417 | if (local->ops->sw_scan_complete) |
Johannes Berg | a344d67 | 2014-06-12 22:24:31 +0200 | [diff] [blame] | 418 | local->ops->sw_scan_complete(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 419 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | static inline int drv_get_stats(struct ieee80211_local *local, |
| 423 | struct ieee80211_low_level_stats *stats) |
| 424 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 425 | int ret = -EOPNOTSUPP; |
| 426 | |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 427 | might_sleep(); |
| 428 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 429 | if (local->ops->get_stats) |
| 430 | ret = local->ops->get_stats(&local->hw, stats); |
| 431 | trace_drv_get_stats(local, stats, ret); |
| 432 | |
| 433 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 434 | } |
| 435 | |
Johannes Berg | 9352c19 | 2015-04-20 18:12:41 +0200 | [diff] [blame] | 436 | static inline void drv_get_key_seq(struct ieee80211_local *local, |
| 437 | struct ieee80211_key *key, |
| 438 | struct ieee80211_key_seq *seq) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 439 | { |
Johannes Berg | 9352c19 | 2015-04-20 18:12:41 +0200 | [diff] [blame] | 440 | if (local->ops->get_key_seq) |
| 441 | local->ops->get_key_seq(&local->hw, &key->conf, seq); |
| 442 | trace_drv_get_key_seq(local, &key->conf); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 443 | } |
| 444 | |
Arik Nemtsov | f23a478 | 2010-11-08 11:51:06 +0200 | [diff] [blame] | 445 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
| 446 | u32 value) |
| 447 | { |
| 448 | int ret = 0; |
| 449 | |
| 450 | might_sleep(); |
| 451 | |
| 452 | trace_drv_set_frag_threshold(local, value); |
| 453 | if (local->ops->set_frag_threshold) |
| 454 | ret = local->ops->set_frag_threshold(&local->hw, value); |
| 455 | trace_drv_return_int(local, ret); |
| 456 | return ret; |
| 457 | } |
| 458 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 459 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
| 460 | u32 value) |
| 461 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 462 | int ret = 0; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 463 | |
| 464 | might_sleep(); |
| 465 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 466 | trace_drv_set_rts_threshold(local, value); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 467 | if (local->ops->set_rts_threshold) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 468 | ret = local->ops->set_rts_threshold(&local->hw, value); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 469 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 470 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 471 | } |
| 472 | |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 473 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
Lorenzo Bianconi | a4bcaf5 | 2014-09-04 23:57:41 +0200 | [diff] [blame] | 474 | s16 value) |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 475 | { |
| 476 | int ret = 0; |
| 477 | might_sleep(); |
| 478 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 479 | trace_drv_set_coverage_class(local, value); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 480 | if (local->ops->set_coverage_class) |
| 481 | local->ops->set_coverage_class(&local->hw, value); |
| 482 | else |
| 483 | ret = -EOPNOTSUPP; |
| 484 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 485 | trace_drv_return_int(local, ret); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 486 | return ret; |
| 487 | } |
| 488 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 489 | static inline void drv_sta_notify(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 490 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 491 | enum sta_notify_cmd cmd, |
| 492 | struct ieee80211_sta *sta) |
| 493 | { |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 494 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 495 | if (!check_sdata_in_driver(sdata)) |
| 496 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 497 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 498 | trace_drv_sta_notify(local, sdata, cmd, sta); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 499 | if (local->ops->sta_notify) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 500 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 501 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 502 | } |
| 503 | |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 504 | static inline int drv_sta_add(struct ieee80211_local *local, |
| 505 | struct ieee80211_sub_if_data *sdata, |
| 506 | struct ieee80211_sta *sta) |
| 507 | { |
| 508 | int ret = 0; |
| 509 | |
| 510 | might_sleep(); |
| 511 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 512 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 513 | if (!check_sdata_in_driver(sdata)) |
| 514 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 515 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 516 | trace_drv_sta_add(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 517 | if (local->ops->sta_add) |
| 518 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 519 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 520 | trace_drv_return_int(local, ret); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 521 | |
| 522 | return ret; |
| 523 | } |
| 524 | |
| 525 | static inline void drv_sta_remove(struct ieee80211_local *local, |
| 526 | struct ieee80211_sub_if_data *sdata, |
| 527 | struct ieee80211_sta *sta) |
| 528 | { |
| 529 | might_sleep(); |
| 530 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 531 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 532 | if (!check_sdata_in_driver(sdata)) |
| 533 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 534 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 535 | trace_drv_sta_remove(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 536 | if (local->ops->sta_remove) |
| 537 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 538 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 539 | trace_drv_return_void(local); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 540 | } |
| 541 | |
Sujith Manoharan | 77d2ece | 2012-11-20 08:46:02 +0530 | [diff] [blame] | 542 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 543 | static inline void drv_sta_add_debugfs(struct ieee80211_local *local, |
| 544 | struct ieee80211_sub_if_data *sdata, |
| 545 | struct ieee80211_sta *sta, |
| 546 | struct dentry *dir) |
| 547 | { |
| 548 | might_sleep(); |
| 549 | |
| 550 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 551 | if (!check_sdata_in_driver(sdata)) |
| 552 | return; |
Sujith Manoharan | 77d2ece | 2012-11-20 08:46:02 +0530 | [diff] [blame] | 553 | |
| 554 | if (local->ops->sta_add_debugfs) |
| 555 | local->ops->sta_add_debugfs(&local->hw, &sdata->vif, |
| 556 | sta, dir); |
| 557 | } |
| 558 | |
| 559 | static inline void drv_sta_remove_debugfs(struct ieee80211_local *local, |
| 560 | struct ieee80211_sub_if_data *sdata, |
| 561 | struct ieee80211_sta *sta, |
| 562 | struct dentry *dir) |
| 563 | { |
| 564 | might_sleep(); |
| 565 | |
| 566 | sdata = get_bss_sdata(sdata); |
| 567 | check_sdata_in_driver(sdata); |
| 568 | |
| 569 | if (local->ops->sta_remove_debugfs) |
| 570 | local->ops->sta_remove_debugfs(&local->hw, &sdata->vif, |
| 571 | sta, dir); |
| 572 | } |
| 573 | #endif |
| 574 | |
Johannes Berg | 6a9d1b9 | 2013-12-04 22:39:17 +0100 | [diff] [blame] | 575 | static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local, |
| 576 | struct ieee80211_sub_if_data *sdata, |
| 577 | struct sta_info *sta) |
| 578 | { |
| 579 | might_sleep(); |
| 580 | |
| 581 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 582 | if (!check_sdata_in_driver(sdata)) |
| 583 | return; |
Johannes Berg | 6a9d1b9 | 2013-12-04 22:39:17 +0100 | [diff] [blame] | 584 | |
| 585 | trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta); |
| 586 | if (local->ops->sta_pre_rcu_remove) |
| 587 | local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif, |
| 588 | &sta->sta); |
| 589 | trace_drv_return_void(local); |
| 590 | } |
| 591 | |
Denys Vlasenko | 727da60 | 2015-07-15 14:56:05 +0200 | [diff] [blame] | 592 | __must_check |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 593 | int drv_sta_state(struct ieee80211_local *local, |
| 594 | struct ieee80211_sub_if_data *sdata, |
| 595 | struct sta_info *sta, |
| 596 | enum ieee80211_sta_state old_state, |
Denys Vlasenko | 727da60 | 2015-07-15 14:56:05 +0200 | [diff] [blame] | 597 | enum ieee80211_sta_state new_state); |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 598 | |
Johannes Berg | 8f727ef | 2012-03-30 08:43:32 +0200 | [diff] [blame] | 599 | static inline void drv_sta_rc_update(struct ieee80211_local *local, |
| 600 | struct ieee80211_sub_if_data *sdata, |
| 601 | struct ieee80211_sta *sta, u32 changed) |
| 602 | { |
| 603 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 604 | if (!check_sdata_in_driver(sdata)) |
| 605 | return; |
Johannes Berg | 8f727ef | 2012-03-30 08:43:32 +0200 | [diff] [blame] | 606 | |
Antonio Quartulli | e687f61 | 2012-08-12 18:24:55 +0200 | [diff] [blame] | 607 | WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED && |
Thomas Pedersen | f68d776 | 2013-01-23 12:18:13 -0800 | [diff] [blame] | 608 | (sdata->vif.type != NL80211_IFTYPE_ADHOC && |
| 609 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT)); |
Antonio Quartulli | e687f61 | 2012-08-12 18:24:55 +0200 | [diff] [blame] | 610 | |
Johannes Berg | 8f727ef | 2012-03-30 08:43:32 +0200 | [diff] [blame] | 611 | trace_drv_sta_rc_update(local, sdata, sta, changed); |
| 612 | if (local->ops->sta_rc_update) |
| 613 | local->ops->sta_rc_update(&local->hw, &sdata->vif, |
| 614 | sta, changed); |
| 615 | |
| 616 | trace_drv_return_void(local); |
| 617 | } |
| 618 | |
Johannes Berg | f815e2b | 2014-11-19 00:10:42 +0100 | [diff] [blame] | 619 | static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local, |
| 620 | struct ieee80211_sub_if_data *sdata, |
| 621 | struct ieee80211_sta *sta) |
| 622 | { |
| 623 | sdata = get_bss_sdata(sdata); |
| 624 | if (!check_sdata_in_driver(sdata)) |
| 625 | return; |
| 626 | |
| 627 | trace_drv_sta_rate_tbl_update(local, sdata, sta); |
| 628 | if (local->ops->sta_rate_tbl_update) |
| 629 | local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta); |
| 630 | |
| 631 | trace_drv_return_void(local); |
| 632 | } |
| 633 | |
Johannes Berg | 2b9a7e1 | 2014-11-17 11:35:23 +0100 | [diff] [blame] | 634 | static inline void drv_sta_statistics(struct ieee80211_local *local, |
| 635 | struct ieee80211_sub_if_data *sdata, |
| 636 | struct ieee80211_sta *sta, |
| 637 | struct station_info *sinfo) |
| 638 | { |
| 639 | sdata = get_bss_sdata(sdata); |
| 640 | if (!check_sdata_in_driver(sdata)) |
| 641 | return; |
| 642 | |
| 643 | trace_drv_sta_statistics(local, sdata, sta); |
| 644 | if (local->ops->sta_statistics) |
| 645 | local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo); |
| 646 | trace_drv_return_void(local); |
| 647 | } |
| 648 | |
Denys Vlasenko | b23dcd4 | 2015-09-18 15:19:34 +0200 | [diff] [blame^] | 649 | int drv_conf_tx(struct ieee80211_local *local, |
| 650 | struct ieee80211_sub_if_data *sdata, u16 ac, |
| 651 | const struct ieee80211_tx_queue_params *params); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 652 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 653 | static inline u64 drv_get_tsf(struct ieee80211_local *local, |
| 654 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 655 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 656 | u64 ret = -1ULL; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 657 | |
| 658 | might_sleep(); |
| 659 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 660 | if (!check_sdata_in_driver(sdata)) |
| 661 | return ret; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 662 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 663 | trace_drv_get_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 664 | if (local->ops->get_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 665 | ret = local->ops->get_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 666 | trace_drv_return_u64(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 667 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 668 | } |
| 669 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 670 | static inline void drv_set_tsf(struct ieee80211_local *local, |
| 671 | struct ieee80211_sub_if_data *sdata, |
| 672 | u64 tsf) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 673 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 674 | might_sleep(); |
| 675 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 676 | if (!check_sdata_in_driver(sdata)) |
| 677 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 678 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 679 | trace_drv_set_tsf(local, sdata, tsf); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 680 | if (local->ops->set_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 681 | local->ops->set_tsf(&local->hw, &sdata->vif, tsf); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 682 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 683 | } |
| 684 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 685 | static inline void drv_reset_tsf(struct ieee80211_local *local, |
| 686 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 687 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 688 | might_sleep(); |
| 689 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 690 | if (!check_sdata_in_driver(sdata)) |
| 691 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 692 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 693 | trace_drv_reset_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 694 | if (local->ops->reset_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 695 | local->ops->reset_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 696 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) |
| 700 | { |
Masanari Iida | 02582e9 | 2012-08-22 19:11:26 +0900 | [diff] [blame] | 701 | int ret = 0; /* default unsupported op for less congestion */ |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 702 | |
| 703 | might_sleep(); |
| 704 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 705 | trace_drv_tx_last_beacon(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 706 | if (local->ops->tx_last_beacon) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 707 | ret = local->ops->tx_last_beacon(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 708 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 709 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | static inline int drv_ampdu_action(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 713 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 714 | enum ieee80211_ampdu_mlme_action action, |
| 715 | struct ieee80211_sta *sta, u16 tid, |
Emmanuel Grumbach | e3abc8f | 2015-08-16 11:13:22 +0300 | [diff] [blame] | 716 | u16 *ssn, u8 buf_size, bool amsdu) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 717 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 718 | int ret = -EOPNOTSUPP; |
Johannes Berg | cfcdbde | 2010-06-10 10:21:48 +0200 | [diff] [blame] | 719 | |
| 720 | might_sleep(); |
| 721 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 722 | sdata = get_bss_sdata(sdata); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 723 | if (!check_sdata_in_driver(sdata)) |
| 724 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 725 | |
Emmanuel Grumbach | e3abc8f | 2015-08-16 11:13:22 +0300 | [diff] [blame] | 726 | trace_drv_ampdu_action(local, sdata, action, sta, tid, |
| 727 | ssn, buf_size, amsdu); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 728 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 729 | if (local->ops->ampdu_action) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 730 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
Emmanuel Grumbach | e3abc8f | 2015-08-16 11:13:22 +0300 | [diff] [blame] | 731 | sta, tid, ssn, buf_size, amsdu); |
Johannes Berg | 85ad181 | 2010-06-10 10:21:49 +0200 | [diff] [blame] | 732 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 733 | trace_drv_return_int(local, ret); |
| 734 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 735 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 736 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 737 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 738 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
| 739 | struct survey_info *survey) |
| 740 | { |
| 741 | int ret = -EOPNOTSUPP; |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 742 | |
| 743 | trace_drv_get_survey(local, idx, survey); |
| 744 | |
Holger Schurig | 35dd050 | 2010-06-07 16:33:49 +0200 | [diff] [blame] | 745 | if (local->ops->get_survey) |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 746 | ret = local->ops->get_survey(&local->hw, idx, survey); |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 747 | |
| 748 | trace_drv_return_int(local, ret); |
| 749 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 750 | return ret; |
| 751 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 752 | |
| 753 | static inline void drv_rfkill_poll(struct ieee80211_local *local) |
| 754 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 755 | might_sleep(); |
| 756 | |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 757 | if (local->ops->rfkill_poll) |
| 758 | local->ops->rfkill_poll(&local->hw); |
| 759 | } |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 760 | |
Johannes Berg | 39ecc01 | 2013-02-13 12:11:00 +0100 | [diff] [blame] | 761 | static inline void drv_flush(struct ieee80211_local *local, |
Emmanuel Grumbach | 77be2c5 | 2014-03-27 11:30:29 +0200 | [diff] [blame] | 762 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 39ecc01 | 2013-02-13 12:11:00 +0100 | [diff] [blame] | 763 | u32 queues, bool drop) |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 764 | { |
Emmanuel Grumbach | 77be2c5 | 2014-03-27 11:30:29 +0200 | [diff] [blame] | 765 | struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL; |
| 766 | |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 767 | might_sleep(); |
| 768 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 769 | if (sdata && !check_sdata_in_driver(sdata)) |
| 770 | return; |
Emmanuel Grumbach | 77be2c5 | 2014-03-27 11:30:29 +0200 | [diff] [blame] | 771 | |
Johannes Berg | 39ecc01 | 2013-02-13 12:11:00 +0100 | [diff] [blame] | 772 | trace_drv_flush(local, queues, drop); |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 773 | if (local->ops->flush) |
Emmanuel Grumbach | 77be2c5 | 2014-03-27 11:30:29 +0200 | [diff] [blame] | 774 | local->ops->flush(&local->hw, vif, queues, drop); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 775 | trace_drv_return_void(local); |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 776 | } |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 777 | |
| 778 | static inline void drv_channel_switch(struct ieee80211_local *local, |
Luciano Coelho | 0f791eb4 | 2014-10-08 09:48:40 +0300 | [diff] [blame] | 779 | struct ieee80211_sub_if_data *sdata, |
| 780 | struct ieee80211_channel_switch *ch_switch) |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 781 | { |
| 782 | might_sleep(); |
| 783 | |
Luciano Coelho | 0f791eb4 | 2014-10-08 09:48:40 +0300 | [diff] [blame] | 784 | trace_drv_channel_switch(local, sdata, ch_switch); |
| 785 | local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 786 | trace_drv_return_void(local); |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 787 | } |
| 788 | |
Bruno Randolf | 15d9675 | 2010-11-10 12:50:56 +0900 | [diff] [blame] | 789 | |
| 790 | static inline int drv_set_antenna(struct ieee80211_local *local, |
| 791 | u32 tx_ant, u32 rx_ant) |
| 792 | { |
| 793 | int ret = -EOPNOTSUPP; |
| 794 | might_sleep(); |
| 795 | if (local->ops->set_antenna) |
| 796 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); |
| 797 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); |
| 798 | return ret; |
| 799 | } |
| 800 | |
| 801 | static inline int drv_get_antenna(struct ieee80211_local *local, |
| 802 | u32 *tx_ant, u32 *rx_ant) |
| 803 | { |
| 804 | int ret = -EOPNOTSUPP; |
| 805 | might_sleep(); |
| 806 | if (local->ops->get_antenna) |
| 807 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); |
| 808 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); |
| 809 | return ret; |
| 810 | } |
| 811 | |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 812 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
Eliad Peller | 4988456 | 2012-11-19 17:05:09 +0200 | [diff] [blame] | 813 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 814 | struct ieee80211_channel *chan, |
Ilan Peer | d339d5c | 2013-02-12 09:34:13 +0200 | [diff] [blame] | 815 | unsigned int duration, |
| 816 | enum ieee80211_roc_type type) |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 817 | { |
| 818 | int ret; |
| 819 | |
| 820 | might_sleep(); |
| 821 | |
Ilan Peer | d339d5c | 2013-02-12 09:34:13 +0200 | [diff] [blame] | 822 | trace_drv_remain_on_channel(local, sdata, chan, duration, type); |
Eliad Peller | 4988456 | 2012-11-19 17:05:09 +0200 | [diff] [blame] | 823 | ret = local->ops->remain_on_channel(&local->hw, &sdata->vif, |
Ilan Peer | d339d5c | 2013-02-12 09:34:13 +0200 | [diff] [blame] | 824 | chan, duration, type); |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 825 | trace_drv_return_int(local, ret); |
| 826 | |
| 827 | return ret; |
| 828 | } |
| 829 | |
| 830 | static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) |
| 831 | { |
| 832 | int ret; |
| 833 | |
| 834 | might_sleep(); |
| 835 | |
| 836 | trace_drv_cancel_remain_on_channel(local); |
| 837 | ret = local->ops->cancel_remain_on_channel(&local->hw); |
| 838 | trace_drv_return_int(local, ret); |
| 839 | |
| 840 | return ret; |
| 841 | } |
| 842 | |
John W. Linville | 38c0915 | 2011-03-07 16:19:18 -0500 | [diff] [blame] | 843 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
| 844 | u32 tx, u32 rx) |
| 845 | { |
| 846 | int ret = -ENOTSUPP; |
| 847 | |
| 848 | might_sleep(); |
| 849 | |
| 850 | trace_drv_set_ringparam(local, tx, rx); |
| 851 | if (local->ops->set_ringparam) |
| 852 | ret = local->ops->set_ringparam(&local->hw, tx, rx); |
| 853 | trace_drv_return_int(local, ret); |
| 854 | |
| 855 | return ret; |
| 856 | } |
| 857 | |
| 858 | static inline void drv_get_ringparam(struct ieee80211_local *local, |
| 859 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) |
| 860 | { |
| 861 | might_sleep(); |
| 862 | |
| 863 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); |
| 864 | if (local->ops->get_ringparam) |
| 865 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); |
| 866 | trace_drv_return_void(local); |
| 867 | } |
| 868 | |
Vivek Natarajan | e8306f9 | 2011-04-06 11:41:10 +0530 | [diff] [blame] | 869 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
| 870 | { |
| 871 | bool ret = false; |
| 872 | |
| 873 | might_sleep(); |
| 874 | |
| 875 | trace_drv_tx_frames_pending(local); |
| 876 | if (local->ops->tx_frames_pending) |
| 877 | ret = local->ops->tx_frames_pending(&local->hw); |
| 878 | trace_drv_return_bool(local, ret); |
| 879 | |
| 880 | return ret; |
| 881 | } |
Sujith Manoharan | bdbfd6b | 2011-04-27 16:56:51 +0530 | [diff] [blame] | 882 | |
| 883 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, |
| 884 | struct ieee80211_sub_if_data *sdata, |
| 885 | const struct cfg80211_bitrate_mask *mask) |
| 886 | { |
| 887 | int ret = -EOPNOTSUPP; |
| 888 | |
| 889 | might_sleep(); |
| 890 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 891 | if (!check_sdata_in_driver(sdata)) |
| 892 | return -EIO; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 893 | |
Sujith Manoharan | bdbfd6b | 2011-04-27 16:56:51 +0530 | [diff] [blame] | 894 | trace_drv_set_bitrate_mask(local, sdata, mask); |
| 895 | if (local->ops->set_bitrate_mask) |
| 896 | ret = local->ops->set_bitrate_mask(&local->hw, |
| 897 | &sdata->vif, mask); |
| 898 | trace_drv_return_int(local, ret); |
| 899 | |
| 900 | return ret; |
| 901 | } |
| 902 | |
Johannes Berg | c68f4b8 | 2011-07-05 16:35:41 +0200 | [diff] [blame] | 903 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
| 904 | struct ieee80211_sub_if_data *sdata, |
| 905 | struct cfg80211_gtk_rekey_data *data) |
| 906 | { |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 907 | if (!check_sdata_in_driver(sdata)) |
| 908 | return; |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 909 | |
Johannes Berg | c68f4b8 | 2011-07-05 16:35:41 +0200 | [diff] [blame] | 910 | trace_drv_set_rekey_data(local, sdata, data); |
| 911 | if (local->ops->set_rekey_data) |
| 912 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); |
| 913 | trace_drv_return_void(local); |
| 914 | } |
| 915 | |
Emmanuel Grumbach | a818292 | 2015-03-16 23:23:34 +0200 | [diff] [blame] | 916 | static inline void drv_event_callback(struct ieee80211_local *local, |
| 917 | struct ieee80211_sub_if_data *sdata, |
| 918 | const struct ieee80211_event *event) |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 919 | { |
Emmanuel Grumbach | a818292 | 2015-03-16 23:23:34 +0200 | [diff] [blame] | 920 | trace_drv_event_callback(local, sdata, event); |
| 921 | if (local->ops->event_callback) |
| 922 | local->ops->event_callback(&local->hw, &sdata->vif, event); |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 923 | trace_drv_return_void(local); |
| 924 | } |
Johannes Berg | 4049e09 | 2011-09-29 16:04:32 +0200 | [diff] [blame] | 925 | |
| 926 | static inline void |
| 927 | drv_release_buffered_frames(struct ieee80211_local *local, |
| 928 | struct sta_info *sta, u16 tids, int num_frames, |
| 929 | enum ieee80211_frame_release_type reason, |
| 930 | bool more_data) |
| 931 | { |
| 932 | trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, |
| 933 | reason, more_data); |
| 934 | if (local->ops->release_buffered_frames) |
| 935 | local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, |
| 936 | num_frames, reason, |
| 937 | more_data); |
| 938 | trace_drv_return_void(local); |
| 939 | } |
Johannes Berg | 40b9640 | 2011-09-29 16:04:38 +0200 | [diff] [blame] | 940 | |
| 941 | static inline void |
| 942 | drv_allow_buffered_frames(struct ieee80211_local *local, |
| 943 | struct sta_info *sta, u16 tids, int num_frames, |
| 944 | enum ieee80211_frame_release_type reason, |
| 945 | bool more_data) |
| 946 | { |
| 947 | trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, |
| 948 | reason, more_data); |
| 949 | if (local->ops->allow_buffered_frames) |
| 950 | local->ops->allow_buffered_frames(&local->hw, &sta->sta, |
| 951 | tids, num_frames, reason, |
| 952 | more_data); |
| 953 | trace_drv_return_void(local); |
| 954 | } |
Victor Goldenshtein | 66572cf | 2012-06-21 10:56:46 +0300 | [diff] [blame] | 955 | |
Johannes Berg | a1845fc | 2012-06-27 13:18:36 +0200 | [diff] [blame] | 956 | static inline void drv_mgd_prepare_tx(struct ieee80211_local *local, |
| 957 | struct ieee80211_sub_if_data *sdata) |
| 958 | { |
| 959 | might_sleep(); |
| 960 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 961 | if (!check_sdata_in_driver(sdata)) |
| 962 | return; |
Johannes Berg | a1845fc | 2012-06-27 13:18:36 +0200 | [diff] [blame] | 963 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); |
| 964 | |
| 965 | trace_drv_mgd_prepare_tx(local, sdata); |
| 966 | if (local->ops->mgd_prepare_tx) |
| 967 | local->ops->mgd_prepare_tx(&local->hw, &sdata->vif); |
| 968 | trace_drv_return_void(local); |
| 969 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 970 | |
Arik Nemtsov | ee10f2c | 2014-06-11 17:18:27 +0300 | [diff] [blame] | 971 | static inline void |
| 972 | drv_mgd_protect_tdls_discover(struct ieee80211_local *local, |
| 973 | struct ieee80211_sub_if_data *sdata) |
| 974 | { |
| 975 | might_sleep(); |
| 976 | |
| 977 | if (!check_sdata_in_driver(sdata)) |
| 978 | return; |
| 979 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); |
| 980 | |
| 981 | trace_drv_mgd_protect_tdls_discover(local, sdata); |
| 982 | if (local->ops->mgd_protect_tdls_discover) |
| 983 | local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif); |
| 984 | trace_drv_return_void(local); |
| 985 | } |
| 986 | |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 987 | static inline int drv_add_chanctx(struct ieee80211_local *local, |
| 988 | struct ieee80211_chanctx *ctx) |
| 989 | { |
| 990 | int ret = -EOPNOTSUPP; |
| 991 | |
| 992 | trace_drv_add_chanctx(local, ctx); |
| 993 | if (local->ops->add_chanctx) |
| 994 | ret = local->ops->add_chanctx(&local->hw, &ctx->conf); |
| 995 | trace_drv_return_int(local, ret); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 996 | if (!ret) |
| 997 | ctx->driver_present = true; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 998 | |
| 999 | return ret; |
| 1000 | } |
| 1001 | |
| 1002 | static inline void drv_remove_chanctx(struct ieee80211_local *local, |
| 1003 | struct ieee80211_chanctx *ctx) |
| 1004 | { |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1005 | if (WARN_ON(!ctx->driver_present)) |
| 1006 | return; |
| 1007 | |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1008 | trace_drv_remove_chanctx(local, ctx); |
| 1009 | if (local->ops->remove_chanctx) |
| 1010 | local->ops->remove_chanctx(&local->hw, &ctx->conf); |
| 1011 | trace_drv_return_void(local); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 1012 | ctx->driver_present = false; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | static inline void drv_change_chanctx(struct ieee80211_local *local, |
| 1016 | struct ieee80211_chanctx *ctx, |
| 1017 | u32 changed) |
| 1018 | { |
| 1019 | trace_drv_change_chanctx(local, ctx, changed); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 1020 | if (local->ops->change_chanctx) { |
| 1021 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1022 | local->ops->change_chanctx(&local->hw, &ctx->conf, changed); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 1023 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1024 | trace_drv_return_void(local); |
| 1025 | } |
| 1026 | |
| 1027 | static inline int drv_assign_vif_chanctx(struct ieee80211_local *local, |
| 1028 | struct ieee80211_sub_if_data *sdata, |
| 1029 | struct ieee80211_chanctx *ctx) |
| 1030 | { |
| 1031 | int ret = 0; |
| 1032 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1033 | if (!check_sdata_in_driver(sdata)) |
| 1034 | return -EIO; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1035 | |
| 1036 | trace_drv_assign_vif_chanctx(local, sdata, ctx); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 1037 | if (local->ops->assign_vif_chanctx) { |
| 1038 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1039 | ret = local->ops->assign_vif_chanctx(&local->hw, |
| 1040 | &sdata->vif, |
| 1041 | &ctx->conf); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 1042 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1043 | trace_drv_return_int(local, ret); |
| 1044 | |
| 1045 | return ret; |
| 1046 | } |
| 1047 | |
| 1048 | static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local, |
| 1049 | struct ieee80211_sub_if_data *sdata, |
| 1050 | struct ieee80211_chanctx *ctx) |
| 1051 | { |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1052 | if (!check_sdata_in_driver(sdata)) |
| 1053 | return; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1054 | |
| 1055 | trace_drv_unassign_vif_chanctx(local, sdata, ctx); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 1056 | if (local->ops->unassign_vif_chanctx) { |
| 1057 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1058 | local->ops->unassign_vif_chanctx(&local->hw, |
| 1059 | &sdata->vif, |
| 1060 | &ctx->conf); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 1061 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 1062 | trace_drv_return_void(local); |
| 1063 | } |
| 1064 | |
Luciano Coelho | 1a5f0c1 | 2014-05-23 14:33:12 +0300 | [diff] [blame] | 1065 | static inline int |
| 1066 | drv_switch_vif_chanctx(struct ieee80211_local *local, |
| 1067 | struct ieee80211_vif_chanctx_switch *vifs, |
| 1068 | int n_vifs, |
| 1069 | enum ieee80211_chanctx_switch_mode mode) |
| 1070 | { |
| 1071 | int ret = 0; |
| 1072 | int i; |
| 1073 | |
| 1074 | if (!local->ops->switch_vif_chanctx) |
| 1075 | return -EOPNOTSUPP; |
| 1076 | |
| 1077 | for (i = 0; i < n_vifs; i++) { |
| 1078 | struct ieee80211_chanctx *new_ctx = |
| 1079 | container_of(vifs[i].new_ctx, |
| 1080 | struct ieee80211_chanctx, |
| 1081 | conf); |
| 1082 | struct ieee80211_chanctx *old_ctx = |
| 1083 | container_of(vifs[i].old_ctx, |
| 1084 | struct ieee80211_chanctx, |
| 1085 | conf); |
| 1086 | |
| 1087 | WARN_ON_ONCE(!old_ctx->driver_present); |
| 1088 | WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS && |
| 1089 | new_ctx->driver_present) || |
| 1090 | (mode == CHANCTX_SWMODE_REASSIGN_VIF && |
| 1091 | !new_ctx->driver_present)); |
| 1092 | } |
| 1093 | |
| 1094 | trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode); |
| 1095 | ret = local->ops->switch_vif_chanctx(&local->hw, |
| 1096 | vifs, n_vifs, mode); |
| 1097 | trace_drv_return_int(local, ret); |
| 1098 | |
| 1099 | if (!ret && mode == CHANCTX_SWMODE_SWAP_CONTEXTS) { |
| 1100 | for (i = 0; i < n_vifs; i++) { |
| 1101 | struct ieee80211_chanctx *new_ctx = |
| 1102 | container_of(vifs[i].new_ctx, |
| 1103 | struct ieee80211_chanctx, |
| 1104 | conf); |
| 1105 | struct ieee80211_chanctx *old_ctx = |
| 1106 | container_of(vifs[i].old_ctx, |
| 1107 | struct ieee80211_chanctx, |
| 1108 | conf); |
| 1109 | |
| 1110 | new_ctx->driver_present = true; |
| 1111 | old_ctx->driver_present = false; |
| 1112 | } |
| 1113 | } |
| 1114 | |
| 1115 | return ret; |
| 1116 | } |
| 1117 | |
Johannes Berg | 1041638 | 2012-10-19 15:44:42 +0200 | [diff] [blame] | 1118 | static inline int drv_start_ap(struct ieee80211_local *local, |
| 1119 | struct ieee80211_sub_if_data *sdata) |
| 1120 | { |
| 1121 | int ret = 0; |
| 1122 | |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1123 | if (!check_sdata_in_driver(sdata)) |
| 1124 | return -EIO; |
Johannes Berg | 1041638 | 2012-10-19 15:44:42 +0200 | [diff] [blame] | 1125 | |
| 1126 | trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf); |
| 1127 | if (local->ops->start_ap) |
| 1128 | ret = local->ops->start_ap(&local->hw, &sdata->vif); |
| 1129 | trace_drv_return_int(local, ret); |
| 1130 | return ret; |
| 1131 | } |
| 1132 | |
| 1133 | static inline void drv_stop_ap(struct ieee80211_local *local, |
| 1134 | struct ieee80211_sub_if_data *sdata) |
| 1135 | { |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1136 | if (!check_sdata_in_driver(sdata)) |
| 1137 | return; |
Johannes Berg | 1041638 | 2012-10-19 15:44:42 +0200 | [diff] [blame] | 1138 | |
| 1139 | trace_drv_stop_ap(local, sdata); |
| 1140 | if (local->ops->stop_ap) |
| 1141 | local->ops->stop_ap(&local->hw, &sdata->vif); |
| 1142 | trace_drv_return_void(local); |
| 1143 | } |
| 1144 | |
Eliad Peller | cf2c92d | 2014-11-04 11:43:54 +0200 | [diff] [blame] | 1145 | static inline void |
| 1146 | drv_reconfig_complete(struct ieee80211_local *local, |
| 1147 | enum ieee80211_reconfig_type reconfig_type) |
Johannes Berg | 9214ad7 | 2012-11-06 19:18:13 +0100 | [diff] [blame] | 1148 | { |
| 1149 | might_sleep(); |
| 1150 | |
Eliad Peller | cf2c92d | 2014-11-04 11:43:54 +0200 | [diff] [blame] | 1151 | trace_drv_reconfig_complete(local, reconfig_type); |
| 1152 | if (local->ops->reconfig_complete) |
| 1153 | local->ops->reconfig_complete(&local->hw, reconfig_type); |
Johannes Berg | 9214ad7 | 2012-11-06 19:18:13 +0100 | [diff] [blame] | 1154 | trace_drv_return_void(local); |
| 1155 | } |
| 1156 | |
Yoni Divinsky | de5fad8 | 2012-05-30 11:36:39 +0300 | [diff] [blame] | 1157 | static inline void |
| 1158 | drv_set_default_unicast_key(struct ieee80211_local *local, |
| 1159 | struct ieee80211_sub_if_data *sdata, |
| 1160 | int key_idx) |
| 1161 | { |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1162 | if (!check_sdata_in_driver(sdata)) |
| 1163 | return; |
Yoni Divinsky | de5fad8 | 2012-05-30 11:36:39 +0300 | [diff] [blame] | 1164 | |
| 1165 | WARN_ON_ONCE(key_idx < -1 || key_idx > 3); |
| 1166 | |
| 1167 | trace_drv_set_default_unicast_key(local, sdata, key_idx); |
| 1168 | if (local->ops->set_default_unicast_key) |
| 1169 | local->ops->set_default_unicast_key(&local->hw, &sdata->vif, |
| 1170 | key_idx); |
| 1171 | trace_drv_return_void(local); |
| 1172 | } |
| 1173 | |
Johannes Berg | a65240c | 2013-01-14 15:14:34 +0100 | [diff] [blame] | 1174 | #if IS_ENABLED(CONFIG_IPV6) |
| 1175 | static inline void drv_ipv6_addr_change(struct ieee80211_local *local, |
| 1176 | struct ieee80211_sub_if_data *sdata, |
| 1177 | struct inet6_dev *idev) |
| 1178 | { |
| 1179 | trace_drv_ipv6_addr_change(local, sdata); |
| 1180 | if (local->ops->ipv6_addr_change) |
| 1181 | local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev); |
| 1182 | trace_drv_return_void(local); |
| 1183 | } |
| 1184 | #endif |
| 1185 | |
Simon Wunderlich | 73da7d5 | 2013-07-11 16:09:06 +0200 | [diff] [blame] | 1186 | static inline void |
| 1187 | drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata, |
| 1188 | struct cfg80211_chan_def *chandef) |
| 1189 | { |
| 1190 | struct ieee80211_local *local = sdata->local; |
| 1191 | |
| 1192 | if (local->ops->channel_switch_beacon) { |
| 1193 | trace_drv_channel_switch_beacon(local, sdata, chandef); |
| 1194 | local->ops->channel_switch_beacon(&local->hw, &sdata->vif, |
| 1195 | chandef); |
| 1196 | } |
| 1197 | } |
| 1198 | |
Luciano Coelho | 6d027bc | 2014-10-08 09:48:37 +0300 | [diff] [blame] | 1199 | static inline int |
| 1200 | drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata, |
| 1201 | struct ieee80211_channel_switch *ch_switch) |
| 1202 | { |
| 1203 | struct ieee80211_local *local = sdata->local; |
| 1204 | int ret = 0; |
| 1205 | |
| 1206 | if (!check_sdata_in_driver(sdata)) |
| 1207 | return -EIO; |
| 1208 | |
| 1209 | trace_drv_pre_channel_switch(local, sdata, ch_switch); |
| 1210 | if (local->ops->pre_channel_switch) |
| 1211 | ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif, |
| 1212 | ch_switch); |
| 1213 | trace_drv_return_int(local, ret); |
| 1214 | return ret; |
| 1215 | } |
| 1216 | |
Luciano Coelho | f1d6558 | 2014-10-08 09:48:38 +0300 | [diff] [blame] | 1217 | static inline int |
| 1218 | drv_post_channel_switch(struct ieee80211_sub_if_data *sdata) |
| 1219 | { |
| 1220 | struct ieee80211_local *local = sdata->local; |
| 1221 | int ret = 0; |
| 1222 | |
| 1223 | if (!check_sdata_in_driver(sdata)) |
| 1224 | return -EIO; |
| 1225 | |
| 1226 | trace_drv_post_channel_switch(local, sdata); |
| 1227 | if (local->ops->post_channel_switch) |
| 1228 | ret = local->ops->post_channel_switch(&local->hw, &sdata->vif); |
| 1229 | trace_drv_return_int(local, ret); |
| 1230 | return ret; |
| 1231 | } |
| 1232 | |
Johannes Berg | 55fff50 | 2013-08-19 18:48:41 +0200 | [diff] [blame] | 1233 | static inline int drv_join_ibss(struct ieee80211_local *local, |
| 1234 | struct ieee80211_sub_if_data *sdata) |
| 1235 | { |
| 1236 | int ret = 0; |
| 1237 | |
| 1238 | might_sleep(); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1239 | if (!check_sdata_in_driver(sdata)) |
| 1240 | return -EIO; |
Johannes Berg | 55fff50 | 2013-08-19 18:48:41 +0200 | [diff] [blame] | 1241 | |
| 1242 | trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf); |
| 1243 | if (local->ops->join_ibss) |
| 1244 | ret = local->ops->join_ibss(&local->hw, &sdata->vif); |
| 1245 | trace_drv_return_int(local, ret); |
| 1246 | return ret; |
| 1247 | } |
| 1248 | |
| 1249 | static inline void drv_leave_ibss(struct ieee80211_local *local, |
| 1250 | struct ieee80211_sub_if_data *sdata) |
| 1251 | { |
| 1252 | might_sleep(); |
Johannes Berg | f6837ba8 | 2014-04-30 14:19:04 +0200 | [diff] [blame] | 1253 | if (!check_sdata_in_driver(sdata)) |
| 1254 | return; |
Johannes Berg | 55fff50 | 2013-08-19 18:48:41 +0200 | [diff] [blame] | 1255 | |
| 1256 | trace_drv_leave_ibss(local, sdata); |
| 1257 | if (local->ops->leave_ibss) |
| 1258 | local->ops->leave_ibss(&local->hw, &sdata->vif); |
| 1259 | trace_drv_return_void(local); |
| 1260 | } |
| 1261 | |
Antonio Quartulli | cca674d | 2014-05-19 21:53:20 +0200 | [diff] [blame] | 1262 | static inline u32 drv_get_expected_throughput(struct ieee80211_local *local, |
| 1263 | struct ieee80211_sta *sta) |
| 1264 | { |
| 1265 | u32 ret = 0; |
| 1266 | |
| 1267 | trace_drv_get_expected_throughput(sta); |
| 1268 | if (local->ops->get_expected_throughput) |
| 1269 | ret = local->ops->get_expected_throughput(sta); |
| 1270 | trace_drv_return_u32(local, ret); |
| 1271 | |
| 1272 | return ret; |
| 1273 | } |
| 1274 | |
Felix Fietkau | 5b3dc42 | 2014-10-26 00:32:53 +0200 | [diff] [blame] | 1275 | static inline int drv_get_txpower(struct ieee80211_local *local, |
| 1276 | struct ieee80211_sub_if_data *sdata, int *dbm) |
| 1277 | { |
| 1278 | int ret; |
| 1279 | |
| 1280 | if (!local->ops->get_txpower) |
| 1281 | return -EOPNOTSUPP; |
| 1282 | |
| 1283 | ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm); |
| 1284 | trace_drv_get_txpower(local, sdata, *dbm, ret); |
| 1285 | |
| 1286 | return ret; |
| 1287 | } |
| 1288 | |
Arik Nemtsov | a7a6bdd | 2014-11-09 18:50:19 +0200 | [diff] [blame] | 1289 | static inline int |
| 1290 | drv_tdls_channel_switch(struct ieee80211_local *local, |
| 1291 | struct ieee80211_sub_if_data *sdata, |
| 1292 | struct ieee80211_sta *sta, u8 oper_class, |
| 1293 | struct cfg80211_chan_def *chandef, |
| 1294 | struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie) |
| 1295 | { |
| 1296 | int ret; |
| 1297 | |
| 1298 | might_sleep(); |
| 1299 | if (!check_sdata_in_driver(sdata)) |
| 1300 | return -EIO; |
| 1301 | |
| 1302 | if (!local->ops->tdls_channel_switch) |
| 1303 | return -EOPNOTSUPP; |
| 1304 | |
| 1305 | trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef); |
| 1306 | ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta, |
| 1307 | oper_class, chandef, tmpl_skb, |
| 1308 | ch_sw_tm_ie); |
| 1309 | trace_drv_return_int(local, ret); |
| 1310 | return ret; |
| 1311 | } |
| 1312 | |
| 1313 | static inline void |
| 1314 | drv_tdls_cancel_channel_switch(struct ieee80211_local *local, |
| 1315 | struct ieee80211_sub_if_data *sdata, |
| 1316 | struct ieee80211_sta *sta) |
| 1317 | { |
| 1318 | might_sleep(); |
| 1319 | if (!check_sdata_in_driver(sdata)) |
| 1320 | return; |
| 1321 | |
| 1322 | if (!local->ops->tdls_cancel_channel_switch) |
| 1323 | return; |
| 1324 | |
| 1325 | trace_drv_tdls_cancel_channel_switch(local, sdata, sta); |
| 1326 | local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta); |
| 1327 | trace_drv_return_void(local); |
| 1328 | } |
| 1329 | |
Arik Nemtsov | 8a4d32f | 2014-11-09 18:50:20 +0200 | [diff] [blame] | 1330 | static inline void |
| 1331 | drv_tdls_recv_channel_switch(struct ieee80211_local *local, |
| 1332 | struct ieee80211_sub_if_data *sdata, |
| 1333 | struct ieee80211_tdls_ch_sw_params *params) |
| 1334 | { |
| 1335 | trace_drv_tdls_recv_channel_switch(local, sdata, params); |
| 1336 | if (local->ops->tdls_recv_channel_switch) |
| 1337 | local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif, |
| 1338 | params); |
| 1339 | trace_drv_return_void(local); |
| 1340 | } |
| 1341 | |
Felix Fietkau | ba8c3d6 | 2015-03-27 21:30:37 +0100 | [diff] [blame] | 1342 | static inline void drv_wake_tx_queue(struct ieee80211_local *local, |
| 1343 | struct txq_info *txq) |
| 1344 | { |
| 1345 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); |
| 1346 | |
| 1347 | if (!check_sdata_in_driver(sdata)) |
| 1348 | return; |
| 1349 | |
| 1350 | trace_drv_wake_tx_queue(local, sdata, txq); |
| 1351 | local->ops->wake_tx_queue(&local->hw, &txq->txq); |
| 1352 | } |
| 1353 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 1354 | #endif /* __MAC80211_DRIVER_OPS */ |