Revert "qcacld-3.0: Treat ARP/ICMP/ICMPV6 packets as high priority"

This reverts commit 1b72a7fee7bfa92ea982b5ba6b2064e9370d4374.

Reason for revert: b/73204553

Change-Id: I1c116c126b9b235fa0209252a16059854cab2d19
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 a5b51c6..77ed25b9 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,7 +63,6 @@
 #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
@@ -1412,22 +1411,6 @@
 	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
@@ -1435,7 +1418,7 @@
  * @adapter: adapter upon which the packet is being transmitted
  * @skb: pointer to network buffer
  * @user_pri: user priority of the OS packet
- * @is_hipri: high priority packet flag
+ * @is_eapol: eapol packet flag
  *
  * Return: None
  */
@@ -1443,7 +1426,7 @@
 void hdd_wmm_classify_pkt(hdd_adapter_t *adapter,
 			  struct sk_buff *skb,
 			  sme_QosWmmUpType *user_pri,
-			  bool *is_hipri)
+			  bool *is_eapol)
 {
 	unsigned char dscp;
 	unsigned char tos;
@@ -1470,16 +1453,14 @@
 	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 = hdd_wmm_check_ip_proto(ip_hdr->protocol, ip_hdr->tos,
-					     is_hipri);
+		tos = ip_hdr->tos;
 #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 = hdd_wmm_check_ip_proto(
-			ipv6hdr->nexthdr, ntohs(*(const __be16 *)ipv6hdr) >> 4,
-			is_hipri);
+		tos = ntohs(*(const __be16 *)ipv6hdr) >> 4;
 #ifdef HDD_WMM_DEBUG
 		hdd_info("Ethernet II IPv6 Packet, tos is %d", tos);
 #endif /* HDD_WMM_DEBUG */
@@ -1490,8 +1471,7 @@
 		  (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 = hdd_wmm_check_ip_proto(ip_hdr->protocol, ip_hdr->tos,
-					     is_hipri);
+		tos = ip_hdr->tos;
 #ifdef HDD_WMM_DEBUG
 		hdd_info("802.3 LLC/SNAP IP Packet, tos is %d", tos);
 #endif /* HDD_WMM_DEBUG */
@@ -1504,8 +1484,7 @@
 			ip_hdr =
 				(struct iphdr *)
 				&pkt[sizeof(eth_hdr->eth_IIv)];
-			tos = hdd_wmm_check_ip_proto(ip_hdr->protocol,
-						     ip_hdr->tos, is_hipri);
+			tos = ip_hdr->tos;
 #ifdef HDD_WMM_DEBUG
 			hdd_info("Ethernet II VLAN tagged IP Packet, tos is %d",
 				 tos);
@@ -1525,39 +1504,30 @@
 			ip_hdr =
 				(struct iphdr *)
 				&pkt[sizeof(eth_hdr->eth_8023v)];
-			tos = hdd_wmm_check_ip_proto(ip_hdr->protocol,
-						     ip_hdr->tos, is_hipri);
+			tos = ip_hdr->tos;
 #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;
@@ -1587,20 +1557,20 @@
 /**
  * hdd_get_queue_index() - get queue index
  * @up: user priority
- * @is_hipri: high priority packet flag
+ * @is_eapol: is_eapol flag
  *
  * Return: queue_index
  */
 static
-uint16_t hdd_get_queue_index(u16 up, bool is_hipri)
+uint16_t hdd_get_queue_index(uint16_t up, bool is_eapol)
 {
-	if (qdf_unlikely(is_hipri))
+	if (qdf_unlikely(is_eapol == true))
 		return HDD_LINUX_AC_HI_PRIO;
 	return __hdd_get_queue_index(up);
 }
 #else
 static
-uint16_t hdd_get_queue_index(u16 up, bool is_hipri)
+uint16_t hdd_get_queue_index(uint16_t up, bool is_eapol)
 {
 	return __hdd_get_queue_index(up);
 }
@@ -1630,7 +1600,7 @@
 	uint16_t queueIndex;
 	hdd_adapter_t *adapter = (hdd_adapter_t *) netdev_priv(dev);
 	hdd_context_t *hddctx = WLAN_HDD_GET_CTX(adapter);
-	bool is_hipri = false;
+	bool is_eapol = false;
 	int status = 0;
 	status = wlan_hdd_validate_context(hddctx);
 
@@ -1640,9 +1610,9 @@
 	}
 
 	/* Get the user priority from IP header */
-	hdd_wmm_classify_pkt(adapter, skb, &up, &is_hipri);
+	hdd_wmm_classify_pkt(adapter, skb, &up, &is_eapol);
 	skb->priority = up;
-	queueIndex = hdd_get_queue_index(skb->priority, is_hipri);
+	queueIndex = hdd_get_queue_index(skb->priority, is_eapol);
 
 	return queueIndex;
 }
@@ -1660,9 +1630,9 @@
 {
 	sme_QosWmmUpType up = SME_QOS_WMM_UP_BE;
 	uint16_t queueIndex;
-	hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	bool is_hipri = false;
-	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+	bool is_eapol = false;
+	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
 	int status;
 
 	status = wlan_hdd_validate_context(hdd_ctx);
@@ -1672,9 +1642,9 @@
 	}
 
 	/* Get the user priority from IP header */
-	hdd_wmm_classify_pkt(adapter, skb, &up, &is_hipri);
+	hdd_wmm_classify_pkt(pAdapter, skb, &up, &is_eapol);
 	skb->priority = up;
-	queueIndex = hdd_get_queue_index(skb->priority, is_hipri);
+	queueIndex = hdd_get_queue_index(skb->priority, is_eapol);
 
 	return queueIndex;
 }