All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: alexei.starovoitov@gmail.com, daniel@iogearbox.net
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	Jan Gossens <jan.gossens@rwth-aachen.de>,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH bpf-next 04/14] nfp: bpf: rename map_lookup_stack() to map_call_stack_common()
Date: Wed, 28 Mar 2018 17:48:28 -0700	[thread overview]
Message-ID: <20180329004839.4506-5-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180329004839.4506-1-jakub.kicinski@netronome.com>

We will reuse most of map call code gen for other map calls.
Rename the lookup gen function and use meta->func_id instead
of hard-coding lookup.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jiong Wang <jiong.wang@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/bpf/jit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
index 0701590e8302..b37c9f86a18f 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
@@ -1352,7 +1352,7 @@ static int adjust_head(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
 }
 
 static int
-map_lookup_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
+map_call_stack_common(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
 {
 	struct bpf_offloaded_map *offmap;
 	struct nfp_bpf_map *nfp_map;
@@ -1378,7 +1378,7 @@ map_lookup_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
 	 */
 	tid = ur_load_imm_any(nfp_prog, nfp_map->tid, imm_a(nfp_prog));
 
-	emit_br_relo(nfp_prog, BR_UNC, BR_OFF_RELO + BPF_FUNC_map_lookup_elem,
+	emit_br_relo(nfp_prog, BR_UNC, BR_OFF_RELO + meta->func_id,
 		     2, RELO_BR_HELPER);
 	ret_tgt = nfp_prog_current_offset(nfp_prog) + 2;
 
@@ -2326,7 +2326,7 @@ static int call(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
 	case BPF_FUNC_xdp_adjust_head:
 		return adjust_head(nfp_prog, meta);
 	case BPF_FUNC_map_lookup_elem:
-		return map_lookup_stack(nfp_prog, meta);
+		return map_call_stack_common(nfp_prog, meta);
 	default:
 		WARN_ONCE(1, "verifier allowed unsupported function\n");
 		return -EOPNOTSUPP;
-- 
2.16.2

  parent reply	other threads:[~2018-03-29  0:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29  0:48 [PATCH bpf-next 00/14] nfp: bpf: add updates, deletes, atomic ops, prandom and packet cache Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 01/14] nfp: bpf: read from packet data cache for PTR_TO_PACKET Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 02/14] nfp: bpf: support unaligned read offset Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 03/14] nfp: bpf: detect packet reads could be cached, enable the optimisation Jakub Kicinski
2018-03-29  0:48 ` Jakub Kicinski [this message]
2018-03-29  0:48 ` [PATCH bpf-next 05/14] nfp: bpf: add helper for validating stack pointers Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 06/14] nfp: bpf: add helper for basic map call checks Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 07/14] nfp: bpf: add map updates from the datapath Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 08/14] nfp: bpf: add map deletes " Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 09/14] bpf: add parenthesis around argument of BPF_LDST_BYTES() Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 10/14] nfp: bpf: add basic support for atomic adds Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 11/14] nfp: bpf: expose command delay slots Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 12/14] nfp: bpf: add support for atomic add of unknown values Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 13/14] nfp: bpf: add support for bpf_get_prandom_u32() Jakub Kicinski
2018-03-29  0:48 ` [PATCH bpf-next 14/14] nfp: bpf: improve wrong FW response warnings Jakub Kicinski
2018-03-29  2:45 ` [PATCH bpf-next 00/14] nfp: bpf: add updates, deletes, atomic ops, prandom and packet cache Alexei Starovoitov

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=20180329004839.4506-5-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=jan.gossens@rwth-aachen.de \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.