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