Browse Source

qcacmn: Add obss detection info extract handler

Add hander to extract obss detection info received
from firmware.

Change-Id: I5fde304915a97d37d6cbe58e7a315e91fbac61b6
CRs-Fixed: 2170184
Arif Hussain 7 years ago
parent
commit
c116a01322

+ 18 - 0
wmi/inc/wmi_unified_api.h

@@ -1911,4 +1911,22 @@ QDF_STATUS wmi_unified_send_btm_config(void *wmi_hdl,
 
 QDF_STATUS wmi_unified_send_obss_detection_cfg_cmd(void *wmi_hdl,
 			struct wmi_obss_detection_cfg_param *cfg);
+
+/**
+ * wmi_unified_extract_obss_detection_info() - WMI function to extract obss
+ *  detection info from FW.
+ * @wmi_hdl: wmi handle
+ * @data: event data from firmware
+ * @info: Pointer to hold obss detection info
+ *
+ * This function is used to extract obss info from firmware.
+ *
+ * Return: QDF_STATUS
+ */
+
+QDF_STATUS wmi_unified_extract_obss_detection_info(void *wmi_hdl,
+						   uint8_t *data,
+						   struct wmi_obss_detect_info
+						   *info);
+
 #endif /* _WMI_UNIFIED_API_H_ */

+ 29 - 0
wmi/inc/wmi_unified_param.h

@@ -8297,4 +8297,33 @@ struct wmi_obss_detection_cfg_param {
 	uint32_t obss_ht_20mhz_detect_mode;
 };
 
+/**
+ * enum sap_obss_detection_reason - obss detection event reasons
+ * @OBSS_OFFLOAD_DETECTION_DISABLED: OBSS detection disabled
+ * @OBSS_OFFLOAD_DETECTION_PRESENT: OBSS present detection
+ * @OBSS_OFFLOAD_DETECTION_ABSENT: OBSS absent detection
+ *
+ * Defines different types of reasons for obss detection event from firmware.
+ */
+enum wmi_obss_detection_reason {
+	OBSS_OFFLOAD_DETECTION_DISABLED = 0,
+	OBSS_OFFLOAD_DETECTION_PRESENT  = 1,
+	OBSS_OFFLOAD_DETECTION_ABSENT   = 2,
+};
+
+/**
+ * struct wmi_obss_detect_info - OBSS detection info from firmware
+ * @vdev_id: IDof the vdev to which this info belongs.
+ * @reason: Indicate if present or Absent detection,
+ *          also if not supported offload for this vdev.
+ * @matched_detection_masks: Detection bit map.
+ * @matched_bssid_addr: MAC address valid for only if info is present detection.
+ */
+struct wmi_obss_detect_info {
+	uint32_t vdev_id;
+	enum wmi_obss_detection_reason reason;
+	uint32_t matched_detection_masks;
+	uint8_t matched_bssid_addr[IEEE80211_ADDR_LEN];
+};
+
 #endif /* _WMI_UNIFIED_PARAM_H_ */

+ 2 - 0
wmi/inc/wmi_unified_priv.h

@@ -1496,6 +1496,8 @@ QDF_STATUS (*send_btm_config)(wmi_unified_t wmi_handle,
 			      struct wmi_btm_config *params);
 QDF_STATUS (*send_obss_detection_cfg_cmd)(wmi_unified_t wmi_handle,
 		struct wmi_obss_detection_cfg_param *obss_cfg_param);
+QDF_STATUS (*extract_obss_detection_info)(uint8_t *evt_buf,
+					  struct wmi_obss_detect_info *info);
 };
 
 /* Forward declartion for psoc*/

+ 13 - 0
wmi/src/wmi_unified_api.c

@@ -7244,3 +7244,16 @@ QDF_STATUS wmi_unified_send_obss_detection_cfg_cmd(void *wmi_hdl,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+QDF_STATUS wmi_unified_extract_obss_detection_info(void *wmi_hdl,
+						   uint8_t *data,
+						   struct wmi_obss_detect_info
+						   *info)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->extract_obss_detection_info)
+		return wmi_handle->ops->extract_obss_detection_info(data, info);
+
+	return QDF_STATUS_E_FAILURE;
+}

+ 51 - 0
wmi/src/wmi_unified_tlv.c

@@ -21009,6 +21009,56 @@ static QDF_STATUS send_obss_detection_cfg_cmd_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * extract_obss_detection_info_tlv() - Extract obss detection info
+ *   received from firmware.
+ * @evt_buf: pointer to event buffer
+ * @obss_detection: Pointer to hold obss detection info
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS extract_obss_detection_info_tlv(uint8_t *evt_buf,
+						  struct wmi_obss_detect_info
+						  *obss_detection)
+{
+	WMI_SAP_OBSS_DETECTION_REPORT_EVENTID_param_tlvs *param_buf;
+	wmi_sap_obss_detection_info_evt_fixed_param *fix_param;
+
+	if (!obss_detection) {
+		WMI_LOGE("%s: Invalid obss_detection event buffer", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	param_buf = (WMI_SAP_OBSS_DETECTION_REPORT_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("%s: Invalid evt_buf", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	fix_param = param_buf->fixed_param;
+	obss_detection->vdev_id = fix_param->vdev_id;
+	obss_detection->matched_detection_masks =
+		fix_param->matched_detection_masks;
+	WMI_MAC_ADDR_TO_CHAR_ARRAY(&fix_param->matched_bssid_addr,
+				   &obss_detection->matched_bssid_addr[0]);
+	switch (fix_param->reason) {
+	case WMI_SAP_OBSS_DETECTION_EVENT_REASON_NOT_SUPPORT:
+		obss_detection->reason = OBSS_OFFLOAD_DETECTION_DISABLED;
+		break;
+	case WMI_SAP_OBSS_DETECTION_EVENT_REASON_PRESENT_NOTIFY:
+		obss_detection->reason = OBSS_OFFLOAD_DETECTION_PRESENT;
+		break;
+	case WMI_SAP_OBSS_DETECTION_EVENT_REASON_ABSENT_TIMEOUT:
+		obss_detection->reason = OBSS_OFFLOAD_DETECTION_ABSENT;
+		break;
+	default:
+		WMI_LOGE("%s: Invalid reason %d", __func__, fix_param->reason);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 struct wmi_ops tlv_ops =  {
 	.send_vdev_create_cmd = send_vdev_create_cmd_tlv,
 	.send_vdev_delete_cmd = send_vdev_delete_cmd_tlv,
@@ -21451,6 +21501,7 @@ struct wmi_ops tlv_ops =  {
 #endif
 	.send_btm_config = send_btm_config_cmd_tlv,
 	.send_obss_detection_cfg_cmd = send_obss_detection_cfg_cmd_tlv,
+	.extract_obss_detection_info = extract_obss_detection_info_tlv,
 };
 
 /**