Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4790975a authored by Gururaj Pandurangi's avatar Gururaj Pandurangi Committed by snandini
Browse files

qcacmn: Add a feature flag for 4.9 GHz channels

Condition 4.9 GHz channels under a macro CONFIG_49GHZ_CHAN
since only WIN uses these channels and not MCC.
This reduces kmalloc memory allocation in regulatory
component.

Change-Id: Ie9241dd68909f68fa70012b664c7bc7cf050c1a5
CRs-Fixed: 2766046
parent 6fcbbe3f
Loading
Loading
Loading
Loading
+38 −4
Original line number Diff line number Diff line
@@ -1283,6 +1283,40 @@ void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
	}
}

/**
 * reg_populate_49g_band_channels() - For all the valid 4.9GHz regdb channels
 * in the master channel list, find the regulatory rules and call
 * reg_fill_channel_info() to populate master channel list with txpower,
 * antennagain, BW info, etc.
 * @reg_rule_5g: Pointer to regulatory rule.
 * @num_5g_reg_rules: Number of regulatory rules.
 * @min_bw_5g: Minimum regulatory bandwidth.
 * @mas_chan_list: Pointer to the master channel list.
 */
#ifdef CONFIG_49GHZ_CHAN
static void
reg_populate_49g_band_channels(struct cur_reg_rule *reg_rule_5g,
			       uint32_t num_5g_reg_rules,
			       uint16_t min_bw_5g,
			       struct regulatory_channel *mas_chan_list)
{
	reg_populate_band_channels(MIN_49GHZ_CHANNEL,
				   MAX_49GHZ_CHANNEL,
				   reg_rule_5g,
				   num_5g_reg_rules,
				   min_bw_5g,
				   mas_chan_list);
}
#else
static void
reg_populate_49g_band_channels(struct cur_reg_rule *reg_rule_5g,
			       uint32_t num_5g_reg_rules,
			       uint16_t min_bw_5g,
			       struct regulatory_channel *mas_chan_list)
{
}
#endif /* CONFIG_49GHZ_CHAN */

/**
 * reg_populate_6g_band_channels() - For all the valid 6GHz regdb channels
 * in the master channel list, find the regulatory rules and call
@@ -2019,10 +2053,10 @@ QDF_STATUS reg_process_master_chan_list(
		reg_populate_band_channels(MIN_5GHZ_CHANNEL, MAX_5GHZ_CHANNEL,
					   reg_rule_5g, num_5g_reg_rules,
					   min_bw_5g, mas_chan_list);
		reg_populate_band_channels(MIN_49GHZ_CHANNEL,
					   MAX_49GHZ_CHANNEL,
					   reg_rule_5g, num_5g_reg_rules,
					   min_bw_5g, mas_chan_list);
		reg_populate_49g_band_channels(reg_rule_5g,
					       num_5g_reg_rules,
					       min_bw_5g,
					       mas_chan_list);
		reg_populate_6g_band_channels(reg_rule_5g,
					      num_5g_reg_rules,
					      min_bw_5g,
+14 −12
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ const struct chan_map channel_map_us[NUM_CHANNELS] = {
	[CHAN_ENUM_2467] = {2467, 12, 20, 40},
	[CHAN_ENUM_2472] = {2472, 13, 20, 40},
	[CHAN_ENUM_2484] = {2484, 14, 20, 20},

#ifdef CONFIG_49GHZ_CHAN
	[CHAN_ENUM_4912] = {4912, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4915] = {4915, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4917] = {4917, INVALID_CHANNEL_NUM, 2, 20},
@@ -234,7 +234,7 @@ const struct chan_map channel_map_us[NUM_CHANNELS] = {
	[CHAN_ENUM_5057] = {5057, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5060] = {5060, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5080] = {5080, INVALID_CHANNEL_NUM, 2, 20},

#endif /* CONFIG_49GHZ_CHAN */
	[CHAN_ENUM_5180] = {5180, 36, 2, 160},
	[CHAN_ENUM_5200] = {5200, 40, 2, 160},
	[CHAN_ENUM_5220] = {5220, 44, 2, 160},
@@ -361,7 +361,7 @@ const struct chan_map channel_map_eu[NUM_CHANNELS] = {
	[CHAN_ENUM_2467] = {2467, 12, 20, 40},
	[CHAN_ENUM_2472] = {2472, 13, 20, 40},
	[CHAN_ENUM_2484] = {2484, 14, 20, 20},

#ifdef CONFIG_49GHZ_CHAN
	[CHAN_ENUM_4912] = {4912, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4915] = {4915, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4917] = {4917, INVALID_CHANNEL_NUM, 2, 20},
@@ -404,7 +404,7 @@ const struct chan_map channel_map_eu[NUM_CHANNELS] = {
	[CHAN_ENUM_5057] = {5057, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5060] = {5060, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5080] = {5080, INVALID_CHANNEL_NUM, 2, 20},

#endif /* CONFIG_49GHZ_CHAN */
	[CHAN_ENUM_5180] = {5180, 36, 2, 160},
	[CHAN_ENUM_5200] = {5200, 40, 2, 160},
	[CHAN_ENUM_5220] = {5220, 44, 2, 160},
@@ -531,7 +531,7 @@ const struct chan_map channel_map_jp[NUM_CHANNELS] = {
	[CHAN_ENUM_2467] = {2467, 12, 20, 40},
	[CHAN_ENUM_2472] = {2472, 13, 20, 40},
	[CHAN_ENUM_2484] = {2484, 14, 20, 20},

#ifdef CONFIG_49GHZ_CHAN
	[CHAN_ENUM_4912] = {4912, 182, 5, 5},
	[CHAN_ENUM_4915] = {4915, 183, 10, 10},
	[CHAN_ENUM_4917] = {4917, 183, 5, 5},
@@ -574,7 +574,7 @@ const struct chan_map channel_map_jp[NUM_CHANNELS] = {
	[CHAN_ENUM_5057] = {5057, 11, 5, 5},
	[CHAN_ENUM_5060] = {5060, 12, 20, 20},
	[CHAN_ENUM_5080] = {5080, 16, 20, 20},

#endif /* CONFIG_49GHZ_CHAN */
	[CHAN_ENUM_5180] = {5180, 36, 2, 160},
	[CHAN_ENUM_5200] = {5200, 40, 2, 160},
	[CHAN_ENUM_5220] = {5220, 44, 2, 160},
@@ -701,7 +701,7 @@ const struct chan_map channel_map_global[NUM_CHANNELS] = {
	[CHAN_ENUM_2467] = {2467, 12, 20, 40},
	[CHAN_ENUM_2472] = {2472, 13, 20, 40},
	[CHAN_ENUM_2484] = {2484, 14, 20, 20},

#ifdef CONFIG_49GHZ_CHAN
	[CHAN_ENUM_4912] = {4912, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4915] = {4915, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4917] = {4917, INVALID_CHANNEL_NUM, 2, 20},
@@ -744,7 +744,7 @@ const struct chan_map channel_map_global[NUM_CHANNELS] = {
	[CHAN_ENUM_5057] = {5057, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5060] = {5060, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5080] = {5080, INVALID_CHANNEL_NUM, 2, 20},

#endif /* CONFIG_49GHZ_CHAN */
	[CHAN_ENUM_5180] = {5180, 36, 2, 160},
	[CHAN_ENUM_5200] = {5200, 40, 2, 160},
	[CHAN_ENUM_5220] = {5220, 44, 2, 160},
@@ -871,7 +871,7 @@ const struct chan_map channel_map_china[NUM_CHANNELS] = {
	[CHAN_ENUM_2467] = {2467, 12, 20, 40},
	[CHAN_ENUM_2472] = {2472, 13, 20, 40},
	[CHAN_ENUM_2484] = {2484, 14, 20, 20},

#ifdef CONFIG_49GHZ_CHAN
	[CHAN_ENUM_4912] = {4912, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4915] = {4915, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_4917] = {4917, INVALID_CHANNEL_NUM, 2, 20},
@@ -914,7 +914,7 @@ const struct chan_map channel_map_china[NUM_CHANNELS] = {
	[CHAN_ENUM_5057] = {5057, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5060] = {5060, INVALID_CHANNEL_NUM, 2, 20},
	[CHAN_ENUM_5080] = {5080, INVALID_CHANNEL_NUM, 2, 20},

#endif /* CONFIG_49GHZ_CHAN */
	[CHAN_ENUM_5180] = {5180, 36, 2, 160},
	[CHAN_ENUM_5200] = {5200, 40, 2, 160},
	[CHAN_ENUM_5220] = {5220, 44, 2, 160},
@@ -2718,7 +2718,7 @@ reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
		}
	}
	if (BAND_5G_PRESENT(band_mask)) {
		for (i = MIN_49GHZ_CHANNEL; i <= MAX_5GHZ_CHANNEL; i++) {
		for (i = BAND_5GHZ_START_CHANNEL; i <= MAX_5GHZ_CHANNEL; i++) {
			if ((cur_chan_list[i].state != CHANNEL_STATE_DISABLE) &&
			    !(cur_chan_list[i].chan_flags &
			      REGULATORY_CHAN_DISABLED)) {
@@ -2789,7 +2789,7 @@ qdf_freq_t reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
		}

		if (BAND_5G_PRESENT(band_mask)) {
			min_chan = MIN_49GHZ_CHANNEL;
			min_chan = BAND_5GHZ_START_CHANNEL;
			max_chan = MAX_5GHZ_CHANNEL;

			return reg_compute_chan_to_freq(pdev, chan_num,
@@ -2802,10 +2802,12 @@ qdf_freq_t reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
	}
}

#ifdef CONFIG_49GHZ_CHAN
bool reg_is_49ghz_freq(qdf_freq_t freq)
{
	return REG_IS_49GHZ_FREQ(freq);
}
#endif /* CONFIG_49GHZ_CHAN */

qdf_freq_t reg_ch_num(uint32_t ch_enum)
{
+10 −0
Original line number Diff line number Diff line
@@ -57,8 +57,13 @@
#define REG_MAX_5GHZ_CH_FREQ channel_map[MAX_5GHZ_CHANNEL].center_freq
#endif /* CONFIG_CHAN_FREQ_API */

#ifdef CONFIG_49GHZ_CHAN
#define REG_MIN_49GHZ_CH_FREQ channel_map[MIN_49GHZ_CHANNEL].center_freq
#define REG_MAX_49GHZ_CH_FREQ channel_map[MAX_49GHZ_CHANNEL].center_freq
#else
#define REG_MIN_49GHZ_CH_FREQ 0
#define REG_MAX_49GHZ_CH_FREQ 0
#endif /* CONFIG_49GHZ_CHAN */

#define REG_IS_49GHZ_FREQ(freq) \
	(((freq) >= REG_MIN_49GHZ_CH_FREQ) &&   \
@@ -85,8 +90,13 @@
				  center_freq - HALF_20MHZ_BW)
#define TWO_GIG_ENDING_EDGE_FREQ   (channel_map_global[MAX_24GHZ_CHANNEL]. \
				  center_freq + HALF_20MHZ_BW)
#ifdef CONFIG_49GHZ_CHAN
#define FIVE_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_49GHZ_CHANNEL]. \
				  center_freq - HALF_5MHZ_BW)
#else
#define FIVE_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_5GHZ_CHANNEL]. \
				  center_freq - HALF_20MHZ_BW)
#endif /* CONFIG_49GHZ_CHAN */
#define FIVE_GIG_ENDING_EDGE_FREQ   (channel_map_global[MAX_5GHZ_CHANNEL]. \
				  center_freq + HALF_20MHZ_BW)

+15 −3
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ enum channel_enum {
	CHAN_ENUM_2467,
	CHAN_ENUM_2472,
	CHAN_ENUM_2484,

#ifdef CONFIG_49GHZ_CHAN
	CHAN_ENUM_4912,
	CHAN_ENUM_4915,
	CHAN_ENUM_4917,
@@ -340,7 +340,7 @@ enum channel_enum {
	CHAN_ENUM_5057,
	CHAN_ENUM_5060,
	CHAN_ENUM_5080,

#endif /* CONFIG_49GHZ_CHAN */
	CHAN_ENUM_5180,
	CHAN_ENUM_5200,
	CHAN_ENUM_5220,
@@ -460,9 +460,17 @@ enum channel_enum {
	MAX_24GHZ_CHANNEL = CHAN_ENUM_2484,
	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),

	INVALID_CHANNEL = 0xBAD,

#ifdef CONFIG_49GHZ_CHAN
	MIN_49GHZ_CHANNEL = CHAN_ENUM_4912,
	MAX_49GHZ_CHANNEL = CHAN_ENUM_5080,
	NUM_49GHZ_CHANNELS = (MAX_49GHZ_CHANNEL - MIN_49GHZ_CHANNEL + 1),
#else
	MIN_49GHZ_CHANNEL = INVALID_CHANNEL,
	MAX_49GHZ_CHANNEL = INVALID_CHANNEL,
	NUM_49GHZ_CHANNELS = 0,
#endif /* CONFIG_49GHZ_CHAN */

	MIN_5GHZ_CHANNEL = CHAN_ENUM_5180,
	MAX_5GHZ_CHANNEL = CHAN_ENUM_5885,
@@ -482,7 +490,11 @@ enum channel_enum {
	MAX_5DOT9_CHANNEL = CHAN_ENUM_5885,
	NUM_5DOT9_CHANNELS = (MAX_5DOT9_CHANNEL - MIN_5DOT9_CHANNEL + 1),

	INVALID_CHANNEL = 0xBAD,
#ifdef CONFIG_49GHZ_CHAN
#define BAND_5GHZ_START_CHANNEL MIN_49GHZ_CHANNEL
#else
#define BAND_5GHZ_START_CHANNEL MIN_5GHZ_CHANNEL
#endif /* CONFIG_49GHZ_CHAN */

#ifdef DISABLE_UNII_SHARED_BANDS
	MIN_UNII_1_BAND_CHANNEL = CHAN_ENUM_5180,
+10 −0
Original line number Diff line number Diff line
@@ -358,6 +358,7 @@ qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
				      uint8_t chan,
				      uint8_t band_mask);

#ifdef CONFIG_49GHZ_CHAN
/**
 * wlan_reg_is_49ghz_freq() - Check if the given channel frequency is 4.9GHz
 * @freq: Channel frequency
@@ -367,6 +368,15 @@ qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
#define WLAN_REG_IS_49GHZ_FREQ(freq) wlan_reg_is_49ghz_freq(freq)
bool wlan_reg_is_49ghz_freq(qdf_freq_t freq);

#else

#define WLAN_REG_IS_49GHZ_FREQ(freq) (false)
static inline bool wlan_reg_is_49ghz_freq(qdf_freq_t freq)
{
	return false;
}
#endif /* CONFIG_49GHZ_CHAN */

/**
 * wlan_reg_ch_num() - Get channel number from channel enum
 * @ch_enum: Channel enum
Loading