diff options
author | Eric Dumazet <edumazet@google.com> | 2012-09-07 22:03:35 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-10 15:44:56 -0400 |
commit | b6069a95706ca5738be3f5d90fd286cbd13ac695 (patch) | |
tree | 8d3d2f11385265b3a0a7d03f07d98752b694ed14 /include/linux/filter.h | |
parent | c6bb8136c95ce16545f8c4028e958c0ee6c86f23 (diff) | |
download | op-kernel-dev-b6069a95706ca5738be3f5d90fd286cbd13ac695.zip op-kernel-dev-b6069a95706ca5738be3f5d90fd286cbd13ac695.tar.gz |
filter: add MOD operation
Add a new ALU opcode, to compute a modulus.
Commit ffe06c17afbbb used an ancillary to implement XOR_X,
but here we reserve one of the available ALU opcode to implement both
MOD_X and MOD_K
Signed-off-by: Eric Dumazet <edumazet@google.com>
Suggested-by: George Bakos <gbakos@alpinista.org>
Cc: Jay Schulist <jschlst@samba.org>
Cc: Jiri Pirko <jpirko@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/filter.h')
-rw-r--r-- | include/linux/filter.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index 82b0135..3cf5fd5 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -74,6 +74,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ #define BPF_LSH 0x60 #define BPF_RSH 0x70 #define BPF_NEG 0x80 +#define BPF_MOD 0x90 + #define BPF_JA 0x00 #define BPF_JEQ 0x10 #define BPF_JGT 0x20 @@ -196,6 +198,8 @@ enum { BPF_S_ALU_MUL_K, BPF_S_ALU_MUL_X, BPF_S_ALU_DIV_X, + BPF_S_ALU_MOD_K, + BPF_S_ALU_MOD_X, BPF_S_ALU_AND_K, BPF_S_ALU_AND_X, BPF_S_ALU_OR_K, |