734-net-ethernet-mtk_eth_soc-ppe-fix-L2-offloading-with-.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From: Felix Fietkau <[email protected]>
  2. Date: Tue, 27 Dec 2022 15:02:51 +0100
  3. Subject: [PATCH] net: ethernet: mtk_eth_soc: ppe: fix L2 offloading with DSA
  4. untagging offload enabled
  5. Check for skb metadata in order to detect the case where the DSA header is not
  6. present.
  7. Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
  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. @@ -1998,9 +1998,6 @@ static int mtk_poll_rx(struct napi_struc
  13. skb_checksum_none_assert(skb);
  14. skb->protocol = eth_type_trans(skb, netdev);
  15. - if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
  16. - mtk_ppe_check_skb(eth->ppe[0], skb, hash);
  17. -
  18. /* When using VLAN untagging in combination with DSA, the
  19. * hardware treats the MTK special tag as a VLAN and untags it.
  20. */
  21. @@ -2013,6 +2010,9 @@ static int mtk_poll_rx(struct napi_struc
  22. skb_dst_set_noref(skb, &eth->dsa_meta[port]->dst);
  23. }
  24. + if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
  25. + mtk_ppe_check_skb(eth->ppe[0], skb, hash);
  26. +
  27. skb_record_rx_queue(skb, 0);
  28. napi_gro_receive(napi, skb);
  29. --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
  30. +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
  31. @@ -8,6 +8,7 @@
  32. #include <linux/platform_device.h>
  33. #include <linux/if_ether.h>
  34. #include <linux/if_vlan.h>
  35. +#include <net/dst_metadata.h>
  36. #include <net/dsa.h>
  37. #include "mtk_eth_soc.h"
  38. #include "mtk_ppe.h"
  39. @@ -756,7 +757,9 @@ void __mtk_ppe_check_skb(struct mtk_ppe
  40. skb->dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK)
  41. goto out;
  42. - tag += 4;
  43. + if (!skb_metadata_dst(skb))
  44. + tag += 4;
  45. +
  46. if (get_unaligned_be16(tag) != ETH_P_8021Q)
  47. break;