patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Ciara Loftus <ciara.loftus@intel.com>
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Ferruh Yigit <ferruh.yigit@xilinx.com>,
	dpdk stable <stable@dpdk.org>
Subject: patch 'net/af_xdp: make compatible with libbpf 0.8.0' has been queued to stable release 21.11.6
Date: Thu,  7 Dec 2023 11:21:14 +0000	[thread overview]
Message-ID: <20231207112116.769502-22-ktraynor@redhat.com> (raw)
In-Reply-To: <20231207112116.769502-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to stable release 21.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/12/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/770e7c27240d09571a62627c3bc90b8e6e9f6024

Thanks.

Kevin

---
From 770e7c27240d09571a62627c3bc90b8e6e9f6024 Mon Sep 17 00:00:00 2001
From: Ciara Loftus <ciara.loftus@intel.com>
Date: Thu, 6 Oct 2022 09:26:54 +0300
Subject: [PATCH] net/af_xdp: make compatible with libbpf 0.8.0

[ upstream commit 1eb1846b1a2caaf77d0697747d3ecd1272ce0bfc ]

libbpf v0.8.0 deprecates the bpf_get_link_xdp_id() and
bpf_set_link_xdp_fd() functions. Use meson to detect if
bpf_xdp_attach() is available and if so, use the recommended
replacement functions bpf_xdp_query_id(), bpf_xdp_attach()
and bpf_xdp_detach().

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
 drivers/net/af_xdp/meson.build      |  8 ++++++
 drivers/net/af_xdp/rte_eth_af_xdp.c | 38 ++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
index 1e0de23705..2605086d0c 100644
--- a/drivers/net/af_xdp/meson.build
+++ b/drivers/net/af_xdp/meson.build
@@ -56,2 +56,10 @@ else
     reason = 'missing header, "linux/if_xdp.h"'
 endif
+
+if build
+  if cc.has_function('bpf_xdp_attach',
+                     prefix : '#include <bpf/libbpf.h>',
+                     dependencies : bpf_dep)
+      cflags += ['-DRTE_NET_AF_XDP_LIBBPF_XDP_ATTACH']
+  endif
+endif
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 9918d3c5fd..6bc7178fc5 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -859,7 +859,41 @@ eth_stats_reset(struct rte_eth_dev *dev)
 }
 
+#ifdef RTE_NET_AF_XDP_LIBBPF_XDP_ATTACH
+
+static int link_xdp_prog_with_dev(int ifindex, int fd, __u32 flags)
+{
+	return bpf_xdp_attach(ifindex, fd, flags, NULL);
+}
+
+static int
+remove_xdp_program(struct pmd_internals *internals)
+{
+	uint32_t curr_prog_id = 0;
+	int ret;
+
+	ret = bpf_xdp_query_id(internals->if_index, XDP_FLAGS_UPDATE_IF_NOEXIST,
+			       &curr_prog_id);
+	if (ret != 0) {
+		AF_XDP_LOG(ERR, "bpf_xdp_query_id failed\n");
+		return ret;
+	}
+
+	ret = bpf_xdp_detach(internals->if_index, XDP_FLAGS_UPDATE_IF_NOEXIST,
+			     NULL);
+	if (ret != 0)
+		AF_XDP_LOG(ERR, "bpf_xdp_detach failed\n");
+	return ret;
+}
+
+#else
+
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
+static int link_xdp_prog_with_dev(int ifindex, int fd, __u32 flags)
+{
+	return bpf_set_link_xdp_fd(ifindex, fd, flags);
+}
+
 static void
 remove_xdp_program(struct pmd_internals *internals)
@@ -878,4 +912,6 @@ remove_xdp_program(struct pmd_internals *internals)
 #pragma GCC diagnostic pop
 
+#endif
+
 static void
 xdp_umem_destroy(struct xsk_umem_info *umem)
@@ -1190,5 +1226,5 @@ load_custom_xdp_prog(const char *prog_path, int if_index, struct bpf_map **map)
 
 	/* Link the program with the given network device */
-	ret = bpf_set_link_xdp_fd(if_index, prog_fd,
+	ret = link_xdp_prog_with_dev(if_index, prog_fd,
 					XDP_FLAGS_UPDATE_IF_NOEXIST);
 	if (ret) {
-- 
2.43.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-12-07 11:19:00.123229717 +0000
+++ 0022-net-af_xdp-make-compatible-with-libbpf-0.8.0.patch	2023-12-07 11:18:59.651874009 +0000
@@ -1 +1 @@
-From 1eb1846b1a2caaf77d0697747d3ecd1272ce0bfc Mon Sep 17 00:00:00 2001
+From 770e7c27240d09571a62627c3bc90b8e6e9f6024 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 1eb1846b1a2caaf77d0697747d3ecd1272ce0bfc ]
+
@@ -16,4 +18,3 @@
- doc/guides/rel_notes/release_22_11.rst |  4 +++
- drivers/net/af_xdp/meson.build         |  5 ++++
- drivers/net/af_xdp/rte_eth_af_xdp.c    | 38 +++++++++++++++++++++++++-
- 3 files changed, 46 insertions(+), 1 deletion(-)
+ drivers/net/af_xdp/meson.build      |  8 ++++++
+ drivers/net/af_xdp/rte_eth_af_xdp.c | 38 ++++++++++++++++++++++++++++-
+ 2 files changed, 45 insertions(+), 1 deletion(-)
@@ -21,13 +21,0 @@
-diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
-index 5fbac5cfc1..aef2d622dd 100644
---- a/doc/guides/rel_notes/release_22_11.rst
-+++ b/doc/guides/rel_notes/release_22_11.rst
-@@ -101,4 +101,8 @@ New Features
-   directly to the kernel without software involvement.
- 
-+* **Updated AF_XDP driver.**
-+
-+  * Made compatible with libbpf v0.8.0 (when used with libxdp).
-+
- * **Updated Intel iavf driver.**
- 
@@ -35 +23 @@
-index 9d5ffab96b..858047989e 100644
+index 1e0de23705..2605086d0c 100644
@@ -38,3 +26,5 @@
-@@ -65,3 +65,8 @@ if build
-       cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN']
-   endif
+@@ -56,2 +56,10 @@ else
+     reason = 'missing header, "linux/if_xdp.h"'
+ endif
++
++if build
@@ -46 +36 @@
- endif
++endif
@@ -48 +38 @@
-index f7c2321a18..b6ec9bf490 100644
+index 9918d3c5fd..6bc7178fc5 100644
@@ -51 +41 @@
-@@ -867,4 +867,38 @@ eth_stats_reset(struct rte_eth_dev *dev)
+@@ -859,7 +859,41 @@ eth_stats_reset(struct rte_eth_dev *dev)
@@ -82,0 +73,3 @@
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ 
@@ -88 +81 @@
- static int
+ static void
@@ -90,2 +83,2 @@
-@@ -887,4 +921,6 @@ remove_xdp_program(struct pmd_internals *internals)
- }
+@@ -878,4 +912,6 @@ remove_xdp_program(struct pmd_internals *internals)
+ #pragma GCC diagnostic pop
@@ -97 +90 @@
-@@ -1206,5 +1242,5 @@ load_custom_xdp_prog(const char *prog_path, int if_index, struct bpf_map **map)
+@@ -1190,5 +1226,5 @@ load_custom_xdp_prog(const char *prog_path, int if_index, struct bpf_map **map)


  parent reply	other threads:[~2023-12-07 11:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 11:20 patch 'net/txgbe: fix out of bound access' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: fix hns3 build option about max queue number' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: update features in hns3 guide' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: fix RSS flow description " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: update versions recommendations for i40e and ice' " Kevin Traynor
2023-12-07 11:20 ` patch 'examples/ipsec-secgw: fix partial overflow' " Kevin Traynor
2023-12-07 11:20 ` patch 'eal/windows: fix build with recent MinGW' " Kevin Traynor
2023-12-07 11:21 ` patch 'pdump: fix error number on IPC response' " Kevin Traynor
2023-12-07 11:21 ` patch 'app/dumpcap: allow multiple invocations' " Kevin Traynor
2023-12-07 11:21 ` patch 'examples/ethtool: fix pause configuration' " Kevin Traynor
2023-12-07 11:21 ` patch 'test/hash: fix creation error log' " Kevin Traynor
2023-12-07 11:21 ` patch 'app/pipeline: add sigint handler' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: remove restriction on ixgbe vector support' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: fix some ordered lists' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: remove number of commands in vDPA guide' " Kevin Traynor
2023-12-07 11:21 ` patch 'mempool: fix get function documentation' " Kevin Traynor
2023-12-07 11:21 ` patch 'mempool: clarify enqueue/dequeue ops " Kevin Traynor
2023-12-07 11:21 ` patch 'ethdev: fix ESP packet type description' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix ignored reset event' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix reset event status' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix VF reset handler interruption' " Kevin Traynor
2023-12-07 11:21 ` Kevin Traynor [this message]
2023-12-07 14:16   ` patch 'net/af_xdp: make compatible with libbpf 0.8.0' " Kevin Traynor
2023-12-11 12:44     ` Loftus, Ciara
2023-12-11 15:27       ` Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231207112116.769502-22-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=ciara.loftus@intel.com \
    --cc=ferruh.yigit@xilinx.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).