From abc88bbfd1147ba55a8496a80ff897abed9ebb20 Mon Sep 17 00:00:00 2001 From: Jia Ding Date: Tue, 26 Apr 2022 10:46:17 +0800 Subject: [PATCH 01/11] qcacmn: Add uplink delay attribute in QCA vendor command get_sta_info responses Add uplink delay attribute in responses of QCA_NL80211_VENDOR_SUBCMD_GET_STA_INFO vendor command. Change-Id: I9f1d6f1a8e9135ed18949759a837c866005b43c5 CRs-Fixed: 2990880 --- os_if/linux/qca_vendor.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 6bc43a97f3b6..3218da32e59d 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -10468,6 +10468,11 @@ enum qca_vendor_wlan_sta_guard_interval { * failed roam invoke. Different roam invoke failure reason codes * are specified in enum qca_vendor_roam_invoke_fail_reasons. This can be * queried either in connected state or disconnected state. + * + * @QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_UPLINK_DELAY: u32, used in STA mode only. + * This represents the average congestion duration of uplink frames in MAC + * queue in unit of ms. This can be queried either in connected state or + * disconnected state. */ enum qca_wlan_vendor_attr_get_sta_info { QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_INVALID = 0, @@ -10517,6 +10522,7 @@ enum qca_wlan_vendor_attr_get_sta_info { QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_ROAM_TRIGGER_REASON = 47, QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_ROAM_FAIL_REASON = 48, QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_ROAM_INVOKE_FAIL_REASON = 49, + QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_UPLINK_DELAY = 50, /* keep last */ QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_AFTER_LAST, From 0c4768e17a5696849244a5af7fe51152b64b94a5 Mon Sep 17 00:00:00 2001 From: Jia Ding Date: Tue, 26 Apr 2022 10:38:58 +0800 Subject: [PATCH 02/11] qcacmn: Add channel load percentage attribute into QCA vendor command Add channel load percentage attribute in enum ll_stats_results. Change-Id: Ib3603730e93d70ab1adc384b0c438f198fc889e9 CRs-Fixed: 2990868 --- os_if/linux/qca_vendor.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 3218da32e59d..3b38e8e06b27 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -2249,6 +2249,8 @@ enum qca_wlan_vendor_attr_ll_stats_results_type { * @QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_RX_TIME: Unsigned int 32bit * value representing total number of msecs the radio is receiving all * 802.11 frames intended for this device on this channel. + * @QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_LOAD_PERCENTAGE: u8 value + * representing the channel load percentage. Possible values are 0-100. * @QCA_WLAN_VENDOR_ATTR_LL_STATS_AFTER_LAST: After last * @QCA_WLAN_VENDOR_ATTR_FEATURE_SET_MAX: Max value */ @@ -2356,6 +2358,7 @@ enum qca_wlan_vendor_attr_ll_stats_results { QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_TX_TIME = 84, QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_RX_TIME = 85, + QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_LOAD_PERCENTAGE = 86, /* keep last */ QCA_WLAN_VENDOR_ATTR_LL_STATS_AFTER_LAST, From d7b2a52591bf4373f7892717ace2185deb5b1b86 Mon Sep 17 00:00:00 2001 From: Jia Ding Date: Tue, 26 Apr 2022 10:41:50 +0800 Subject: [PATCH 03/11] qcacmn: Extend QCA vendor command for TSF to enable and disable auto report Add TSF cmd to enable and disable automatic TSF report from the target to the host. Change-Id: I17b255299f55b8e78968d951824726d533a7c6e9 CRs-Fixed: 2991909 --- os_if/linux/qca_vendor.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 3b38e8e06b27..be1da4fa3206 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -5558,11 +5558,22 @@ enum qca_vendor_attr_tsf_cmd { * @QCA_TSF_CAPTURE: Initiate TSF Capture * @QCA_TSF_GET: Get TSF capture value * @QCA_TSF_SYNC_GET: Initiate TSF capture and return with captured value + * @QCA_TSF_AUTO_REPORT_ENABLE: Used in STA mode only. Once set, the target + * will automatically send TSF report to the host. To query + * QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_UPLINK_DELAY, this operation needs to be + * initiated first. + * @QCA_TSF_AUTO_REPORT_DISABLE: Used in STA mode only. Once set, the target + * will not automatically send TSF report to the host. If + * QCA_TSF_AUTO_REPORT_ENABLE is initiated and + * QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_UPLINK_DELAY is not queried anymore, this + * operation needs to be initiated. */ enum qca_tsf_cmd { QCA_TSF_CAPTURE, QCA_TSF_GET, QCA_TSF_SYNC_GET, + QCA_TSF_AUTO_REPORT_ENABLE, + QCA_TSF_AUTO_REPORT_DISABLE, }; /** From 80e3b667ebb5dc9076887d1388393aac6d3020b4 Mon Sep 17 00:00:00 2001 From: Jia Ding Date: Tue, 26 Apr 2022 09:50:22 +0800 Subject: [PATCH 04/11] qcacmn: Get buffer_timestamp from wbm release ring Upon TX completion, get buffer_timestamp from wbm release ring descriptor. Change-Id: I0203b51c52a265711e62afc3a940392674ac014a CRs-Fixed: 2978492 --- hal/wifi3.0/hal_generic_api.h | 18 ++++++++++++++++++ hal/wifi3.0/hal_tx.h | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/hal/wifi3.0/hal_generic_api.h b/hal/wifi3.0/hal_generic_api.h index 2ecaaa06c8a1..2e7315447d00 100644 --- a/hal/wifi3.0/hal_generic_api.h +++ b/hal/wifi3.0/hal_generic_api.h @@ -21,6 +21,22 @@ #include +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY +static inline void +hal_tx_comp_get_buffer_timestamp(void *desc, + struct hal_tx_completion_status *ts) +{ + ts->buffer_timestamp = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4, + BUFFER_TIMESTAMP); +} +#else /* !WLAN_FEATURE_TSF_UPLINK_DELAY */ +static inline void +hal_tx_comp_get_buffer_timestamp(void *desc, + struct hal_tx_completion_status *ts) +{ +} +#endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */ + /** * hal_tx_comp_get_status() - TQM Release reason * @hal_desc: completion ring Tx status @@ -88,6 +104,8 @@ void hal_tx_comp_get_status_generic(void *desc, ts->tsf = HAL_TX_DESC_GET(desc, UNIFIED_WBM_RELEASE_RING_6, TX_RATE_STATS_INFO_TX_RATE_STATS); + + hal_tx_comp_get_buffer_timestamp(desc, ts); } /** diff --git a/hal/wifi3.0/hal_tx.h b/hal/wifi3.0/hal_tx.h index 7cc5e61033b0..fde6f2bdb0fe 100644 --- a/hal/wifi3.0/hal_tx.h +++ b/hal/wifi3.0/hal_tx.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -165,6 +166,8 @@ enum hal_tx_ret_buf_manager { * @transmit_cnt: Number of times this frame has been transmitted * @tid: TID of the flow or MPDU queue * @peer_id: Peer ID of the flow or MPDU queue + * @buffer_timestamp: Frame system entrance timestamp in units of 1024 + * microseconds */ struct hal_tx_completion_status { uint8_t status; @@ -187,6 +190,9 @@ struct hal_tx_completion_status { uint8_t transmit_cnt; uint8_t tid; uint16_t peer_id; +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY + uint32_t buffer_timestamp:19; +#endif }; /** From 5a4270c91417de6425bfc4b307f492aa48483581 Mon Sep 17 00:00:00 2001 From: Jia Ding Date: Tue, 26 Apr 2022 10:07:46 +0800 Subject: [PATCH 05/11] qcacmn: Add support to calculate uplink delay Add support to calculate uplink delay on a per vdev basis. The delay calculated excludes bus delays, where packet enqueueing time and complete time are fetched from HW release ring. Change-Id: I4bbcbf28b197f7a87cb822a841f1f957ebcf063b CRs-Fixed: 2958833 --- dp/inc/cdp_txrx_ctrl.h | 83 +++++++++++++++++++++++++ dp/inc/cdp_txrx_ops.h | 13 +++- dp/wifi3.0/dp_main.c | 5 ++ dp/wifi3.0/dp_tx.c | 134 +++++++++++++++++++++++++++++++++++++++++ dp/wifi3.0/dp_tx.h | 37 ++++++++++++ dp/wifi3.0/dp_types.h | 13 +++- 6 files changed, 283 insertions(+), 2 deletions(-) diff --git a/dp/inc/cdp_txrx_ctrl.h b/dp/inc/cdp_txrx_ctrl.h index c719318b6483..a2a8aa578b29 100644 --- a/dp/inc/cdp_txrx_ctrl.h +++ b/dp/inc/cdp_txrx_ctrl.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -1217,4 +1218,86 @@ cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, flow_info); } #endif /* WLAN_SUPPORT_RX_FLOW_TAG */ + +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY +/** + * cdp_set_delta_tsf() - wrapper function to set delta_tsf + * @soc: SOC TXRX handle + * @vdev_id: vdev id + * @delta_tsf: difference between TSF clock and qtimer + * + * Return: None + */ +static inline void cdp_set_delta_tsf(ol_txrx_soc_handle soc, uint8_t vdev_id, + uint32_t delta_tsf) +{ + if (!soc || !soc->ops) { + dp_cdp_err("Invalid instance"); + QDF_BUG(0); + return; + } + + if (!soc->ops->ctrl_ops || + !soc->ops->ctrl_ops->txrx_set_delta_tsf) + return; + + soc->ops->ctrl_ops->txrx_set_delta_tsf(soc, vdev_id, delta_tsf); +} + +/** + * cdp_set_tsf_ul_delay_report() - Enable or disable reporting uplink delay + * @soc: SOC TXRX handle + * @vdev_id: vdev id + * @enable: true to enable and false to disable + * + * Return: QDF_STATUS + */ +static inline QDF_STATUS cdp_set_tsf_ul_delay_report(ol_txrx_soc_handle soc, + uint8_t vdev_id, + bool enable) +{ + if (!soc || !soc->ops) { + dp_cdp_err("Invalid SOC instance"); + QDF_BUG(0); + return QDF_STATUS_E_FAILURE; + } + + if (!soc->ops->ctrl_ops || + !soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report) + return QDF_STATUS_E_FAILURE; + + return soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report(soc, vdev_id, + enable); +} + +/** + * cdp_get_uplink_delay() - Get uplink delay value + * @soc: SOC TXRX handle + * @vdev_id: vdev id + * @val: pointer to save uplink delay value + * + * Return: QDF_STATUS + */ +static inline QDF_STATUS cdp_get_uplink_delay(ol_txrx_soc_handle soc, + uint32_t vdev_id, uint32_t *val) +{ + if (!soc || !soc->ops) { + dp_cdp_err("Invalid SOC instance"); + QDF_BUG(0); + return QDF_STATUS_E_FAILURE; + } + + if (!val) { + dp_cdp_err("Invalid params val"); + return QDF_STATUS_E_FAILURE; + } + + if (!soc->ops->ctrl_ops || + !soc->ops->ctrl_ops->txrx_get_uplink_delay) + return QDF_STATUS_E_FAILURE; + + return soc->ops->ctrl_ops->txrx_get_uplink_delay(soc, vdev_id, val); +} +#endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */ + #endif /* _CDP_TXRX_CTRL_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 921876d0a690..85589c1f2c6d 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. - * + * Copyright (c) 2022 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 @@ -794,6 +794,17 @@ struct cdp_ctrl_ops { int8_t vdev_id); #endif + +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY + void (*txrx_set_delta_tsf)(struct cdp_soc_t *soc, uint8_t vdev_id, + uint32_t delta_tsf); + QDF_STATUS (*txrx_set_tsf_ul_delay_report)(struct cdp_soc_t *soc, + uint8_t vdev_id, + bool enable); + QDF_STATUS (*txrx_get_uplink_delay)(struct cdp_soc_t *soc, + uint8_t vdev_id, + uint32_t *val); +#endif }; struct cdp_me_ops { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 12b27e5bb9f2..4b50d78c5779 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -11475,6 +11475,11 @@ static struct cdp_ctrl_ops dp_ops_ctrl = { .txrx_update_peer_pkt_capture_params = dp_peer_update_pkt_capture_params, #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */ +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY + .txrx_set_delta_tsf = dp_set_delta_tsf, + .txrx_set_tsf_ul_delay_report = dp_set_tsf_ul_delay_report, + .txrx_get_uplink_delay = dp_get_uplink_delay, +#endif }; static struct cdp_me_ops dp_ops_me = { diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index a499384d3dd4..817ffbf37de0 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -4399,6 +4400,138 @@ void dp_tx_update_connectivity_stats(struct dp_soc *soc, } #endif +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY +void dp_set_delta_tsf(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, + uint32_t delta_tsf) +{ + struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); + struct dp_vdev *vdev = dp_vdev_get_ref_by_id(soc, vdev_id, + DP_MOD_ID_CDP); + + if (!vdev) { + dp_err_rl("vdev %d does not exist", vdev_id); + return; + } + + vdev->delta_tsf = delta_tsf; + dp_debug("vdev id %u delta_tsf %u", vdev_id, delta_tsf); + + dp_vdev_unref_delete(soc, vdev, DP_MOD_ID_CDP); +} + +QDF_STATUS dp_set_tsf_ul_delay_report(struct cdp_soc_t *soc_hdl, + uint8_t vdev_id, bool enable) +{ + struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); + struct dp_vdev *vdev = dp_vdev_get_ref_by_id(soc, vdev_id, + DP_MOD_ID_CDP); + + if (!vdev) { + dp_err_rl("vdev %d does not exist", vdev_id); + return QDF_STATUS_E_FAILURE; + } + + qdf_atomic_set(&vdev->ul_delay_report, enable); + + dp_vdev_unref_delete(soc, vdev, DP_MOD_ID_CDP); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS dp_get_uplink_delay(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, + uint32_t *val) +{ + struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); + struct dp_vdev *vdev; + uint32_t delay_accum; + uint32_t pkts_accum; + + vdev = dp_vdev_get_ref_by_id(soc, vdev_id, DP_MOD_ID_CDP); + if (!vdev) { + dp_err_rl("vdev %d does not exist", vdev_id); + return QDF_STATUS_E_FAILURE; + } + + if (!qdf_atomic_read(&vdev->ul_delay_report)) { + dp_vdev_unref_delete(soc, vdev, DP_MOD_ID_CDP); + return QDF_STATUS_E_FAILURE; + } + + /* Average uplink delay based on current accumulated values */ + delay_accum = qdf_atomic_read(&vdev->ul_delay_accum); + pkts_accum = qdf_atomic_read(&vdev->ul_pkts_accum); + + *val = delay_accum / pkts_accum; + dp_debug("uplink_delay %u delay_accum %u pkts_accum %u", *val, + delay_accum, pkts_accum); + + /* Reset accumulated values to 0 */ + qdf_atomic_set(&vdev->ul_delay_accum, 0); + qdf_atomic_set(&vdev->ul_pkts_accum, 0); + + dp_vdev_unref_delete(soc, vdev, DP_MOD_ID_CDP); + + return QDF_STATUS_SUCCESS; +} + +static void dp_tx_update_uplink_delay(struct dp_soc *soc, struct dp_vdev *vdev, + struct hal_tx_completion_status *ts) +{ + uint32_t buffer_ts; + uint32_t delta_tsf; + uint32_t ul_delay; + + /* Tx_rate_stats_info_valid is 0 and tsf is invalid then */ + if (!ts->valid) + return; + + if (qdf_unlikely(!vdev)) { + dp_info_rl("vdev is null or delete in progrss"); + return; + } + + if (!qdf_atomic_read(&vdev->ul_delay_report)) + return; + + delta_tsf = vdev->delta_tsf; + + /* buffer_timestamp is in units of 1024 us and is [31:13] of + * WBM_RELEASE_RING_4. After left shift 10 bits, it's + * valid up to 29 bits. + */ + buffer_ts = ts->buffer_timestamp << 10; + + ul_delay = ts->tsf - buffer_ts - delta_tsf; + ul_delay &= 0x1FFFFFFF; /* mask 29 BITS */ + if (ul_delay > 0x1000000) { + dp_info_rl("----------------------\n" + "Tx completion status:\n" + "----------------------\n" + "release_src = %d\n" + "ppdu_id = 0x%x\n" + "release_reason = %d\n" + "tsf = %u (0x%x)\n" + "buffer_timestamp = %u (0x%x)\n" + "delta_tsf = %u (0x%x)\n", + ts->release_src, ts->ppdu_id, ts->status, + ts->tsf, ts->tsf, ts->buffer_timestamp, + ts->buffer_timestamp, delta_tsf, delta_tsf); + return; + } + + ul_delay /= 1000; /* in unit of ms */ + + qdf_atomic_add(ul_delay, &vdev->ul_delay_accum); + qdf_atomic_inc(&vdev->ul_pkts_accum); +} +#else /* !WLAN_FEATURE_TSF_UPLINK_DELAY */ +static inline +void dp_tx_update_uplink_delay(struct dp_soc *soc, struct dp_vdev *vdev, + struct hal_tx_completion_status *ts) +{ +} +#endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */ + /** * dp_tx_comp_process_tx_status() - Parse and Dump Tx completion status info * @soc: DP soc handle @@ -4479,6 +4612,7 @@ void dp_tx_comp_process_tx_status(struct dp_soc *soc, vdev = peer->vdev; dp_tx_update_connectivity_stats(soc, vdev, tx_desc, ts->status); + dp_tx_update_uplink_delay(soc, vdev, ts); /* Update per-packet stats for mesh mode */ if (qdf_unlikely(vdev->mesh_vdev) && diff --git a/dp/wifi3.0/dp_tx.h b/dp/wifi3.0/dp_tx.h index 80073bfc1845..4c504ee22b53 100644 --- a/dp/wifi3.0/dp_tx.h +++ b/dp/wifi3.0/dp_tx.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -542,4 +543,40 @@ dp_send_completion_to_pkt_capture(struct dp_soc *soc, { } #endif + +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY +/** + * dp_set_delta_tsf() - Set delta_tsf to dp_soc structure + * @soc_hdl: cdp soc pointer + * @vdev_id: vdev id + * @delta_tsf: difference between TSF clock and qtimer + * + * Return: None + */ +void dp_set_delta_tsf(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, + uint32_t delta_tsf); + +/** + * dp_set_tsf_report_ul_delay() - Enable or disable reporting uplink delay + * @soc_hdl: cdp soc pointer + * @vdev_id: vdev id + * @enable: true to enable and false to disable + * + * Return: QDF_STATUS + */ +QDF_STATUS dp_set_tsf_ul_delay_report(struct cdp_soc_t *soc_hdl, + uint8_t vdev_id, bool enable); + +/** + * dp_get_uplink_delay() - Get uplink delay value + * @soc_hdl: cdp soc pointer + * @vdev_id: vdev id + * @val: pointer to save uplink delay value + * + * Return: QDF_STATUS + */ +QDF_STATUS dp_get_uplink_delay(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, + uint32_t *val); +#endif /* WLAN_FEATURE_TSF_UPLINK_TSF */ + #endif diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 51184b9f8e87..68a3813027d5 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -2786,8 +2787,18 @@ struct dp_vdev { qdf_atomic_t ref_cnt; qdf_atomic_t mod_refs[DP_MOD_ID_MAX]; uint8_t num_latency_critical_conn; -}; +#ifdef WLAN_FEATURE_TSF_UPLINK_DELAY + /* Indicate if uplink delay report is enabled or not */ + qdf_atomic_t ul_delay_report; + /* Delta between TQM clock and TSF clock */ + uint32_t delta_tsf; + /* accumulative delay for every TX completion */ + qdf_atomic_t ul_delay_accum; + /* accumulative number of packets delay has accumulated */ + qdf_atomic_t ul_pkts_accum; +#endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */ +}; enum { dp_sec_mcast = 0, From 0b62d7f8acdf62497fd90987c0b5cca7b4b0c551 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Fri, 19 Nov 2021 05:20:52 -0800 Subject: [PATCH 06/11] qcacmn: Allow scan/connection if RF test mode/Safe mode enabled Currently if AP and STA have different ctry codes, STA should operate in VLP mode. And if STA ctry code is US, then scan and connection are not allowed as US VLP is not supported yet. However, if RF test mode or Wi-Fi Safe Mode is enabled, allow scan and connection on this AP and STA can operate in LPI mode. Change-Id: I513657b8e274ef07eb9e9b5fc265722cb01525de CRs-Fixed: 3079537 --- umac/regulatory/core/src/reg_utils.c | 14 ++++++++++++-- umac/regulatory/core/src/reg_utils.h | 4 +++- .../dispatcher/inc/wlan_reg_services_api.h | 4 +++- .../dispatcher/src/wlan_reg_services_api.c | 8 +++++--- umac/scan/core/src/wlan_scan_cache_db.c | 15 +++++++++++---- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 2596fbbe3300..5c87c16c43d3 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 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 @@ -36,6 +37,7 @@ #include #include "reg_services_common.h" #include "reg_build_chan_list.h" +#include "wlan_cm_bss_score_param.h" #define DEFAULT_WORLD_REGDMN 0x60 @@ -323,7 +325,8 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, #ifdef CONFIG_REG_CLIENT QDF_STATUS -reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, +reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, + uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, bool *ctry_code_match) { @@ -334,7 +337,14 @@ reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, ap_ctry[1], sta_ctry[0], sta_ctry[1]); *ctry_code_match = false; - if (wlan_reg_is_us(sta_ctry)) { + /** + * Do not return if Wi-Fi safe mode or RF test mode is + * enabled, 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 (wlan_reg_is_us(sta_ctry) && + wlan_cm_get_check_6ghz_security(psoc)) { reg_err("US VLP not in place yet, connection not allowed"); return QDF_STATUS_E_NOSUPPORT; } diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index 8bcbd4628e10..8a60819446f8 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -320,7 +321,8 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, * Return: QDF_STATUS */ QDF_STATUS -reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, +reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, + uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, bool *ctry_code_match); #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 711d673bc046..5f8ec7e2fa18 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 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 @@ -550,7 +551,8 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, * Return: QDF_STATUS */ QDF_STATUS -wlan_reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, +wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, + uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, bool *ctry_code_match); #endif diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 4251c50326e5..962888ad3813 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -86,12 +87,13 @@ QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, #ifdef CONFIG_REG_CLIENT QDF_STATUS -wlan_reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, +wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, + uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, bool *ctry_code_match) { - return reg_get_6g_power_type_for_ctry(ap_ctry, sta_ctry, pwr_type_6g, - ctry_code_match); + return reg_get_6g_power_type_for_ctry(psoc, ap_ctry, sta_ctry, + pwr_type_6g, ctry_code_match); } #endif diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 05e87bb3f809..58a2d9de7179 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -1106,10 +1106,17 @@ QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn) if (scan_obj->cb.update_beacon) scan_obj->cb.update_beacon(pdev, scan_entry); - if (!scm_is_bss_allowed_for_country(psoc, scan_entry)) { - scm_info("Drop frame from "QDF_MAC_ADDR_FMT - ": AP in VLP mode not supported for US", - QDF_MAC_ADDR_REF(scan_entry->bssid.bytes)); + /** + * Do not drop the frame if Wi-Fi safe mode or RF test mode is + * enabled. wlan_cm_get_check_6ghz_security API returns true if + * neither Safe mode nor RF test mode are enabled. + */ + if (!scm_is_bss_allowed_for_country(psoc, scan_entry) && + wlan_cm_get_check_6ghz_security(psoc)) { + scm_info_rl( + "Drop frame from "QDF_MAC_ADDR_FMT + ": AP in VLP mode not supported for US", + QDF_MAC_ADDR_REF(scan_entry->bssid.bytes)); util_scan_free_cache_entry(scan_entry); qdf_mem_free(scan_node); continue; From b8894c96e24ddd4c578eaa59acdb9b04aef53173 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Thu, 2 Dec 2021 04:04:34 -0800 Subject: [PATCH 07/11] qcacmn: Allow STA in LPI mode if AP ctry US and advertises LPI The existing logic is if STA and AP have different ctry code, and STA is in ETSI, then it operates in VLP mode irrespective of AP ctry. New logic would be if AP ctry is US and if it advertises LPI power type in HE ops IE via beacon, then STA can advance to LPI mode. Change-Id: Ifbee7052854277c3d21ccd21b65b79edb5e89f46 CRs-Fixed: 3084589 --- umac/regulatory/core/src/reg_utils.c | 9 ++++++++- umac/regulatory/core/src/reg_utils.h | 5 +++-- umac/regulatory/dispatcher/inc/wlan_reg_services_api.h | 5 +++-- umac/regulatory/dispatcher/src/wlan_reg_services_api.c | 6 ++++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 5c87c16c43d3..06103a2d2c3b 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -328,7 +328,8 @@ QDF_STATUS reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match) + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type) { *pwr_type_6g = REG_INDOOR_AP; @@ -354,6 +355,12 @@ reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, sta_ctry[0], sta_ctry[1]); *pwr_type_6g = REG_VERY_LOW_POWER_AP; } + + if (wlan_reg_is_us(ap_ctry) && ap_pwr_type == REG_INDOOR_AP) { + reg_debug("AP ctry:%c%c, AP power type:%d, allow STA IN LPI", + ap_ctry[0], ap_ctry[1], ap_pwr_type); + *pwr_type_6g = REG_INDOOR_AP; + } } else { *ctry_code_match = true; } diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index 8a60819446f8..fdb8a834a28d 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -317,14 +317,15 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, * @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 * Return: QDF_STATUS */ QDF_STATUS reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match); + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type); #endif /** diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 5f8ec7e2fa18..99a67981c385 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -547,14 +547,15 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, * @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 for 6G as advertised in HE ops IE * Return: QDF_STATUS */ QDF_STATUS wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match); + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type); #endif #ifdef CONFIG_CHAN_NUM_API diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 962888ad3813..b9bec25b2e6d 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -90,10 +90,12 @@ QDF_STATUS wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match) + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type) { return reg_get_6g_power_type_for_ctry(psoc, ap_ctry, sta_ctry, - pwr_type_6g, ctry_code_match); + pwr_type_6g, ctry_code_match, + ap_pwr_type); } #endif From b92591930578743ad7a1ac4c92d654abae66aec4 Mon Sep 17 00:00:00 2001 From: Aravind Kishore Sukla Date: Fri, 13 May 2022 12:15:48 +0530 Subject: [PATCH 08/11] qcacmn: Replace kmsg logs to debug logs Change kernel log level to debug level Change-Id: Ib2736aff0f653d046d502d460f204bba2247246f CRs-Fixed: 3182588 --- dp/wifi3.0/dp_htt.c | 5 +++-- dp/wifi3.0/dp_tx_flow_control.c | 10 +++++----- hif/src/hif_main.c | 4 ++-- umac/cfr/core/src/cfr_common.c | 4 ++-- umac/dcs/core/src/wlan_dcs.c | 3 ++- umac/dfs/dispatcher/src/wlan_dfs_utils_api.c | 4 ++-- umac/green_ap/dispatcher/src/wlan_green_ap_api.c | 3 ++- umac/regulatory/core/src/reg_services_common.c | 3 ++- wmi/src/wmi_unified_tlv.c | 8 ++++---- 9 files changed, 24 insertions(+), 20 deletions(-) diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index e715fadbfcf0..3dc1b76ff8d0 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -4584,7 +4585,7 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt) (u_int8_t *) (msg_word+1), &mac_addr_deswizzle_buf[0]); QDF_TRACE(QDF_MODULE_ID_TXRX, - QDF_TRACE_LEVEL_INFO, + QDF_TRACE_LEVEL_DEBUG, "HTT_T2H_MSG_TYPE_PEER_MAP msg for peer id %d vdev id %d n", peer_id, vdev_id); @@ -4792,7 +4793,7 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt) HTT_RX_PEER_MAP_V2_TID_VALID_HI_PRI_GET(*(msg_word + 5)); QDF_TRACE(QDF_MODULE_ID_TXRX, - QDF_TRACE_LEVEL_INFO, + QDF_TRACE_LEVEL_DEBUG, "HTT_T2H_MSG_TYPE_PEER_MAP msg for peer id %d vdev id %d n", peer_id, vdev_id); diff --git a/dp/wifi3.0/dp_tx_flow_control.c b/dp/wifi3.0/dp_tx_flow_control.c index 41654aa1e7af..a50a8004885b 100644 --- a/dp/wifi3.0/dp_tx_flow_control.c +++ b/dp/wifi3.0/dp_tx_flow_control.c @@ -73,8 +73,8 @@ dp_tx_initialize_threshold(struct dp_tx_desc_pool_s *pool, pool->stop_th[DP_TH_HI] = (pool->stop_th[DP_TH_BE_BK] * FL_TH_HI_PERCENTAGE) / 100; - dp_info("tx flow control threshold is set, pool size is %d", - flow_pool_size); + dp_debug("tx flow control threshold is set, pool size is %d", + flow_pool_size); } /** @@ -568,9 +568,9 @@ void dp_tx_flow_pool_unmap_handler(struct dp_pdev *pdev, uint8_t flow_id, struct dp_tx_desc_pool_s *pool; enum htt_flow_type type = flow_type; - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, - "%s: flow_id %d flow_type %d flow_pool_id %d", - __func__, flow_id, flow_type, flow_pool_id); + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, + "%s: flow_id %d flow_type %d flow_pool_id %d", + __func__, flow_id, flow_type, flow_pool_id); if (qdf_unlikely(!pdev)) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index 15f7d94eced3..83ac8f2f749c 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -801,7 +801,7 @@ void hif_latency_detect_timer_start(struct hif_opaque_softc *hif_ctx) if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) return; - hif_info_rl("start timer"); + hif_debug_rl("start timer"); if (scn->latency_detect.is_timer_started) { hif_info("timer has been started"); return; @@ -819,7 +819,7 @@ void hif_latency_detect_timer_stop(struct hif_opaque_softc *hif_ctx) if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) return; - hif_info_rl("stop timer"); + hif_debug_rl("stop timer"); qdf_timer_sync_cancel(&scn->latency_detect.detect_latency_timer); scn->latency_detect.is_timer_started = false; diff --git a/umac/cfr/core/src/cfr_common.c b/umac/cfr/core/src/cfr_common.c index 1365dc8a718b..b23da3b583c1 100644 --- a/umac/cfr/core/src/cfr_common.c +++ b/umac/cfr/core/src/cfr_common.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 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 @@ -294,7 +294,7 @@ wlan_cfr_peer_obj_create_handler(struct wlan_objmgr_peer *peer, void *arg) } if (wlan_cfr_is_feature_disabled(pdev)) { - cfr_info("cfr is disabled"); + cfr_debug("cfr is disabled"); return QDF_STATUS_E_NOSUPPORT; } diff --git a/umac/dcs/core/src/wlan_dcs.c b/umac/dcs/core/src/wlan_dcs.c index d7b16c899006..cbfded332bae 100644 --- a/umac/dcs/core/src/wlan_dcs.c +++ b/umac/dcs/core/src/wlan_dcs.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 above @@ -126,7 +127,7 @@ QDF_STATUS wlan_dcs_cmd_send(struct wlan_objmgr_psoc *psoc, dcs_tx_ops = target_if_dcs_get_tx_ops(psoc); if (dcs_tx_ops->dcs_cmd_send) { - dcs_info("dcs_enable: %u, pdev_id: %u", dcs_enable, pdev_id); + dcs_debug("dcs_enable: %u, pdev_id: %u", dcs_enable, pdev_id); return dcs_tx_ops->dcs_cmd_send(psoc, pdev_id, is_host_pdev_id, diff --git a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c index 34aeba6340a2..29c7b63c0d1e 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. - * + * Copyright (c) 2022 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 @@ -1302,7 +1302,7 @@ void utils_dfs_init_nol(struct wlan_objmgr_pdev *pdev) dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "nol channels in pld"); DFS_PRINT_NOL_LOCKED(dfs); } else { - dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "no nol in pld"); + dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS, "no nol in pld"); } qdf_mem_free(dfs_nolinfo); } diff --git a/umac/green_ap/dispatcher/src/wlan_green_ap_api.c b/umac/green_ap/dispatcher/src/wlan_green_ap_api.c index 7fa69dceb56d..f03375e4ca38 100644 --- a/umac/green_ap/dispatcher/src/wlan_green_ap_api.c +++ b/umac/green_ap/dispatcher/src/wlan_green_ap_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -414,7 +415,7 @@ QDF_STATUS wlan_green_ap_del_sta(struct wlan_objmgr_pdev *pdev) qdf_spin_lock_bh(&green_ap_ctx->lock); if (wlan_is_egap_enabled(green_ap_ctx)) { qdf_spin_unlock_bh(&green_ap_ctx->lock); - green_ap_info("enhanced green ap support is enabled"); + green_ap_debug("enhanced green ap support is enabled"); return QDF_STATUS_SUCCESS; } qdf_spin_unlock_bh(&green_ap_ctx->lock); diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index c116472c8079..64bb09998265 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -1687,7 +1688,7 @@ uint8_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; if (freq == 0) { - reg_err_rl("Invalid freq %d", freq); + reg_debug_rl("Invalid freq %d", freq); return 0; } diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 534a0371b750..6edd7e6b616d 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -1871,10 +1871,10 @@ static QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; cmd->flags = param->flags; - wmi_info("suspend type: %s flag is 0x%x", - cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? - "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED", - cmd->flags); + wmi_debug("suspend type: %s flag is 0x%x", + cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? + "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED", + cmd->flags); wmi_mtrace(WMI_WOW_ENABLE_CMDID, NO_SESSION, 0); ret = wmi_unified_cmd_send(wmi_handle, buf, len, From e19169dc461f6220b024f0c1b884f69e84659ad5 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Tue, 14 Dec 2021 21:51:36 -0800 Subject: [PATCH 09/11] qcacmn: Reduce logging in get 6G power type for country API Optimize the checks in reg_get_6g_power_type_for_ctry API to reduce logging. Logs will appear only during initial connection and not after parsing each beacon. Change-Id: I4c4904c4825cd822d119e4ee9b2c69e96612be31 CRs-Fixed: 3094366 --- umac/regulatory/core/src/reg_utils.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 06103a2d2c3b..73f3a88c7806 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -350,10 +350,14 @@ reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_NOSUPPORT; } - if (wlan_reg_is_etsi(sta_ctry)) { - reg_debug("STA ctry:%c%c, doesn't match with AP ctry, switch to VLP", - sta_ctry[0], sta_ctry[1]); - *pwr_type_6g = REG_VERY_LOW_POWER_AP; + if (wlan_reg_is_etsi(sta_ctry) && + ap_pwr_type != REG_MAX_AP_TYPE) { + if (!(wlan_reg_is_us(ap_ctry) && + ap_pwr_type == REG_INDOOR_AP)) { + reg_debug("STA ctry:%c%c, doesn't match with AP ctry, switch to VLP", + sta_ctry[0], sta_ctry[1]); + *pwr_type_6g = REG_VERY_LOW_POWER_AP; + } } if (wlan_reg_is_us(ap_ctry) && ap_pwr_type == REG_INDOOR_AP) { From 7700a1544e8f326ab262b3642cb9035169546ffe Mon Sep 17 00:00:00 2001 From: Sai Pavan Akhil Remella Date: Mon, 31 Jan 2022 14:38:39 +0530 Subject: [PATCH 10/11] qcacmn: Add mode based flags to channels in PNO request Currently 6 GHz channel flags are not set for channels present in the list from PNO scan request but are set for all other 6 GHz channels which are added when either of the two below conditions are satisfied 1. Userspace sets NL80211_SCAN_FLAG_COLOCATED_6GHZ flag in PNO scan request. 2. At least one 6 GHz channel is present in the PNO scan req. Add flags for channels in the PNO scan request based on the scan_mode_6g ini configured similar to active scan request. Add changes to remove the RNR flag for the channel if the corresponding short SSID entry is present in the RNR db Cache since if colocated SSID is different userspace doesn't include corresponding 2.4/5 GHz channel information in PNO request. Change-Id: I22c4f7ecf65d4ab09dfbbe126aefe02f9145de42 CRs-Fixed: 3119113 --- os_if/linux/scan/src/wlan_cfg80211_scan.c | 44 +++--- umac/cmn_services/utils/inc/wlan_utility.h | 11 ++ umac/cmn_services/utils/src/wlan_utility.c | 62 +++++++++ umac/scan/core/src/wlan_scan_cache_db.c | 55 ++++++++ umac/scan/core/src/wlan_scan_cache_db.h | 26 ++++ umac/scan/core/src/wlan_scan_manager_6ghz.c | 126 ++++++++++-------- umac/scan/core/src/wlan_scan_manager_6ghz.h | 28 ++++ .../dispatcher/inc/wlan_scan_public_structs.h | 2 + umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h | 16 ++- umac/scan/dispatcher/src/wlan_scan_ucfg_api.c | 27 ++-- 10 files changed, 306 insertions(+), 91 deletions(-) diff --git a/os_if/linux/scan/src/wlan_cfg80211_scan.c b/os_if/linux/scan/src/wlan_cfg80211_scan.c index b58563d998c4..a9b58d275bae 100644 --- a/os_if/linux/scan/src/wlan_cfg80211_scan.c +++ b/os_if/linux/scan/src/wlan_cfg80211_scan.c @@ -529,36 +529,42 @@ int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_vdev *vdev, /* Filling per profile params */ for (i = 0; i < req->networks_cnt; i++) { - req->networks_list[i].ssid.length = - request->match_sets[i].ssid.ssid_len; + struct cfg80211_match_set *user_req = &request->match_sets[i]; + struct pno_nw_type *tgt_req = &req->networks_list[i]; - if ((!req->networks_list[i].ssid.length) || - (req->networks_list[i].ssid.length > WLAN_SSID_MAX_LEN)) { + tgt_req->ssid.length = user_req->ssid.ssid_len; + + if (!tgt_req->ssid.length || + tgt_req->ssid.length > WLAN_SSID_MAX_LEN) { osif_err(" SSID Len %d is not correct for network %d", - req->networks_list[i].ssid.length, i); + tgt_req->ssid.length, i); ret = -EINVAL; goto error; } - qdf_mem_copy(req->networks_list[i].ssid.ssid, - request->match_sets[i].ssid.ssid, - req->networks_list[i].ssid.length); - req->networks_list[i].authentication = 0; /*eAUTH_TYPE_ANY */ - req->networks_list[i].encryption = 0; /*eED_ANY */ - req->networks_list[i].bc_new_type = 0; /*eBCAST_UNKNOWN */ + qdf_mem_copy(tgt_req->ssid.ssid, user_req->ssid.ssid, + tgt_req->ssid.length); + tgt_req->authentication = 0; /*eAUTH_TYPE_ANY */ + tgt_req->encryption = 0; /*eED_ANY */ + tgt_req->bc_new_type = 0; /*eBCAST_UNKNOWN */ + /*Copying list of valid channel into request */ for (j = 0; j < num_chan; j++) - req->networks_list[i].pno_chan_list.chan[j].freq = - valid_ch[j]; - req->networks_list[i].pno_chan_list.num_chan = num_chan; + tgt_req->pno_chan_list.chan[j].freq = valid_ch[j]; + tgt_req->pno_chan_list.num_chan = num_chan; - if (ucfg_is_6ghz_pno_scan_optimization_supported(psoc)) - ucfg_scan_pno_add_all_valid_6g_channels(vdev, req, - &num_chan); + if (ucfg_is_6ghz_pno_scan_optimization_supported(psoc)) { + uint32_t short_ssid = + wlan_construct_shortssid(tgt_req->ssid.ssid, + tgt_req->ssid.length); - req->networks_list[i].rssi_thresh = - request->match_sets[i].rssi_thold; + ucfg_scan_add_flags_to_pno_chan_list(vdev, req, + &num_chan, + short_ssid, i); + } + + tgt_req->rssi_thresh = user_req->rssi_thold; } /* set scan to passive if no SSIDs are specified in the request */ diff --git a/umac/cmn_services/utils/inc/wlan_utility.h b/umac/cmn_services/utils/inc/wlan_utility.h index 9d52f467c7d3..cfec6712098e 100644 --- a/umac/cmn_services/utils/inc/wlan_utility.h +++ b/umac/cmn_services/utils/inc/wlan_utility.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 above @@ -52,6 +53,16 @@ struct wlan_op_mode_peer_count { uint16_t peer_count; }; +/** + * wlan_construct_shortssid() - construct the short ssid with the help of + * shortssid table + * @ssid: pointer to ssid + * @ssid_len: ssid length + * + * return: short ssid length + */ +uint32_t wlan_construct_shortssid(uint8_t *ssid, uint8_t ssid_len); + /** * wlan_chan_to_freq() - converts channel to frequency * @chan: channel number diff --git a/umac/cmn_services/utils/src/wlan_utility.c b/umac/cmn_services/utils/src/wlan_utility.c index 0b030ee9802f..e737b0704e9e 100644 --- a/umac/cmn_services/utils/src/wlan_utility.c +++ b/umac/cmn_services/utils/src/wlan_utility.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 above @@ -27,6 +28,67 @@ #include #include "cfg_ucfg_api.h" +/* CRC polynomial 0xedb88320 */ +static unsigned long const wlan_shortssid_table[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t wlan_construct_shortssid(uint8_t *ssid, uint8_t ssid_len) +{ + uint32_t shortssid = 0xffffffff; + uint8_t i; + + if (!ssid || ssid_len > WLAN_SSID_MAX_LEN) + return shortssid; + + for (i = 0; i < ssid_len; i++) + shortssid = wlan_shortssid_table[(shortssid ^ ssid[i]) & 0xff] ^ + (shortssid >> 8); + return (shortssid ^ 0xffffffff); +} + uint32_t wlan_chan_to_freq(uint8_t chan) { if (chan == 0 ) diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 58a2d9de7179..229ed22f98f9 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -156,6 +156,8 @@ static void scm_add_rnr_channel_db(struct wlan_objmgr_psoc *psoc, QDF_MAC_ADDR_SIZE); if (rnr_bss->short_ssid) rnr_node->entry.short_ssid = rnr_bss->short_ssid; + if (rnr_bss->bss_params) + rnr_node->entry.bss_params = rnr_bss->bss_params; scm_debug("Add freq %d: "QDF_MAC_ADDR_FMT" short ssid %x", chan_freq, QDF_MAC_ADDR_REF(rnr_bss->bssid.bytes), rnr_bss->short_ssid); @@ -163,6 +165,59 @@ static void scm_add_rnr_channel_db(struct wlan_objmgr_psoc *psoc, &rnr_node->node); } } + +void scm_filter_rnr_flag_pno(struct wlan_objmgr_vdev *vdev, + uint32_t short_ssid, + struct chan_list *pno_chan_list) +{ + uint8_t i; + uint32_t freq; + struct meta_rnr_channel *chan; + struct scan_rnr_node *rnr_node; + enum scan_mode_6ghz scan_mode; + struct wlan_scan_obj *scan_obj; + struct wlan_objmgr_psoc *psoc; + + psoc = wlan_vdev_get_psoc(vdev); + if (!psoc) + return; + + scan_obj = wlan_vdev_get_scan_obj(vdev); + if (!scan_obj) { + scm_err("scan_obj is NULL"); + return; + } + + scan_mode = scan_obj->scan_def.scan_mode_6g; + /* No Filteration required for below scan modes since + * no RNR flag marked + */ + if (scan_mode == SCAN_MODE_6G_NO_CHANNEL || + scan_mode == SCAN_MODE_6G_ALL_CHANNEL || + scan_mode == SCAN_MODE_6G_ALL_DUTY_CYCLE) + return; + + for (i = 0; i < pno_chan_list->num_chan; i++) { + freq = pno_chan_list->chan[i].freq; + + chan = scm_get_chan_meta(psoc, freq); + if (!chan || qdf_list_empty(&chan->rnr_list)) + continue; + + qdf_list_for_each(&chan->rnr_list, rnr_node, node) { + if (rnr_node->entry.short_ssid) { + if (rnr_node->entry.short_ssid == short_ssid) { + /* If short ssid entry present in RNR db cache, remove + * FLAG_SCAN_ONLY_IF_RNR_FOUND flag from the channel. + */ + pno_chan_list->chan[i].flags &= + ~FLAG_SCAN_ONLY_IF_RNR_FOUND; + break; + } + } + } + } +} #endif /** diff --git a/umac/scan/core/src/wlan_scan_cache_db.h b/umac/scan/core/src/wlan_scan_cache_db.h index c7f2366f72a5..daa29a79fea3 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.h +++ b/umac/scan/core/src/wlan_scan_cache_db.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -248,6 +249,24 @@ QDF_STATUS scm_rnr_db_flush(struct wlan_objmgr_psoc *psoc); */ void scm_update_rnr_from_scan_cache(struct wlan_objmgr_pdev *pdev); +/** + * scm_filter_rnr_flag_pno() - Remove FLAG_SCAN_ONLY_IF_RNR_FOUND flag + * in channel if ssid is different for colocated AP, + * during pno scan request + * @vdev: vdev + * @short_ssid: short ssid + * @pno_chan_list: channel list + * + * Remove FLAG_SCAN_ONLY_IF_RNR_FOUND flag in channel if ssid is different for + * colocated AP, in pno scan request + * + * Return: None + */ +void +scm_filter_rnr_flag_pno(struct wlan_objmgr_vdev *vdev, + uint32_t short_ssid, + struct chan_list *chan_list); + #else static inline QDF_STATUS scm_channel_list_db_init(struct wlan_objmgr_psoc *psoc) { @@ -259,6 +278,13 @@ QDF_STATUS scm_channel_list_db_deinit(struct wlan_objmgr_psoc *psoc) { return QDF_STATUS_SUCCESS; } + +static inline void +scm_filter_rnr_flag_pno(struct wlan_objmgr_vdev *vdev, + uint32_t short_ssid, + struct chan_list *chan_list) +{ +} #endif /** diff --git a/umac/scan/core/src/wlan_scan_manager_6ghz.c b/umac/scan/core/src/wlan_scan_manager_6ghz.c index 319cdbd82675..6120f4955501 100644 --- a/umac/scan/core/src/wlan_scan_manager_6ghz.c +++ b/umac/scan/core/src/wlan_scan_manager_6ghz.c @@ -332,18 +332,6 @@ void scm_add_all_valid_6g_channels(struct wlan_objmgr_pdev *pdev, qdf_mem_free(cur_chan_list); } -static void scm_scan_add_all_valid_6g_channels(struct wlan_objmgr_pdev *pdev, - struct scan_start_request *req, - uint8_t *num_scan_ch) -{ - bool is_colocated_6ghz_scan_enabled = - req->scan_req.scan_policy_colocated_6ghz; - - scm_add_all_valid_6g_channels(pdev, &req->scan_req.chan_list, - num_scan_ch, - is_colocated_6ghz_scan_enabled); -} - static void scm_copy_valid_channels(struct wlan_objmgr_psoc *psoc, enum scan_mode_6ghz scan_mode, @@ -445,6 +433,76 @@ scm_is_6ghz_scan_optimization_supported(struct wlan_objmgr_psoc *psoc) WLAN_SOC_CEXT_SCAN_PER_CH_CONFIG); } +void scm_add_channel_flags(struct wlan_objmgr_vdev *vdev, + struct chan_list *chan_list, + uint8_t *num_chan, + bool is_colocated_6ghz_scan_enabled, + bool is_pno_scan) +{ + struct wlan_scan_obj *scan_obj; + enum scan_mode_6ghz scan_mode; + struct wlan_objmgr_pdev *pdev; + uint8_t num_scan_chan = *num_chan; + + pdev = wlan_vdev_get_pdev(vdev); + if (!pdev) + return; + scan_obj = wlan_vdev_get_scan_obj(vdev); + if (!scan_obj) { + scm_err("scan_obj is NULL"); + return; + } + + scan_mode = scan_obj->scan_def.scan_mode_6g; + + switch (scan_mode) { + case SCAN_MODE_6G_RNR_ONLY: + /* + * When the ini is set to SCAN_MODE_6G_RNR_ONLY, + * always set RNR flag for all(PSC and non-PSC) channels. + */ + scm_set_rnr_flag_all_6g_ch(&chan_list->chan[0], num_scan_chan); + break; + case SCAN_MODE_6G_PSC_CHANNEL: + /* + * When the ini is set to SCAN_MODE_6G_PSC_CHANNEL, + * always set RNR flag for non-PSC channels. + */ + scm_set_rnr_flag_non_psc_6g_ch(&chan_list->chan[0], + num_scan_chan); + break; + case SCAN_MODE_6G_PSC_DUTY_CYCLE: + case SCAN_MODE_6G_ALL_DUTY_CYCLE: + if (!is_pno_scan && !scm_is_duty_cycle_scan(scan_obj)) + scm_set_rnr_flag_all_6g_ch(&chan_list->chan[0], + num_scan_chan); + else if (scan_mode == SCAN_MODE_6G_PSC_DUTY_CYCLE) { + if (is_pno_scan) + scm_debug("Duty cycle scan not supported in pno"); + scm_set_rnr_flag_non_psc_6g_ch(&chan_list->chan[0], + num_scan_chan); + } + break; + case SCAN_MODE_6G_ALL_CHANNEL: + /* + * When the ini is set to SCAN_MODE_6G_ALL_CHANNEL, + * Host fills all remaining (other than channel(s) present in + * host scan req) valid 6 GHz channel(s) to scan requests and + * set the flag FLAG_SCAN_ONLY_IF_RNR_FOUND for each remaining + * channels. + */ + scm_add_all_valid_6g_channels(pdev, chan_list, num_chan, + is_colocated_6ghz_scan_enabled); + break; + default: + /* + * Don't set the RNR flag for SCAN_MODE_6G_NO_CHANNEL/ + * SCAN_MODE_6G_RNR_ONLY + */ + break; + } +} + void scm_update_6ghz_channel_list(struct scan_start_request *req, struct wlan_scan_obj *scan_obj) @@ -493,48 +551,8 @@ scm_update_6ghz_channel_list(struct scan_start_request *req, scm_is_scan_type_exempted_from_optimization(req)) goto end; - switch (scan_mode) { - case SCAN_MODE_6G_RNR_ONLY: - /* - * When the ini is set to SCAN_MODE_6G_RNR_ONLY, - * always set RNR flag for all(PSC and non-PSC) channels. - */ - scm_set_rnr_flag_all_6g_ch(&chan_list->chan[0], num_scan_ch); - break; - case SCAN_MODE_6G_PSC_CHANNEL: - /* - * When the ini is set to SCAN_MODE_6G_PSC_CHANNEL, - * always set RNR flag for non-PSC channels. - */ - scm_set_rnr_flag_non_psc_6g_ch(&chan_list->chan[0], - num_scan_ch); - break; - case SCAN_MODE_6G_PSC_DUTY_CYCLE: - case SCAN_MODE_6G_ALL_DUTY_CYCLE: - if (!scm_is_duty_cycle_scan(scan_obj)) - scm_set_rnr_flag_all_6g_ch(&chan_list->chan[0], - num_scan_ch); - else if (scan_mode == SCAN_MODE_6G_PSC_DUTY_CYCLE) - scm_set_rnr_flag_non_psc_6g_ch(&chan_list->chan[0], - num_scan_ch); - break; - case SCAN_MODE_6G_ALL_CHANNEL: - /* - * When the ini is set to SCAN_MODE_6G_ALL_CHANNEL, - * Host fills all remaining (other than channel(s) present in - * host scan req) valid 6 GHz channel(s) to scan requests and - * set the flag FLAG_SCAN_ONLY_IF_RNR_FOUND for each remaining - * channels. - */ - scm_scan_add_all_valid_6g_channels(pdev, req, &num_scan_ch); - break; - default: - /* - * Don't set the RNR flag for SCAN_MODE_6G_NO_CHANNEL/ - * SCAN_MODE_6G_RNR_ONLY - */ - break; - } + scm_add_channel_flags(vdev, chan_list, &num_scan_ch, + req->scan_req.scan_policy_colocated_6ghz, false); end: chan_list->num_chan = num_scan_ch; diff --git a/umac/scan/core/src/wlan_scan_manager_6ghz.h b/umac/scan/core/src/wlan_scan_manager_6ghz.h index 4f4114d10229..62f88619d730 100644 --- a/umac/scan/core/src/wlan_scan_manager_6ghz.h +++ b/umac/scan/core/src/wlan_scan_manager_6ghz.h @@ -47,6 +47,25 @@ #define SET_RNR_FLAG_TO_NON_PSC_CHANNEL 0x2 #define SET_RNR_FLAG_TO_ALL_6G_CHANNELS 0x3 +/** + * scm_add_channel_flags() - Update 6ghz channel flags in the active/pno scan req + * @vdev: vdev + * @pno_chan_list: channel list + * @num_chan: number channels + * @is_colocated_6ghz_scan_enabled: Colacated 6ghz flag + * @is_pno_scan: is pno scan + * + * Add channel flags for 6ghz channels from active/pno scan request based on ini + * + * Return: None + */ +void +scm_add_channel_flags(struct wlan_objmgr_vdev *vdev, + struct chan_list *chan_list, + uint8_t *num_chan, + bool is_colocated_6ghz_scan_enabled, + bool is_pno_scan); + /** * scm_update_6ghz_channel_list() - Update 6ghz channel list in the scan req * @req: scan start request @@ -93,6 +112,15 @@ void scm_add_all_valid_6g_channels(struct wlan_objmgr_pdev *pdev, bool is_colocated_6ghz); #else +static inline void +scm_add_channel_flags(struct wlan_objmgr_vdev *vdev, + struct chan_list *pno_chan_list, + uint8_t *num_chan, + bool is_colocated_6ghz, + bool is_pno_scan) +{ +} + static inline void scm_update_6ghz_channel_list(struct scan_start_request *req, struct wlan_scan_obj *scan_obj) diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index cb87e61c0547..4a150b7f6b41 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -1449,11 +1449,13 @@ enum ext_cap_bit_field { * @timestamp: time stamp of beacon/probe * @short_ssid: Short SSID * @bssid: BSSID + * @bss_params: bss params present in RNR IE */ struct scan_rnr_info { qdf_time_t timestamp; uint32_t short_ssid; struct qdf_mac_addr bssid; + uint8_t bss_params; }; /** diff --git a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h index 70cda95abf46..050f0fce8138 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h @@ -102,17 +102,21 @@ QDF_STATUS ucfg_scan_pno_start(struct wlan_objmgr_vdev *vdev, struct pno_scan_req_params *req); /** - * ucfg_scan_pno_add_all_valid_6g_channels() - This API to update all valid 6g - * channels to pno scan request + * ucfg_scan_add_flags_to_pno_chan_list() - This API to update flags for all 6g + * channels in pno scan request * @vdev: vdev pointer * @req: pno req params - * @num_scan_ch: total number of channels present in pno scan request + * @num_chan: number of channels + * @short_ssid: short ssid + * @list_idx: index of network_list in pno request * * Return: None */ -void ucfg_scan_pno_add_all_valid_6g_channels(struct wlan_objmgr_vdev *vdev, - struct pno_scan_req_params *req, - uint8_t *num_scan_ch); +void ucfg_scan_add_flags_to_pno_chan_list(struct wlan_objmgr_vdev *vdev, + struct pno_scan_req_params *req, + uint8_t *num_chan, + uint32_t short_ssid, + int list_idx); /** * ucfg_is_6ghz_pno_scan_optimization_supported() - Public API to check diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c index 189b8d07a879..7aab4712ca76 100644 --- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c @@ -185,20 +185,23 @@ QDF_STATUS ucfg_scan_pno_start(struct wlan_objmgr_vdev *vdev, return status; } -void ucfg_scan_pno_add_all_valid_6g_channels(struct wlan_objmgr_vdev *vdev, - struct pno_scan_req_params *req, - uint8_t *num_scan_ch) +void ucfg_scan_add_flags_to_pno_chan_list(struct wlan_objmgr_vdev *vdev, + struct pno_scan_req_params *req, + uint8_t *num_chan, + uint32_t short_ssid, + int list_idx) { - struct wlan_objmgr_pdev *pdev; - struct chan_list *pno_chan_list = &req->networks_list[0].pno_chan_list; - bool is_colocated_6ghz = req->scan_policy_colocated_6ghz; + struct chan_list *pno_chan_list = + &req->networks_list[list_idx].pno_chan_list; - pdev = wlan_vdev_get_pdev(vdev); - if (!pdev) - return; - - scm_add_all_valid_6g_channels(pdev, pno_chan_list, num_scan_ch, - is_colocated_6ghz); + /* Add RNR flags to channels based on scan_mode_6g ini */ + scm_add_channel_flags(vdev, pno_chan_list, num_chan, + req->scan_policy_colocated_6ghz, true); + /* Filter RNR flags in pno channel list based on short ssid entry in + * RNR db cache. + */ + scm_filter_rnr_flag_pno(vdev, short_ssid, + &req->networks_list[0].pno_chan_list); } QDF_STATUS ucfg_scan_pno_stop(struct wlan_objmgr_vdev *vdev) From 528e81a13b0f40c19288f52ca48ebf5f2b533ca9 Mon Sep 17 00:00:00 2001 From: Sheenam Monga Date: Mon, 2 May 2022 10:23:23 +0530 Subject: [PATCH 11/11] qcacmn: Add support for lower span active and passive dwell time Add LOW_SPAN_ACTIVE_DWELL_TIME and LOW_SPAN_PASSIVE_DWELL_TIME macro support to keep all 2.4g/5g active/passive dwell time same for low span scan mode. Disable adaptive dwell to firmware so that firmware cannot modify dwell time. Change-Id: Iff05dd7b37a40226c61b28a1e59ea8aa8c57cb52 CRs-Fixed: 3076163 --- os_if/linux/scan/src/wlan_cfg80211_scan.c | 3 +- umac/scan/core/src/wlan_scan_manager.c | 36 +++++++++++++++++++ .../dispatcher/inc/wlan_scan_public_structs.h | 9 +++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/os_if/linux/scan/src/wlan_cfg80211_scan.c b/os_if/linux/scan/src/wlan_cfg80211_scan.c index a9b58d275bae..d76a1b825393 100644 --- a/os_if/linux/scan/src/wlan_cfg80211_scan.c +++ b/os_if/linux/scan/src/wlan_cfg80211_scan.c @@ -1535,8 +1535,7 @@ int wlan_cfg80211_scan(struct wlan_objmgr_vdev *vdev, if (req->scan_req.scan_policy_high_accuracy) req->scan_req.adaptive_dwell_time_mode = SCAN_DWELL_MODE_STATIC; - if (req->scan_req.scan_policy_low_power || - req->scan_req.scan_policy_low_span) + if (req->scan_req.scan_policy_low_power) req->scan_req.adaptive_dwell_time_mode = SCAN_DWELL_MODE_AGGRESSIVE; } diff --git a/umac/scan/core/src/wlan_scan_manager.c b/umac/scan/core/src/wlan_scan_manager.c index de436566c474..3227a43aafda 100644 --- a/umac/scan/core/src/wlan_scan_manager.c +++ b/umac/scan/core/src/wlan_scan_manager.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 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 @@ -945,6 +946,38 @@ scm_update_channel_list(struct scan_start_request *req, scm_scan_chlist_concurrency_modify(req->vdev, req); } +/** + * scm_req_update_dwell_time_as_per_scan_mode() - update scan req params + * dwell time as per scan mode. + * @req: scan request + * + * Return: void + */ +static void +scm_req_update_dwell_time_as_per_scan_mode( + struct wlan_objmgr_vdev *vdev, + struct scan_start_request *req) +{ + struct wlan_objmgr_psoc *psoc; + + psoc = wlan_vdev_get_psoc(vdev); + + if (req->scan_req.scan_policy_low_span && + wlan_scan_cfg_honour_nl_scan_policy_flags(psoc)) { + req->scan_req.adaptive_dwell_time_mode = + SCAN_DWELL_MODE_STATIC; + req->scan_req.dwell_time_active = + QDF_MIN(req->scan_req.dwell_time_active, + LOW_SPAN_ACTIVE_DWELL_TIME); + req->scan_req.dwell_time_active_2g = + QDF_MIN(req->scan_req.dwell_time_active_2g, + LOW_SPAN_ACTIVE_DWELL_TIME); + req->scan_req.dwell_time_passive = + QDF_MIN(req->scan_req.dwell_time_passive, + LOW_SPAN_PASSIVE_DWELL_TIME); + } +} + /** * scm_scan_req_update_params() - update scan req params depending on modes * and scan type. @@ -1051,6 +1084,9 @@ scm_scan_req_update_params(struct wlan_objmgr_vdev *vdev, if (req->scan_req.scan_type == SCAN_TYPE_RRM) req->scan_req.scan_ctrl_flags_ext |= SCAN_FLAG_EXT_RRM_SCAN_IND; + + scm_req_update_dwell_time_as_per_scan_mode(vdev, req); + /* * Set wide band flag if enabled. This will cause * phymode TLV being sent to FW. diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index 4a150b7f6b41..962edac467ab 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -61,6 +61,15 @@ typedef uint32_t wlan_scan_id; #define TBTT_INFO_COUNT 16 +/* Active dwell time in low span scan mode(NL80211_SCAN_FLAG_LOW_SPAN) + * in msec + */ +#define LOW_SPAN_ACTIVE_DWELL_TIME 40 +/* passive dwell time in low span scan mode (NL80211_SCAN_FLAG_LOW_SPAN) + * in msec + */ +#define LOW_SPAN_PASSIVE_DWELL_TIME 110 + /* forward declaration */ struct wlan_objmgr_vdev; struct wlan_objmgr_pdev;