Browse Source

qcacmn: Add 6ghz support functions

Add API to know whether 6ghz is supported. Also add API to know
whether an operating class is 6ghz operating class.

Change-Id: I75747502c0033e31d119e58a2254b220646bba10
CRs-Fixed: 2556998
Amar Singhal 5 years ago
parent
commit
5fbd62d6e3

+ 2 - 0
target_if/init_deinit/src/init_event_handler.c

@@ -186,6 +186,8 @@ static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle,
 		goto exit;
 
 	target_if_reg_set_offloaded_info(psoc);
+	target_if_reg_set_6ghz_info(psoc);
+
 	if (wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) {
 		target_if_debug("Wait for EXT message");
 	} else {

+ 8 - 1
target_if/regulatory/inc/target_if_reg.h

@@ -50,9 +50,16 @@ QDF_STATUS target_if_register_regulatory_tx_ops(
  */
 QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * target_if_reg_set_6ghz_info() - populate 6ghz enablement info
+ * @psoc: psoc pointer
+ * Return: Success or Failure
+ */
+QDF_STATUS target_if_reg_set_6ghz_info(struct wlan_objmgr_psoc *psoc);
+
 /**
  * target_if_regulatory_get_rx_ops() - Get regdb rx ops
- * @psoc: Pointer to psoc object
+ * @psoc: pointer to psoc object
  *
  * Return: Reg rx_ops
  */

+ 34 - 0
target_if/regulatory/src/target_if_reg.c

@@ -68,6 +68,22 @@ static bool tgt_if_regulatory_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc)
 	return wmi_service_enabled(wmi_handle, wmi_service_regulatory_db);
 }
 
+/**
+ * tgt_if_regulatory_is_6ghz_supported() - Check if 6ghz is supported
+ * @psoc: Pointer to psoc
+ *
+ * Return: true if regdb if offloaded, else false
+ */
+static bool tgt_if_regulatory_is_6ghz_supported(struct wlan_objmgr_psoc *psoc)
+{
+	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+
+	if (!wmi_handle)
+		return false;
+
+	return wmi_service_enabled(wmi_handle, wmi_service_6ghz_support);
+}
+
 /**
  * tgt_if_regulatory_is_there_serv_ready_extn() - Check for service ready
  * extension
@@ -120,6 +136,24 @@ QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc)
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS target_if_reg_set_6ghz_info(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
+
+	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
+	if (!reg_rx_ops) {
+		target_if_err("reg_rx_ops is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (reg_rx_ops->reg_set_6ghz_supported)
+		reg_rx_ops->reg_set_6ghz_supported(
+			psoc,
+			tgt_if_regulatory_is_6ghz_supported(psoc));
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * tgt_reg_chan_list_update_handler() - Channel list update handler
  * @handle: scn handle

+ 2 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -970,6 +970,8 @@ struct wlan_lmac_if_reg_rx_ops {
 			bool val);
 	QDF_STATUS (*reg_set_11d_offloaded)(struct wlan_objmgr_psoc *psoc,
 			bool val);
+	QDF_STATUS (*reg_set_6ghz_supported)(struct wlan_objmgr_psoc *psoc,
+					     bool val);
 	QDF_STATUS (*get_dfs_region)(struct wlan_objmgr_pdev *pdev,
 			enum dfs_reg *dfs_reg);
 	QDF_STATUS (*reg_ch_avoid_event_handler)(struct wlan_objmgr_psoc *psoc,

+ 3 - 0
umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c

@@ -291,6 +291,9 @@ static void wlan_lmac_if_umac_reg_rx_ops_register(
 	rx_ops->reg_rx_ops.reg_set_11d_offloaded =
 		tgt_reg_set_11d_offloaded;
 
+	rx_ops->reg_rx_ops.reg_set_6ghz_supported =
+		tgt_reg_set_6ghz_supported;
+
 	rx_ops->reg_rx_ops.get_dfs_region =
 		wlan_reg_get_dfs_region;
 

+ 2 - 0
umac/regulatory/core/src/reg_priv_objs.h

@@ -89,10 +89,12 @@ struct chan_change_cbk_entry {
  * @world_country_pending: In this array, element[phy_id] is true if any world
  *	country update is pending for pdev (phy_id).
  * @ignore_fw_reg_offload_ind: Ignore FW reg offload indication
+ * @six_ghz_supported: whether 6ghz is supported
  */
 struct wlan_regulatory_psoc_priv_obj {
 	struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP];
 	bool offload_enabled;
+	bool six_ghz_supported;
 	uint8_t num_phy;
 	char cur_country[REG_ALPHA2_LEN + 1];
 	char def_country[REG_ALPHA2_LEN + 1];

+ 42 - 0
umac/regulatory/core/src/reg_services_common.c

@@ -3433,3 +3433,45 @@ bool reg_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc)
 	return psoc_reg->ignore_fw_reg_offload_ind;
 }
 
+QDF_STATUS reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc, bool val)
+{
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+
+	psoc_priv_obj = reg_get_psoc_obj(psoc);
+
+	if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) {
+		reg_err("psoc reg component is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	psoc_priv_obj->six_ghz_supported = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+bool reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, uint8_t op_class)
+{
+	return ((op_class >= MIN_6GHZ_OPER_CLASS) &&
+		(op_class <= MAX_6GHZ_OPER_CLASS));
+}
+
+bool reg_is_6ghz_supported(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		reg_err_rl("psoc is NULL");
+		return false;
+	}
+
+	psoc_priv_obj = reg_get_psoc_obj(psoc);
+
+	if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) {
+		reg_err("psoc reg component is NULL");
+		return  false;
+	}
+
+	return psoc_priv_obj->six_ghz_supported;
+}

+ 27 - 0
umac/regulatory/core/src/reg_services_common.h

@@ -102,6 +102,8 @@
 
 /* EEPROM setting is a country code */
 #define    COUNTRY_ERD_FLAG     0x8000
+#define MIN_6GHZ_OPER_CLASS 131
+#define MAX_6GHZ_OPER_CLASS 135
 
 extern const struct chan_map *channel_map;
 extern const struct chan_map channel_map_us[];
@@ -928,4 +930,29 @@ QDF_STATUS reg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc);
  */
 bool reg_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * reg_set_6ghz_supported() - Set if 6ghz is supported
+ *
+ * @psoc: Pointer to psoc
+ * @val: value
+ */
+QDF_STATUS reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc,
+				  bool val);
+
+/**
+ * reg_is_6ghz_op_class() - Check whether 6ghz oper class
+ *
+ * @pdev: Pointer to pdev
+ * @op_class: oper class
+ */
+bool reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev,
+			  uint8_t op_class);
+
+/**
+ * reg_is_6ghz_supported() - Whether 6ghz is supported
+ *
+ * @pdev: pointer to pdev
+ */
+bool reg_is_6ghz_supported(struct wlan_objmgr_pdev *pdev);
+
 #endif

+ 28 - 10
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -1006,7 +1006,7 @@ wlan_reg_get_channel_state_for_freq(struct wlan_objmgr_pdev *pdev,
 				    uint16_t freq);
 
 /**
- * wlan_reg_set_channel_params_for_freq () - Sets channel parameteres for
+ * wlan_reg_set_channel_params_for_freq() - Sets channel parameteres for
  * given bandwidth
  * @pdev: The physical dev to program country code or regdomain
  * @freq: channel center frequency.
@@ -1045,7 +1045,7 @@ void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev,
 				     bool nol_ch);
 
 /**
- * wlan_reg_is_dfs_freq () - Checks the channel state for DFS
+ * wlan_reg_is_dfs_freq() - Checks the channel state for DFS
  * @freq: Channel center frequency
  *
  * Return: true or false
@@ -1053,7 +1053,7 @@ void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev,
 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, uint16_t freq);
 
 /**
- * wlan_reg_is_dsrc_freq () - Checks if the channel is dsrc channel or not
+ * wlan_reg_is_dsrc_freq() - Checks if the channel is dsrc channel or not
  * @freq: Channel center frequency
  *
  * Return: true or false
@@ -1061,7 +1061,7 @@ bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, uint16_t freq);
 bool wlan_reg_is_dsrc_freq(uint16_t freq);
 
 /**
- * wlan_reg_is_passive_or_disable_for_freq () - Checks chan state for passive
+ * wlan_reg_is_passive_or_disable_for_freq() - Checks chan state for passive
  * and disabled
  * @pdev: pdev ptr
  * @freq: Channel center frequency
@@ -1072,7 +1072,7 @@ bool wlan_reg_is_passive_or_disable_for_freq(struct wlan_objmgr_pdev *pdev,
 					     uint16_t freq);
 
 /**
- * wlan_reg_is_disable_for_freq () - Checks chan state for disabled
+ * wlan_reg_is_disable_for_freq() - Checks chan state for disabled
  * @pdev: pdev ptr
  * @freq: Channel center frequency
  *
@@ -1089,21 +1089,21 @@ bool wlan_reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, uint16_t freq);
 enum reg_wifi_band wlan_reg_freq_to_band(uint16_t freq);
 
 /**
- * wlan_reg_min_chan_freq () - minimum channel frequency supported
+ * wlan_reg_min_chan_freq() - Minimum channel frequency supported
  *
  * Return: frequency
  */
 uint16_t wlan_reg_min_chan_freq(void);
 
 /**
- * wlan_reg_max_chan_freq () - Checks chan state f
+ * wlan_reg_max_chan_freq() - Return max. frequency
  *
  * Return: frequency
  */
 uint16_t wlan_reg_max_chan_freq(void);
 
 /**
- * wlan_reg_freq_width_to_chan_op_class () - get op class from freq
+ * wlan_reg_freq_width_to_chan_op_class() -Get op class from freq
  * @pdev: pdev ptr
  * @freq: channel frequency
  * @chan_width: channel width
@@ -1123,7 +1123,7 @@ void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 					  uint8_t *chan_num);
 
 /**
- * wlan_reg_freq_to_chan_and_op_class () - converts freq to oper class
+ * wlan_reg_freq_to_chan_and_op_class() - Converts freq to oper class
  * @pdev: pdev ptr
  * @freq: channel frequency
  * @global_tbl_lookup: whether to look up global table
@@ -1143,7 +1143,7 @@ void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 #endif /*CONFIG_CHAN_FREQ_API */
 
 /**
- * wlan_reg_get_op_class_width () - get operating class chan width
+ * wlan_reg_get_op_class_width() - Get operating class chan width
  * @pdev: pdev ptr
  * @freq: channel frequency
  * @global_tbl_lookup: whether to look up global table
@@ -1156,4 +1156,22 @@ uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,
 				     uint8_t op_class,
 				     bool global_tbl_lookup);
 
+/**
+ * wlan_reg_is_6ghz_op_class() - Whether 6ghz oper class
+ * @pdev: pdev ptr
+ * @op_class: operating class
+ *
+ * Return: bool
+ */
+bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev,
+			       uint8_t op_class);
+
+/**
+ * wlan_reg_is_6ghz_supported() - Whether 6ghz is supported
+ * @pdev: pdev ptr
+ *
+ * Return: bool
+ */
+bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_pdev *pdev);
+
 #endif

+ 8 - 1
umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h

@@ -69,9 +69,16 @@ QDF_STATUS tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc,
 /**
  * tgt_reg_ignore_fw_reg_offload_ind() - Check whether regdb offload indication
  * from FW needs to be ignored.
- *
  * @psoc: Pointer to psoc
  */
 bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * tgt_reg_set_6ghz_supported() - Whether 6ghz is supported by the chip
+ * @psoc: Pointer to psoc
+ * @val: value
+ */
+QDF_STATUS tgt_reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc,
+				      bool val);
+
 #endif

+ 11 - 0
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -1012,3 +1012,14 @@ uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,
 	return reg_get_op_class_width(pdev, op_class,
 				      global_tbl_lookup);
 }
+
+bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev,
+			       uint8_t op_class)
+{
+	return reg_is_6ghz_op_class(pdev, op_class);
+}
+
+bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_pdev *pdev)
+{
+	return reg_is_6ghz_supported(pdev);
+}

+ 6 - 0
umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c

@@ -75,3 +75,9 @@ bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc)
 {
 	return reg_get_ignore_fw_reg_offload_ind(psoc);
 }
+
+QDF_STATUS tgt_reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc,
+				      bool val)
+{
+	return reg_set_6ghz_supported(psoc, val);
+}

+ 1 - 0
wmi/inc/wmi_unified_param.h

@@ -5022,6 +5022,7 @@ typedef enum {
 	wmi_service_sae_roam_support,
 	wmi_service_owe_roam_support,
 	wmi_service_ext2_msg,
+	wmi_service_6ghz_support,
 	wmi_services_max,
 } wmi_conv_service_ids;
 #define WMI_SERVICE_UNAVAILABLE 0xFFFF

+ 2 - 0
wmi/src/wmi_unified_tlv.c

@@ -13069,6 +13069,8 @@ static void populate_tlv_service(uint32_t *wmi_service)
 			WMI_SERVICE_WPA3_SAE_ROAM_SUPPORT;
 	wmi_service[wmi_service_owe_roam_support] =
 			WMI_SERVICE_WPA3_OWE_ROAM_SUPPORT;
+	wmi_service[wmi_service_6ghz_support] =
+			WMI_SERVICE_6GHZ_SUPPORT;
 }
 
 /**