18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci* Portions of this file
48c2ecf20Sopenharmony_ci* Copyright(c) 2016 Intel Deutschland GmbH
58c2ecf20Sopenharmony_ci* Copyright (C) 2018 - 2019 Intel Corporation
68c2ecf20Sopenharmony_ci*/
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __MAC80211_DRIVER_OPS
98c2ecf20Sopenharmony_ci#define __MAC80211_DRIVER_OPS
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <net/mac80211.h>
128c2ecf20Sopenharmony_ci#include "ieee80211_i.h"
138c2ecf20Sopenharmony_ci#include "trace.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define check_sdata_in_driver(sdata)	({					\
168c2ecf20Sopenharmony_ci	!WARN_ONCE(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),			\
178c2ecf20Sopenharmony_ci		   "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",	\
188c2ecf20Sopenharmony_ci		   sdata->dev ? sdata->dev->name : sdata->name, sdata->flags);	\
198c2ecf20Sopenharmony_ci})
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistatic inline struct ieee80211_sub_if_data *
228c2ecf20Sopenharmony_ciget_bss_sdata(struct ieee80211_sub_if_data *sdata)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
258c2ecf20Sopenharmony_ci		sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
268c2ecf20Sopenharmony_ci				     u.ap);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	return sdata;
298c2ecf20Sopenharmony_ci}
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistatic inline void drv_tx(struct ieee80211_local *local,
328c2ecf20Sopenharmony_ci			  struct ieee80211_tx_control *control,
338c2ecf20Sopenharmony_ci			  struct sk_buff *skb)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	local->ops->tx(&local->hw, control, skb);
368c2ecf20Sopenharmony_ci}
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic inline void drv_sync_rx_queues(struct ieee80211_local *local,
398c2ecf20Sopenharmony_ci				      struct sta_info *sta)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	if (local->ops->sync_rx_queues) {
428c2ecf20Sopenharmony_ci		trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta);
438c2ecf20Sopenharmony_ci		local->ops->sync_rx_queues(&local->hw);
448c2ecf20Sopenharmony_ci		trace_drv_return_void(local);
458c2ecf20Sopenharmony_ci	}
468c2ecf20Sopenharmony_ci}
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
498c2ecf20Sopenharmony_ci				      u32 sset, u8 *data)
508c2ecf20Sopenharmony_ci{
518c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
528c2ecf20Sopenharmony_ci	if (local->ops->get_et_strings) {
538c2ecf20Sopenharmony_ci		trace_drv_get_et_strings(local, sset);
548c2ecf20Sopenharmony_ci		local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
558c2ecf20Sopenharmony_ci		trace_drv_return_void(local);
568c2ecf20Sopenharmony_ci	}
578c2ecf20Sopenharmony_ci}
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_cistatic inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
608c2ecf20Sopenharmony_ci				    struct ethtool_stats *stats,
618c2ecf20Sopenharmony_ci				    u64 *data)
628c2ecf20Sopenharmony_ci{
638c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
648c2ecf20Sopenharmony_ci	if (local->ops->get_et_stats) {
658c2ecf20Sopenharmony_ci		trace_drv_get_et_stats(local);
668c2ecf20Sopenharmony_ci		local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
678c2ecf20Sopenharmony_ci		trace_drv_return_void(local);
688c2ecf20Sopenharmony_ci	}
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistatic inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
728c2ecf20Sopenharmony_ci					int sset)
738c2ecf20Sopenharmony_ci{
748c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
758c2ecf20Sopenharmony_ci	int rv = 0;
768c2ecf20Sopenharmony_ci	if (local->ops->get_et_sset_count) {
778c2ecf20Sopenharmony_ci		trace_drv_get_et_sset_count(local, sset);
788c2ecf20Sopenharmony_ci		rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
798c2ecf20Sopenharmony_ci						   sset);
808c2ecf20Sopenharmony_ci		trace_drv_return_int(local, rv);
818c2ecf20Sopenharmony_ci	}
828c2ecf20Sopenharmony_ci	return rv;
838c2ecf20Sopenharmony_ci}
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ciint drv_start(struct ieee80211_local *local);
868c2ecf20Sopenharmony_civoid drv_stop(struct ieee80211_local *local);
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
898c2ecf20Sopenharmony_cistatic inline int drv_suspend(struct ieee80211_local *local,
908c2ecf20Sopenharmony_ci			      struct cfg80211_wowlan *wowlan)
918c2ecf20Sopenharmony_ci{
928c2ecf20Sopenharmony_ci	int ret;
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci	might_sleep();
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	trace_drv_suspend(local);
978c2ecf20Sopenharmony_ci	ret = local->ops->suspend(&local->hw, wowlan);
988c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
998c2ecf20Sopenharmony_ci	return ret;
1008c2ecf20Sopenharmony_ci}
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cistatic inline int drv_resume(struct ieee80211_local *local)
1038c2ecf20Sopenharmony_ci{
1048c2ecf20Sopenharmony_ci	int ret;
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	might_sleep();
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	trace_drv_resume(local);
1098c2ecf20Sopenharmony_ci	ret = local->ops->resume(&local->hw);
1108c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
1118c2ecf20Sopenharmony_ci	return ret;
1128c2ecf20Sopenharmony_ci}
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_cistatic inline void drv_set_wakeup(struct ieee80211_local *local,
1158c2ecf20Sopenharmony_ci				  bool enabled)
1168c2ecf20Sopenharmony_ci{
1178c2ecf20Sopenharmony_ci	might_sleep();
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	if (!local->ops->set_wakeup)
1208c2ecf20Sopenharmony_ci		return;
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci	trace_drv_set_wakeup(local, enabled);
1238c2ecf20Sopenharmony_ci	local->ops->set_wakeup(&local->hw, enabled);
1248c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
1258c2ecf20Sopenharmony_ci}
1268c2ecf20Sopenharmony_ci#endif
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ciint drv_add_interface(struct ieee80211_local *local,
1298c2ecf20Sopenharmony_ci		      struct ieee80211_sub_if_data *sdata);
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ciint drv_change_interface(struct ieee80211_local *local,
1328c2ecf20Sopenharmony_ci			 struct ieee80211_sub_if_data *sdata,
1338c2ecf20Sopenharmony_ci			 enum nl80211_iftype type, bool p2p);
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_civoid drv_remove_interface(struct ieee80211_local *local,
1368c2ecf20Sopenharmony_ci			  struct ieee80211_sub_if_data *sdata);
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_cistatic inline int drv_config(struct ieee80211_local *local, u32 changed)
1398c2ecf20Sopenharmony_ci{
1408c2ecf20Sopenharmony_ci	int ret;
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci	might_sleep();
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci	trace_drv_config(local, changed);
1458c2ecf20Sopenharmony_ci	ret = local->ops->config(&local->hw, changed);
1468c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
1478c2ecf20Sopenharmony_ci	return ret;
1488c2ecf20Sopenharmony_ci}
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cistatic inline void drv_bss_info_changed(struct ieee80211_local *local,
1518c2ecf20Sopenharmony_ci					struct ieee80211_sub_if_data *sdata,
1528c2ecf20Sopenharmony_ci					struct ieee80211_bss_conf *info,
1538c2ecf20Sopenharmony_ci					u32 changed)
1548c2ecf20Sopenharmony_ci{
1558c2ecf20Sopenharmony_ci	might_sleep();
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci	if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
1588c2ecf20Sopenharmony_ci				    BSS_CHANGED_BEACON_ENABLED) &&
1598c2ecf20Sopenharmony_ci			 sdata->vif.type != NL80211_IFTYPE_AP &&
1608c2ecf20Sopenharmony_ci			 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
1618c2ecf20Sopenharmony_ci			 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
1628c2ecf20Sopenharmony_ci			 sdata->vif.type != NL80211_IFTYPE_OCB))
1638c2ecf20Sopenharmony_ci		return;
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
1668c2ecf20Sopenharmony_ci			 sdata->vif.type == NL80211_IFTYPE_NAN ||
1678c2ecf20Sopenharmony_ci			 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
1688c2ecf20Sopenharmony_ci			  !sdata->vif.mu_mimo_owner &&
1698c2ecf20Sopenharmony_ci			  !(changed & BSS_CHANGED_TXPOWER))))
1708c2ecf20Sopenharmony_ci		return;
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
1738c2ecf20Sopenharmony_ci		return;
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci	trace_drv_bss_info_changed(local, sdata, info, changed);
1768c2ecf20Sopenharmony_ci	if (local->ops->bss_info_changed)
1778c2ecf20Sopenharmony_ci		local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
1788c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
1798c2ecf20Sopenharmony_ci}
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_cistatic inline u64 drv_prepare_multicast(struct ieee80211_local *local,
1828c2ecf20Sopenharmony_ci					struct netdev_hw_addr_list *mc_list)
1838c2ecf20Sopenharmony_ci{
1848c2ecf20Sopenharmony_ci	u64 ret = 0;
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci	trace_drv_prepare_multicast(local, mc_list->count);
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci	if (local->ops->prepare_multicast)
1898c2ecf20Sopenharmony_ci		ret = local->ops->prepare_multicast(&local->hw, mc_list);
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci	trace_drv_return_u64(local, ret);
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	return ret;
1948c2ecf20Sopenharmony_ci}
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cistatic inline void drv_configure_filter(struct ieee80211_local *local,
1978c2ecf20Sopenharmony_ci					unsigned int changed_flags,
1988c2ecf20Sopenharmony_ci					unsigned int *total_flags,
1998c2ecf20Sopenharmony_ci					u64 multicast)
2008c2ecf20Sopenharmony_ci{
2018c2ecf20Sopenharmony_ci	might_sleep();
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci	trace_drv_configure_filter(local, changed_flags, total_flags,
2048c2ecf20Sopenharmony_ci				   multicast);
2058c2ecf20Sopenharmony_ci	local->ops->configure_filter(&local->hw, changed_flags, total_flags,
2068c2ecf20Sopenharmony_ci				     multicast);
2078c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
2088c2ecf20Sopenharmony_ci}
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_cistatic inline void drv_config_iface_filter(struct ieee80211_local *local,
2118c2ecf20Sopenharmony_ci					   struct ieee80211_sub_if_data *sdata,
2128c2ecf20Sopenharmony_ci					   unsigned int filter_flags,
2138c2ecf20Sopenharmony_ci					   unsigned int changed_flags)
2148c2ecf20Sopenharmony_ci{
2158c2ecf20Sopenharmony_ci	might_sleep();
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci	trace_drv_config_iface_filter(local, sdata, filter_flags,
2188c2ecf20Sopenharmony_ci				      changed_flags);
2198c2ecf20Sopenharmony_ci	if (local->ops->config_iface_filter)
2208c2ecf20Sopenharmony_ci		local->ops->config_iface_filter(&local->hw, &sdata->vif,
2218c2ecf20Sopenharmony_ci						filter_flags,
2228c2ecf20Sopenharmony_ci						changed_flags);
2238c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
2248c2ecf20Sopenharmony_ci}
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_cistatic inline int drv_set_tim(struct ieee80211_local *local,
2278c2ecf20Sopenharmony_ci			      struct ieee80211_sta *sta, bool set)
2288c2ecf20Sopenharmony_ci{
2298c2ecf20Sopenharmony_ci	int ret = 0;
2308c2ecf20Sopenharmony_ci	trace_drv_set_tim(local, sta, set);
2318c2ecf20Sopenharmony_ci	if (local->ops->set_tim)
2328c2ecf20Sopenharmony_ci		ret = local->ops->set_tim(&local->hw, sta, set);
2338c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
2348c2ecf20Sopenharmony_ci	return ret;
2358c2ecf20Sopenharmony_ci}
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_cistatic inline int drv_set_key(struct ieee80211_local *local,
2388c2ecf20Sopenharmony_ci			      enum set_key_cmd cmd,
2398c2ecf20Sopenharmony_ci			      struct ieee80211_sub_if_data *sdata,
2408c2ecf20Sopenharmony_ci			      struct ieee80211_sta *sta,
2418c2ecf20Sopenharmony_ci			      struct ieee80211_key_conf *key)
2428c2ecf20Sopenharmony_ci{
2438c2ecf20Sopenharmony_ci	int ret;
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	might_sleep();
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
2488c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
2498c2ecf20Sopenharmony_ci		return -EIO;
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci	trace_drv_set_key(local, cmd, sdata, sta, key);
2528c2ecf20Sopenharmony_ci	ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
2538c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
2548c2ecf20Sopenharmony_ci	return ret;
2558c2ecf20Sopenharmony_ci}
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_cistatic inline void drv_update_tkip_key(struct ieee80211_local *local,
2588c2ecf20Sopenharmony_ci				       struct ieee80211_sub_if_data *sdata,
2598c2ecf20Sopenharmony_ci				       struct ieee80211_key_conf *conf,
2608c2ecf20Sopenharmony_ci				       struct sta_info *sta, u32 iv32,
2618c2ecf20Sopenharmony_ci				       u16 *phase1key)
2628c2ecf20Sopenharmony_ci{
2638c2ecf20Sopenharmony_ci	struct ieee80211_sta *ista = NULL;
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci	if (sta)
2668c2ecf20Sopenharmony_ci		ista = &sta->sta;
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
2698c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
2708c2ecf20Sopenharmony_ci		return;
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci	trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
2738c2ecf20Sopenharmony_ci	if (local->ops->update_tkip_key)
2748c2ecf20Sopenharmony_ci		local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
2758c2ecf20Sopenharmony_ci					    ista, iv32, phase1key);
2768c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
2778c2ecf20Sopenharmony_ci}
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_cistatic inline int drv_hw_scan(struct ieee80211_local *local,
2808c2ecf20Sopenharmony_ci			      struct ieee80211_sub_if_data *sdata,
2818c2ecf20Sopenharmony_ci			      struct ieee80211_scan_request *req)
2828c2ecf20Sopenharmony_ci{
2838c2ecf20Sopenharmony_ci	int ret;
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci	might_sleep();
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
2888c2ecf20Sopenharmony_ci		return -EIO;
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci	trace_drv_hw_scan(local, sdata);
2918c2ecf20Sopenharmony_ci	ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
2928c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
2938c2ecf20Sopenharmony_ci	return ret;
2948c2ecf20Sopenharmony_ci}
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_cistatic inline void drv_cancel_hw_scan(struct ieee80211_local *local,
2978c2ecf20Sopenharmony_ci				      struct ieee80211_sub_if_data *sdata)
2988c2ecf20Sopenharmony_ci{
2998c2ecf20Sopenharmony_ci	might_sleep();
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
3028c2ecf20Sopenharmony_ci		return;
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	trace_drv_cancel_hw_scan(local, sdata);
3058c2ecf20Sopenharmony_ci	local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
3068c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
3078c2ecf20Sopenharmony_ci}
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_cistatic inline int
3108c2ecf20Sopenharmony_cidrv_sched_scan_start(struct ieee80211_local *local,
3118c2ecf20Sopenharmony_ci		     struct ieee80211_sub_if_data *sdata,
3128c2ecf20Sopenharmony_ci		     struct cfg80211_sched_scan_request *req,
3138c2ecf20Sopenharmony_ci		     struct ieee80211_scan_ies *ies)
3148c2ecf20Sopenharmony_ci{
3158c2ecf20Sopenharmony_ci	int ret;
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	might_sleep();
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
3208c2ecf20Sopenharmony_ci		return -EIO;
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci	trace_drv_sched_scan_start(local, sdata);
3238c2ecf20Sopenharmony_ci	ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
3248c2ecf20Sopenharmony_ci					      req, ies);
3258c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
3268c2ecf20Sopenharmony_ci	return ret;
3278c2ecf20Sopenharmony_ci}
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_cistatic inline int drv_sched_scan_stop(struct ieee80211_local *local,
3308c2ecf20Sopenharmony_ci				      struct ieee80211_sub_if_data *sdata)
3318c2ecf20Sopenharmony_ci{
3328c2ecf20Sopenharmony_ci	int ret;
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci	might_sleep();
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
3378c2ecf20Sopenharmony_ci		return -EIO;
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	trace_drv_sched_scan_stop(local, sdata);
3408c2ecf20Sopenharmony_ci	ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif);
3418c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci	return ret;
3448c2ecf20Sopenharmony_ci}
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_cistatic inline void drv_sw_scan_start(struct ieee80211_local *local,
3478c2ecf20Sopenharmony_ci				     struct ieee80211_sub_if_data *sdata,
3488c2ecf20Sopenharmony_ci				     const u8 *mac_addr)
3498c2ecf20Sopenharmony_ci{
3508c2ecf20Sopenharmony_ci	might_sleep();
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	trace_drv_sw_scan_start(local, sdata, mac_addr);
3538c2ecf20Sopenharmony_ci	if (local->ops->sw_scan_start)
3548c2ecf20Sopenharmony_ci		local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
3558c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
3568c2ecf20Sopenharmony_ci}
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_cistatic inline void drv_sw_scan_complete(struct ieee80211_local *local,
3598c2ecf20Sopenharmony_ci					struct ieee80211_sub_if_data *sdata)
3608c2ecf20Sopenharmony_ci{
3618c2ecf20Sopenharmony_ci	might_sleep();
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci	trace_drv_sw_scan_complete(local, sdata);
3648c2ecf20Sopenharmony_ci	if (local->ops->sw_scan_complete)
3658c2ecf20Sopenharmony_ci		local->ops->sw_scan_complete(&local->hw, &sdata->vif);
3668c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
3678c2ecf20Sopenharmony_ci}
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_cistatic inline int drv_get_stats(struct ieee80211_local *local,
3708c2ecf20Sopenharmony_ci				struct ieee80211_low_level_stats *stats)
3718c2ecf20Sopenharmony_ci{
3728c2ecf20Sopenharmony_ci	int ret = -EOPNOTSUPP;
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci	might_sleep();
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci	if (local->ops->get_stats)
3778c2ecf20Sopenharmony_ci		ret = local->ops->get_stats(&local->hw, stats);
3788c2ecf20Sopenharmony_ci	trace_drv_get_stats(local, stats, ret);
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci	return ret;
3818c2ecf20Sopenharmony_ci}
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_cistatic inline void drv_get_key_seq(struct ieee80211_local *local,
3848c2ecf20Sopenharmony_ci				   struct ieee80211_key *key,
3858c2ecf20Sopenharmony_ci				   struct ieee80211_key_seq *seq)
3868c2ecf20Sopenharmony_ci{
3878c2ecf20Sopenharmony_ci	if (local->ops->get_key_seq)
3888c2ecf20Sopenharmony_ci		local->ops->get_key_seq(&local->hw, &key->conf, seq);
3898c2ecf20Sopenharmony_ci	trace_drv_get_key_seq(local, &key->conf);
3908c2ecf20Sopenharmony_ci}
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_cistatic inline int drv_set_frag_threshold(struct ieee80211_local *local,
3938c2ecf20Sopenharmony_ci					u32 value)
3948c2ecf20Sopenharmony_ci{
3958c2ecf20Sopenharmony_ci	int ret = 0;
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci	might_sleep();
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci	trace_drv_set_frag_threshold(local, value);
4008c2ecf20Sopenharmony_ci	if (local->ops->set_frag_threshold)
4018c2ecf20Sopenharmony_ci		ret = local->ops->set_frag_threshold(&local->hw, value);
4028c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
4038c2ecf20Sopenharmony_ci	return ret;
4048c2ecf20Sopenharmony_ci}
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_cistatic inline int drv_set_rts_threshold(struct ieee80211_local *local,
4078c2ecf20Sopenharmony_ci					u32 value)
4088c2ecf20Sopenharmony_ci{
4098c2ecf20Sopenharmony_ci	int ret = 0;
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci	might_sleep();
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci	trace_drv_set_rts_threshold(local, value);
4148c2ecf20Sopenharmony_ci	if (local->ops->set_rts_threshold)
4158c2ecf20Sopenharmony_ci		ret = local->ops->set_rts_threshold(&local->hw, value);
4168c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
4178c2ecf20Sopenharmony_ci	return ret;
4188c2ecf20Sopenharmony_ci}
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_cistatic inline int drv_set_coverage_class(struct ieee80211_local *local,
4218c2ecf20Sopenharmony_ci					 s16 value)
4228c2ecf20Sopenharmony_ci{
4238c2ecf20Sopenharmony_ci	int ret = 0;
4248c2ecf20Sopenharmony_ci	might_sleep();
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ci	trace_drv_set_coverage_class(local, value);
4278c2ecf20Sopenharmony_ci	if (local->ops->set_coverage_class)
4288c2ecf20Sopenharmony_ci		local->ops->set_coverage_class(&local->hw, value);
4298c2ecf20Sopenharmony_ci	else
4308c2ecf20Sopenharmony_ci		ret = -EOPNOTSUPP;
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
4338c2ecf20Sopenharmony_ci	return ret;
4348c2ecf20Sopenharmony_ci}
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_cistatic inline void drv_sta_notify(struct ieee80211_local *local,
4378c2ecf20Sopenharmony_ci				  struct ieee80211_sub_if_data *sdata,
4388c2ecf20Sopenharmony_ci				  enum sta_notify_cmd cmd,
4398c2ecf20Sopenharmony_ci				  struct ieee80211_sta *sta)
4408c2ecf20Sopenharmony_ci{
4418c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
4428c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
4438c2ecf20Sopenharmony_ci		return;
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci	trace_drv_sta_notify(local, sdata, cmd, sta);
4468c2ecf20Sopenharmony_ci	if (local->ops->sta_notify)
4478c2ecf20Sopenharmony_ci		local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
4488c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
4498c2ecf20Sopenharmony_ci}
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_cistatic inline int drv_sta_add(struct ieee80211_local *local,
4528c2ecf20Sopenharmony_ci			      struct ieee80211_sub_if_data *sdata,
4538c2ecf20Sopenharmony_ci			      struct ieee80211_sta *sta)
4548c2ecf20Sopenharmony_ci{
4558c2ecf20Sopenharmony_ci	int ret = 0;
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci	might_sleep();
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
4608c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
4618c2ecf20Sopenharmony_ci		return -EIO;
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci	trace_drv_sta_add(local, sdata, sta);
4648c2ecf20Sopenharmony_ci	if (local->ops->sta_add)
4658c2ecf20Sopenharmony_ci		ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci	return ret;
4708c2ecf20Sopenharmony_ci}
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_cistatic inline void drv_sta_remove(struct ieee80211_local *local,
4738c2ecf20Sopenharmony_ci				  struct ieee80211_sub_if_data *sdata,
4748c2ecf20Sopenharmony_ci				  struct ieee80211_sta *sta)
4758c2ecf20Sopenharmony_ci{
4768c2ecf20Sopenharmony_ci	might_sleep();
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
4798c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
4808c2ecf20Sopenharmony_ci		return;
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ci	trace_drv_sta_remove(local, sdata, sta);
4838c2ecf20Sopenharmony_ci	if (local->ops->sta_remove)
4848c2ecf20Sopenharmony_ci		local->ops->sta_remove(&local->hw, &sdata->vif, sta);
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
4878c2ecf20Sopenharmony_ci}
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_DEBUGFS
4908c2ecf20Sopenharmony_cistatic inline void drv_sta_add_debugfs(struct ieee80211_local *local,
4918c2ecf20Sopenharmony_ci				       struct ieee80211_sub_if_data *sdata,
4928c2ecf20Sopenharmony_ci				       struct ieee80211_sta *sta,
4938c2ecf20Sopenharmony_ci				       struct dentry *dir)
4948c2ecf20Sopenharmony_ci{
4958c2ecf20Sopenharmony_ci	might_sleep();
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
4988c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
4998c2ecf20Sopenharmony_ci		return;
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci	if (local->ops->sta_add_debugfs)
5028c2ecf20Sopenharmony_ci		local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
5038c2ecf20Sopenharmony_ci					    sta, dir);
5048c2ecf20Sopenharmony_ci}
5058c2ecf20Sopenharmony_ci#endif
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_cistatic inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
5088c2ecf20Sopenharmony_ci					  struct ieee80211_sub_if_data *sdata,
5098c2ecf20Sopenharmony_ci					  struct sta_info *sta)
5108c2ecf20Sopenharmony_ci{
5118c2ecf20Sopenharmony_ci	might_sleep();
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
5148c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
5158c2ecf20Sopenharmony_ci		return;
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci	trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta);
5188c2ecf20Sopenharmony_ci	if (local->ops->sta_pre_rcu_remove)
5198c2ecf20Sopenharmony_ci		local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif,
5208c2ecf20Sopenharmony_ci					       &sta->sta);
5218c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
5228c2ecf20Sopenharmony_ci}
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci__must_check
5258c2ecf20Sopenharmony_ciint drv_sta_state(struct ieee80211_local *local,
5268c2ecf20Sopenharmony_ci		  struct ieee80211_sub_if_data *sdata,
5278c2ecf20Sopenharmony_ci		  struct sta_info *sta,
5288c2ecf20Sopenharmony_ci		  enum ieee80211_sta_state old_state,
5298c2ecf20Sopenharmony_ci		  enum ieee80211_sta_state new_state);
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci__must_check
5328c2ecf20Sopenharmony_ciint drv_sta_set_txpwr(struct ieee80211_local *local,
5338c2ecf20Sopenharmony_ci		      struct ieee80211_sub_if_data *sdata,
5348c2ecf20Sopenharmony_ci		      struct sta_info *sta);
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_civoid drv_sta_rc_update(struct ieee80211_local *local,
5378c2ecf20Sopenharmony_ci		       struct ieee80211_sub_if_data *sdata,
5388c2ecf20Sopenharmony_ci		       struct ieee80211_sta *sta, u32 changed);
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_cistatic inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
5418c2ecf20Sopenharmony_ci					   struct ieee80211_sub_if_data *sdata,
5428c2ecf20Sopenharmony_ci					   struct ieee80211_sta *sta)
5438c2ecf20Sopenharmony_ci{
5448c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
5458c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
5468c2ecf20Sopenharmony_ci		return;
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci	trace_drv_sta_rate_tbl_update(local, sdata, sta);
5498c2ecf20Sopenharmony_ci	if (local->ops->sta_rate_tbl_update)
5508c2ecf20Sopenharmony_ci		local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
5538c2ecf20Sopenharmony_ci}
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_cistatic inline void drv_sta_statistics(struct ieee80211_local *local,
5568c2ecf20Sopenharmony_ci				      struct ieee80211_sub_if_data *sdata,
5578c2ecf20Sopenharmony_ci				      struct ieee80211_sta *sta,
5588c2ecf20Sopenharmony_ci				      struct station_info *sinfo)
5598c2ecf20Sopenharmony_ci{
5608c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
5618c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
5628c2ecf20Sopenharmony_ci		return;
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_ci	trace_drv_sta_statistics(local, sdata, sta);
5658c2ecf20Sopenharmony_ci	if (local->ops->sta_statistics)
5668c2ecf20Sopenharmony_ci		local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo);
5678c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
5688c2ecf20Sopenharmony_ci}
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ciint drv_conf_tx(struct ieee80211_local *local,
5718c2ecf20Sopenharmony_ci		struct ieee80211_sub_if_data *sdata, u16 ac,
5728c2ecf20Sopenharmony_ci		const struct ieee80211_tx_queue_params *params);
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ciu64 drv_get_tsf(struct ieee80211_local *local,
5758c2ecf20Sopenharmony_ci		struct ieee80211_sub_if_data *sdata);
5768c2ecf20Sopenharmony_civoid drv_set_tsf(struct ieee80211_local *local,
5778c2ecf20Sopenharmony_ci		 struct ieee80211_sub_if_data *sdata,
5788c2ecf20Sopenharmony_ci		 u64 tsf);
5798c2ecf20Sopenharmony_civoid drv_offset_tsf(struct ieee80211_local *local,
5808c2ecf20Sopenharmony_ci		    struct ieee80211_sub_if_data *sdata,
5818c2ecf20Sopenharmony_ci		    s64 offset);
5828c2ecf20Sopenharmony_civoid drv_reset_tsf(struct ieee80211_local *local,
5838c2ecf20Sopenharmony_ci		   struct ieee80211_sub_if_data *sdata);
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_cistatic inline int drv_tx_last_beacon(struct ieee80211_local *local)
5868c2ecf20Sopenharmony_ci{
5878c2ecf20Sopenharmony_ci	int ret = 0; /* default unsupported op for less congestion */
5888c2ecf20Sopenharmony_ci
5898c2ecf20Sopenharmony_ci	might_sleep();
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci	trace_drv_tx_last_beacon(local);
5928c2ecf20Sopenharmony_ci	if (local->ops->tx_last_beacon)
5938c2ecf20Sopenharmony_ci		ret = local->ops->tx_last_beacon(&local->hw);
5948c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
5958c2ecf20Sopenharmony_ci	return ret;
5968c2ecf20Sopenharmony_ci}
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ciint drv_ampdu_action(struct ieee80211_local *local,
5998c2ecf20Sopenharmony_ci		     struct ieee80211_sub_if_data *sdata,
6008c2ecf20Sopenharmony_ci		     struct ieee80211_ampdu_params *params);
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_cistatic inline int drv_get_survey(struct ieee80211_local *local, int idx,
6038c2ecf20Sopenharmony_ci				struct survey_info *survey)
6048c2ecf20Sopenharmony_ci{
6058c2ecf20Sopenharmony_ci	int ret = -EOPNOTSUPP;
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci	trace_drv_get_survey(local, idx, survey);
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci	if (local->ops->get_survey)
6108c2ecf20Sopenharmony_ci		ret = local->ops->get_survey(&local->hw, idx, survey);
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_ci	return ret;
6158c2ecf20Sopenharmony_ci}
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_cistatic inline void drv_rfkill_poll(struct ieee80211_local *local)
6188c2ecf20Sopenharmony_ci{
6198c2ecf20Sopenharmony_ci	might_sleep();
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci	if (local->ops->rfkill_poll)
6228c2ecf20Sopenharmony_ci		local->ops->rfkill_poll(&local->hw);
6238c2ecf20Sopenharmony_ci}
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_cistatic inline void drv_flush(struct ieee80211_local *local,
6268c2ecf20Sopenharmony_ci			     struct ieee80211_sub_if_data *sdata,
6278c2ecf20Sopenharmony_ci			     u32 queues, bool drop)
6288c2ecf20Sopenharmony_ci{
6298c2ecf20Sopenharmony_ci	struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL;
6308c2ecf20Sopenharmony_ci
6318c2ecf20Sopenharmony_ci	might_sleep();
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ci	if (sdata && !check_sdata_in_driver(sdata))
6348c2ecf20Sopenharmony_ci		return;
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci	trace_drv_flush(local, queues, drop);
6378c2ecf20Sopenharmony_ci	if (local->ops->flush)
6388c2ecf20Sopenharmony_ci		local->ops->flush(&local->hw, vif, queues, drop);
6398c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
6408c2ecf20Sopenharmony_ci}
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_cistatic inline void drv_channel_switch(struct ieee80211_local *local,
6438c2ecf20Sopenharmony_ci				      struct ieee80211_sub_if_data *sdata,
6448c2ecf20Sopenharmony_ci				      struct ieee80211_channel_switch *ch_switch)
6458c2ecf20Sopenharmony_ci{
6468c2ecf20Sopenharmony_ci	might_sleep();
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci	trace_drv_channel_switch(local, sdata, ch_switch);
6498c2ecf20Sopenharmony_ci	local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch);
6508c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
6518c2ecf20Sopenharmony_ci}
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_cistatic inline int drv_set_antenna(struct ieee80211_local *local,
6558c2ecf20Sopenharmony_ci				  u32 tx_ant, u32 rx_ant)
6568c2ecf20Sopenharmony_ci{
6578c2ecf20Sopenharmony_ci	int ret = -EOPNOTSUPP;
6588c2ecf20Sopenharmony_ci	might_sleep();
6598c2ecf20Sopenharmony_ci	if (local->ops->set_antenna)
6608c2ecf20Sopenharmony_ci		ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
6618c2ecf20Sopenharmony_ci	trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
6628c2ecf20Sopenharmony_ci	return ret;
6638c2ecf20Sopenharmony_ci}
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_cistatic inline int drv_get_antenna(struct ieee80211_local *local,
6668c2ecf20Sopenharmony_ci				  u32 *tx_ant, u32 *rx_ant)
6678c2ecf20Sopenharmony_ci{
6688c2ecf20Sopenharmony_ci	int ret = -EOPNOTSUPP;
6698c2ecf20Sopenharmony_ci	might_sleep();
6708c2ecf20Sopenharmony_ci	if (local->ops->get_antenna)
6718c2ecf20Sopenharmony_ci		ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
6728c2ecf20Sopenharmony_ci	trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
6738c2ecf20Sopenharmony_ci	return ret;
6748c2ecf20Sopenharmony_ci}
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_cistatic inline int drv_remain_on_channel(struct ieee80211_local *local,
6778c2ecf20Sopenharmony_ci					struct ieee80211_sub_if_data *sdata,
6788c2ecf20Sopenharmony_ci					struct ieee80211_channel *chan,
6798c2ecf20Sopenharmony_ci					unsigned int duration,
6808c2ecf20Sopenharmony_ci					enum ieee80211_roc_type type)
6818c2ecf20Sopenharmony_ci{
6828c2ecf20Sopenharmony_ci	int ret;
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_ci	might_sleep();
6858c2ecf20Sopenharmony_ci
6868c2ecf20Sopenharmony_ci	trace_drv_remain_on_channel(local, sdata, chan, duration, type);
6878c2ecf20Sopenharmony_ci	ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
6888c2ecf20Sopenharmony_ci					    chan, duration, type);
6898c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_ci	return ret;
6928c2ecf20Sopenharmony_ci}
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_cistatic inline int
6958c2ecf20Sopenharmony_cidrv_cancel_remain_on_channel(struct ieee80211_local *local,
6968c2ecf20Sopenharmony_ci			     struct ieee80211_sub_if_data *sdata)
6978c2ecf20Sopenharmony_ci{
6988c2ecf20Sopenharmony_ci	int ret;
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_ci	might_sleep();
7018c2ecf20Sopenharmony_ci
7028c2ecf20Sopenharmony_ci	trace_drv_cancel_remain_on_channel(local, sdata);
7038c2ecf20Sopenharmony_ci	ret = local->ops->cancel_remain_on_channel(&local->hw, &sdata->vif);
7048c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci	return ret;
7078c2ecf20Sopenharmony_ci}
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_cistatic inline int drv_set_ringparam(struct ieee80211_local *local,
7108c2ecf20Sopenharmony_ci				    u32 tx, u32 rx)
7118c2ecf20Sopenharmony_ci{
7128c2ecf20Sopenharmony_ci	int ret = -ENOTSUPP;
7138c2ecf20Sopenharmony_ci
7148c2ecf20Sopenharmony_ci	might_sleep();
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci	trace_drv_set_ringparam(local, tx, rx);
7178c2ecf20Sopenharmony_ci	if (local->ops->set_ringparam)
7188c2ecf20Sopenharmony_ci		ret = local->ops->set_ringparam(&local->hw, tx, rx);
7198c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci	return ret;
7228c2ecf20Sopenharmony_ci}
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_cistatic inline void drv_get_ringparam(struct ieee80211_local *local,
7258c2ecf20Sopenharmony_ci				     u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
7268c2ecf20Sopenharmony_ci{
7278c2ecf20Sopenharmony_ci	might_sleep();
7288c2ecf20Sopenharmony_ci
7298c2ecf20Sopenharmony_ci	trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
7308c2ecf20Sopenharmony_ci	if (local->ops->get_ringparam)
7318c2ecf20Sopenharmony_ci		local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
7328c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
7338c2ecf20Sopenharmony_ci}
7348c2ecf20Sopenharmony_ci
7358c2ecf20Sopenharmony_cistatic inline bool drv_tx_frames_pending(struct ieee80211_local *local)
7368c2ecf20Sopenharmony_ci{
7378c2ecf20Sopenharmony_ci	bool ret = false;
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci	might_sleep();
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci	trace_drv_tx_frames_pending(local);
7428c2ecf20Sopenharmony_ci	if (local->ops->tx_frames_pending)
7438c2ecf20Sopenharmony_ci		ret = local->ops->tx_frames_pending(&local->hw);
7448c2ecf20Sopenharmony_ci	trace_drv_return_bool(local, ret);
7458c2ecf20Sopenharmony_ci
7468c2ecf20Sopenharmony_ci	return ret;
7478c2ecf20Sopenharmony_ci}
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_cistatic inline int drv_set_bitrate_mask(struct ieee80211_local *local,
7508c2ecf20Sopenharmony_ci				       struct ieee80211_sub_if_data *sdata,
7518c2ecf20Sopenharmony_ci				       const struct cfg80211_bitrate_mask *mask)
7528c2ecf20Sopenharmony_ci{
7538c2ecf20Sopenharmony_ci	int ret = -EOPNOTSUPP;
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci	might_sleep();
7568c2ecf20Sopenharmony_ci
7578c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
7588c2ecf20Sopenharmony_ci		return -EIO;
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci	trace_drv_set_bitrate_mask(local, sdata, mask);
7618c2ecf20Sopenharmony_ci	if (local->ops->set_bitrate_mask)
7628c2ecf20Sopenharmony_ci		ret = local->ops->set_bitrate_mask(&local->hw,
7638c2ecf20Sopenharmony_ci						   &sdata->vif, mask);
7648c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci	return ret;
7678c2ecf20Sopenharmony_ci}
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_cistatic inline void drv_set_rekey_data(struct ieee80211_local *local,
7708c2ecf20Sopenharmony_ci				      struct ieee80211_sub_if_data *sdata,
7718c2ecf20Sopenharmony_ci				      struct cfg80211_gtk_rekey_data *data)
7728c2ecf20Sopenharmony_ci{
7738c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
7748c2ecf20Sopenharmony_ci		return;
7758c2ecf20Sopenharmony_ci
7768c2ecf20Sopenharmony_ci	trace_drv_set_rekey_data(local, sdata, data);
7778c2ecf20Sopenharmony_ci	if (local->ops->set_rekey_data)
7788c2ecf20Sopenharmony_ci		local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
7798c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
7808c2ecf20Sopenharmony_ci}
7818c2ecf20Sopenharmony_ci
7828c2ecf20Sopenharmony_cistatic inline void drv_event_callback(struct ieee80211_local *local,
7838c2ecf20Sopenharmony_ci				      struct ieee80211_sub_if_data *sdata,
7848c2ecf20Sopenharmony_ci				      const struct ieee80211_event *event)
7858c2ecf20Sopenharmony_ci{
7868c2ecf20Sopenharmony_ci	trace_drv_event_callback(local, sdata, event);
7878c2ecf20Sopenharmony_ci	if (local->ops->event_callback)
7888c2ecf20Sopenharmony_ci		local->ops->event_callback(&local->hw, &sdata->vif, event);
7898c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
7908c2ecf20Sopenharmony_ci}
7918c2ecf20Sopenharmony_ci
7928c2ecf20Sopenharmony_cistatic inline void
7938c2ecf20Sopenharmony_cidrv_release_buffered_frames(struct ieee80211_local *local,
7948c2ecf20Sopenharmony_ci			    struct sta_info *sta, u16 tids, int num_frames,
7958c2ecf20Sopenharmony_ci			    enum ieee80211_frame_release_type reason,
7968c2ecf20Sopenharmony_ci			    bool more_data)
7978c2ecf20Sopenharmony_ci{
7988c2ecf20Sopenharmony_ci	trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
7998c2ecf20Sopenharmony_ci					  reason, more_data);
8008c2ecf20Sopenharmony_ci	if (local->ops->release_buffered_frames)
8018c2ecf20Sopenharmony_ci		local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
8028c2ecf20Sopenharmony_ci						    num_frames, reason,
8038c2ecf20Sopenharmony_ci						    more_data);
8048c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
8058c2ecf20Sopenharmony_ci}
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_cistatic inline void
8088c2ecf20Sopenharmony_cidrv_allow_buffered_frames(struct ieee80211_local *local,
8098c2ecf20Sopenharmony_ci			  struct sta_info *sta, u16 tids, int num_frames,
8108c2ecf20Sopenharmony_ci			  enum ieee80211_frame_release_type reason,
8118c2ecf20Sopenharmony_ci			  bool more_data)
8128c2ecf20Sopenharmony_ci{
8138c2ecf20Sopenharmony_ci	trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
8148c2ecf20Sopenharmony_ci					reason, more_data);
8158c2ecf20Sopenharmony_ci	if (local->ops->allow_buffered_frames)
8168c2ecf20Sopenharmony_ci		local->ops->allow_buffered_frames(&local->hw, &sta->sta,
8178c2ecf20Sopenharmony_ci						  tids, num_frames, reason,
8188c2ecf20Sopenharmony_ci						  more_data);
8198c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
8208c2ecf20Sopenharmony_ci}
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_cistatic inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
8238c2ecf20Sopenharmony_ci				      struct ieee80211_sub_if_data *sdata,
8248c2ecf20Sopenharmony_ci				      u16 duration)
8258c2ecf20Sopenharmony_ci{
8268c2ecf20Sopenharmony_ci	might_sleep();
8278c2ecf20Sopenharmony_ci
8288c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
8298c2ecf20Sopenharmony_ci		return;
8308c2ecf20Sopenharmony_ci	WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_ci	trace_drv_mgd_prepare_tx(local, sdata, duration);
8338c2ecf20Sopenharmony_ci	if (local->ops->mgd_prepare_tx)
8348c2ecf20Sopenharmony_ci		local->ops->mgd_prepare_tx(&local->hw, &sdata->vif, duration);
8358c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
8368c2ecf20Sopenharmony_ci}
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_cistatic inline void
8398c2ecf20Sopenharmony_cidrv_mgd_protect_tdls_discover(struct ieee80211_local *local,
8408c2ecf20Sopenharmony_ci			      struct ieee80211_sub_if_data *sdata)
8418c2ecf20Sopenharmony_ci{
8428c2ecf20Sopenharmony_ci	might_sleep();
8438c2ecf20Sopenharmony_ci
8448c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
8458c2ecf20Sopenharmony_ci		return;
8468c2ecf20Sopenharmony_ci	WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
8478c2ecf20Sopenharmony_ci
8488c2ecf20Sopenharmony_ci	trace_drv_mgd_protect_tdls_discover(local, sdata);
8498c2ecf20Sopenharmony_ci	if (local->ops->mgd_protect_tdls_discover)
8508c2ecf20Sopenharmony_ci		local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
8518c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
8528c2ecf20Sopenharmony_ci}
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_cistatic inline int drv_add_chanctx(struct ieee80211_local *local,
8558c2ecf20Sopenharmony_ci				  struct ieee80211_chanctx *ctx)
8568c2ecf20Sopenharmony_ci{
8578c2ecf20Sopenharmony_ci	int ret = -EOPNOTSUPP;
8588c2ecf20Sopenharmony_ci
8598c2ecf20Sopenharmony_ci	might_sleep();
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci	trace_drv_add_chanctx(local, ctx);
8628c2ecf20Sopenharmony_ci	if (local->ops->add_chanctx)
8638c2ecf20Sopenharmony_ci		ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
8648c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
8658c2ecf20Sopenharmony_ci	if (!ret)
8668c2ecf20Sopenharmony_ci		ctx->driver_present = true;
8678c2ecf20Sopenharmony_ci
8688c2ecf20Sopenharmony_ci	return ret;
8698c2ecf20Sopenharmony_ci}
8708c2ecf20Sopenharmony_ci
8718c2ecf20Sopenharmony_cistatic inline void drv_remove_chanctx(struct ieee80211_local *local,
8728c2ecf20Sopenharmony_ci				      struct ieee80211_chanctx *ctx)
8738c2ecf20Sopenharmony_ci{
8748c2ecf20Sopenharmony_ci	might_sleep();
8758c2ecf20Sopenharmony_ci
8768c2ecf20Sopenharmony_ci	if (WARN_ON(!ctx->driver_present))
8778c2ecf20Sopenharmony_ci		return;
8788c2ecf20Sopenharmony_ci
8798c2ecf20Sopenharmony_ci	trace_drv_remove_chanctx(local, ctx);
8808c2ecf20Sopenharmony_ci	if (local->ops->remove_chanctx)
8818c2ecf20Sopenharmony_ci		local->ops->remove_chanctx(&local->hw, &ctx->conf);
8828c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
8838c2ecf20Sopenharmony_ci	ctx->driver_present = false;
8848c2ecf20Sopenharmony_ci}
8858c2ecf20Sopenharmony_ci
8868c2ecf20Sopenharmony_cistatic inline void drv_change_chanctx(struct ieee80211_local *local,
8878c2ecf20Sopenharmony_ci				      struct ieee80211_chanctx *ctx,
8888c2ecf20Sopenharmony_ci				      u32 changed)
8898c2ecf20Sopenharmony_ci{
8908c2ecf20Sopenharmony_ci	might_sleep();
8918c2ecf20Sopenharmony_ci
8928c2ecf20Sopenharmony_ci	trace_drv_change_chanctx(local, ctx, changed);
8938c2ecf20Sopenharmony_ci	if (local->ops->change_chanctx) {
8948c2ecf20Sopenharmony_ci		WARN_ON_ONCE(!ctx->driver_present);
8958c2ecf20Sopenharmony_ci		local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
8968c2ecf20Sopenharmony_ci	}
8978c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
8988c2ecf20Sopenharmony_ci}
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_cistatic inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
9018c2ecf20Sopenharmony_ci					 struct ieee80211_sub_if_data *sdata,
9028c2ecf20Sopenharmony_ci					 struct ieee80211_chanctx *ctx)
9038c2ecf20Sopenharmony_ci{
9048c2ecf20Sopenharmony_ci	int ret = 0;
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
9078c2ecf20Sopenharmony_ci		return -EIO;
9088c2ecf20Sopenharmony_ci
9098c2ecf20Sopenharmony_ci	trace_drv_assign_vif_chanctx(local, sdata, ctx);
9108c2ecf20Sopenharmony_ci	if (local->ops->assign_vif_chanctx) {
9118c2ecf20Sopenharmony_ci		WARN_ON_ONCE(!ctx->driver_present);
9128c2ecf20Sopenharmony_ci		ret = local->ops->assign_vif_chanctx(&local->hw,
9138c2ecf20Sopenharmony_ci						     &sdata->vif,
9148c2ecf20Sopenharmony_ci						     &ctx->conf);
9158c2ecf20Sopenharmony_ci	}
9168c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
9178c2ecf20Sopenharmony_ci
9188c2ecf20Sopenharmony_ci	return ret;
9198c2ecf20Sopenharmony_ci}
9208c2ecf20Sopenharmony_ci
9218c2ecf20Sopenharmony_cistatic inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
9228c2ecf20Sopenharmony_ci					    struct ieee80211_sub_if_data *sdata,
9238c2ecf20Sopenharmony_ci					    struct ieee80211_chanctx *ctx)
9248c2ecf20Sopenharmony_ci{
9258c2ecf20Sopenharmony_ci	might_sleep();
9268c2ecf20Sopenharmony_ci
9278c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
9288c2ecf20Sopenharmony_ci		return;
9298c2ecf20Sopenharmony_ci
9308c2ecf20Sopenharmony_ci	trace_drv_unassign_vif_chanctx(local, sdata, ctx);
9318c2ecf20Sopenharmony_ci	if (local->ops->unassign_vif_chanctx) {
9328c2ecf20Sopenharmony_ci		WARN_ON_ONCE(!ctx->driver_present);
9338c2ecf20Sopenharmony_ci		local->ops->unassign_vif_chanctx(&local->hw,
9348c2ecf20Sopenharmony_ci						 &sdata->vif,
9358c2ecf20Sopenharmony_ci						 &ctx->conf);
9368c2ecf20Sopenharmony_ci	}
9378c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
9388c2ecf20Sopenharmony_ci}
9398c2ecf20Sopenharmony_ci
9408c2ecf20Sopenharmony_ciint drv_switch_vif_chanctx(struct ieee80211_local *local,
9418c2ecf20Sopenharmony_ci			   struct ieee80211_vif_chanctx_switch *vifs,
9428c2ecf20Sopenharmony_ci			   int n_vifs, enum ieee80211_chanctx_switch_mode mode);
9438c2ecf20Sopenharmony_ci
9448c2ecf20Sopenharmony_cistatic inline int drv_start_ap(struct ieee80211_local *local,
9458c2ecf20Sopenharmony_ci			       struct ieee80211_sub_if_data *sdata)
9468c2ecf20Sopenharmony_ci{
9478c2ecf20Sopenharmony_ci	int ret = 0;
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_ci	might_sleep();
9508c2ecf20Sopenharmony_ci
9518c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
9528c2ecf20Sopenharmony_ci		return -EIO;
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci	trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
9558c2ecf20Sopenharmony_ci	if (local->ops->start_ap)
9568c2ecf20Sopenharmony_ci		ret = local->ops->start_ap(&local->hw, &sdata->vif);
9578c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
9588c2ecf20Sopenharmony_ci	return ret;
9598c2ecf20Sopenharmony_ci}
9608c2ecf20Sopenharmony_ci
9618c2ecf20Sopenharmony_cistatic inline void drv_stop_ap(struct ieee80211_local *local,
9628c2ecf20Sopenharmony_ci			       struct ieee80211_sub_if_data *sdata)
9638c2ecf20Sopenharmony_ci{
9648c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
9658c2ecf20Sopenharmony_ci		return;
9668c2ecf20Sopenharmony_ci
9678c2ecf20Sopenharmony_ci	trace_drv_stop_ap(local, sdata);
9688c2ecf20Sopenharmony_ci	if (local->ops->stop_ap)
9698c2ecf20Sopenharmony_ci		local->ops->stop_ap(&local->hw, &sdata->vif);
9708c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
9718c2ecf20Sopenharmony_ci}
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_cistatic inline void
9748c2ecf20Sopenharmony_cidrv_reconfig_complete(struct ieee80211_local *local,
9758c2ecf20Sopenharmony_ci		      enum ieee80211_reconfig_type reconfig_type)
9768c2ecf20Sopenharmony_ci{
9778c2ecf20Sopenharmony_ci	might_sleep();
9788c2ecf20Sopenharmony_ci
9798c2ecf20Sopenharmony_ci	trace_drv_reconfig_complete(local, reconfig_type);
9808c2ecf20Sopenharmony_ci	if (local->ops->reconfig_complete)
9818c2ecf20Sopenharmony_ci		local->ops->reconfig_complete(&local->hw, reconfig_type);
9828c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
9838c2ecf20Sopenharmony_ci}
9848c2ecf20Sopenharmony_ci
9858c2ecf20Sopenharmony_cistatic inline void
9868c2ecf20Sopenharmony_cidrv_set_default_unicast_key(struct ieee80211_local *local,
9878c2ecf20Sopenharmony_ci			    struct ieee80211_sub_if_data *sdata,
9888c2ecf20Sopenharmony_ci			    int key_idx)
9898c2ecf20Sopenharmony_ci{
9908c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
9918c2ecf20Sopenharmony_ci		return;
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci	WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
9948c2ecf20Sopenharmony_ci
9958c2ecf20Sopenharmony_ci	trace_drv_set_default_unicast_key(local, sdata, key_idx);
9968c2ecf20Sopenharmony_ci	if (local->ops->set_default_unicast_key)
9978c2ecf20Sopenharmony_ci		local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
9988c2ecf20Sopenharmony_ci						    key_idx);
9998c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
10008c2ecf20Sopenharmony_ci}
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_IPV6)
10038c2ecf20Sopenharmony_cistatic inline void drv_ipv6_addr_change(struct ieee80211_local *local,
10048c2ecf20Sopenharmony_ci					struct ieee80211_sub_if_data *sdata,
10058c2ecf20Sopenharmony_ci					struct inet6_dev *idev)
10068c2ecf20Sopenharmony_ci{
10078c2ecf20Sopenharmony_ci	trace_drv_ipv6_addr_change(local, sdata);
10088c2ecf20Sopenharmony_ci	if (local->ops->ipv6_addr_change)
10098c2ecf20Sopenharmony_ci		local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
10108c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
10118c2ecf20Sopenharmony_ci}
10128c2ecf20Sopenharmony_ci#endif
10138c2ecf20Sopenharmony_ci
10148c2ecf20Sopenharmony_cistatic inline void
10158c2ecf20Sopenharmony_cidrv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
10168c2ecf20Sopenharmony_ci			  struct cfg80211_chan_def *chandef)
10178c2ecf20Sopenharmony_ci{
10188c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
10198c2ecf20Sopenharmony_ci
10208c2ecf20Sopenharmony_ci	if (local->ops->channel_switch_beacon) {
10218c2ecf20Sopenharmony_ci		trace_drv_channel_switch_beacon(local, sdata, chandef);
10228c2ecf20Sopenharmony_ci		local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
10238c2ecf20Sopenharmony_ci						  chandef);
10248c2ecf20Sopenharmony_ci	}
10258c2ecf20Sopenharmony_ci}
10268c2ecf20Sopenharmony_ci
10278c2ecf20Sopenharmony_cistatic inline int
10288c2ecf20Sopenharmony_cidrv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
10298c2ecf20Sopenharmony_ci		       struct ieee80211_channel_switch *ch_switch)
10308c2ecf20Sopenharmony_ci{
10318c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
10328c2ecf20Sopenharmony_ci	int ret = 0;
10338c2ecf20Sopenharmony_ci
10348c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
10358c2ecf20Sopenharmony_ci		return -EIO;
10368c2ecf20Sopenharmony_ci
10378c2ecf20Sopenharmony_ci	trace_drv_pre_channel_switch(local, sdata, ch_switch);
10388c2ecf20Sopenharmony_ci	if (local->ops->pre_channel_switch)
10398c2ecf20Sopenharmony_ci		ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif,
10408c2ecf20Sopenharmony_ci						     ch_switch);
10418c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
10428c2ecf20Sopenharmony_ci	return ret;
10438c2ecf20Sopenharmony_ci}
10448c2ecf20Sopenharmony_ci
10458c2ecf20Sopenharmony_cistatic inline int
10468c2ecf20Sopenharmony_cidrv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
10478c2ecf20Sopenharmony_ci{
10488c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
10498c2ecf20Sopenharmony_ci	int ret = 0;
10508c2ecf20Sopenharmony_ci
10518c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
10528c2ecf20Sopenharmony_ci		return -EIO;
10538c2ecf20Sopenharmony_ci
10548c2ecf20Sopenharmony_ci	trace_drv_post_channel_switch(local, sdata);
10558c2ecf20Sopenharmony_ci	if (local->ops->post_channel_switch)
10568c2ecf20Sopenharmony_ci		ret = local->ops->post_channel_switch(&local->hw, &sdata->vif);
10578c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
10588c2ecf20Sopenharmony_ci	return ret;
10598c2ecf20Sopenharmony_ci}
10608c2ecf20Sopenharmony_ci
10618c2ecf20Sopenharmony_cistatic inline void
10628c2ecf20Sopenharmony_cidrv_abort_channel_switch(struct ieee80211_sub_if_data *sdata)
10638c2ecf20Sopenharmony_ci{
10648c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
10658c2ecf20Sopenharmony_ci
10668c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
10678c2ecf20Sopenharmony_ci		return;
10688c2ecf20Sopenharmony_ci
10698c2ecf20Sopenharmony_ci	trace_drv_abort_channel_switch(local, sdata);
10708c2ecf20Sopenharmony_ci
10718c2ecf20Sopenharmony_ci	if (local->ops->abort_channel_switch)
10728c2ecf20Sopenharmony_ci		local->ops->abort_channel_switch(&local->hw, &sdata->vif);
10738c2ecf20Sopenharmony_ci}
10748c2ecf20Sopenharmony_ci
10758c2ecf20Sopenharmony_cistatic inline void
10768c2ecf20Sopenharmony_cidrv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata,
10778c2ecf20Sopenharmony_ci			     struct ieee80211_channel_switch *ch_switch)
10788c2ecf20Sopenharmony_ci{
10798c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
10808c2ecf20Sopenharmony_ci
10818c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
10828c2ecf20Sopenharmony_ci		return;
10838c2ecf20Sopenharmony_ci
10848c2ecf20Sopenharmony_ci	trace_drv_channel_switch_rx_beacon(local, sdata, ch_switch);
10858c2ecf20Sopenharmony_ci	if (local->ops->channel_switch_rx_beacon)
10868c2ecf20Sopenharmony_ci		local->ops->channel_switch_rx_beacon(&local->hw, &sdata->vif,
10878c2ecf20Sopenharmony_ci						     ch_switch);
10888c2ecf20Sopenharmony_ci}
10898c2ecf20Sopenharmony_ci
10908c2ecf20Sopenharmony_cistatic inline int drv_join_ibss(struct ieee80211_local *local,
10918c2ecf20Sopenharmony_ci				struct ieee80211_sub_if_data *sdata)
10928c2ecf20Sopenharmony_ci{
10938c2ecf20Sopenharmony_ci	int ret = 0;
10948c2ecf20Sopenharmony_ci
10958c2ecf20Sopenharmony_ci	might_sleep();
10968c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
10978c2ecf20Sopenharmony_ci		return -EIO;
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci	trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf);
11008c2ecf20Sopenharmony_ci	if (local->ops->join_ibss)
11018c2ecf20Sopenharmony_ci		ret = local->ops->join_ibss(&local->hw, &sdata->vif);
11028c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
11038c2ecf20Sopenharmony_ci	return ret;
11048c2ecf20Sopenharmony_ci}
11058c2ecf20Sopenharmony_ci
11068c2ecf20Sopenharmony_cistatic inline void drv_leave_ibss(struct ieee80211_local *local,
11078c2ecf20Sopenharmony_ci				  struct ieee80211_sub_if_data *sdata)
11088c2ecf20Sopenharmony_ci{
11098c2ecf20Sopenharmony_ci	might_sleep();
11108c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
11118c2ecf20Sopenharmony_ci		return;
11128c2ecf20Sopenharmony_ci
11138c2ecf20Sopenharmony_ci	trace_drv_leave_ibss(local, sdata);
11148c2ecf20Sopenharmony_ci	if (local->ops->leave_ibss)
11158c2ecf20Sopenharmony_ci		local->ops->leave_ibss(&local->hw, &sdata->vif);
11168c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
11178c2ecf20Sopenharmony_ci}
11188c2ecf20Sopenharmony_ci
11198c2ecf20Sopenharmony_cistatic inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
11208c2ecf20Sopenharmony_ci					      struct sta_info *sta)
11218c2ecf20Sopenharmony_ci{
11228c2ecf20Sopenharmony_ci	u32 ret = 0;
11238c2ecf20Sopenharmony_ci
11248c2ecf20Sopenharmony_ci	trace_drv_get_expected_throughput(&sta->sta);
11258c2ecf20Sopenharmony_ci	if (local->ops->get_expected_throughput && sta->uploaded)
11268c2ecf20Sopenharmony_ci		ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
11278c2ecf20Sopenharmony_ci	trace_drv_return_u32(local, ret);
11288c2ecf20Sopenharmony_ci
11298c2ecf20Sopenharmony_ci	return ret;
11308c2ecf20Sopenharmony_ci}
11318c2ecf20Sopenharmony_ci
11328c2ecf20Sopenharmony_cistatic inline int drv_get_txpower(struct ieee80211_local *local,
11338c2ecf20Sopenharmony_ci				  struct ieee80211_sub_if_data *sdata, int *dbm)
11348c2ecf20Sopenharmony_ci{
11358c2ecf20Sopenharmony_ci	int ret;
11368c2ecf20Sopenharmony_ci
11378c2ecf20Sopenharmony_ci	if (!local->ops->get_txpower)
11388c2ecf20Sopenharmony_ci		return -EOPNOTSUPP;
11398c2ecf20Sopenharmony_ci
11408c2ecf20Sopenharmony_ci	ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm);
11418c2ecf20Sopenharmony_ci	trace_drv_get_txpower(local, sdata, *dbm, ret);
11428c2ecf20Sopenharmony_ci
11438c2ecf20Sopenharmony_ci	return ret;
11448c2ecf20Sopenharmony_ci}
11458c2ecf20Sopenharmony_ci
11468c2ecf20Sopenharmony_cistatic inline int
11478c2ecf20Sopenharmony_cidrv_tdls_channel_switch(struct ieee80211_local *local,
11488c2ecf20Sopenharmony_ci			struct ieee80211_sub_if_data *sdata,
11498c2ecf20Sopenharmony_ci			struct ieee80211_sta *sta, u8 oper_class,
11508c2ecf20Sopenharmony_ci			struct cfg80211_chan_def *chandef,
11518c2ecf20Sopenharmony_ci			struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie)
11528c2ecf20Sopenharmony_ci{
11538c2ecf20Sopenharmony_ci	int ret;
11548c2ecf20Sopenharmony_ci
11558c2ecf20Sopenharmony_ci	might_sleep();
11568c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
11578c2ecf20Sopenharmony_ci		return -EIO;
11588c2ecf20Sopenharmony_ci
11598c2ecf20Sopenharmony_ci	if (!local->ops->tdls_channel_switch)
11608c2ecf20Sopenharmony_ci		return -EOPNOTSUPP;
11618c2ecf20Sopenharmony_ci
11628c2ecf20Sopenharmony_ci	trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef);
11638c2ecf20Sopenharmony_ci	ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta,
11648c2ecf20Sopenharmony_ci					      oper_class, chandef, tmpl_skb,
11658c2ecf20Sopenharmony_ci					      ch_sw_tm_ie);
11668c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
11678c2ecf20Sopenharmony_ci	return ret;
11688c2ecf20Sopenharmony_ci}
11698c2ecf20Sopenharmony_ci
11708c2ecf20Sopenharmony_cistatic inline void
11718c2ecf20Sopenharmony_cidrv_tdls_cancel_channel_switch(struct ieee80211_local *local,
11728c2ecf20Sopenharmony_ci			       struct ieee80211_sub_if_data *sdata,
11738c2ecf20Sopenharmony_ci			       struct ieee80211_sta *sta)
11748c2ecf20Sopenharmony_ci{
11758c2ecf20Sopenharmony_ci	might_sleep();
11768c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
11778c2ecf20Sopenharmony_ci		return;
11788c2ecf20Sopenharmony_ci
11798c2ecf20Sopenharmony_ci	if (!local->ops->tdls_cancel_channel_switch)
11808c2ecf20Sopenharmony_ci		return;
11818c2ecf20Sopenharmony_ci
11828c2ecf20Sopenharmony_ci	trace_drv_tdls_cancel_channel_switch(local, sdata, sta);
11838c2ecf20Sopenharmony_ci	local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta);
11848c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
11858c2ecf20Sopenharmony_ci}
11868c2ecf20Sopenharmony_ci
11878c2ecf20Sopenharmony_cistatic inline void
11888c2ecf20Sopenharmony_cidrv_tdls_recv_channel_switch(struct ieee80211_local *local,
11898c2ecf20Sopenharmony_ci			     struct ieee80211_sub_if_data *sdata,
11908c2ecf20Sopenharmony_ci			     struct ieee80211_tdls_ch_sw_params *params)
11918c2ecf20Sopenharmony_ci{
11928c2ecf20Sopenharmony_ci	trace_drv_tdls_recv_channel_switch(local, sdata, params);
11938c2ecf20Sopenharmony_ci	if (local->ops->tdls_recv_channel_switch)
11948c2ecf20Sopenharmony_ci		local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif,
11958c2ecf20Sopenharmony_ci						     params);
11968c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
11978c2ecf20Sopenharmony_ci}
11988c2ecf20Sopenharmony_ci
11998c2ecf20Sopenharmony_cistatic inline void drv_wake_tx_queue(struct ieee80211_local *local,
12008c2ecf20Sopenharmony_ci				     struct txq_info *txq)
12018c2ecf20Sopenharmony_ci{
12028c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
12038c2ecf20Sopenharmony_ci
12048c2ecf20Sopenharmony_ci	/* In reconfig don't transmit now, but mark for waking later */
12058c2ecf20Sopenharmony_ci	if (local->in_reconfig) {
12068c2ecf20Sopenharmony_ci		set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags);
12078c2ecf20Sopenharmony_ci		return;
12088c2ecf20Sopenharmony_ci	}
12098c2ecf20Sopenharmony_ci
12108c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
12118c2ecf20Sopenharmony_ci		return;
12128c2ecf20Sopenharmony_ci
12138c2ecf20Sopenharmony_ci	trace_drv_wake_tx_queue(local, sdata, txq);
12148c2ecf20Sopenharmony_ci	local->ops->wake_tx_queue(&local->hw, &txq->txq);
12158c2ecf20Sopenharmony_ci}
12168c2ecf20Sopenharmony_ci
12178c2ecf20Sopenharmony_cistatic inline void schedule_and_wake_txq(struct ieee80211_local *local,
12188c2ecf20Sopenharmony_ci					 struct txq_info *txqi)
12198c2ecf20Sopenharmony_ci{
12208c2ecf20Sopenharmony_ci	ieee80211_schedule_txq(&local->hw, &txqi->txq);
12218c2ecf20Sopenharmony_ci	drv_wake_tx_queue(local, txqi);
12228c2ecf20Sopenharmony_ci}
12238c2ecf20Sopenharmony_ci
12248c2ecf20Sopenharmony_cistatic inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local,
12258c2ecf20Sopenharmony_ci					     struct sk_buff *head,
12268c2ecf20Sopenharmony_ci					     struct sk_buff *skb)
12278c2ecf20Sopenharmony_ci{
12288c2ecf20Sopenharmony_ci	if (!local->ops->can_aggregate_in_amsdu)
12298c2ecf20Sopenharmony_ci		return true;
12308c2ecf20Sopenharmony_ci
12318c2ecf20Sopenharmony_ci	return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb);
12328c2ecf20Sopenharmony_ci}
12338c2ecf20Sopenharmony_ci
12348c2ecf20Sopenharmony_cistatic inline int
12358c2ecf20Sopenharmony_cidrv_get_ftm_responder_stats(struct ieee80211_local *local,
12368c2ecf20Sopenharmony_ci			    struct ieee80211_sub_if_data *sdata,
12378c2ecf20Sopenharmony_ci			    struct cfg80211_ftm_responder_stats *ftm_stats)
12388c2ecf20Sopenharmony_ci{
12398c2ecf20Sopenharmony_ci	u32 ret = -EOPNOTSUPP;
12408c2ecf20Sopenharmony_ci
12418c2ecf20Sopenharmony_ci	if (local->ops->get_ftm_responder_stats)
12428c2ecf20Sopenharmony_ci		ret = local->ops->get_ftm_responder_stats(&local->hw,
12438c2ecf20Sopenharmony_ci							 &sdata->vif,
12448c2ecf20Sopenharmony_ci							 ftm_stats);
12458c2ecf20Sopenharmony_ci	trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats);
12468c2ecf20Sopenharmony_ci
12478c2ecf20Sopenharmony_ci	return ret;
12488c2ecf20Sopenharmony_ci}
12498c2ecf20Sopenharmony_ci
12508c2ecf20Sopenharmony_cistatic inline int drv_start_pmsr(struct ieee80211_local *local,
12518c2ecf20Sopenharmony_ci				 struct ieee80211_sub_if_data *sdata,
12528c2ecf20Sopenharmony_ci				 struct cfg80211_pmsr_request *request)
12538c2ecf20Sopenharmony_ci{
12548c2ecf20Sopenharmony_ci	int ret = -EOPNOTSUPP;
12558c2ecf20Sopenharmony_ci
12568c2ecf20Sopenharmony_ci	might_sleep();
12578c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
12588c2ecf20Sopenharmony_ci		return -EIO;
12598c2ecf20Sopenharmony_ci
12608c2ecf20Sopenharmony_ci	trace_drv_start_pmsr(local, sdata);
12618c2ecf20Sopenharmony_ci
12628c2ecf20Sopenharmony_ci	if (local->ops->start_pmsr)
12638c2ecf20Sopenharmony_ci		ret = local->ops->start_pmsr(&local->hw, &sdata->vif, request);
12648c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
12658c2ecf20Sopenharmony_ci
12668c2ecf20Sopenharmony_ci	return ret;
12678c2ecf20Sopenharmony_ci}
12688c2ecf20Sopenharmony_ci
12698c2ecf20Sopenharmony_cistatic inline void drv_abort_pmsr(struct ieee80211_local *local,
12708c2ecf20Sopenharmony_ci				  struct ieee80211_sub_if_data *sdata,
12718c2ecf20Sopenharmony_ci				  struct cfg80211_pmsr_request *request)
12728c2ecf20Sopenharmony_ci{
12738c2ecf20Sopenharmony_ci	trace_drv_abort_pmsr(local, sdata);
12748c2ecf20Sopenharmony_ci
12758c2ecf20Sopenharmony_ci	might_sleep();
12768c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
12778c2ecf20Sopenharmony_ci		return;
12788c2ecf20Sopenharmony_ci
12798c2ecf20Sopenharmony_ci	if (local->ops->abort_pmsr)
12808c2ecf20Sopenharmony_ci		local->ops->abort_pmsr(&local->hw, &sdata->vif, request);
12818c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
12828c2ecf20Sopenharmony_ci}
12838c2ecf20Sopenharmony_ci
12848c2ecf20Sopenharmony_cistatic inline int drv_start_nan(struct ieee80211_local *local,
12858c2ecf20Sopenharmony_ci				struct ieee80211_sub_if_data *sdata,
12868c2ecf20Sopenharmony_ci				struct cfg80211_nan_conf *conf)
12878c2ecf20Sopenharmony_ci{
12888c2ecf20Sopenharmony_ci	int ret;
12898c2ecf20Sopenharmony_ci
12908c2ecf20Sopenharmony_ci	might_sleep();
12918c2ecf20Sopenharmony_ci	check_sdata_in_driver(sdata);
12928c2ecf20Sopenharmony_ci
12938c2ecf20Sopenharmony_ci	trace_drv_start_nan(local, sdata, conf);
12948c2ecf20Sopenharmony_ci	ret = local->ops->start_nan(&local->hw, &sdata->vif, conf);
12958c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
12968c2ecf20Sopenharmony_ci	return ret;
12978c2ecf20Sopenharmony_ci}
12988c2ecf20Sopenharmony_ci
12998c2ecf20Sopenharmony_cistatic inline void drv_stop_nan(struct ieee80211_local *local,
13008c2ecf20Sopenharmony_ci				struct ieee80211_sub_if_data *sdata)
13018c2ecf20Sopenharmony_ci{
13028c2ecf20Sopenharmony_ci	might_sleep();
13038c2ecf20Sopenharmony_ci	check_sdata_in_driver(sdata);
13048c2ecf20Sopenharmony_ci
13058c2ecf20Sopenharmony_ci	trace_drv_stop_nan(local, sdata);
13068c2ecf20Sopenharmony_ci	local->ops->stop_nan(&local->hw, &sdata->vif);
13078c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
13088c2ecf20Sopenharmony_ci}
13098c2ecf20Sopenharmony_ci
13108c2ecf20Sopenharmony_cistatic inline int drv_nan_change_conf(struct ieee80211_local *local,
13118c2ecf20Sopenharmony_ci				       struct ieee80211_sub_if_data *sdata,
13128c2ecf20Sopenharmony_ci				       struct cfg80211_nan_conf *conf,
13138c2ecf20Sopenharmony_ci				       u32 changes)
13148c2ecf20Sopenharmony_ci{
13158c2ecf20Sopenharmony_ci	int ret;
13168c2ecf20Sopenharmony_ci
13178c2ecf20Sopenharmony_ci	might_sleep();
13188c2ecf20Sopenharmony_ci	check_sdata_in_driver(sdata);
13198c2ecf20Sopenharmony_ci
13208c2ecf20Sopenharmony_ci	if (!local->ops->nan_change_conf)
13218c2ecf20Sopenharmony_ci		return -EOPNOTSUPP;
13228c2ecf20Sopenharmony_ci
13238c2ecf20Sopenharmony_ci	trace_drv_nan_change_conf(local, sdata, conf, changes);
13248c2ecf20Sopenharmony_ci	ret = local->ops->nan_change_conf(&local->hw, &sdata->vif, conf,
13258c2ecf20Sopenharmony_ci					  changes);
13268c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
13278c2ecf20Sopenharmony_ci
13288c2ecf20Sopenharmony_ci	return ret;
13298c2ecf20Sopenharmony_ci}
13308c2ecf20Sopenharmony_ci
13318c2ecf20Sopenharmony_cistatic inline int drv_add_nan_func(struct ieee80211_local *local,
13328c2ecf20Sopenharmony_ci				   struct ieee80211_sub_if_data *sdata,
13338c2ecf20Sopenharmony_ci				   const struct cfg80211_nan_func *nan_func)
13348c2ecf20Sopenharmony_ci{
13358c2ecf20Sopenharmony_ci	int ret;
13368c2ecf20Sopenharmony_ci
13378c2ecf20Sopenharmony_ci	might_sleep();
13388c2ecf20Sopenharmony_ci	check_sdata_in_driver(sdata);
13398c2ecf20Sopenharmony_ci
13408c2ecf20Sopenharmony_ci	if (!local->ops->add_nan_func)
13418c2ecf20Sopenharmony_ci		return -EOPNOTSUPP;
13428c2ecf20Sopenharmony_ci
13438c2ecf20Sopenharmony_ci	trace_drv_add_nan_func(local, sdata, nan_func);
13448c2ecf20Sopenharmony_ci	ret = local->ops->add_nan_func(&local->hw, &sdata->vif, nan_func);
13458c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
13468c2ecf20Sopenharmony_ci
13478c2ecf20Sopenharmony_ci	return ret;
13488c2ecf20Sopenharmony_ci}
13498c2ecf20Sopenharmony_ci
13508c2ecf20Sopenharmony_cistatic inline void drv_del_nan_func(struct ieee80211_local *local,
13518c2ecf20Sopenharmony_ci				   struct ieee80211_sub_if_data *sdata,
13528c2ecf20Sopenharmony_ci				   u8 instance_id)
13538c2ecf20Sopenharmony_ci{
13548c2ecf20Sopenharmony_ci	might_sleep();
13558c2ecf20Sopenharmony_ci	check_sdata_in_driver(sdata);
13568c2ecf20Sopenharmony_ci
13578c2ecf20Sopenharmony_ci	trace_drv_del_nan_func(local, sdata, instance_id);
13588c2ecf20Sopenharmony_ci	if (local->ops->del_nan_func)
13598c2ecf20Sopenharmony_ci		local->ops->del_nan_func(&local->hw, &sdata->vif, instance_id);
13608c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
13618c2ecf20Sopenharmony_ci}
13628c2ecf20Sopenharmony_ci
13638c2ecf20Sopenharmony_cistatic inline int drv_set_tid_config(struct ieee80211_local *local,
13648c2ecf20Sopenharmony_ci				     struct ieee80211_sub_if_data *sdata,
13658c2ecf20Sopenharmony_ci				     struct ieee80211_sta *sta,
13668c2ecf20Sopenharmony_ci				     struct cfg80211_tid_config *tid_conf)
13678c2ecf20Sopenharmony_ci{
13688c2ecf20Sopenharmony_ci	int ret;
13698c2ecf20Sopenharmony_ci
13708c2ecf20Sopenharmony_ci	might_sleep();
13718c2ecf20Sopenharmony_ci	ret = local->ops->set_tid_config(&local->hw, &sdata->vif, sta,
13728c2ecf20Sopenharmony_ci					 tid_conf);
13738c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
13748c2ecf20Sopenharmony_ci
13758c2ecf20Sopenharmony_ci	return ret;
13768c2ecf20Sopenharmony_ci}
13778c2ecf20Sopenharmony_ci
13788c2ecf20Sopenharmony_cistatic inline int drv_reset_tid_config(struct ieee80211_local *local,
13798c2ecf20Sopenharmony_ci				       struct ieee80211_sub_if_data *sdata,
13808c2ecf20Sopenharmony_ci				       struct ieee80211_sta *sta, u8 tids)
13818c2ecf20Sopenharmony_ci{
13828c2ecf20Sopenharmony_ci	int ret;
13838c2ecf20Sopenharmony_ci
13848c2ecf20Sopenharmony_ci	might_sleep();
13858c2ecf20Sopenharmony_ci	ret = local->ops->reset_tid_config(&local->hw, &sdata->vif, sta, tids);
13868c2ecf20Sopenharmony_ci	trace_drv_return_int(local, ret);
13878c2ecf20Sopenharmony_ci
13888c2ecf20Sopenharmony_ci	return ret;
13898c2ecf20Sopenharmony_ci}
13908c2ecf20Sopenharmony_ci
13918c2ecf20Sopenharmony_cistatic inline void drv_update_vif_offload(struct ieee80211_local *local,
13928c2ecf20Sopenharmony_ci					  struct ieee80211_sub_if_data *sdata)
13938c2ecf20Sopenharmony_ci{
13948c2ecf20Sopenharmony_ci	might_sleep();
13958c2ecf20Sopenharmony_ci	check_sdata_in_driver(sdata);
13968c2ecf20Sopenharmony_ci
13978c2ecf20Sopenharmony_ci	if (!local->ops->update_vif_offload)
13988c2ecf20Sopenharmony_ci		return;
13998c2ecf20Sopenharmony_ci
14008c2ecf20Sopenharmony_ci	trace_drv_update_vif_offload(local, sdata);
14018c2ecf20Sopenharmony_ci	local->ops->update_vif_offload(&local->hw, &sdata->vif);
14028c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
14038c2ecf20Sopenharmony_ci}
14048c2ecf20Sopenharmony_ci
14058c2ecf20Sopenharmony_cistatic inline void drv_sta_set_4addr(struct ieee80211_local *local,
14068c2ecf20Sopenharmony_ci				     struct ieee80211_sub_if_data *sdata,
14078c2ecf20Sopenharmony_ci				     struct ieee80211_sta *sta, bool enabled)
14088c2ecf20Sopenharmony_ci{
14098c2ecf20Sopenharmony_ci	sdata = get_bss_sdata(sdata);
14108c2ecf20Sopenharmony_ci	if (!check_sdata_in_driver(sdata))
14118c2ecf20Sopenharmony_ci		return;
14128c2ecf20Sopenharmony_ci
14138c2ecf20Sopenharmony_ci	trace_drv_sta_set_4addr(local, sdata, sta, enabled);
14148c2ecf20Sopenharmony_ci	if (local->ops->sta_set_4addr)
14158c2ecf20Sopenharmony_ci		local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled);
14168c2ecf20Sopenharmony_ci	trace_drv_return_void(local);
14178c2ecf20Sopenharmony_ci}
14188c2ecf20Sopenharmony_ci
14198c2ecf20Sopenharmony_ci#endif /* __MAC80211_DRIVER_OPS */
1420