mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 08:36:12 -04:00
qcacld-3.0: Implement vendor command to restart SAP on some channel
qcacld-2.0 to qcacld-3.0 propagation Add support for vendor command which will do restart of the SAP on desirable channel. QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG is used to send driver to restart SAP device on some other channel. Upon receiving this command, driver will do __hdd_hostapd_stop and will disable all queues. After that WLANSAP_StartBss start SAP on user config channel. Change-Id: I34d4e4f758ca7e010ae198af31d9fc3777973b22 CRs-Fixed: 1000593
This commit is contained in:
parent
5b733215c9
commit
c9ddbabf76
3 changed files with 149 additions and 0 deletions
|
|
@ -1670,6 +1670,15 @@ static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
|
|||
struct net_device *wlan_dev){}
|
||||
#endif /* FEATURE_TSO */
|
||||
|
||||
#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
|
||||
defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
|
||||
void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter);
|
||||
#else
|
||||
static inline void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_FEATURE_ROAM_OFFLOAD
|
||||
static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5359,6 +5359,119 @@ void hdd_init_bpf_completion(void)
|
|||
init_completion(&bpf_context.completion);
|
||||
}
|
||||
|
||||
static const struct nla_policy
|
||||
wlan_hdd_sap_config_policy[QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX + 1] = {
|
||||
[QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHANNEL] = {.type = NLA_U8 },
|
||||
};
|
||||
|
||||
/**
|
||||
* __wlan_hdd_cfg80211_sap_configuration_set() - ask driver to restart SAP if
|
||||
* SAP is on unsafe channel.
|
||||
* @wiphy: wiphy structure pointer
|
||||
* @wdev: Wireless device structure pointer
|
||||
* @data: Pointer to the data received
|
||||
* @data_len: Length of @data
|
||||
*
|
||||
* __wlan_hdd_cfg80211_sap_configuration_set function set SAP params to
|
||||
* driver.
|
||||
* QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHAN will set sap config channel and
|
||||
* will initiate restart of sap.
|
||||
*
|
||||
* Return: 0 on success; errno on failure
|
||||
*/
|
||||
static int
|
||||
__wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
const void *data, int data_len)
|
||||
{
|
||||
struct net_device *ndev = wdev->netdev;
|
||||
hdd_adapter_t *hostapd_adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
|
||||
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX + 1];
|
||||
uint8_t config_channel = 0;
|
||||
hdd_ap_ctx_t *ap_ctx;
|
||||
int ret;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
|
||||
hddLog(LOGE, FL("Command not allowed in FTM mode"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (0 != ret)
|
||||
return -EINVAL;
|
||||
|
||||
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX,
|
||||
data, data_len,
|
||||
wlan_hdd_sap_config_policy)) {
|
||||
hddLog(LOGE, FL("invalid attr"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (tb[QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHANNEL]) {
|
||||
if (!test_bit(SOFTAP_BSS_STARTED,
|
||||
&hostapd_adapter->event_flags)) {
|
||||
hdd_err("SAP is not started yet. Restart sap will be invalid");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
config_channel =
|
||||
nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHANNEL]);
|
||||
|
||||
if (!((IS_24G_CH(config_channel)) ||
|
||||
(IS_5G_CH(config_channel)))) {
|
||||
hdd_err("Channel %d is not valid to restart SAP",
|
||||
config_channel);
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(hostapd_adapter);
|
||||
ap_ctx->sapConfig.channel = config_channel;
|
||||
ap_ctx->sapConfig.ch_params.ch_width =
|
||||
ap_ctx->sapConfig.ch_width_orig;
|
||||
|
||||
sme_set_ch_params(hdd_ctx->hHal,
|
||||
ap_ctx->sapConfig.SapHw_mode,
|
||||
ap_ctx->sapConfig.channel,
|
||||
ap_ctx->sapConfig.sec_ch,
|
||||
&ap_ctx->sapConfig.ch_params);
|
||||
|
||||
cds_restart_sap(hostapd_adapter);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_hdd_cfg80211_sap_configuration_set() - sap configuration vendor command
|
||||
* @wiphy: wiphy structure pointer
|
||||
* @wdev: Wireless device structure pointer
|
||||
* @data: Pointer to the data received
|
||||
* @data_len: Length of @data
|
||||
*
|
||||
* __wlan_hdd_cfg80211_sap_configuration_set function set SAP params to
|
||||
* driver.
|
||||
* QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHAN will set sap config channel and
|
||||
* will initiate restart of sap.
|
||||
*
|
||||
* Return: 0 on success; errno on failure
|
||||
*/
|
||||
static int wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
const void *data, int data_len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wlan_hdd_cfg80211_sap_configuration_set(wiphy,
|
||||
wdev, data, data_len);
|
||||
cds_ssr_unprotect(__func__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef BPF_INVALID
|
||||
#undef BPF_SET_RESET
|
||||
#undef BPF_VERSION
|
||||
|
|
@ -5845,6 +5958,15 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
|
|||
WIPHY_VENDOR_CMD_NEED_RUNNING,
|
||||
.doit = wlan_hdd_cfg80211_bpf_offload
|
||||
},
|
||||
{
|
||||
.info.vendor_id = QCA_NL80211_VENDOR_ID,
|
||||
.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG,
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
|
||||
WIPHY_VENDOR_CMD_NEED_NETDEV |
|
||||
WIPHY_VENDOR_CMD_NEED_RUNNING,
|
||||
.doit = wlan_hdd_cfg80211_sap_configuration_set
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -258,6 +258,7 @@ typedef enum {
|
|||
* @QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG: set gateway parameters
|
||||
* @QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE: set tx power by percentage
|
||||
* @QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE_DECR_DB: reduce tx power by DB
|
||||
* @QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG: SAP configuration
|
||||
* @QCA_NL80211_VENDOR_SUBCMD_TSF: TSF operations command
|
||||
* @QCA_NL80211_VENDOR_SUBCMD_WISA: WISA mode configuration
|
||||
*/
|
||||
|
|
@ -379,6 +380,7 @@ enum qca_nl80211_vendor_subcmds {
|
|||
QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE = 109,
|
||||
/* Tx power scaling in db subcommands */
|
||||
QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE_DECR_DB = 115,
|
||||
QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG = 118,
|
||||
QCA_NL80211_VENDOR_SUBCMD_TSF = 119,
|
||||
QCA_NL80211_VENDOR_SUBCMD_WISA = 120,
|
||||
};
|
||||
|
|
@ -2357,6 +2359,22 @@ enum qca_vendor_attr_txpower_scale_decr_db {
|
|||
QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
/**
|
||||
* enum qca_wlan_vendor_attr_sap_config - config params for sap configuration
|
||||
* @QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_INVALID: invalid
|
||||
* @QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHANNEL: Channel on which SAP should start
|
||||
* @QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_AFTER_LAST: after last
|
||||
* @QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX: max attribute
|
||||
*/
|
||||
enum qca_wlan_vendor_attr_sap_config {
|
||||
QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_INVALID = 0,
|
||||
QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHANNEL,
|
||||
/* keep last */
|
||||
QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_AFTER_LAST,
|
||||
QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX =
|
||||
QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_AFTER_LAST - 1,
|
||||
};
|
||||
|
||||
struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_db(hdd_adapter_t *pAdapter,
|
||||
tCsrRoamInfo *pRoamInfo);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue