ソースを参照

qcacld-3.0: Featurize pre cac code

Featurize pre cac code under PRE_CAC_SUPPORT macro.

Change-Id: I4379e667d4e0ddd3c4d91b5d624fc2325f87022e
CRs-Fixed: 3172393
Dundi Raviteja 3 年 前
コミット
990e73237e

+ 3 - 0
Kbuild

@@ -996,6 +996,9 @@ cppflags-$(CONFIG_QDF_TEST) += -DWLAN_TRACKER_TEST
 cppflags-$(CONFIG_QDF_TEST) += -DWLAN_TYPES_TEST
 cppflags-$(CONFIG_WLAN_HANG_EVENT) += -DWLAN_HANG_EVENT
 
+#Flag to enable pre_cac
+cppflags-$(CONFIG_FEATURE_WLAN_PRE_CAC)  += -DPRE_CAC_SUPPORT
+
 ############ WBUFF ############
 WBUFF_OS_DIR :=	wbuff
 WBUFF_OS_INC_DIR := $(WBUFF_OS_DIR)/inc

+ 3 - 0
configs/default_defconfig

@@ -315,6 +315,9 @@ CONFIG_WLAN_SYSFS := y
 
 CONFIG_THERMAL_STATS_SUPPORT := y
 
+#Flag to enable pre cac feature
+CONFIG_FEATURE_WLAN_PRE_CAC := y
+
 ifeq ($(CONFIG_WLAN_SYSFS), y)
 	CONFIG_WLAN_SYSFS_STA_INFO := y
 	CONFIG_WLAN_SYSFS_CHANNEL := y

+ 27 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -3691,8 +3691,35 @@ static inline int wlan_hdd_get_cpu(void)
 }
 #endif
 
+#ifdef PRE_CAC_SUPPORT
+/**
+ * wlan_hdd_sap_pre_cac_failure() - Process the pre cac failure
+ * @data: AP adapter
+ *
+ * Deletes the pre cac adapter
+ *
+ * Return: None
+ */
 void wlan_hdd_sap_pre_cac_failure(void *data);
+/**
+ * hdd_clean_up_pre_cac_interface() - Clean up the pre cac interface
+ * @hdd_ctx: HDD context
+ *
+ * Cleans up the pre cac interface, if it exists
+ *
+ * Return: None
+ */
 void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx);
+#else
+static inline void wlan_hdd_sap_pre_cac_failure(void *data)
+{
+}
+
+static inline void
+hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx)
+{
+}
+#endif /* PRE_CAC_SUPPORT */
 
 void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
 	enum netif_action_type action, enum netif_reason_type reason);

+ 8 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -550,6 +550,7 @@ void hdd_send_roam_scan_ch_list_event(struct hdd_context *hdd_ctx,
 
 int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter);
 
+#ifdef PRE_CAC_SUPPORT
 /**
  * wlan_hdd_request_pre_cac() - Start pre CAC in the driver
  * @hdd_ctx: the HDD context to operate against
@@ -561,6 +562,13 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter);
  * Return: Zero on success, non-zero value on error
  */
 int wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint32_t chan_freq);
+#else
+static inline int
+wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint32_t chan_freq)
+{
+	return 0;
+}
+#endif
 int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter);
 
 int wlan_hdd_enable_dfs_chan_scan(struct hdd_context *hdd_ctx,

+ 8 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -1079,6 +1079,7 @@ static QDF_STATUS hdd_send_radar_event(struct hdd_context *hdd_context,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef PRE_CAC_SUPPORT
 /**
  * hdd_send_conditional_chan_switch_status() - Send conditional channel switch
  * status
@@ -1264,6 +1265,7 @@ static void wlan_hdd_sap_pre_cac_success(void *data)
 
 	osif_vdev_sync_trans_stop(vdev_sync);
 }
+#endif
 
 #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
 /**
@@ -2292,6 +2294,11 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		hdd_son_deliver_cac_status_event(adapter, true);
 		break;
 	}
+/*
+ * The code under this macro will be removed
+ * once pre_cac componentization is done
+ */
+#ifdef PRE_CAC_SUPPORT
 	case eSAP_DFS_RADAR_DETECT_DURING_PRE_CAC:
 		hdd_debug("notification for radar detect during pre cac:%d",
 			adapter->vdev_id);
@@ -2319,6 +2326,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 				(void *)adapter);
 		qdf_sched_work(0, &hdd_ctx->sap_pre_cac_work);
 		break;
+#endif
 	case eSAP_DFS_NO_AVAILABLE_CHANNEL:
 		wlan_hdd_send_svc_nlink_msg
 			(hdd_ctx->radio_index,

+ 9 - 8
core/hdd/src/wlan_hdd_main.c

@@ -8050,6 +8050,7 @@ static inline void hdd_dump_func_call_map(void)
 }
 #endif
 
+#ifdef PRE_CAC_SUPPORT
 static void hdd_close_pre_cac_adapter(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *pre_cac_adapter;
@@ -8075,6 +8076,12 @@ static void hdd_close_pre_cac_adapter(struct hdd_context *hdd_ctx)
 	osif_vdev_sync_trans_stop(vdev_sync);
 	osif_vdev_sync_destroy(vdev_sync);
 }
+#else
+static inline void
+hdd_close_pre_cac_adapter(struct hdd_context *hdd_ctx)
+{
+}
+#endif
 
 QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 				struct hdd_adapter *adapter)
@@ -18825,14 +18832,7 @@ void hdd_set_conparam(int32_t con_param)
 	curr_con_mode = con_param;
 }
 
-/**
- * hdd_clean_up_pre_cac_interface() - Clean up the pre cac interface
- * @hdd_ctx: HDD context
- *
- * Cleans up the pre cac interface, if it exists
- *
- * Return: None
- */
+#ifdef PRE_CAC_SUPPORT
 void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx)
 {
 	uint8_t vdev_id;
@@ -18857,6 +18857,7 @@ void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx)
 	qdf_sched_work(0, &hdd_ctx->sap_pre_cac_work);
 
 }
+#endif
 
 /**
  * hdd_svc_fw_crashed_ind() - API to send FW CRASHED IND to Userspace

+ 3 - 0
core/hdd/src/wlan_hdd_sap_cond_chan_switch.c

@@ -34,6 +34,7 @@
 #include <wlan_hdd_includes.h>
 #include <wlan_hdd_sap_cond_chan_switch.h>
 
+#ifdef PRE_CAC_SUPPORT
 /* default pre cac channel bandwidth */
 #define DEFAULT_PRE_CAC_BANDWIDTH CH_WIDTH_80MHZ
 
@@ -217,6 +218,7 @@ static int wlan_set_def_pre_cac_chan(struct hdd_context *hdd_ctx,
 
 	return 0;
 }
+
 /**
  * __wlan_hdd_request_pre_cac() - Start pre CAC in the driver
  * @hdd_ctx: the HDD context to operate against
@@ -545,6 +547,7 @@ destroy_sync:
 
 	return errno;
 }
+#endif
 
 const struct nla_policy conditional_chan_switch_policy[
 		QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_MAX + 1] = {

+ 44 - 1
core/sap/inc/sap_api.h

@@ -855,7 +855,7 @@ QDF_STATUS wlan_sap_update_next_channel(struct sap_context *sap_ctx,
 					uint8_t channel,
 					enum phy_ch_width chan_bw);
 
-#ifdef FEATURE_SAP_COND_CHAN_SWITCH
+#if defined(FEATURE_SAP_COND_CHAN_SWITCH) && defined(PRE_CAC_SUPPORT)
 /**
  * wlan_sap_set_pre_cac_status() - Set the pre cac status
  * @sap_ctx: SAP context
@@ -895,6 +895,7 @@ wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx,
 }
 #endif
 
+#ifdef PRE_CAC_SUPPORT
 /**
  * wlan_sap_set_pre_cac_complete_status() - Sets pre cac complete status
  * @sap_ctx: SAP context
@@ -917,6 +918,26 @@ bool wlan_sap_is_pre_cac_context(struct sap_context *context);
 
 bool wlan_sap_is_pre_cac_active(mac_handle_t handle);
 QDF_STATUS wlan_sap_get_pre_cac_vdev_id(mac_handle_t handle, uint8_t *vdev_id);
+#else
+static inline QDF_STATUS
+wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx,
+				     bool status)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline bool
+wlan_sap_is_pre_cac_context(struct sap_context *context)
+{
+	return false;
+}
+
+static inline bool wlan_sap_is_pre_cac_active(mac_handle_t handle)
+{
+	return false;
+}
+#endif
+
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
 /**
  * wlansap_check_cc_intf() - Get interfering concurrent channel
@@ -1809,6 +1830,28 @@ static inline void sap_acs_set_puncture_support(struct sap_context *sap_ctx,
 {
 }
 #endif /* WLAN_FEATURE_11BE */
+
+#ifdef PRE_CAC_SUPPORT
+/**
+ * sap_cac_end_notify() - Notify CAC end to HDD
+ * @mac_handle: Opaque handle to the global MAC context
+ *
+ * Function will be called to notify eSAP_DFS_CAC_END event to HDD
+ *
+ * Return: QDF_STATUS_SUCCESS if the notification was sent, otherwise
+ *         an appropriate QDF_STATUS error
+ */
+QDF_STATUS sap_cac_end_notify(mac_handle_t mac_handle,
+			      struct csr_roam_info *roamInfo);
+#else
+static inline QDF_STATUS
+sap_cac_end_notify(mac_handle_t mac_handle,
+		   struct csr_roam_info *roamInfo)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* PRE_CAC_SUPPORT */
+
 #ifdef __cplusplus
 }
 #endif

+ 26 - 13
core/sap/src/sap_api_link_cntl.c

@@ -990,6 +990,31 @@ static bool sap_is_csa_restart_state(struct wlan_objmgr_psoc *psoc,
 	return QDF_IS_STATUS_SUCCESS(status);
 }
 
+#ifdef PRE_CAC_SUPPORT
+static void wlan_sap_pre_cac_radar_ind(struct sap_context *sap_ctx,
+				       struct mac_context *mac_ctx)
+{
+	qdf_mc_timer_t *dfs_timer = &mac_ctx->sap.SapDfsInfo.sap_dfs_cac_timer;
+
+	sap_debug("sapdfs: Radar detect on pre cac:%d", sap_ctx->sessionId);
+	if (!sap_ctx->dfs_cac_offload) {
+		qdf_mc_timer_stop(dfs_timer);
+		qdf_mc_timer_destroy(dfs_timer);
+	}
+
+	mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running = false;
+	sap_signal_hdd_event(sap_ctx, NULL,
+			     eSAP_DFS_RADAR_DETECT_DURING_PRE_CAC,
+			     (void *)eSAP_STATUS_SUCCESS);
+}
+#else
+static inline void
+wlan_sap_pre_cac_radar_ind(struct sap_context *sap_ctx,
+			   struct mac_context *mac_ctx)
+{
+}
+#endif
+
 QDF_STATUS wlansap_roam_callback(void *ctx,
 				 struct csr_roam_info *csr_roam_info,
 				 eRoamCmdStatus roam_status,
@@ -1095,19 +1120,7 @@ QDF_STATUS wlansap_roam_callback(void *ctx,
 		}
 
 		if (sap_ctx->is_pre_cac_on) {
-			sap_debug("sapdfs: Radar detect on pre cac:%d",
-				  sap_ctx->sessionId);
-			if (!sap_ctx->dfs_cac_offload) {
-				qdf_mc_timer_stop(
-				&mac_ctx->sap.SapDfsInfo.sap_dfs_cac_timer);
-				qdf_mc_timer_destroy(
-				&mac_ctx->sap.SapDfsInfo.sap_dfs_cac_timer);
-			}
-			mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running =
-				false;
-			sap_signal_hdd_event(sap_ctx, NULL,
-					eSAP_DFS_RADAR_DETECT_DURING_PRE_CAC,
-					(void *) eSAP_STATUS_SUCCESS);
+			wlan_sap_pre_cac_radar_ind(sap_ctx, mac_ctx);
 			break;
 		}
 

+ 4 - 11
core/sap/src/sap_fsm.c

@@ -2635,6 +2635,7 @@ static QDF_STATUS sap_cac_start_notify(mac_handle_t mac_handle)
 	return qdf_status;
 }
 
+#ifdef PRE_CAC_SUPPORT
 /**
  * wlansap_update_pre_cac_end() - Update pre cac end to upper layer
  * @sap_context: SAP context
@@ -2666,17 +2667,8 @@ static QDF_STATUS wlansap_update_pre_cac_end(struct sap_context *sap_context,
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * sap_cac_end_notify() - Notify CAC end to HDD
- * @mac_handle: Opaque handle to the global MAC context
- *
- * Function will be called to notify eSAP_DFS_CAC_END event to HDD
- *
- * Return: QDF_STATUS_SUCCESS if the notification was sent, otherwise
- *         an appropriate QDF_STATUS error
- */
-static QDF_STATUS sap_cac_end_notify(mac_handle_t mac_handle,
-				     struct csr_roam_info *roamInfo)
+QDF_STATUS sap_cac_end_notify(mac_handle_t mac_handle,
+			      struct csr_roam_info *roamInfo)
 {
 	uint8_t intf;
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
@@ -2770,6 +2762,7 @@ static QDF_STATUS sap_cac_end_notify(mac_handle_t mac_handle,
 	mac->sap.SapDfsInfo.cac_state = eSAP_DFS_SKIP_CAC;
 	return qdf_status;
 }
+#endif
 
 /**
  * sap_validate_dfs_nol() - Validate SAP channel with NOL list

+ 3 - 1
core/sap/src/sap_module.c

@@ -1616,7 +1616,7 @@ QDF_STATUS wlan_sap_update_next_channel(struct sap_context *sap_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
-#ifdef FEATURE_SAP_COND_CHAN_SWITCH
+#if defined(FEATURE_SAP_COND_CHAN_SWITCH) && defined(PRE_CAC_SUPPORT)
 QDF_STATUS wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx,
 				       bool status)
 {
@@ -1645,6 +1645,7 @@ wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx,
 }
 #endif /* FEATURE_SAP_COND_CHAN_SWITCH */
 
+#ifdef PRE_CAC_SUPPORT
 QDF_STATUS wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx,
 						bool status)
 {
@@ -1725,6 +1726,7 @@ QDF_STATUS wlan_sap_get_pre_cac_vdev_id(mac_handle_t handle, uint8_t *vdev_id)
 	}
 	return QDF_STATUS_E_FAILURE;
 }
+#endif
 
 void wlansap_get_sec_channel(uint8_t sec_ch_offset,
 			     uint32_t op_chan_freq,