Skip to content
Snippets Groups Projects
Commit 1b72a7fe authored by Kumar Anand's avatar Kumar Anand
Browse files

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

This reverts commit c35b7320.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I8ad0e0cd33e91ef36b330fd3fa0afa89788b7612
parent bf8c6549
Branches android-msm-smelt-3.10-lollipop-mr1-wear-release
Tags android-wear-5.1.1_r0.22
No related merge requests found
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include <cds_sched.h> #include <cds_sched.h>
#include "sme_api.h" #include "sme_api.h"
#define WLAN_HDD_HIPRI_TOS 0xc0
#define WLAN_HDD_MAX_DSCP 0x3f #define WLAN_HDD_MAX_DSCP 0x3f
#define HDD_WMM_UP_TO_AC_MAP_SIZE 8 #define HDD_WMM_UP_TO_AC_MAP_SIZE 8
...@@ -1411,6 +1412,22 @@ QDF_STATUS hdd_wmm_adapter_close(hdd_adapter_t *pAdapter) ...@@ -1411,6 +1412,22 @@ QDF_STATUS hdd_wmm_adapter_close(hdd_adapter_t *pAdapter)
return QDF_STATUS_SUCCESS; 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 * hdd_wmm_classify_pkt() - Function which will classify an OS packet
* into a WMM AC based on DSCP * into a WMM AC based on DSCP
...@@ -1418,7 +1435,7 @@ QDF_STATUS hdd_wmm_adapter_close(hdd_adapter_t *pAdapter) ...@@ -1418,7 +1435,7 @@ QDF_STATUS hdd_wmm_adapter_close(hdd_adapter_t *pAdapter)
* @adapter: adapter upon which the packet is being transmitted * @adapter: adapter upon which the packet is being transmitted
* @skb: pointer to network buffer * @skb: pointer to network buffer
* @user_pri: user priority of the OS packet * @user_pri: user priority of the OS packet
* @is_eapol: eapol packet flag * @is_hipri: high priority packet flag
* *
* Return: None * Return: None
*/ */
...@@ -1426,7 +1443,7 @@ static ...@@ -1426,7 +1443,7 @@ static
void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, void hdd_wmm_classify_pkt(hdd_adapter_t *adapter,
struct sk_buff *skb, struct sk_buff *skb,
sme_QosWmmUpType *user_pri, sme_QosWmmUpType *user_pri,
bool *is_eapol) bool *is_hipri)
{ {
unsigned char dscp; unsigned char dscp;
unsigned char tos; unsigned char tos;
...@@ -1453,14 +1470,16 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, ...@@ -1453,14 +1470,16 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter,
if (eth_hdr->eth_II.h_proto == htons(ETH_P_IP)) { if (eth_hdr->eth_II.h_proto == htons(ETH_P_IP)) {
/* case 1: Ethernet II IP packet */ /* case 1: Ethernet II IP packet */
ip_hdr = (struct iphdr *)&pkt[sizeof(eth_hdr->eth_II)]; 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 #ifdef HDD_WMM_DEBUG
hdd_info("Ethernet II IP Packet, tos is %d", tos); hdd_info("Ethernet II IP Packet, tos is %d", tos);
#endif /* HDD_WMM_DEBUG */ #endif /* HDD_WMM_DEBUG */
} else if (eth_hdr->eth_II.h_proto == htons(ETH_P_IPV6)) { } else if (eth_hdr->eth_II.h_proto == htons(ETH_P_IPV6)) {
ipv6hdr = ipv6_hdr(skb); 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 #ifdef HDD_WMM_DEBUG
hdd_info("Ethernet II IPv6 Packet, tos is %d", tos); hdd_info("Ethernet II IPv6 Packet, tos is %d", tos);
#endif /* HDD_WMM_DEBUG */ #endif /* HDD_WMM_DEBUG */
...@@ -1471,7 +1490,8 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, ...@@ -1471,7 +1490,8 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter,
(eth_hdr->eth_8023.h_proto == htons(ETH_P_IP))) { (eth_hdr->eth_8023.h_proto == htons(ETH_P_IP))) {
/* case 2: 802.3 LLC/SNAP IP packet */ /* case 2: 802.3 LLC/SNAP IP packet */
ip_hdr = (struct iphdr *)&pkt[sizeof(eth_hdr->eth_8023)]; 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 #ifdef HDD_WMM_DEBUG
hdd_info("802.3 LLC/SNAP IP Packet, tos is %d", tos); hdd_info("802.3 LLC/SNAP IP Packet, tos is %d", tos);
#endif /* HDD_WMM_DEBUG */ #endif /* HDD_WMM_DEBUG */
...@@ -1484,7 +1504,8 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, ...@@ -1484,7 +1504,8 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter,
ip_hdr = ip_hdr =
(struct iphdr *) (struct iphdr *)
&pkt[sizeof(eth_hdr->eth_IIv)]; &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 #ifdef HDD_WMM_DEBUG
hdd_info("Ethernet II VLAN tagged IP Packet, tos is %d", hdd_info("Ethernet II VLAN tagged IP Packet, tos is %d",
tos); tos);
...@@ -1504,30 +1525,39 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter, ...@@ -1504,30 +1525,39 @@ void hdd_wmm_classify_pkt(hdd_adapter_t *adapter,
ip_hdr = ip_hdr =
(struct iphdr *) (struct iphdr *)
&pkt[sizeof(eth_hdr->eth_8023v)]; &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 #ifdef HDD_WMM_DEBUG
hdd_info("802.3 LLC/SNAP VLAN tagged IP Packet, tos is %d", hdd_info("802.3 LLC/SNAP VLAN tagged IP Packet, tos is %d",
tos); tos);
#endif /* HDD_WMM_DEBUG */ #endif /* HDD_WMM_DEBUG */
} else { } else {
/* default */ /* default */
*is_hipri = false;
tos = 0;
#ifdef HDD_WMM_DEBUG #ifdef HDD_WMM_DEBUG
hdd_warn("VLAN tagged Unhandled Protocol, using default tos"); hdd_warn("VLAN tagged Unhandled Protocol, using default tos");
#endif /* HDD_WMM_DEBUG */ #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 { } else {
/* default */ /* default */
*is_hipri = false;
tos = 0;
#ifdef HDD_WMM_DEBUG #ifdef HDD_WMM_DEBUG
hdd_warn("Unhandled Protocol, using default tos"); hdd_warn("Unhandled Protocol, using default tos");
#endif /* HDD_WMM_DEBUG */ #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; dscp = (tos >> 2) & 0x3f;
...@@ -1557,20 +1587,20 @@ static uint16_t __hdd_get_queue_index(uint16_t up) ...@@ -1557,20 +1587,20 @@ static uint16_t __hdd_get_queue_index(uint16_t up)
/** /**
* hdd_get_queue_index() - get queue index * hdd_get_queue_index() - get queue index
* @up: user priority * @up: user priority
* @is_eapol: is_eapol flag * @is_hipri: high priority packet flag
* *
* Return: queue_index * Return: queue_index
*/ */
static 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_LINUX_AC_HI_PRIO;
return __hdd_get_queue_index(up); return __hdd_get_queue_index(up);
} }
#else #else
static 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); return __hdd_get_queue_index(up);
} }
...@@ -1600,7 +1630,7 @@ uint16_t hdd_hostapd_select_queue(struct net_device *dev, struct sk_buff *skb ...@@ -1600,7 +1630,7 @@ uint16_t hdd_hostapd_select_queue(struct net_device *dev, struct sk_buff *skb
uint16_t queueIndex; uint16_t queueIndex;
hdd_adapter_t *adapter = (hdd_adapter_t *) netdev_priv(dev); hdd_adapter_t *adapter = (hdd_adapter_t *) netdev_priv(dev);
hdd_context_t *hddctx = WLAN_HDD_GET_CTX(adapter); hdd_context_t *hddctx = WLAN_HDD_GET_CTX(adapter);
bool is_eapol = false; bool is_hipri = false;
int status = 0; int status = 0;
status = wlan_hdd_validate_context(hddctx); status = wlan_hdd_validate_context(hddctx);
...@@ -1610,9 +1640,9 @@ uint16_t hdd_hostapd_select_queue(struct net_device *dev, struct sk_buff *skb ...@@ -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 */ /* 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; skb->priority = up;
queueIndex = hdd_get_queue_index(skb->priority, is_eapol); queueIndex = hdd_get_queue_index(skb->priority, is_hipri);
return queueIndex; return queueIndex;
} }
...@@ -1630,9 +1660,9 @@ uint16_t hdd_wmm_select_queue(struct net_device *dev, struct sk_buff *skb) ...@@ -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; sme_QosWmmUpType up = SME_QOS_WMM_UP_BE;
uint16_t queueIndex; uint16_t queueIndex;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
bool is_eapol = false; bool is_hipri = false;
hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
int status; int status;
status = wlan_hdd_validate_context(hdd_ctx); 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) ...@@ -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 */ /* 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; skb->priority = up;
queueIndex = hdd_get_queue_index(skb->priority, is_eapol); queueIndex = hdd_get_queue_index(skb->priority, is_hipri);
return queueIndex; return queueIndex;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment