732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From: Felix Fietkau <[email protected]>
  2. Date: Thu, 27 Oct 2022 23:39:52 +0200
  3. Subject: [PATCH] net: ethernet: mtk_eth_soc: compile out netsys v2 code
  4. on mt7621
  5. Avoid some branches in the hot path on low-end devices with limited CPU power,
  6. and reduce code size
  7. Signed-off-by: Felix Fietkau <[email protected]>
  8. ---
  9. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
  10. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
  11. @@ -1323,6 +1323,22 @@ struct mtk_mac {
  12. /* the struct describing the SoC. these are declared in the soc_xyz.c files */
  13. extern const struct of_device_id of_mtk_match[];
  14. +#ifdef CONFIG_SOC_MT7621
  15. +static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
  16. +{
  17. + return true;
  18. +}
  19. +
  20. +static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth)
  21. +{
  22. + return false;
  23. +}
  24. +
  25. +static inline bool mtk_is_netsys_v3_or_greater(struct mtk_eth *eth)
  26. +{
  27. + return false;
  28. +}
  29. +#else
  30. static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
  31. {
  32. return eth->soc->version == 1;
  33. @@ -1337,6 +1353,7 @@ static inline bool mtk_is_netsys_v3_or_g
  34. {
  35. return eth->soc->version > 2;
  36. }
  37. +#endif
  38. static inline struct mtk_foe_entry *
  39. mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash)