瀏覽代碼

qcacmn: Enhance EPNO feature

qcacld-2.0 to qcacmn propagation

Make the following enhancements to the EPNO feature:
1) Implement the reset EPNO command handler
2) Add new parameters for candidate score calculation.

Change-Id: Iad1ff9c2b003c9e3ddbc3373366686040ccb55ca
CRs-Fixed: 1075380
Mukul Sharma 8 年之前
父節點
當前提交
019562cd1f
共有 2 個文件被更改,包括 110 次插入53 次删除
  1. 18 1
      wmi/inc/wmi_unified_param.h
  2. 92 52
      wmi/src/wmi_unified_tlv.c

+ 18 - 1
wmi/inc/wmi_unified_param.h

@@ -1802,12 +1802,29 @@ struct wifi_epno_network_params {
 
 /**
  * struct wifi_enhanched_pno_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: PNO networks
+ * @networks: EPNO networks
  */
 struct wifi_enhanched_pno_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_params networks[];
 };

+ 92 - 52
wmi/src/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;
-
-	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);
+	WMI_LOGD("SSID count: %d flags: %d",
+		cmd->no_of_ssids, cmd->flags);
 
-		/* 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);
+	/* 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 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 = (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)",
 				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);
-	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0);
-	buf_ptr += WMI_TLV_HDR_SIZE;
+		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);
+	}
 
-	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