]> git.baikalelectronics.ru Git - kernel.git/commit
nfp: bpf: support arithmetic indirect right shift (BPF_ARSH | BPF_X)
authorJiong Wang <jiong.wang@netronome.com>
Fri, 18 May 2018 19:12:11 +0000 (12:12 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 18 May 2018 19:35:55 +0000 (21:35 +0200)
commitec7ebec778212bd6c73a505d9d7b2bb3236568d9
tree9472d009cd111dc8b5d6a4cc2f0800aa50adb503
parentace79c58b3d45dde3bc7557dc650824144284fa0
nfp: bpf: support arithmetic indirect right shift (BPF_ARSH | BPF_X)

Code logic is similar with arithmetic right shift by constant, and NFP
get indirect shift amount through source A operand of PREV_ALU.

It is possible to fall back to logic right shift if the MSB is known to be
zero from range info, however there is no benefit to do this given logic
indirect right shift use the same number and cycle of instruction sequence.

Suppose the MSB of regX is the bit we want to replicate to fill in all the
vacant positions, and regY contains the shift amount, then we could use
single instruction to set up both.

  [alu, --, regY, OR, regX]

  --
  NOTE: the PREV_ALU result doesn't need to write to any destination
        register.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/bpf/jit.c