aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mvebu/patches-5.4/023-net-mvneta-fix-XDP-support-if-sw-bm-is-used-as-fallb.patch
diff options
context:
space:
mode:
authorJakov Petrina <jakov.petrina@sartura.hr>2020-05-25 14:14:40 +0200
committerLuka Perkov <luka.perkov@sartura.hr>2020-05-28 11:43:13 +0200
commit3dbb658d26062b34e5a540a4477e4a768628c42c (patch)
treeeb3342be7f0e8693c3ae1442668ee4a1ba26b04d /target/linux/mvebu/patches-5.4/023-net-mvneta-fix-XDP-support-if-sw-bm-is-used-as-fallb.patch
parent76f9aa6f4bfd12fba34fc44aef890c48d4fb1024 (diff)
downloadupstream-3dbb658d26062b34e5a540a4477e4a768628c42c.tar.gz
upstream-3dbb658d26062b34e5a540a4477e4a768628c42c.tar.bz2
upstream-3dbb658d26062b34e5a540a4477e4a768628c42c.zip
linux: mvebu: backport mvneta XDP support fixes
This patch backports additional fixes for XDP support in the mvneta driver. These changes are found upstream as commits: b37fa92e20ef2 net: mvneta: fix build skb for bm capable devices f383b2950070c net: mvneta: rely on page_pool_recycle_direct in mvneta_run_xdp 79572c98c554d mvneta driver disallow XDP program on hardware buffer management 44efc78d0e464 net: mvneta: fix XDP support if sw bm is used as fallback Signed-off-by: Jakov Petrina <jakov.petrina@sartura.hr>
Diffstat (limited to 'target/linux/mvebu/patches-5.4/023-net-mvneta-fix-XDP-support-if-sw-bm-is-used-as-fallb.patch')
-rw-r--r--target/linux/mvebu/patches-5.4/023-net-mvneta-fix-XDP-support-if-sw-bm-is-used-as-fallb.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/target/linux/mvebu/patches-5.4/023-net-mvneta-fix-XDP-support-if-sw-bm-is-used-as-fallb.patch b/target/linux/mvebu/patches-5.4/023-net-mvneta-fix-XDP-support-if-sw-bm-is-used-as-fallb.patch
new file mode 100644
index 0000000000..38b874cd49
--- /dev/null
+++ b/target/linux/mvebu/patches-5.4/023-net-mvneta-fix-XDP-support-if-sw-bm-is-used-as-fallb.patch
@@ -0,0 +1,67 @@
+From 44efc78d0e464ce70b45b165c005f8bedc17952e Mon Sep 17 00:00:00 2001
+From: Lorenzo Bianconi <lorenzo@kernel.org>
+Date: Wed, 29 Jan 2020 12:50:53 +0100
+Subject: [PATCH] net: mvneta: fix XDP support if sw bm is used as fallback
+
+In order to fix XDP support if sw buffer management is used as fallback
+for hw bm devices, define MVNETA_SKB_HEADROOM as maximum between
+XDP_PACKET_HEADROOM and NET_SKB_PAD and let the hw aligns the IP header
+to 4-byte boundary.
+Fix rx_offset_correction initialization if mvneta_bm_port_init fails in
+mvneta_resume routine
+
+Fixes: 0db51da7a8e9 ("net: mvneta: add basic XDP support")
+Tested-by: Sven Auhagen <sven.auhagen@voleatech.de>
+Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -324,8 +324,7 @@
+ ETH_HLEN + ETH_FCS_LEN, \
+ cache_line_size())
+
+-#define MVNETA_SKB_HEADROOM (max(XDP_PACKET_HEADROOM, NET_SKB_PAD) + \
+- NET_IP_ALIGN)
++#define MVNETA_SKB_HEADROOM max(XDP_PACKET_HEADROOM, NET_SKB_PAD)
+ #define MVNETA_SKB_PAD (SKB_DATA_ALIGN(sizeof(struct skb_shared_info) + \
+ MVNETA_SKB_HEADROOM))
+ #define MVNETA_SKB_SIZE(len) (SKB_DATA_ALIGN(len) + MVNETA_SKB_PAD)
+@@ -1172,6 +1171,7 @@ bm_mtu_err:
+ mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, 1 << pp->id);
+
+ pp->bm_priv = NULL;
++ pp->rx_offset_correction = MVNETA_SKB_HEADROOM;
+ mvreg_write(pp, MVNETA_ACC_MODE, MVNETA_ACC_MODE_EXT1);
+ netdev_info(pp->dev, "fail to update MTU, fall back to software BM\n");
+ }
+@@ -4954,7 +4954,6 @@ static int mvneta_probe(struct platform_
+ SET_NETDEV_DEV(dev, &pdev->dev);
+
+ pp->id = global_port_id++;
+- pp->rx_offset_correction = MVNETA_SKB_HEADROOM;
+
+ /* Obtain access to BM resources if enabled and already initialized */
+ bm_node = of_parse_phandle(dn, "buffer-manager", 0);
+@@ -4979,6 +4978,10 @@ static int mvneta_probe(struct platform_
+ }
+ of_node_put(bm_node);
+
++ /* sw buffer management */
++ if (!pp->bm_priv)
++ pp->rx_offset_correction = MVNETA_SKB_HEADROOM;
++
+ err = mvneta_init(&pdev->dev, pp);
+ if (err < 0)
+ goto err_netdev;
+@@ -5136,6 +5139,7 @@ static int mvneta_resume(struct device *
+ err = mvneta_bm_port_init(pdev, pp);
+ if (err < 0) {
+ dev_info(&pdev->dev, "use SW buffer management\n");
++ pp->rx_offset_correction = MVNETA_SKB_HEADROOM;
+ pp->bm_priv = NULL;
+ }
+ }