diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-10-12 10:34:18 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-14 11:13:28 -0700 |
commit | bfddbc8adcd471806f2369d347a958d11e80f53b (patch) | |
tree | 8024166cdbdcea43379ccb67be3f094bd0754c47 | |
parent | e663fe3863ad20c5e6a84a1a1d47aff8e71f583f (diff) |
nfp: bpf: support direct packet access in TC
Add support for direct packet access in TC, note that because
writing the packet will cause the verifier to generate a csum
fixup prologue we won't be able to offload packet writes from
TC, just yet, only the reads will work.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/bpf/jit.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c index 139a4ebdc774..23fb11a41cc4 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c @@ -1135,12 +1135,25 @@ static int data_ind_ld4(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) static int mem_ldx_skb(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta, u8 size) { + swreg dst = reg_both(meta->insn.dst_reg * 2); + switch (meta->insn.off) { case offsetof(struct sk_buff, len): if (size != FIELD_SIZEOF(struct sk_buff, len)) return -EOPNOTSUPP; - wrp_mov(nfp_prog, - reg_both(meta->insn.dst_reg * 2), plen_reg(nfp_prog)); + wrp_mov(nfp_prog, dst, plen_reg(nfp_prog)); + break; + case offsetof(struct sk_buff, data): + if (size != sizeof(void *)) + return -EOPNOTSUPP; + wrp_mov(nfp_prog, dst, pptr_reg(nfp_prog)); + break; + case offsetof(struct sk_buff, cb) + + offsetof(struct bpf_skb_data_end, data_end): + if (size != sizeof(void *)) + return -EOPNOTSUPP; + emit_alu(nfp_prog, dst, + plen_reg(nfp_prog), ALU_OP_ADD, pptr_reg(nfp_prog)); break; default: return -EOPNOTSUPP; |