kernel: 5.4: import wireguard backport
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 080-wireguard-0081-wireguard-socket-mark-skbs-as-not-on-list-when-recei.patch
1 From 6d8e17ad1b4b019c61403a88377e731491de409c Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Thu, 2 Jan 2020 17:47:51 +0100
4 Subject: [PATCH 081/124] wireguard: socket: mark skbs as not on list when
5 receiving via gro
6
7 commit 736775d06bac60d7a353e405398b48b2bd8b1e54 upstream.
8
9 Certain drivers will pass gro skbs to udp, at which point the udp driver
10 simply iterates through them and passes them off to encap_rcv, which is
11 where we pick up. At the moment, we're not attempting to coalesce these
12 into bundles, but we also don't want to wind up having cascaded lists of
13 skbs treated separately. The right behavior here, then, is to just mark
14 each incoming one as not on a list. This can be seen in practice, for
15 example, with Qualcomm's rmnet_perf driver.
16
17 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18 Tested-by: Yaroslav Furman <yaro330@gmail.com>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
20 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
21 ---
22 drivers/net/wireguard/socket.c | 1 +
23 1 file changed, 1 insertion(+)
24
25 --- a/drivers/net/wireguard/socket.c
26 +++ b/drivers/net/wireguard/socket.c
27 @@ -333,6 +333,7 @@ static int wg_receive(struct sock *sk, s
28 wg = sk->sk_user_data;
29 if (unlikely(!wg))
30 goto err;
31 + skb_mark_not_on_list(skb);
32 wg_packet_receive(wg, skb);
33 return 0;
34