wlan: Send data pkts with correct priority for TDLS connection.

When data pkts are transmitted on tdls link,
qos priority is mapped to BE when AP-STA link
is non-qos.
Fix this by always doing qos mapping for each pkt in
HDD irrespective of qos/non-qos STA capability.
In TL if dest STA is qos-sta then choose appropriate
qos mapping based on SKB priority else choose BE priority

CRs-Fixed: 779026
Change-Id: I37e05267535b6df5e52c6bc0a3a38bd75785985a
diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c
index 5c6303e..5b056ba 100644
--- a/CORE/HDD/src/wlan_hdd_tx_rx.c
+++ b/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -1706,52 +1706,47 @@
 
 #ifdef FEATURE_WLAN_WAPI
    // Override usIsEapol value when its zero for WAPI case
-      pPktMetaInfo->ucIsWai = hdd_IsWAIPacket( pVosPacket ) ? 1 : 0;
+   pPktMetaInfo->ucIsWai = hdd_IsWAIPacket( pVosPacket ) ? 1 : 0;
 #endif /* FEATURE_WLAN_WAPI */
 
-   if ((HDD_WMM_USER_MODE_NO_QOS == pHddCtx->cfg_ini->WmmMode) ||
-       (!pAdapter->hddWmmStatus.wmmQap))
+   /* 1. Check if ACM is set for this AC
+    * 2. If set, check if this AC had already admitted
+    * 3. If not already admitted, downgrade the UP to next best UP
+    * 4. Allow only when medium time is non zero when Addts accepted
+    *    else downgrade traffic. we opted downgrading over Delts when
+    *    medium time is zero because while doing downgradig driver is not
+    *    clearing the wmm context so consider in subsequent roaming
+    *    if AP (new or same AP) accept the Addts with valid medium time
+    *    no application support is required where if we have opted
+    *    delts Applications have to again do Addts or STA will never
+    *    go for Addts.
+    */
+
+   if(!pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired ||
+      (pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid &&
+       pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecInfo.medium_time))
    {
-      // either we don't want QoS or the AP doesn't support QoS
-      pPktMetaInfo->ucUP = 0;
-      pPktMetaInfo->ucTID = 0;
+      pPktMetaInfo->ucUP = pktNode->userPriority;
+      pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
    }
    else
    {
-      /* 1. Check if ACM is set for this AC 
-       * 2. If set, check if this AC had already admitted 
-       * 3. If not already admitted, downgrade the UP to next best UP
-       * 4. Allow only when medium time is non zero when Addts accepted else downgrade traffic.
-            we opted downgrading over Delts when medium time is zero because while doing downgradig
-            driver is not clearing the wmm context so consider in subsequent roaming if AP (new or
-            same AP) accept the Addts with valid medium time no application support is required
-            where if we have opted delts Applications have to again do Addts or STA will never
-            go for Addts.*/
-
-      if(!pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired ||
-         (pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid &&
-          pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecInfo.medium_time))
+     //Downgrade the UP
+      acAdmitted = pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid;
+      newAc = WLANTL_AC_BK;
+      for (i=ac-1; i>0; i--)
       {
-        pPktMetaInfo->ucUP = pktNode->userPriority;
-        pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
+         if (pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessRequired == 0)
+         {
+             newAc = i;
+             break;
+         }
       }
-      else
-      {
-        //Downgrade the UP
-        acAdmitted = pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid;
-        newAc = WLANTL_AC_BK;
-        for (i=ac-1; i>0; i--)
-        {
-            if (pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessRequired == 0)
-            {
-                newAc = i;
-                break;
-            }
-        }
-        pPktMetaInfo->ucUP = hddWmmAcToHighestUp[newAc];
-        pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
-        VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_LOW,"Downgrading UP %d to UP %d ", pktNode->userPriority, pPktMetaInfo->ucUP);
-      }
+      pPktMetaInfo->ucUP = hddWmmAcToHighestUp[newAc];
+      pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
+      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_LOW,
+               "Downgrading UP %d to UP %d ",
+                pktNode->userPriority, pPktMetaInfo->ucUP);
    }
 
 #ifdef DEBUG_ROAM_DELAY
diff --git a/CORE/HDD/src/wlan_hdd_wmm.c b/CORE/HDD/src/wlan_hdd_wmm.c
index 101b01b..3ae56d3 100644
--- a/CORE/HDD/src/wlan_hdd_wmm.c
+++ b/CORE/HDD/src/wlan_hdd_wmm.c
@@ -2008,20 +2008,19 @@
           }
        }
    }
-   // if we don't want QoS or the AP doesn't support Qos
-   // All traffic will get equal opportuniy to transmit data frames.
-   if( hdd_wmm_is_active(pAdapter) ) {
-      /* Get the user priority from IP header & corresponding AC */
-      hdd_wmm_classify_pkt (pAdapter, skb, &ac, &up);
-      //If 3/4th of BE AC Tx queue is full, then place the DHCP packet in VOICE AC queue
-      if (pAdapter->isVosLowResource && is_dhcp_packet(skb))
-      {
-         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
-                   "%s: BestEffort Tx Queue is 3/4th full"
-                   " Make DHCP packet's pri as VO", __func__);
-         up = SME_QOS_WMM_UP_VO;
-         ac = hddWmmUpToAcMap[up];
-      }
+   /* All traffic will get equal opportuniy to transmit data frames. */
+   /* Get the user priority from IP header & corresponding AC */
+   hdd_wmm_classify_pkt (pAdapter, skb, &ac, &up);
+   /* If 3/4th of BE AC Tx queue is full,
+    * then place the DHCP packet in VOICE AC queue
+    */
+   if (pAdapter->isVosLowResource && is_dhcp_packet(skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
+                "%s: BestEffort Tx Queue is 3/4th full"
+                " Make DHCP packet's pri as VO", __func__);
+      up = SME_QOS_WMM_UP_VO;
+      ac = hddWmmUpToAcMap[up];
    }
 done:
    skb->priority = up;
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
index 1ec925a..e8408e8 100644
--- a/CORE/TL/src/wlan_qct_tl.c
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -9957,6 +9957,8 @@
   else
   {
       pw80211Header->wFrmCtrl.subType  = 0;
+      tlMetaInfo->ucUP = 0;
+      tlMetaInfo->ucTID = 0;
 
   // NO NO NO - there is not enough memory allocated to write the QOS ctrl  
   // field, it will overwrite the first 2 bytes of the data packet(LLC header)