qcacld-3.0: Refine the extscan set epno logic
Make the following updates to the extscan set epno logic: 1) Exclusively use the Unified WMI data structures. 2) Refactor the vendor command processing to improve code maintainability. Change-Id: I8179fd9b9acced01956232f113d656e0137231b5 CRs-Fixed: 2333537
This commit is contained in:
@@ -3625,98 +3625,117 @@ int wlan_hdd_cfg80211_extscan_reset_significant_change(struct wiphy *wiphy,
|
||||
|
||||
|
||||
/**
|
||||
* hdd_extscan_epno_fill_network_list() - epno fill network list
|
||||
* @hddctx: HDD context
|
||||
* @req_msg: request message
|
||||
* @tb: vendor attribute table
|
||||
* hdd_extscan_epno_fill_network() - epno fill single network
|
||||
* @network: aggregate network attribute
|
||||
* @nw: epno network record to be filled
|
||||
*
|
||||
* This function reads the network block NL vendor attributes from %tb and
|
||||
* fill in the epno request message.
|
||||
* This function takes a single network block NL vendor attribute from
|
||||
* @network and decodes it into the internal record @nw.
|
||||
*
|
||||
* Return: 0 on success, error number otherwise
|
||||
*/
|
||||
static int hdd_extscan_epno_fill_network_list(
|
||||
struct hdd_context *hddctx,
|
||||
struct wifi_epno_params *req_msg,
|
||||
struct nlattr **tb)
|
||||
static int
|
||||
hdd_extscan_epno_fill_network(struct nlattr *network,
|
||||
struct wifi_epno_network_params *nw)
|
||||
{
|
||||
struct nlattr *network[QCA_WLAN_VENDOR_ATTR_PNO_MAX + 1];
|
||||
struct nlattr *networks;
|
||||
int rem1, ssid_len;
|
||||
uint8_t index, *ssid;
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_PNO_MAX + 1];
|
||||
int id, ssid_len;
|
||||
uint8_t *ssid;
|
||||
|
||||
if (!network) {
|
||||
hdd_err("attr network attr failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (wlan_cfg80211_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_PNO_MAX,
|
||||
nla_data(network),
|
||||
nla_len(network),
|
||||
wlan_hdd_pno_config_policy)) {
|
||||
hdd_err("nla_parse failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Parse and fetch ssid */
|
||||
id = QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_SSID;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr network ssid failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
ssid_len = nla_len(tb[id]);
|
||||
|
||||
/* nla_parse will detect overflow but not underflow */
|
||||
if (0 == ssid_len) {
|
||||
hdd_err("zero ssid length");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Decrement by 1, don't count null character */
|
||||
ssid_len--;
|
||||
|
||||
nw->ssid.length = ssid_len;
|
||||
hdd_debug("network ssid length %d", ssid_len);
|
||||
ssid = nla_data(tb[id]);
|
||||
qdf_mem_copy(nw->ssid.mac_ssid, ssid, ssid_len);
|
||||
hdd_debug("Ssid (%.*s)", nw->ssid.length, nw->ssid.mac_ssid);
|
||||
|
||||
/* Parse and fetch epno flags */
|
||||
id = QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_FLAGS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr epno flags failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
nw->flags = nla_get_u8(tb[id]);
|
||||
hdd_debug("flags %u", nw->flags);
|
||||
|
||||
/* Parse and fetch auth bit */
|
||||
id = QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_AUTH_BIT;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr auth bit failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
nw->auth_bit_field = nla_get_u8(tb[id]);
|
||||
hdd_debug("auth bit %u", nw->auth_bit_field);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_extscan_epno_fill_network_list() - epno fill network list
|
||||
* @req_msg: request message
|
||||
* @networks: aggregate network list attribute
|
||||
*
|
||||
* This function reads the network block NL vendor attributes from
|
||||
* @networks and fills in the epno request message @req_msg.
|
||||
*
|
||||
* Return: 0 on success, error number otherwise
|
||||
*/
|
||||
static int
|
||||
hdd_extscan_epno_fill_network_list(struct wifi_enhanced_pno_params *req_msg,
|
||||
struct nlattr *networks)
|
||||
{
|
||||
struct nlattr *network;
|
||||
int rem;
|
||||
uint32_t index;
|
||||
uint32_t expected_networks;
|
||||
struct wifi_epno_network_params *nw;
|
||||
|
||||
if (!networks) {
|
||||
hdd_err("attr networks list failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
expected_networks = req_msg->num_networks;
|
||||
index = 0;
|
||||
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORKS_LIST]) {
|
||||
hdd_err("attr networks list failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
nla_for_each_nested(networks,
|
||||
tb[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORKS_LIST],
|
||||
rem1) {
|
||||
|
||||
nla_for_each_nested(network, networks, rem) {
|
||||
if (index == expected_networks) {
|
||||
hdd_warn("ignoring excess networks");
|
||||
break;
|
||||
}
|
||||
|
||||
if (wlan_cfg80211_nla_parse(network,
|
||||
QCA_WLAN_VENDOR_ATTR_PNO_MAX,
|
||||
nla_data(networks),
|
||||
nla_len(networks),
|
||||
wlan_hdd_pno_config_policy)) {
|
||||
hdd_err("nla_parse failed");
|
||||
nw = &req_msg->networks[index++];
|
||||
if (hdd_extscan_epno_fill_network(network, nw))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Parse and fetch ssid */
|
||||
if (!network[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_SSID]) {
|
||||
hdd_err("attr network ssid failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
ssid_len = nla_len(
|
||||
network[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_SSID]);
|
||||
|
||||
/* nla_parse will detect overflow but not underflow */
|
||||
if (0 == ssid_len) {
|
||||
hdd_err("zero ssid length");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Decrement by 1, don't count null character */
|
||||
ssid_len--;
|
||||
|
||||
req_msg->networks[index].ssid.length = ssid_len;
|
||||
hdd_debug("network ssid length %d", ssid_len);
|
||||
ssid = nla_data(network[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_SSID]);
|
||||
qdf_mem_copy(req_msg->networks[index].ssid.ssId,
|
||||
ssid, ssid_len);
|
||||
hdd_debug("Ssid (%.*s)",
|
||||
req_msg->networks[index].ssid.length,
|
||||
req_msg->networks[index].ssid.ssId);
|
||||
|
||||
/* Parse and fetch epno flags */
|
||||
if (!network[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_FLAGS]) {
|
||||
hdd_err("attr epno flags failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->networks[index].flags = nla_get_u8(
|
||||
network[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_FLAGS]);
|
||||
hdd_debug("flags %u", req_msg->networks[index].flags);
|
||||
|
||||
/* Parse and fetch auth bit */
|
||||
if (!network[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_AUTH_BIT]) {
|
||||
hdd_err("attr auth bit failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->networks[index].auth_bit_field = nla_get_u8(
|
||||
network[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_AUTH_BIT]);
|
||||
hdd_debug("auth bit %u",
|
||||
req_msg->networks[index].auth_bit_field);
|
||||
|
||||
index++;
|
||||
}
|
||||
req_msg->num_networks = index;
|
||||
return 0;
|
||||
@@ -3729,8 +3748,8 @@ static int hdd_extscan_epno_fill_network_list(
|
||||
* @data: data pointer
|
||||
* @data_len: data length
|
||||
*
|
||||
* This function reads the NL vendor attributes from %tb and
|
||||
* fill in the epno request message.
|
||||
* This function reads the NL vendor attributes from @data and
|
||||
* fills in the epno request message.
|
||||
*
|
||||
* Return: 0 on success, error number otherwise
|
||||
*/
|
||||
@@ -3739,15 +3758,15 @@ static int __wlan_hdd_cfg80211_set_epno_list(struct wiphy *wiphy,
|
||||
const void *data,
|
||||
int data_len)
|
||||
{
|
||||
struct wifi_epno_params *req_msg = NULL;
|
||||
struct net_device *dev = wdev->netdev;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
||||
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
|
||||
struct nlattr *tb[
|
||||
QCA_WLAN_VENDOR_ATTR_PNO_MAX + 1];
|
||||
struct wifi_enhanced_pno_params *req_msg;
|
||||
struct net_device *dev = wdev->netdev;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
||||
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_PNO_MAX + 1];
|
||||
struct nlattr *networks;
|
||||
QDF_STATUS status;
|
||||
uint32_t num_networks, len;
|
||||
int ret_val;
|
||||
int id, ret_val;
|
||||
|
||||
hdd_enter_dev(dev);
|
||||
|
||||
@@ -3772,7 +3791,8 @@ static int __wlan_hdd_cfg80211_set_epno_list(struct wiphy *wiphy,
|
||||
}
|
||||
|
||||
/* Parse and fetch number of networks */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_NUM_NETWORKS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_NUM_NETWORKS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr num networks failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -3781,8 +3801,7 @@ static int __wlan_hdd_cfg80211_set_epno_list(struct wiphy *wiphy,
|
||||
* num_networks is also used as EPNO SET/RESET request.
|
||||
* if num_networks is zero then it is treated as RESET.
|
||||
*/
|
||||
num_networks = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_NUM_NETWORKS]);
|
||||
num_networks = nla_get_u32(tb[id]);
|
||||
|
||||
if (num_networks > MAX_EPNO_NETWORKS) {
|
||||
hdd_debug("num of nw: %d exceeded max: %d, resetting to: %d",
|
||||
@@ -3792,7 +3811,7 @@ static int __wlan_hdd_cfg80211_set_epno_list(struct wiphy *wiphy,
|
||||
|
||||
hdd_debug("num networks %u", num_networks);
|
||||
len = sizeof(*req_msg) +
|
||||
(num_networks * sizeof(struct wifi_epno_network));
|
||||
(num_networks * sizeof(req_msg->networks[0]));
|
||||
|
||||
req_msg = qdf_mem_malloc(len);
|
||||
if (!req_msg) {
|
||||
@@ -3802,75 +3821,73 @@ static int __wlan_hdd_cfg80211_set_epno_list(struct wiphy *wiphy,
|
||||
req_msg->num_networks = num_networks;
|
||||
|
||||
/* Parse and fetch request Id */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_PNO_CONFIG_REQUEST_ID]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_PNO_CONFIG_REQUEST_ID;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr request id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->request_id = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_PNO_CONFIG_REQUEST_ID]);
|
||||
req_msg->request_id = nla_get_u32(tb[id]);
|
||||
hdd_debug("Req Id %u", req_msg->request_id);
|
||||
|
||||
req_msg->session_id = adapter->session_id;
|
||||
hdd_debug("Session Id %d", req_msg->session_id);
|
||||
req_msg->vdev_id = adapter->session_id;
|
||||
hdd_debug("Vdev Id %d", req_msg->vdev_id);
|
||||
|
||||
if (num_networks) {
|
||||
|
||||
/* Parse and fetch min_5ghz_rssi */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EPNO_MIN5GHZ_RSSI]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EPNO_MIN5GHZ_RSSI;
|
||||
if (!tb[id]) {
|
||||
hdd_err("min_5ghz_rssi id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->min_5ghz_rssi = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EPNO_MIN5GHZ_RSSI]);
|
||||
req_msg->min_5ghz_rssi = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch min_24ghz_rssi */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EPNO_MIN24GHZ_RSSI]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EPNO_MIN24GHZ_RSSI;
|
||||
if (!tb[id]) {
|
||||
hdd_err("min_24ghz_rssi id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->min_24ghz_rssi = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EPNO_MIN24GHZ_RSSI]);
|
||||
req_msg->min_24ghz_rssi = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch initial_score_max */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EPNO_INITIAL_SCORE_MAX]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EPNO_INITIAL_SCORE_MAX;
|
||||
if (!tb[id]) {
|
||||
hdd_err("initial_score_max id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->initial_score_max = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EPNO_INITIAL_SCORE_MAX]);
|
||||
req_msg->initial_score_max = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch current_connection_bonus */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EPNO_CURRENT_CONNECTION_BONUS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EPNO_CURRENT_CONNECTION_BONUS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("current_connection_bonus id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->current_connection_bonus = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EPNO_CURRENT_CONNECTION_BONUS]
|
||||
);
|
||||
req_msg->current_connection_bonus = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch same_network_bonus */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EPNO_SAME_NETWORK_BONUS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EPNO_SAME_NETWORK_BONUS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("same_network_bonus id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->same_network_bonus = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EPNO_SAME_NETWORK_BONUS]);
|
||||
req_msg->same_network_bonus = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch secure_bonus */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EPNO_SECURE_BONUS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EPNO_SECURE_BONUS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("secure_bonus id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->secure_bonus = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EPNO_SECURE_BONUS]);
|
||||
req_msg->secure_bonus = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch band_5ghz_bonus */
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EPNO_BAND5GHZ_BONUS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EPNO_BAND5GHZ_BONUS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("band_5ghz_bonus id failed");
|
||||
goto fail;
|
||||
}
|
||||
req_msg->band_5ghz_bonus = nla_get_u32(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EPNO_BAND5GHZ_BONUS]);
|
||||
req_msg->band_5ghz_bonus = nla_get_u32(tb[id]);
|
||||
|
||||
hdd_debug("min_5ghz_rssi: %d min_24ghz_rssi: %d",
|
||||
req_msg->min_5ghz_rssi,
|
||||
@@ -3883,7 +3900,9 @@ static int __wlan_hdd_cfg80211_set_epno_list(struct wiphy *wiphy,
|
||||
req_msg->secure_bonus,
|
||||
req_msg->band_5ghz_bonus);
|
||||
|
||||
if (hdd_extscan_epno_fill_network_list(hdd_ctx, req_msg, tb))
|
||||
id = QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORKS_LIST;
|
||||
networks = tb[id];
|
||||
if (hdd_extscan_epno_fill_network_list(req_msg, networks))
|
||||
goto fail;
|
||||
|
||||
}
|
||||
|
@@ -4210,47 +4210,6 @@ typedef struct {
|
||||
|
||||
#define MAX_EPNO_NETWORKS 64
|
||||
|
||||
/**
|
||||
* struct wifi_epno_network - enhanced pno network block
|
||||
* @ssid: ssid
|
||||
* @flags: WIFI_PNO_FLAG_XXX
|
||||
* @auth_bit_field: auth bit field for matching WPA IE
|
||||
*/
|
||||
struct wifi_epno_network {
|
||||
tSirMacSSid ssid;
|
||||
uint8_t flags;
|
||||
uint8_t auth_bit_field;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wifi_epno_params - enhanced pno network params
|
||||
* @request_id: request id number
|
||||
* @session_id: session_id number
|
||||
* @min_5ghz_rssi: minimum 5GHz RSSI for a BSSID to be considered
|
||||
* @min_24ghz_rssi: minimum 2.4GHz RSSI for a BSSID to be considered
|
||||
* @initial_score_max: maximum score that a network can have before bonuses
|
||||
* @current_connection_bonus: only report when there is a network's score this
|
||||
* much higher than the current connection
|
||||
* @same_network_bonus: score bonus for all n/w with the same network flag
|
||||
* @secure_bonus: score bonus for networks that are not open
|
||||
* @band_5ghz_bonus: 5GHz RSSI score bonus (applied to all 5GHz networks)
|
||||
* @num_networks: number of ssids
|
||||
* @networks: EPNO networks
|
||||
*/
|
||||
struct wifi_epno_params {
|
||||
uint32_t request_id;
|
||||
uint32_t session_id;
|
||||
uint32_t min_5ghz_rssi;
|
||||
uint32_t min_24ghz_rssi;
|
||||
uint32_t initial_score_max;
|
||||
uint32_t current_connection_bonus;
|
||||
uint32_t same_network_bonus;
|
||||
uint32_t secure_bonus;
|
||||
uint32_t band_5ghz_bonus;
|
||||
uint32_t num_networks;
|
||||
struct wifi_epno_network networks[];
|
||||
};
|
||||
|
||||
#define SIR_PASSPOINT_LIST_MAX_NETWORKS 8
|
||||
#define SIR_PASSPOINT_REALM_LEN 256
|
||||
#define SIR_PASSPOINT_ROAMING_CONSORTIUM_ID_NUM 16
|
||||
|
@@ -1081,8 +1081,18 @@ QDF_STATUS
|
||||
sme_get_cached_results(mac_handle_t mac_handle,
|
||||
struct extscan_cached_result_params *params);
|
||||
|
||||
QDF_STATUS sme_set_epno_list(tHalHandle hal,
|
||||
struct wifi_epno_params *req_msg);
|
||||
/**
|
||||
* sme_set_epno_list() - set epno network list
|
||||
* @mac_handle: Opaque handle to the MAC context
|
||||
* @params: request message
|
||||
*
|
||||
* This function sends an Enhanced PNO configuration to firmware.
|
||||
*
|
||||
* Return: QDF_STATUS enumeration
|
||||
*/
|
||||
QDF_STATUS sme_set_epno_list(mac_handle_t mac_handle,
|
||||
struct wifi_enhanced_pno_params *params);
|
||||
|
||||
QDF_STATUS sme_set_passpoint_list(tHalHandle hal,
|
||||
struct wifi_passpoint_req *req_msg);
|
||||
QDF_STATUS sme_reset_passpoint_list(tHalHandle hal,
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOC: smeApi.c
|
||||
* DOC: sme_api.c
|
||||
*
|
||||
* Definitions for SME APIs
|
||||
*/
|
||||
@@ -11349,59 +11349,25 @@ sme_get_cached_results(mac_handle_t mac_handle,
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* sme_set_epno_list() - set epno network list
|
||||
* @hal: global hal handle
|
||||
* @input: request message
|
||||
*
|
||||
* This function constructs the cds message and fill in message type,
|
||||
* bodyptr with %input and posts it to WDA queue.
|
||||
*
|
||||
* Return: QDF_STATUS enumeration
|
||||
*/
|
||||
QDF_STATUS sme_set_epno_list(tHalHandle hal,
|
||||
struct wifi_epno_params *input)
|
||||
QDF_STATUS sme_set_epno_list(mac_handle_t mac_handle,
|
||||
struct wifi_enhanced_pno_params *params)
|
||||
{
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
tpAniSirGlobal mac = PMAC_STRUCT(hal);
|
||||
QDF_STATUS status;
|
||||
tpAniSirGlobal mac = MAC_CONTEXT(mac_handle);
|
||||
struct scheduler_msg message = {0};
|
||||
struct wifi_epno_params *req_msg;
|
||||
int len, i;
|
||||
struct wifi_enhanced_pno_params *req_msg;
|
||||
int len;
|
||||
|
||||
SME_ENTER();
|
||||
|
||||
/* per contract must make a copy of the params when messaging */
|
||||
len = sizeof(*req_msg) +
|
||||
(input->num_networks * sizeof(struct wifi_epno_network));
|
||||
(params->num_networks * sizeof(req_msg->networks[0]));
|
||||
|
||||
req_msg = qdf_mem_malloc(len);
|
||||
if (!req_msg)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
req_msg->num_networks = input->num_networks;
|
||||
req_msg->request_id = input->request_id;
|
||||
req_msg->session_id = input->session_id;
|
||||
|
||||
/* Fill only when num_networks are non zero */
|
||||
if (req_msg->num_networks) {
|
||||
req_msg->min_5ghz_rssi = input->min_5ghz_rssi;
|
||||
req_msg->min_24ghz_rssi = input->min_24ghz_rssi;
|
||||
req_msg->initial_score_max = input->initial_score_max;
|
||||
req_msg->same_network_bonus = input->same_network_bonus;
|
||||
req_msg->secure_bonus = input->secure_bonus;
|
||||
req_msg->band_5ghz_bonus = input->band_5ghz_bonus;
|
||||
req_msg->current_connection_bonus =
|
||||
input->current_connection_bonus;
|
||||
|
||||
for (i = 0; i < req_msg->num_networks; i++) {
|
||||
req_msg->networks[i].flags = input->networks[i].flags;
|
||||
req_msg->networks[i].auth_bit_field =
|
||||
input->networks[i].auth_bit_field;
|
||||
req_msg->networks[i].ssid.length =
|
||||
input->networks[i].ssid.length;
|
||||
qdf_mem_copy(req_msg->networks[i].ssid.ssId,
|
||||
input->networks[i].ssid.ssId,
|
||||
req_msg->networks[i].ssid.length);
|
||||
}
|
||||
}
|
||||
qdf_mem_copy(req_msg, params, len);
|
||||
|
||||
status = sme_acquire_global_lock(&mac->sme);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
@@ -11418,12 +11384,11 @@ QDF_STATUS sme_set_epno_list(tHalHandle hal,
|
||||
QDF_MODULE_ID_WMA,
|
||||
QDF_MODULE_ID_WMA, &message);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
sme_err("scheduler_post_msg failed!(err=%d)",
|
||||
status);
|
||||
sme_err("scheduler_post_msg failed!(err=%d)", status);
|
||||
qdf_mem_free(req_msg);
|
||||
status = QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
sme_release_global_lock(&mac->sme);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@@ -438,8 +438,18 @@ QDF_STATUS
|
||||
wma_extscan_get_capabilities(tp_wma_handle wma,
|
||||
struct extscan_capabilities_params *params);
|
||||
|
||||
/**
|
||||
* wma_set_epno_network_list() - set epno network list
|
||||
* @wma: WMA handle
|
||||
* @req: epno config params request structure
|
||||
*
|
||||
* This function reads the incoming epno config request structure
|
||||
* and constructs the WMI message to the firmware.
|
||||
*
|
||||
* Return: 0 on success, error number otherwise
|
||||
*/
|
||||
QDF_STATUS wma_set_epno_network_list(tp_wma_handle wma,
|
||||
struct wifi_epno_params *req);
|
||||
struct wifi_enhanced_pno_params *req);
|
||||
|
||||
QDF_STATUS wma_set_passpoint_network_list(tp_wma_handle wma,
|
||||
struct wifi_passpoint_req *req);
|
||||
|
@@ -8216,8 +8216,7 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
|
||||
qdf_mem_free(msg->bodyptr);
|
||||
break;
|
||||
case WMA_SET_EPNO_LIST_REQ:
|
||||
wma_set_epno_network_list(wma_handle,
|
||||
(struct wifi_epno_params *)msg->bodyptr);
|
||||
wma_set_epno_network_list(wma_handle, msg->bodyptr);
|
||||
qdf_mem_free(msg->bodyptr);
|
||||
break;
|
||||
case WMA_SET_PER_ROAM_CONFIG_CMD:
|
||||
|
@@ -4743,76 +4743,25 @@ wma_extscan_get_capabilities(tp_wma_handle wma,
|
||||
params);
|
||||
}
|
||||
|
||||
/** wma_set_epno_network_list() - set epno network list
|
||||
* @wma: WMA handle
|
||||
* @req: epno config params request structure
|
||||
*
|
||||
* This function reads the incoming epno config request structure
|
||||
* and constructs the WMI message to the firmware.
|
||||
*
|
||||
* Returns: 0 on success, error number otherwise
|
||||
*/
|
||||
QDF_STATUS wma_set_epno_network_list(tp_wma_handle wma,
|
||||
struct wifi_epno_params *req)
|
||||
struct wifi_enhanced_pno_params *req)
|
||||
{
|
||||
struct wifi_enhanced_pno_params *params;
|
||||
uint8_t i = 0;
|
||||
QDF_STATUS status;
|
||||
size_t params_len;
|
||||
|
||||
WMA_LOGD("wma_set_epno_network_list");
|
||||
wma_debug("Enter");
|
||||
|
||||
if (!wma || !wma->wmi_handle) {
|
||||
WMA_LOGE("%s: WMA is closed, can not issue cmd", __func__);
|
||||
wma_err("WMA is closed, can not issue cmd");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
if (!wmi_service_enabled(wma->wmi_handle,
|
||||
wmi_service_extscan)) {
|
||||
WMA_LOGE("%s: extscan not enabled", __func__);
|
||||
|
||||
if (!wmi_service_enabled(wma->wmi_handle, wmi_service_extscan)) {
|
||||
wma_err("extscan not enabled");
|
||||
return QDF_STATUS_E_NOSUPPORT;
|
||||
}
|
||||
|
||||
params_len = sizeof(*params) + (req->num_networks *
|
||||
sizeof(struct wifi_epno_network_params));
|
||||
params = qdf_mem_malloc(params_len);
|
||||
if (!params)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
params->request_id = req->request_id;
|
||||
params->vdev_id = req->session_id;
|
||||
params->num_networks = req->num_networks;
|
||||
|
||||
/* Fill only when num_networks are non zero */
|
||||
if (req->num_networks) {
|
||||
params->min_5ghz_rssi = req->min_5ghz_rssi;
|
||||
params->min_24ghz_rssi = req->min_24ghz_rssi;
|
||||
params->initial_score_max = req->initial_score_max;
|
||||
params->same_network_bonus = req->same_network_bonus;
|
||||
params->secure_bonus = req->secure_bonus;
|
||||
params->band_5ghz_bonus = req->band_5ghz_bonus;
|
||||
params->current_connection_bonus =
|
||||
req->current_connection_bonus;
|
||||
|
||||
for (i = 0; i < req->num_networks; i++) {
|
||||
params->networks[i].flags = req->networks[i].flags;
|
||||
params->networks[i].auth_bit_field =
|
||||
req->networks[i].auth_bit_field;
|
||||
params->networks[i].ssid.length =
|
||||
req->networks[i].ssid.length;
|
||||
qdf_mem_copy(params->networks[i].ssid.mac_ssid,
|
||||
req->networks[i].ssid.ssId,
|
||||
req->networks[i].ssid.length);
|
||||
}
|
||||
}
|
||||
|
||||
status = wmi_unified_set_epno_network_list_cmd(wma->wmi_handle, params);
|
||||
qdf_mem_free(params);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
return status;
|
||||
|
||||
WMA_LOGD("set ePNO list request sent successfully for vdev %d",
|
||||
req->session_id);
|
||||
status = wmi_unified_set_epno_network_list_cmd(wma->wmi_handle, req);
|
||||
wma_debug("Exit, vdev %d, status %d", req->vdev_id, status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user