From ddbd5137c5d8bf51b46a28fb633df1bd29487513 Mon Sep 17 00:00:00 2001 From: Rakesh Pillai Date: Tue, 10 Nov 2020 18:12:25 +0530 Subject: [PATCH] qcacld-3.0: Fix the UDP qos upgrade logic The UDP qos upgrade is skipped currently if the setting from userspace is set to best effort. Also with the current logic the priority of packets at "best effort" gets downgraded to "background". Fix the UDP qos upgrade logic to take care of using the "background" priority value as a trigger to skip UDP qos upgrade. Change-Id: I5111a930995ddd71b082db95440ed778f09a3cba CRs-Fixed: 2816426 --- core/hdd/src/wlan_hdd_main.c | 2 +- core/hdd/src/wlan_hdd_tx_rx.c | 2 ++ core/hdd/src/wlan_hdd_wmm.c | 52 +++++++++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 2e1bcbf92101..d2d3f3a67855 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6715,7 +6715,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio if (QDF_IS_STATUS_ERROR(status)) goto err_cleanup_adapter; - adapter->upgrade_udp_qos_threshold = QCA_WLAN_AC_BE; + adapter->upgrade_udp_qos_threshold = QCA_WLAN_AC_BK; qdf_spinlock_create(&adapter->vdev_lock); qdf_atomic_init(&hdd_ctx->num_latency_critical_clients); diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index ca918dcfef75..c12eea2752cc 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -485,6 +485,8 @@ int hdd_set_udp_qos_upgrade_config(struct hdd_adapter *adapter, adapter->upgrade_udp_qos_threshold = priority; + hdd_debug("UDP packets qos upgrade to: %d", priority); + return 0; } diff --git a/core/hdd/src/wlan_hdd_wmm.c b/core/hdd/src/wlan_hdd_wmm.c index 75e642215919..6b0eee8e75e0 100644 --- a/core/hdd/src/wlan_hdd_wmm.c +++ b/core/hdd/src/wlan_hdd_wmm.c @@ -1744,6 +1744,51 @@ QDF_STATUS hdd_wmm_adapter_close(struct hdd_adapter *adapter) return QDF_STATUS_SUCCESS; } +/** + * hdd_check_and_upgrade_udp_qos() - Check and upgrade the qos for UDP packets + * if the current set priority is below the + * pre-configured threshold for upgrade. + * @adapter: [in] pointer to the adapter context (Should not be invalid) + * @skb: [in] pointer to the packet to be transmitted + * @user_pri: [out] priority set for this packet + * + * This function checks if the packet is a UDP packet and upgrades its + * priority if its below the pre-configured upgrade threshold. + * The upgrade order is as below: + * BK -> BE -> VI -> VO + * + * Return: none + */ +static inline void +hdd_check_and_upgrade_udp_qos(struct hdd_adapter *adapter, + qdf_nbuf_t skb, + enum sme_qos_wmmuptype *user_pri) +{ + /* Upgrade UDP pkt priority alone */ + if (!(qdf_nbuf_is_ipv4_udp_pkt(skb) || qdf_nbuf_is_ipv6_udp_pkt(skb))) + return; + + switch (adapter->upgrade_udp_qos_threshold) { + case QCA_WLAN_AC_BK: + break; + case QCA_WLAN_AC_BE: + if (*user_pri == qca_wlan_ac_to_sme_qos(QCA_WLAN_AC_BK)) + *user_pri = qca_wlan_ac_to_sme_qos(QCA_WLAN_AC_BE); + + break; + case QCA_WLAN_AC_VI: + case QCA_WLAN_AC_VO: + if (*user_pri < + qca_wlan_ac_to_sme_qos(adapter->upgrade_udp_qos_threshold)) + *user_pri = qca_wlan_ac_to_sme_qos( + adapter->upgrade_udp_qos_threshold); + + break; + default: + break; + } +} + /** * hdd_wmm_classify_pkt() - Function which will classify an OS packet * into a WMM AC based on DSCP @@ -1869,12 +1914,7 @@ void hdd_wmm_classify_pkt(struct hdd_adapter *adapter, * Upgrade the priority, if the user priority of this packet is * less than the configured threshold. */ - if (*user_pri < adapter->upgrade_udp_qos_threshold && - (qdf_nbuf_is_ipv4_udp_pkt(skb) || qdf_nbuf_is_ipv6_udp_pkt(skb))) { - /* Upgrade UDP pkt priority alone */ - *user_pri = qca_wlan_ac_to_sme_qos( - adapter->upgrade_udp_qos_threshold); - } + hdd_check_and_upgrade_udp_qos(adapter, skb, user_pri); #ifdef HDD_WMM_DEBUG hdd_debug("tos is %d, dscp is %d, up is %d", tos, dscp, *user_pri);