[][MAC80211][hnat][Improve ETH to ETH performace in an unbalanced PHY rate test for the mt7988]

[Description]
Add two pachtes to improve ETH to ETH performace in an unbalanced PHY
rate test for the mt7988.

These patches will enlarge FQ DMA size to 4K and dispatch short packets
a high priority queue in the PPPQ path.

Without this patch, the performance of ETH to ETH cannot reach line rate
in an unbalanced PHY rate test for the mt7988.

[Release-log]
N/A


Change-Id: I572c886af40fbce236ba93ccfa1118b246f608d7
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8312578
diff --git a/autobuild_mac80211_release/mt7988_mt7996_mac80211/target/linux/mediatek/patches-5.4/999-3024-mtk-ppe-dispatch-short-packets-to-high-priority-TXQ-in-PPPQ.patch b/autobuild_mac80211_release/mt7988_mt7996_mac80211/target/linux/mediatek/patches-5.4/999-3024-mtk-ppe-dispatch-short-packets-to-high-priority-TXQ-in-PPPQ.patch
new file mode 100644
index 0000000..31d8b89
--- /dev/null
+++ b/autobuild_mac80211_release/mt7988_mt7996_mac80211/target/linux/mediatek/patches-5.4/999-3024-mtk-ppe-dispatch-short-packets-to-high-priority-TXQ-in-PPPQ.patch
@@ -0,0 +1,57 @@
+From 8306aa4c52abf96af2c229762207369f279c89e2 Mon Sep 17 00:00:00 2001
+From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
+Date: Tue, 28 Nov 2023 13:25:03 +0800
+Subject: [PATCH] 999-3024-mtk-ppe-dispatch-short-packets-to-high-priority-TXQ-in-PPPQ
+
+---
+ drivers/net/ethernet/mediatek/mtk_ppe.c | 27 +++++++++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+
+diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
+index 16aec2e..1e2b96e 100644
+--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
+@@ -451,6 +451,28 @@ int mtk_foe_entry_set_qid(struct mtk_foe_entry *entry, int qid)
+ 	return 0;
+ }
+ 
++#if defined(CONFIG_MEDIATEK_NETSYS_V3)
++void mtk_foe_entry_adjust_qid(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
++{
++	struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(&entry->data);
++	u32 *ib2 = mtk_foe_entry_ib2(&entry->data);
++	u8 qid;
++
++	if (l2->tport_id != 1)
++		return;
++
++	qid = FIELD_GET(MTK_FOE_IB2_QID, *ib2);
++	/* To enhance performance in the unbalanced PHY rate test,
++	 * dispatching short packets to the high priority TXQ.
++	 */
++	if (ppe->eth->qos_toggle == 2 && qid < 6) {
++		qid += 6;
++		*ib2 &= ~MTK_FOE_IB2_QID;
++		*ib2 |= FIELD_PREP(MTK_FOE_IB2_QID, qid);
++	}
++}
++#endif
++
+ int mtk_foe_entry_set_dscp(struct mtk_foe_entry *entry, int dscp)
+ {
+ 	u32 *ib2 = mtk_foe_entry_ib2(entry);
+@@ -790,6 +812,11 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
+ 			continue;
+ 		}
+ 
++#if defined(CONFIG_MEDIATEK_NETSYS_V3)
++		if (skb && skb->len < 100)
++			mtk_foe_entry_adjust_qid(ppe, entry);
++#endif
++
+ 		entry->hash = hash;
+ 		__mtk_foe_entry_commit(ppe, &entry->data, hash);
+ 		found = true;
+-- 
+2.18.0
+