kernel: bump 5.4 to 5.4.124
[openwrt/openwrt.git] / target / linux / generic / pending-5.4 / 770-14-net-ethernet-mtk_eth_soc-set-PPE-flow-hash-as-skb-ha.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 13 Sep 2020 08:27:24 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: set PPE flow hash as skb hash
4 if present
5
6 This improves GRO performance
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
12 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
13 @@ -19,6 +19,7 @@
14 #include <linux/interrupt.h>
15 #include <linux/pinctrl/devinfo.h>
16 #include <linux/phylink.h>
17 +#include <linux/jhash.h>
18 #include <net/dsa.h>
19
20 #include "mtk_eth_soc.h"
21 @@ -1267,6 +1268,7 @@ static int mtk_poll_rx(struct napi_struc
22 struct net_device *netdev;
23 unsigned int pktlen;
24 dma_addr_t dma_addr;
25 + u32 hash;
26 int mac;
27
28 ring = mtk_get_rx_ring(eth);
29 @@ -1336,6 +1338,12 @@ static int mtk_poll_rx(struct napi_struc
30 skb->protocol = eth_type_trans(skb, netdev);
31 bytes += pktlen;
32
33 + hash = trxd.rxd4 & GENMASK(13, 0);
34 + if (hash != GENMASK(13, 0)) {
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),