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); |
Johannes Berg | ad2d223 | 2012-12-14 14:34:25 +0100 | [diff] [blame] | 215 | WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE && |
| 216 | changed & ~BSS_CHANGED_IDLE); |
Johannes Berg | b8dc1a3 | 2012-12-14 14:22:10 +0100 | [diff] [blame] | 217 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 218 | check_sdata_in_driver(sdata); |
| 219 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 220 | trace_drv_bss_info_changed(local, sdata, info, changed); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 221 | if (local->ops->bss_info_changed) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 222 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 223 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 224 | } |
| 225 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 226 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 227 | struct netdev_hw_addr_list *mc_list) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 228 | { |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 229 | u64 ret = 0; |
| 230 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 231 | trace_drv_prepare_multicast(local, mc_list->count); |
| 232 | |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 233 | if (local->ops->prepare_multicast) |
Jiri Pirko | 22bedad3 | 2010-04-01 21:22:57 +0000 | [diff] [blame] | 234 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 235 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 236 | trace_drv_return_u64(local, ret); |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 237 | |
| 238 | return ret; |
| 239 | } |
| 240 | |
| 241 | static inline void drv_configure_filter(struct ieee80211_local *local, |
| 242 | unsigned int changed_flags, |
| 243 | unsigned int *total_flags, |
| 244 | u64 multicast) |
| 245 | { |
| 246 | might_sleep(); |
| 247 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 248 | trace_drv_configure_filter(local, changed_flags, total_flags, |
Johannes Berg | 3ac64be | 2009-08-17 16:16:53 +0200 | [diff] [blame] | 249 | multicast); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 250 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
| 251 | multicast); |
| 252 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | static inline int drv_set_tim(struct ieee80211_local *local, |
| 256 | struct ieee80211_sta *sta, bool set) |
| 257 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 258 | int ret = 0; |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 259 | trace_drv_set_tim(local, sta, set); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 260 | if (local->ops->set_tim) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 261 | ret = local->ops->set_tim(&local->hw, sta, set); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 262 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 263 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | static inline int drv_set_key(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 267 | enum set_key_cmd cmd, |
| 268 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 269 | struct ieee80211_sta *sta, |
| 270 | struct ieee80211_key_conf *key) |
| 271 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 272 | int ret; |
| 273 | |
| 274 | might_sleep(); |
| 275 | |
Johannes Berg | 077f493 | 2012-01-20 13:55:18 +0100 | [diff] [blame] | 276 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 277 | check_sdata_in_driver(sdata); |
| 278 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 279 | trace_drv_set_key(local, cmd, sdata, sta, key); |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 280 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 281 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 282 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | static inline void drv_update_tkip_key(struct ieee80211_local *local, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 286 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 287 | struct ieee80211_key_conf *conf, |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 288 | struct sta_info *sta, u32 iv32, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 289 | u16 *phase1key) |
| 290 | { |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 291 | struct ieee80211_sta *ista = NULL; |
| 292 | |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 293 | if (sta) |
| 294 | ista = &sta->sta; |
| 295 | |
Johannes Berg | 077f493 | 2012-01-20 13:55:18 +0100 | [diff] [blame] | 296 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 297 | check_sdata_in_driver(sdata); |
| 298 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 299 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 300 | if (local->ops->update_tkip_key) |
Johannes Berg | b3fbdcf | 2010-01-21 11:40:47 +0100 | [diff] [blame] | 301 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
| 302 | ista, iv32, phase1key); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 303 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | static inline int drv_hw_scan(struct ieee80211_local *local, |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 307 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 308 | struct cfg80211_scan_request *req) |
| 309 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 310 | int ret; |
| 311 | |
| 312 | might_sleep(); |
| 313 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 314 | check_sdata_in_driver(sdata); |
| 315 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 316 | trace_drv_hw_scan(local, sdata); |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 317 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 318 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 319 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 320 | } |
| 321 | |
Eliad Peller | b856439 | 2011-06-13 12:47:30 +0300 | [diff] [blame] | 322 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
| 323 | struct ieee80211_sub_if_data *sdata) |
| 324 | { |
| 325 | might_sleep(); |
| 326 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 327 | check_sdata_in_driver(sdata); |
| 328 | |
Eliad Peller | b856439 | 2011-06-13 12:47:30 +0300 | [diff] [blame] | 329 | trace_drv_cancel_hw_scan(local, sdata); |
| 330 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); |
| 331 | trace_drv_return_void(local); |
| 332 | } |
| 333 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 334 | static inline int |
| 335 | drv_sched_scan_start(struct ieee80211_local *local, |
| 336 | struct ieee80211_sub_if_data *sdata, |
| 337 | struct cfg80211_sched_scan_request *req, |
| 338 | struct ieee80211_sched_scan_ies *ies) |
| 339 | { |
| 340 | int ret; |
| 341 | |
| 342 | might_sleep(); |
| 343 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 344 | check_sdata_in_driver(sdata); |
| 345 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 346 | trace_drv_sched_scan_start(local, sdata); |
| 347 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, |
| 348 | req, ies); |
| 349 | trace_drv_return_int(local, ret); |
| 350 | return ret; |
| 351 | } |
| 352 | |
| 353 | static inline void drv_sched_scan_stop(struct ieee80211_local *local, |
| 354 | struct ieee80211_sub_if_data *sdata) |
| 355 | { |
| 356 | might_sleep(); |
| 357 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 358 | check_sdata_in_driver(sdata); |
| 359 | |
Luciano Coelho | 79f460c | 2011-05-11 17:09:36 +0300 | [diff] [blame] | 360 | trace_drv_sched_scan_stop(local, sdata); |
| 361 | local->ops->sched_scan_stop(&local->hw, &sdata->vif); |
| 362 | trace_drv_return_void(local); |
| 363 | } |
| 364 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 365 | static inline void drv_sw_scan_start(struct ieee80211_local *local) |
| 366 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 367 | might_sleep(); |
| 368 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 369 | trace_drv_sw_scan_start(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 370 | if (local->ops->sw_scan_start) |
| 371 | local->ops->sw_scan_start(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 372 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) |
| 376 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 377 | might_sleep(); |
| 378 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 379 | trace_drv_sw_scan_complete(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 380 | if (local->ops->sw_scan_complete) |
| 381 | local->ops->sw_scan_complete(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 382 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | static inline int drv_get_stats(struct ieee80211_local *local, |
| 386 | struct ieee80211_low_level_stats *stats) |
| 387 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 388 | int ret = -EOPNOTSUPP; |
| 389 | |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 390 | might_sleep(); |
| 391 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 392 | if (local->ops->get_stats) |
| 393 | ret = local->ops->get_stats(&local->hw, stats); |
| 394 | trace_drv_get_stats(local, stats, ret); |
| 395 | |
| 396 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | static inline void drv_get_tkip_seq(struct ieee80211_local *local, |
| 400 | u8 hw_key_idx, u32 *iv32, u16 *iv16) |
| 401 | { |
| 402 | if (local->ops->get_tkip_seq) |
| 403 | local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 404 | trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 405 | } |
| 406 | |
Arik Nemtsov | f23a478 | 2010-11-08 11:51:06 +0200 | [diff] [blame] | 407 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
| 408 | u32 value) |
| 409 | { |
| 410 | int ret = 0; |
| 411 | |
| 412 | might_sleep(); |
| 413 | |
| 414 | trace_drv_set_frag_threshold(local, value); |
| 415 | if (local->ops->set_frag_threshold) |
| 416 | ret = local->ops->set_frag_threshold(&local->hw, value); |
| 417 | trace_drv_return_int(local, ret); |
| 418 | return ret; |
| 419 | } |
| 420 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 421 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
| 422 | u32 value) |
| 423 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 424 | int ret = 0; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 425 | |
| 426 | might_sleep(); |
| 427 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 428 | trace_drv_set_rts_threshold(local, value); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 429 | if (local->ops->set_rts_threshold) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 430 | ret = local->ops->set_rts_threshold(&local->hw, value); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 431 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 432 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 433 | } |
| 434 | |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 435 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
| 436 | u8 value) |
| 437 | { |
| 438 | int ret = 0; |
| 439 | might_sleep(); |
| 440 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 441 | trace_drv_set_coverage_class(local, value); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 442 | if (local->ops->set_coverage_class) |
| 443 | local->ops->set_coverage_class(&local->hw, value); |
| 444 | else |
| 445 | ret = -EOPNOTSUPP; |
| 446 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 447 | trace_drv_return_int(local, ret); |
Lukáš Turek | 310bc67 | 2009-12-21 22:50:48 +0100 | [diff] [blame] | 448 | return ret; |
| 449 | } |
| 450 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 451 | static inline void drv_sta_notify(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 452 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 453 | enum sta_notify_cmd cmd, |
| 454 | struct ieee80211_sta *sta) |
| 455 | { |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 456 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 457 | check_sdata_in_driver(sdata); |
| 458 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 459 | trace_drv_sta_notify(local, sdata, cmd, sta); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 460 | if (local->ops->sta_notify) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 461 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 462 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 463 | } |
| 464 | |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 465 | static inline int drv_sta_add(struct ieee80211_local *local, |
| 466 | struct ieee80211_sub_if_data *sdata, |
| 467 | struct ieee80211_sta *sta) |
| 468 | { |
| 469 | int ret = 0; |
| 470 | |
| 471 | might_sleep(); |
| 472 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 473 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 474 | check_sdata_in_driver(sdata); |
| 475 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 476 | trace_drv_sta_add(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 477 | if (local->ops->sta_add) |
| 478 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 479 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 480 | trace_drv_return_int(local, ret); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 481 | |
| 482 | return ret; |
| 483 | } |
| 484 | |
| 485 | static inline void drv_sta_remove(struct ieee80211_local *local, |
| 486 | struct ieee80211_sub_if_data *sdata, |
| 487 | struct ieee80211_sta *sta) |
| 488 | { |
| 489 | might_sleep(); |
| 490 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 491 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 492 | check_sdata_in_driver(sdata); |
| 493 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 494 | trace_drv_sta_remove(local, sdata, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 495 | if (local->ops->sta_remove) |
| 496 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 497 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 498 | trace_drv_return_void(local); |
Johannes Berg | 34e8950 | 2010-02-03 13:59:58 +0100 | [diff] [blame] | 499 | } |
| 500 | |
Sujith Manoharan | 77d2ece6 | 2012-11-20 08:46:02 +0530 | [diff] [blame] | 501 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 502 | static inline void drv_sta_add_debugfs(struct ieee80211_local *local, |
| 503 | struct ieee80211_sub_if_data *sdata, |
| 504 | struct ieee80211_sta *sta, |
| 505 | struct dentry *dir) |
| 506 | { |
| 507 | might_sleep(); |
| 508 | |
| 509 | sdata = get_bss_sdata(sdata); |
| 510 | check_sdata_in_driver(sdata); |
| 511 | |
| 512 | if (local->ops->sta_add_debugfs) |
| 513 | local->ops->sta_add_debugfs(&local->hw, &sdata->vif, |
| 514 | sta, dir); |
| 515 | } |
| 516 | |
| 517 | static inline void drv_sta_remove_debugfs(struct ieee80211_local *local, |
| 518 | struct ieee80211_sub_if_data *sdata, |
| 519 | struct ieee80211_sta *sta, |
| 520 | struct dentry *dir) |
| 521 | { |
| 522 | might_sleep(); |
| 523 | |
| 524 | sdata = get_bss_sdata(sdata); |
| 525 | check_sdata_in_driver(sdata); |
| 526 | |
| 527 | if (local->ops->sta_remove_debugfs) |
| 528 | local->ops->sta_remove_debugfs(&local->hw, &sdata->vif, |
| 529 | sta, dir); |
| 530 | } |
| 531 | #endif |
| 532 | |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 533 | static inline __must_check |
| 534 | int drv_sta_state(struct ieee80211_local *local, |
| 535 | struct ieee80211_sub_if_data *sdata, |
| 536 | struct sta_info *sta, |
| 537 | enum ieee80211_sta_state old_state, |
| 538 | enum ieee80211_sta_state new_state) |
| 539 | { |
| 540 | int ret = 0; |
| 541 | |
| 542 | might_sleep(); |
| 543 | |
| 544 | sdata = get_bss_sdata(sdata); |
| 545 | check_sdata_in_driver(sdata); |
| 546 | |
| 547 | trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); |
Johannes Berg | a4ec45a | 2012-01-20 13:55:22 +0100 | [diff] [blame] | 548 | if (local->ops->sta_state) { |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 549 | ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta, |
| 550 | old_state, new_state); |
Johannes Berg | a4ec45a | 2012-01-20 13:55:22 +0100 | [diff] [blame] | 551 | } else if (old_state == IEEE80211_STA_AUTH && |
| 552 | new_state == IEEE80211_STA_ASSOC) { |
| 553 | ret = drv_sta_add(local, sdata, &sta->sta); |
| 554 | if (ret == 0) |
| 555 | sta->uploaded = true; |
| 556 | } else if (old_state == IEEE80211_STA_ASSOC && |
| 557 | new_state == IEEE80211_STA_AUTH) { |
| 558 | drv_sta_remove(local, sdata, &sta->sta); |
| 559 | } |
Johannes Berg | f09603a | 2012-01-20 13:55:21 +0100 | [diff] [blame] | 560 | trace_drv_return_int(local, ret); |
| 561 | return ret; |
| 562 | } |
| 563 | |
Johannes Berg | 8f727ef | 2012-03-30 08:43:32 +0200 | [diff] [blame] | 564 | static inline void drv_sta_rc_update(struct ieee80211_local *local, |
| 565 | struct ieee80211_sub_if_data *sdata, |
| 566 | struct ieee80211_sta *sta, u32 changed) |
| 567 | { |
| 568 | sdata = get_bss_sdata(sdata); |
| 569 | check_sdata_in_driver(sdata); |
| 570 | |
Antonio Quartulli | e687f61 | 2012-08-12 18:24:55 +0200 | [diff] [blame] | 571 | WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED && |
Thomas Pedersen | f68d776 | 2013-01-23 12:18:13 -0800 | [diff] [blame] | 572 | (sdata->vif.type != NL80211_IFTYPE_ADHOC && |
| 573 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT)); |
Antonio Quartulli | e687f61 | 2012-08-12 18:24:55 +0200 | [diff] [blame] | 574 | |
Johannes Berg | 8f727ef | 2012-03-30 08:43:32 +0200 | [diff] [blame] | 575 | trace_drv_sta_rc_update(local, sdata, sta, changed); |
| 576 | if (local->ops->sta_rc_update) |
| 577 | local->ops->sta_rc_update(&local->hw, &sdata->vif, |
| 578 | sta, changed); |
| 579 | |
| 580 | trace_drv_return_void(local); |
| 581 | } |
| 582 | |
Eliad Peller | f6f3def | 2011-09-25 20:06:54 +0300 | [diff] [blame] | 583 | static inline int drv_conf_tx(struct ieee80211_local *local, |
Johannes Berg | a3304b0 | 2012-03-28 11:04:24 +0200 | [diff] [blame] | 584 | struct ieee80211_sub_if_data *sdata, u16 ac, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 585 | const struct ieee80211_tx_queue_params *params) |
| 586 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 587 | int ret = -EOPNOTSUPP; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 588 | |
| 589 | might_sleep(); |
| 590 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 591 | check_sdata_in_driver(sdata); |
| 592 | |
Johannes Berg | a3304b0 | 2012-03-28 11:04:24 +0200 | [diff] [blame] | 593 | trace_drv_conf_tx(local, sdata, ac, params); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 594 | if (local->ops->conf_tx) |
Eliad Peller | 8a3a3c8 | 2011-10-02 10:15:52 +0200 | [diff] [blame] | 595 | ret = local->ops->conf_tx(&local->hw, &sdata->vif, |
Johannes Berg | a3304b0 | 2012-03-28 11:04:24 +0200 | [diff] [blame] | 596 | ac, params); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 597 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 598 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 599 | } |
| 600 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 601 | static inline u64 drv_get_tsf(struct ieee80211_local *local, |
| 602 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 603 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 604 | u64 ret = -1ULL; |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 605 | |
| 606 | might_sleep(); |
| 607 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 608 | check_sdata_in_driver(sdata); |
| 609 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 610 | trace_drv_get_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 611 | if (local->ops->get_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 612 | ret = local->ops->get_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 613 | trace_drv_return_u64(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 614 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 615 | } |
| 616 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 617 | static inline void drv_set_tsf(struct ieee80211_local *local, |
| 618 | struct ieee80211_sub_if_data *sdata, |
| 619 | u64 tsf) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 620 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 621 | might_sleep(); |
| 622 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 623 | check_sdata_in_driver(sdata); |
| 624 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 625 | trace_drv_set_tsf(local, sdata, tsf); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 626 | if (local->ops->set_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 627 | local->ops->set_tsf(&local->hw, &sdata->vif, tsf); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 628 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 629 | } |
| 630 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 631 | static inline void drv_reset_tsf(struct ieee80211_local *local, |
| 632 | struct ieee80211_sub_if_data *sdata) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 633 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 634 | might_sleep(); |
| 635 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 636 | check_sdata_in_driver(sdata); |
| 637 | |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 638 | trace_drv_reset_tsf(local, sdata); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 639 | if (local->ops->reset_tsf) |
Eliad Peller | 37a41b4 | 2011-09-21 14:06:11 +0300 | [diff] [blame] | 640 | local->ops->reset_tsf(&local->hw, &sdata->vif); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 641 | trace_drv_return_void(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) |
| 645 | { |
Masanari Iida | 02582e9 | 2012-08-22 19:11:26 +0900 | [diff] [blame] | 646 | int ret = 0; /* default unsupported op for less congestion */ |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 647 | |
| 648 | might_sleep(); |
| 649 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 650 | trace_drv_tx_last_beacon(local); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 651 | if (local->ops->tx_last_beacon) |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 652 | ret = local->ops->tx_last_beacon(&local->hw); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 653 | trace_drv_return_int(local, ret); |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 654 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | static inline int drv_ampdu_action(struct ieee80211_local *local, |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 658 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 659 | enum ieee80211_ampdu_mlme_action action, |
| 660 | struct ieee80211_sta *sta, u16 tid, |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 661 | u16 *ssn, u8 buf_size) |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 662 | { |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 663 | int ret = -EOPNOTSUPP; |
Johannes Berg | cfcdbde | 2010-06-10 10:21:48 +0200 | [diff] [blame] | 664 | |
| 665 | might_sleep(); |
| 666 | |
Felix Fietkau | bc192f8 | 2011-11-23 21:09:49 +0700 | [diff] [blame] | 667 | sdata = get_bss_sdata(sdata); |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 668 | check_sdata_in_driver(sdata); |
| 669 | |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 670 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 671 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 672 | if (local->ops->ampdu_action) |
Johannes Berg | 12375ef | 2009-11-25 20:30:31 +0100 | [diff] [blame] | 673 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
Johannes Berg | 0b01f03 | 2011-01-18 13:51:05 +0100 | [diff] [blame] | 674 | sta, tid, ssn, buf_size); |
Johannes Berg | 85ad181 | 2010-06-10 10:21:49 +0200 | [diff] [blame] | 675 | |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 676 | trace_drv_return_int(local, ret); |
| 677 | |
Johannes Berg | 0a2b8bb | 2009-07-07 13:46:22 +0200 | [diff] [blame] | 678 | return ret; |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 679 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 680 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 681 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
| 682 | struct survey_info *survey) |
| 683 | { |
| 684 | int ret = -EOPNOTSUPP; |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 685 | |
| 686 | trace_drv_get_survey(local, idx, survey); |
| 687 | |
Holger Schurig | 35dd050 | 2010-06-07 16:33:49 +0200 | [diff] [blame] | 688 | if (local->ops->get_survey) |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 689 | ret = local->ops->get_survey(&local->hw, idx, survey); |
John W. Linville | c466d4e | 2010-06-29 14:51:23 -0400 | [diff] [blame] | 690 | |
| 691 | trace_drv_return_int(local, ret); |
| 692 | |
Holger Schurig | 1289723 | 2010-04-19 10:23:57 +0200 | [diff] [blame] | 693 | return ret; |
| 694 | } |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 695 | |
| 696 | static inline void drv_rfkill_poll(struct ieee80211_local *local) |
| 697 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 698 | might_sleep(); |
| 699 | |
Johannes Berg | 1f87f7d | 2009-06-02 13:01:41 +0200 | [diff] [blame] | 700 | if (local->ops->rfkill_poll) |
| 701 | local->ops->rfkill_poll(&local->hw); |
| 702 | } |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 703 | |
| 704 | static inline void drv_flush(struct ieee80211_local *local, bool drop) |
| 705 | { |
Kalle Valo | e1781ed | 2009-12-23 13:15:47 +0100 | [diff] [blame] | 706 | might_sleep(); |
| 707 | |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 708 | trace_drv_flush(local, drop); |
| 709 | if (local->ops->flush) |
| 710 | local->ops->flush(&local->hw, drop); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 711 | trace_drv_return_void(local); |
Johannes Berg | a80f7c0 | 2009-12-23 13:15:32 +0100 | [diff] [blame] | 712 | } |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 713 | |
| 714 | static inline void drv_channel_switch(struct ieee80211_local *local, |
| 715 | struct ieee80211_channel_switch *ch_switch) |
| 716 | { |
| 717 | might_sleep(); |
| 718 | |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 719 | trace_drv_channel_switch(local, ch_switch); |
Johannes Berg | 4efc76b | 2010-06-10 10:56:20 +0200 | [diff] [blame] | 720 | local->ops->channel_switch(&local->hw, ch_switch); |
| 721 | trace_drv_return_void(local); |
Johannes Berg | 5ce6e43 | 2010-05-11 16:20:57 +0200 | [diff] [blame] | 722 | } |
| 723 | |
Bruno Randolf | 15d9675 | 2010-11-10 12:50:56 +0900 | [diff] [blame] | 724 | |
| 725 | static inline int drv_set_antenna(struct ieee80211_local *local, |
| 726 | u32 tx_ant, u32 rx_ant) |
| 727 | { |
| 728 | int ret = -EOPNOTSUPP; |
| 729 | might_sleep(); |
| 730 | if (local->ops->set_antenna) |
| 731 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); |
| 732 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); |
| 733 | return ret; |
| 734 | } |
| 735 | |
| 736 | static inline int drv_get_antenna(struct ieee80211_local *local, |
| 737 | u32 *tx_ant, u32 *rx_ant) |
| 738 | { |
| 739 | int ret = -EOPNOTSUPP; |
| 740 | might_sleep(); |
| 741 | if (local->ops->get_antenna) |
| 742 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); |
| 743 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); |
| 744 | return ret; |
| 745 | } |
| 746 | |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 747 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
Eliad Peller | 4988456 | 2012-11-19 17:05:09 +0200 | [diff] [blame] | 748 | struct ieee80211_sub_if_data *sdata, |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 749 | struct ieee80211_channel *chan, |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 750 | unsigned int duration) |
| 751 | { |
| 752 | int ret; |
| 753 | |
| 754 | might_sleep(); |
| 755 | |
Johannes Berg | 42d97a5 | 2012-11-08 18:31:02 +0100 | [diff] [blame] | 756 | trace_drv_remain_on_channel(local, sdata, chan, duration); |
Eliad Peller | 4988456 | 2012-11-19 17:05:09 +0200 | [diff] [blame] | 757 | ret = local->ops->remain_on_channel(&local->hw, &sdata->vif, |
Johannes Berg | 42d97a5 | 2012-11-08 18:31:02 +0100 | [diff] [blame] | 758 | chan, duration); |
Johannes Berg | 21f8358 | 2010-12-18 17:20:47 +0100 | [diff] [blame] | 759 | trace_drv_return_int(local, ret); |
| 760 | |
| 761 | return ret; |
| 762 | } |
| 763 | |
| 764 | static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) |
| 765 | { |
| 766 | int ret; |
| 767 | |
| 768 | might_sleep(); |
| 769 | |
| 770 | trace_drv_cancel_remain_on_channel(local); |
| 771 | ret = local->ops->cancel_remain_on_channel(&local->hw); |
| 772 | trace_drv_return_int(local, ret); |
| 773 | |
| 774 | return ret; |
| 775 | } |
| 776 | |
John W. Linville | 38c0915 | 2011-03-07 16:19:18 -0500 | [diff] [blame] | 777 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
| 778 | u32 tx, u32 rx) |
| 779 | { |
| 780 | int ret = -ENOTSUPP; |
| 781 | |
| 782 | might_sleep(); |
| 783 | |
| 784 | trace_drv_set_ringparam(local, tx, rx); |
| 785 | if (local->ops->set_ringparam) |
| 786 | ret = local->ops->set_ringparam(&local->hw, tx, rx); |
| 787 | trace_drv_return_int(local, ret); |
| 788 | |
| 789 | return ret; |
| 790 | } |
| 791 | |
| 792 | static inline void drv_get_ringparam(struct ieee80211_local *local, |
| 793 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) |
| 794 | { |
| 795 | might_sleep(); |
| 796 | |
| 797 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); |
| 798 | if (local->ops->get_ringparam) |
| 799 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); |
| 800 | trace_drv_return_void(local); |
| 801 | } |
| 802 | |
Vivek Natarajan | e8306f9 | 2011-04-06 11:41:10 +0530 | [diff] [blame] | 803 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
| 804 | { |
| 805 | bool ret = false; |
| 806 | |
| 807 | might_sleep(); |
| 808 | |
| 809 | trace_drv_tx_frames_pending(local); |
| 810 | if (local->ops->tx_frames_pending) |
| 811 | ret = local->ops->tx_frames_pending(&local->hw); |
| 812 | trace_drv_return_bool(local, ret); |
| 813 | |
| 814 | return ret; |
| 815 | } |
Sujith Manoharan | bdbfd6b | 2011-04-27 16:56:51 +0530 | [diff] [blame] | 816 | |
| 817 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, |
| 818 | struct ieee80211_sub_if_data *sdata, |
| 819 | const struct cfg80211_bitrate_mask *mask) |
| 820 | { |
| 821 | int ret = -EOPNOTSUPP; |
| 822 | |
| 823 | might_sleep(); |
| 824 | |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 825 | check_sdata_in_driver(sdata); |
| 826 | |
Sujith Manoharan | bdbfd6b | 2011-04-27 16:56:51 +0530 | [diff] [blame] | 827 | trace_drv_set_bitrate_mask(local, sdata, mask); |
| 828 | if (local->ops->set_bitrate_mask) |
| 829 | ret = local->ops->set_bitrate_mask(&local->hw, |
| 830 | &sdata->vif, mask); |
| 831 | trace_drv_return_int(local, ret); |
| 832 | |
| 833 | return ret; |
| 834 | } |
| 835 | |
Johannes Berg | c68f4b8 | 2011-07-05 16:35:41 +0200 | [diff] [blame] | 836 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
| 837 | struct ieee80211_sub_if_data *sdata, |
| 838 | struct cfg80211_gtk_rekey_data *data) |
| 839 | { |
Johannes Berg | 7b7eab6 | 2011-11-03 14:41:13 +0100 | [diff] [blame] | 840 | check_sdata_in_driver(sdata); |
| 841 | |
Johannes Berg | c68f4b8 | 2011-07-05 16:35:41 +0200 | [diff] [blame] | 842 | trace_drv_set_rekey_data(local, sdata, data); |
| 843 | if (local->ops->set_rekey_data) |
| 844 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); |
| 845 | trace_drv_return_void(local); |
| 846 | } |
| 847 | |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 848 | static inline void drv_rssi_callback(struct ieee80211_local *local, |
Emmanuel Grumbach | 887da91 | 2013-01-20 17:32:41 +0200 | [diff] [blame] | 849 | struct ieee80211_sub_if_data *sdata, |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 850 | const enum ieee80211_rssi_event event) |
| 851 | { |
Emmanuel Grumbach | 887da91 | 2013-01-20 17:32:41 +0200 | [diff] [blame] | 852 | trace_drv_rssi_callback(local, sdata, event); |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 853 | if (local->ops->rssi_callback) |
Emmanuel Grumbach | 887da91 | 2013-01-20 17:32:41 +0200 | [diff] [blame] | 854 | local->ops->rssi_callback(&local->hw, &sdata->vif, event); |
Meenakshi Venkataraman | 615f7b9 | 2011-07-08 08:46:22 -0700 | [diff] [blame] | 855 | trace_drv_return_void(local); |
| 856 | } |
Johannes Berg | 4049e09 | 2011-09-29 16:04:32 +0200 | [diff] [blame] | 857 | |
| 858 | static inline void |
| 859 | drv_release_buffered_frames(struct ieee80211_local *local, |
| 860 | struct sta_info *sta, u16 tids, int num_frames, |
| 861 | enum ieee80211_frame_release_type reason, |
| 862 | bool more_data) |
| 863 | { |
| 864 | trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, |
| 865 | reason, more_data); |
| 866 | if (local->ops->release_buffered_frames) |
| 867 | local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, |
| 868 | num_frames, reason, |
| 869 | more_data); |
| 870 | trace_drv_return_void(local); |
| 871 | } |
Johannes Berg | 40b9640 | 2011-09-29 16:04:38 +0200 | [diff] [blame] | 872 | |
| 873 | static inline void |
| 874 | drv_allow_buffered_frames(struct ieee80211_local *local, |
| 875 | struct sta_info *sta, u16 tids, int num_frames, |
| 876 | enum ieee80211_frame_release_type reason, |
| 877 | bool more_data) |
| 878 | { |
| 879 | trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, |
| 880 | reason, more_data); |
| 881 | if (local->ops->allow_buffered_frames) |
| 882 | local->ops->allow_buffered_frames(&local->hw, &sta->sta, |
| 883 | tids, num_frames, reason, |
| 884 | more_data); |
| 885 | trace_drv_return_void(local); |
| 886 | } |
Victor Goldenshtein | 66572cf | 2012-06-21 10:56:46 +0300 | [diff] [blame] | 887 | |
| 888 | static inline int drv_get_rssi(struct ieee80211_local *local, |
| 889 | struct ieee80211_sub_if_data *sdata, |
| 890 | struct ieee80211_sta *sta, |
| 891 | s8 *rssi_dbm) |
| 892 | { |
| 893 | int ret; |
| 894 | |
| 895 | might_sleep(); |
| 896 | |
| 897 | ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm); |
| 898 | trace_drv_get_rssi(local, sta, *rssi_dbm, ret); |
| 899 | |
| 900 | return ret; |
| 901 | } |
Johannes Berg | a1845fc | 2012-06-27 13:18:36 +0200 | [diff] [blame] | 902 | |
| 903 | static inline void drv_mgd_prepare_tx(struct ieee80211_local *local, |
| 904 | struct ieee80211_sub_if_data *sdata) |
| 905 | { |
| 906 | might_sleep(); |
| 907 | |
| 908 | check_sdata_in_driver(sdata); |
| 909 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); |
| 910 | |
| 911 | trace_drv_mgd_prepare_tx(local, sdata); |
| 912 | if (local->ops->mgd_prepare_tx) |
| 913 | local->ops->mgd_prepare_tx(&local->hw, &sdata->vif); |
| 914 | trace_drv_return_void(local); |
| 915 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 916 | |
| 917 | static inline int drv_add_chanctx(struct ieee80211_local *local, |
| 918 | struct ieee80211_chanctx *ctx) |
| 919 | { |
| 920 | int ret = -EOPNOTSUPP; |
| 921 | |
| 922 | trace_drv_add_chanctx(local, ctx); |
| 923 | if (local->ops->add_chanctx) |
| 924 | ret = local->ops->add_chanctx(&local->hw, &ctx->conf); |
| 925 | trace_drv_return_int(local, ret); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 926 | if (!ret) |
| 927 | ctx->driver_present = true; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 928 | |
| 929 | return ret; |
| 930 | } |
| 931 | |
| 932 | static inline void drv_remove_chanctx(struct ieee80211_local *local, |
| 933 | struct ieee80211_chanctx *ctx) |
| 934 | { |
| 935 | trace_drv_remove_chanctx(local, ctx); |
| 936 | if (local->ops->remove_chanctx) |
| 937 | local->ops->remove_chanctx(&local->hw, &ctx->conf); |
| 938 | trace_drv_return_void(local); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 939 | ctx->driver_present = false; |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 940 | } |
| 941 | |
| 942 | static inline void drv_change_chanctx(struct ieee80211_local *local, |
| 943 | struct ieee80211_chanctx *ctx, |
| 944 | u32 changed) |
| 945 | { |
| 946 | trace_drv_change_chanctx(local, ctx, changed); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 947 | if (local->ops->change_chanctx) { |
| 948 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 949 | local->ops->change_chanctx(&local->hw, &ctx->conf, changed); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 950 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 951 | trace_drv_return_void(local); |
| 952 | } |
| 953 | |
| 954 | static inline int drv_assign_vif_chanctx(struct ieee80211_local *local, |
| 955 | struct ieee80211_sub_if_data *sdata, |
| 956 | struct ieee80211_chanctx *ctx) |
| 957 | { |
| 958 | int ret = 0; |
| 959 | |
| 960 | check_sdata_in_driver(sdata); |
| 961 | |
| 962 | trace_drv_assign_vif_chanctx(local, sdata, ctx); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 963 | if (local->ops->assign_vif_chanctx) { |
| 964 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 965 | ret = local->ops->assign_vif_chanctx(&local->hw, |
| 966 | &sdata->vif, |
| 967 | &ctx->conf); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 968 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 969 | trace_drv_return_int(local, ret); |
| 970 | |
| 971 | return ret; |
| 972 | } |
| 973 | |
| 974 | static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local, |
| 975 | struct ieee80211_sub_if_data *sdata, |
| 976 | struct ieee80211_chanctx *ctx) |
| 977 | { |
| 978 | check_sdata_in_driver(sdata); |
| 979 | |
| 980 | trace_drv_unassign_vif_chanctx(local, sdata, ctx); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 981 | if (local->ops->unassign_vif_chanctx) { |
| 982 | WARN_ON_ONCE(!ctx->driver_present); |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 983 | local->ops->unassign_vif_chanctx(&local->hw, |
| 984 | &sdata->vif, |
| 985 | &ctx->conf); |
Johannes Berg | 8a61af6 | 2012-12-13 17:42:30 +0100 | [diff] [blame] | 986 | } |
Michal Kazior | c3645ea | 2012-06-26 14:37:17 +0200 | [diff] [blame] | 987 | trace_drv_return_void(local); |
| 988 | } |
| 989 | |
Johannes Berg | 1041638 | 2012-10-19 15:44:42 +0200 | [diff] [blame] | 990 | static inline int drv_start_ap(struct ieee80211_local *local, |
| 991 | struct ieee80211_sub_if_data *sdata) |
| 992 | { |
| 993 | int ret = 0; |
| 994 | |
| 995 | check_sdata_in_driver(sdata); |
| 996 | |
| 997 | trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf); |
| 998 | if (local->ops->start_ap) |
| 999 | ret = local->ops->start_ap(&local->hw, &sdata->vif); |
| 1000 | trace_drv_return_int(local, ret); |
| 1001 | return ret; |
| 1002 | } |
| 1003 | |
| 1004 | static inline void drv_stop_ap(struct ieee80211_local *local, |
| 1005 | struct ieee80211_sub_if_data *sdata) |
| 1006 | { |
| 1007 | check_sdata_in_driver(sdata); |
| 1008 | |
| 1009 | trace_drv_stop_ap(local, sdata); |
| 1010 | if (local->ops->stop_ap) |
| 1011 | local->ops->stop_ap(&local->hw, &sdata->vif); |
| 1012 | trace_drv_return_void(local); |
| 1013 | } |
| 1014 | |
Johannes Berg | 9214ad7 | 2012-11-06 19:18:13 +0100 | [diff] [blame] | 1015 | static inline void drv_restart_complete(struct ieee80211_local *local) |
| 1016 | { |
| 1017 | might_sleep(); |
| 1018 | |
| 1019 | trace_drv_restart_complete(local); |
| 1020 | if (local->ops->restart_complete) |
| 1021 | local->ops->restart_complete(&local->hw); |
| 1022 | trace_drv_return_void(local); |
| 1023 | } |
| 1024 | |
Yoni Divinsky | de5fad8 | 2012-05-30 11:36:39 +0300 | [diff] [blame] | 1025 | static inline void |
| 1026 | drv_set_default_unicast_key(struct ieee80211_local *local, |
| 1027 | struct ieee80211_sub_if_data *sdata, |
| 1028 | int key_idx) |
| 1029 | { |
| 1030 | check_sdata_in_driver(sdata); |
| 1031 | |
| 1032 | WARN_ON_ONCE(key_idx < -1 || key_idx > 3); |
| 1033 | |
| 1034 | trace_drv_set_default_unicast_key(local, sdata, key_idx); |
| 1035 | if (local->ops->set_default_unicast_key) |
| 1036 | local->ops->set_default_unicast_key(&local->hw, &sdata->vif, |
| 1037 | key_idx); |
| 1038 | trace_drv_return_void(local); |
| 1039 | } |
| 1040 | |
Johannes Berg | a65240c | 2013-01-14 15:14:34 +0100 | [diff] [blame] | 1041 | #if IS_ENABLED(CONFIG_IPV6) |
| 1042 | static inline void drv_ipv6_addr_change(struct ieee80211_local *local, |
| 1043 | struct ieee80211_sub_if_data *sdata, |
| 1044 | struct inet6_dev *idev) |
| 1045 | { |
| 1046 | trace_drv_ipv6_addr_change(local, sdata); |
| 1047 | if (local->ops->ipv6_addr_change) |
| 1048 | local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev); |
| 1049 | trace_drv_return_void(local); |
| 1050 | } |
| 1051 | #endif |
| 1052 | |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 1053 | #endif /* __MAC80211_DRIVER_OPS */ |