Pārlūkot izejas kodu

qcacmn: Add support for obss spatial reuse default threshold

Add support to send default offsets to firmware.

Change-Id: I5d566fbd5eb074e7aac94f793c5431734c2e0922
CRs-Fixed: 2345173
Arif Hussain 6 gadi atpakaļ
vecāks
revīzija
e1a66b56e2

+ 13 - 3
wmi/inc/wmi_unified_api.h

@@ -1577,15 +1577,25 @@ wmi_extract_ctl_failsafe_check_ev_param(void *wmi_hdl,
 
 #ifdef OBSS_PD
 /**
- * wmi_extract_smartlog_ev() - extract smartlog event info from event
+ * wmi_unified_send_obss_spatial_reuse_set_cmd() - send obss pd offset
  * @wmi_handle: wmi handle
- * @param evt_buf: pointer to event buffer
- * @param ev: Pointer to hold fatal events
+ * @oobss_spatial_reuse_param: Pointer to obsspd min max offset
  *
  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
  */
 QDF_STATUS wmi_unified_send_obss_spatial_reuse_set_cmd(void *wmi_handle,
 	struct wmi_host_obss_spatial_reuse_set_param *obss_spatial_reuse_param);
+
+/**
+ * wmi_unified_send_obss_spatial_reuse_set_def_thresh_cmd() - send def thresh
+ * @wmi_handle: wmi handle
+ * @thresh: Pointer to def thresh
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_send_obss_spatial_reuse_set_def_thresh_cmd(void *wmi_hdl,
+	struct wmi_host_obss_spatial_reuse_set_def_thresh *thresh);
+
 #endif /* OBSS_PD */
 
 /**

+ 14 - 2
wmi/inc/wmi_unified_param.h

@@ -7278,10 +7278,22 @@ struct bcn_offload_control {
  */
 struct wmi_host_obss_spatial_reuse_set_param {
 	uint32_t enable;
-	uint32_t obss_min;
-	uint32_t obss_max;
+	int32_t obss_min;
+	int32_t obss_max;
 	uint32_t vdev_id;
 };
+
+/**
+ * struct wmi_host_obss_spatial_reuse_set_def_thresh - default obsspd offsets
+ * @obss_min: Minimum OBSS level to use
+ * @obss_max: Maximum OBSS level to use
+ * @vdev_type: vdev_type should be one of WMI_VDEV_TYPE_STA or WMI_VDEV_TYPE_AP
+ */
+struct wmi_host_obss_spatial_reuse_set_def_thresh {
+	int32_t obss_min;
+	int32_t obss_max;
+	uint32_t vdev_type;
+};
 #endif
 
 /**

+ 4 - 0
wmi/inc/wmi_unified_priv.h

@@ -1830,6 +1830,10 @@ QDF_STATUS (*extract_dfs_status_from_fw)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_obss_spatial_reuse_set)(wmi_unified_t wmi_handle,
 		struct wmi_host_obss_spatial_reuse_set_param
 		*obss_spatial_reuse_param);
+
+QDF_STATUS (*send_obss_spatial_reuse_set_def_thresh)(wmi_unified_t wmi_handle,
+		struct wmi_host_obss_spatial_reuse_set_def_thresh
+		*obss_spatial_reuse_param);
 #endif
 
 QDF_STATUS

+ 13 - 0
wmi/src/wmi_unified_api.c

@@ -4460,6 +4460,19 @@ wmi_unified_send_obss_spatial_reuse_set_cmd(void *wmi_hdl,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+QDF_STATUS
+wmi_unified_send_obss_spatial_reuse_set_def_thresh_cmd(void *wmi_hdl,
+		struct wmi_host_obss_spatial_reuse_set_def_thresh *thresh)
+{
+	wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
+
+	if (wmi->ops->send_obss_spatial_reuse_set_def_thresh)
+		return wmi->ops->send_obss_spatial_reuse_set_def_thresh(wmi,
+									thresh);
+
+	return QDF_STATUS_E_FAILURE;
+}
 #endif
 
 QDF_STATUS wmi_convert_pdev_id_host_to_target(void *wmi_hdl,

+ 49 - 0
wmi/src/wmi_unified_tlv.c

@@ -7502,6 +7502,53 @@ send_addba_clearresponse_cmd_tlv(wmi_unified_t wmi_handle,
 }
 
 #ifdef OBSS_PD
+/**
+ * send_obss_spatial_reuse_set_def_thresh_cmd_tlv - send obss spatial reuse set
+ * def thresh to fw
+ * @wmi_handle: wmi handle
+ * @thresh: pointer to obss_spatial_reuse_def_thresh
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static
+QDF_STATUS send_obss_spatial_reuse_set_def_thresh_cmd_tlv(
+			wmi_unified_t wmi_handle,
+			struct wmi_host_obss_spatial_reuse_set_def_thresh
+			*thresh)
+{
+	wmi_buf_t buf;
+	wmi_obss_spatial_reuse_set_def_obss_thresh_cmd_fixed_param *cmd;
+	QDF_STATUS ret;
+	uint32_t cmd_len;
+	uint32_t tlv_len;
+
+	cmd_len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, cmd_len);
+	if (!buf)
+		return QDF_STATUS_E_NOMEM;
+
+	cmd = (wmi_obss_spatial_reuse_set_def_obss_thresh_cmd_fixed_param *)
+		wmi_buf_data(buf);
+
+	tlv_len = WMITLV_GET_STRUCT_TLVLEN(
+		wmi_obss_spatial_reuse_set_def_obss_thresh_cmd_fixed_param);
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+	WMITLV_TAG_STRUC_wmi_obss_spatial_reuse_set_def_obss_thresh_cmd_fixed_param,
+	tlv_len);
+
+	cmd->obss_min = thresh->obss_min;
+	cmd->obss_max = thresh->obss_max;
+	cmd->vdev_type = thresh->vdev_type;
+	ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len,
+		WMI_PDEV_OBSS_PD_SPATIAL_REUSE_SET_DEF_OBSS_THRESH_CMDID);
+	if (QDF_IS_STATUS_ERROR(ret))
+		wmi_buf_free(buf);
+
+	return ret;
+}
+
 /**
  * send_obss_spatial_reuse_set_cmd_tlv - send obss spatial reuse set cmd to fw
  * @wmi_handle: wmi handle
@@ -11188,6 +11235,8 @@ struct wmi_ops tlv_ops =  {
 	.extract_roam_scan_stats_res_evt = extract_roam_scan_stats_res_evt_tlv,
 #ifdef OBSS_PD
 	.send_obss_spatial_reuse_set = send_obss_spatial_reuse_set_cmd_tlv,
+	.send_obss_spatial_reuse_set_def_thresh =
+		send_obss_spatial_reuse_set_def_thresh_cmd_tlv,
 #endif
 	.extract_offload_bcn_tx_status_evt = extract_offload_bcn_tx_status_evt,
 	.extract_ctl_failsafe_check_ev_param =