Browse Source

qcacmn: Enumerate OCAC completion status

Currently, OCAC status in DFS SOC object is defined as a boolean type,
whereas, individual OCAC status types are defined as macros. Hence, it
becomes difficult to differentiate between various status values.

To solve this issue, enumerate OCAC status types together and change
the OCAC status in the DFS SOC object from boolean to the enumerated
type.

Also, create a new object 'adfs_completion_params' to store the Off
channel CAC completion parameters within the wlan_dfs structure.

Create a new api 'dfs_agile_cleanup_rcac' to clear the agile RCAC
parameters.

Change-Id: Id95014f4f81b4a2137092a5dd107c570d70058b6
CRs-Fixed: 3501679
Thirusenthil Kumaran J 2 years ago
parent
commit
1301454202

+ 20 - 1
umac/dfs/core/src/dfs.h

@@ -981,6 +981,23 @@ struct dfs_rcac_params {
 	qdf_freq_t rcac_pri_freq;
 	struct ch_params rcac_ch_params;
 };
+
+/**
+ * struct adfs_completion_params - Agile DFS completion parameters
+ * @ocac_status:   Off channel CAC completion status
+ * @center_freq1:  For 20/40/80/160Mhz, it is the center of the corresponding
+ *                 segment. For 80P80/165MHz, it is the center of the left
+ *                 80MHz.
+ * @center_freq2:  It is valid and non-zero only for 80P80/165MHz. It indicates
+ *                 the Center Frequency of the right 80MHz segment.
+ * @chan_width:    Channel Width
+ */
+struct adfs_completion_params {
+	enum ocac_status_type ocac_status;
+	uint32_t center_freq1;
+	uint32_t center_freq2;
+	uint32_t chan_width;
+};
 #endif
 
 #ifdef WLAN_DISP_CHAN_INFO
@@ -1188,6 +1205,7 @@ struct dfs_punc_unpunc {
  * @dfs_pdev_obj:                    DFS pdev object.
  * @dfs_soc_obj:                     DFS soc object.
  * @dfs_psoc_idx:                    DFS psoc index
+ * @adfs_completion_status:          Agile DFS completion parameters object.
  * @dfs_agile_precac_freq_mhz:       Freq in MHZ configured on Agile DFS engine.
  * @dfs_is_offload_enabled:          Set if DFS offload enabled.
  * @dfs_is_bangradar_320_supported:  Set if DFS 320MHZ enabled.
@@ -1371,6 +1389,7 @@ struct wlan_dfs {
 	struct dfs_soc_priv_obj *dfs_soc_obj;
 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS)
 	uint8_t dfs_psoc_idx;
+	struct adfs_completion_params adfs_completion_status;
 #endif
 #ifdef CONFIG_CHAN_FREQ_API
 	uint16_t       dfs_agile_precac_freq_mhz;
@@ -1481,7 +1500,7 @@ struct dfs_soc_priv_obj {
 	qdf_hrtimer_data_t    dfs_precac_timer;
 	uint8_t dfs_precac_timer_running;
 	bool precac_state_started;
-	bool ocac_status;
+	enum ocac_status_type ocac_status;
 #endif
 	struct dfsreq_nolinfo *dfs_psoc_nolinfo;
 #ifdef QCA_SUPPORT_ADFS_RCAC

+ 38 - 8
umac/dfs/core/src/dfs_zero_cac.h

@@ -35,10 +35,6 @@
 #include "dfs.h"
 #include <wlan_dfs_tgt_api.h>
 
-#define OCAC_SUCCESS 0
-#define OCAC_RESET 1
-#define OCAC_CANCEL 2
-
 #ifdef WLAN_FEATURE_11BE
 #define TREE_DEPTH_320                    5
 #define TREE_DEPTH_MAX                    TREE_DEPTH_320
@@ -458,11 +454,28 @@ void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs, bool *is_chan_found);
  * @chwidth : Width of the channel for which OCAC completion is received.
  */
 void dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev,
-			       uint32_t ocac_status,
+			       enum ocac_status_type ocac_status,
 			       uint32_t center_freq1,
 			       uint32_t center_freq2,
 			       enum phy_ch_width chwidth);
 
+/*
+ * dfs_is_ocac_complete_event_for_cur_agile_chan() - Check if the OCAC
+ * completion event from FW is received for the currently configured agile
+ * channel in host.
+ *
+ * @dfs: Pointer to dfs structure.
+ * @center_freq_mhz1: Center frequency of the band when the precac width is
+ * 20/40/80/160MHz and center frequency of the left 80MHz in case of restricted
+ * 80P80/165MHz.
+ * @center_freq_mhz2: Center frequency of the right 80MHz in case of restricted
+ * 80P80/165MHz. It is zero for other channel widths.
+ * @chwidth: Agile channel width for which the completion event is received.
+ *
+ * return: True if the channel on which OCAC completion event received is same
+ * as currently configured agile channel in host. False otherwise.
+ */
+bool dfs_is_ocac_complete_event_for_cur_agile_chan(struct wlan_dfs *dfs);
 /**
  * dfs_set_agilecac_chan_for_freq() - Find chan freq for agile CAC.
  * @dfs:         Pointer to wlan_dfs structure.
@@ -510,7 +523,7 @@ void dfs_agile_precac_start(struct wlan_dfs *dfs);
  * fields in adfs_param.
  */
 void dfs_start_agile_precac_timer(struct wlan_dfs *dfs,
-				  uint8_t ocac_status,
+				  enum ocac_status_type ocac_status,
 				  struct dfs_agile_cac_params *adfs_param);
 
 /**
@@ -539,13 +552,19 @@ static inline void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs,
 
 static inline void
 dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev,
-			  uint32_t ocac_status,
+			  enum ocac_status_type ocac_status,
 			  uint32_t center_freq1,
 			  uint32_t center_freq2,
 			  enum phy_ch_width chwidth)
 {
 }
 
+static inline bool
+dfs_is_ocac_complete_event_for_cur_agile_chan(struct wlan_dfs *dfs)
+{
+	return false;
+}
+
 #ifdef CONFIG_CHAN_FREQ_API
 static inline void
 dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs,
@@ -569,7 +588,7 @@ static inline void dfs_agile_precac_start(struct wlan_dfs *dfs)
 
 static inline void
 dfs_start_agile_precac_timer(struct wlan_dfs *dfs,
-			     uint8_t ocac_status,
+			     enum ocac_status_type ocac_status,
 			     struct dfs_agile_cac_params *adfs_param)
 {
 }
@@ -1144,12 +1163,23 @@ void dfs_start_agile_rcac_timer(struct wlan_dfs *dfs);
  *
  */
 void dfs_stop_agile_rcac_timer(struct wlan_dfs *dfs);
+
+/**
+ * dfs_agile_cleanup_rcac() - Reset parameters of wlan_dfs relatewd to RCAC
+ *
+ * @dfs: Pointer to struct wlan_dfs.
+ */
+void dfs_agile_cleanup_rcac(struct wlan_dfs *dfs);
 #else
 static inline bool dfs_is_agile_rcac_enabled(struct wlan_dfs *dfs)
 {
 	return false;
 }
 
+static inline void dfs_agile_cleanup_rcac(struct wlan_dfs *dfs)
+{
+}
+
 static inline void
 dfs_prepare_agile_rcac_channel(struct wlan_dfs *dfs,
 			       bool *is_rcac_chan_available)

+ 12 - 0
umac/dfs/dispatcher/inc/wlan_dfs_public_struct.h

@@ -198,4 +198,16 @@ enum channel_dfs_state {
 	CH_DFS_S_PRECAC_COMPLETED,
 	CH_DFS_S_NON_DFS,
 };
+
+/**
+ * enum ocac_status_type - Enum for OCAC status for Agile DFS.
+ * @OCAC_SUCCESS:       OCAC completed successfully.
+ * @OCAC_RESET:         OCAC status was reset.
+ * @OCAC_CANCEL:        OCAC canceled.
+ */
+enum ocac_status_type {
+	OCAC_SUCCESS = 0,
+	OCAC_RESET,
+	OCAC_CANCEL,
+};
 #endif

+ 1 - 1
umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h

@@ -118,7 +118,7 @@ struct vdev_adfs_complete_status {
 	uint32_t chan_width;
 	uint32_t center_freq1;
 	uint32_t center_freq2;
-	uint32_t ocac_status;
+	enum ocac_status_type ocac_status;
 };
 
 extern struct dfs_to_mlme global_dfs_to_mlme;