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

Commit 4cb64ffe authored by Gururaj Pandurangi's avatar Gururaj Pandurangi Committed by Madan Koyyalamudi
Browse files

qcacmn: Add new API to get chan list with band mask for SAP

Add new API reg_get_band_from_cur_chan_list to build a chan
list based on either primary/secondary current channel list
as per requirement.
The legacy API reg_get_band_channel_list uses primary
current chan list to build a channel list. SAP needs to use
a secondary current channel list. Add a new API for SAP,
reg_get_secondary_band_channel_list for the same. Both these
APIs will call new API reg_get_band_from_cur_chan_list
by passing primary/secondary current chan list respectively.

Change-Id: I1e5573ac9371fc3ce5dc2c387fbd1d47696a161a
CRs-Fixed: 2947516
parent 8f2c736c
Loading
Loading
Loading
Loading
+56 −14
Original line number Diff line number Diff line
@@ -2719,23 +2719,28 @@ static inline bool BAND_6G_PRESENT(uint8_t band_mask)
}
#endif /* CONFIG_BAND_6GHZ */

uint16_t
reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
/**
 * reg_get_band_from_cur_chan_list() - Get channel list and number of channels
 * @pdev: pdev ptr
 * @band_mask: Input bitmap with band set
 * @channel_list: Pointer to Channel List
 * @cur_chan_list: Pointer to primary current channel list for non-beaconing
 * entites (STA, p2p client) and secondary channel list for beaconing entities
 * (SAP, p2p GO)
 *
 * Get the given channel list and number of channels from the current channel
 * list based on input band bitmap.
 *
 * Return: Number of channels, else 0 to indicate error
 */
static uint16_t
reg_get_band_from_cur_chan_list(struct wlan_objmgr_pdev *pdev,
				uint8_t band_mask,
			  struct regulatory_channel *channel_list)
				struct regulatory_channel *channel_list,
				struct regulatory_channel *cur_chan_list)
{
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
	struct regulatory_channel *cur_chan_list;
	uint16_t i, num_channels = 0;

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

	cur_chan_list = pdev_priv_obj->cur_chan_list;

	if (BAND_2G_PRESENT(band_mask)) {
		for (i = MIN_24GHZ_CHANNEL; i <= MAX_24GHZ_CHANNEL; i++) {
			if ((cur_chan_list[i].state != CHANNEL_STATE_DISABLE) &&
@@ -2775,6 +2780,43 @@ reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
	return num_channels;
}

uint16_t
reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
			  uint8_t band_mask,
			  struct regulatory_channel *channel_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 priv obj is NULL");
		return 0;
	}

	return reg_get_band_from_cur_chan_list(pdev, band_mask, channel_list,
					       pdev_priv_obj->cur_chan_list);
}

#ifdef CONFIG_REG_CLIENT
uint16_t
reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev,
				    uint8_t band_mask,
				    struct regulatory_channel *channel_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 priv obj is NULL");
		return 0;
	}

	return reg_get_band_from_cur_chan_list(
				pdev, band_mask, channel_list,
				pdev_priv_obj->secondary_cur_chan_list);
}
#endif

qdf_freq_t reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
				 uint8_t chan_num,
				 uint8_t band_mask)
+23 −3
Original line number Diff line number Diff line
@@ -760,13 +760,14 @@ static inline uint16_t reg_max_6ghz_chan_freq(void)
#endif /* CONFIG_BAND_6GHZ */

/**
 * reg_get_band_channel_list() - Get the channel list and number of channels
 * reg_get_band_channel_list() - Caller function to
 * reg_get_band_from_cur_chan_list with primary current channel list
 * @pdev: pdev ptr
 * @band_mask: Input bitmap with band set
 * @channel_list: Pointer to Channel List
 *
 * Get the given channel list and number of channels from the current channel
 * list based on input band bitmap.
 * Caller function to reg_get_band_from_cur_chan_listto get the primary channel
 * list and number of channels (for non-beaconing entities).
 *
 * Return: Number of channels, else 0 to indicate error
 */
@@ -774,6 +775,25 @@ uint16_t reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
				   uint8_t band_mask,
				   struct regulatory_channel *channel_list);

#ifdef CONFIG_REG_CLIENT
/**
 * reg_get_secondary_band_channel_list() - Caller function to
 * reg_get_band_from_cur_chan_list with secondary current channel list
 * @pdev: pdev ptr
 * @band_mask: Input bitmap with band set
 * @channel_list: Pointer to Channel List
 *
 * Caller function to reg_get_band_from_cur_chan_list to get the secondary
 * channel list and number of channels (for beaconing entities).
 *
 * Return: Number of channels, else 0 to indicate error
 */
uint16_t reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev,
					     uint8_t band_mask,
					     struct regulatory_channel
					     *channel_list);
#endif

/**
 * reg_chan_band_to_freq - Return channel frequency based on the channel number
 * and band.
+20 −0
Original line number Diff line number Diff line
@@ -355,6 +355,26 @@ wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
			       uint8_t band_mask,
			       struct regulatory_channel *channel_list);

#ifdef CONFIG_REG_CLIENT
/**
 * wlan_reg_get_secondary_band_channel_list() - Get secondary channel list for
 * SAP based on the band_mask
 * @pdev: pdev ptr
 * @band_mask: Input bitmap with band set
 * @channel_list: Pointer to Channel List
 *
 * Get the given channel list and number of channels from the secondary current
 * channel list based on input band bitmap.
 *
 * Return: Number of channels, else 0 to indicate error
 */
uint16_t
wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev,
					 uint8_t band_mask,
					 struct regulatory_channel
					 *channel_list);
#endif

/**
 * wlan_reg_chan_band_to_freq - Return channel frequency based on the channel
 * number and band.
+17 −0
Original line number Diff line number Diff line
@@ -923,6 +923,23 @@ wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
	return reg_get_band_channel_list(pdev, band_mask, channel_list);
}

#ifdef CONFIG_REG_CLIENT
uint16_t
wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev,
					 uint8_t band_mask,
					 struct regulatory_channel
					 *channel_list)
{
	if (!pdev) {
		reg_err("pdev object is NULL");
		return 0;
	}

	return reg_get_secondary_band_channel_list(pdev, band_mask,
						   channel_list);
}
#endif

qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
				      uint8_t chan, uint8_t band_mask)
{