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

Commit b3c6b2d0 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 1f86f4dd on remote branch

Change-Id: Ib6ffa685310baf7d0e9f29a9fa0d3a8a9bb2d8de
parents e19fbb22 1f86f4dd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022, 2024 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
@@ -68,7 +68,7 @@ do { \
#define DP_TX_QUEUE_MASK 0x3

/* number of dwords for htt_tx_msdu_desc_ext2_t */
#define DP_TX_MSDU_INFO_META_DATA_DWORDS 7
#define DP_TX_MSDU_INFO_META_DATA_DWORDS 9

/**
 * struct dp_tx_frag_info_s
+18 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022,2024 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
@@ -5278,4 +5278,21 @@ bool reg_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc *psoc)

	return psoc_priv_obj->is_upper_6g_edge_ch_disabled;
}

static inline bool reg_is_within_range_inclusive(enum channel_enum left,
						 enum channel_enum right,
						 enum channel_enum idx)
{
	return (idx >= left) && (idx <= right);
}

uint16_t reg_convert_enum_to_6g_idx(enum channel_enum ch_idx)
{
	if (!reg_is_within_range_inclusive(MIN_6GHZ_CHANNEL,
					   MAX_6GHZ_CHANNEL,
					   ch_idx))
		return INVALID_CHANNEL;

	return (ch_idx - MIN_6GHZ_CHANNEL);
}
#endif
+11 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 *
 * Permission to use, copy, modify, and/or distribute this software for
@@ -1663,5 +1664,15 @@ bool reg_is_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc);
 * Return: true if edge channels are supported, else false
 */
bool reg_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc *psoc);

/**
 * reg_convert_enum_to_6g_idx() - Convert a channel enum between
 * MIN_6GHZ_CHANNEL and MAX_6GHZ_CHANNEL, to an index between 0 and
 * NUM_6GHZ_CHANNELS
 * @ch_idx: Channel index
 *
 * Return: enum channel_enum
 */
uint16_t reg_convert_enum_to_6g_idx(enum channel_enum ch_idx);
#endif
#endif
+98 −54
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2021-2024 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
@@ -373,82 +373,126 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
	return QDF_STATUS_SUCCESS;
}

static inline bool reg_is_state_allowed(enum channel_state chan_state)
{
	return !((chan_state == CHANNEL_STATE_INVALID) ||
		 (chan_state == CHANNEL_STATE_DISABLE));
}

#ifdef CONFIG_REG_CLIENT
#ifdef CONFIG_BAND_6GHZ
QDF_STATUS
reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
/**
 * reg_check_if_6g_pwr_type_supp_for_chan() - Check if 6 GHz power type is
 *                                            supported for the channel
 * @pdev: Pointer to pdev
 * @pwr_type: 6 GHz power type
 * @chan_idx: Connection channel index
 *
 * Return: Return QDF_STATUS_SUCCESS if 6 GHz power type supported for
 *         the given channel, else return QDF_STATUS_E_FAILURE.
 */
static
QDF_STATUS reg_check_if_6g_pwr_type_supp_for_chan(
						struct wlan_objmgr_pdev *pdev,
			       uint8_t *ap_ctry, uint8_t *sta_ctry,
			       enum reg_6g_ap_type *pwr_type_6g,
			       bool *ctry_code_match,
			       enum reg_6g_ap_type ap_pwr_type)
						enum reg_6g_ap_type pwr_type,
						enum channel_enum chan_idx)
{
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
	struct regulatory_channel *ch_info;
	enum reg_6g_client_type client_type;
	uint16_t ch_idx_6g;

	*pwr_type_6g = ap_pwr_type;
	pdev_priv_obj = reg_get_pdev_obj(pdev);
	if (!pdev_priv_obj) {
		reg_err("pdev priv obj null");
		return QDF_STATUS_E_FAILURE;
	}

	reg_debug("STA country: %c%c, AP country: %c%c, AP power type: %d",
		  sta_ctry[0], sta_ctry[1], ap_ctry[0], ap_ctry[1],
		  ap_pwr_type);

	if (!qdf_mem_cmp(ap_ctry, sta_ctry, REG_ALPHA2_LEN)) {
		*ctry_code_match = true;
		if (ap_pwr_type == REG_VERY_LOW_POWER_AP) {
			if (!pdev_priv_obj->reg_rules.num_of_6g_client_reg_rules[ap_pwr_type]) {
				reg_err("VLP not supported, can't connect");
	ch_idx_6g = reg_convert_enum_to_6g_idx(chan_idx);
	if (ch_idx_6g >= NUM_6GHZ_CHANNELS) {
		reg_err("Invalid channel");
		return QDF_STATUS_E_NOSUPPORT;
	}
		}

	if (QDF_IS_STATUS_ERROR(reg_get_cur_6g_client_type(pdev, &client_type)))
		return QDF_STATUS_E_FAILURE;

	ch_info = &pdev_priv_obj->mas_chan_list_6g_client[pwr_type][client_type][ch_idx_6g];

	if (reg_is_state_allowed(ch_info->state) &&
	    !(ch_info->chan_flags & REGULATORY_CHAN_DISABLED))
		return QDF_STATUS_SUCCESS;
	}

	*ctry_code_match = false;
	/*
	 * If reg_info=0 not included, STA should operate in VLP mode.
	 * If STA country doesn't support VLP, do not return if Wi-Fi
	 * safe mode or RF test mode or enable relaxed connection policy,
	 * rather STA should operate in LPI mode.
	 * wlan_cm_get_check_6ghz_security API returns true if
	 * neither Safe mode nor RF test mode are enabled.
	 */
	if (ap_pwr_type != REG_INDOOR_AP) {
		if (wlan_reg_ctry_support_vlp(sta_ctry))
			*pwr_type_6g = REG_VERY_LOW_POWER_AP;
		if (!wlan_reg_ctry_support_vlp(sta_ctry) &&
		    wlan_cm_get_check_6ghz_security(psoc)) {
			reg_err("VLP not supported, can't connect");
	reg_err("6 GHz power type = %d not supported by STA %d index %d",
		pwr_type, client_type, ch_idx_6g);
	return QDF_STATUS_E_NOSUPPORT;
}
	}

	if (wlan_reg_ctry_support_vlp(sta_ctry) &&
	    wlan_reg_ctry_support_vlp(ap_ctry) &&
	    ap_pwr_type == REG_INDOOR_AP) {
		reg_debug("STA ctry doesn't match with AP ctry, switch to VLP");
		*pwr_type_6g = REG_VERY_LOW_POWER_AP;
QDF_STATUS
reg_get_best_6g_power_type(struct wlan_objmgr_psoc *psoc,
			   struct wlan_objmgr_pdev *pdev,
			   enum reg_6g_ap_type *pwr_type_6g,
			   enum reg_6g_ap_type ap_pwr_type,
			   uint32_t chan_freq)
{
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
	enum channel_enum chan_idx = reg_get_chan_enum_for_freq(chan_freq);

	*pwr_type_6g = ap_pwr_type;
	pdev_priv_obj = reg_get_pdev_obj(pdev);
	if (!pdev_priv_obj) {
		reg_err("pdev priv obj null");
		return QDF_STATUS_E_FAILURE;
	}

	if (!wlan_reg_ctry_support_vlp(ap_ctry) &&
	    ap_pwr_type == REG_INDOOR_AP) {
		reg_debug("VLP not supported by AP, allow STA IN LPI");
		*pwr_type_6g = REG_INDOOR_AP;
	if (pdev_priv_obj->reg_rules.num_of_6g_client_reg_rules[ap_pwr_type] &&
	    QDF_IS_STATUS_SUCCESS(reg_check_if_6g_pwr_type_supp_for_chan(
						pdev,
						ap_pwr_type, chan_idx))) {
		reg_debug("AP power type: %d , is supported by client",
			  ap_pwr_type);
		return QDF_STATUS_SUCCESS;
	}

	if (ap_pwr_type == REG_INDOOR_AP) {
		if (pdev_priv_obj->reg_rules.num_of_6g_client_reg_rules[REG_VERY_LOW_POWER_AP] &&
		    QDF_IS_STATUS_SUCCESS(
			reg_check_if_6g_pwr_type_supp_for_chan(pdev,
							REG_VERY_LOW_POWER_AP,
							chan_idx))) {
			*pwr_type_6g = REG_VERY_LOW_POWER_AP;
			reg_debug("AP power type = %d, selected power type = %d",
				  ap_pwr_type, *pwr_type_6g);
			return QDF_STATUS_SUCCESS;
		} else {
			goto no_support;
		}
	} else if (ap_pwr_type == REG_STANDARD_POWER_AP) {
		if (pdev_priv_obj->reg_rules.num_of_6g_client_reg_rules[REG_VERY_LOW_POWER_AP] &&
		    QDF_IS_STATUS_SUCCESS(
			reg_check_if_6g_pwr_type_supp_for_chan(pdev,
							REG_VERY_LOW_POWER_AP,
							chan_idx))) {
			*pwr_type_6g = REG_VERY_LOW_POWER_AP;
			reg_debug("AP power type = %d, selected power type = %d",
				  ap_pwr_type, *pwr_type_6g);
			return QDF_STATUS_SUCCESS;
		} else {
			goto no_support;
		}
	}

no_support:
	reg_err("AP power type = %d, not supported", ap_pwr_type);
	return QDF_STATUS_E_NOSUPPORT;
}
#else
QDF_STATUS
reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
reg_get_best_6g_power_type(struct wlan_objmgr_psoc *psoc,
			   struct wlan_objmgr_pdev *pdev,
			       uint8_t *ap_ctry, uint8_t *sta_ctry,
			   enum reg_6g_ap_type *pwr_type_6g,
			       bool *ctry_code_match,
			       enum reg_6g_ap_type ap_pwr_type)
			   enum reg_6g_ap_type ap_pwr_type,
			   uint32_t chan_freq)
{
	return QDF_STATUS_SUCCESS;
}
+17 −11
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 *
 * Permission to use, copy, modify, and/or distribute this software for
@@ -299,23 +299,29 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,

#ifdef CONFIG_REG_CLIENT
/**
 * reg_get_6g_power_type_for_ctry() - Return power type for 6G based on cntry IE
 * reg_get_best_6g_power_type() - Return best power type for 6 GHz connection
 * @psoc: pointer to psoc
 * @pdev: pointer to pdev
 * @ap_ctry: ptr to country string in country IE
 * @sta_ctry: ptr to sta programmed country
 * @pwr_type_6g: ptr to 6G power type
 * @ctry_code_match: Check for country IE and sta country code match
 * @ap_pwr_type: AP's power type as advertised in HE ops IE
 * @chan_freq: Connection channel frequency
 *
 * This function computes best power type for 6 GHz connection.
 * SP power type is selected only if AP advertises SP and client supports SP.
 * LPI power type is selected only if AP advertises LPI and client supports LPI.
 * VLP power type is selected for the below cases,
 * a) AP advertises VLP and client supports VLP.
 * b) AP advertises SP but client doesn't support SP but supports VLP.
 * c) AP advertises LPI but client doesn't support LPI but supports VLP.
 *
 * Return: QDF_STATUS
 */
QDF_STATUS
reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
reg_get_best_6g_power_type(struct wlan_objmgr_psoc *psoc,
			   struct wlan_objmgr_pdev *pdev,
			       uint8_t *ap_ctry, uint8_t *sta_ctry,
			   enum reg_6g_ap_type *pwr_type_6g,
			       bool *ctry_code_match,
			       enum reg_6g_ap_type ap_pwr_type);
			   enum reg_6g_ap_type ap_pwr_type,
			   uint32_t chan_freq);
#endif

/**
Loading