Browse Source

qcacld-3.0: Fix the UDP qos upgrade logic

The UDP qos upgrade is skipped currently if the setting
from userspace is set to best effort. Also with the current
logic the priority of packets at "best effort" gets
downgraded to "background".

Fix the UDP qos upgrade logic to take care of using
the "background" priority value as a trigger to skip
UDP qos upgrade.

Change-Id: I5111a930995ddd71b082db95440ed778f09a3cba
CRs-Fixed: 2816426
Rakesh Pillai 4 years ago
parent
commit
c7d5c4a52f
3 changed files with 49 additions and 7 deletions
  1. 1 1
      core/hdd/src/wlan_hdd_main.c
  2. 2 0
      core/hdd/src/wlan_hdd_tx_rx.c
  3. 46 6
      core/hdd/src/wlan_hdd_wmm.c

+ 1 - 1
core/hdd/src/wlan_hdd_main.c

@@ -6597,7 +6597,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
 	if (QDF_IS_STATUS_ERROR(status))
 		goto err_cleanup_adapter;
 
-	adapter->upgrade_udp_qos_threshold = QCA_WLAN_AC_BE;
+	adapter->upgrade_udp_qos_threshold = QCA_WLAN_AC_BK;
 	qdf_spinlock_create(&adapter->vdev_lock);
 	qdf_atomic_init(&hdd_ctx->num_latency_critical_clients);
 

+ 2 - 0
core/hdd/src/wlan_hdd_tx_rx.c

@@ -485,6 +485,8 @@ int hdd_set_udp_qos_upgrade_config(struct hdd_adapter *adapter,
 
 	adapter->upgrade_udp_qos_threshold = priority;
 
+	hdd_debug("UDP packets qos upgrade to: %d", priority);
+
 	return 0;
 }
 

+ 46 - 6
core/hdd/src/wlan_hdd_wmm.c

@@ -1744,6 +1744,51 @@ QDF_STATUS hdd_wmm_adapter_close(struct hdd_adapter *adapter)
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * hdd_check_and_upgrade_udp_qos() - Check and upgrade the qos for UDP packets
+ *				     if the current set priority is below the
+ *				     pre-configured threshold for upgrade.
+ * @adapter: [in] pointer to the adapter context (Should not be invalid)
+ * @skb: [in] pointer to the packet to be transmitted
+ * @user_pri: [out] priority set for this packet
+ *
+ * This function checks if the packet is a UDP packet and upgrades its
+ * priority if its below the pre-configured upgrade threshold.
+ * The upgrade order is as below:
+ * BK -> BE -> VI -> VO
+ *
+ * Return: none
+ */
+static inline void
+hdd_check_and_upgrade_udp_qos(struct hdd_adapter *adapter,
+			      qdf_nbuf_t skb,
+			      enum sme_qos_wmmuptype *user_pri)
+{
+	/* Upgrade UDP pkt priority alone */
+	if (!(qdf_nbuf_is_ipv4_udp_pkt(skb) || qdf_nbuf_is_ipv6_udp_pkt(skb)))
+		return;
+
+	switch (adapter->upgrade_udp_qos_threshold) {
+	case QCA_WLAN_AC_BK:
+		break;
+	case QCA_WLAN_AC_BE:
+		if (*user_pri == qca_wlan_ac_to_sme_qos(QCA_WLAN_AC_BK))
+			*user_pri = qca_wlan_ac_to_sme_qos(QCA_WLAN_AC_BE);
+
+		break;
+	case QCA_WLAN_AC_VI:
+	case QCA_WLAN_AC_VO:
+		if (*user_pri <
+		    qca_wlan_ac_to_sme_qos(adapter->upgrade_udp_qos_threshold))
+			*user_pri = qca_wlan_ac_to_sme_qos(
+					adapter->upgrade_udp_qos_threshold);
+
+		break;
+	default:
+		break;
+	}
+}
+
 /**
  * hdd_wmm_classify_pkt() - Function which will classify an OS packet
  * into a WMM AC based on DSCP
@@ -1869,12 +1914,7 @@ void hdd_wmm_classify_pkt(struct hdd_adapter *adapter,
 	 * 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);
-	}
+	hdd_check_and_upgrade_udp_qos(adapter, skb, user_pri);
 
 #ifdef HDD_WMM_DEBUG
 	hdd_debug("tos is %d, dscp is %d, up is %d", tos, dscp, *user_pri);