From: Jiri Pirko <jpirko@redhat.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
bhutchings@solarflare.com, shemminger@vyatta.com,
raise.sail@gmail.com, nuno.martins@caixamagica.pt,
matt@ozlabs.org
Subject: [patch net-next 2/4] filter: add XOR operation
Date: Sat, 31 Mar 2012 23:01:20 +0200 [thread overview]
Message-ID: <1333227682-10235-3-git-send-email-jpirko@redhat.com> (raw)
In-Reply-To: <1333227682-10235-1-git-send-email-jpirko@redhat.com>
Add XOR instruction fo BPF machine. Needed for computing packet hashes.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
include/linux/filter.h | 4 +++-
net/core/filter.c | 4 ++++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 92dd993..7209099 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -126,7 +126,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
#define SKF_AD_HATYPE 28
#define SKF_AD_RXHASH 32
#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_LL_OFF (-0x200000)
@@ -231,6 +232,7 @@ enum {
BPF_S_ANC_HATYPE,
BPF_S_ANC_RXHASH,
BPF_S_ANC_CPU,
+ BPF_S_ANC_ALU_XOR_X,
};
#endif /* __KERNEL__ */
diff --git a/net/core/filter.c b/net/core/filter.c
index cfbea88..5099c4b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -315,6 +315,9 @@ load_b:
case BPF_S_ANC_CPU:
A = raw_smp_processor_id();
continue;
+ case BPF_S_ANC_ALU_XOR_X:
+ A ^= X;
+ continue;
case BPF_S_ANC_NLATTR: {
struct nlattr *nla;
@@ -559,6 +562,7 @@ int sk_chk_filter(struct sock_filter *filter, unsigned int flen)
ANCILLARY(HATYPE);
ANCILLARY(RXHASH);
ANCILLARY(CPU);
+ ANCILLARY(ALU_XOR_X);
}
}
ftest->code = code;
--
1.7.9.1
next prev parent reply other threads:[~2012-03-31 21:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-31 21:01 [patch net-next 0/4] Introduce BPF-based TX port selecting for Team device Jiri Pirko
2012-03-31 21:01 ` [patch net-next 1/4] filter: Allow to create sk-unattached filters Jiri Pirko
2012-04-03 22:36 ` David Miller
2012-03-31 21:01 ` Jiri Pirko [this message]
2012-04-03 22:36 ` [patch net-next 2/4] filter: add XOR operation David Miller
2012-03-31 21:01 ` [patch net-next 3/4] team: add binary option type Jiri Pirko
2012-04-03 22:38 ` David Miller
2012-04-04 12:29 ` Jiri Pirko
2012-04-04 21:45 ` David Miller
2012-04-04 22:14 ` Jiri Pirko
2012-03-31 21:01 ` [patch net-next 4/4] team: add loadbalance mode Jiri Pirko
2012-04-03 22:38 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333227682-10235-3-git-send-email-jpirko@redhat.com \
--to=jpirko@redhat.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=matt@ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=nuno.martins@caixamagica.pt \
--cc=raise.sail@gmail.com \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).