diff options
author | Kumar Anand <kumaranand@google.com> | 2018-05-08 22:50:50 +0000 |
---|---|---|
committer | Kumar Anand <kumaranand@google.com> | 2018-05-08 22:51:00 +0000 |
commit | 1b72a7fee7bfa92ea982b5ba6b2064e9370d4374 (patch) | |
tree | 1ba5ec0b0fa0b2bc889be0e3499f1a5bbed8db98 | |
parent | bf8c6549e125711b8a57e7c7457e27c8f952a1b6 (diff) |
Revert "Revert "qcacld-3.0: Treat ARP/ICMP/ICMPV6 packets as high priority""android-8.1.0_r0.65
This reverts commit c35b7320e0dba3802c7cc94c837d3b960279e01e.
Reason for revert: <INSERT REASONING HERE>
Change-Id: I8ad0e0cd33e91ef36b330fd3fa0afa89788b7612
-rw-r--r-- | drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_wmm.c | 86 |
1 files changed, 58 insertions, 28 deletions
diff --git a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_wmm.c b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_wmm.c index 77ed25b98ed5..a5b51c68ceac 100644 --- a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_wmm.c +++ b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_wmm.c @@ -63,6 +63,7 @@ #include <cds_sched.h> #include "sme_api.h" +#define WLAN_HDD_HIPRI_TOS 0xc0 #define WLAN_HDD_MAX_DSCP 0x3f #define HDD_WMM_UP_TO_AC_MAP_SIZE 8 @@ -1411,6 +1412,22 @@ QDF_STATUS hdd_wmm_adapter_close(hdd_adapter_t *pAdapter) return QDF_STATUS_SUCCESS; } +static inline unsigned char hdd_wmm_check_ip_proto(unsigned char ip_proto, + unsigned char ip_tos, + bool *is_hipri) +{ + switch (ip_proto) { + case IPPROTO_ICMP: + case IPPROTO_ICMPV6: + *is_hipri = true; + return WLAN_HDD_HIPRI_TOS; + + default: + *is_hipri = false; + return ip_tos; + } +} + /** * hdd_wmm_classify_pkt() - Function which will classify an OS packet * into a WMM AC based on DSCP @@ -1418,7 +1435,7 @@ QDF_STATUS hdd_wmm_adapter_close(hdd_adapter_t *pAdapter) * @adapter: adapter upon which the packet is being transmitted * @skb: pointer to network buffer * @user_pri: user priority of the OS packet - * @is_eapol: eapol packet flag + * @is_hipri: high priority packet flag * * Return: None */ @@ -1426,7 +1443,7 @@ static void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, struct sk_buff *skb, sme_QosWmmUpType *user_pri, - bool *is_eapol) + bool *is_hipri) { unsigned char dscp; unsigned char tos; @@ -1453,14 +1470,16 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, if (eth_hdr->eth_II.h_proto == htons(ETH_P_IP)) { /* case 1: Ethernet II IP packet */ ip_hdr = (struct iphdr *)&pkt[sizeof(eth_hdr->eth_II)]; - tos = ip_hdr->tos; + tos = hdd_wmm_check_ip_proto(ip_hdr->protocol, ip_hdr->tos, + is_hipri); #ifdef HDD_WMM_DEBUG hdd_info("Ethernet II IP Packet, tos is %d", tos); #endif /* HDD_WMM_DEBUG */ - } else if (eth_hdr->eth_II.h_proto == htons(ETH_P_IPV6)) { ipv6hdr = ipv6_hdr(skb); - tos = ntohs(*(const __be16 *)ipv6hdr) >> 4; + tos = hdd_wmm_check_ip_proto( + ipv6hdr->nexthdr, ntohs(*(const __be16 *)ipv6hdr) >> 4, + is_hipri); #ifdef HDD_WMM_DEBUG hdd_info("Ethernet II IPv6 Packet, tos is %d", tos); #endif /* HDD_WMM_DEBUG */ @@ -1471,7 +1490,8 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, (eth_hdr->eth_8023.h_proto == htons(ETH_P_IP))) { /* case 2: 802.3 LLC/SNAP IP packet */ ip_hdr = (struct iphdr *)&pkt[sizeof(eth_hdr->eth_8023)]; - tos = ip_hdr->tos; + tos = hdd_wmm_check_ip_proto(ip_hdr->protocol, ip_hdr->tos, + is_hipri); #ifdef HDD_WMM_DEBUG hdd_info("802.3 LLC/SNAP IP Packet, tos is %d", tos); #endif /* HDD_WMM_DEBUG */ @@ -1484,7 +1504,8 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, ip_hdr = (struct iphdr *) &pkt[sizeof(eth_hdr->eth_IIv)]; - tos = ip_hdr->tos; + tos = hdd_wmm_check_ip_proto(ip_hdr->protocol, + ip_hdr->tos, is_hipri); #ifdef HDD_WMM_DEBUG hdd_info("Ethernet II VLAN tagged IP Packet, tos is %d", tos); @@ -1504,30 +1525,39 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, ip_hdr = (struct iphdr *) &pkt[sizeof(eth_hdr->eth_8023v)]; - tos = ip_hdr->tos; + tos = hdd_wmm_check_ip_proto(ip_hdr->protocol, + ip_hdr->tos, is_hipri); #ifdef HDD_WMM_DEBUG hdd_info("802.3 LLC/SNAP VLAN tagged IP Packet, tos is %d", tos); #endif /* HDD_WMM_DEBUG */ } else { /* default */ + *is_hipri = false; + tos = 0; #ifdef HDD_WMM_DEBUG hdd_warn("VLAN tagged Unhandled Protocol, using default tos"); #endif /* HDD_WMM_DEBUG */ - tos = 0; } + } else if (eth_hdr->eth_II.h_proto == htons(HDD_ETHERTYPE_802_1_X)) { + *is_hipri = true; + tos = WLAN_HDD_HIPRI_TOS; +#ifdef HDD_WMM_DEBUG + hdd_info("802.1x packet, tos is %d", tos); +#endif /* HDD_WMM_DEBUG */ + } else if (skb->protocol == htons(ETH_P_ARP)) { + *is_hipri = true; + tos = WLAN_HDD_HIPRI_TOS; +#ifdef HDD_WMM_DEBUG + hdd_info("ARP packet, tos is %d", tos); +#endif /* HDD_WMM_DEBUG */ } else { /* default */ + *is_hipri = false; + tos = 0; #ifdef HDD_WMM_DEBUG hdd_warn("Unhandled Protocol, using default tos"); #endif /* HDD_WMM_DEBUG */ - /* Give the highest priority to 802.1x packet */ - if (eth_hdr->eth_II.h_proto == - htons(HDD_ETHERTYPE_802_1_X)) { - tos = 0xC0; - *is_eapol = true; - } else - tos = 0; } dscp = (tos >> 2) & 0x3f; @@ -1557,20 +1587,20 @@ static uint16_t __hdd_get_queue_index(uint16_t up) /** * hdd_get_queue_index() - get queue index * @up: user priority - * @is_eapol: is_eapol flag + * @is_hipri: high priority packet flag * * Return: queue_index */ static -uint16_t hdd_get_queue_index(uint16_t up, bool is_eapol) +uint16_t hdd_get_queue_index(u16 up, bool is_hipri) { - if (qdf_unlikely(is_eapol == true)) + if (qdf_unlikely(is_hipri)) return HDD_LINUX_AC_HI_PRIO; return __hdd_get_queue_index(up); } #else static -uint16_t hdd_get_queue_index(uint16_t up, bool is_eapol) +uint16_t hdd_get_queue_index(u16 up, bool is_hipri) { return __hdd_get_queue_index(up); } @@ -1600,7 +1630,7 @@ uint16_t hdd_hostapd_select_queue(struct net_device *dev, struct sk_buff *skb uint16_t queueIndex; hdd_adapter_t *adapter = (hdd_adapter_t *) netdev_priv(dev); hdd_context_t *hddctx = WLAN_HDD_GET_CTX(adapter); - bool is_eapol = false; + bool is_hipri = false; int status = 0; status = wlan_hdd_validate_context(hddctx); @@ -1610,9 +1640,9 @@ uint16_t hdd_hostapd_select_queue(struct net_device *dev, struct sk_buff *skb } /* Get the user priority from IP header */ - hdd_wmm_classify_pkt(adapter, skb, &up, &is_eapol); + hdd_wmm_classify_pkt(adapter, skb, &up, &is_hipri); skb->priority = up; - queueIndex = hdd_get_queue_index(skb->priority, is_eapol); + queueIndex = hdd_get_queue_index(skb->priority, is_hipri); return queueIndex; } @@ -1630,9 +1660,9 @@ uint16_t hdd_wmm_select_queue(struct net_device *dev, struct sk_buff *skb) { sme_QosWmmUpType up = SME_QOS_WMM_UP_BE; uint16_t queueIndex; - hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); - bool is_eapol = false; - hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); + hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + bool is_hipri = false; + hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); int status; status = wlan_hdd_validate_context(hdd_ctx); @@ -1642,9 +1672,9 @@ uint16_t hdd_wmm_select_queue(struct net_device *dev, struct sk_buff *skb) } /* Get the user priority from IP header */ - hdd_wmm_classify_pkt(pAdapter, skb, &up, &is_eapol); + hdd_wmm_classify_pkt(adapter, skb, &up, &is_hipri); skb->priority = up; - queueIndex = hdd_get_queue_index(skb->priority, is_eapol); + queueIndex = hdd_get_queue_index(skb->priority, is_hipri); return queueIndex; } |