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: Re: 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 14:16:15 +0000	[thread overview]
Message-ID: <968caeb4-3420-4f47-9b9f-42e4c828d01a@redhat.com> (raw)
In-Reply-To: <20231207112116.769502-22-ktraynor@redhat.com>

Hi Ciara,

On 07/12/2023 11:21, Kevin Traynor wrote:
> 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(-)
> 

I saw that af_xdp driver was not building [0] on F38 with the libbpf and 
libxdp packages [1]. Previously I had squashed the deprecation warnings 
but now with newer package versions it seems that is not enough.

The meson.build file has changed a bit from 21.11 to DPDK main, so I 
tried to take the correct part from the above commit and it builds for 
F38 now.

I'm not sure if I missed some case, or there's some other commits that I 
should backport.

Can you have a look and if it's not right, send a patch or tell me which 
patches should be backported ? (you can see the diff and full file on 
the github link above).

thanks,
Kevin.


[0]
[1126/3148] Compiling C object 
drivers/libtmp_rte_net_af_xdp.a.p/net_af_xdp_rte_eth_af_xdp.c.o
../drivers/net/af_xdp/rte_eth_af_xdp.c: In function ‘remove_xdp_program’:
../drivers/net/af_xdp/rte_eth_af_xdp.c:869:13: warning: implicit 
declaration of function ‘bpf_get_link_xdp_id’ 
[-Wimplicit-function-declaration]
   869 |         if (bpf_get_link_xdp_id(internals->if_index, &curr_prog_id,
       |             ^~~~~~~~~~~~~~~~~~~
../drivers/net/af_xdp/rte_eth_af_xdp.c:869:13: warning: nested extern 
declaration of ‘bpf_get_link_xdp_id’ [-Wnested-externs]
../drivers/net/af_xdp/rte_eth_af_xdp.c:874:9: warning: implicit 
declaration of function ‘bpf_set_link_xdp_fd’; did you mean 
‘bpf_link__fd’? [-Wimplicit-function-declaration]
   874 |         bpf_set_link_xdp_fd(internals->if_index, -1,
       |         ^~~~~~~~~~~~~~~~~~~
       |         bpf_link__fd
../drivers/net/af_xdp/rte_eth_af_xdp.c:874:9: warning: nested extern 
declaration of ‘bpf_set_link_xdp_fd’ [-Wnested-externs]


[1]
$ rpm -qa | grep -e libbpf -e libxdp
libbpf-1.1.0-2.fc38.x86_64
libbpf-devel-1.1.0-2.fc38.x86_64
libxdp-1.4.1-1.fc38.x86_64
libxdp-devel-1.4.1-1.fc38.x86_64




> 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) {


  reply	other threads:[~2023-12-07 14: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 ` patch 'net/af_xdp: make compatible with libbpf 0.8.0' " Kevin Traynor
2023-12-07 14:16   ` Kevin Traynor [this message]
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=968caeb4-3420-4f47-9b9f-42e4c828d01a@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).