* [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap @ 2023-03-03 13:56 Martzki 2023-03-05 17:16 ` Stephen Hemminger 2023-03-06 15:32 ` [PATCH v2] lib/bpf: Rename bpf function names " Martzki 0 siblings, 2 replies; 17+ messages in thread From: Martzki @ 2023-03-03 13:56 UTC (permalink / raw) To: dev; +Cc: Martzki, Konstantin Ananyev The library libpcap has their function 'bpf_validate' either so there would be a multiple definition issue when linking with librte_bpf.a and libpcap.a staticly. You can reproduce this issue by 'meson build -Dprefer_static=true -Denable_apps=test-pmd -Denable_drivers=net/af_xdp,net/af_packet'. Notice you need to have a static version of libpcap to reproduce this. In 2019 there was a patch reported the same issue but not applied: https://inbox.dpdk.org/stable/2601191342CEEE43887BDE71AB9772580148A95BE2@irsmsx105.ger.corp.intel.com/T Since 'bpf_validate' is an internal function, I think adding an 'rte' prefix is not a good idea and rename it to 'bpf_do_validate' instead. Signed-off-by: Martzki <mars14850@gmail.com> --- lib/bpf/bpf_impl.h | 2 +- lib/bpf/bpf_load.c | 2 +- lib/bpf/bpf_validate.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h index b4d8e87c6d..a0a1fbab24 100644 --- a/lib/bpf/bpf_impl.h +++ b/lib/bpf/bpf_impl.h @@ -17,7 +17,7 @@ struct rte_bpf { uint32_t stack_sz; }; -extern int bpf_validate(struct rte_bpf *bpf); +extern int bpf_do_validate(struct rte_bpf *bpf); extern int bpf_jit(struct rte_bpf *bpf); diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c index 1e17df6ce0..b2591d39fa 100644 --- a/lib/bpf/bpf_load.c +++ b/lib/bpf/bpf_load.c @@ -108,7 +108,7 @@ rte_bpf_load(const struct rte_bpf_prm *prm) return NULL; } - rc = bpf_validate(bpf); + rc = bpf_do_validate(bpf); if (rc == 0) { bpf_jit(bpf); if (mprotect(bpf, bpf->sz, PROT_READ) != 0) diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c index 61cbb42216..52defb3337 100644 --- a/lib/bpf/bpf_validate.c +++ b/lib/bpf/bpf_validate.c @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) } int -bpf_validate(struct rte_bpf *bpf) +bpf_do_validate(struct rte_bpf *bpf) { int32_t rc; struct bpf_verifier bvf; -- 2.37.1 (Apple Git-137.1) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap 2023-03-03 13:56 [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap Martzki @ 2023-03-05 17:16 ` Stephen Hemminger 2023-03-05 17:31 ` Stephen Hemminger 2023-03-06 15:32 ` [PATCH v2] lib/bpf: Rename bpf function names " Martzki 1 sibling, 1 reply; 17+ messages in thread From: Stephen Hemminger @ 2023-03-05 17:16 UTC (permalink / raw) To: Martzki; +Cc: dev, Konstantin Ananyev On Fri, 3 Mar 2023 21:56:54 +0800 Martzki <mars14850@gmail.com> wrote: > The library libpcap has their function 'bpf_validate' either so > there would be a multiple definition issue when linking with > librte_bpf.a and libpcap.a staticly. > > You can reproduce this issue by 'meson build -Dprefer_static=true > -Denable_apps=test-pmd -Denable_drivers=net/af_xdp,net/af_packet'. > Notice you need to have a static version of libpcap to reproduce this. > > In 2019 there was a patch reported the same issue but not applied: > https://inbox.dpdk.org/stable/2601191342CEEE43887BDE71AB9772580148A95BE2@irsmsx105.ger.corp.intel.com/T > > Since 'bpf_validate' is an internal function, I think adding an 'rte' > prefix is not a good idea and rename it to 'bpf_do_validate' instead. > > Signed-off-by: Martzki <mars14850@gmail.com> Let's change all the function names here to rte_bpf_XXX. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap 2023-03-05 17:16 ` Stephen Hemminger @ 2023-03-05 17:31 ` Stephen Hemminger 0 siblings, 0 replies; 17+ messages in thread From: Stephen Hemminger @ 2023-03-05 17:31 UTC (permalink / raw) To: Martzki; +Cc: dev, Konstantin Ananyev On Sun, 5 Mar 2023 09:16:55 -0800 Stephen Hemminger <stephen@networkplumber.org> wrote: > On Fri, 3 Mar 2023 21:56:54 +0800 > Martzki <mars14850@gmail.com> wrote: > > > The library libpcap has their function 'bpf_validate' either so > > there would be a multiple definition issue when linking with > > librte_bpf.a and libpcap.a staticly. > > > > You can reproduce this issue by 'meson build -Dprefer_static=true > > -Denable_apps=test-pmd -Denable_drivers=net/af_xdp,net/af_packet'. > > Notice you need to have a static version of libpcap to reproduce this. > > > > In 2019 there was a patch reported the same issue but not applied: > > https://inbox.dpdk.org/stable/2601191342CEEE43887BDE71AB9772580148A95BE2@irsmsx105.ger.corp.intel.com/T > > > > Since 'bpf_validate' is an internal function, I think adding an 'rte' > > prefix is not a good idea and rename it to 'bpf_do_validate' instead. > > > > Signed-off-by: Martzki <mars14850@gmail.com> > > Let's change all the function names here to rte_bpf_XXX. Something like this diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c index 1e1dd42a589f..f218a8f2b049 100644 --- a/lib/bpf/bpf.c +++ b/lib/bpf/bpf.c @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) } int -bpf_jit(struct rte_bpf *bpf) +rte_bpf_jit(struct rte_bpf *bpf) { int32_t rc; #if defined(RTE_ARCH_X86_64) - rc = bpf_jit_x86(bpf); + rc = rte_bpf_jit_x86(bpf); #elif defined(RTE_ARCH_ARM64) - rc = bpf_jit_arm64(bpf); + rc = rte_bpf_jit_arm64(bpf); #else rc = -ENOTSUP; #endif diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c index 9563274c9c6b..d441be66634f 100644 --- a/lib/bpf/bpf_convert.c +++ b/lib/bpf/bpf_convert.c @@ -23,11 +23,8 @@ #include <rte_malloc.h> #include <rte_errno.h> -/* Workaround name conflicts with libpcap */ -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) #include <pcap/pcap.h> #include <pcap/bpf.h> -#undef bpf_validate #include "bpf_impl.h" #include "bpf_def.h" diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h index b4d8e87c6dfb..7fca2db9bef6 100644 --- a/lib/bpf/bpf_impl.h +++ b/lib/bpf/bpf_impl.h @@ -17,12 +17,10 @@ struct rte_bpf { uint32_t stack_sz; }; -extern int bpf_validate(struct rte_bpf *bpf); - -extern int bpf_jit(struct rte_bpf *bpf); - -extern int bpf_jit_x86(struct rte_bpf *); -extern int bpf_jit_arm64(struct rte_bpf *); +extern int rte_bpf_validate(struct rte_bpf *bpf); +extern int rte_bpf_jit(struct rte_bpf *bpf); +extern int rte_bpf_jit_x86(struct rte_bpf *); +extern int rte_bpf_jit_arm64(struct rte_bpf *); extern int rte_bpf_logtype; diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c index c1a30e038660..182004ac7d6c 100644 --- a/lib/bpf/bpf_jit_x86.c +++ b/lib/bpf/bpf_jit_x86.c @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) * produce a native ISA version of the given BPF code. */ int -bpf_jit_x86(struct rte_bpf *bpf) +rte_bpf_jit_x86(struct rte_bpf *bpf) { int32_t rc; uint32_t i; diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c index 1e17df6ce0ab..2c4bca358603 100644 --- a/lib/bpf/bpf_load.c +++ b/lib/bpf/bpf_load.c @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) return NULL; } - rc = bpf_validate(bpf); + rc = rte_bpf_validate(bpf); if (rc == 0) { - bpf_jit(bpf); + rte_bpf_jit(bpf); if (mprotect(bpf, bpf->sz, PROT_READ) != 0) rc = -ENOMEM; } diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c index 61cbb42216b8..2d3d899966b9 100644 --- a/lib/bpf/bpf_validate.c +++ b/lib/bpf/bpf_validate.c @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) } int -bpf_validate(struct rte_bpf *bpf) +rte_bpf_validate(struct rte_bpf *bpf) { int32_t rc; struct bpf_verifier bvf; ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-03 13:56 [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap Martzki 2023-03-05 17:16 ` Stephen Hemminger @ 2023-03-06 15:32 ` Martzki 2023-03-06 15:42 ` [PATCH v3] " Martzki 1 sibling, 1 reply; 17+ messages in thread From: Martzki @ 2023-03-06 15:32 UTC (permalink / raw) To: dev; +Cc: stephen, Martzki, Konstantin Ananyev, Ruifeng Wang Thanks for your review. In this v2 patch I renamed all functions in bpf_impl.h. Signed-off-by: Martzki <mars14850@gmail.com> --- v2: * Rename all functions in bpf_impl.h. * Adjust the commit message. --- lib/bpf/bpf.c | 6 +++--- lib/bpf/bpf_convert.c | 3 --- lib/bpf/bpf_impl.h | 10 ++++------ lib/bpf/bpf_jit_arm64.c | 2 +- lib/bpf/bpf_jit_x86.c | 2 +- lib/bpf/bpf_load.c | 4 ++-- lib/bpf/bpf_validate.c | 2 +- 7 files changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c index 1e1dd42a58..f218a8f2b0 100644 --- a/lib/bpf/bpf.c +++ b/lib/bpf/bpf.c @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) } int -bpf_jit(struct rte_bpf *bpf) +rte_bpf_jit(struct rte_bpf *bpf) { int32_t rc; #if defined(RTE_ARCH_X86_64) - rc = bpf_jit_x86(bpf); + rc = rte_bpf_jit_x86(bpf); #elif defined(RTE_ARCH_ARM64) - rc = bpf_jit_arm64(bpf); + rc = rte_bpf_jit_arm64(bpf); #else rc = -ENOTSUP; #endif diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c index 9563274c9c..d441be6663 100644 --- a/lib/bpf/bpf_convert.c +++ b/lib/bpf/bpf_convert.c @@ -23,11 +23,8 @@ #include <rte_malloc.h> #include <rte_errno.h> -/* Workaround name conflicts with libpcap */ -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) #include <pcap/pcap.h> #include <pcap/bpf.h> -#undef bpf_validate #include "bpf_impl.h" #include "bpf_def.h" diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h index b4d8e87c6d..e955b74181 100644 --- a/lib/bpf/bpf_impl.h +++ b/lib/bpf/bpf_impl.h @@ -17,12 +17,10 @@ struct rte_bpf { uint32_t stack_sz; }; -extern int bpf_validate(struct rte_bpf *bpf); - -extern int bpf_jit(struct rte_bpf *bpf); - -extern int bpf_jit_x86(struct rte_bpf *); -extern int bpf_jit_arm64(struct rte_bpf *); +extern int rte_bpf_validate(struct rte_bpf *bpf); +extern int rte_bpf_jit(struct rte_bpf *bpf); +extern int rte_bpf_jit_x86(struct rte_bpf *bpf); +extern int rte_bpf_jit_arm64(struct rte_bpf *bpf); extern int rte_bpf_logtype; diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c index db79ff7385..d1ab5f8fbf 100644 --- a/lib/bpf/bpf_jit_arm64.c +++ b/lib/bpf/bpf_jit_arm64.c @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) * Produce a native ISA version of the given BPF code. */ int -bpf_jit_arm64(struct rte_bpf *bpf) +rte_bpf_jit_arm64(struct rte_bpf *bpf) { struct a64_jit_ctx ctx; size_t size; diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c index c1a30e0386..182004ac7d 100644 --- a/lib/bpf/bpf_jit_x86.c +++ b/lib/bpf/bpf_jit_x86.c @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) * produce a native ISA version of the given BPF code. */ int -bpf_jit_x86(struct rte_bpf *bpf) +rte_bpf_jit_x86(struct rte_bpf *bpf) { int32_t rc; uint32_t i; diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c index 1e17df6ce0..2c4bca3586 100644 --- a/lib/bpf/bpf_load.c +++ b/lib/bpf/bpf_load.c @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) return NULL; } - rc = bpf_validate(bpf); + rc = rte_bpf_validate(bpf); if (rc == 0) { - bpf_jit(bpf); + rte_bpf_jit(bpf); if (mprotect(bpf, bpf->sz, PROT_READ) != 0) rc = -ENOMEM; } diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c index 61cbb42216..2d3d899966 100644 --- a/lib/bpf/bpf_validate.c +++ b/lib/bpf/bpf_validate.c @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) } int -bpf_validate(struct rte_bpf *bpf) +rte_bpf_validate(struct rte_bpf *bpf) { int32_t rc; struct bpf_verifier bvf; -- 2.37.1 (Apple Git-137.1) ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-06 15:32 ` [PATCH v2] lib/bpf: Rename bpf function names " Martzki @ 2023-03-06 15:42 ` Martzki 2023-03-11 9:18 ` Thomas Monjalon 2023-03-12 6:20 ` [PATCH v4] " J.J. Martzki 0 siblings, 2 replies; 17+ messages in thread From: Martzki @ 2023-03-06 15:42 UTC (permalink / raw) To: dev; +Cc: stephen, Martzki, Konstantin Ananyev, Ruifeng Wang The library libpcap has their function 'bpf_validate' either so there would be a multiple definition issue when linking with librte_bpf.a and libpcap.a statically (Same as http://dpdk.org/patch/52631). So just rename the function names to avoid such issue. Signed-off-by: Martzki <mars14850@gmail.com> --- v3: * Rewrite the commit message. v2: * Rename all functions in bpf_impl.h. * Adjust the commit message. --- lib/bpf/bpf.c | 6 +++--- lib/bpf/bpf_convert.c | 3 --- lib/bpf/bpf_impl.h | 10 ++++------ lib/bpf/bpf_jit_arm64.c | 2 +- lib/bpf/bpf_jit_x86.c | 2 +- lib/bpf/bpf_load.c | 4 ++-- lib/bpf/bpf_validate.c | 2 +- 7 files changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c index 1e1dd42a58..f218a8f2b0 100644 --- a/lib/bpf/bpf.c +++ b/lib/bpf/bpf.c @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) } int -bpf_jit(struct rte_bpf *bpf) +rte_bpf_jit(struct rte_bpf *bpf) { int32_t rc; #if defined(RTE_ARCH_X86_64) - rc = bpf_jit_x86(bpf); + rc = rte_bpf_jit_x86(bpf); #elif defined(RTE_ARCH_ARM64) - rc = bpf_jit_arm64(bpf); + rc = rte_bpf_jit_arm64(bpf); #else rc = -ENOTSUP; #endif diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c index 9563274c9c..d441be6663 100644 --- a/lib/bpf/bpf_convert.c +++ b/lib/bpf/bpf_convert.c @@ -23,11 +23,8 @@ #include <rte_malloc.h> #include <rte_errno.h> -/* Workaround name conflicts with libpcap */ -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) #include <pcap/pcap.h> #include <pcap/bpf.h> -#undef bpf_validate #include "bpf_impl.h" #include "bpf_def.h" diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h index b4d8e87c6d..e955b74181 100644 --- a/lib/bpf/bpf_impl.h +++ b/lib/bpf/bpf_impl.h @@ -17,12 +17,10 @@ struct rte_bpf { uint32_t stack_sz; }; -extern int bpf_validate(struct rte_bpf *bpf); - -extern int bpf_jit(struct rte_bpf *bpf); - -extern int bpf_jit_x86(struct rte_bpf *); -extern int bpf_jit_arm64(struct rte_bpf *); +extern int rte_bpf_validate(struct rte_bpf *bpf); +extern int rte_bpf_jit(struct rte_bpf *bpf); +extern int rte_bpf_jit_x86(struct rte_bpf *bpf); +extern int rte_bpf_jit_arm64(struct rte_bpf *bpf); extern int rte_bpf_logtype; diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c index db79ff7385..d1ab5f8fbf 100644 --- a/lib/bpf/bpf_jit_arm64.c +++ b/lib/bpf/bpf_jit_arm64.c @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) * Produce a native ISA version of the given BPF code. */ int -bpf_jit_arm64(struct rte_bpf *bpf) +rte_bpf_jit_arm64(struct rte_bpf *bpf) { struct a64_jit_ctx ctx; size_t size; diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c index c1a30e0386..182004ac7d 100644 --- a/lib/bpf/bpf_jit_x86.c +++ b/lib/bpf/bpf_jit_x86.c @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) * produce a native ISA version of the given BPF code. */ int -bpf_jit_x86(struct rte_bpf *bpf) +rte_bpf_jit_x86(struct rte_bpf *bpf) { int32_t rc; uint32_t i; diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c index 1e17df6ce0..2c4bca3586 100644 --- a/lib/bpf/bpf_load.c +++ b/lib/bpf/bpf_load.c @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) return NULL; } - rc = bpf_validate(bpf); + rc = rte_bpf_validate(bpf); if (rc == 0) { - bpf_jit(bpf); + rte_bpf_jit(bpf); if (mprotect(bpf, bpf->sz, PROT_READ) != 0) rc = -ENOMEM; } diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c index 61cbb42216..2d3d899966 100644 --- a/lib/bpf/bpf_validate.c +++ b/lib/bpf/bpf_validate.c @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) } int -bpf_validate(struct rte_bpf *bpf) +rte_bpf_validate(struct rte_bpf *bpf) { int32_t rc; struct bpf_verifier bvf; -- 2.37.1 (Apple Git-137.1) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-06 15:42 ` [PATCH v3] " Martzki @ 2023-03-11 9:18 ` Thomas Monjalon 2023-03-12 6:20 ` [PATCH v4] " J.J. Martzki 1 sibling, 0 replies; 17+ messages in thread From: Thomas Monjalon @ 2023-03-11 9:18 UTC (permalink / raw) To: Martzki; +Cc: dev, stephen, Konstantin Ananyev, Ruifeng Wang 06/03/2023 16:42, Martzki: > The library libpcap has their function 'bpf_validate' either so there would > be a multiple definition issue when linking with librte_bpf.a and libpcap.a > statically (Same as http://dpdk.org/patch/52631). So just rename the > function names to avoid such issue. > > Signed-off-by: Martzki <mars14850@gmail.com> Please could you provide you first name and last name? ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-06 15:42 ` [PATCH v3] " Martzki 2023-03-11 9:18 ` Thomas Monjalon @ 2023-03-12 6:20 ` J.J. Martzki 2023-03-12 14:02 ` Konstantin Ananyev 2023-03-14 14:20 ` [PATCH v5] " J.J. Martzki 1 sibling, 2 replies; 17+ messages in thread From: J.J. Martzki @ 2023-03-12 6:20 UTC (permalink / raw) To: dev; +Cc: stephen, thomas, J.J. Martzki, Konstantin Ananyev, Ruifeng Wang The library libpcap has their function 'bpf_validate' either so there would be a multiple definition issue when linking with librte_bpf.a and libpcap.a statically (Same as http://dpdk.org/patch/52631). So just rename the function names to avoid such issue. Signed-off-by: J.J. Martzki <mars14850@gmail.com> --- v4: * Update my name. v3: * Rewrite the commit message. v2: * Rename all functions in bpf_impl.h. * Adjust the commit message. --- lib/bpf/bpf.c | 6 +++--- lib/bpf/bpf_convert.c | 3 --- lib/bpf/bpf_impl.h | 10 ++++------ lib/bpf/bpf_jit_arm64.c | 2 +- lib/bpf/bpf_jit_x86.c | 2 +- lib/bpf/bpf_load.c | 4 ++-- lib/bpf/bpf_validate.c | 2 +- 7 files changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c index 1e1dd42a58..f218a8f2b0 100644 --- a/lib/bpf/bpf.c +++ b/lib/bpf/bpf.c @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) } int -bpf_jit(struct rte_bpf *bpf) +rte_bpf_jit(struct rte_bpf *bpf) { int32_t rc; #if defined(RTE_ARCH_X86_64) - rc = bpf_jit_x86(bpf); + rc = rte_bpf_jit_x86(bpf); #elif defined(RTE_ARCH_ARM64) - rc = bpf_jit_arm64(bpf); + rc = rte_bpf_jit_arm64(bpf); #else rc = -ENOTSUP; #endif diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c index 9563274c9c..d441be6663 100644 --- a/lib/bpf/bpf_convert.c +++ b/lib/bpf/bpf_convert.c @@ -23,11 +23,8 @@ #include <rte_malloc.h> #include <rte_errno.h> -/* Workaround name conflicts with libpcap */ -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) #include <pcap/pcap.h> #include <pcap/bpf.h> -#undef bpf_validate #include "bpf_impl.h" #include "bpf_def.h" diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h index b4d8e87c6d..e955b74181 100644 --- a/lib/bpf/bpf_impl.h +++ b/lib/bpf/bpf_impl.h @@ -17,12 +17,10 @@ struct rte_bpf { uint32_t stack_sz; }; -extern int bpf_validate(struct rte_bpf *bpf); - -extern int bpf_jit(struct rte_bpf *bpf); - -extern int bpf_jit_x86(struct rte_bpf *); -extern int bpf_jit_arm64(struct rte_bpf *); +extern int rte_bpf_validate(struct rte_bpf *bpf); +extern int rte_bpf_jit(struct rte_bpf *bpf); +extern int rte_bpf_jit_x86(struct rte_bpf *bpf); +extern int rte_bpf_jit_arm64(struct rte_bpf *bpf); extern int rte_bpf_logtype; diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c index db79ff7385..d1ab5f8fbf 100644 --- a/lib/bpf/bpf_jit_arm64.c +++ b/lib/bpf/bpf_jit_arm64.c @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) * Produce a native ISA version of the given BPF code. */ int -bpf_jit_arm64(struct rte_bpf *bpf) +rte_bpf_jit_arm64(struct rte_bpf *bpf) { struct a64_jit_ctx ctx; size_t size; diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c index c1a30e0386..182004ac7d 100644 --- a/lib/bpf/bpf_jit_x86.c +++ b/lib/bpf/bpf_jit_x86.c @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) * produce a native ISA version of the given BPF code. */ int -bpf_jit_x86(struct rte_bpf *bpf) +rte_bpf_jit_x86(struct rte_bpf *bpf) { int32_t rc; uint32_t i; diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c index 1e17df6ce0..2c4bca3586 100644 --- a/lib/bpf/bpf_load.c +++ b/lib/bpf/bpf_load.c @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) return NULL; } - rc = bpf_validate(bpf); + rc = rte_bpf_validate(bpf); if (rc == 0) { - bpf_jit(bpf); + rte_bpf_jit(bpf); if (mprotect(bpf, bpf->sz, PROT_READ) != 0) rc = -ENOMEM; } diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c index 61cbb42216..2d3d899966 100644 --- a/lib/bpf/bpf_validate.c +++ b/lib/bpf/bpf_validate.c @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) } int -bpf_validate(struct rte_bpf *bpf) +rte_bpf_validate(struct rte_bpf *bpf) { int32_t rc; struct bpf_verifier bvf; -- 2.37.1 (Apple Git-137.1) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-12 6:20 ` [PATCH v4] " J.J. Martzki @ 2023-03-12 14:02 ` Konstantin Ananyev 2023-03-13 1:50 ` J.J. Mars 2023-03-13 14:55 ` J.J. Martzki 2023-03-14 14:20 ` [PATCH v5] " J.J. Martzki 1 sibling, 2 replies; 17+ messages in thread From: Konstantin Ananyev @ 2023-03-12 14:02 UTC (permalink / raw) To: J.J. Martzki, dev; +Cc: stephen, thomas, Ruifeng Wang 12/03/2023 06:20, J.J. Martzki пишет: > The library libpcap has their function 'bpf_validate' either so there would > be a multiple definition issue when linking with librte_bpf.a and libpcap.a > statically (Same as http://dpdk.org/patch/52631). So just rename the > function names to avoid such issue. > > Signed-off-by: J.J. Martzki <mars14850@gmail.com> > > --- > v4: > * Update my name. > v3: > * Rewrite the commit message. > v2: > * Rename all functions in bpf_impl.h. > * Adjust the commit message. > --- > lib/bpf/bpf.c | 6 +++--- > lib/bpf/bpf_convert.c | 3 --- > lib/bpf/bpf_impl.h | 10 ++++------ > lib/bpf/bpf_jit_arm64.c | 2 +- > lib/bpf/bpf_jit_x86.c | 2 +- > lib/bpf/bpf_load.c | 4 ++-- > lib/bpf/bpf_validate.c | 2 +- > 7 files changed, 12 insertions(+), 17 deletions(-) > > diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c > index 1e1dd42a58..f218a8f2b0 100644 > --- a/lib/bpf/bpf.c > +++ b/lib/bpf/bpf.c > @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) > } > > int > -bpf_jit(struct rte_bpf *bpf) > +rte_bpf_jit(struct rte_bpf *bpf) > { > int32_t rc; > > #if defined(RTE_ARCH_X86_64) > - rc = bpf_jit_x86(bpf); > + rc = rte_bpf_jit_x86(bpf); > #elif defined(RTE_ARCH_ARM64) > - rc = bpf_jit_arm64(bpf); > + rc = rte_bpf_jit_arm64(bpf); > #else > rc = -ENOTSUP; > #endif > diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c > index 9563274c9c..d441be6663 100644 > --- a/lib/bpf/bpf_convert.c > +++ b/lib/bpf/bpf_convert.c > @@ -23,11 +23,8 @@ > #include <rte_malloc.h> > #include <rte_errno.h> > > -/* Workaround name conflicts with libpcap */ > -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) > #include <pcap/pcap.h> > #include <pcap/bpf.h> > -#undef bpf_validate > > #include "bpf_impl.h" > #include "bpf_def.h" > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h > index b4d8e87c6d..e955b74181 100644 > --- a/lib/bpf/bpf_impl.h > +++ b/lib/bpf/bpf_impl.h > @@ -17,12 +17,10 @@ struct rte_bpf { > uint32_t stack_sz; > }; > > -extern int bpf_validate(struct rte_bpf *bpf); > - > -extern int bpf_jit(struct rte_bpf *bpf); > - > -extern int bpf_jit_x86(struct rte_bpf *); > -extern int bpf_jit_arm64(struct rte_bpf *); > +extern int rte_bpf_validate(struct rte_bpf *bpf); > +extern int rte_bpf_jit(struct rte_bpf *bpf); > +extern int rte_bpf_jit_x86(struct rte_bpf *bpf); > +extern int rte_bpf_jit_arm64(struct rte_bpf *bpf); I am still not quite ok to us 'rte_' prefix for internal library functions... Might be at least '_rte_', or '_bpf_'? Another ask - can you put comment here with advise for future add-ons to avoid pure 'bpf_' prefix and why. Konstantin > extern int rte_bpf_logtype; > > diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c > index db79ff7385..d1ab5f8fbf 100644 > --- a/lib/bpf/bpf_jit_arm64.c > +++ b/lib/bpf/bpf_jit_arm64.c > @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) > * Produce a native ISA version of the given BPF code. > */ > int > -bpf_jit_arm64(struct rte_bpf *bpf) > +rte_bpf_jit_arm64(struct rte_bpf *bpf) > { > struct a64_jit_ctx ctx; > size_t size; > diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c > index c1a30e0386..182004ac7d 100644 > --- a/lib/bpf/bpf_jit_x86.c > +++ b/lib/bpf/bpf_jit_x86.c > @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) > * produce a native ISA version of the given BPF code. > */ > int > -bpf_jit_x86(struct rte_bpf *bpf) > +rte_bpf_jit_x86(struct rte_bpf *bpf) > { > int32_t rc; > uint32_t i; > diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c > index 1e17df6ce0..2c4bca3586 100644 > --- a/lib/bpf/bpf_load.c > +++ b/lib/bpf/bpf_load.c > @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) > return NULL; > } > > - rc = bpf_validate(bpf); > + rc = rte_bpf_validate(bpf); > if (rc == 0) { > - bpf_jit(bpf); > + rte_bpf_jit(bpf); > if (mprotect(bpf, bpf->sz, PROT_READ) != 0) > rc = -ENOMEM; > } > diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c > index 61cbb42216..2d3d899966 100644 > --- a/lib/bpf/bpf_validate.c > +++ b/lib/bpf/bpf_validate.c > @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) > } > > int > -bpf_validate(struct rte_bpf *bpf) > +rte_bpf_validate(struct rte_bpf *bpf) > { > int32_t rc; > struct bpf_verifier bvf; ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-12 14:02 ` Konstantin Ananyev @ 2023-03-13 1:50 ` J.J. Mars 2023-03-13 14:55 ` J.J. Martzki 1 sibling, 0 replies; 17+ messages in thread From: J.J. Mars @ 2023-03-13 1:50 UTC (permalink / raw) To: Konstantin Ananyev; +Cc: dev, stephen, thomas, Ruifeng Wang Actually I'm still hesitating about the 'rte_' prefix either. So I'll try a new prefix in the next version, comments will be added together :) Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> 于2023年3月12日周日 22:02写道: > > 12/03/2023 06:20, J.J. Martzki пишет: > > The library libpcap has their function 'bpf_validate' either so there would > > be a multiple definition issue when linking with librte_bpf.a and libpcap.a > > statically (Same as http://dpdk.org/patch/52631). So just rename the > > function names to avoid such issue. > > > > Signed-off-by: J.J. Martzki <mars14850@gmail.com> > > > > --- > > v4: > > * Update my name. > > v3: > > * Rewrite the commit message. > > v2: > > * Rename all functions in bpf_impl.h. > > * Adjust the commit message. > > --- > > lib/bpf/bpf.c | 6 +++--- > > lib/bpf/bpf_convert.c | 3 --- > > lib/bpf/bpf_impl.h | 10 ++++------ > > lib/bpf/bpf_jit_arm64.c | 2 +- > > lib/bpf/bpf_jit_x86.c | 2 +- > > lib/bpf/bpf_load.c | 4 ++-- > > lib/bpf/bpf_validate.c | 2 +- > > 7 files changed, 12 insertions(+), 17 deletions(-) > > > > diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c > > index 1e1dd42a58..f218a8f2b0 100644 > > --- a/lib/bpf/bpf.c > > +++ b/lib/bpf/bpf.c > > @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) > > } > > > > int > > -bpf_jit(struct rte_bpf *bpf) > > +rte_bpf_jit(struct rte_bpf *bpf) > > { > > int32_t rc; > > > > #if defined(RTE_ARCH_X86_64) > > - rc = bpf_jit_x86(bpf); > > + rc = rte_bpf_jit_x86(bpf); > > #elif defined(RTE_ARCH_ARM64) > > - rc = bpf_jit_arm64(bpf); > > + rc = rte_bpf_jit_arm64(bpf); > > #else > > rc = -ENOTSUP; > > #endif > > diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c > > index 9563274c9c..d441be6663 100644 > > --- a/lib/bpf/bpf_convert.c > > +++ b/lib/bpf/bpf_convert.c > > @@ -23,11 +23,8 @@ > > #include <rte_malloc.h> > > #include <rte_errno.h> > > > > -/* Workaround name conflicts with libpcap */ > > -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) > > #include <pcap/pcap.h> > > #include <pcap/bpf.h> > > -#undef bpf_validate > > > > #include "bpf_impl.h" > > #include "bpf_def.h" > > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h > > index b4d8e87c6d..e955b74181 100644 > > --- a/lib/bpf/bpf_impl.h > > +++ b/lib/bpf/bpf_impl.h > > @@ -17,12 +17,10 @@ struct rte_bpf { > > uint32_t stack_sz; > > }; > > > > -extern int bpf_validate(struct rte_bpf *bpf); > > - > > -extern int bpf_jit(struct rte_bpf *bpf); > > - > > -extern int bpf_jit_x86(struct rte_bpf *); > > -extern int bpf_jit_arm64(struct rte_bpf *); > > +extern int rte_bpf_validate(struct rte_bpf *bpf); > > +extern int rte_bpf_jit(struct rte_bpf *bpf); > > +extern int rte_bpf_jit_x86(struct rte_bpf *bpf); > > +extern int rte_bpf_jit_arm64(struct rte_bpf *bpf); > > I am still not quite ok to us 'rte_' prefix for internal library > functions... > Might be at least '_rte_', or '_bpf_'? > Another ask - can you put comment here with advise for future > add-ons to avoid pure 'bpf_' prefix and why. > Konstantin > > > > extern int rte_bpf_logtype; > > > > diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c > > index db79ff7385..d1ab5f8fbf 100644 > > --- a/lib/bpf/bpf_jit_arm64.c > > +++ b/lib/bpf/bpf_jit_arm64.c > > @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) > > * Produce a native ISA version of the given BPF code. > > */ > > int > > -bpf_jit_arm64(struct rte_bpf *bpf) > > +rte_bpf_jit_arm64(struct rte_bpf *bpf) > > { > > struct a64_jit_ctx ctx; > > size_t size; > > diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c > > index c1a30e0386..182004ac7d 100644 > > --- a/lib/bpf/bpf_jit_x86.c > > +++ b/lib/bpf/bpf_jit_x86.c > > @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) > > * produce a native ISA version of the given BPF code. > > */ > > int > > -bpf_jit_x86(struct rte_bpf *bpf) > > +rte_bpf_jit_x86(struct rte_bpf *bpf) > > { > > int32_t rc; > > uint32_t i; > > diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c > > index 1e17df6ce0..2c4bca3586 100644 > > --- a/lib/bpf/bpf_load.c > > +++ b/lib/bpf/bpf_load.c > > @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) > > return NULL; > > } > > > > - rc = bpf_validate(bpf); > > + rc = rte_bpf_validate(bpf); > > if (rc == 0) { > > - bpf_jit(bpf); > > + rte_bpf_jit(bpf); > > if (mprotect(bpf, bpf->sz, PROT_READ) != 0) > > rc = -ENOMEM; > > } > > diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c > > index 61cbb42216..2d3d899966 100644 > > --- a/lib/bpf/bpf_validate.c > > +++ b/lib/bpf/bpf_validate.c > > @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) > > } > > > > int > > -bpf_validate(struct rte_bpf *bpf) > > +rte_bpf_validate(struct rte_bpf *bpf) > > { > > int32_t rc; > > struct bpf_verifier bvf; > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-12 14:02 ` Konstantin Ananyev 2023-03-13 1:50 ` J.J. Mars @ 2023-03-13 14:55 ` J.J. Martzki 2023-03-13 15:54 ` Stephen Hemminger 2023-03-13 17:07 ` Konstantin Ananyev 1 sibling, 2 replies; 17+ messages in thread From: J.J. Martzki @ 2023-03-13 14:55 UTC (permalink / raw) To: Konstantin Ananyev; +Cc: dev, stephen, thomas, Ruifeng Wang I've read the libbpf code again and I found some other functions with pure 'bpf_' prefix. Should we rename all the functions whose names start with pure 'bpf_'? Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> 于2023年3月12日周日 22:02写道: > > 12/03/2023 06:20, J.J. Martzki пишет: > > The library libpcap has their function 'bpf_validate' either so there would > > be a multiple definition issue when linking with librte_bpf.a and libpcap.a > > statically (Same as http://dpdk.org/patch/52631). So just rename the > > function names to avoid such issue. > > > > Signed-off-by: J.J. Martzki <mars14850@gmail.com> > > > > --- > > v4: > > * Update my name. > > v3: > > * Rewrite the commit message. > > v2: > > * Rename all functions in bpf_impl.h. > > * Adjust the commit message. > > --- > > lib/bpf/bpf.c | 6 +++--- > > lib/bpf/bpf_convert.c | 3 --- > > lib/bpf/bpf_impl.h | 10 ++++------ > > lib/bpf/bpf_jit_arm64.c | 2 +- > > lib/bpf/bpf_jit_x86.c | 2 +- > > lib/bpf/bpf_load.c | 4 ++-- > > lib/bpf/bpf_validate.c | 2 +- > > 7 files changed, 12 insertions(+), 17 deletions(-) > > > > diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c > > index 1e1dd42a58..f218a8f2b0 100644 > > --- a/lib/bpf/bpf.c > > +++ b/lib/bpf/bpf.c > > @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) > > } > > > > int > > -bpf_jit(struct rte_bpf *bpf) > > +rte_bpf_jit(struct rte_bpf *bpf) > > { > > int32_t rc; > > > > #if defined(RTE_ARCH_X86_64) > > - rc = bpf_jit_x86(bpf); > > + rc = rte_bpf_jit_x86(bpf); > > #elif defined(RTE_ARCH_ARM64) > > - rc = bpf_jit_arm64(bpf); > > + rc = rte_bpf_jit_arm64(bpf); > > #else > > rc = -ENOTSUP; > > #endif > > diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c > > index 9563274c9c..d441be6663 100644 > > --- a/lib/bpf/bpf_convert.c > > +++ b/lib/bpf/bpf_convert.c > > @@ -23,11 +23,8 @@ > > #include <rte_malloc.h> > > #include <rte_errno.h> > > > > -/* Workaround name conflicts with libpcap */ > > -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) > > #include <pcap/pcap.h> > > #include <pcap/bpf.h> > > -#undef bpf_validate > > > > #include "bpf_impl.h" > > #include "bpf_def.h" > > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h > > index b4d8e87c6d..e955b74181 100644 > > --- a/lib/bpf/bpf_impl.h > > +++ b/lib/bpf/bpf_impl.h > > @@ -17,12 +17,10 @@ struct rte_bpf { > > uint32_t stack_sz; > > }; > > > > -extern int bpf_validate(struct rte_bpf *bpf); > > - > > -extern int bpf_jit(struct rte_bpf *bpf); > > - > > -extern int bpf_jit_x86(struct rte_bpf *); > > -extern int bpf_jit_arm64(struct rte_bpf *); > > +extern int rte_bpf_validate(struct rte_bpf *bpf); > > +extern int rte_bpf_jit(struct rte_bpf *bpf); > > +extern int rte_bpf_jit_x86(struct rte_bpf *bpf); > > +extern int rte_bpf_jit_arm64(struct rte_bpf *bpf); > > I am still not quite ok to us 'rte_' prefix for internal library > functions... > Might be at least '_rte_', or '_bpf_'? > Another ask - can you put comment here with advise for future > add-ons to avoid pure 'bpf_' prefix and why. > Konstantin > > > > extern int rte_bpf_logtype; > > > > diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c > > index db79ff7385..d1ab5f8fbf 100644 > > --- a/lib/bpf/bpf_jit_arm64.c > > +++ b/lib/bpf/bpf_jit_arm64.c > > @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) > > * Produce a native ISA version of the given BPF code. > > */ > > int > > -bpf_jit_arm64(struct rte_bpf *bpf) > > +rte_bpf_jit_arm64(struct rte_bpf *bpf) > > { > > struct a64_jit_ctx ctx; > > size_t size; > > diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c > > index c1a30e0386..182004ac7d 100644 > > --- a/lib/bpf/bpf_jit_x86.c > > +++ b/lib/bpf/bpf_jit_x86.c > > @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) > > * produce a native ISA version of the given BPF code. > > */ > > int > > -bpf_jit_x86(struct rte_bpf *bpf) > > +rte_bpf_jit_x86(struct rte_bpf *bpf) > > { > > int32_t rc; > > uint32_t i; > > diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c > > index 1e17df6ce0..2c4bca3586 100644 > > --- a/lib/bpf/bpf_load.c > > +++ b/lib/bpf/bpf_load.c > > @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) > > return NULL; > > } > > > > - rc = bpf_validate(bpf); > > + rc = rte_bpf_validate(bpf); > > if (rc == 0) { > > - bpf_jit(bpf); > > + rte_bpf_jit(bpf); > > if (mprotect(bpf, bpf->sz, PROT_READ) != 0) > > rc = -ENOMEM; > > } > > diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c > > index 61cbb42216..2d3d899966 100644 > > --- a/lib/bpf/bpf_validate.c > > +++ b/lib/bpf/bpf_validate.c > > @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) > > } > > > > int > > -bpf_validate(struct rte_bpf *bpf) > > +rte_bpf_validate(struct rte_bpf *bpf) > > { > > int32_t rc; > > struct bpf_verifier bvf; > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-13 14:55 ` J.J. Martzki @ 2023-03-13 15:54 ` Stephen Hemminger 2023-03-13 17:07 ` Konstantin Ananyev 1 sibling, 0 replies; 17+ messages in thread From: Stephen Hemminger @ 2023-03-13 15:54 UTC (permalink / raw) To: J.J. Martzki; +Cc: Konstantin Ananyev, dev, thomas, Ruifeng Wang On Mon, 13 Mar 2023 22:55:34 +0800 "J.J. Martzki" <mars14850@gmail.com> wrote: > I've read the libbpf code again and I found some other functions with > pure 'bpf_' prefix. Should we rename all the functions whose names > start with pure 'bpf_'? Yes, all visible (ie non-static) functions should use a DPDK style prefix. ^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-13 14:55 ` J.J. Martzki 2023-03-13 15:54 ` Stephen Hemminger @ 2023-03-13 17:07 ` Konstantin Ananyev 2023-03-13 17:22 ` Stephen Hemminger 1 sibling, 1 reply; 17+ messages in thread From: Konstantin Ananyev @ 2023-03-13 17:07 UTC (permalink / raw) To: J.J. Martzki, Konstantin Ananyev; +Cc: dev, stephen, thomas, Ruifeng Wang > I've read the libbpf code again and I found some other functions with > pure 'bpf_' prefix. Should we rename all the functions whose names > start with pure 'bpf_'? I thought you already prefixed all non-static functions in the lib... Or do I miss something? > Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> 于2023年3月12日周日 22:02写道: > > > > 12/03/2023 06:20, J.J. Martzki пишет: > > > The library libpcap has their function 'bpf_validate' either so there would > > > be a multiple definition issue when linking with librte_bpf.a and libpcap.a > > > statically (Same as http://dpdk.org/patch/52631). So just rename the > > > function names to avoid such issue. > > > > > > Signed-off-by: J.J. Martzki <mars14850@gmail.com> > > > > > > --- > > > v4: > > > * Update my name. > > > v3: > > > * Rewrite the commit message. > > > v2: > > > * Rename all functions in bpf_impl.h. > > > * Adjust the commit message. > > > --- > > > lib/bpf/bpf.c | 6 +++--- > > > lib/bpf/bpf_convert.c | 3 --- > > > lib/bpf/bpf_impl.h | 10 ++++------ > > > lib/bpf/bpf_jit_arm64.c | 2 +- > > > lib/bpf/bpf_jit_x86.c | 2 +- > > > lib/bpf/bpf_load.c | 4 ++-- > > > lib/bpf/bpf_validate.c | 2 +- > > > 7 files changed, 12 insertions(+), 17 deletions(-) > > > > > > diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c > > > index 1e1dd42a58..f218a8f2b0 100644 > > > --- a/lib/bpf/bpf.c > > > +++ b/lib/bpf/bpf.c > > > @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) > > > } > > > > > > int > > > -bpf_jit(struct rte_bpf *bpf) > > > +rte_bpf_jit(struct rte_bpf *bpf) > > > { > > > int32_t rc; > > > > > > #if defined(RTE_ARCH_X86_64) > > > - rc = bpf_jit_x86(bpf); > > > + rc = rte_bpf_jit_x86(bpf); > > > #elif defined(RTE_ARCH_ARM64) > > > - rc = bpf_jit_arm64(bpf); > > > + rc = rte_bpf_jit_arm64(bpf); > > > #else > > > rc = -ENOTSUP; > > > #endif > > > diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c > > > index 9563274c9c..d441be6663 100644 > > > --- a/lib/bpf/bpf_convert.c > > > +++ b/lib/bpf/bpf_convert.c > > > @@ -23,11 +23,8 @@ > > > #include <rte_malloc.h> > > > #include <rte_errno.h> > > > > > > -/* Workaround name conflicts with libpcap */ > > > -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) > > > #include <pcap/pcap.h> > > > #include <pcap/bpf.h> > > > -#undef bpf_validate > > > > > > #include "bpf_impl.h" > > > #include "bpf_def.h" > > > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h > > > index b4d8e87c6d..e955b74181 100644 > > > --- a/lib/bpf/bpf_impl.h > > > +++ b/lib/bpf/bpf_impl.h > > > @@ -17,12 +17,10 @@ struct rte_bpf { > > > uint32_t stack_sz; > > > }; > > > > > > -extern int bpf_validate(struct rte_bpf *bpf); > > > - > > > -extern int bpf_jit(struct rte_bpf *bpf); > > > - > > > -extern int bpf_jit_x86(struct rte_bpf *); > > > -extern int bpf_jit_arm64(struct rte_bpf *); > > > +extern int rte_bpf_validate(struct rte_bpf *bpf); > > > +extern int rte_bpf_jit(struct rte_bpf *bpf); > > > +extern int rte_bpf_jit_x86(struct rte_bpf *bpf); > > > +extern int rte_bpf_jit_arm64(struct rte_bpf *bpf); > > > > I am still not quite ok to us 'rte_' prefix for internal library > > functions... > > Might be at least '_rte_', or '_bpf_'? > > Another ask - can you put comment here with advise for future > > add-ons to avoid pure 'bpf_' prefix and why. > > Konstantin > > > > > > > extern int rte_bpf_logtype; > > > > > > diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c > > > index db79ff7385..d1ab5f8fbf 100644 > > > --- a/lib/bpf/bpf_jit_arm64.c > > > +++ b/lib/bpf/bpf_jit_arm64.c > > > @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) > > > * Produce a native ISA version of the given BPF code. > > > */ > > > int > > > -bpf_jit_arm64(struct rte_bpf *bpf) > > > +rte_bpf_jit_arm64(struct rte_bpf *bpf) > > > { > > > struct a64_jit_ctx ctx; > > > size_t size; > > > diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c > > > index c1a30e0386..182004ac7d 100644 > > > --- a/lib/bpf/bpf_jit_x86.c > > > +++ b/lib/bpf/bpf_jit_x86.c > > > @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) > > > * produce a native ISA version of the given BPF code. > > > */ > > > int > > > -bpf_jit_x86(struct rte_bpf *bpf) > > > +rte_bpf_jit_x86(struct rte_bpf *bpf) > > > { > > > int32_t rc; > > > uint32_t i; > > > diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c > > > index 1e17df6ce0..2c4bca3586 100644 > > > --- a/lib/bpf/bpf_load.c > > > +++ b/lib/bpf/bpf_load.c > > > @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) > > > return NULL; > > > } > > > > > > - rc = bpf_validate(bpf); > > > + rc = rte_bpf_validate(bpf); > > > if (rc == 0) { > > > - bpf_jit(bpf); > > > + rte_bpf_jit(bpf); > > > if (mprotect(bpf, bpf->sz, PROT_READ) != 0) > > > rc = -ENOMEM; > > > } > > > diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c > > > index 61cbb42216..2d3d899966 100644 > > > --- a/lib/bpf/bpf_validate.c > > > +++ b/lib/bpf/bpf_validate.c > > > @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) > > > } > > > > > > int > > > -bpf_validate(struct rte_bpf *bpf) > > > +rte_bpf_validate(struct rte_bpf *bpf) > > > { > > > int32_t rc; > > > struct bpf_verifier bvf; > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-13 17:07 ` Konstantin Ananyev @ 2023-03-13 17:22 ` Stephen Hemminger 2023-03-14 2:21 ` 马尔斯 0 siblings, 1 reply; 17+ messages in thread From: Stephen Hemminger @ 2023-03-13 17:22 UTC (permalink / raw) To: Konstantin Ananyev Cc: J.J. Martzki, Konstantin Ananyev, dev, thomas, Ruifeng Wang On Mon, 13 Mar 2023 17:07:29 +0000 Konstantin Ananyev <konstantin.ananyev@huawei.com> wrote: > > I've read the libbpf code again and I found some other functions with > > pure 'bpf_' prefix. Should we rename all the functions whose names > > start with pure 'bpf_'? > > I thought you already prefixed all non-static functions in the lib... > Or do I miss something? Right, it was bpf_validate, bpf_jit_XXX that were not prefixed. .../build/lib/librte_bpf.a.p $ nm * | grep ' T ' | grep -v 'rte_bpf' 0000000000000070 T bpf_jit 0000000000003210 T bpf_jit_x86 00000000000021f0 T bpf_validate ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-13 17:22 ` Stephen Hemminger @ 2023-03-14 2:21 ` 马尔斯 0 siblings, 0 replies; 17+ messages in thread From: 马尔斯 @ 2023-03-14 2:21 UTC (permalink / raw) To: Stephen Hemminger Cc: Konstantin Ananyev, Konstantin Ananyev, dev, thomas, Ruifeng Wang Ok, that was my mistake. I’ll send the new patch later :) Sent from my iPhone > On Mar 14, 2023, at 01:22, Stephen Hemminger <stephen@networkplumber.org> wrote: > > On Mon, 13 Mar 2023 17:07:29 +0000 > Konstantin Ananyev <konstantin.ananyev@huawei.com> wrote: > >>> I've read the libbpf code again and I found some other functions with >>> pure 'bpf_' prefix. Should we rename all the functions whose names >>> start with pure 'bpf_'? >> >> I thought you already prefixed all non-static functions in the lib... >> Or do I miss something? > > Right, it was bpf_validate, bpf_jit_XXX that were not prefixed. > > .../build/lib/librte_bpf.a.p $ nm * | grep ' T ' | grep -v 'rte_bpf' > 0000000000000070 T bpf_jit > 0000000000003210 T bpf_jit_x86 > 00000000000021f0 T bpf_validate ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v5] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-12 6:20 ` [PATCH v4] " J.J. Martzki 2023-03-12 14:02 ` Konstantin Ananyev @ 2023-03-14 14:20 ` J.J. Martzki 2023-03-16 0:58 ` Konstantin Ananyev 1 sibling, 1 reply; 17+ messages in thread From: J.J. Martzki @ 2023-03-14 14:20 UTC (permalink / raw) To: dev Cc: stephen, thomas, konstantin.ananyev, J.J. Martzki, Konstantin Ananyev, Ruifeng Wang The library libpcap has their function 'bpf_validate' either so there would be a multiple definition issue when linking with librte_bpf.a and libpcap.a statically (Same as http://dpdk.org/patch/52631). So just rename the function names to avoid such issue. Signed-off-by: J.J. Martzki <mars14850@gmail.com> --- v5: * Use '__rte' prefix. * Add annotation for function naming. v4: * Update my name. v3: * Rewrite the commit message. v2: * Rename all functions in bpf_impl.h. * Adjust the commit message. --- lib/bpf/bpf.c | 6 +++--- lib/bpf/bpf_convert.c | 3 --- lib/bpf/bpf_impl.h | 14 ++++++++------ lib/bpf/bpf_jit_arm64.c | 2 +- lib/bpf/bpf_jit_x86.c | 2 +- lib/bpf/bpf_load.c | 4 ++-- lib/bpf/bpf_validate.c | 2 +- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c index 1e1dd42a58..8a0254d8bb 100644 --- a/lib/bpf/bpf.c +++ b/lib/bpf/bpf.c @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) } int -bpf_jit(struct rte_bpf *bpf) +__rte_bpf_jit(struct rte_bpf *bpf) { int32_t rc; #if defined(RTE_ARCH_X86_64) - rc = bpf_jit_x86(bpf); + rc = __rte_bpf_jit_x86(bpf); #elif defined(RTE_ARCH_ARM64) - rc = bpf_jit_arm64(bpf); + rc = __rte_bpf_jit_arm64(bpf); #else rc = -ENOTSUP; #endif diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c index 9563274c9c..d441be6663 100644 --- a/lib/bpf/bpf_convert.c +++ b/lib/bpf/bpf_convert.c @@ -23,11 +23,8 @@ #include <rte_malloc.h> #include <rte_errno.h> -/* Workaround name conflicts with libpcap */ -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) #include <pcap/pcap.h> #include <pcap/bpf.h> -#undef bpf_validate #include "bpf_impl.h" #include "bpf_def.h" diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h index b4d8e87c6d..3e067c1ff4 100644 --- a/lib/bpf/bpf_impl.h +++ b/lib/bpf/bpf_impl.h @@ -17,12 +17,14 @@ struct rte_bpf { uint32_t stack_sz; }; -extern int bpf_validate(struct rte_bpf *bpf); - -extern int bpf_jit(struct rte_bpf *bpf); - -extern int bpf_jit_x86(struct rte_bpf *); -extern int bpf_jit_arm64(struct rte_bpf *); +/* + * Use '__rte' prefix for non-static internal functions + * to avoid potential name conflict with other libraries. + */ +extern int __rte_bpf_validate(struct rte_bpf *bpf); +extern int __rte_bpf_jit(struct rte_bpf *bpf); +extern int __rte_bpf_jit_x86(struct rte_bpf *bpf); +extern int __rte_bpf_jit_arm64(struct rte_bpf *bpf); extern int rte_bpf_logtype; diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c index db79ff7385..f9ddafd7dc 100644 --- a/lib/bpf/bpf_jit_arm64.c +++ b/lib/bpf/bpf_jit_arm64.c @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) * Produce a native ISA version of the given BPF code. */ int -bpf_jit_arm64(struct rte_bpf *bpf) +__rte_bpf_jit_arm64(struct rte_bpf *bpf) { struct a64_jit_ctx ctx; size_t size; diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c index c1a30e0386..a73b2006db 100644 --- a/lib/bpf/bpf_jit_x86.c +++ b/lib/bpf/bpf_jit_x86.c @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) * produce a native ISA version of the given BPF code. */ int -bpf_jit_x86(struct rte_bpf *bpf) +__rte_bpf_jit_x86(struct rte_bpf *bpf) { int32_t rc; uint32_t i; diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c index 1e17df6ce0..45ce9210da 100644 --- a/lib/bpf/bpf_load.c +++ b/lib/bpf/bpf_load.c @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) return NULL; } - rc = bpf_validate(bpf); + rc = __rte_bpf_validate(bpf); if (rc == 0) { - bpf_jit(bpf); + __rte_bpf_jit(bpf); if (mprotect(bpf, bpf->sz, PROT_READ) != 0) rc = -ENOMEM; } diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c index 61cbb42216..119dc4d3aa 100644 --- a/lib/bpf/bpf_validate.c +++ b/lib/bpf/bpf_validate.c @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) } int -bpf_validate(struct rte_bpf *bpf) +__rte_bpf_validate(struct rte_bpf *bpf) { int32_t rc; struct bpf_verifier bvf; -- 2.37.1 (Apple Git-137.1) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-14 14:20 ` [PATCH v5] " J.J. Martzki @ 2023-03-16 0:58 ` Konstantin Ananyev 2023-03-20 11:50 ` Thomas Monjalon 0 siblings, 1 reply; 17+ messages in thread From: Konstantin Ananyev @ 2023-03-16 0:58 UTC (permalink / raw) To: J.J. Martzki, dev; +Cc: stephen, thomas, konstantin.ananyev, Ruifeng Wang 14/03/2023 14:20, J.J. Martzki пишет: > The library libpcap has their function 'bpf_validate' either so there would > be a multiple definition issue when linking with librte_bpf.a and libpcap.a > statically (Same as http://dpdk.org/patch/52631). So just rename the > function names to avoid such issue. > > Signed-off-by: J.J. Martzki <mars14850@gmail.com> > > --- > v5: > * Use '__rte' prefix. > * Add annotation for function naming. > v4: > * Update my name. > v3: > * Rewrite the commit message. > v2: > * Rename all functions in bpf_impl.h. > * Adjust the commit message. > --- > lib/bpf/bpf.c | 6 +++--- > lib/bpf/bpf_convert.c | 3 --- > lib/bpf/bpf_impl.h | 14 ++++++++------ > lib/bpf/bpf_jit_arm64.c | 2 +- > lib/bpf/bpf_jit_x86.c | 2 +- > lib/bpf/bpf_load.c | 4 ++-- > lib/bpf/bpf_validate.c | 2 +- > 7 files changed, 16 insertions(+), 17 deletions(-) > > diff --git a/lib/bpf/bpf.c b/lib/bpf/bpf.c > index 1e1dd42a58..8a0254d8bb 100644 > --- a/lib/bpf/bpf.c > +++ b/lib/bpf/bpf.c > @@ -31,14 +31,14 @@ rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) > } > > int > -bpf_jit(struct rte_bpf *bpf) > +__rte_bpf_jit(struct rte_bpf *bpf) > { > int32_t rc; > > #if defined(RTE_ARCH_X86_64) > - rc = bpf_jit_x86(bpf); > + rc = __rte_bpf_jit_x86(bpf); > #elif defined(RTE_ARCH_ARM64) > - rc = bpf_jit_arm64(bpf); > + rc = __rte_bpf_jit_arm64(bpf); > #else > rc = -ENOTSUP; > #endif > diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c > index 9563274c9c..d441be6663 100644 > --- a/lib/bpf/bpf_convert.c > +++ b/lib/bpf/bpf_convert.c > @@ -23,11 +23,8 @@ > #include <rte_malloc.h> > #include <rte_errno.h> > > -/* Workaround name conflicts with libpcap */ > -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) > #include <pcap/pcap.h> > #include <pcap/bpf.h> > -#undef bpf_validate > > #include "bpf_impl.h" > #include "bpf_def.h" > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h > index b4d8e87c6d..3e067c1ff4 100644 > --- a/lib/bpf/bpf_impl.h > +++ b/lib/bpf/bpf_impl.h > @@ -17,12 +17,14 @@ struct rte_bpf { > uint32_t stack_sz; > }; > > -extern int bpf_validate(struct rte_bpf *bpf); > - > -extern int bpf_jit(struct rte_bpf *bpf); > - > -extern int bpf_jit_x86(struct rte_bpf *); > -extern int bpf_jit_arm64(struct rte_bpf *); > +/* > + * Use '__rte' prefix for non-static internal functions > + * to avoid potential name conflict with other libraries. > + */ > +extern int __rte_bpf_validate(struct rte_bpf *bpf); > +extern int __rte_bpf_jit(struct rte_bpf *bpf); > +extern int __rte_bpf_jit_x86(struct rte_bpf *bpf); > +extern int __rte_bpf_jit_arm64(struct rte_bpf *bpf); > > extern int rte_bpf_logtype; > > diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c > index db79ff7385..f9ddafd7dc 100644 > --- a/lib/bpf/bpf_jit_arm64.c > +++ b/lib/bpf/bpf_jit_arm64.c > @@ -1393,7 +1393,7 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf) > * Produce a native ISA version of the given BPF code. > */ > int > -bpf_jit_arm64(struct rte_bpf *bpf) > +__rte_bpf_jit_arm64(struct rte_bpf *bpf) > { > struct a64_jit_ctx ctx; > size_t size; > diff --git a/lib/bpf/bpf_jit_x86.c b/lib/bpf/bpf_jit_x86.c > index c1a30e0386..a73b2006db 100644 > --- a/lib/bpf/bpf_jit_x86.c > +++ b/lib/bpf/bpf_jit_x86.c > @@ -1490,7 +1490,7 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf) > * produce a native ISA version of the given BPF code. > */ > int > -bpf_jit_x86(struct rte_bpf *bpf) > +__rte_bpf_jit_x86(struct rte_bpf *bpf) > { > int32_t rc; > uint32_t i; > diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c > index 1e17df6ce0..45ce9210da 100644 > --- a/lib/bpf/bpf_load.c > +++ b/lib/bpf/bpf_load.c > @@ -108,9 +108,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm) > return NULL; > } > > - rc = bpf_validate(bpf); > + rc = __rte_bpf_validate(bpf); > if (rc == 0) { > - bpf_jit(bpf); > + __rte_bpf_jit(bpf); > if (mprotect(bpf, bpf->sz, PROT_READ) != 0) > rc = -ENOMEM; > } > diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c > index 61cbb42216..119dc4d3aa 100644 > --- a/lib/bpf/bpf_validate.c > +++ b/lib/bpf/bpf_validate.c > @@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf) > } > > int > -bpf_validate(struct rte_bpf *bpf) > +__rte_bpf_validate(struct rte_bpf *bpf) > { > int32_t rc; > struct bpf_verifier bvf; Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap 2023-03-16 0:58 ` Konstantin Ananyev @ 2023-03-20 11:50 ` Thomas Monjalon 0 siblings, 0 replies; 17+ messages in thread From: Thomas Monjalon @ 2023-03-20 11:50 UTC (permalink / raw) To: J.J. Martzki Cc: dev, stephen, konstantin.ananyev, Ruifeng Wang, Konstantin Ananyev 16/03/2023 01:58, Konstantin Ananyev: > 14/03/2023 14:20, J.J. Martzki пишет: > > The library libpcap has their function 'bpf_validate' either so there would > > be a multiple definition issue when linking with librte_bpf.a and libpcap.a > > statically (Same as http://dpdk.org/patch/52631). So just rename the > > function names to avoid such issue. > > > > Signed-off-by: J.J. Martzki <mars14850@gmail.com> > > Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> Applied, thanks. ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2023-03-20 11:50 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-03-03 13:56 [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap Martzki 2023-03-05 17:16 ` Stephen Hemminger 2023-03-05 17:31 ` Stephen Hemminger 2023-03-06 15:32 ` [PATCH v2] lib/bpf: Rename bpf function names " Martzki 2023-03-06 15:42 ` [PATCH v3] " Martzki 2023-03-11 9:18 ` Thomas Monjalon 2023-03-12 6:20 ` [PATCH v4] " J.J. Martzki 2023-03-12 14:02 ` Konstantin Ananyev 2023-03-13 1:50 ` J.J. Mars 2023-03-13 14:55 ` J.J. Martzki 2023-03-13 15:54 ` Stephen Hemminger 2023-03-13 17:07 ` Konstantin Ananyev 2023-03-13 17:22 ` Stephen Hemminger 2023-03-14 2:21 ` 马尔斯 2023-03-14 14:20 ` [PATCH v5] " J.J. Martzki 2023-03-16 0:58 ` Konstantin Ananyev 2023-03-20 11:50 ` Thomas Monjalon
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).