blob: 31d8b89ffd6a057de8bf62b8b9b388476c30bff4 [file] [log] [blame]
developer4f56ddb2023-11-29 12:16:21 +08001From 8306aa4c52abf96af2c229762207369f279c89e2 Mon Sep 17 00:00:00 2001
2From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
3Date: Tue, 28 Nov 2023 13:25:03 +0800
4Subject: [PATCH] 999-3024-mtk-ppe-dispatch-short-packets-to-high-priority-TXQ-in-PPPQ
5
6---
7 drivers/net/ethernet/mediatek/mtk_ppe.c | 27 +++++++++++++++++++++++++
8 1 file changed, 27 insertions(+)
9
10diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
11index 16aec2e..1e2b96e 100644
12--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
13+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
14@@ -451,6 +451,28 @@ int mtk_foe_entry_set_qid(struct mtk_foe_entry *entry, int qid)
15 return 0;
16 }
17
18+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
19+void mtk_foe_entry_adjust_qid(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
20+{
21+ struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(&entry->data);
22+ u32 *ib2 = mtk_foe_entry_ib2(&entry->data);
23+ u8 qid;
24+
25+ if (l2->tport_id != 1)
26+ return;
27+
28+ qid = FIELD_GET(MTK_FOE_IB2_QID, *ib2);
29+ /* To enhance performance in the unbalanced PHY rate test,
30+ * dispatching short packets to the high priority TXQ.
31+ */
32+ if (ppe->eth->qos_toggle == 2 && qid < 6) {
33+ qid += 6;
34+ *ib2 &= ~MTK_FOE_IB2_QID;
35+ *ib2 |= FIELD_PREP(MTK_FOE_IB2_QID, qid);
36+ }
37+}
38+#endif
39+
40 int mtk_foe_entry_set_dscp(struct mtk_foe_entry *entry, int dscp)
41 {
42 u32 *ib2 = mtk_foe_entry_ib2(entry);
43@@ -790,6 +812,11 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
44 continue;
45 }
46
47+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
48+ if (skb && skb->len < 100)
49+ mtk_foe_entry_adjust_qid(ppe, entry);
50+#endif
51+
52 entry->hash = hash;
53 __mtk_foe_entry_commit(ppe, &entry->data, hash);
54 found = true;
55--
562.18.0
57