mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
nfp: bpf: encode indirect commands
Add support for emitting commands with field overwrites. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Jiong Wang <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
This commit is contained in:
parent
3239e7bb28
commit
5468a8b929
2 changed files with 15 additions and 5 deletions
|
|
@ -96,7 +96,7 @@ nfp_prog_offset_to_index(struct nfp_prog *nfp_prog, unsigned int offset)
|
|||
/* --- Emitters --- */
|
||||
static void
|
||||
__emit_cmd(struct nfp_prog *nfp_prog, enum cmd_tgt_map op,
|
||||
u8 mode, u8 xfer, u8 areg, u8 breg, u8 size, bool sync)
|
||||
u8 mode, u8 xfer, u8 areg, u8 breg, u8 size, bool sync, bool indir)
|
||||
{
|
||||
enum cmd_ctx_swap ctx;
|
||||
u64 insn;
|
||||
|
|
@ -114,14 +114,15 @@ __emit_cmd(struct nfp_prog *nfp_prog, enum cmd_tgt_map op,
|
|||
FIELD_PREP(OP_CMD_CNT, size) |
|
||||
FIELD_PREP(OP_CMD_SIG, sync) |
|
||||
FIELD_PREP(OP_CMD_TGT_CMD, cmd_tgt_act[op].tgt_cmd) |
|
||||
FIELD_PREP(OP_CMD_INDIR, indir) |
|
||||
FIELD_PREP(OP_CMD_MODE, mode);
|
||||
|
||||
nfp_prog_push(nfp_prog, insn);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_cmd(struct nfp_prog *nfp_prog, enum cmd_tgt_map op,
|
||||
u8 mode, u8 xfer, swreg lreg, swreg rreg, u8 size, bool sync)
|
||||
emit_cmd_any(struct nfp_prog *nfp_prog, enum cmd_tgt_map op, u8 mode, u8 xfer,
|
||||
swreg lreg, swreg rreg, u8 size, bool sync, bool indir)
|
||||
{
|
||||
struct nfp_insn_re_regs reg;
|
||||
int err;
|
||||
|
|
@ -142,7 +143,15 @@ emit_cmd(struct nfp_prog *nfp_prog, enum cmd_tgt_map op,
|
|||
return;
|
||||
}
|
||||
|
||||
__emit_cmd(nfp_prog, op, mode, xfer, reg.areg, reg.breg, size, sync);
|
||||
__emit_cmd(nfp_prog, op, mode, xfer, reg.areg, reg.breg, size, sync,
|
||||
indir);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_cmd(struct nfp_prog *nfp_prog, enum cmd_tgt_map op, u8 mode, u8 xfer,
|
||||
swreg lreg, swreg rreg, u8 size, bool sync)
|
||||
{
|
||||
emit_cmd_any(nfp_prog, op, mode, xfer, lreg, rreg, size, sync, false);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Netronome Systems, Inc.
|
||||
* Copyright (C) 2016-2017 Netronome Systems, Inc.
|
||||
*
|
||||
* This software is dual licensed under the GNU General License Version 2,
|
||||
* June 1991 as shown in the file COPYING in the top-level directory of this
|
||||
|
|
@ -209,6 +209,7 @@ enum alu_dst_ab {
|
|||
#define OP_CMD_CNT 0x0000e000000ULL
|
||||
#define OP_CMD_SIG 0x000f0000000ULL
|
||||
#define OP_CMD_TGT_CMD 0x07f00000000ULL
|
||||
#define OP_CMD_INDIR 0x20000000000ULL
|
||||
#define OP_CMD_MODE 0x1c0000000000ULL
|
||||
|
||||
struct cmd_tgt_act {
|
||||
|
|
|
|||
Loading…
Reference in a new issue