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

Commit 1c69cdfc authored by Lincoln Tran's avatar Lincoln Tran Committed by Madan Koyyalamudi
Browse files

qcacmn: Add second current channel list

For some concurrency scenarios, there is a need to have each session
operate in independent power modes. To achieve this, add a second
current channel list to store info for the secondary power mode.
Also add the APIs to read from the secondary channel list.

Change-Id: Ib1bd712645de05786ea6d4bbfe6163c385bdfeaa
CRs-fixed: 2944483
parent 2af62bf3
Loading
Loading
Loading
Loading
+69 −8
Original line number Diff line number Diff line
@@ -1032,8 +1032,8 @@ reg_append_mas_chan_list_for_6g(struct wlan_regulatory_pdev_priv_obj
		return;
	}

	master_chan_list_6g_client = pdev_priv_obj->mas_chan_list_6g_client
			[pdev_priv_obj->reg_cur_6g_ap_pwr_type]
	master_chan_list_6g_client =
		pdev_priv_obj->mas_chan_list_6g_client[REG_INDOOR_AP]
			[pdev_priv_obj->reg_cur_6g_client_mobility_type];

	qdf_mem_copy(&pdev_priv_obj->mas_chan_list[MIN_6GHZ_CHANNEL],
@@ -1041,7 +1041,22 @@ reg_append_mas_chan_list_for_6g(struct wlan_regulatory_pdev_priv_obj
		     NUM_6GHZ_CHANNELS *
		     sizeof(struct regulatory_channel));
}
#else

static void
reg_populate_secondary_cur_chan_list(struct wlan_regulatory_pdev_priv_obj
				     *pdev_priv_obj)
{
	qdf_mem_copy(pdev_priv_obj->secondary_cur_chan_list,
		     pdev_priv_obj->mas_chan_list,
		     (NUM_CHANNELS - NUM_6GHZ_CHANNELS) *
		     sizeof(struct regulatory_channel));
	qdf_mem_copy(&pdev_priv_obj->
		     secondary_cur_chan_list[MIN_6GHZ_CHANNEL],
		     pdev_priv_obj->mas_chan_list_6g_ap
		     [pdev_priv_obj->reg_cur_6g_ap_pwr_type],
		     NUM_6GHZ_CHANNELS * sizeof(struct regulatory_channel));
}
#else /* CONFIG_REG_CLIENT */
static void
reg_append_mas_chan_list_for_6g(struct wlan_regulatory_pdev_priv_obj
				*pdev_priv_obj)
@@ -1057,6 +1072,12 @@ reg_append_mas_chan_list_for_6g(struct wlan_regulatory_pdev_priv_obj
		     pdev_priv_obj->mas_chan_list_6g_ap[ap_pwr_type],
		     NUM_6GHZ_CHANNELS * sizeof(struct regulatory_channel));
}

static inline void
reg_populate_secondary_cur_chan_list(struct wlan_regulatory_pdev_priv_obj
				     *pdev_priv_obj)
{
}
#endif /* CONFIG_REG_CLIENT */

static void reg_copy_6g_cur_mas_chan_list_to_cmn(
@@ -1065,7 +1086,7 @@ static void reg_copy_6g_cur_mas_chan_list_to_cmn(
	if (pdev_priv_obj->is_6g_channel_list_populated)
		reg_append_mas_chan_list_for_6g(pdev_priv_obj);
}
#else
#else /* CONFIG_BAND_6GHZ */
static inline void
reg_copy_6g_cur_mas_chan_list_to_cmn(
			struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
@@ -1077,6 +1098,23 @@ reg_append_mas_chan_list_for_6g(
			struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
{
}

#ifdef CONFIG_REG_CLIENT
static void
reg_populate_secondary_cur_chan_list(struct wlan_regulatory_pdev_priv_obj
				     *pdev_priv_obj)
{
	qdf_mem_copy(pdev_priv_obj->secondary_cur_chan_list,
		     pdev_priv_obj->mas_chan_list,
		     NUM_CHANNELS * sizeof(struct regulatory_channel));
}
#else /* CONFIG_REG_CLIENT */
static inline void
reg_populate_secondary_cur_chan_list(struct wlan_regulatory_pdev_priv_obj
				     *pdev_priv_obj)
{
}
#endif /* CONFIG_REG_CLIENT */
#endif /* CONFIG_BAND_6GHZ */

void reg_compute_pdev_current_chan_list(struct wlan_regulatory_pdev_priv_obj
@@ -1087,6 +1125,8 @@ void reg_compute_pdev_current_chan_list(struct wlan_regulatory_pdev_priv_obj
	qdf_mem_copy(pdev_priv_obj->cur_chan_list, pdev_priv_obj->mas_chan_list,
		     NUM_CHANNELS * sizeof(struct regulatory_channel));

	reg_populate_secondary_cur_chan_list(pdev_priv_obj);

	reg_modify_chan_list_for_freq_range(pdev_priv_obj->cur_chan_list,
					    pdev_priv_obj->range_2g_low,
					    pdev_priv_obj->range_2g_high,
@@ -2157,3 +2197,24 @@ QDF_STATUS reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,

	return QDF_STATUS_SUCCESS;
}

#ifdef CONFIG_REG_CLIENT
QDF_STATUS
reg_get_secondary_current_chan_list(struct wlan_objmgr_pdev *pdev,
				    struct regulatory_channel *chan_list)
{
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;

	pdev_priv_obj = reg_get_pdev_obj(pdev);

	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
		reg_err("reg pdev private obj is NULL");
		return QDF_STATUS_E_FAILURE;
	}

	qdf_mem_copy(chan_list, pdev_priv_obj->secondary_cur_chan_list,
		     NUM_CHANNELS * sizeof(struct regulatory_channel));

	return QDF_STATUS_SUCCESS;
}
#endif
+21 −0
Original line number Diff line number Diff line
@@ -98,9 +98,30 @@ reg_process_master_chan_list_ext(struct cur_regulatory_info *reg_info);
 */
QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info *reg_info);

/**
 * reg_get_current_chan_list() - provide the pdev current channel list
 * @pdev: pdev pointer
 * @chan_list: channel list pointer
 *
 * Return: QDF_STATUS
 */
QDF_STATUS reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
				     struct regulatory_channel *chan_list);

#ifdef CONFIG_REG_CLIENT
/**
 * reg_get_secondary_current_chan_list() - provide the pdev secondary current
 * channel list
 * @pdev: pdev pointer
 * @chan_list: channel list pointer
 *
 * Return: QDF_STATUS
 */
QDF_STATUS
reg_get_secondary_current_chan_list(struct wlan_objmgr_pdev *pdev,
				    struct regulatory_channel *chan_list);
#endif

/**
 * reg_update_nol_history_ch() - Set nol-history flag for the channels in the
 * list.
+5 −0
Original line number Diff line number Diff line
@@ -175,6 +175,8 @@ struct wlan_regulatory_psoc_priv_obj {
/**
 * struct wlan_regulatory_pdev_priv_obj - wlan regulatory pdev private object
 * @cur_chan_list: current channel list, includes 6G channels
 * @secondary_cur_chan_list: secondary current channel list, for concurrency
 * situations
 * @mas_chan_list: master channel list
 * @is_6g_channel_list_populated: indicates the channel lists are populated
 * @mas_chan_list_6g_ap: master channel list for 6G AP, includes all power types
@@ -193,6 +195,9 @@ struct wlan_regulatory_psoc_priv_obj {
 */
struct wlan_regulatory_pdev_priv_obj {
	struct regulatory_channel cur_chan_list[NUM_CHANNELS];
#ifdef CONFIG_REG_CLIENT
	struct regulatory_channel secondary_cur_chan_list[NUM_CHANNELS];
#endif
	struct regulatory_channel mas_chan_list[NUM_CHANNELS];
#ifdef CONFIG_BAND_6GHZ
	bool is_6g_channel_list_populated;
+101 −0
Original line number Diff line number Diff line
@@ -2515,6 +2515,35 @@ bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
		REGULATORY_CHAN_INDOOR_ONLY);
}

#ifdef CONFIG_REG_CLIENT
bool reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev,
					  qdf_freq_t freq)
{
	struct regulatory_channel *secondary_cur_chan_list;
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
	enum channel_enum chan_enum;

	pdev_priv_obj = reg_get_pdev_obj(pdev);

	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
		reg_err("reg pdev priv obj is NULL");
		return false;
	}

	chan_enum = reg_get_chan_enum_for_freq(freq);

	if (chan_enum == INVALID_CHANNEL) {
		reg_err_rl("Invalid chan enum %d", chan_enum);
		return false;
	}

	secondary_cur_chan_list = pdev_priv_obj->secondary_cur_chan_list;

	return (secondary_cur_chan_list[chan_enum].chan_flags &
		REGULATORY_CHAN_INDOOR_ONLY);
}
#endif

#ifdef CONFIG_BAND_6GHZ
bool reg_is_6ghz_chan_freq(uint16_t freq)
{
@@ -3259,6 +3288,54 @@ static uint32_t reg_get_channel_flags_for_freq(struct wlan_objmgr_pdev *pdev,
	return pdev_priv_obj->cur_chan_list[chan_enum].chan_flags;
}

#ifdef CONFIG_REG_CLIENT
enum channel_state reg_get_channel_state_from_secondary_list_for_freq(
						struct wlan_objmgr_pdev *pdev,
						qdf_freq_t freq)
{
	enum channel_enum ch_idx;
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;

	ch_idx = reg_get_chan_enum_for_freq(freq);

	if (ch_idx == INVALID_CHANNEL)
		return CHANNEL_STATE_INVALID;

	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 CHANNEL_STATE_INVALID;
	}

	return pdev_priv_obj->secondary_cur_chan_list[ch_idx].state;
}

static uint32_t reg_get_channel_flags_from_secondary_list_for_freq(
						struct wlan_objmgr_pdev *pdev,
						qdf_freq_t freq)
{
	enum channel_enum chan_enum;
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;

	chan_enum = reg_get_chan_enum_for_freq(freq);

	if (chan_enum == INVALID_CHANNEL) {
		reg_err("chan freq is not valid");
		return REGULATORY_CHAN_INVALID;
	}

	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 REGULATORY_CHAN_INVALID;
	}

	return pdev_priv_obj->secondary_cur_chan_list[chan_enum].chan_flags;
}
#endif

/**
 * reg_get_5g_bonded_chan_array_for_freq()- Return the channel state for a
 * 5G or 6G channel frequency based on the bonded channel.
@@ -3772,6 +3849,17 @@ bool reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
}

#ifdef CONFIG_REG_CLIENT
bool reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev,
					   qdf_freq_t freq)
{
	uint32_t chan_flags;

	chan_flags = reg_get_channel_flags_from_secondary_list_for_freq(pdev,
								     freq);

	return chan_flags & REGULATORY_CHAN_RADAR;
}

/**
 * reg_get_psoc_mas_chan_list () - Get psoc master channel list
 * @pdev: pointer to pdev object
@@ -3952,6 +4040,19 @@ bool reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
	return ch_state == CHANNEL_STATE_DISABLE;
}

#ifdef CONFIG_REG_CLIENT
bool reg_is_disable_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev,
					       qdf_freq_t freq)
{
	enum channel_state ch_state;

	ch_state = reg_get_channel_state_from_secondary_list_for_freq(pdev,
								      freq);

	return ch_state == CHANNEL_STATE_DISABLE;
}
#endif

bool reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
	uint32_t chan_flags;
+53 −0
Original line number Diff line number Diff line
@@ -588,6 +588,19 @@ bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq);
 */
bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);

#ifdef CONFIG_REG_CLIENT
/**
 * reg_is_freq_indoor_in_secondary_list() - Check if the input frequency is
 * an indoor frequency in the secondary channel list
 * @pdev: Pointer to pdev.
 * @freq: Channel frequency.
 *
 * Return: Return true if the input frequency is indoor, else false.
 */
bool reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev,
					  qdf_freq_t freq);
#endif

#ifdef CONFIG_BAND_6GHZ
/**
 * reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz
@@ -986,6 +999,20 @@ reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev,
enum channel_state reg_get_channel_state_for_freq(struct wlan_objmgr_pdev *pdev,
						  qdf_freq_t freq);

#ifdef CONFIG_REG_CLIENT
/**
 * reg_get_channel_state_from_secondary_list_for_freq() - Get channel state
 * from secondary regulatory current channel list
 * @pdev: Pointer to pdev
 * @freq: channel center frequency.
 *
 * Return: channel state
 */
enum channel_state reg_get_channel_state_from_secondary_list_for_freq(
						struct wlan_objmgr_pdev *pdev,
						qdf_freq_t freq);
#endif

/**
 * reg_get_5g_bonded_channel_state_for_freq() - Get channel state for
 * 5G bonded channel using the channel frequency
@@ -1064,6 +1091,19 @@ void reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev,
 */
bool reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);

#ifdef CONFIG_REG_CLIENT
/**
 * reg_is_dfs_in_secondary_list_for_freq() - Checks the channel state for DFS
 * from the secondary channel list
 * @pdev: pdev ptr
 * @freq: Channel center frequency
 *
 * Return: true or false
 */
bool reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev,
					   qdf_freq_t freq);
#endif

/**
 * reg_chan_freq_is_49ghz() - Check if the input channel center frequency is
 * 4.9GHz
@@ -1157,6 +1197,19 @@ reg_get_5g_bonded_channel_for_freq(struct wlan_objmgr_pdev *pdev,
 */
bool reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);

#ifdef CONFIG_REG_CLIENT
/**
 * reg_is_disable_in_secondary_list_for_freq() - Check if the given channel
 * frequency is in disable state
 * @pdev: Pointer to pdev
 * @freq: Channel frequency
 *
 * Return: True if channel state is disabled, else false
 */
bool reg_is_disable_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev,
					       qdf_freq_t freq);
#endif

/**
 * reg_is_passive_for_freq() - Check if the given channel frequency is in
 * passive state
Loading