Browse Source

qcacld-3.0: Check and skip Radar event for SAP

Use the new API wlan_reg_chan_has_dfs_attribute
to check dfs channel or not. The old API may return
CHANNEL_STATE_DISABLE if the dfs chan is added to
NOL.
If SAP is not on dfs channel, skip the Radar event
process.

Change-Id: Ie5c87e6fa416658df64da54c276fb87f23ed7efb
CRs-Fixed: 2324649
Liangwei Dong 6 years ago
parent
commit
3fb0016526
3 changed files with 70 additions and 6 deletions
  1. 5 6
      core/sap/src/sap_api_link_cntl.c
  2. 50 0
      core/sap/src/sap_fsm.c
  3. 15 0
      core/sap/src/sap_internal.h

+ 5 - 6
core/sap/src/sap_api_link_cntl.c

@@ -777,7 +777,6 @@ wlansap_roam_callback(void *ctx, struct csr_roam_info *csr_roam_info,
 	tpAniSirGlobal mac_ctx = NULL;
 	uint8_t intf;
 	bool sta_sap_scc_on_dfs_chan;
-	enum channel_state chan_state;
 
 	if (QDF_IS_STATUS_ERROR(wlansap_context_get(ctx)))
 		return QDF_STATUS_E_FAILURE;
@@ -897,12 +896,12 @@ wlansap_roam_callback(void *ctx, struct csr_roam_info *csr_roam_info,
 			goto EXIT;
 		}
 
-		chan_state = wlan_reg_get_channel_state(
-				mac_ctx->pdev, sap_ctx->channel);
-		if (chan_state != CHANNEL_STATE_DFS)  {
+		if (!sap_chan_bond_dfs_sub_chan(
+			sap_ctx, sap_ctx->channel,
+			PHY_CHANNEL_BONDING_STATE_MAX))  {
 			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
-				  "Ignore Radar event for sap ch %d state %d",
-				  sap_ctx->channel, chan_state);
+				  "Ignore Radar event for sap ch %d",
+				  sap_ctx->channel);
 			goto EXIT;
 		}
 

+ 50 - 0
core/sap/src/sap_fsm.c

@@ -741,6 +741,56 @@ sap_dfs_is_channel_in_nol_list(struct sap_context *sap_context,
 	return false;
 }
 
+bool
+sap_chan_bond_dfs_sub_chan(struct sap_context *sap_context,
+			   uint8_t channel_number,
+			   ePhyChanBondState bond_state)
+{
+	int i;
+	tHalHandle h_hal = CDS_GET_HAL_CB();
+	tpAniSirGlobal mac_ctx;
+	uint8_t channels[MAX_BONDED_CHANNELS];
+	uint8_t num_channels;
+	struct wlan_objmgr_pdev *pdev;
+
+	if (!h_hal) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			  FL("invalid h_hal"));
+		return false;
+	}
+	mac_ctx = PMAC_STRUCT(h_hal);
+	pdev = mac_ctx->pdev;
+	if (!pdev) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			  FL("null pdev"));
+		return false;
+	}
+
+	if (wlan_reg_chan_has_dfs_attribute(pdev, channel_number))
+		return true;
+
+	/* get the bonded channels */
+	if (channel_number == sap_context->channel && bond_state >=
+						PHY_CHANNEL_BONDING_STATE_MAX)
+		num_channels = sap_ch_params_to_bonding_channels(
+					&sap_context->ch_params, channels);
+	else
+		num_channels = sap_get_bonding_channels(
+					sap_context, channel_number, channels,
+					MAX_BONDED_CHANNELS, bond_state);
+
+	for (i = 0; i < num_channels; i++) {
+		if (wlan_reg_chan_has_dfs_attribute(pdev, channels[i])) {
+			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
+				  FL("sub ch num=%d is dfs in %d"),
+				  channels[i], channel_number);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg)
 {
 	uint8_t channel;

+ 15 - 0
core/sap/src/sap_internal.h

@@ -510,6 +510,21 @@ uint8_t sap_channel_in_acs_channel_list(uint8_t channel_num,
 					struct sap_context *sap_ctx,
 					tSapChSelSpectInfo *spect_info_params);
 
+/**
+ * sap_chan_bond_dfs_sub_chan - check bonded channel includes dfs sub chan
+ * @sap_context: Handle to SAP context.
+ * @channel_number: chan whose bonded chan will be checked
+ * @bond_state: The channel bonding mode of the passed channel.
+ *
+ * This function checks if a given bonded channel includes dfs sub chan.
+ *
+ * Return: true if at least one dfs sub chan is bonded, otherwise false
+ */
+bool
+sap_chan_bond_dfs_sub_chan(struct sap_context *sap_context,
+			   uint8_t channel_number,
+			   ePhyChanBondState bond_state);
+
 /**
  * sap_acquire_vdev_ref() - Increment reference count for vdev object
  * @mac: mac handle