2024-01-03 11:57:28 +00:00
|
|
|
From: Felix Fietkau <nbd@nbd.name>
|
|
|
|
Date: Thu, 27 Oct 2022 23:39:52 +0200
|
|
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: compile out netsys v2 code
|
|
|
|
on mt7621
|
|
|
|
|
|
|
|
Avoid some branches in the hot path on low-end devices with limited CPU power,
|
|
|
|
and reduce code size
|
|
|
|
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
---
|
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
2024-06-25 18:41:06 +00:00
|
|
|
@@ -1336,6 +1336,22 @@ struct mtk_mac {
|
2024-01-03 11:57:28 +00:00
|
|
|
/* the struct describing the SoC. these are declared in the soc_xyz.c files */
|
|
|
|
extern const struct of_device_id of_mtk_match[];
|
|
|
|
|
|
|
|
+#ifdef CONFIG_SOC_MT7621
|
|
|
|
+static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
|
|
|
|
+{
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth)
|
|
|
|
+{
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline bool mtk_is_netsys_v3_or_greater(struct mtk_eth *eth)
|
|
|
|
+{
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
|
|
|
|
{
|
|
|
|
return eth->soc->version == 1;
|
2024-06-25 18:41:06 +00:00
|
|
|
@@ -1350,6 +1366,7 @@ static inline bool mtk_is_netsys_v3_or_g
|
2024-01-03 11:57:28 +00:00
|
|
|
{
|
|
|
|
return eth->soc->version > 2;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
static inline struct mtk_foe_entry *
|
|
|
|
mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash)
|