Prechádzať zdrojové kódy

qcacmn: Changes for PER based roaming

DUT should be able to roam to a better access point if current
AP is having congestion/packet error.

This roam also devise a new selection logic for candidate
selection which considers channel congestion and AP capabilities.

Change-Id: I6cffbf0de059a218e971be32fbdc1a0092ceea9d
CRs-Fixed: 1090934
Kapil Gupta 8 rokov pred
rodič
commit
5a4968e145

+ 10 - 0
wmi/inc/wmi_unified_api.h

@@ -854,6 +854,16 @@ QDF_STATUS wmi_unified_roam_scan_offload_rssi_change_cmd(void *wmi_hdl,
 			  uint32_t bcn_rssi_weight,
 			  uint32_t hirssi_delay_btw_scans);
 
+/**
+ * wmi_unified_set_per_roam_config() - set PER roam config in FW
+ * @wmi_hdl: wmi handle
+ * @req_buf: per roam config request buffer
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_per_roam_config(void *wmi_hdl,
+		struct wmi_per_roam_config_req *req_buf);
+
 QDF_STATUS wmi_unified_get_buf_extscan_hotlist_cmd(void *wmi_hdl,
 				   struct ext_scan_setbssi_hotlist_params *
 				   photlist, int *buf_len);

+ 39 - 0
wmi/inc/wmi_unified_param.h

@@ -6949,6 +6949,45 @@ struct wmi_adaptive_dwelltime_params {
 	uint8_t wifi_act_threshold;
 };
 
+/**
+ * struct wmi_per_roam_config - per based roaming parameters
+ * @enable: if PER based roaming is enabled/disabled
+ * @tx_high_rate_thresh: high rate threshold at which PER based
+ *     roam will stop in tx path
+ * @rx_high_rate_thresh: high rate threshold at which PER based
+ *     roam will stop in rx path
+ * @tx_low_rate_thresh: rate below which traffic will be considered
+ *     for PER based roaming in Tx path
+ * @rx_low_rate_thresh: rate below which traffic will be considered
+ *     for PER based roaming in Tx path
+ * @tx_rate_thresh_percnt: % above which when traffic is below low_rate_thresh
+ *     will be considered for PER based scan in tx path
+ * @rx_rate_thresh_percnt: % above which when traffic is below low_rate_thresh
+ *     will be considered for PER based scan in rx path
+ * @per_rest_time: time for which PER based roam will wait once it
+ *     issues a roam scan.
+ */
+struct wmi_per_roam_config {
+	uint32_t enable;
+	uint32_t tx_high_rate_thresh;
+	uint32_t rx_high_rate_thresh;
+	uint32_t tx_low_rate_thresh;
+	uint32_t rx_low_rate_thresh;
+	uint32_t tx_rate_thresh_percnt;
+	uint32_t rx_rate_thresh_percnt;
+	uint32_t per_rest_time;
+};
+
+/**
+ * struct wmi_per_roam_config_req: PER based roaming config request
+ * @vdev_id: vdev id on which config needs to be set
+ * @per_config: PER config
+ */
+struct wmi_per_roam_config_req {
+	uint8_t vdev_id;
+	struct wmi_per_roam_config per_config;
+};
+
 /**
  * struct wmi_fw_dump_seg_req - individual segment details
  * @seg_id - segment id.

+ 3 - 0
wmi/inc/wmi_unified_priv.h

@@ -720,6 +720,9 @@ QDF_STATUS (*send_roam_scan_offload_rssi_change_cmd)(wmi_unified_t wmi_handle,
 	uint32_t bcn_rssi_weight,
 	uint32_t hirssi_delay_btw_scans);
 
+QDF_STATUS (*send_per_roam_config_cmd)(wmi_unified_t wmi_handle,
+		struct wmi_per_roam_config_req *req_buf);
+
 QDF_STATUS (*send_get_buf_extscan_hotlist_cmd)(wmi_unified_t wmi_handle,
 				   struct ext_scan_setbssi_hotlist_params *
 				   photlist, int *buf_len);

+ 12 - 0
wmi/src/wmi_unified_api.c

@@ -3205,6 +3205,18 @@ QDF_STATUS wmi_unified_roam_scan_offload_rssi_change_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_unified_set_per_roam_config(void *wmi_hdl,
+		struct wmi_per_roam_config_req *req_buf)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_per_roam_config_cmd)
+		return wmi_handle->ops->send_per_roam_config_cmd(wmi_handle,
+				req_buf);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 /**
  * wmi_unified_get_buf_extscan_hotlist_cmd() - prepare hotlist command
  * @wmi_hdl: wmi handle

+ 66 - 0
wmi/src/wmi_unified_tlv.c

@@ -13123,6 +13123,71 @@ error:
 	return status;
 }
 
+/**
+ * send_per_roam_config_cmd_tlv() - set per roaming config to FW
+ * @wmi_handle: wmi handle
+ * @req_buf: per roam config buffer
+ *
+ * Return: QDF status
+ */
+static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle,
+		struct wmi_per_roam_config_req *req_buf)
+{
+	wmi_buf_t buf = NULL;
+	QDF_STATUS status;
+	int len;
+	uint8_t *buf_ptr;
+	wmi_roam_per_config_fixed_param *wmi_per_config;
+
+	len = sizeof(wmi_roam_per_config_fixed_param);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s : wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = (uint8_t *) wmi_buf_data(buf);
+	wmi_per_config =
+		(wmi_roam_per_config_fixed_param *) buf_ptr;
+	WMITLV_SET_HDR(&wmi_per_config->tlv_header,
+			WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param,
+			WMITLV_GET_STRUCT_TLVLEN
+			(wmi_roam_per_config_fixed_param));
+
+	/* fill in per roam config values */
+	wmi_per_config->vdev_id = req_buf->vdev_id;
+	if (req_buf->per_config.enable) {
+		/* Enable for both Tx and Rx*/
+		req_buf->per_config.enable = 3;
+	}
+
+	wmi_per_config->enable = req_buf->per_config.enable;
+	wmi_per_config->high_rate_thresh =
+		(req_buf->per_config.tx_high_rate_thresh << 16) |
+		(req_buf->per_config.rx_high_rate_thresh & 0x0000ffff);
+	wmi_per_config->low_rate_thresh =
+		(req_buf->per_config.tx_low_rate_thresh << 16) |
+		(req_buf->per_config.rx_low_rate_thresh & 0x0000ffff);
+	wmi_per_config->pkt_err_rate_thresh_pct =
+		(req_buf->per_config.tx_rate_thresh_percnt << 16) |
+		(req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff);
+	wmi_per_config->per_rest_time = req_buf->per_config.per_rest_time;
+
+	/* Send per roam config parameters */
+	status = wmi_unified_cmd_send(wmi_handle, buf,
+			len, WMI_ROAM_PER_CONFIG_CMDID);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d",
+				status);
+		wmi_buf_free(buf);
+		return status;
+	}
+
+	WMI_LOGI(FL("per roam enable=%d, vdev=%d"),
+			req_buf->per_config.enable, req_buf->vdev_id);
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th
  * @wmi_handle: wmi handle
@@ -15919,6 +15984,7 @@ struct wmi_ops tlv_ops =  {
 	.extract_peer_sta_ps_statechange_ev =
 		extract_peer_sta_ps_statechange_ev_tlv,
 	.extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv,
+	.send_per_roam_config_cmd = send_per_roam_config_cmd_tlv,
 };
 
 #ifndef CONFIG_MCL