Browse Source

qcacmn: Add get Chan DFS attribute API

DFS chan "state" will be set to CHANNEL_STATE_DISABLE
if the dfs chan is added to NOL.
Add the new API wlan_reg_chan_has_dfs_attribute
to get the attribute from "chan_flag" which keeps
the chan's initial dfs attribute.

Change-Id: I5149d958c0dcb1e5909e02bd5be9acdf9fca7f2f
CRs-Fixed: 2324648
Liangwei Dong 6 years ago
parent
commit
6d63c822b8

+ 23 - 0
umac/regulatory/core/src/reg_services.c

@@ -892,6 +892,29 @@ enum channel_state reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
 	return pdev_priv_obj->cur_chan_list[ch_idx].state;
 }
 
+bool reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint32_t ch)
+{
+	enum channel_enum ch_idx;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	ch_idx = reg_get_chan_enum(ch);
+
+	if (ch_idx == INVALID_CHANNEL)
+		return false;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("pdev reg obj is NULL");
+		return false;
+	}
+	if (pdev_priv_obj->cur_chan_list[ch_idx].chan_flags &
+	    REGULATORY_CHAN_RADAR)
+		return true;
+
+	return false;
+}
+
 /**
  * reg_get_5g_bonded_chan_array() - get ptr to bonded channel
  * @oper_ch: operating channel number

+ 10 - 0
umac/regulatory/core/src/reg_services.h

@@ -106,6 +106,16 @@ QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev,
 enum channel_state reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
 					 uint32_t ch);
 
+/**
+ * reg_chan_has_dfs_attribute() - check channel has dfs attribue or not
+ * @ch: channel number.
+ *
+ * This API get chan initial dfs attribue flag from regdomain
+ *
+ * Return: true if chan is dfs, otherwise false
+ */
+bool reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint32_t ch);
+
 enum channel_state reg_get_5g_bonded_channel_state(struct wlan_objmgr_pdev
 						   *pdev,
 						   uint8_t ch,

+ 11 - 0
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -103,6 +103,17 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
 enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
 					      uint32_t ch);
 
+/**
+ * wlan_reg_chan_has_dfs_attribute() - check channel has dfs attribute flag
+ * @ch: channel number.
+ *
+ * This API get chan initial dfs attribute from regdomain
+ *
+ * Return: true if chan is dfs, otherwise false
+ */
+bool
+wlan_reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint32_t ch);
+
 /**
  * wlan_reg_get_5g_bonded_channel_state() - Get 5G bonded channel state
  * @pdev: The physical dev to program country code or regdomain

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

@@ -85,6 +85,12 @@ enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
 	return reg_get_channel_state(pdev, ch);
 }
 
+bool
+wlan_reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint32_t ch)
+{
+	return reg_chan_has_dfs_attribute(pdev, ch);
+}
+
 /**
  * wlan_reg_get_5g_bonded_channel_state() - Get 5G bonded channel state
  * @ch: channel number.