Commit c6606a87 authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next

Steffen Klassert says:

====================
pull request (net-next): ipsec-next 2017-04-11

1) Remove unused field from struct xfrm_mgr.

2) Code size optimizations for the xfrm prefix hash and
   address match.

3) Branch optimization for addr4_match.

All patches from Alexey Dobriyan.

Please pull or let me know if there are problems.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7988ceef 6c786bcb
...@@ -586,7 +586,6 @@ struct xfrm_migrate { ...@@ -586,7 +586,6 @@ struct xfrm_migrate {
struct xfrm_mgr { struct xfrm_mgr {
struct list_head list; struct list_head list;
char *id;
int (*notify)(struct xfrm_state *x, const struct km_event *c); int (*notify)(struct xfrm_state *x, const struct km_event *c);
int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp); int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp);
struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
...@@ -817,12 +816,12 @@ static inline void xfrm_state_hold(struct xfrm_state *x) ...@@ -817,12 +816,12 @@ static inline void xfrm_state_hold(struct xfrm_state *x)
} }
static inline bool addr_match(const void *token1, const void *token2, static inline bool addr_match(const void *token1, const void *token2,
int prefixlen) unsigned int prefixlen)
{ {
const __be32 *a1 = token1; const __be32 *a1 = token1;
const __be32 *a2 = token2; const __be32 *a2 = token2;
int pdw; unsigned int pdw;
int pbi; unsigned int pbi;
pdw = prefixlen >> 5; /* num of whole u32 in prefix */ pdw = prefixlen >> 5; /* num of whole u32 in prefix */
pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */
...@@ -846,9 +845,9 @@ static inline bool addr_match(const void *token1, const void *token2, ...@@ -846,9 +845,9 @@ static inline bool addr_match(const void *token1, const void *token2,
static inline bool addr4_match(__be32 a1, __be32 a2, u8 prefixlen) static inline bool addr4_match(__be32 a1, __be32 a2, u8 prefixlen)
{ {
/* C99 6.5.7 (3): u32 << 32 is undefined behaviour */ /* C99 6.5.7 (3): u32 << 32 is undefined behaviour */
if (prefixlen == 0) if (sizeof(long) == 4 && prefixlen == 0)
return true; return true;
return !((a1 ^ a2) & htonl(0xFFFFFFFFu << (32 - prefixlen))); return !((a1 ^ a2) & htonl(~0UL << (32 - prefixlen)));
} }
static __inline__ static __inline__
......
...@@ -3792,7 +3792,6 @@ static inline void pfkey_exit_proc(struct net *net) ...@@ -3792,7 +3792,6 @@ static inline void pfkey_exit_proc(struct net *net)
static struct xfrm_mgr pfkeyv2_mgr = static struct xfrm_mgr pfkeyv2_mgr =
{ {
.id = "pfkeyv2",
.notify = pfkey_send_notify, .notify = pfkey_send_notify,
.acquire = pfkey_send_acquire, .acquire = pfkey_send_acquire,
.compile_policy = pfkey_compile_policy, .compile_policy = pfkey_compile_policy,
......
...@@ -54,8 +54,8 @@ static inline unsigned int __xfrm4_dpref_spref_hash(const xfrm_address_t *daddr, ...@@ -54,8 +54,8 @@ static inline unsigned int __xfrm4_dpref_spref_hash(const xfrm_address_t *daddr,
static inline unsigned int __xfrm6_pref_hash(const xfrm_address_t *addr, static inline unsigned int __xfrm6_pref_hash(const xfrm_address_t *addr,
__u8 prefixlen) __u8 prefixlen)
{ {
int pdw; unsigned int pdw;
int pbi; unsigned int pbi;
u32 initval = 0; u32 initval = 0;
pdw = prefixlen >> 5; /* num of whole u32 in prefix */ pdw = prefixlen >> 5; /* num of whole u32 in prefix */
......
...@@ -3108,7 +3108,6 @@ static bool xfrm_is_alive(const struct km_event *c) ...@@ -3108,7 +3108,6 @@ static bool xfrm_is_alive(const struct km_event *c)
} }
static struct xfrm_mgr netlink_mgr = { static struct xfrm_mgr netlink_mgr = {
.id = "netlink",
.notify = xfrm_send_state_notify, .notify = xfrm_send_state_notify,
.acquire = xfrm_send_acquire, .acquire = xfrm_send_acquire,
.compile_policy = xfrm_compile_policy, .compile_policy = xfrm_compile_policy,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment