blob: d0ad23e77ee18cb79877ae06839e0bf3cdf2b789 [file] [log] [blame]
From e8a6054c824c5c65abd501bfd7437a3d7c5f2751 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 23/24]
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 ae0acd5..547b5a0 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -451,6 +451,31 @@ int mtk_foe_entry_set_qid(struct mtk_foe_entry *entry, int qid)
return 0;
}
+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 defined(CONFIG_MEDIATEK_NETSYS_V3)
+ if (l2->tport_id != 1)
+ return;
+#else
+ if (!(*ib2 & MTK_FOE_IB2_PSE_QOS))
+ return;
+#endif
+
+ 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);
+ }
+}
+
int mtk_foe_entry_set_dscp(struct mtk_foe_entry *entry, int dscp)
{
u32 *ib2 = mtk_foe_entry_ib2(entry);
@@ -790,6 +815,9 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
continue;
}
+ if (skb && skb->len < 100)
+ mtk_foe_entry_adjust_qid(ppe, entry);
+
entry->hash = hash;
__mtk_foe_entry_commit(ppe, &entry->data, hash);
found = true;
--
2.18.0