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 C84C741DCA; Fri, 3 Mar 2023 14:57:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EC3640687; Fri, 3 Mar 2023 14:57:11 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 5BB55400D6 for ; Fri, 3 Mar 2023 14:57:10 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id u3-20020a17090a450300b00239db6d7d47so2315512pjg.4 for ; Fri, 03 Mar 2023 05:57:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677851829; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Rtlr1YD9ZhQx/vrqUtKDM7QVUVr+nH8iRiq2SAlQ+hg=; b=f0gZ2UOpMD8RMJ4N1SbK5B0C8iTYQPxmBDc+SQ1hY+3kpRkPlpvsQxT77wsisxsEC4 rTcnvqdElHZqzxwMsxdOt0CpvGXtct3/ze+IlTaQXwXLffS4Yf7mn4B4dlomtDBYvZ2W T9hiewH2sm0sESsyjMjB3b/n6bCG9LE/PIZ+v7qrpxBNw3EBQ+L0kLPsVCzh0a3rmKJR rwrp2mtC2QED6Lm1cYln9Leig16y/ZewL0UWAWkDcvCoGog1GpEwxE1s/xSwLbCHS3CG GH1pbe83oRG26ENwaHcdIEWkmhJsOV9Zyb/AT7+Xi01V5fwGf40BEK24k6M/DNPPdGTh fUlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677851829; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Rtlr1YD9ZhQx/vrqUtKDM7QVUVr+nH8iRiq2SAlQ+hg=; b=aYfbfjtf57l6S4I95j5LHBBpkC4tIvqBx8gm5wjEs58X0pD+YVAmEs9yXLuPh+/u9T KyXPPMikQd0nnxCZbSnOCVAizDQ4eO5Ruscm9cAw3jz107hjz06cVFBRo5esb9tE85Ue wrK3AgOCsrbmPYwSzGW5T5ql17N4AFQsy9+q7TPYw+5r2muAURpGdHbGIdCMhX0WPcHb xSrwpt15cqFLA2gEKn731oZ3GJdjbHurNGd6srehBgGIV81EkDU4K1s9wSWakyMlqFVJ /RWl+PJWxMimUgO3DiutnfyU90K6nn3WqLPrIWQkiEY5CuZK7f278S35h4dicXxa+x7I xhnw== X-Gm-Message-State: AO0yUKUQi+UjDrAGmddtRUrOlbRC/GgUEETJenEpVgM9fETGE8l5EDRy MHnaa9nuWgJtDGviqeMGn9W0TPgbRoYOSL4p X-Google-Smtp-Source: AK7set/v7gRz703iXCk2IsvvMNXrJJw3X+orPdWv5q264JbwEIFVADUkmlIBwv3ega0I3tAlabcOZQ== X-Received: by 2002:a05:6a20:69a6:b0:c7:8779:416d with SMTP id t38-20020a056a2069a600b000c78779416dmr2503661pzk.58.1677851829386; Fri, 03 Mar 2023 05:57:09 -0800 (PST) Received: from localhost.localdomain ([2409:8a55:316d:eb00:19:548c:ea53:2b8f]) by smtp.gmail.com with ESMTPSA id j8-20020a62b608000000b005a8e9e2f1c5sm1609811pff.187.2023.03.03.05.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 05:57:09 -0800 (PST) From: Martzki To: dev@dpdk.org Cc: Martzki , Konstantin Ananyev Subject: [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap Date: Fri, 3 Mar 2023 21:56:54 +0800 Message-Id: <20230303135655.78749-1-mars14850@gmail.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) 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 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 --- 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)