diff --git a/wmi_unified_tlv.c b/wmi_unified_tlv.c index c6a5f523fc..da845a5ebe 100644 --- a/wmi_unified_tlv.c +++ b/wmi_unified_tlv.c @@ -5090,18 +5090,28 @@ QDF_STATUS send_set_epno_network_list_cmd_tlv(wmi_unified_t wmi_handle, { wmi_nlo_config_cmd_fixed_param *cmd; nlo_configured_parameters *nlo_list; + enlo_candidate_score_params *cand_score_params; u_int8_t i, *buf_ptr; wmi_buf_t buf; uint32_t len; QDF_STATUS ret; - /* TLV place holder for array of structures - * nlo_configured_parameters(nlo_list) */ - len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; - len += sizeof(nlo_configured_parameters) * - QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS); - len += WMI_TLV_HDR_SIZE; /* TLV for channel_list */ - len += WMI_TLV_HDR_SIZE; /* TLV for channel prediction cfg*/ + /* Fixed Params */ + len = sizeof(*cmd); + if (req->num_networks) { + /* TLV place holder for array of structures + * then each nlo_configured_parameters(nlo_list) TLV. + */ + len += WMI_TLV_HDR_SIZE; + len += (sizeof(nlo_configured_parameters) + * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); + /* TLV for array of uint32 channel_list */ + len += WMI_TLV_HDR_SIZE; + /* TLV for nlo_channel_prediction_cfg */ + len += WMI_TLV_HDR_SIZE; + /* TLV for candidate score params */ + len += sizeof(enlo_candidate_score_params); + } buf = wmi_buf_alloc(wmi_handle, len); if (!buf) { @@ -5117,65 +5127,94 @@ QDF_STATUS send_set_epno_network_list_cmd_tlv(wmi_unified_t wmi_handle, WMITLV_GET_STRUCT_TLVLEN( wmi_nlo_config_cmd_fixed_param)); cmd->vdev_id = req->session_id; - cmd->flags = WMI_NLO_CONFIG_ENLO; + + /* set flag to reset if num of networks are 0 */ + cmd->flags = (req->num_networks == 0 ? + WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); cmd->no_of_ssids = QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS); - WMI_LOGD("SSID count: %d", cmd->no_of_ssids); - WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, - cmd->no_of_ssids * sizeof(nlo_configured_parameters)); - buf_ptr += WMI_TLV_HDR_SIZE; + WMI_LOGD("SSID count: %d flags: %d", + cmd->no_of_ssids, cmd->flags); - nlo_list = (nlo_configured_parameters *) buf_ptr; - for (i = 0; i < cmd->no_of_ssids; i++) { - WMITLV_SET_HDR(&nlo_list[i].tlv_header, - WMITLV_TAG_ARRAY_BYTE, - WMITLV_GET_STRUCT_TLVLEN(nlo_configured_parameters)); - /* Copy ssid and it's length */ - nlo_list[i].ssid.valid = true; - nlo_list[i].ssid.ssid.ssid_len = req->networks[i].ssid.length; - qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, - req->networks[i].ssid.mac_ssid, - nlo_list[i].ssid.ssid.ssid_len); - WMI_LOGD("index: %d ssid: %.*s len: %d", i, - nlo_list[i].ssid.ssid.ssid_len, - (char *) nlo_list[i].ssid.ssid.ssid, - nlo_list[i].ssid.ssid.ssid_len); + /* Fill nlo_config only when num_networks are non zero */ + if (cmd->no_of_ssids) { + /* Fill networks */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, + cmd->no_of_ssids * sizeof(nlo_configured_parameters)); + buf_ptr += WMI_TLV_HDR_SIZE; - /* Copy rssi threshold */ - nlo_list[i].rssi_cond.valid = true; - nlo_list[i].rssi_cond.rssi = - req->networks[i].rssi_threshold; - WMI_LOGD("RSSI threshold : %d dBm", - nlo_list[i].rssi_cond.rssi); + nlo_list = (nlo_configured_parameters *) buf_ptr; + for (i = 0; i < cmd->no_of_ssids; i++) { + WMITLV_SET_HDR(&nlo_list[i].tlv_header, + WMITLV_TAG_ARRAY_BYTE, + WMITLV_GET_STRUCT_TLVLEN( + nlo_configured_parameters)); + /* Copy ssid and it's length */ + nlo_list[i].ssid.valid = true; + nlo_list[i].ssid.ssid.ssid_len = + req->networks[i].ssid.length; + qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, + req->networks[i].ssid.mac_ssid, + nlo_list[i].ssid.ssid.ssid_len); + WMI_LOGD("index: %d ssid: %.*s len: %d", i, + nlo_list[i].ssid.ssid.ssid_len, + (char *) nlo_list[i].ssid.ssid.ssid, + nlo_list[i].ssid.ssid.ssid_len); - /* Copy pno flags */ - nlo_list[i].bcast_nw_type.valid = true; - nlo_list[i].bcast_nw_type.bcast_nw_type = - req->networks[i].flags; - WMI_LOGD("PNO flags (%u)", + /* Copy pno flags */ + nlo_list[i].bcast_nw_type.valid = true; + nlo_list[i].bcast_nw_type.bcast_nw_type = + req->networks[i].flags; + WMI_LOGD("PNO flags (%u)", nlo_list[i].bcast_nw_type.bcast_nw_type); - /* Copy auth bit field */ - nlo_list[i].auth_type.valid = true; - nlo_list[i].auth_type.auth_type = - req->networks[i].auth_bit_field; - WMI_LOGD("Auth bit field (%u)", - nlo_list[i].auth_type.auth_type); + /* Copy auth bit field */ + nlo_list[i].auth_type.valid = true; + nlo_list[i].auth_type.auth_type = + req->networks[i].auth_bit_field; + WMI_LOGD("Auth bit field (%u)", + nlo_list[i].auth_type.auth_type); + } + + buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); + /* Fill the channel list */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); + buf_ptr += WMI_TLV_HDR_SIZE; + + /* Fill prediction_param */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); + buf_ptr += WMI_TLV_HDR_SIZE; + + /* Fill epno candidate score params */ + cand_score_params = (enlo_candidate_score_params *) buf_ptr; + WMITLV_SET_HDR(buf_ptr, + WMITLV_TAG_STRUC_enlo_candidate_score_param, + WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); + cand_score_params->min5GHz_rssi = + req->min_5ghz_rssi; + cand_score_params->min24GHz_rssi = + req->min_24ghz_rssi; + cand_score_params->initial_score_max = + req->initial_score_max; + cand_score_params->current_connection_bonus = + req->current_connection_bonus; + cand_score_params->same_network_bonus = + req->same_network_bonus; + cand_score_params->secure_bonus = + req->secure_bonus; + cand_score_params->band5GHz_bonus = + req->band_5ghz_bonus; + buf_ptr += sizeof(enlo_candidate_score_params); } - buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); - WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); - buf_ptr += WMI_TLV_HDR_SIZE; - - WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); - buf_ptr += WMI_TLV_HDR_SIZE; ret = wmi_unified_cmd_send(wmi_handle, buf, len, - WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); + WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); if (QDF_IS_STATUS_ERROR(ret)) { WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); wmi_buf_free(buf); + return QDF_STATUS_E_INVAL; } WMI_LOGD("set ePNO list request sent successfully for vdev %d", @@ -5184,6 +5223,7 @@ QDF_STATUS send_set_epno_network_list_cmd_tlv(wmi_unified_t wmi_handle, return ret; } + /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter * @wmi_handle: wmi handle * @ipa_offload: ipa offload control parameter