diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 70b5a7f0b9c5..9cfe17c50604 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1087,6 +1087,8 @@ struct hdd_context; * @latency_level: 0 - normal, 1 - moderate, 2 - low, 3 - ultralow * @last_disconnect_reason: Last disconnected internal reason code * as per enum qca_disconnect_reason_codes + * @upgrade_udp_qos_threshold: The threshold for user priority upgrade for + any UDP packet. */ struct hdd_adapter { /* Magic cookie for adapter sanity verification. Note that this @@ -1295,6 +1297,7 @@ struct hdd_adapter { bool is_link_layer_stats_set; #endif uint8_t link_status; + uint8_t upgrade_udp_qos_threshold; /* variable for temperature in Celsius */ int temperature; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 7d7b8c0aafaa..469fc0828eb2 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6304,6 +6304,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio return NULL; } + adapter->upgrade_udp_qos_threshold = QCA_WLAN_AC_BE; qdf_spinlock_create(&adapter->vdev_lock); qdf_atomic_init(&hdd_ctx->num_latency_critical_clients); diff --git a/core/hdd/src/wlan_hdd_wmm.c b/core/hdd/src/wlan_hdd_wmm.c index 7ad67e4503db..f6c56011d845 100644 --- a/core/hdd/src/wlan_hdd_wmm.c +++ b/core/hdd/src/wlan_hdd_wmm.c @@ -1863,6 +1863,17 @@ void hdd_wmm_classify_pkt(struct hdd_adapter *adapter, dscp = (tos >> 2) & 0x3f; *user_pri = adapter->dscp_to_up_map[dscp]; + /* + * 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); + } + #ifdef HDD_WMM_DEBUG hdd_debug("tos is %d, dscp is %d, up is %d", tos, dscp, *user_pri); #endif /* HDD_WMM_DEBUG */ diff --git a/core/sme/inc/sme_qos_api.h b/core/sme/inc/sme_qos_api.h index e06816db3486..09d4993f151f 100644 --- a/core/sme/inc/sme_qos_api.h +++ b/core/sme/inc/sme_qos_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2020 The Linux Foundation. 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 @@ -196,6 +196,22 @@ struct sme_qos_wmmtspecinfo { uint16_t medium_time; }; +static inline enum sme_qos_wmmuptype qca_wlan_ac_to_sme_qos(u8 priority) +{ + switch (priority) { + case QCA_WLAN_AC_BE: + return SME_QOS_WMM_UP_BE; + case QCA_WLAN_AC_BK: + return SME_QOS_WMM_UP_BK; + case QCA_WLAN_AC_VI: + return SME_QOS_WMM_UP_VI; + case QCA_WLAN_AC_VO: + return SME_QOS_WMM_UP_VO; + default: + return SME_QOS_WMM_UP_BE; + } +} + /* External APIs */ typedef QDF_STATUS (*sme_QosCallback)(mac_handle_t mac_handle, void *HDDcontext, struct sme_qos_wmmtspecinfo *pCurrentQoSInfo,