1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 27 Oct 2022 23:39:52 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: compile out netsys v2 code
6 Avoid some branches in the hot path on low-end devices with limited CPU power,
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
13 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
14 @@ -1323,6 +1323,22 @@ struct mtk_mac {
15 /* the struct describing the SoC. these are declared in the soc_xyz.c files */
16 extern const struct of_device_id of_mtk_match[];
18 +#ifdef CONFIG_SOC_MT7621
19 +static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
24 +static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth)
29 +static inline bool mtk_is_netsys_v3_or_greater(struct mtk_eth *eth)
34 static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
36 return eth->soc->version == 1;
37 @@ -1337,6 +1353,7 @@ static inline bool mtk_is_netsys_v3_or_g
39 return eth->soc->version > 2;
43 static inline struct mtk_foe_entry *
44 mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash)