610-v5.13-50-net-ethernet-mtk_eth_soc-set-PPE-flow-hash-as-skb-ha.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From fa817272c37ef78e25dc14e4760ac78a7043a18a Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <[email protected]>
  3. Date: Thu, 22 Apr 2021 22:21:07 -0700
  4. Subject: [PATCH] net: ethernet: mtk_eth_soc: set PPE flow hash as skb hash if
  5. present
  6. This improves GRO performance
  7. Signed-off-by: Felix Fietkau <[email protected]>
  8. [Ilya: Use MTK_RXD4_FOE_ENTRY instead of GENMASK(13, 0)]
  9. Signed-off-by: Ilya Lipnitskiy <[email protected]>
  10. Signed-off-by: David S. Miller <[email protected]>
  11. ---
  12. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++++++
  13. 1 file changed, 8 insertions(+)
  14. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  15. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  16. @@ -19,6 +19,7 @@
  17. #include <linux/interrupt.h>
  18. #include <linux/pinctrl/devinfo.h>
  19. #include <linux/phylink.h>
  20. +#include <linux/jhash.h>
  21. #include <net/dsa.h>
  22. #include "mtk_eth_soc.h"
  23. @@ -1271,6 +1272,7 @@ static int mtk_poll_rx(struct napi_struc
  24. struct net_device *netdev;
  25. unsigned int pktlen;
  26. dma_addr_t dma_addr;
  27. + u32 hash;
  28. int mac;
  29. ring = mtk_get_rx_ring(eth);
  30. @@ -1340,6 +1342,12 @@ static int mtk_poll_rx(struct napi_struc
  31. skb->protocol = eth_type_trans(skb, netdev);
  32. bytes += pktlen;
  33. + hash = trxd.rxd4 & MTK_RXD4_FOE_ENTRY;
  34. + if (hash != MTK_RXD4_FOE_ENTRY) {
  35. + hash = jhash_1word(hash, 0);
  36. + skb_set_hash(skb, hash, PKT_HASH_TYPE_L4);
  37. + }
  38. +
  39. if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX &&
  40. (trxd.rxd2 & RX_DMA_VTAG))
  41. __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),