From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 21A86A0471 for ; Wed, 14 Aug 2019 15:10:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EDEE8375B; Wed, 14 Aug 2019 15:10:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 8E8BBA69 for ; Wed, 14 Aug 2019 15:10:28 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7ED80xc023249; Wed, 14 Aug 2019 06:10:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=IaCDJLIUjIM2MpwIXIUaXGkaOatiUjLSr/mFReEm1n0=; b=rgY6HZkVa1C0ZP8IvkF5BVQhlviIhRds2w9Gxm8ehrLPaJ2RXSTATREs0T9eLNVETK8B 1o1tuNcU+ixJOdMbYtG/PbBWnhUpa06CI1aj/yl7EYghNxKHqLvnzrYRyvy5wddsQdSy xasFJ+MdhkSZVpITVctESljCz84eFntHPcxCj5AS+C9nZKz8XPgwygASYrL5s7nMHXA0 igXyIk/LNGxsut6XCg+UWCcwj5OSzeRnrqMRc57zl/5VMMysFUwjfGPCf/+ENjDmDM4m 0UAKC5rT+QbOGKJ4N+PkeKzBfew9/XMwgFq/sxfZPu0z6MMH2Mh0F0RplMiB6HI4kPeU LQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2ubfabf452-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 14 Aug 2019 06:10:25 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 14 Aug 2019 06:10:20 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 14 Aug 2019 06:10:20 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id C73C73F703F; Wed, 14 Aug 2019 06:10:18 -0700 (PDT) From: To: , Konstantin Ananyev CC: , Jerin Jacob Date: Wed, 14 Aug 2019 18:39:53 +0530 Message-ID: <20190814130953.30853-1-jerinj@marvell.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-08-14_04:2019-08-14,2019-08-14 signatures=0 Subject: [dpdk-dev] [PATCH] bpf: hide internal program arg type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jerin Jacob RTE_BPF_ARG_PTR_STACK is used as internal program arg type. Rename to RTE_BPF_ARG_RESERVED to avoid exposing internal program type. Signed-off-by: Jerin Jacob --- lib/librte_bpf/bpf_validate.c | 12 +++++++----- lib/librte_bpf/rte_bpf.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c index 0cf41fa27..6bd6f78e9 100644 --- a/lib/librte_bpf/bpf_validate.c +++ b/lib/librte_bpf/bpf_validate.c @@ -15,6 +15,8 @@ #include "bpf_impl.h" +#define BPF_ARG_PTR_STACK RTE_BPF_ARG_RESERVED + struct bpf_reg_val { struct rte_bpf_arg v; uint64_t mask; @@ -710,7 +712,7 @@ eval_ptr(struct bpf_verifier *bvf, struct bpf_reg_val *rm, uint32_t opsz, if (rm->u.max % align != 0) return "unaligned memory access"; - if (rm->v.type == RTE_BPF_ARG_PTR_STACK) { + if (rm->v.type == BPF_ARG_PTR_STACK) { if (rm->u.max != rm->u.min || rm->s.max != rm->s.min || rm->u.max != (uint64_t)rm->s.max) @@ -764,7 +766,7 @@ eval_load(struct bpf_verifier *bvf, const struct ebpf_insn *ins) if (err != NULL) return err; - if (rs.v.type == RTE_BPF_ARG_PTR_STACK) { + if (rs.v.type == BPF_ARG_PTR_STACK) { sv = st->sv + rs.u.max / sizeof(uint64_t); if (sv->v.type == RTE_BPF_ARG_UNDEF || sv->mask < msk) @@ -859,7 +861,7 @@ eval_store(struct bpf_verifier *bvf, const struct ebpf_insn *ins) if (err != NULL) return err; - if (rd.v.type == RTE_BPF_ARG_PTR_STACK) { + if (rd.v.type == BPF_ARG_PTR_STACK) { sv = st->sv + rd.u.max / sizeof(uint64_t); if (BPF_CLASS(ins->code) == BPF_STX && @@ -908,7 +910,7 @@ eval_func_arg(struct bpf_verifier *bvf, const struct rte_bpf_arg *arg, * pointer to the variable on the stack is passed * as an argument, mark stack space it occupies as initialized. */ - if (err == NULL && rv->v.type == RTE_BPF_ARG_PTR_STACK) { + if (err == NULL && rv->v.type == BPF_ARG_PTR_STACK) { i = rv->u.max / sizeof(uint64_t); n = i + arg->size / sizeof(uint64_t); @@ -2131,7 +2133,7 @@ evaluate(struct bpf_verifier *bvf) /* initial state of frame pointer */ static const struct bpf_reg_val rvfp = { .v = { - .type = RTE_BPF_ARG_PTR_STACK, + .type = BPF_ARG_PTR_STACK, .size = MAX_BPF_STACK_SIZE, }, .mask = UINT64_MAX, diff --git a/lib/librte_bpf/rte_bpf.h b/lib/librte_bpf/rte_bpf.h index cd4d56dea..cbf1cddac 100644 --- a/lib/librte_bpf/rte_bpf.h +++ b/lib/librte_bpf/rte_bpf.h @@ -32,7 +32,7 @@ enum rte_bpf_arg_type { RTE_BPF_ARG_RAW, /**< scalar value */ RTE_BPF_ARG_PTR = 0x10, /**< pointer to data buffer */ RTE_BPF_ARG_PTR_MBUF, /**< pointer to rte_mbuf */ - RTE_BPF_ARG_PTR_STACK, + RTE_BPF_ARG_RESERVED, /**< reserved for internal use */ }; /** -- 2.22.0