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 824487981SJohannes Berg static inline int drv_tx(struct ieee80211_local *local, struct sk_buff *skb) 924487981SJohannes Berg { 1024487981SJohannes Berg return 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 17ea77f12fSJohannes Berg local->started = true; 18ea77f12fSJohannes Berg smp_mb(); 19ea77f12fSJohannes Berg ret = local->ops->start(&local->hw); 200a2b8bb2SJohannes Berg trace_drv_start(local, ret); 210a2b8bb2SJohannes Berg return ret; 2224487981SJohannes Berg } 2324487981SJohannes Berg 2424487981SJohannes Berg static inline void drv_stop(struct ieee80211_local *local) 2524487981SJohannes Berg { 2624487981SJohannes Berg local->ops->stop(&local->hw); 270a2b8bb2SJohannes Berg trace_drv_stop(local); 28ea77f12fSJohannes Berg 29ea77f12fSJohannes Berg /* sync away all work on the tasklet before clearing started */ 30ea77f12fSJohannes Berg tasklet_disable(&local->tasklet); 31ea77f12fSJohannes Berg tasklet_enable(&local->tasklet); 32ea77f12fSJohannes Berg 33ea77f12fSJohannes Berg barrier(); 34ea77f12fSJohannes Berg 35ea77f12fSJohannes Berg local->started = false; 3624487981SJohannes Berg } 3724487981SJohannes Berg 3824487981SJohannes Berg static inline int drv_add_interface(struct ieee80211_local *local, 391ed32e4fSJohannes Berg struct ieee80211_vif *vif) 4024487981SJohannes Berg { 411ed32e4fSJohannes Berg int ret = local->ops->add_interface(&local->hw, vif); 421ed32e4fSJohannes Berg trace_drv_add_interface(local, vif_to_sdata(vif), ret); 430a2b8bb2SJohannes Berg return ret; 4424487981SJohannes Berg } 4524487981SJohannes Berg 4624487981SJohannes Berg static inline void drv_remove_interface(struct ieee80211_local *local, 471ed32e4fSJohannes Berg struct ieee80211_vif *vif) 4824487981SJohannes Berg { 491ed32e4fSJohannes Berg local->ops->remove_interface(&local->hw, vif); 501ed32e4fSJohannes Berg trace_drv_remove_interface(local, vif_to_sdata(vif)); 5124487981SJohannes Berg } 5224487981SJohannes Berg 5324487981SJohannes Berg static inline int drv_config(struct ieee80211_local *local, u32 changed) 5424487981SJohannes Berg { 550a2b8bb2SJohannes Berg int ret = local->ops->config(&local->hw, changed); 560a2b8bb2SJohannes Berg trace_drv_config(local, changed, ret); 570a2b8bb2SJohannes Berg return ret; 5824487981SJohannes Berg } 5924487981SJohannes Berg 6024487981SJohannes Berg static inline void drv_bss_info_changed(struct ieee80211_local *local, 6112375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 6224487981SJohannes Berg struct ieee80211_bss_conf *info, 6324487981SJohannes Berg u32 changed) 6424487981SJohannes Berg { 6524487981SJohannes Berg if (local->ops->bss_info_changed) 6612375ef9SJohannes Berg local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); 6712375ef9SJohannes Berg trace_drv_bss_info_changed(local, sdata, info, changed); 6824487981SJohannes Berg } 6924487981SJohannes Berg 703ac64beeSJohannes Berg static inline u64 drv_prepare_multicast(struct ieee80211_local *local, 7124487981SJohannes Berg int mc_count, 7224487981SJohannes Berg struct dev_addr_list *mc_list) 7324487981SJohannes Berg { 743ac64beeSJohannes Berg u64 ret = 0; 753ac64beeSJohannes Berg 763ac64beeSJohannes Berg if (local->ops->prepare_multicast) 773ac64beeSJohannes Berg ret = local->ops->prepare_multicast(&local->hw, mc_count, 783ac64beeSJohannes Berg mc_list); 793ac64beeSJohannes Berg 803ac64beeSJohannes Berg trace_drv_prepare_multicast(local, mc_count, ret); 813ac64beeSJohannes Berg 823ac64beeSJohannes Berg return ret; 833ac64beeSJohannes Berg } 843ac64beeSJohannes Berg 853ac64beeSJohannes Berg static inline void drv_configure_filter(struct ieee80211_local *local, 863ac64beeSJohannes Berg unsigned int changed_flags, 873ac64beeSJohannes Berg unsigned int *total_flags, 883ac64beeSJohannes Berg u64 multicast) 893ac64beeSJohannes Berg { 903ac64beeSJohannes Berg might_sleep(); 913ac64beeSJohannes Berg 9224487981SJohannes Berg local->ops->configure_filter(&local->hw, changed_flags, total_flags, 933ac64beeSJohannes Berg multicast); 940a2b8bb2SJohannes Berg trace_drv_configure_filter(local, changed_flags, total_flags, 953ac64beeSJohannes Berg multicast); 9624487981SJohannes Berg } 9724487981SJohannes Berg 9824487981SJohannes Berg static inline int drv_set_tim(struct ieee80211_local *local, 9924487981SJohannes Berg struct ieee80211_sta *sta, bool set) 10024487981SJohannes Berg { 1010a2b8bb2SJohannes Berg int ret = 0; 10224487981SJohannes Berg if (local->ops->set_tim) 1030a2b8bb2SJohannes Berg ret = local->ops->set_tim(&local->hw, sta, set); 1040a2b8bb2SJohannes Berg trace_drv_set_tim(local, sta, set, ret); 1050a2b8bb2SJohannes Berg return ret; 10624487981SJohannes Berg } 10724487981SJohannes Berg 10824487981SJohannes Berg static inline int drv_set_key(struct ieee80211_local *local, 10912375ef9SJohannes Berg enum set_key_cmd cmd, 11012375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 11124487981SJohannes Berg struct ieee80211_sta *sta, 11224487981SJohannes Berg struct ieee80211_key_conf *key) 11324487981SJohannes Berg { 11412375ef9SJohannes Berg int ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); 11512375ef9SJohannes Berg trace_drv_set_key(local, cmd, sdata, sta, key, ret); 1160a2b8bb2SJohannes Berg return ret; 11724487981SJohannes Berg } 11824487981SJohannes Berg 11924487981SJohannes Berg static inline void drv_update_tkip_key(struct ieee80211_local *local, 12024487981SJohannes Berg struct ieee80211_key_conf *conf, 12124487981SJohannes Berg const u8 *address, u32 iv32, 12224487981SJohannes Berg u16 *phase1key) 12324487981SJohannes Berg { 12424487981SJohannes Berg if (local->ops->update_tkip_key) 12524487981SJohannes Berg local->ops->update_tkip_key(&local->hw, conf, address, 12624487981SJohannes Berg iv32, phase1key); 1270a2b8bb2SJohannes Berg trace_drv_update_tkip_key(local, conf, address, iv32); 12824487981SJohannes Berg } 12924487981SJohannes Berg 13024487981SJohannes Berg static inline int drv_hw_scan(struct ieee80211_local *local, 13124487981SJohannes Berg struct cfg80211_scan_request *req) 13224487981SJohannes Berg { 1330a2b8bb2SJohannes Berg int ret = local->ops->hw_scan(&local->hw, req); 1340a2b8bb2SJohannes Berg trace_drv_hw_scan(local, req, ret); 1350a2b8bb2SJohannes Berg return ret; 13624487981SJohannes Berg } 13724487981SJohannes Berg 13824487981SJohannes Berg static inline void drv_sw_scan_start(struct ieee80211_local *local) 13924487981SJohannes Berg { 14024487981SJohannes Berg if (local->ops->sw_scan_start) 14124487981SJohannes Berg local->ops->sw_scan_start(&local->hw); 1420a2b8bb2SJohannes Berg trace_drv_sw_scan_start(local); 14324487981SJohannes Berg } 14424487981SJohannes Berg 14524487981SJohannes Berg static inline void drv_sw_scan_complete(struct ieee80211_local *local) 14624487981SJohannes Berg { 14724487981SJohannes Berg if (local->ops->sw_scan_complete) 14824487981SJohannes Berg local->ops->sw_scan_complete(&local->hw); 1490a2b8bb2SJohannes Berg trace_drv_sw_scan_complete(local); 15024487981SJohannes Berg } 15124487981SJohannes Berg 15224487981SJohannes Berg static inline int drv_get_stats(struct ieee80211_local *local, 15324487981SJohannes Berg struct ieee80211_low_level_stats *stats) 15424487981SJohannes Berg { 1550a2b8bb2SJohannes Berg int ret = -EOPNOTSUPP; 1560a2b8bb2SJohannes Berg 1570a2b8bb2SJohannes Berg if (local->ops->get_stats) 1580a2b8bb2SJohannes Berg ret = local->ops->get_stats(&local->hw, stats); 1590a2b8bb2SJohannes Berg trace_drv_get_stats(local, stats, ret); 1600a2b8bb2SJohannes Berg 1610a2b8bb2SJohannes Berg return ret; 16224487981SJohannes Berg } 16324487981SJohannes Berg 16424487981SJohannes Berg static inline void drv_get_tkip_seq(struct ieee80211_local *local, 16524487981SJohannes Berg u8 hw_key_idx, u32 *iv32, u16 *iv16) 16624487981SJohannes Berg { 16724487981SJohannes Berg if (local->ops->get_tkip_seq) 16824487981SJohannes Berg local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); 1690a2b8bb2SJohannes Berg trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); 17024487981SJohannes Berg } 17124487981SJohannes Berg 17224487981SJohannes Berg static inline int drv_set_rts_threshold(struct ieee80211_local *local, 17324487981SJohannes Berg u32 value) 17424487981SJohannes Berg { 1750a2b8bb2SJohannes Berg int ret = 0; 17624487981SJohannes Berg if (local->ops->set_rts_threshold) 1770a2b8bb2SJohannes Berg ret = local->ops->set_rts_threshold(&local->hw, value); 1780a2b8bb2SJohannes Berg trace_drv_set_rts_threshold(local, value, ret); 1790a2b8bb2SJohannes Berg return ret; 18024487981SJohannes Berg } 18124487981SJohannes Berg 18224487981SJohannes Berg static inline void drv_sta_notify(struct ieee80211_local *local, 18312375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 18424487981SJohannes Berg enum sta_notify_cmd cmd, 18524487981SJohannes Berg struct ieee80211_sta *sta) 18624487981SJohannes Berg { 18724487981SJohannes Berg if (local->ops->sta_notify) 18812375ef9SJohannes Berg local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); 18912375ef9SJohannes Berg trace_drv_sta_notify(local, sdata, cmd, sta); 19024487981SJohannes Berg } 19124487981SJohannes Berg 19224487981SJohannes Berg static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, 19324487981SJohannes Berg const struct ieee80211_tx_queue_params *params) 19424487981SJohannes Berg { 1950a2b8bb2SJohannes Berg int ret = -EOPNOTSUPP; 19624487981SJohannes Berg if (local->ops->conf_tx) 1970a2b8bb2SJohannes Berg ret = local->ops->conf_tx(&local->hw, queue, params); 1980a2b8bb2SJohannes Berg trace_drv_conf_tx(local, queue, params, ret); 1990a2b8bb2SJohannes Berg return ret; 20024487981SJohannes Berg } 20124487981SJohannes Berg 20224487981SJohannes Berg static inline int drv_get_tx_stats(struct ieee80211_local *local, 20324487981SJohannes Berg struct ieee80211_tx_queue_stats *stats) 20424487981SJohannes Berg { 2050a2b8bb2SJohannes Berg int ret = local->ops->get_tx_stats(&local->hw, stats); 2060a2b8bb2SJohannes Berg trace_drv_get_tx_stats(local, stats, ret); 2070a2b8bb2SJohannes Berg return ret; 20824487981SJohannes Berg } 20924487981SJohannes Berg 21024487981SJohannes Berg static inline u64 drv_get_tsf(struct ieee80211_local *local) 21124487981SJohannes Berg { 2120a2b8bb2SJohannes Berg u64 ret = -1ULL; 21324487981SJohannes Berg if (local->ops->get_tsf) 2140a2b8bb2SJohannes Berg ret = local->ops->get_tsf(&local->hw); 2150a2b8bb2SJohannes Berg trace_drv_get_tsf(local, ret); 2160a2b8bb2SJohannes Berg return ret; 21724487981SJohannes Berg } 21824487981SJohannes Berg 21924487981SJohannes Berg static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) 22024487981SJohannes Berg { 22124487981SJohannes Berg if (local->ops->set_tsf) 22224487981SJohannes Berg local->ops->set_tsf(&local->hw, tsf); 2230a2b8bb2SJohannes Berg trace_drv_set_tsf(local, tsf); 22424487981SJohannes Berg } 22524487981SJohannes Berg 22624487981SJohannes Berg static inline void drv_reset_tsf(struct ieee80211_local *local) 22724487981SJohannes Berg { 22824487981SJohannes Berg if (local->ops->reset_tsf) 22924487981SJohannes Berg local->ops->reset_tsf(&local->hw); 2300a2b8bb2SJohannes Berg trace_drv_reset_tsf(local); 23124487981SJohannes Berg } 23224487981SJohannes Berg 23324487981SJohannes Berg static inline int drv_tx_last_beacon(struct ieee80211_local *local) 23424487981SJohannes Berg { 2350a2b8bb2SJohannes Berg int ret = 1; 23624487981SJohannes Berg if (local->ops->tx_last_beacon) 2370a2b8bb2SJohannes Berg ret = local->ops->tx_last_beacon(&local->hw); 2380a2b8bb2SJohannes Berg trace_drv_tx_last_beacon(local, ret); 2390a2b8bb2SJohannes Berg return ret; 24024487981SJohannes Berg } 24124487981SJohannes Berg 24224487981SJohannes Berg static inline int drv_ampdu_action(struct ieee80211_local *local, 24312375ef9SJohannes Berg struct ieee80211_sub_if_data *sdata, 24424487981SJohannes Berg enum ieee80211_ampdu_mlme_action action, 24524487981SJohannes Berg struct ieee80211_sta *sta, u16 tid, 24624487981SJohannes Berg u16 *ssn) 24724487981SJohannes Berg { 2480a2b8bb2SJohannes Berg int ret = -EOPNOTSUPP; 24924487981SJohannes Berg if (local->ops->ampdu_action) 25012375ef9SJohannes Berg ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, 25124487981SJohannes Berg sta, tid, ssn); 25212375ef9SJohannes Berg trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, ret); 2530a2b8bb2SJohannes Berg return ret; 25424487981SJohannes Berg } 2551f87f7d3SJohannes Berg 2561f87f7d3SJohannes Berg 2571f87f7d3SJohannes Berg static inline void drv_rfkill_poll(struct ieee80211_local *local) 2581f87f7d3SJohannes Berg { 2591f87f7d3SJohannes Berg if (local->ops->rfkill_poll) 2601f87f7d3SJohannes Berg local->ops->rfkill_poll(&local->hw); 2611f87f7d3SJohannes Berg } 262a80f7c0bSJohannes Berg 263a80f7c0bSJohannes Berg static inline void drv_flush(struct ieee80211_local *local, bool drop) 264a80f7c0bSJohannes Berg { 265a80f7c0bSJohannes Berg trace_drv_flush(local, drop); 266a80f7c0bSJohannes Berg if (local->ops->flush) 267a80f7c0bSJohannes Berg local->ops->flush(&local->hw, drop); 268a80f7c0bSJohannes Berg } 26924487981SJohannes Berg #endif /* __MAC80211_DRIVER_OPS */ 270