e8a41d9eb239daf3c7094df04dc363f3290f6613
[openwrt/openwrt.git] / target / linux / mvebu / patches-5.4 / 014-mvneta-driver-disallow-XDP-program-on-hardware-buffe.patch
1 From 79572c98c554dcdb080bca547c871a51716dcdf8 Mon Sep 17 00:00:00 2001
2 From: Sven Auhagen <sven.auhagen@voleatech.de>
3 Date: Sat, 25 Jan 2020 08:07:03 +0000
4 Subject: [PATCH] mvneta driver disallow XDP program on hardware buffer
5 management
6
7 Recently XDP Support was added to the mvneta driver
8 for software buffer management only.
9 It is still possible to attach an XDP program if
10 hardware buffer management is used.
11 It is not doing anything at that point.
12
13 The patch disallows attaching XDP programs to mvneta
14 if hardware buffer management is used.
15
16 I am sorry about that. It is my first submission and I am having
17 some troubles with the format of my emails.
18
19 v4 -> v5:
20 - Remove extra tabs
21
22 v3 -> v4:
23 - Please ignore v3 I accidentally submitted
24 my other patch with git-send-mail and v4 is correct
25
26 v2 -> v3:
27 - My mailserver corrupted the patch
28 resubmission with git-send-email
29
30 v1 -> v2:
31 - Fixing the patches indentation
32
33 Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
34 Signed-off-by: David S. Miller <davem@davemloft.net>
35 ---
36 drivers/net/ethernet/marvell/mvneta.c | 6 ++++++
37 1 file changed, 6 insertions(+)
38
39 --- a/drivers/net/ethernet/marvell/mvneta.c
40 +++ b/drivers/net/ethernet/marvell/mvneta.c
41 @@ -4263,6 +4263,12 @@ static int mvneta_xdp_setup(struct net_d
42 return -EOPNOTSUPP;
43 }
44
45 + if (pp->bm_priv) {
46 + NL_SET_ERR_MSG_MOD(extack,
47 + "Hardware Buffer Management not supported on XDP");
48 + return -EOPNOTSUPP;
49 + }
50 +
51 need_update = !!pp->xdp_prog != !!prog;
52 if (running && need_update)
53 mvneta_stop(dev);