summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/netronome/nfp/bpf/main.h
diff options
context:
space:
mode:
authorJakub Kicinski2018-04-25 06:22:39 +0200
committerDaniel Borkmann2018-04-25 09:56:10 +0200
commit7bdc97be9075c074be0f0aa9c59a8d2238224743 (patch)
tree16281ac7de8247d60c728a93b7db5bc92a1e74ca /drivers/net/ethernet/netronome/nfp/bpf/main.h
parentnfp: bpf: tabularize generations of compare operations (diff)
downloadkernel-qcow2-linux-7bdc97be9075c074be0f0aa9c59a8d2238224743.tar.gz
kernel-qcow2-linux-7bdc97be9075c074be0f0aa9c59a8d2238224743.tar.xz
kernel-qcow2-linux-7bdc97be9075c074be0f0aa9c59a8d2238224743.zip
nfp: bpf: optimize comparisons to negative constants
Comparison instruction requires a subtraction. If the constant is negative we are more likely to fit it into a NFP instruction directly if we change the sign and use addition. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/bpf/main.h')
-rw-r--r--drivers/net/ethernet/netronome/nfp/bpf/main.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.h b/drivers/net/ethernet/netronome/nfp/bpf/main.h
index 4981c8944ca3..68b5d326483d 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/main.h
+++ b/drivers/net/ethernet/netronome/nfp/bpf/main.h
@@ -236,6 +236,7 @@ struct nfp_bpf_reg_state {
* @xadd_over_16bit: 16bit immediate is not guaranteed
* @xadd_maybe_16bit: 16bit immediate is possible
* @jmp_dst: destination info for jump instructions
+ * @jump_neg_op: jump instruction has inverted immediate, use ADD instead of SUB
* @func_id: function id for call instructions
* @arg1: arg1 for call instructions
* @arg2: arg2 for call instructions
@@ -264,7 +265,10 @@ struct nfp_insn_meta {
bool xadd_maybe_16bit;
};
/* jump */
- struct nfp_insn_meta *jmp_dst;
+ struct {
+ struct nfp_insn_meta *jmp_dst;
+ bool jump_neg_op;
+ };
/* function calls */
struct {
u32 func_id;