mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-12 00:00:00 +00:00
filter: add XOR operation
Add XOR instruction fo BPF machine. Needed for computing packet hashes. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
302d663740
commit
ffe06c17af
@ -126,7 +126,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
|
|||||||
#define SKF_AD_HATYPE 28
|
#define SKF_AD_HATYPE 28
|
||||||
#define SKF_AD_RXHASH 32
|
#define SKF_AD_RXHASH 32
|
||||||
#define SKF_AD_CPU 36
|
#define SKF_AD_CPU 36
|
||||||
#define SKF_AD_MAX 40
|
#define SKF_AD_ALU_XOR_X 40
|
||||||
|
#define SKF_AD_MAX 44
|
||||||
#define SKF_NET_OFF (-0x100000)
|
#define SKF_NET_OFF (-0x100000)
|
||||||
#define SKF_LL_OFF (-0x200000)
|
#define SKF_LL_OFF (-0x200000)
|
||||||
|
|
||||||
@ -231,6 +232,7 @@ enum {
|
|||||||
BPF_S_ANC_HATYPE,
|
BPF_S_ANC_HATYPE,
|
||||||
BPF_S_ANC_RXHASH,
|
BPF_S_ANC_RXHASH,
|
||||||
BPF_S_ANC_CPU,
|
BPF_S_ANC_CPU,
|
||||||
|
BPF_S_ANC_ALU_XOR_X,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
@ -315,6 +315,9 @@ load_b:
|
|||||||
case BPF_S_ANC_CPU:
|
case BPF_S_ANC_CPU:
|
||||||
A = raw_smp_processor_id();
|
A = raw_smp_processor_id();
|
||||||
continue;
|
continue;
|
||||||
|
case BPF_S_ANC_ALU_XOR_X:
|
||||||
|
A ^= X;
|
||||||
|
continue;
|
||||||
case BPF_S_ANC_NLATTR: {
|
case BPF_S_ANC_NLATTR: {
|
||||||
struct nlattr *nla;
|
struct nlattr *nla;
|
||||||
|
|
||||||
@ -559,6 +562,7 @@ int sk_chk_filter(struct sock_filter *filter, unsigned int flen)
|
|||||||
ANCILLARY(HATYPE);
|
ANCILLARY(HATYPE);
|
||||||
ANCILLARY(RXHASH);
|
ANCILLARY(RXHASH);
|
||||||
ANCILLARY(CPU);
|
ANCILLARY(CPU);
|
||||||
|
ANCILLARY(ALU_XOR_X);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ftest->code = code;
|
ftest->code = code;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user