From 9972a802341176d4e094a232b6604439c17f38d3 Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Wed, 28 Dec 2022 18:53:05 +0530 Subject: [PATCH] qcacld-3.0: Set to_fw bit in DP vdev for Direct link use case Set to_fw bit in DP vdev for direct link use case and also set it when the use case is unspecified as well. Change-Id: I7306e22e81303720830cfce4ce19b15d2080d93c CRs-Fixed: 3369891 --- components/dp/core/src/wlan_dp_main.c | 11 +++- components/dp/core/src/wlan_dp_softap_txrx.c | 18 +----- .../dp/dispatcher/src/wlan_dp_ucfg_api.c | 37 +++++++++++- .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 14 ++++- core/hdd/src/wlan_hdd_cfg80211.c | 56 +++++++++++++++---- 5 files changed, 103 insertions(+), 33 deletions(-) diff --git a/components/dp/core/src/wlan_dp_main.c b/components/dp/core/src/wlan_dp_main.c index 98ef7988ca..9754d147ba 100644 --- a/components/dp/core/src/wlan_dp_main.c +++ b/components/dp/core/src/wlan_dp_main.c @@ -1,5 +1,5 @@ /* - * 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 @@ -38,6 +38,7 @@ #include #ifdef FEATURE_DIRECT_LINK #include "dp_internal.h" +#include "cdp_txrx_ctrl.h" #endif /* Global DP context */ @@ -1731,6 +1732,8 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf, struct direct_link_info *config = &dp_intf->direct_link_config; void *htc_handle; bool prev_ll, update_ll; + cdp_config_param_type vdev_param = {0}; + QDF_STATUS status; if (!dp_ctx || !dp_ctx->psoc) { dp_err("DP Handle is NULL"); @@ -1753,6 +1756,10 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf, update_ll = config_direct_link ? enable_low_latency : prev_ll; config->config_set = config_direct_link; config->low_latency = enable_low_latency; + vdev_param.cdp_vdev_tx_to_fw = config_direct_link; + status = cdp_txrx_set_vdev_param(wlan_psoc_get_dp_handle(dp_ctx->psoc), + dp_intf->intf_id, CDP_VDEV_TX_TO_FW, + vdev_param); qdf_spin_unlock(&dp_intf->vdev_lock); if (config_direct_link) { @@ -1773,6 +1780,6 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf, dp_info("Direct link config cleared."); } - return QDF_STATUS_SUCCESS; + return status; } #endif diff --git a/components/dp/core/src/wlan_dp_softap_txrx.c b/components/dp/core/src/wlan_dp_softap_txrx.c index 9852a57d2c..d7b133c2d7 100644 --- a/components/dp/core/src/wlan_dp_softap_txrx.c +++ b/components/dp/core/src/wlan_dp_softap_txrx.c @@ -1,5 +1,5 @@ /* - * 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 @@ -610,20 +610,6 @@ dp_softap_inspect_traffic_end_indication_pkt(struct wlan_dp_intf *dp_intf, {} #endif -#ifdef FEATURE_DIRECT_LINK -static inline void dp_intf_tx_to_fw(struct wlan_dp_intf *dp_intf, - qdf_nbuf_t nbuf) -{ - if (qdf_unlikely(dp_intf->direct_link_config.config_set)) - QDF_NBUF_CB_TX_PACKET_TO_FW(nbuf) = 1; -} -#else -static inline void dp_intf_tx_to_fw(struct wlan_dp_intf *dp_intf, - qdf_nbuf_t nbuf) -{ -} -#endif - /** * dp_softap_start_xmit() - Transmit a frame * @nbuf: pointer to Network buffer @@ -686,8 +672,6 @@ QDF_STATUS dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_dp_intf *dp_intf) if (dp_softap_traffic_end_indication_enabled(dp_intf)) dp_softap_inspect_traffic_end_indication_pkt(dp_intf, nbuf); - dp_intf_tx_to_fw(dp_intf, nbuf); - dp_softap_config_tx_pkt_tracing(dp_intf, nbuf); /* check whether need to linearize skb, like non-linear udp data */ diff --git a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c b/components/dp/dispatcher/src/wlan_dp_ucfg_api.c index 5282a87108..514e6181f4 100644 --- a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c +++ b/components/dp/dispatcher/src/wlan_dp_ucfg_api.c @@ -1,5 +1,5 @@ /* - * 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 @@ -40,6 +40,39 @@ #include "wlan_dp_prealloc.h" #include "wlan_dp_rx_thread.h" +#ifdef FEATURE_DIRECT_LINK +/** + * wlan_dp_set_vdev_direct_link_cfg() - Set direct link config in DP vdev + * @psoc: objmgr psoc handle + * @dp_intf: pointer to DP component interface handle + * + * Return: direct link configuration + */ +static inline +QDF_STATUS wlan_dp_set_vdev_direct_link_cfg(struct wlan_objmgr_psoc *psoc, + struct wlan_dp_intf *dp_intf) +{ + cdp_config_param_type vdev_param = {0}; + + if (dp_intf->device_mode != QDF_SAP_MODE || + !dp_intf->dp_ctx->dp_direct_link_ctx) + return QDF_STATUS_SUCCESS; + + vdev_param.cdp_vdev_tx_to_fw = dp_intf->direct_link_config.config_set; + + return cdp_txrx_set_vdev_param(wlan_psoc_get_dp_handle(psoc), + dp_intf->intf_id, CDP_VDEV_TX_TO_FW, + vdev_param); +} +#else +static inline +QDF_STATUS wlan_dp_set_vdev_direct_link_cfg(struct wlan_objmgr_psoc *psoc, + struct wlan_dp_intf *dp_intf) +{ + return QDF_STATUS_SUCCESS; +} +#endif + void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc, struct qdf_mac_addr *cur_mac, struct qdf_mac_addr *new_mac) @@ -62,6 +95,8 @@ void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc, QDF_MAC_ADDR_REF(new_mac->bytes)); qdf_copy_macaddr(&dp_intf->mac_addr, new_mac); + + wlan_dp_set_vdev_direct_link_cfg(psoc, dp_intf); } QDF_STATUS diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index c3887bb213..e19e5ae2e3 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-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 @@ -352,6 +352,18 @@ QDF_STATUS ucfg_mlme_set_ap_policy(struct wlan_objmgr_vdev *vdev, return wlan_mlme_set_ap_policy(vdev, ap_cfg_policy); } +/** + * ucfg_mlme_get_ap_policy() - Get the AP policy value + * @vdev: pointer to vdev object + * + * Return: enum host_concurrent_ap_policy + */ +static inline enum host_concurrent_ap_policy +ucfg_mlme_get_ap_policy(struct wlan_objmgr_vdev *vdev) +{ + return wlan_mlme_get_ap_policy(vdev); +} + /** * ucfg_mlme_get_prevent_link_down() - Get the prevent link down config * @psoc: pointer to psoc object diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 5682179770..b13022a260 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -14182,19 +14182,50 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx) return operating_band; } -static inline -QDF_STATUS wlan_hdd_config_dp_direct_link_profile(struct wlan_objmgr_vdev *vdev, - uint8_t ap_config) +static inline QDF_STATUS +wlan_hdd_config_dp_direct_link_profile(struct wlan_objmgr_vdev *vdev, + enum host_concurrent_ap_policy ap_policy) { - switch (ap_config) { - case QCA_WLAN_CONCURRENT_AP_POLICY_GAMING_AUDIO: - return ucfg_dp_config_direct_link(vdev, true, true); - case QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING: - return ucfg_dp_config_direct_link(vdev, true, false); - case QCA_WLAN_CONCURRENT_AP_POLICY_UNSPECIFIED: + enum host_concurrent_ap_policy prev_ap_policy; + + prev_ap_policy = ucfg_mlme_get_ap_policy(vdev); + + hdd_debug("Current AP policy %d prev AP policy %d", ap_policy, + prev_ap_policy); + + switch (prev_ap_policy) { + case HOST_CONCURRENT_AP_POLICY_UNSPECIFIED: + switch (ap_policy) { + case HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING: + return ucfg_dp_config_direct_link(vdev, true, false); + case HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO: + return ucfg_dp_config_direct_link(vdev, true, true); + default: + break; + } + break; + case HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO: + switch (ap_policy) { + case HOST_CONCURRENT_AP_POLICY_UNSPECIFIED: + case HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING: + return ucfg_dp_config_direct_link(vdev, true, false); + default: + break; + } + break; + case HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING: + switch (ap_policy) { + case HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO: + return ucfg_dp_config_direct_link(vdev, true, true); + default: + break; + } + break; default: - return ucfg_dp_config_direct_link(vdev, false, false); + break; } + + return QDF_STATUS_SUCCESS; } const struct nla_policy @@ -14390,13 +14421,14 @@ static int __wlan_hdd_cfg80211_ap_policy(struct wlan_objmgr_vdev *vdev, return -EINVAL; } - status = wlan_hdd_config_dp_direct_link_profile(vdev, ap_config); + ap_cfg_policy = wlan_mlme_convert_ap_policy_config(ap_config); + + status = wlan_hdd_config_dp_direct_link_profile(vdev, ap_cfg_policy); if (QDF_IS_STATUS_ERROR(status)) { hdd_err("failed to set DP ap config"); return -EINVAL; } - ap_cfg_policy = wlan_mlme_convert_ap_policy_config(ap_config); status = ucfg_mlme_set_ap_policy(vdev, ap_cfg_policy); if (QDF_IS_STATUS_ERROR(status)) { hdd_err("failed to set MLME ap config");