瀏覽代碼

qcacmn: Fetch fw support for fixed channel SAP in coex cases

Currently, firmware sends WMI_WLAN_FREQ_AVOID_EVENTID with set
of frequency ranges to be avoided when it finds LTE operating
around those frequencies. Host driver marks these frequencies
as unsafe and doesn't operate in SAP/P2P-GO mode.

There is a new requirement where SAP can be allowed to operate
in unsafe channels when below conditions are met,
1. Firmware advertises the capability fix_channel_priority in
   WMI_COEX_FIX_CHANNEL_CAPABILITIES through ext2 event.
2. SAP is started in a fixed channel.

Fetch the capability fix_channel_priority sent by firmware and
cache it in wlan_psoc_host_service_ext2_param to support
this feature. Add APIs to cache value received from firmware in
psoc_info->info.service_ext2_param.sap_coex_fixed_chan_support
and to fetch the same.

Change-Id: I8ceb501240bc86d6b004446f9927f4402c487203
CRs-Fixed: 3381399
Srinivas Dasari 2 年之前
父節點
當前提交
8380ebaf9b

+ 33 - 1
target_if/core/inc/target_if.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -2713,6 +2713,38 @@ void target_psoc_set_sbs_lower_band_end(struct target_psoc_info *psoc_info,
 	psoc_info->info.sbs_lower_band_end_freq = val;
 }
 
+/**
+ * target_psoc_set_sap_coex_fixed_chan_cap() - Set SAP coex fixed chan cap
+ * @psoc_info: Pointer to struct target_psoc_info.
+ * @val: SAP coex fixed chan support
+ *
+ * Return: None
+ */
+static inline void
+target_psoc_set_sap_coex_fixed_chan_cap(struct target_psoc_info *psoc_info,
+					bool val)
+{
+	if (!psoc_info)
+		return;
+
+	psoc_info->info.service_ext2_param.sap_coex_fixed_chan_support = val;
+}
+
+/**
+ * target_psoc_get_sap_coex_fixed_chan_cap() - Get SAP coex fixed chan cap
+ * @psoc_info: Pointer to struct target_psoc_info.
+ *
+ * Return: sap_coex_fixed_chan_support received from firmware
+ */
+static inline bool
+target_psoc_get_sap_coex_fixed_chan_cap(struct target_psoc_info *psoc_info)
+{
+	if (!psoc_info)
+		return false;
+
+	return psoc_info->info.service_ext2_param.sap_coex_fixed_chan_support;
+}
+
 /**
  * target_psoc_set_twt_ack_cap() - Set twt ack capability
  *

+ 4 - 1
target_if/init_deinit/inc/service_ready_param.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -454,6 +454,8 @@ struct wlan_psoc_host_service_ext_param {
  * @max_users_dl_mumimo: Max number of users per-PPDU for Downlink MU-MIMO
  * @max_users_ul_mumimo: Max number of users per-PPDU for Uplink MU-MIMO
  * @twt_ack_support_cap: TWT ack capability support
+ * @sap_coex_fixed_chan_support: Indicates if fw supports coex SAP in
+ *                               fixed chan config
  * @target_cap_flags: Rx peer metadata version number used by target
  * @ul_mumimo_tx_2g: UL MUMIMO Tx support for 2GHz
  * @ul_mumimo_tx_5g: UL MUMIMO Tx support for 5GHz
@@ -478,6 +480,7 @@ struct wlan_psoc_host_service_ext2_param {
 	uint16_t max_users_dl_mumimo;
 	uint16_t max_users_ul_mumimo;
 	uint32_t twt_ack_support_cap:1;
+	uint32_t sap_coex_fixed_chan_support:1;
 	uint32_t target_cap_flags;
 	uint8_t ul_mumimo_tx_2g:1,
 		ul_mumimo_tx_5g:1,

+ 15 - 0
target_if/init_deinit/inc/service_ready_util.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 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
@@ -346,6 +347,20 @@ int init_deinit_populate_dbs_or_sbs_cap_ext2(struct wlan_objmgr_psoc *psoc,
 					     uint8_t *event,
 					     struct tgt_info *info);
 
+/**
+ * init_deinit_populate_sap_coex_capability() - SAP coex capability
+ * @psoc: PSOC object
+ * @handle: WMI handle pointer
+ * @event: event buffer received from FW
+ *
+ * API to populate SAP coex capabilities which currently indicates whether SAP
+ * is allowed on a coex channel when it's started with fixed chan config
+ *
+ * Return: zero on successful capability fetching or failure
+ */
+int init_deinit_populate_sap_coex_capability(struct wlan_objmgr_psoc *psoc,
+					     wmi_unified_t handle,
+					     uint8_t *event);
 /**
  * init_deinit_validate_160_80p80_fw_caps() - validate 160 80p80 fw caps
  * @psoc: PSOC object

+ 6 - 1
target_if/init_deinit/src/init_event_handler.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -518,6 +518,11 @@ static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle,
 	if (err_code)
 		target_if_debug("failed to populate dbs_or_sbs cap ext2");
 
+	err_code = init_deinit_populate_sap_coex_capability(psoc, wmi_handle,
+							    event);
+	if (err_code)
+		target_if_debug("failed to populate sap_coex_capability ext2");
+
 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
 	if (legacy_callback)
 		if (legacy_callback(wmi_service_ready_ext2_event_id,

+ 24 - 1
target_if/init_deinit/src/service_ready_util.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023, 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
@@ -583,6 +583,29 @@ exit:
 	return qdf_status_to_os_return(status);
 }
 
+int init_deinit_populate_sap_coex_capability(struct wlan_objmgr_psoc *psoc,
+					     wmi_unified_t handle,
+					     uint8_t *event)
+{
+	struct wmi_host_coex_fix_chan_cap sap_coex_fixed_chan_cap;
+	struct target_psoc_info *psoc_info;
+	QDF_STATUS status;
+
+	qdf_mem_zero(&sap_coex_fixed_chan_cap,
+		     sizeof(struct wmi_host_coex_fix_chan_cap));
+
+	status = wmi_extract_sap_coex_cap_service_ready_ext2(handle, event,
+					&sap_coex_fixed_chan_cap);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Extraction of sap_coex_chan_pref cap failed");
+		goto exit;
+	}
+	psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
+	target_psoc_set_sap_coex_fixed_chan_cap(psoc_info,
+				!!sap_coex_fixed_chan_cap.fix_chan_priority);
+exit:
+	return qdf_status_to_os_return(status);
+}
 
 QDF_STATUS init_deinit_dbr_ring_cap_free(
 		struct target_psoc_info *tgt_psoc_info)

+ 14 - 0
wmi/inc/wmi_unified_api.h

@@ -5082,4 +5082,18 @@ QDF_STATUS
 wmi_unified_update_edca_pifs_param(
 			wmi_unified_t wmi_handle,
 			struct edca_pifs_vparam *edca_pifs_param);
+
+/**
+ * wmi_extract_sap_coex_cap_service_ready_ext2() - extract sap coex capability
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @cap: It's set to 1 if fixed chan SAP is supported by firmware even when the
+ *       channel is unsafe due to coex.
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
+ */
+QDF_STATUS wmi_extract_sap_coex_cap_service_ready_ext2(
+			wmi_unified_t wmi_handle,
+			uint8_t *evt_buf,
+			struct wmi_host_coex_fix_chan_cap *cap);
 #endif /* _WMI_UNIFIED_API_H_ */

+ 8 - 0
wmi/inc/wmi_unified_param.h

@@ -9580,4 +9580,12 @@ struct edca_pifs_vparam {
 	uint8_t vdev_id;
 	struct wlan_edca_pifs_param_ie param;
 };
+
+/**
+ * struct wmi_host_coex_fix_chan_cap - fw capability to support fixed chan SAP
+ * @fix_chan_priority: Fix channel priority, set to 1 if firmware supports it
+ */
+struct wmi_host_coex_fix_chan_cap {
+	uint32_t fix_chan_priority;
+};
 #endif /* _WMI_UNIFIED_PARAM_H_ */

+ 4 - 0
wmi/inc/wmi_unified_priv.h

@@ -3201,6 +3201,10 @@ QDF_STATUS
 QDF_STATUS (*send_update_edca_pifs_param_cmd)(
 			wmi_unified_t wmi_handle,
 			struct edca_pifs_vparam *edca_pifs_param);
+
+QDF_STATUS (*extract_sap_coex_cap_service_ready_ext2)(
+			wmi_unified_t wmi_handle, uint8_t *event,
+			struct wmi_host_coex_fix_chan_cap *cap);
 };
 
 /* Forward declaration for psoc*/

+ 12 - 0
wmi/src/wmi_unified_api.c

@@ -4009,3 +4009,15 @@ wmi_unified_update_edca_pifs_param(
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+QDF_STATUS wmi_extract_sap_coex_cap_service_ready_ext2(
+			wmi_unified_t wmi_handle,
+			uint8_t *evt_buf,
+			struct wmi_host_coex_fix_chan_cap *cap)
+{
+	if (wmi_handle->ops->extract_sap_coex_cap_service_ready_ext2)
+		return wmi_handle->ops->extract_sap_coex_cap_service_ready_ext2(
+				wmi_handle, evt_buf, cap);
+
+	return QDF_STATUS_E_FAILURE;
+}

+ 23 - 0
wmi/src/wmi_unified_tlv.c

@@ -20008,6 +20008,27 @@ send_set_mac_addr_rx_filter_cmd_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS
+extract_sap_coex_fix_chan_caps(wmi_unified_t wmi_handle,
+			       uint8_t *event,
+			       struct wmi_host_coex_fix_chan_cap *cap)
+{
+	WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *param_buf;
+	WMI_COEX_FIX_CHANNEL_CAPABILITIES *fw_cap;
+
+	param_buf = (WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *)event;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	fw_cap = param_buf->coex_fix_channel_caps;
+	if (!fw_cap)
+		return QDF_STATUS_E_INVAL;
+
+	cap->fix_chan_priority = fw_cap->fix_channel_priority;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 struct wmi_ops tlv_ops =  {
 	.send_vdev_create_cmd = send_vdev_create_cmd_tlv,
 	.send_vdev_delete_cmd = send_vdev_delete_cmd_tlv,
@@ -20490,6 +20511,8 @@ struct wmi_ops tlv_ops =  {
 	.set_mac_addr_rx_filter = send_set_mac_addr_rx_filter_cmd_tlv,
 	.send_update_edca_pifs_param_cmd =
 			send_update_edca_pifs_param_cmd_tlv,
+	.extract_sap_coex_cap_service_ready_ext2 =
+			extract_sap_coex_fix_chan_caps,
 };
 
 #ifdef WLAN_FEATURE_11BE_MLO