summaryrefslogtreecommitdiff |
diff options
author | Jiri Slaby <jslaby@suse.cz> | 2019-01-17 12:02:21 +0100 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2019-01-18 15:30:19 +0100 |
commit | 5b23d92fbb823fb61fece2e24e8d6949f743b454 (patch) | |
tree | 2cac5211811439a65c364d0f229b3582ef7e8b22 | |
parent | 864403df63add5fca87f021e078a92051107f8b1 (diff) |
net: thunderx: set xdp_prog to NULL if bpf_prog_add fails
(networking-stable-18_12_03).
-rw-r--r-- | patches.suse/net-thunderx-set-xdp_prog-to-NULL-if-bpf_prog_add-fa.patch | 54 | ||||
-rw-r--r-- | series.conf | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/patches.suse/net-thunderx-set-xdp_prog-to-NULL-if-bpf_prog_add-fa.patch b/patches.suse/net-thunderx-set-xdp_prog-to-NULL-if-bpf_prog_add-fa.patch new file mode 100644 index 0000000000..cc90e14e91 --- /dev/null +++ b/patches.suse/net-thunderx-set-xdp_prog-to-NULL-if-bpf_prog_add-fa.patch @@ -0,0 +1,54 @@ +From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> +Date: Wed, 21 Nov 2018 16:32:10 +0100 +Subject: net: thunderx: set xdp_prog to NULL if bpf_prog_add fails +Git-commit: 6d0f60b0f8588fd4380ea5df9601e12fddd55ce2 +Patch-mainline: v4.20-rc4 +References: networking-stable-18_12_03 + +Set xdp_prog pointer to NULL if bpf_prog_add fails since that routine +reports the error code instead of NULL in case of failure and xdp_prog +pointer value is used in the driver to verify if XDP is currently +enabled. +Moreover report the error code to userspace if nicvf_xdp_setup fails + +Fixes: 05c773f52b96 ("net: thunderx: Add basic XDP support") +Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> +Signed-off-by: David S. Miller <davem@davemloft.net> +Signed-off-by: Jiri Slaby <jslaby@suse.cz> +--- + drivers/net/ethernet/cavium/thunder/nicvf_main.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c ++++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c +@@ -1787,6 +1787,7 @@ static int nicvf_xdp_setup(struct nicvf + bool if_up = netif_running(nic->netdev); + struct bpf_prog *old_prog; + bool bpf_attached = false; ++ int ret = 0; + + /* For now just support only the usual MTU sized frames */ + if (prog && (dev->mtu > 1500)) { +@@ -1820,8 +1821,12 @@ static int nicvf_xdp_setup(struct nicvf + if (nic->xdp_prog) { + /* Attach BPF program */ + nic->xdp_prog = bpf_prog_add(nic->xdp_prog, nic->rx_queues - 1); +- if (!IS_ERR(nic->xdp_prog)) ++ if (!IS_ERR(nic->xdp_prog)) { + bpf_attached = true; ++ } else { ++ ret = PTR_ERR(nic->xdp_prog); ++ nic->xdp_prog = NULL; ++ } + } + + /* Calculate Tx queues needed for XDP and network stack */ +@@ -1833,7 +1838,7 @@ static int nicvf_xdp_setup(struct nicvf + netif_trans_update(nic->netdev); + } + +- return 0; ++ return ret; + } + + static int nicvf_xdp(struct net_device *netdev, struct netdev_xdp *xdp) diff --git a/series.conf b/series.conf index 7792a37748..085b4276e3 100644 --- a/series.conf +++ b/series.conf @@ -19384,6 +19384,7 @@ patches.drivers/iwlwifi-mvm-fix-regulatory-domain-update-when-the-fi.patch patches.drivers/iwlwifi-mvm-don-t-use-SAR-Geo-if-basic-SAR-is-not-us.patch patches.drivers/brcmfmac-fix-reporting-support-for-160-MHz-channels.patch + patches.suse/net-thunderx-set-xdp_prog-to-NULL-if-bpf_prog_add-fa.patch patches.drivers/ibmvnic-Fix-RX-queue-buffer-cleanup.patch patches.drivers/ibmvnic-Update-driver-queues-after-change-in-ring-si.patch patches.fixes/team-no-need-to-do-team_notify_peers-or-team_mcast_r.patch |