730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From: Felix Fietkau <[email protected]>
  2. Date: Fri, 4 Nov 2022 19:49:08 +0100
  3. Subject: [PATCH] net: ethernet: mtk_eth_soc: avoid port_mg assignment on
  4. MT7622 and newer
  5. On newer chips, this field is unused and contains some bits related to queue
  6. assignment. Initialize it to 0 in those cases.
  7. Fix offload_version on MT7621 and MT7623, which still need the previous value.
  8. Signed-off-by: Felix Fietkau <[email protected]>
  9. ---
  10. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  11. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  12. @@ -4424,7 +4424,7 @@ static const struct mtk_soc_data mt7621_
  13. .hw_features = MTK_HW_FEATURES,
  14. .required_clks = MT7621_CLKS_BITMAP,
  15. .required_pctl = false,
  16. - .offload_version = 2,
  17. + .offload_version = 1,
  18. .hash_offset = 2,
  19. .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
  20. .txrx = {
  21. @@ -4463,7 +4463,7 @@ static const struct mtk_soc_data mt7623_
  22. .hw_features = MTK_HW_FEATURES,
  23. .required_clks = MT7623_CLKS_BITMAP,
  24. .required_pctl = true,
  25. - .offload_version = 2,
  26. + .offload_version = 1,
  27. .hash_offset = 2,
  28. .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
  29. .txrx = {
  30. --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
  31. +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
  32. @@ -175,6 +175,8 @@ int mtk_foe_entry_prepare(struct mtk_eth
  33. val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, pse_port) |
  34. FIELD_PREP(MTK_FOE_IB2_PORT_AG_V2, 0xf);
  35. } else {
  36. + int port_mg = eth->soc->offload_version > 1 ? 0 : 0x3f;
  37. +
  38. val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) |
  39. FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE, type) |
  40. FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) |
  41. @@ -182,7 +184,7 @@ int mtk_foe_entry_prepare(struct mtk_eth
  42. entry->ib1 = val;
  43. val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port) |
  44. - FIELD_PREP(MTK_FOE_IB2_PORT_MG, 0x3f) |
  45. + FIELD_PREP(MTK_FOE_IB2_PORT_MG, port_mg) |
  46. FIELD_PREP(MTK_FOE_IB2_PORT_AG, 0x1f);
  47. }