dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: <jerinj@marvell.com>
To: <dev@dpdk.org>, Konstantin Ananyev <konstantin.ananyev@intel.com>
Cc: <thomas@monjalon.net>, Jerin Jacob <jerinj@marvell.com>
Subject: [dpdk-dev]  [PATCH] bpf: hide internal program arg type
Date: Wed, 14 Aug 2019 18:39:53 +0530	[thread overview]
Message-ID: <20190814130953.30853-1-jerinj@marvell.com> (raw)

From: Jerin Jacob <jerinj@marvell.com>

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 <jerinj@marvell.com>
---
 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


             reply	other threads:[~2019-08-14 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 13:09 jerinj [this message]
2019-08-16 13:01 ` [dpdk-dev] [PATCH] bpf: hide internal program arg type Ananyev, Konstantin
2019-10-12 12:28   ` Thomas Monjalon

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=20190814130953.30853-1-jerinj@marvell.com \
    --to=jerinj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=thomas@monjalon.net \
    /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).