From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 600A341DCD; Mon, 6 Mar 2023 16:32:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44D1E40EDB; Mon, 6 Mar 2023 16:32:32 +0100 (CET) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id C735040A8A for ; Mon, 6 Mar 2023 16:32:31 +0100 (CET) Received: by mail-pj1-f50.google.com with SMTP id h11-20020a17090a2ecb00b00237c740335cso9143409pjs.3 for ; Mon, 06 Mar 2023 07:32:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678116751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6w6Ol3niCZykYYQlLrIWBbx+TRARjSDKX+FSI0bxkAk=; b=bdyVcUHWxecdGSzJ1TBi4j1W9tNf1bmGU0qEzhghjyd3vq8AprhsZnKxVUEOljFlpH mR0j7hjfeo0X0PfnSCEIO785D/k3FzBul3H+xBUHHVIio1xImbQmLW7tcKYNMzaAjP+a QS7TUI3usOXahDbspJKIPIDAagf18YcjBKnGFbXA+8DPXdXIMRGJ3ugMUFr0KWrMkQjc RBu+SFoWK6C1b3toQ9SSjjHUnqbRxoKdaaPi65p0+vkRpp17sYgqlMNWsD2P+M8Zwi/f K1BFePz0atA/niEAZTSTDawS45ABWgsdxN0j07qZgFz272KOd0RvsqJI5ZSOA5KKFhWn t79g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678116751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6w6Ol3niCZykYYQlLrIWBbx+TRARjSDKX+FSI0bxkAk=; b=ES1uaQQtX8OBeZEsSBNa5ndh2mG4cx6pSnglz33ymBg/6/13uukH5JCs3kxRGfCPun QOR3d3mAwAw4d5BohwK2q/o/oyID2q7hUcm2rP32I+cARzW6VNmuJz4Nv1T/udgSu5DK TRC+ZHogaPycV49NGaHUHxWNp3la8v41RVcAxOL/ZsrXAYR/vhC28QcTm1xF0ElTZTKC fAdi+kRpLIS4Rdia2xZTHNALxhHJAFcSfI8epnzcb2Zm88YqqXFSqory2HKG+kST2hoQ XDEufC2EBfeSE3LSP80PzEqON8S/SZlBq6L1iIRz3872m+S3BKB6hluO/q5cn4AkB8eE RlpQ== X-Gm-Message-State: AO0yUKV9eXELvpJc98ZuO2q64KuHWQizzIoP7e0rmGOr83EYDYoCevKJ SH9b/qnlOHGzowG6Sz85d8Uj4fdJdPA3IQ== X-Google-Smtp-Source: AK7set8DV0X8DCaYyHGT388h1ptVFx+KJyujyNOxPg2exRYEFY+iNMUjvbjBorG+4w96qT8P5MT5BQ== X-Received: by 2002:a17:902:ecca:b0:195:e9d4:5380 with SMTP id a10-20020a170902ecca00b00195e9d45380mr14614833plh.56.1678116750796; Mon, 06 Mar 2023 07:32:30 -0800 (PST) Received: from localhost.localdomain ([2409:8a55:316d:eb00:a902:28a8:e8fd:edbe]) by smtp.gmail.com with ESMTPSA id km8-20020a17090327c800b0019e56171eacsm6855394plb.198.2023.03.06.07.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 07:32:30 -0800 (PST) From: Martzki To: dev@dpdk.org Cc: stephen@networkplumber.org, Martzki , Konstantin Ananyev , Ruifeng Wang Subject: [PATCH v2] lib/bpf: Rename bpf function names to avoid potential conflict with libpcap Date: Mon, 6 Mar 2023 23:32:18 +0800 Message-Id: <20230306153218.40320-1-mars14850@gmail.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230303135655.78749-1-mars14850@gmail.com> References: <20230303135655.78749-1-mars14850@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Thanks for your review. In this v2 patch I renamed all functions in bpf_impl.h. Signed-off-by: Martzki --- 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 #include -/* Workaround name conflicts with libpcap */ -#define bpf_validate(f, len) bpf_validate_libpcap(f, len) #include #include -#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)