Эх сурвалжийг харах

qcacmn: Add callback for dynamic changes to current channel list

For dynamic master channel list, compute per pdev current channel
list as well. Provide API for user to register callback to be called
whenever current channel list for a pdev changes.

CRs-Fixed: 2012415
Change-Id: Ie86a719306178a1c3579c2b534a52a12ec3e0b1d
Amar Singhal 8 жил өмнө
parent
commit
90ae139bc4

+ 6 - 0
umac/regulatory/core/src/reg_priv.h

@@ -54,9 +54,12 @@ struct wlan_regulatory_psoc_priv_obj {
 	bool nol_chan[NUM_CHANNELS];
 	char default_country[REG_ALPHA2_LEN + 1];
 	char current_country[REG_ALPHA2_LEN + 1];
+	enum country_src cc_src;
 	struct wlan_objmgr_psoc *psoc_ptr;
 	uint32_t phybitmap;
 	enum dfs_reg dfs_region;
+	bool new_user_ctry_pending;
+	bool new_11d_ctry_pending;
 	char country_11d[REG_ALPHA2_LEN + 1];
 	bool dfs_enabled;
 	bool set_fcc_channel;
@@ -65,6 +68,9 @@ struct wlan_regulatory_psoc_priv_obj {
 	bool enable_11d_supp_original;
 	bool enable_11d_supp_current;
 	bool userspace_country_priority;
+	struct chan_change_cbk_entry cbk_list[REG_MAX_CHAN_CHANGE_CBKS];
+	uint8_t num_chan_change_cbks;
+	qdf_spinlock_t cbk_list_lock;
 };
 
 struct wlan_regulatory_pdev_priv_obj {

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 494 - 178
umac/regulatory/core/src/reg_services.c


+ 24 - 3
umac/regulatory/core/src/reg_services.h

@@ -162,8 +162,8 @@ QDF_STATUS reg_set_default_country(struct wlan_objmgr_psoc *psoc,
 
 /**
  * reg_set_country() - Set the current regulatory country
- * @pdev: The physical dev to set current country for
- * @country: The country information to configure
+ * @pdev: pdev device for country information
+ * @country: country value
  *
  * Return: QDF_STATUS
  */
@@ -239,7 +239,7 @@ QDF_STATUS  wlan_regulatory_pdev_obj_destroyed_notification(
 					    void *arg_list);
 
 static inline struct wlan_lmac_if_reg_tx_ops *
-get_reg_psoc_tx_ops(struct wlan_objmgr_psoc *psoc)
+reg_get_psoc_tx_ops(struct wlan_objmgr_psoc *psoc)
 {
 	return &((psoc->soc_cb.tx_ops.reg_ops));
 }
@@ -298,5 +298,26 @@ QDF_STATUS reg_get_current_cc(struct wlan_objmgr_psoc *psoc,
 QDF_STATUS reg_get_curr_band(struct wlan_objmgr_pdev *pdev,
 		enum band_info *band);
 
+typedef void (*reg_chan_change_callback)(struct wlan_objmgr_psoc *psoc,
+					      struct wlan_objmgr_pdev *pdev,
+					      struct regulatory_channel
+					      *chan_list,
+					      void *arg);
+
+void reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+				       reg_chan_change_callback cbk,
+				       void *arg);
+
+void reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					 reg_chan_change_callback cbk);
+
+
+struct chan_change_cbk_entry {
+	reg_chan_change_callback cbk;
+	void *arg;
+};
+
+enum country_src reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
+				    uint8_t *alpha2);
 
 #endif

+ 21 - 0
umac/regulatory/dispatcher/inc/reg_services_public_struct.h

@@ -29,6 +29,7 @@
 #define REG_SBS_SEPARATION_THRESHOLD 100
 #define REG_MAX_CHANNELS_PER_OPERATING_CLASS  25
 #define REG_MAX_SUPP_OPER_CLASSES 32
+#define REG_MAX_CHAN_CHANGE_CBKS 30
 
 /**
  * enum channel_enum - channel enumeration
@@ -498,4 +499,24 @@ struct reg_freq_range {
 	uint32_t high_freq;
 };
 
+/**
+ * struct reg_sched_payload
+ * @psoc: psoc ptr
+ * @pdev: pdev ptr
+ */
+struct reg_sched_payload {
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_objmgr_pdev *pdev;
+};
+
+/**
+ * enum direction
+ * @NORTHBOUND: northbound
+ * @SOUTHBOUND: southbound
+ */
+enum direction {
+	NORTHBOUND,
+	SOUTHBOUND,
+};
+
 #endif

+ 24 - 1
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -29,6 +29,7 @@
 #include "../../core/src/reg_services.h"
 #include <reg_services_public_struct.h>
 
+
 #define WLAN_REG_MIN_24GHZ_CH_NUM REG_MIN_24GHZ_CH_NUM
 #define WLAN_REG_MAX_24GHZ_CH_NUM REG_MAX_24GHZ_CH_NUM
 #define WLAN_REG_MIN_5GHZ_CH_NUM REG_MIN_5GHZ_CH_NUM
@@ -62,7 +63,6 @@
 
 #define WLAN_REG_CHAN_TO_BAND(chan_num)  reg_chan_to_band(chan_num)
 
-
 /**
  * wlan_reg_get_channel_list_with_power() - Provide the channel list with power
  * @ch_list: pointer to the channel list.
@@ -337,4 +337,27 @@ uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
  */
 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
 				       uint8_t *country);
+
+/**
+ * wlan_reg_register_chan_change_callback () - add chan change cbk
+ * @psoc: channel number
+ * @cbk: callback
+ * @arg: argument
+ *
+ * Return: true or false
+ */
+void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					    reg_chan_change_callback cbk,
+					    void *arg);
+
+/**
+ * wlan_reg_unregister_chan_change_callback () - remove chan change cbk
+ * @psoc: channel number
+ * @cbk: callback
+ *
+ * Return: true or false
+ */
+void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					      reg_chan_change_callback cbk);
+
 #endif

+ 33 - 2
umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h

@@ -81,8 +81,8 @@ QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc,
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *pdev,
-		uint8_t *country_code);
+QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *dev,
+				uint8_t *country_code);
 
 /**
  * ucfg_reg_reset_country() - Reset the regulatory country to default
@@ -167,4 +167,35 @@ void ucfg_reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
 				    uint8_t *alpha2,
 				    enum dfs_reg dfs_region);
 
+/**
+ * ucfg_reg_register_chan_change_callback () - add chan change cbk
+ * @psoc: psoc ptr
+ * @cbk: callback
+ * @arg: argument
+ *
+ * Return: void
+ */
+void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					    reg_chan_change_callback cbk,
+					    void *arg);
+
+/**
+ * ucfg_reg_unregister_chan_change_callback () - remove chan change cbk
+ * @psoc: psoc ptr
+ * @cbk: callback
+ *
+ * Return: void
+ */
+void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					      reg_chan_change_callback cbk);
+
+/**
+ * ucfg_reg_get_cc_and_src () - get country code and src
+ * @psoc: psoc ptr
+ * @alpha2: country code alpha2
+ *
+ * Return: void
+ */
+enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
+					 uint8_t *alpha2);
 #endif

+ 18 - 2
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -334,7 +334,7 @@ QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 
-	tx_ops = get_reg_psoc_tx_ops(psoc);
+	tx_ops = reg_get_psoc_tx_ops(psoc);
 	if (tx_ops->register_master_handler)
 		tx_ops->register_master_handler(psoc, NULL);
 
@@ -345,7 +345,7 @@ QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 
-	tx_ops = get_reg_psoc_tx_ops(psoc);
+	tx_ops = reg_get_psoc_tx_ops(psoc);
 	if (tx_ops->unregister_master_handler)
 		tx_ops->unregister_master_handler(psoc, NULL);
 
@@ -393,3 +393,19 @@ QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
 {
 	return reg_set_country(pdev, country);
 }
+
+void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					    reg_chan_change_callback cbk,
+					    void *arg)
+{
+	reg_register_chan_change_callback(psoc, cbk, arg);
+
+}
+
+void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					      reg_chan_change_callback cbk)
+{
+	reg_unregister_chan_change_callback(psoc, cbk);
+
+}
+

+ 20 - 1
umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c

@@ -151,7 +151,7 @@ QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc,
  * Return: QDF_STATUS
  */
 QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *pdev,
-				       uint8_t *country)
+				uint8_t *country)
 {
 	return reg_set_country(pdev, country);
 }
@@ -185,3 +185,22 @@ QDF_STATUS ucfg_reg_get_curr_band(struct wlan_objmgr_pdev *pdev,
 	return reg_get_curr_band(pdev, band);
 
 }
+
+void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					    reg_chan_change_callback cbk,
+					    void *arg)
+{
+	reg_register_chan_change_callback(psoc, cbk, arg);
+}
+
+void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
+					      reg_chan_change_callback cbk)
+{
+	reg_unregister_chan_change_callback(psoc, cbk);
+}
+
+enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
+					 uint8_t *alpha2)
+{
+	return reg_get_cc_and_src(psoc, alpha2);
+}

+ 21 - 0
wmi/src/wmi_unified_tlv.c

@@ -17309,6 +17309,27 @@ static QDF_STATUS extract_reg_chan_list_update_event_tlv(
 	reg_info->dfs_region = chan_list_event_hdr->dfs_region;
 	reg_info->phybitmap = chan_list_event_hdr->phybitmap;
 	reg_info->offload_enabled = true;
+	reg_info->num_phy = chan_list_event_hdr->num_phy;
+	reg_info->ctry_code = chan_list_event_hdr->country_id;
+	reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code;
+	if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS)
+		reg_info->status_code = REG_SET_CC_STATUS_PASS;
+	else if (chan_list_event_hdr->status_code ==
+		 WMI_REG_CURRENT_ALPHA2_NOT_FOUND)
+		reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND;
+	else if (chan_list_event_hdr->status_code ==
+		 WMI_REG_INIT_ALPHA2_NOT_FOUND)
+		reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND;
+	else if (chan_list_event_hdr->status_code ==
+		 WMI_REG_SET_CC_CHANGE_NOT_ALLOWED)
+		reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED;
+	else if (chan_list_event_hdr->status_code ==
+		 WMI_REG_SET_CC_STATUS_NO_MEMORY)
+		reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY;
+	else if (chan_list_event_hdr->status_code ==
+		 WMI_REG_SET_CC_STATUS_FAIL)
+		reg_info->status_code = REG_SET_CC_STATUS_FAIL;
+
 	reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g;
 	reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g;
 	reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g;

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно