瀏覽代碼

qcacmn: Expand sub-channel array storage for 11be chipsets

The sub-channel array size was maximum of 8 sub-channels corresponding
to a maximum channel width of 160MHz. But with the introduction of 11be
higher channel width of 320MHz is possible.

Expand the size of sub-channel array to 16 to accommodate the sub-channels
of 320MHz in case of 11be chipsets.

Change-Id: I7ffd1a7c0f05085edff74b92e47ab5a0dab42ef0
CRs-Fixed: 3068405
Vignesh U 3 年之前
父節點
當前提交
b7b42cc588

+ 7 - 0
umac/dfs/core/src/dfs_process_radar_found_ind.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -115,6 +116,12 @@ dfs_flush_additional_pulses(struct wlan_dfs *dfs)
 /* Number of 20MHz sub-channels in 320 MHz segment */
 #define NUM_CHANNELS_320MHZ 16
 
+#ifdef WLAN_FEATURE_11BE
+#define MAX_20MHZ_SUBCHANS NUM_CHANNELS_320MHZ
+#else
+#define MAX_20MHZ_SUBCHANS NUM_CHANNELS_160MHZ
+#endif
+
 #if defined(QCA_DFS_RCSA_SUPPORT)
 /**
  * dfs_send_nol_ie_and_rcsa()- Send NOL IE and RCSA action frames.

+ 4 - 3
umac/dfs/core/src/misc/dfs_cac.c

@@ -2,6 +2,7 @@
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting
  * All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -67,7 +68,7 @@ void dfs_clear_cac_started_chan(struct wlan_dfs *dfs)
 static void dfs_clear_nol_history_for_curchan(struct wlan_dfs *dfs)
 {
 	struct dfs_channel *chan = dfs->dfs_curchan;
-	uint16_t sub_channels[NUM_CHANNELS_160MHZ];
+	uint16_t sub_channels[MAX_20MHZ_SUBCHANS];
 	uint8_t num_subchs;
 
 	num_subchs = dfs_get_bonding_channel_without_seg_info_for_freq(
@@ -397,8 +398,8 @@ dfs_is_new_chan_subset_of_old_chan(struct wlan_dfs *dfs,
 				   struct dfs_channel *new_chan,
 				   struct dfs_channel *old_chan)
 {
-	uint16_t new_subchans[NUM_CHANNELS_160MHZ];
-	uint16_t old_subchans[NUM_CHANNELS_160MHZ];
+	uint16_t new_subchans[MAX_20MHZ_SUBCHANS];
+	uint16_t old_subchans[MAX_20MHZ_SUBCHANS];
 	uint8_t n_new_subchans = 0;
 	uint8_t n_old_subchans = 0;
 

+ 4 - 3
umac/dfs/core/src/misc/dfs_nol.c

@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  * Copyright (c) 2002-2010, Atheros Communications Inc.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -567,7 +568,7 @@ void dfs_clear_nolhistory(struct wlan_dfs *dfs)
 	bool sta_opmode;
 	int i;
 	qdf_freq_t *nol_freq_list = NULL;
-	int num_nol_history_chans;
+	uint32_t num_nol_history_chans;
 
 	if (!dfs->dfs_is_stadfs_enabled)
 		return;
@@ -627,7 +628,7 @@ void dfs_clear_nolhistory(struct wlan_dfs *dfs)
 void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs)
 {
 	struct dfs_nolelem *nol;
-	uint16_t freq_list[NUM_CHANNELS_160MHZ];
+	uint16_t freq_list[MAX_20MHZ_SUBCHANS];
 	int i, nchans = 0;
 
 	nchans = dfs_get_bonding_channels_for_freq(dfs,
@@ -637,7 +638,7 @@ void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs)
 						   freq_list);
 
 	WLAN_DFSNOL_LOCK(dfs);
-	for (i = 0; i < nchans && i < NUM_CHANNELS_160MHZ; i++) {
+	for (i = 0; i < nchans && i < MAX_20MHZ_SUBCHANS; i++) {
 		nol = dfs->dfs_nol;
 		while (nol) {
 			if (nol->nol_freq == freq_list[i]) {

+ 23 - 9
umac/dfs/core/src/misc/dfs_process_radar_found_ind.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -160,7 +161,7 @@ dfs_radar_add_channel_list_to_nol_for_freq(struct wlan_dfs *dfs,
 	uint16_t last_chan_freq = 0;
 	uint8_t num_ch = 0;
 
-	if (*num_channels > NUM_CHANNELS_320MHZ) {
+	if (*num_channels > MAX_20MHZ_SUBCHANS) {
 		dfs_err(dfs, WLAN_DEBUG_DFS,
 			"Invalid num channels: %d", *num_channels);
 		return QDF_STATUS_E_FAILURE;
@@ -414,7 +415,7 @@ dfs_find_radar_affected_subchans_for_freq(struct wlan_dfs *dfs,
 	uint32_t flag;
 	int32_t sidx;
 	uint16_t candidate_subchan_freq;
-	uint16_t cur_subchans[NUM_CHANNELS_320MHZ];
+	uint16_t cur_subchans[MAX_20MHZ_SUBCHANS];
 	uint8_t n_cur_subchans;
 	struct dfs_channel *curchan = dfs->dfs_curchan;
 	struct freqs_offsets freq_offset;
@@ -586,13 +587,26 @@ void dfs_get_160mhz_bonding_channels(uint16_t center_freq, uint16_t *freq_list)
  *
  * Return: void
  */
+#ifdef WLAN_FEATURE_11BE
 static
-void dfs_get_320mhz_bonding_channels(uint16_t center_freq, uint16_t *freq_list)
+void dfs_get_320mhz_bonding_channels(uint16_t center_freq, uint16_t *freq_list,
+				     uint8_t *nchannels)
 {
 	uint16_t chwidth = 320;
 
+	*nchannels = 16;
 	dfs_calc_bonding_freqs(center_freq, chwidth, freq_list);
 }
+#else
+static
+void dfs_get_320mhz_bonding_channels(uint16_t center_freq, uint16_t *freq_list,
+				     uint8_t *nchannels)
+{
+	*nchannels = 0;
+	dfs_debug(NULL, WLAN_DEBUG_DFS_ALWAYS,
+		  "320MHz chan width for non 11be");
+}
+#endif
 
 /*
  * dfs_get_bonding_channel_without_seg_info_for_freq() - Get bonding frequency
@@ -634,9 +648,9 @@ dfs_get_bonding_channel_without_seg_info_for_freq(struct dfs_channel *chan,
 		center_freq = chan->dfs_ch_mhz_freq_seg2;
 		dfs_get_160mhz_bonding_channels(center_freq, freq_list);
 	} else if (WLAN_IS_CHAN_MODE_320(chan)) {
-		nchannels = 16;
 		center_freq = chan->dfs_ch_mhz_freq_seg2;
-		dfs_get_320mhz_bonding_channels(center_freq, freq_list);
+		dfs_get_320mhz_bonding_channels(center_freq, freq_list,
+						&nchannels);
 	}
 
 	return nchannels;
@@ -762,8 +776,8 @@ uint8_t dfs_get_bonding_channels_for_freq(struct wlan_dfs *dfs,
 		else
 			dfs_get_160mhz_bonding_channels(center_freq, freq_list);
 	} else if (WLAN_IS_CHAN_MODE_320(curchan)) {
-		nchannels = 16;
-		dfs_get_320mhz_bonding_channels(center_freq, freq_list);
+		dfs_get_320mhz_bonding_channels(center_freq, freq_list,
+						&nchannels);
 	}  else if (WLAN_IS_CHAN_MODE_80_80(curchan)) {
 		/*
 		 * If the current channel's bandwidth is 80P80MHz,
@@ -1065,8 +1079,8 @@ dfs_process_radar_ind_on_home_chan(struct wlan_dfs *dfs,
 				   struct radar_found_info *radar_found)
 {
 	bool wait_for_csa = false;
-	uint16_t freq_list[NUM_CHANNELS_320MHZ];
-	uint16_t nol_freq_list[NUM_CHANNELS_320MHZ];
+	uint16_t freq_list[MAX_20MHZ_SUBCHANS];
+	uint16_t nol_freq_list[MAX_20MHZ_SUBCHANS];
 	uint8_t num_channels;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	uint32_t freq_center;

+ 2 - 1
umac/dfs/core/src/misc/dfs_random_chan_sel.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -1299,7 +1300,7 @@ static void dfs_apply_rules_for_freq(struct wlan_dfs *dfs,
 	int i;
 	bool found = false;
 	uint16_t j;
-	uint16_t freq_list[NUM_CHANNELS_160MHZ];
+	uint16_t freq_list[MAX_20MHZ_SUBCHANS];
 	uint8_t num_channels = 0;
 
 	dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN, "flags %d", flags);

+ 7 - 4
umac/dfs/dispatcher/src/wlan_dfs_utils_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -648,15 +649,17 @@ static void utils_dfs_get_max_sup_width(struct wlan_objmgr_pdev *pdev,
 void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
 			     void *clist, uint32_t *num_chan)
 {
-	int i = 0, j = 0;
+	uint32_t i = 0, j = 0;
 	enum channel_state state;
 	struct regulatory_channel *cur_chan_list;
 	struct wlan_dfs *dfs;
 	struct dfs_channel *chan_list = (struct dfs_channel *)clist;
 
 	dfs = wlan_pdev_get_dfs_obj(pdev);
-	if (!dfs)
+	if (!dfs) {
+		*num_chan = 0;
 		return;
+	}
 
 	cur_chan_list = qdf_mem_malloc(NUM_CHANNELS *
 			sizeof(struct regulatory_channel));
@@ -723,7 +726,7 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 	uint8_t chan_num;
 	uint16_t center_freq;
 	uint16_t flagext;
-	int i, j = 0;
+	uint32_t i, j = 0;
 
 	dfs = wlan_pdev_get_dfs_obj(pdev);
 	if (!dfs) {
@@ -800,7 +803,7 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 	uint8_t weight_list[NUM_CHANNELS] = {0};
 	uint32_t len;
 	uint32_t weight_len;
-	int i;
+	uint32_t i;
 	struct wlan_objmgr_psoc *psoc;
 	uint32_t conn_count = 0;
 	enum policy_mgr_con_mode mode;

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

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the