124487981SJohannes Berg #ifndef __MAC80211_DRIVER_OPS 224487981SJohannes Berg #define __MAC80211_DRIVER_OPS 324487981SJohannes Berg 424487981SJohannes Berg #include <net/mac80211.h> 524487981SJohannes Berg #include "ieee80211_i.h" 60a2b8bb2SJohannes Berg #include "driver-trace.h" 724487981SJohannes Berg 87bb45683SJohannes Berg static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) 924487981SJohannes Berg { 107bb45683SJohannes Berg local->ops->tx(&local->hw, skb); 1124487981SJohannes Berg } 1224487981SJohannes Berg 1324487981SJohannes Berg static inline int drv_start(struct ieee80211_local *local) 1424487981SJohannes Berg { 15ea77f12fSJohannes Berg int ret; 16ea77f12fSJohannes Berg 17e1781ed3SKalle Valo might_sleep(); 18e1781ed3SKalle Valo 194efc76bdSJohannes Berg trace_drv_start(local); 20ea77f12fSJohannes Berg local->started = true; 21ea77f12fSJohannes Berg smp_mb(); 22ea77f12fSJohannes Berg ret = local->ops->start(&local->hw); 234efc76bdSJohannes Berg trace_drv_return_int(local, ret); 240a2b8bb2SJohannes Berg return ret; 2524487981SJohannes Berg } 2624487981SJohannes Berg 2724487981SJohannes Berg static inline void drv_stop(struct ieee80211_local *local) 2824487981SJohannes Berg { 29e1781ed3SKalle Valo might_sleep(); 30e1781ed3SKalle Valo 310a2b8bb2SJohannes Berg trace_drv_stop(local); 324efc76bdSJohannes Berg local->ops->stop(&local->hw); 334efc76bdSJohannes Berg trace_drv_return_void(local); 34ea77f12fSJohannes Berg 35ea77f12fSJohannes Berg /* sync away all work on the tasklet before clearing started */ 36ea77f12fSJohannes Berg tasklet_disable(&local->tasklet); 37ea77f12fSJohannes Berg tasklet_enable(&local->tasklet); 38ea77f12fSJohannes Berg 39ea77f12fSJohannes Berg barrier(); 40ea77f12fSJohannes Berg 41ea77f12fSJohannes Berg local->started = false; 4224487981SJohannes Berg } 4324487981SJohannes Berg 44eecc4800SJohannes Berg #ifdef CONFIG_PM 45eecc4800SJohannes Berg static inline int drv_suspend(struct ieee80211_local *local, 46eecc4800SJohannes Berg struct cfg80211_wowlan *wowlan) 47eecc4800SJohannes Berg { 48eecc4800SJohannes Berg int ret; 49eecc4800SJohannes Berg 50eecc4800SJohannes Berg might_sleep(); 51eecc4800SJohannes Berg 52eecc4800SJohannes Berg trace_drv_suspend(local); 53eecc4800SJohannes Berg ret = local->ops->suspend(&local->hw, wowlan); 54eecc4800SJohannes Berg trace_drv_return_int(local, ret); 55eecc4800SJohannes Berg return ret; 56eecc4800SJohannes Berg } 57eecc4800SJohannes Berg 58eecc4800SJohannes Berg static inline int drv_resume(struct ieee80211_local *local) 59eecc4800SJohannes Berg { 60eecc4800SJohannes Berg int ret; 61eecc4800SJohannes Berg 62eecc4800SJohannes Berg might_sleep(); 63eecc4800SJohannes Berg 64eecc4800SJohannes Berg trace_drv_resume(local); 65eecc4800SJohannes Berg ret = local->ops->resume(&local->hw); 66eecc4800SJohannes Berg trace_drv_return_int(local, ret); 67eecc4800SJohannes Berg return ret; 68eecc4800SJohannes Berg } 69eecc4800SJohannes Berg #endif 70eecc4800SJohannes Berg 7124487981SJohannes Berg static inline int drv_add_interface(struct ieee80211_local *local, 721ed32e4fSJohannes Berg struct ieee80211_vif *vif) 7324487981SJohannes Berg { 74e1781ed3SKalle Valo int ret; 75e1781ed3SKalle Valo 76e1781ed3SKalle Valo might_sleep(); 77e1781ed3SKalle Valo 784efc76bdSJohannes Berg trace_drv_add_interface(local, vif_to_sdata(vif)); 79e1781ed3SKalle Valo ret = local->ops->add_interface(&local->hw, vif); 804efc76bdSJohannes Berg trace_drv_return_int(local, ret); 810a2b8bb2SJohannes Berg return ret; 8224487981SJohannes Berg } 8324487981SJohannes Berg 8434d4bc4dSJohannes Berg static inline int drv_change_interface(struct ieee80211_local *local, 8534d4bc4dSJohannes Berg struct ieee80211_sub_if_data *sdata, 862ca27bcfSJohannes Berg enum nl80211_iftype type, bool p2p) 8734d4bc4dSJohannes Berg { 8834d4bc4dSJohannes Berg int ret; 8934d4bc4dSJohannes Berg 9034d4bc4dSJohannes Berg might_sleep(); 9134d4bc4dSJohannes Berg 922ca27bcfSJohannes Berg trace_drv_change_interface(local, sdata, type, p2p); 932ca27bcfSJohannes Berg ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); 9434d4bc4dSJohannes Berg trace_drv_return_int(local, ret); 9534d4bc4dSJohannes Berg return ret; 9634d4bc4dSJohannes Berg } 9734d4bc4dSJohannes Berg 9824487981SJohannes Berg static inline void drv_remove_interface(struct ieee80211_local *local, 991ed32e4fSJohannes Berg struct ieee80211_vif *vif) 10024487981SJohannes Berg { 101e1781ed3SKalle Valo might_sleep(); 102e1781ed3SKalle Valo 1031ed32e4fSJohannes Berg trace_drv_remove_interface(local, vif_to_sdata(vif)); 1044efc76bdSJohannes Berg local->ops->remove_interface(&local->hw, vif); 1054efc76bdSJohannes Berg trace_drv_return_void(local); 10624487981SJohannes Berg } 10724487981SJohannes Berg 10824487981SJohannes Berg static inline int drv_config(struct ieee80211_local *local, u32 changed) 10924487981SJohannes Berg { 110e1781ed3SKalle Valo int ret; 111e1781ed3SKalle Valo 112e1781ed3SKalle Valo might_sleep(); 113e1781ed3SKalle Valo 1144efc76bdSJohannes Berg trace_drv_config(local, changed); 115e1781ed3SKalle Valo ret = local->ops->config(&local->hw, changed); 1164efc76bdSJohannes Berg trace_drv_return_int(local, ret); 1170a2b8bb2SJohannes Berg return ret; 11824487981SJohannes Berg } 11924487981SJohannes Berg 12024487981SJohannes Berg static inline void drv_bss_info_changed(struct ieee80211_local *local, 12112375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 12224487981SJohannes Berg struct ieee80211_bss_conf *info, 12324487981SJohannes Berg u32 changed) 12424487981SJohannes Berg { 125e1781ed3SKalle Valo might_sleep(); 126e1781ed3SKalle Valo 1274efc76bdSJohannes Berg trace_drv_bss_info_changed(local, sdata, info, changed); 12824487981SJohannes Berg if (local->ops->bss_info_changed) 12912375ef9SJohannes Berg local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); 1304efc76bdSJohannes Berg trace_drv_return_void(local); 13124487981SJohannes Berg } 13224487981SJohannes Berg 133b2abb6e2SJohannes Berg static inline int drv_tx_sync(struct ieee80211_local *local, 134b2abb6e2SJohannes Berg struct ieee80211_sub_if_data *sdata, 135b2abb6e2SJohannes Berg const u8 *bssid, 136b2abb6e2SJohannes Berg enum ieee80211_tx_sync_type type) 137b2abb6e2SJohannes Berg { 138b2abb6e2SJohannes Berg int ret = 0; 139b2abb6e2SJohannes Berg 140b2abb6e2SJohannes Berg might_sleep(); 141b2abb6e2SJohannes Berg 142b2abb6e2SJohannes Berg trace_drv_tx_sync(local, sdata, bssid, type); 143b2abb6e2SJohannes Berg if (local->ops->tx_sync) 144b2abb6e2SJohannes Berg ret = local->ops->tx_sync(&local->hw, &sdata->vif, 145b2abb6e2SJohannes Berg bssid, type); 146b2abb6e2SJohannes Berg trace_drv_return_int(local, ret); 147b2abb6e2SJohannes Berg return ret; 148b2abb6e2SJohannes Berg } 149b2abb6e2SJohannes Berg 150b2abb6e2SJohannes Berg static inline void drv_finish_tx_sync(struct ieee80211_local *local, 151b2abb6e2SJohannes Berg struct ieee80211_sub_if_data *sdata, 152b2abb6e2SJohannes Berg const u8 *bssid, 153b2abb6e2SJohannes Berg enum ieee80211_tx_sync_type type) 154b2abb6e2SJohannes Berg { 155b2abb6e2SJohannes Berg might_sleep(); 156b2abb6e2SJohannes Berg 157b2abb6e2SJohannes Berg trace_drv_finish_tx_sync(local, sdata, bssid, type); 158b2abb6e2SJohannes Berg if (local->ops->finish_tx_sync) 159b2abb6e2SJohannes Berg local->ops->finish_tx_sync(&local->hw, &sdata->vif, 160b2abb6e2SJohannes Berg bssid, type); 161b2abb6e2SJohannes Berg trace_drv_return_void(local); 162b2abb6e2SJohannes Berg } 163b2abb6e2SJohannes Berg 1643ac64beeSJohannes Berg static inline u64 drv_prepare_multicast(struct ieee80211_local *local, 16522bedad3SJiri Pirko struct netdev_hw_addr_list *mc_list) 16624487981SJohannes Berg { 1673ac64beeSJohannes Berg u64 ret = 0; 1683ac64beeSJohannes Berg 1694efc76bdSJohannes Berg trace_drv_prepare_multicast(local, mc_list->count); 1704efc76bdSJohannes Berg 1713ac64beeSJohannes Berg if (local->ops->prepare_multicast) 17222bedad3SJiri Pirko ret = local->ops->prepare_multicast(&local->hw, mc_list); 1733ac64beeSJohannes Berg 1744efc76bdSJohannes Berg trace_drv_return_u64(local, ret); 1753ac64beeSJohannes Berg 1763ac64beeSJohannes Berg return ret; 1773ac64beeSJohannes Berg } 1783ac64beeSJohannes Berg 1793ac64beeSJohannes Berg static inline void drv_configure_filter(struct ieee80211_local *local, 1803ac64beeSJohannes Berg unsigned int changed_flags, 1813ac64beeSJohannes Berg unsigned int *total_flags, 1823ac64beeSJohannes Berg u64 multicast) 1833ac64beeSJohannes Berg { 1843ac64beeSJohannes Berg might_sleep(); 1853ac64beeSJohannes Berg 1860a2b8bb2SJohannes Berg trace_drv_configure_filter(local, changed_flags, total_flags, 1873ac64beeSJohannes Berg multicast); 1884efc76bdSJohannes Berg local->ops->configure_filter(&local->hw, changed_flags, total_flags, 1894efc76bdSJohannes Berg multicast); 1904efc76bdSJohannes Berg trace_drv_return_void(local); 19124487981SJohannes Berg } 19224487981SJohannes Berg 19324487981SJohannes Berg static inline int drv_set_tim(struct ieee80211_local *local, 19424487981SJohannes Berg struct ieee80211_sta *sta, bool set) 19524487981SJohannes Berg { 1960a2b8bb2SJohannes Berg int ret = 0; 1974efc76bdSJohannes Berg trace_drv_set_tim(local, sta, set); 19824487981SJohannes Berg if (local->ops->set_tim) 1990a2b8bb2SJohannes Berg ret = local->ops->set_tim(&local->hw, sta, set); 2004efc76bdSJohannes Berg trace_drv_return_int(local, ret); 2010a2b8bb2SJohannes Berg return ret; 20224487981SJohannes Berg } 20324487981SJohannes Berg 20424487981SJohannes Berg static inline int drv_set_key(struct ieee80211_local *local, 20512375ef9SJohannes Berg enum set_key_cmd cmd, 20612375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 20724487981SJohannes Berg struct ieee80211_sta *sta, 20824487981SJohannes Berg struct ieee80211_key_conf *key) 20924487981SJohannes Berg { 210e1781ed3SKalle Valo int ret; 211e1781ed3SKalle Valo 212e1781ed3SKalle Valo might_sleep(); 213e1781ed3SKalle Valo 2144efc76bdSJohannes Berg trace_drv_set_key(local, cmd, sdata, sta, key); 215e1781ed3SKalle Valo ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); 2164efc76bdSJohannes Berg trace_drv_return_int(local, ret); 2170a2b8bb2SJohannes Berg return ret; 21824487981SJohannes Berg } 21924487981SJohannes Berg 22024487981SJohannes Berg static inline void drv_update_tkip_key(struct ieee80211_local *local, 221b3fbdcf4SJohannes Berg struct ieee80211_sub_if_data *sdata, 22224487981SJohannes Berg struct ieee80211_key_conf *conf, 223b3fbdcf4SJohannes Berg struct sta_info *sta, u32 iv32, 22424487981SJohannes Berg u16 *phase1key) 22524487981SJohannes Berg { 226b3fbdcf4SJohannes Berg struct ieee80211_sta *ista = NULL; 227b3fbdcf4SJohannes Berg 228b3fbdcf4SJohannes Berg if (sta) 229b3fbdcf4SJohannes Berg ista = &sta->sta; 230b3fbdcf4SJohannes Berg 2314efc76bdSJohannes Berg trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); 23224487981SJohannes Berg if (local->ops->update_tkip_key) 233b3fbdcf4SJohannes Berg local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, 234b3fbdcf4SJohannes Berg ista, iv32, phase1key); 2354efc76bdSJohannes Berg trace_drv_return_void(local); 23624487981SJohannes Berg } 23724487981SJohannes Berg 23824487981SJohannes Berg static inline int drv_hw_scan(struct ieee80211_local *local, 239a060bbfeSJohannes Berg struct ieee80211_sub_if_data *sdata, 24024487981SJohannes Berg struct cfg80211_scan_request *req) 24124487981SJohannes Berg { 242e1781ed3SKalle Valo int ret; 243e1781ed3SKalle Valo 244e1781ed3SKalle Valo might_sleep(); 245e1781ed3SKalle Valo 24679f460caSLuciano Coelho trace_drv_hw_scan(local, sdata); 247a060bbfeSJohannes Berg ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); 2484efc76bdSJohannes Berg trace_drv_return_int(local, ret); 2490a2b8bb2SJohannes Berg return ret; 25024487981SJohannes Berg } 25124487981SJohannes Berg 252b856439bSEliad Peller static inline void drv_cancel_hw_scan(struct ieee80211_local *local, 253b856439bSEliad Peller struct ieee80211_sub_if_data *sdata) 254b856439bSEliad Peller { 255b856439bSEliad Peller might_sleep(); 256b856439bSEliad Peller 257b856439bSEliad Peller trace_drv_cancel_hw_scan(local, sdata); 258b856439bSEliad Peller local->ops->cancel_hw_scan(&local->hw, &sdata->vif); 259b856439bSEliad Peller trace_drv_return_void(local); 260b856439bSEliad Peller } 261b856439bSEliad Peller 26279f460caSLuciano Coelho static inline int 26379f460caSLuciano Coelho drv_sched_scan_start(struct ieee80211_local *local, 26479f460caSLuciano Coelho struct ieee80211_sub_if_data *sdata, 26579f460caSLuciano Coelho struct cfg80211_sched_scan_request *req, 26679f460caSLuciano Coelho struct ieee80211_sched_scan_ies *ies) 26779f460caSLuciano Coelho { 26879f460caSLuciano Coelho int ret; 26979f460caSLuciano Coelho 27079f460caSLuciano Coelho might_sleep(); 27179f460caSLuciano Coelho 27279f460caSLuciano Coelho trace_drv_sched_scan_start(local, sdata); 27379f460caSLuciano Coelho ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, 27479f460caSLuciano Coelho req, ies); 27579f460caSLuciano Coelho trace_drv_return_int(local, ret); 27679f460caSLuciano Coelho return ret; 27779f460caSLuciano Coelho } 27879f460caSLuciano Coelho 27979f460caSLuciano Coelho static inline void drv_sched_scan_stop(struct ieee80211_local *local, 28079f460caSLuciano Coelho struct ieee80211_sub_if_data *sdata) 28179f460caSLuciano Coelho { 28279f460caSLuciano Coelho might_sleep(); 28379f460caSLuciano Coelho 28479f460caSLuciano Coelho trace_drv_sched_scan_stop(local, sdata); 28579f460caSLuciano Coelho local->ops->sched_scan_stop(&local->hw, &sdata->vif); 28679f460caSLuciano Coelho trace_drv_return_void(local); 28779f460caSLuciano Coelho } 28879f460caSLuciano Coelho 28924487981SJohannes Berg static inline void drv_sw_scan_start(struct ieee80211_local *local) 29024487981SJohannes Berg { 291e1781ed3SKalle Valo might_sleep(); 292e1781ed3SKalle Valo 2934efc76bdSJohannes Berg trace_drv_sw_scan_start(local); 29424487981SJohannes Berg if (local->ops->sw_scan_start) 29524487981SJohannes Berg local->ops->sw_scan_start(&local->hw); 2964efc76bdSJohannes Berg trace_drv_return_void(local); 29724487981SJohannes Berg } 29824487981SJohannes Berg 29924487981SJohannes Berg static inline void drv_sw_scan_complete(struct ieee80211_local *local) 30024487981SJohannes Berg { 301e1781ed3SKalle Valo might_sleep(); 302e1781ed3SKalle Valo 3034efc76bdSJohannes Berg trace_drv_sw_scan_complete(local); 30424487981SJohannes Berg if (local->ops->sw_scan_complete) 30524487981SJohannes Berg local->ops->sw_scan_complete(&local->hw); 3064efc76bdSJohannes Berg trace_drv_return_void(local); 30724487981SJohannes Berg } 30824487981SJohannes Berg 30924487981SJohannes Berg static inline int drv_get_stats(struct ieee80211_local *local, 31024487981SJohannes Berg struct ieee80211_low_level_stats *stats) 31124487981SJohannes Berg { 3120a2b8bb2SJohannes Berg int ret = -EOPNOTSUPP; 3130a2b8bb2SJohannes Berg 314e1781ed3SKalle Valo might_sleep(); 315e1781ed3SKalle Valo 3160a2b8bb2SJohannes Berg if (local->ops->get_stats) 3170a2b8bb2SJohannes Berg ret = local->ops->get_stats(&local->hw, stats); 3180a2b8bb2SJohannes Berg trace_drv_get_stats(local, stats, ret); 3190a2b8bb2SJohannes Berg 3200a2b8bb2SJohannes Berg return ret; 32124487981SJohannes Berg } 32224487981SJohannes Berg 32324487981SJohannes Berg static inline void drv_get_tkip_seq(struct ieee80211_local *local, 32424487981SJohannes Berg u8 hw_key_idx, u32 *iv32, u16 *iv16) 32524487981SJohannes Berg { 32624487981SJohannes Berg if (local->ops->get_tkip_seq) 32724487981SJohannes Berg local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); 3280a2b8bb2SJohannes Berg trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); 32924487981SJohannes Berg } 33024487981SJohannes Berg 331f23a4780SArik Nemtsov static inline int drv_set_frag_threshold(struct ieee80211_local *local, 332f23a4780SArik Nemtsov u32 value) 333f23a4780SArik Nemtsov { 334f23a4780SArik Nemtsov int ret = 0; 335f23a4780SArik Nemtsov 336f23a4780SArik Nemtsov might_sleep(); 337f23a4780SArik Nemtsov 338f23a4780SArik Nemtsov trace_drv_set_frag_threshold(local, value); 339f23a4780SArik Nemtsov if (local->ops->set_frag_threshold) 340f23a4780SArik Nemtsov ret = local->ops->set_frag_threshold(&local->hw, value); 341f23a4780SArik Nemtsov trace_drv_return_int(local, ret); 342f23a4780SArik Nemtsov return ret; 343f23a4780SArik Nemtsov } 344f23a4780SArik Nemtsov 34524487981SJohannes Berg static inline int drv_set_rts_threshold(struct ieee80211_local *local, 34624487981SJohannes Berg u32 value) 34724487981SJohannes Berg { 3480a2b8bb2SJohannes Berg int ret = 0; 349e1781ed3SKalle Valo 350e1781ed3SKalle Valo might_sleep(); 351e1781ed3SKalle Valo 3524efc76bdSJohannes Berg trace_drv_set_rts_threshold(local, value); 35324487981SJohannes Berg if (local->ops->set_rts_threshold) 3540a2b8bb2SJohannes Berg ret = local->ops->set_rts_threshold(&local->hw, value); 3554efc76bdSJohannes Berg trace_drv_return_int(local, ret); 3560a2b8bb2SJohannes Berg return ret; 35724487981SJohannes Berg } 35824487981SJohannes Berg 359310bc676SLukáš Turek static inline int drv_set_coverage_class(struct ieee80211_local *local, 360310bc676SLukáš Turek u8 value) 361310bc676SLukáš Turek { 362310bc676SLukáš Turek int ret = 0; 363310bc676SLukáš Turek might_sleep(); 364310bc676SLukáš Turek 3654efc76bdSJohannes Berg trace_drv_set_coverage_class(local, value); 366310bc676SLukáš Turek if (local->ops->set_coverage_class) 367310bc676SLukáš Turek local->ops->set_coverage_class(&local->hw, value); 368310bc676SLukáš Turek else 369310bc676SLukáš Turek ret = -EOPNOTSUPP; 370310bc676SLukáš Turek 3714efc76bdSJohannes Berg trace_drv_return_int(local, ret); 372310bc676SLukáš Turek return ret; 373310bc676SLukáš Turek } 374310bc676SLukáš Turek 37524487981SJohannes Berg static inline void drv_sta_notify(struct ieee80211_local *local, 37612375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 37724487981SJohannes Berg enum sta_notify_cmd cmd, 37824487981SJohannes Berg struct ieee80211_sta *sta) 37924487981SJohannes Berg { 3804efc76bdSJohannes Berg trace_drv_sta_notify(local, sdata, cmd, sta); 38124487981SJohannes Berg if (local->ops->sta_notify) 38212375ef9SJohannes Berg local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); 3834efc76bdSJohannes Berg trace_drv_return_void(local); 38424487981SJohannes Berg } 38524487981SJohannes Berg 38634e89507SJohannes Berg static inline int drv_sta_add(struct ieee80211_local *local, 38734e89507SJohannes Berg struct ieee80211_sub_if_data *sdata, 38834e89507SJohannes Berg struct ieee80211_sta *sta) 38934e89507SJohannes Berg { 39034e89507SJohannes Berg int ret = 0; 39134e89507SJohannes Berg 39234e89507SJohannes Berg might_sleep(); 39334e89507SJohannes Berg 3944efc76bdSJohannes Berg trace_drv_sta_add(local, sdata, sta); 39534e89507SJohannes Berg if (local->ops->sta_add) 39634e89507SJohannes Berg ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); 39734e89507SJohannes Berg 3984efc76bdSJohannes Berg trace_drv_return_int(local, ret); 39934e89507SJohannes Berg 40034e89507SJohannes Berg return ret; 40134e89507SJohannes Berg } 40234e89507SJohannes Berg 40334e89507SJohannes Berg static inline void drv_sta_remove(struct ieee80211_local *local, 40434e89507SJohannes Berg struct ieee80211_sub_if_data *sdata, 40534e89507SJohannes Berg struct ieee80211_sta *sta) 40634e89507SJohannes Berg { 40734e89507SJohannes Berg might_sleep(); 40834e89507SJohannes Berg 4094efc76bdSJohannes Berg trace_drv_sta_remove(local, sdata, sta); 41034e89507SJohannes Berg if (local->ops->sta_remove) 41134e89507SJohannes Berg local->ops->sta_remove(&local->hw, &sdata->vif, sta); 41234e89507SJohannes Berg 4134efc76bdSJohannes Berg trace_drv_return_void(local); 41434e89507SJohannes Berg } 41534e89507SJohannes Berg 416f6f3def3SEliad Peller static inline int drv_conf_tx(struct ieee80211_local *local, 417f6f3def3SEliad Peller struct ieee80211_sub_if_data *sdata, u16 queue, 41824487981SJohannes Berg const struct ieee80211_tx_queue_params *params) 41924487981SJohannes Berg { 4200a2b8bb2SJohannes Berg int ret = -EOPNOTSUPP; 421e1781ed3SKalle Valo 422e1781ed3SKalle Valo might_sleep(); 423e1781ed3SKalle Valo 424f6f3def3SEliad Peller trace_drv_conf_tx(local, sdata, queue, params); 42524487981SJohannes Berg if (local->ops->conf_tx) 4260a2b8bb2SJohannes Berg ret = local->ops->conf_tx(&local->hw, queue, params); 4274efc76bdSJohannes Berg trace_drv_return_int(local, ret); 4280a2b8bb2SJohannes Berg return ret; 42924487981SJohannes Berg } 43024487981SJohannes Berg 43137a41b4aSEliad Peller static inline u64 drv_get_tsf(struct ieee80211_local *local, 43237a41b4aSEliad Peller struct ieee80211_sub_if_data *sdata) 43324487981SJohannes Berg { 4340a2b8bb2SJohannes Berg u64 ret = -1ULL; 435e1781ed3SKalle Valo 436e1781ed3SKalle Valo might_sleep(); 437e1781ed3SKalle Valo 43837a41b4aSEliad Peller trace_drv_get_tsf(local, sdata); 43924487981SJohannes Berg if (local->ops->get_tsf) 44037a41b4aSEliad Peller ret = local->ops->get_tsf(&local->hw, &sdata->vif); 4414efc76bdSJohannes Berg trace_drv_return_u64(local, ret); 4420a2b8bb2SJohannes Berg return ret; 44324487981SJohannes Berg } 44424487981SJohannes Berg 44537a41b4aSEliad Peller static inline void drv_set_tsf(struct ieee80211_local *local, 44637a41b4aSEliad Peller struct ieee80211_sub_if_data *sdata, 44737a41b4aSEliad Peller u64 tsf) 44824487981SJohannes Berg { 449e1781ed3SKalle Valo might_sleep(); 450e1781ed3SKalle Valo 45137a41b4aSEliad Peller trace_drv_set_tsf(local, sdata, tsf); 45224487981SJohannes Berg if (local->ops->set_tsf) 45337a41b4aSEliad Peller local->ops->set_tsf(&local->hw, &sdata->vif, tsf); 4544efc76bdSJohannes Berg trace_drv_return_void(local); 45524487981SJohannes Berg } 45624487981SJohannes Berg 45737a41b4aSEliad Peller static inline void drv_reset_tsf(struct ieee80211_local *local, 45837a41b4aSEliad Peller struct ieee80211_sub_if_data *sdata) 45924487981SJohannes Berg { 460e1781ed3SKalle Valo might_sleep(); 461e1781ed3SKalle Valo 46237a41b4aSEliad Peller trace_drv_reset_tsf(local, sdata); 46324487981SJohannes Berg if (local->ops->reset_tsf) 46437a41b4aSEliad Peller local->ops->reset_tsf(&local->hw, &sdata->vif); 4654efc76bdSJohannes Berg trace_drv_return_void(local); 46624487981SJohannes Berg } 46724487981SJohannes Berg 46824487981SJohannes Berg static inline int drv_tx_last_beacon(struct ieee80211_local *local) 46924487981SJohannes Berg { 47091f44b02STim Harvey int ret = 0; /* default unsuported op for less congestion */ 471e1781ed3SKalle Valo 472e1781ed3SKalle Valo might_sleep(); 473e1781ed3SKalle Valo 4744efc76bdSJohannes Berg trace_drv_tx_last_beacon(local); 47524487981SJohannes Berg if (local->ops->tx_last_beacon) 4760a2b8bb2SJohannes Berg ret = local->ops->tx_last_beacon(&local->hw); 4774efc76bdSJohannes Berg trace_drv_return_int(local, ret); 4780a2b8bb2SJohannes Berg return ret; 47924487981SJohannes Berg } 48024487981SJohannes Berg 48124487981SJohannes Berg static inline int drv_ampdu_action(struct ieee80211_local *local, 48212375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 48324487981SJohannes Berg enum ieee80211_ampdu_mlme_action action, 48424487981SJohannes Berg struct ieee80211_sta *sta, u16 tid, 4850b01f030SJohannes Berg u16 *ssn, u8 buf_size) 48624487981SJohannes Berg { 4870a2b8bb2SJohannes Berg int ret = -EOPNOTSUPP; 488cfcdbde3SJohannes Berg 489cfcdbde3SJohannes Berg might_sleep(); 490cfcdbde3SJohannes Berg 4910b01f030SJohannes Berg trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); 4924efc76bdSJohannes Berg 49324487981SJohannes Berg if (local->ops->ampdu_action) 49412375ef9SJohannes Berg ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, 4950b01f030SJohannes Berg sta, tid, ssn, buf_size); 49685ad181eSJohannes Berg 4974efc76bdSJohannes Berg trace_drv_return_int(local, ret); 4984efc76bdSJohannes Berg 4990a2b8bb2SJohannes Berg return ret; 50024487981SJohannes Berg } 5011f87f7d3SJohannes Berg 5021289723eSHolger Schurig static inline int drv_get_survey(struct ieee80211_local *local, int idx, 5031289723eSHolger Schurig struct survey_info *survey) 5041289723eSHolger Schurig { 5051289723eSHolger Schurig int ret = -EOPNOTSUPP; 506c466d4efSJohn W. Linville 507c466d4efSJohn W. Linville trace_drv_get_survey(local, idx, survey); 508c466d4efSJohn W. Linville 50935dd0509SHolger Schurig if (local->ops->get_survey) 5101289723eSHolger Schurig ret = local->ops->get_survey(&local->hw, idx, survey); 511c466d4efSJohn W. Linville 512c466d4efSJohn W. Linville trace_drv_return_int(local, ret); 513c466d4efSJohn W. Linville 5141289723eSHolger Schurig return ret; 5151289723eSHolger Schurig } 5161f87f7d3SJohannes Berg 5171f87f7d3SJohannes Berg static inline void drv_rfkill_poll(struct ieee80211_local *local) 5181f87f7d3SJohannes Berg { 519e1781ed3SKalle Valo might_sleep(); 520e1781ed3SKalle Valo 5211f87f7d3SJohannes Berg if (local->ops->rfkill_poll) 5221f87f7d3SJohannes Berg local->ops->rfkill_poll(&local->hw); 5231f87f7d3SJohannes Berg } 524a80f7c0bSJohannes Berg 525a80f7c0bSJohannes Berg static inline void drv_flush(struct ieee80211_local *local, bool drop) 526a80f7c0bSJohannes Berg { 527e1781ed3SKalle Valo might_sleep(); 528e1781ed3SKalle Valo 529a80f7c0bSJohannes Berg trace_drv_flush(local, drop); 530a80f7c0bSJohannes Berg if (local->ops->flush) 531a80f7c0bSJohannes Berg local->ops->flush(&local->hw, drop); 5324efc76bdSJohannes Berg trace_drv_return_void(local); 533a80f7c0bSJohannes Berg } 5345ce6e438SJohannes Berg 5355ce6e438SJohannes Berg static inline void drv_channel_switch(struct ieee80211_local *local, 5365ce6e438SJohannes Berg struct ieee80211_channel_switch *ch_switch) 5375ce6e438SJohannes Berg { 5385ce6e438SJohannes Berg might_sleep(); 5395ce6e438SJohannes Berg 5405ce6e438SJohannes Berg trace_drv_channel_switch(local, ch_switch); 5414efc76bdSJohannes Berg local->ops->channel_switch(&local->hw, ch_switch); 5424efc76bdSJohannes Berg trace_drv_return_void(local); 5435ce6e438SJohannes Berg } 5445ce6e438SJohannes Berg 54515d96753SBruno Randolf 54615d96753SBruno Randolf static inline int drv_set_antenna(struct ieee80211_local *local, 54715d96753SBruno Randolf u32 tx_ant, u32 rx_ant) 54815d96753SBruno Randolf { 54915d96753SBruno Randolf int ret = -EOPNOTSUPP; 55015d96753SBruno Randolf might_sleep(); 55115d96753SBruno Randolf if (local->ops->set_antenna) 55215d96753SBruno Randolf ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); 55315d96753SBruno Randolf trace_drv_set_antenna(local, tx_ant, rx_ant, ret); 55415d96753SBruno Randolf return ret; 55515d96753SBruno Randolf } 55615d96753SBruno Randolf 55715d96753SBruno Randolf static inline int drv_get_antenna(struct ieee80211_local *local, 55815d96753SBruno Randolf u32 *tx_ant, u32 *rx_ant) 55915d96753SBruno Randolf { 56015d96753SBruno Randolf int ret = -EOPNOTSUPP; 56115d96753SBruno Randolf might_sleep(); 56215d96753SBruno Randolf if (local->ops->get_antenna) 56315d96753SBruno Randolf ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); 56415d96753SBruno Randolf trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); 56515d96753SBruno Randolf return ret; 56615d96753SBruno Randolf } 56715d96753SBruno Randolf 56821f83589SJohannes Berg static inline int drv_remain_on_channel(struct ieee80211_local *local, 56921f83589SJohannes Berg struct ieee80211_channel *chan, 57021f83589SJohannes Berg enum nl80211_channel_type chantype, 57121f83589SJohannes Berg unsigned int duration) 57221f83589SJohannes Berg { 57321f83589SJohannes Berg int ret; 57421f83589SJohannes Berg 57521f83589SJohannes Berg might_sleep(); 57621f83589SJohannes Berg 57721f83589SJohannes Berg trace_drv_remain_on_channel(local, chan, chantype, duration); 57821f83589SJohannes Berg ret = local->ops->remain_on_channel(&local->hw, chan, chantype, 57921f83589SJohannes Berg duration); 58021f83589SJohannes Berg trace_drv_return_int(local, ret); 58121f83589SJohannes Berg 58221f83589SJohannes Berg return ret; 58321f83589SJohannes Berg } 58421f83589SJohannes Berg 58521f83589SJohannes Berg static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) 58621f83589SJohannes Berg { 58721f83589SJohannes Berg int ret; 58821f83589SJohannes Berg 58921f83589SJohannes Berg might_sleep(); 59021f83589SJohannes Berg 59121f83589SJohannes Berg trace_drv_cancel_remain_on_channel(local); 59221f83589SJohannes Berg ret = local->ops->cancel_remain_on_channel(&local->hw); 59321f83589SJohannes Berg trace_drv_return_int(local, ret); 59421f83589SJohannes Berg 59521f83589SJohannes Berg return ret; 59621f83589SJohannes Berg } 59721f83589SJohannes Berg 59838c09159SJohn W. Linville static inline int drv_set_ringparam(struct ieee80211_local *local, 59938c09159SJohn W. Linville u32 tx, u32 rx) 60038c09159SJohn W. Linville { 60138c09159SJohn W. Linville int ret = -ENOTSUPP; 60238c09159SJohn W. Linville 60338c09159SJohn W. Linville might_sleep(); 60438c09159SJohn W. Linville 60538c09159SJohn W. Linville trace_drv_set_ringparam(local, tx, rx); 60638c09159SJohn W. Linville if (local->ops->set_ringparam) 60738c09159SJohn W. Linville ret = local->ops->set_ringparam(&local->hw, tx, rx); 60838c09159SJohn W. Linville trace_drv_return_int(local, ret); 60938c09159SJohn W. Linville 61038c09159SJohn W. Linville return ret; 61138c09159SJohn W. Linville } 61238c09159SJohn W. Linville 61338c09159SJohn W. Linville static inline void drv_get_ringparam(struct ieee80211_local *local, 61438c09159SJohn W. Linville u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) 61538c09159SJohn W. Linville { 61638c09159SJohn W. Linville might_sleep(); 61738c09159SJohn W. Linville 61838c09159SJohn W. Linville trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); 61938c09159SJohn W. Linville if (local->ops->get_ringparam) 62038c09159SJohn W. Linville local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); 62138c09159SJohn W. Linville trace_drv_return_void(local); 62238c09159SJohn W. Linville } 62338c09159SJohn W. Linville 624e8306f98SVivek Natarajan static inline bool drv_tx_frames_pending(struct ieee80211_local *local) 625e8306f98SVivek Natarajan { 626e8306f98SVivek Natarajan bool ret = false; 627e8306f98SVivek Natarajan 628e8306f98SVivek Natarajan might_sleep(); 629e8306f98SVivek Natarajan 630e8306f98SVivek Natarajan trace_drv_tx_frames_pending(local); 631e8306f98SVivek Natarajan if (local->ops->tx_frames_pending) 632e8306f98SVivek Natarajan ret = local->ops->tx_frames_pending(&local->hw); 633e8306f98SVivek Natarajan trace_drv_return_bool(local, ret); 634e8306f98SVivek Natarajan 635e8306f98SVivek Natarajan return ret; 636e8306f98SVivek Natarajan } 637bdbfd6b5SSujith Manoharan 638bdbfd6b5SSujith Manoharan static inline int drv_set_bitrate_mask(struct ieee80211_local *local, 639bdbfd6b5SSujith Manoharan struct ieee80211_sub_if_data *sdata, 640bdbfd6b5SSujith Manoharan const struct cfg80211_bitrate_mask *mask) 641bdbfd6b5SSujith Manoharan { 642bdbfd6b5SSujith Manoharan int ret = -EOPNOTSUPP; 643bdbfd6b5SSujith Manoharan 644bdbfd6b5SSujith Manoharan might_sleep(); 645bdbfd6b5SSujith Manoharan 646bdbfd6b5SSujith Manoharan trace_drv_set_bitrate_mask(local, sdata, mask); 647bdbfd6b5SSujith Manoharan if (local->ops->set_bitrate_mask) 648bdbfd6b5SSujith Manoharan ret = local->ops->set_bitrate_mask(&local->hw, 649bdbfd6b5SSujith Manoharan &sdata->vif, mask); 650bdbfd6b5SSujith Manoharan trace_drv_return_int(local, ret); 651bdbfd6b5SSujith Manoharan 652bdbfd6b5SSujith Manoharan return ret; 653bdbfd6b5SSujith Manoharan } 654bdbfd6b5SSujith Manoharan 655c68f4b89SJohannes Berg static inline void drv_set_rekey_data(struct ieee80211_local *local, 656c68f4b89SJohannes Berg struct ieee80211_sub_if_data *sdata, 657c68f4b89SJohannes Berg struct cfg80211_gtk_rekey_data *data) 658c68f4b89SJohannes Berg { 659c68f4b89SJohannes Berg trace_drv_set_rekey_data(local, sdata, data); 660c68f4b89SJohannes Berg if (local->ops->set_rekey_data) 661c68f4b89SJohannes Berg local->ops->set_rekey_data(&local->hw, &sdata->vif, data); 662c68f4b89SJohannes Berg trace_drv_return_void(local); 663c68f4b89SJohannes Berg } 664c68f4b89SJohannes Berg 665615f7b9bSMeenakshi Venkataraman static inline void drv_rssi_callback(struct ieee80211_local *local, 666615f7b9bSMeenakshi Venkataraman const enum ieee80211_rssi_event event) 667615f7b9bSMeenakshi Venkataraman { 668615f7b9bSMeenakshi Venkataraman trace_drv_rssi_callback(local, event); 669615f7b9bSMeenakshi Venkataraman if (local->ops->rssi_callback) 670615f7b9bSMeenakshi Venkataraman local->ops->rssi_callback(&local->hw, event); 671615f7b9bSMeenakshi Venkataraman trace_drv_return_void(local); 672615f7b9bSMeenakshi Venkataraman } 67324487981SJohannes Berg #endif /* __MAC80211_DRIVER_OPS */ 674