diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2011-11-22 07:46:02 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-22 21:27:18 +0100 |
commit | 26bff940dd975499c6c47438d4395d7d215911e8 (patch) | |
tree | 7b6774138e3033d7ab6df080419740083caee2ae /net/xfrm/xfrm_policy.c | |
parent | net: add documentation for net_prio cgroups (v4) (diff) | |
download | linux-26bff940dd975499c6c47438d4395d7d215911e8.tar.xz linux-26bff940dd975499c6c47438d4395d7d215911e8.zip |
xfrm: optimize ipv4 selector matching
Current addr_match() is errh, under-optimized.
Compiler doesn't know that memcmp() branch doesn't trigger for IPv4.
Also, pass addresses by value -- they fit into register.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 552df27dcf53..593c8a1f1440 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -61,8 +61,8 @@ __xfrm4_selector_match(const struct xfrm_selector *sel, const struct flowi *fl) { const struct flowi4 *fl4 = &fl->u.ip4; - return addr_match(&fl4->daddr, &sel->daddr, sel->prefixlen_d) && - addr_match(&fl4->saddr, &sel->saddr, sel->prefixlen_s) && + return addr4_match(fl4->daddr, sel->daddr.a4, sel->prefixlen_d) && + addr4_match(fl4->saddr, sel->saddr.a4, sel->prefixlen_s) && !((xfrm_flowi_dport(fl, &fl4->uli) ^ sel->dport) & sel->dport_mask) && !((xfrm_flowi_sport(fl, &fl4->uli) ^ sel->sport) & sel->sport_mask) && (fl4->flowi4_proto == sel->proto || !sel->proto) && |