Browse Source

qcacld-3.0: Avoid using fw-api defined enum at the CM layer

Currently, the definition of WMI_ROAM_GET_VENDOR_CONTROL_PARAM_ID
is present at the fw-api level. The host should not be using fw-api
definitions outside the WMI TLV code. To make sure it,

1. Add host-defined enum vendor_control_roam_param which defines
the param IDs that the host supports.

2. Add logic to convert host-defined enum vendor_control_roam_param
to fw-api defined enum WMI_ROAM_GET_VENDOR_CONTROL_PARAM_ID and
vice versa.

Change-Id: I035ece1bc0af8e583782460868193affb76db0f3
CRs-Fixed: 3363916
abhinav kumar 2 years ago
parent
commit
f9137050ed

+ 10 - 9
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -823,7 +823,8 @@ QDF_STATUS cm_roam_update_vendor_handoff_config(struct wlan_objmgr_psoc *psoc,
 	struct rso_cfg_params *cfg_params;
 	uint8_t vdev_id;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	uint32_t param_id, param_value, i;
+	uint32_t param_value, i;
+	enum vendor_control_roam_param param_id;
 
 	vdev_id = list->vdev_id;
 
@@ -851,30 +852,30 @@ QDF_STATUS cm_roam_update_vendor_handoff_config(struct wlan_objmgr_psoc *psoc,
 		mlme_debug("param id:%d, param value:%d", param_id,
 			   param_value);
 		switch (param_id) {
-		case ROAM_VENDOR_CONTROL_PARAM_TRIGGER:
+		case VENDOR_CONTROL_PARAM_ROAM_TRIGGER:
 			cfg_params->neighbor_lookup_threshold =
 							abs(param_value);
 			break;
-		case ROAM_VENDOR_CONTROL_PARAM_DELTA:
+		case VENDOR_CONTROL_PARAM_ROAM_DELTA:
 			cfg_params->roam_rssi_diff = param_value;
 			break;
-		case ROAM_VENDOR_CONTROL_PARAM_FULL_SCANPERIOD:
+		case VENDOR_CONTROL_PARAM_ROAM_FULL_SCANPERIOD:
 			cfg_params->full_roam_scan_period = param_value;
 			break;
-		case ROAM_VENDOR_CONTROL_PARAM_PARTIAL_SCANPERIOD:
+		case VENDOR_CONTROL_PARAM_ROAM_PARTIAL_SCANPERIOD:
 			cfg_params->empty_scan_refresh_period =
 							param_value * 1000;
 			break;
-		case ROAM_VENDOR_CONTROL_PARAM_ACTIVE_CH_DWELLTIME:
+		case VENDOR_CONTROL_PARAM_ROAM_ACTIVE_CH_DWELLTIME:
 			cfg_params->max_chan_scan_time = param_value;
 			break;
-		case ROAM_VENDOR_CONTROL_PARAM_PASSIVE_CH_DWELLTIME:
+		case VENDOR_CONTROL_PARAM_ROAM_PASSIVE_CH_DWELLTIME:
 			cfg_params->passive_max_chan_time = param_value;
 			break;
-		case ROAM_VENDOR_CONTROL_PARAM_HOME_CH_TIME:
+		case VENDOR_CONTROL_PARAM_ROAM_HOME_CH_TIME:
 			cfg_params->neighbor_scan_period = param_value;
 			break;
-		case ROAM_VENDOR_CONTROL_PARAM_AWAY_TIME:
+		case VENDOR_CONTROL_PARAM_ROAM_AWAY_TIME:
 			cfg_params->roam_scan_home_away_time = param_value;
 			break;
 		default:

+ 74 - 2
components/wmi/src/wmi_unified_roam_tlv.c

@@ -3465,6 +3465,77 @@ extract_roam_candidate_frame_tlv(wmi_unified_t wmi_handle, uint8_t *event,
 }
 
 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
+/**
+ * convert_roam_vendor_control_param() - Function to convert
+ * vendor_control_roam_param enum to TLV specific
+ * WMI_ROAM_GET_VENDOR_CONTROL_PARAM_ID
+ * @param_id: Roam vendor control param id
+ *
+ * Return: wmi roam vendor control param id
+ */
+static WMI_ROAM_GET_VENDOR_CONTROL_PARAM_ID
+convert_roam_vendor_control_param(enum vendor_control_roam_param param_id)
+{
+	switch (param_id) {
+	case VENDOR_CONTROL_PARAM_ROAM_TRIGGER:
+		return ROAM_VENDOR_CONTROL_PARAM_TRIGGER;
+	case VENDOR_CONTROL_PARAM_ROAM_DELTA:
+		return ROAM_VENDOR_CONTROL_PARAM_DELTA;
+	case VENDOR_CONTROL_PARAM_ROAM_FULL_SCANPERIOD:
+		return ROAM_VENDOR_CONTROL_PARAM_FULL_SCANPERIOD;
+	case VENDOR_CONTROL_PARAM_ROAM_PARTIAL_SCANPERIOD:
+		return ROAM_VENDOR_CONTROL_PARAM_PARTIAL_SCANPERIOD;
+	case VENDOR_CONTROL_PARAM_ROAM_ACTIVE_CH_DWELLTIME:
+		return ROAM_VENDOR_CONTROL_PARAM_ACTIVE_CH_DWELLTIME;
+	case VENDOR_CONTROL_PARAM_ROAM_PASSIVE_CH_DWELLTIME:
+		return ROAM_VENDOR_CONTROL_PARAM_PASSIVE_CH_DWELLTIME;
+	case VENDOR_CONTROL_PARAM_ROAM_HOME_CH_TIME:
+		return ROAM_VENDOR_CONTROL_PARAM_HOME_CH_TIME;
+	case VENDOR_CONTROL_PARAM_ROAM_AWAY_TIME:
+		return ROAM_VENDOR_CONTROL_PARAM_AWAY_TIME;
+	case VENDOR_CONTROL_PARAM_ROAM_ALL:
+		return ROAM_VENDOR_CONTROL_PARAM_ALL;
+	default:
+		wmi_debug("Invalid param id");
+		return 0;
+	}
+}
+
+/**
+ * convert_wmi_roam_vendor_control_param() - Function to convert TLV specific
+ * WMI_ROAM_GET_VENDOR_CONTROL_PARAM_ID to vendor_control_roam_param
+ * @param_id: wmi vendor control param id
+ *
+ * Return: roam vendor control param id
+ */
+static enum vendor_control_roam_param convert_wmi_roam_vendor_control_param(
+			WMI_ROAM_GET_VENDOR_CONTROL_PARAM_ID param_id)
+{
+	switch (param_id) {
+	case ROAM_VENDOR_CONTROL_PARAM_TRIGGER:
+		return VENDOR_CONTROL_PARAM_ROAM_TRIGGER;
+	case ROAM_VENDOR_CONTROL_PARAM_DELTA:
+		return VENDOR_CONTROL_PARAM_ROAM_DELTA;
+	case ROAM_VENDOR_CONTROL_PARAM_FULL_SCANPERIOD:
+		return VENDOR_CONTROL_PARAM_ROAM_FULL_SCANPERIOD;
+	case ROAM_VENDOR_CONTROL_PARAM_PARTIAL_SCANPERIOD:
+		return VENDOR_CONTROL_PARAM_ROAM_PARTIAL_SCANPERIOD;
+	case ROAM_VENDOR_CONTROL_PARAM_ACTIVE_CH_DWELLTIME:
+		return VENDOR_CONTROL_PARAM_ROAM_ACTIVE_CH_DWELLTIME;
+	case ROAM_VENDOR_CONTROL_PARAM_PASSIVE_CH_DWELLTIME:
+		return VENDOR_CONTROL_PARAM_ROAM_PASSIVE_CH_DWELLTIME;
+	case ROAM_VENDOR_CONTROL_PARAM_HOME_CH_TIME:
+		return VENDOR_CONTROL_PARAM_ROAM_HOME_CH_TIME;
+	case ROAM_VENDOR_CONTROL_PARAM_AWAY_TIME:
+		return VENDOR_CONTROL_PARAM_ROAM_AWAY_TIME;
+	case ROAM_VENDOR_CONTROL_PARAM_ALL:
+		return VENDOR_CONTROL_PARAM_ROAM_ALL;
+	default:
+		wmi_debug("Invalid param id");
+		return 0;
+	}
+}
+
 static QDF_STATUS
 extract_roam_vendor_control_param_event_tlv(wmi_unified_t wmi_handle,
 				uint8_t *event, uint32_t len,
@@ -3518,7 +3589,8 @@ extract_roam_vendor_control_param_event_tlv(wmi_unified_t wmi_handle,
 
 	param_info = &dst_list->param_info[0];
 	for (i = 0; i < num_entries; i++) {
-		param_info->param_id = src_list->param_id;
+		param_info->param_id =
+		     convert_wmi_roam_vendor_control_param(src_list->param_id);
 		param_info->param_value = src_list->param_value;
 		wmi_debug("param_info->param_id:%d, param_info->param_value:%d",
 			  param_info->param_id, param_info->param_value);
@@ -3565,7 +3637,7 @@ send_process_roam_vendor_handoff_req_cmd_tlv(wmi_unified_t wmi_handle,
 	     WMITLV_GET_STRUCT_TLVLEN
 		       (wmi_roam_get_vendor_control_param_cmd_fixed_param));
 	cmd->vdev_id = vdev_id;
-	cmd->param_id = param_id;
+	cmd->param_id = convert_roam_vendor_control_param(param_id);
 	wmi_debug("Send GET_VENDOR_CONTROL_PARAM cmd vdev_id:%d, param_id:0x%x",
 		cmd->vdev_id, cmd->param_id);
 	wmi_mtrace(WMI_ROAM_GET_VENDOR_CONTROL_PARAM_CMDID, cmd->vdev_id, 0);

+ 25 - 4
core/hdd/src/wlan_hdd_cfg80211.c

@@ -5727,6 +5727,30 @@ hdd_set_roam_rx_linkspeed_threshold(struct wlan_objmgr_psoc *psoc,
 /* Include the 6 GHz channels in roam full scan only on prior discovery */
 #define INCLUDE_6GHZ_IN_FULL_SCAN_IF_DISC	1
 
+#ifdef WLAN_VENDOR_HANDOFF_CONTROL
+/**
+ * hdd_get_handoff_param() - get vendor handoff parameters
+ * @hdd_ctx: HDD context
+ * @vdev_id: vdev id
+ *
+ * Wrapper function for hdd_cm_get_handoff_param
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS hdd_get_handoff_param(struct hdd_context *hdd_ctx,
+					uint8_t vdev_id)
+{
+	return hdd_cm_get_handoff_param(hdd_ctx->psoc, vdev_id,
+					VENDOR_CONTROL_PARAM_ROAM_ALL);
+}
+#else
+static inline QDF_STATUS
+hdd_get_handoff_param(struct hdd_context *hdd_ctx, uint8_t vdev_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * hdd_set_roam_with_control_config() - Set roam control configuration
  * @hdd_ctx: HDD context
@@ -5797,10 +5821,7 @@ hdd_set_roam_with_control_config(struct hdd_context *hdd_ctx,
 		if (roam_control_enable &&
 		    ucfg_cm_roam_is_vendor_handoff_control_enable(
 			hdd_ctx->psoc)) {
-			status =
-				hdd_cm_get_handoff_param(hdd_ctx->psoc, adapter,
-						adapter->vdev_id,
-						ROAM_VENDOR_CONTROL_PARAM_ALL);
+			status = hdd_get_handoff_param(hdd_ctx, vdev_id);
 			if (QDF_IS_STATUS_ERROR(status)) {
 				hdd_err("failed to get vendor handoff params");
 				return qdf_status_to_os_return(status);

+ 3 - 12
core/hdd/src/wlan_hdd_cm_api.h

@@ -116,23 +116,14 @@ hdd_cm_get_vendor_handoff_params(struct wlan_objmgr_psoc *psoc,
 /**
  * hdd_cm_get_handoff_param() - send get vendor handoff param request to fw
  * @psoc: psoc common object
- * @hdd_adapter: adapter context
  * @vdev_id: vdev id
- * @param_id: Param ID from enum WMI_ROAM_GET_VENDOR_CONTROL_PARAM_ID
+ * @param_id: param id from enum vendor_control_roam_param
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS hdd_cm_get_handoff_param(struct wlan_objmgr_psoc *psoc,
-				    struct hdd_adapter *hdd_adapter,
-				    uint8_t vdev_id, uint32_t param_id);
-#else
-static inline QDF_STATUS
-hdd_cm_get_handoff_param(struct wlan_objmgr_psoc *psoc,
-			 struct hdd_adapter *hdd_adapter,
-			 uint8_t vdev_id, uint32_t param_value)
-{
-	return QDF_STATUS_SUCCESS;
-}
+				    uint8_t vdev_id,
+				    enum vendor_control_roam_param param_id);
 #endif
 
 /**

+ 2 - 2
core/hdd/src/wlan_hdd_cm_connect.c

@@ -1568,8 +1568,8 @@ QDF_STATUS hdd_cm_send_vdev_keys(struct wlan_objmgr_vdev *vdev,
 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
 #define WLAN_WAIT_TIME_HANDOFF_PARAMS 1000
 QDF_STATUS hdd_cm_get_handoff_param(struct wlan_objmgr_psoc *psoc,
-				    struct hdd_adapter *adapter,
-				    uint8_t vdev_id, uint32_t param_id)
+				    uint8_t vdev_id,
+				    enum vendor_control_roam_param param_id)
 {
 	QDF_STATUS status;
 	int retval;