Skip to contentSkip to conversation

ila: Optimization to preserve value of early demux

PATCH Superseded Tom Herbert 4 participants 15 messages Dec 1, 2015 – Dec 9, 2015

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover ila: Optimization to preserve value of early demux

In the current implementation of ILA, LWT is used to perform translation on both the input and output paths. This is functional, however there is a big performance hit in the receive path. Early demux occurs before the routing lookup (a hit actually obviates the route lookup). Therefore the stack currently performs early demux before translation so that a local connection with ILA addresses is never matched. Note that this issue is not just with ILA, but pretty much any translated or encapsulated packet handled by LWT would miss the opportunity for early demux. Solving the general problem seems non trivial since we would need to move the route lookup before early demx thereby mitigating the value.

This patch set addresses the issue for ILA by adding a fast locator lookup that occurs before early demux. This is done by setting iptables rule in PREROUTING. Something like:

ip6tables -t mangle -A PREROUTING --dst 2001:0:0:33::/64 -j ILAIN

For the backend we implement an rhashtable that contains identifier to locator to mappings. The table also allows more specific matches that include original locator and interface.

This patch set:
- Add an rhashtable function to atomically replace and element. This is useful to implement sub-trees from a table entry without needing to use a special anchor structure as the table entry.
- Add a start callback for starting a netlink dump.
- Creates an ila directory under net/ipv6 and moves ila.c to it. ila.c is split into ila_common.c and ila_lwt.c.
- Implement a table to do identifier->locator mapping. This is an rhashtable (in ila_xlat.c).
- Configuration for the table with netlink.
- Add ILAIN and ILAOUT targets which call into the ILA module

Changes from v1:
- Use iptables targets instead of a new xfrm function

Testing:
Running 200 netperf TCP_RR streams

No ILA, baseline
79.26% CPU utilization
1678282 tps
104/189/390 50/90/99% latencies

ILA before fix (LWT on both input and output)
81.91% CPU utilization
1464723 tps (-14.5% from baseline)
121/215/411 50/90/99% latencies

ILA after fix (PREROUTING ILAIN target for input)
80.41% CPU utilization
1577483 tps (-6.3% from baseline)
113/203/393 50/90/99% latencies

Tom Herbert (5):
ila: Create net/ipv6/ila directory
rhashtable: add function to replace an element
netlink: add a start callback for starting a netlink dump
ila: Add generic ILA translation facility
net: ILA iptables target

 include/linux/netlink.h    |   2 +
 include/linux/rhashtable.h |  82 ++++++
 include/net/genetlink.h    |   2 +
 include/net/ila.h          |  18 ++
 include/uapi/linux/ila.h   |  22 ++
 net/ipv6/Makefile          |   2 +-
 net/ipv6/ila.c             | 229 ----------------
 net/ipv6/ila/Makefile      |   7 +
 net/ipv6/ila/ila.h         |  48 ++++
 net/ipv6/ila/ila_common.c  | 103 ++++++++
 net/ipv6/ila/ila_lwt.c     | 152 +++++++++++
 net/ipv6/ila/ila_xlat.c    | 645 +++++++++++++++++++++++++++++++++++++++++++++
 net/netfilter/Kconfig      |  12 +
 net/netfilter/Makefile     |   1 +
 net/netfilter/xt_ILA.c     |  82 ++++++
 net/netlink/af_netlink.c   |   4 +
 net/netlink/genetlink.c    |  16 ++
 17 files changed, 1197 insertions(+), 230 deletions(-)
 create mode 100644 include/net/ila.h
 delete mode 100644 net/ipv6/ila.c
 create mode 100644 net/ipv6/ila/Makefile
 create mode 100644 net/ipv6/ila/ila.h
 create mode 100644 net/ipv6/ila/ila_common.c
 create mode 100644 net/ipv6/ila/ila_lwt.c
 create mode 100644 net/ipv6/ila/ila_xlat.c
 create mode 100644 net/netfilter/xt_ILA.c
Signature · 1 line
2.4.6
#1 lore raw

PATCH v2 1/5 ila: Create net/ipv6/ila directory

Create ila directory in preparation for supporting other hooks in the kernel than LWT for doing ILA. This includes:
- Moving ila.c to ila/ila_lwt.c
- Splitting out some common functions into ila_common.c

---
 net/ipv6/Makefile         |   2 +-
 net/ipv6/ila.c            | 229 ----------------------------------------------
 net/ipv6/ila/Makefile     |   7 ++
 net/ipv6/ila/ila.h        |  46 ++++++++++
 net/ipv6/ila/ila_common.c |  95 +++++++++++++++++++
 net/ipv6/ila/ila_lwt.c    | 152 ++++++++++++++++++++++++++++++
 6 files changed, 301 insertions(+), 230 deletions(-)
 delete mode 100644 net/ipv6/ila.c
 create mode 100644 net/ipv6/ila/Makefile
 create mode 100644 net/ipv6/ila/ila.h
 create mode 100644 net/ipv6/ila/ila_common.c
 create mode 100644 net/ipv6/ila/ila_lwt.c
net/ipv6/Makefile +1 -1
index 2c900c7..2fbd90b 100644
@@ -34,7 +34,7 @@ obj-$(CONFIG_INET6_XFRM_MODE_TUNNEL) += xfrm6_mode_tunnel.o
 obj-$(CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION) += xfrm6_mode_ro.o
 obj-$(CONFIG_INET6_XFRM_MODE_BEET) += xfrm6_mode_beet.o
 obj-$(CONFIG_IPV6_MIP6) += mip6.o
-obj-$(CONFIG_IPV6_ILA) += ila.o
+obj-$(CONFIG_IPV6_ILA) += ila/
 obj-$(CONFIG_NETFILTER)	+= netfilter/
 
 obj-$(CONFIG_IPV6_VTI) += ip6_vti.o
net/ipv6/ila.c deleted +0 -229

229 lines not on this page · raw message

net/ipv6/ila/Makefile new file +7 -0
new file mode 100644
index 0000000..31d136b
@@ -0,0 +1,7 @@
+#
+# Makefile for ILA module
+#
+
+obj-$(CONFIG_IPV6_ILA) += ila.o
+
+ila-objs := ila_common.o ila_lwt.o
net/ipv6/ila/ila.h new file +46 -0

46 lines not on this page · raw message

net/ipv6/ila/ila_common.c new file +95 -0

95 lines not on this page · raw message

net/ipv6/ila/ila_lwt.c new file +152 -0

152 lines not on this page · raw message

Signature · 1 line
2.4.6
#2 lore raw

PATCH v2 2/5 rhashtable: add function to replace an element

In reply to Tom Herbert

Add the rhashtable_replace_fast function. This replaces one object in the table with another atomically. The hashes of the new and old objects must be equal.

---
 include/linux/rhashtable.h | 82 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)
include/linux/rhashtable.h +82 -0
index 843ceca..77deece 100644
@@ -819,4 +819,86 @@ out:
 	return err;
 }
 
+/* Internal function, please use rhashtable_replace_fast() instead */
+static inline int __rhashtable_replace_fast(
+	struct rhashtable *ht, struct bucket_table *tbl,
+	struct rhash_head *obj_old, struct rhash_head *obj_new,
+	const struct rhashtable_params params)
+{
+	struct rhash_head __rcu **pprev;
+	struct rhash_head *he;
+	spinlock_t *lock;
+	unsigned int hash;
+	int err = -ENOENT;
+
+	/* Minimally, the old and new objects must have same hash
+	 * (which should mean identifiers are the same).
+	 */
+	hash = rht_head_hashfn(ht, tbl, obj_old, params);
+	if (hash != rht_head_hashfn(ht, tbl, obj_new, params))
+		return -EINVAL;
+
+	lock = rht_bucket_lock(tbl, hash);
+
+	spin_lock_bh(lock);
+
+	pprev = &tbl->buckets[hash];
+	rht_for_each(he, tbl, hash) {
+		if (he != obj_old) {
+			pprev = &he->next;
+			continue;
+		}
+
+		rcu_assign_pointer(obj_new->next, obj_old->next);
+		rcu_assign_pointer(*pprev, obj_new);
+		err = 0;
+		break;
+	}
+
+	spin_unlock_bh(lock);
+
+	return err;
+}
+
+/**
+ * rhashtable_replace_fast - replace an object in hash table
+ * @ht:		hash table
+ * @obj_old:	pointer to hash head inside object being replaced
+ * @obj_new:	pointer to hash head inside object which is new
+ * @params:	hash table parameters
+ *
+ * Replacing an object doesn't affect the number of elements in the hash table
+ * or bucket, so we don't need to worry about shrinking or expanding the
+ * table here.
+ *
+ * Returns zero on success, -ENOENT if the entry could not be found,
+ * -EINVAL if hash is not the same for the old and new objects.
+ */
+static inline int rhashtable_replace_fast(
+	struct rhashtable *ht, struct rhash_head *obj_old,
+	struct rhash_head *obj_new,
+	const struct rhashtable_params params)
+{
+	struct bucket_table *tbl;
+	int err;
+
+	rcu_read_lock();
+
+	tbl = rht_dereference_rcu(ht->tbl, ht);
+
+	/* Because we have already taken (and released) the bucket
+	 * lock in old_tbl, if we find that future_tbl is not yet
+	 * visible then that guarantees the entry to still be in
+	 * the old tbl if it exists.
+	 */
+	while ((err = __rhashtable_replace_fast(ht, tbl, obj_old,
+						obj_new, params)) &&
+	       (tbl = rht_dereference_rcu(tbl->future_tbl, ht)))
+		;
+
+	rcu_read_unlock();
+
+	return err;
+}
+
 #endif /* _LINUX_RHASHTABLE_H */
Signature · 1 line
2.4.6
maintainer
#3 lore raw

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

From: Tom Herbert <[email protected]>
Date: Tue, 1 Dec 2015 15:11:09 -0800

Quoted 5 lines
include/linux/rhashtable.h +5 -0
+	lock = rht_bucket_lock(tbl, hash);
+
+	spin_lock_bh(lock);
+
+	pprev = &tbl->buckets[hash];

include/linux/rhashtable.h out: · line 855

Quoted 10 lines
include/linux/rhashtable.h +10 -0
+	rht_for_each(he, tbl, hash) {
+		if (he != obj_old) {
+			pprev = &he->next;
+			continue;
+		}
+
+		rcu_assign_pointer(obj_new->next, obj_old->next);
+		rcu_assign_pointer(*pprev, obj_new);
+		err = 0;
+		break;

Are you sure this works fine in the presence of both parallel readers and table expansion passes?

maintainer
#4 lore raw

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

Quoted 13 lines · David Miller

From: Tom Herbert <[email protected]>
Date: Tue, 1 Dec 2015 15:11:09 -0800

Quoted 10 lines
include/linux/rhashtable.h +10 -0
+     lock = rht_bucket_lock(tbl, hash);
+
+     spin_lock_bh(lock);
+
+     pprev = &tbl->buckets[hash];
+     rht_for_each(he, tbl, hash) {
+             if (he != obj_old) {
+                     pprev = &he->next;
+                     continue;
+             }
Quoted 8 lines

include/linux/rhashtable.h out: · line 855

Quoted 5 lines
include/linux/rhashtable.h +5 -0
+
+             rcu_assign_pointer(obj_new->next, obj_old->next);
+             rcu_assign_pointer(*pprev, obj_new);
+             err = 0;
+             break;

Are you sure this works fine in the presence of both parallel readers and table expansion passes?

Good question.

What's more this is something that can be easily implemented outside of rhashtable, i.e., by hashing a pointer to the actual object rather than the object itself. So I'd like to see some pretty good reasons for penny-pinching on memory and adding more complexity to rhashtable.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#5 lore raw

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

Quoted 23 lines · Herbert Xu
Quoted 13 lines · David Miller

From: Tom Herbert <[email protected]>
Date: Tue, 1 Dec 2015 15:11:09 -0800

Quoted 10 lines
include/linux/rhashtable.h +10 -0
+     lock = rht_bucket_lock(tbl, hash);
+
+     spin_lock_bh(lock);
+
+     pprev = &tbl->buckets[hash];
+     rht_for_each(he, tbl, hash) {
+             if (he != obj_old) {
+                     pprev = &he->next;
+                     continue;
+             }
Quoted 8 lines

include/linux/rhashtable.h out: · line 855

Quoted 5 lines
include/linux/rhashtable.h +5 -0
+
+             rcu_assign_pointer(obj_new->next, obj_old->next);
+             rcu_assign_pointer(*pprev, obj_new);
+             err = 0;
+             break;

Are you sure this works fine in the presence of both parallel readers and table expansion passes?

Quoted 7 lines

Good question.

What's more this is something that can be easily implemented outside of rhashtable, i.e., by hashing a pointer to the actual object rather than the object itself. So I'd like to see some pretty good reasons for penny-pinching on memory and adding more complexity to rhashtable.

That creates one more level of indirection. I don't see how add an atomic replace operation adds any complexity to the rhashtable, none of the semantics for rhashtable need to be changed.

Quoted 6 lines

Cheers,
--
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

maintainer
#6 lore raw

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

Quoted 4 lines · Tom Herbert

That creates one more level of indirection. I don't see how add an atomic replace operation adds any complexity to the rhashtable, none of the semantics for rhashtable need to be changed.

OK after thinking about it a little bit more I think your approach is safe and we won't need to play any more games to get this to work. So I'm fine with this patch.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#7 lore raw

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

Quoted 4 lines · Herbert Xu

OK after thinking about it a little bit more I think your approach is safe and we won't need to play any more games to get this to work. So I'm fine with this patch.

One suggestion though: your inline function doesn't actually inline the fast path. The only thing that's inlined is the loop which is not that critical. As this is probably not performance critical how about just making the whole thing out-of-line?

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#8 lore raw

PATCH v2 3/5 netlink: add a start callback for starting a netlink dump

In reply to Tom Herbert

The start callback allows the caller to set up a context for the dump callbacks. Presumably, the context can then be destroyed in the done callback.

---
 include/linux/netlink.h  |  2 ++
 include/net/genetlink.h  |  2 ++
 net/netlink/af_netlink.c |  4 ++++
 net/netlink/genetlink.c  | 16 ++++++++++++++++
 4 files changed, 24 insertions(+)
include/linux/netlink.h +2 -0
index 639e9b8..0b41959 100644
@@ -131,6 +131,7 @@ netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
 struct netlink_callback {
 	struct sk_buff		*skb;
 	const struct nlmsghdr	*nlh;
+	int			(*start)(struct netlink_callback *);
 	int			(*dump)(struct sk_buff * skb,
 					struct netlink_callback *cb);
 	int			(*done)(struct netlink_callback *cb);
@@ -153,6 +154,7 @@ struct nlmsghdr *
 __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags);
 
 struct netlink_dump_control {
+	int (*start)(struct netlink_callback *);
 	int (*dump)(struct sk_buff *skb, struct netlink_callback *);
 	int (*done)(struct netlink_callback *);
 	void *data;
include/net/genetlink.h +2 -0
index 1b6b6dc..43c0e77 100644
@@ -114,6 +114,7 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
  * @flags: flags
  * @policy: attribute validation policy
  * @doit: standard command callback
+ * @start: start callback for dumps
  * @dumpit: callback for dumpers
  * @done: completion callback for dumps
  * @ops_list: operations list
@@ -122,6 +123,7 @@ struct genl_ops {
 	const struct nla_policy	*policy;
 	int		       (*doit)(struct sk_buff *skb,
 				       struct genl_info *info);
+	int		       (*start)(struct netlink_callback *cb);
 	int		       (*dumpit)(struct sk_buff *skb,
 					 struct netlink_callback *cb);
 	int		       (*done)(struct netlink_callback *cb);
net/netlink/af_netlink.c +4 -0
index 59651af..81dc1bb 100644
@@ -2915,6 +2915,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
 
 	cb = &nlk->cb;
 	memset(cb, 0, sizeof(*cb));
+	cb->start = control->start;
 	cb->dump = control->dump;
 	cb->done = control->done;
 	cb->nlh = nlh;
@@ -2927,6 +2928,9 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
 
 	mutex_unlock(nlk->cb_mutex);
 
+	if (cb->start)
+		cb->start(cb);
+
 	ret = netlink_dump(sk);
 	sock_put(sk);
 
net/netlink/genetlink.c +16 -0
index bc0e504..8e63662 100644
@@ -513,6 +513,20 @@ void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
 }
 EXPORT_SYMBOL(genlmsg_put);
 
+static int genl_lock_start(struct netlink_callback *cb)
+{
+	/* our ops are always const - netlink API doesn't propagate that */
+	const struct genl_ops *ops = cb->data;
+	int rc = 0;
+
+	if (ops->start) {
+		genl_lock();
+		rc = ops->start(cb);
+		genl_unlock();
+	}
+	return rc;
+}
+
 static int genl_lock_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
 {
 	/* our ops are always const - netlink API doesn't propagate that */
@@ -577,6 +591,7 @@ static int genl_family_rcv_msg(struct genl_family *family,
 				.module = family->module,
 				/* we have const, but the netlink API doesn't */
 				.data = (void *)ops,
+				.start = genl_lock_start,
 				.dump = genl_lock_dumpit,
 				.done = genl_lock_done,
 			};
@@ -588,6 +603,7 @@ static int genl_family_rcv_msg(struct genl_family *family,
 		} else {
 			struct netlink_dump_control c = {
 				.module = family->module,
+				.start = ops->start,
 				.dump = ops->dumpit,
 				.done = ops->done,
 			};
Signature · 1 line
2.4.6
#9 lore raw

PATCH v2 4/5 ila: Add generic ILA translation facility

In reply to Tom Herbert

This patch implements an ILA tanslation table. This table can be configured with identifier to locator mappings, and can be be queried to resolve a mapping. Queries can be parameterized based on interface, direction (incoming or outoing), and matching locator. The table is implemented using rhashtable and is configured via netlink (through "ip ila .." in iproute).

The table may be used as alternative means to do do ILA tanslations other than the lw tunnels

---
 include/net/ila.h         |  18 ++
 include/uapi/linux/ila.h  |  22 ++
 net/ipv6/ila/Makefile     |   2 +-
 net/ipv6/ila/ila.h        |   2 +
 net/ipv6/ila/ila_common.c |   8 +
 net/ipv6/ila/ila_xlat.c   | 645 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 696 insertions(+), 1 deletion(-)
 create mode 100644 include/net/ila.h
 create mode 100644 net/ipv6/ila/ila_xlat.c
include/net/ila.h new file +18 -0
new file mode 100644
index 0000000..9f4f43e
@@ -0,0 +1,18 @@
+/*
+ * ILA kernel interface
+ *
+ * Copyright (c) 2015 Tom Herbert <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#ifndef _NET_ILA_H
+#define _NET_ILA_H
+
+int ila_xlat_outgoing(struct sk_buff *skb);
+int ila_xlat_incoming(struct sk_buff *skb);
+
+#endif /* _NET_ILA_H */
include/uapi/linux/ila.h +22 -0
index 7ed9e67..abde7bb 100644
@@ -3,13 +3,35 @@
 #ifndef _UAPI_LINUX_ILA_H
 #define _UAPI_LINUX_ILA_H
 
+/* NETLINK_GENERIC related info */
+#define ILA_GENL_NAME		"ila"
+#define ILA_GENL_VERSION	0x1
+
 enum {
 	ILA_ATTR_UNSPEC,
 	ILA_ATTR_LOCATOR,			/* u64 */
+	ILA_ATTR_IDENTIFIER,			/* u64 */
+	ILA_ATTR_LOCATOR_MATCH,			/* u64 */
+	ILA_ATTR_IFINDEX,			/* s32 */
+	ILA_ATTR_DIR,				/* u32 */
 
 	__ILA_ATTR_MAX,
 };
 
 #define ILA_ATTR_MAX		(__ILA_ATTR_MAX - 1)
 
+enum {
+	ILA_CMD_UNSPEC,
+	ILA_CMD_ADD,
+	ILA_CMD_DEL,
+	ILA_CMD_GET,
+
+	__ILA_CMD_MAX,
+};
+
+#define ILA_CMD_MAX	(__ILA_CMD_MAX - 1)
+
+#define ILA_DIR_IN	(1 << 0)
+#define ILA_DIR_OUT	(1 << 1)
+
 #endif /* _UAPI_LINUX_ILA_H */
net/ipv6/ila/Makefile +1 -1
index 31d136b..4b32e59 100644
@@ -4,4 +4,4 @@
 
 obj-$(CONFIG_IPV6_ILA) += ila.o
 
-ila-objs := ila_common.o ila_lwt.o
+ila-objs := ila_common.o ila_lwt.o ila_xlat.o
net/ipv6/ila/ila.h +2 -0
index b94081f..28542cb 100644
@@ -42,5 +42,7 @@ void update_ipv6_locator(struct sk_buff *skb, struct ila_params *p);
 
 int ila_lwt_init(void);
 void ila_lwt_fini(void);
+int ila_xlat_init(void);
+void ila_xlat_fini(void);
 
 #endif /* __ILA_H */
net/ipv6/ila/ila_common.c +8 -0
index 64e1904..32dc9aa 100644
@@ -80,12 +80,20 @@ static int __init ila_init(void)
 	if (ret)
 		goto fail_lwt;
 
+	ret = ila_xlat_init();
+	if (ret)
+		goto fail_xlat;
+
+	return 0;
+fail_xlat:
+	ila_lwt_fini();
 fail_lwt:
 	return ret;
 }
 
 static void __exit ila_fini(void)
 {
+	ila_xlat_fini();
 	ila_lwt_fini();
 }
 
net/ipv6/ila/ila_xlat.c new file +645 -0

645 lines not on this page · raw message

Signature · 1 line
2.4.6
#10 lore raw

Re: [PATCH net-next v2 4/5] ila: Add generic ILA translation facility

url: https://github.com/0day-ci/linux/commits/Tom-Herbert/ila-Optimization-to-preserve-value-of-early-demux/20151202-111601 reproduce:

Hi Tom,

[auto build test WARNING on net-next/master]

url: https://github.com/0day-ci/linux/commits/Tom-Herbert/ila-Optimization-to-preserve-value-of-early-demux/20151202-111601
reproduce:

        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute

>> net/ipv6/ila/ila_xlat.c:218:24: sparse: incompatible types in comparison expression (different address spaces)

net/ipv6/ila/ila_xlat.c:269:32: sparse: incompatible types in comparison expression (different address spaces) net/ipv6/ila/ila_xlat.c:275:25: sparse: incompatible types in comparison expression (different address spaces) net/ipv6/ila/ila_xlat.c:279:25: sparse: incompatible types in comparison expression (different address spaces) net/ipv6/ila/ila_xlat.c:315:31: sparse: incompatible types in comparison expression (different address spaces) net/ipv6/ila/ila_xlat.c:329:32: sparse: incompatible types in comparison expression (different address spaces) net/ipv6/ila/ila_xlat.c:201:23: sparse: incompatible types in comparison expression (different address spaces) net/ipv6/ila/ila_xlat.c:514:31: sparse: incompatible types in comparison expression (different address spaces) net/ipv6/ila/ila_xlat.c:184:23: sparse: incompatible types in comparison expression (different address spaces)

vim +218 net/ipv6/ila/ila_xlat.c

202 }
203
204 return NULL;
205 }
206
207 static inline void ila_release(struct ila_map *ila)
208 {
209 kfree_rcu(ila, rcu);
210 }
211
212 static void ila_free_cb(void *ptr, void *arg)
213 {
214 struct ila_map *ila = (struct ila_map *)ptr, *next;
215
216 /* Assume rcu_readlock held */
217 while (ila) {

 > 218			next = rcu_access_pointer(ila->next);

219 ila_release(ila);
220 ila = next;
221 }
222 }
223
224 static int ila_add_mapping(struct net *net, struct ila_xlat_params *p)
225 {
226 struct ila_net *ilan = net_generic(net, ila_net_id);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#11 lore raw

PATCH v2 5/5 net: ILA iptables target

In reply to Tom Herbert

Add two target ILAIN and ILAOUT which hook into the ILA module.

---
 net/netfilter/Kconfig  | 12 ++++++++
 net/netfilter/Makefile |  1 +
 net/netfilter/xt_ILA.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)
 create mode 100644 net/netfilter/xt_ILA.c
net/netfilter/Kconfig +12 -0
index 4692782..62ae50f 100644
@@ -749,6 +749,18 @@ config NETFILTER_XT_TARGET_IDLETIMER
 
 	  To compile it as a module, choose M here.  If unsure, say N.
 
+config NETFILTER_XT_TARGET_ILA
+	tristate "ILA target support"
+	depends on IP_NF_MANGLE || IP6_NF_MANGLE
+	depends on NETFILTER_ADVANCED
+	depends on IPV6_ILA
+	help
+	  This option adds an `ILA' target, which allow Identifier Locator
+	  Addressing (ILA) translations. The ILA tables are managed by the
+	  ILA module.
+
+	  To compile it as a module, choose M here.  If unsure, say N.
+
 config NETFILTER_XT_TARGET_LED
 	tristate '"LED" target support'
 	depends on LEDS_CLASS && LEDS_TRIGGERS
net/netfilter/Makefile +1 -0
index 7638c36..4fc16aa 100644
@@ -122,6 +122,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP) += xt_TCPOPTSTRIP.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_TEE) += xt_TEE.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_TRACE) += xt_TRACE.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_IDLETIMER) += xt_IDLETIMER.o
+obj-$(CONFIG_NETFILTER_XT_TARGET_ILA) += xt_ILA.o
 
 # matches
 obj-$(CONFIG_NETFILTER_XT_MATCH_ADDRTYPE) += xt_addrtype.o
net/netfilter/xt_ILA.c new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.4.6
maintainer
#12 lore raw
In reply to Tom Herbert

From: Tom Herbert <[email protected]>
Date: Tue, 1 Dec 2015 15:11:07 -0800

Quoted 1 line

ip6tables -t mangle -A PREROUTING --dst 2001:0:0:33::/64 -j ILAIN

The user should have to do anything like this in order to just get proper working functionality of ILA.

It should just work transparently.

#13 lore raw
Quoted 9 lines · David Miller

From: Tom Herbert <[email protected]>
Date: Tue, 1 Dec 2015 15:11:07 -0800

Quoted 1 line

ip6tables -t mangle -A PREROUTING --dst 2001:0:0:33::/64 -j ILAIN

The user should have to do anything like this in order to just get proper working functionality of ILA.

It should just work transparently.

This was transparent in the previously posted patch "ila: Add support for netfilter NF_INET_PRE_ROUTING hook", but there was significant pushback that NF interface was not intended for this purpose. Using an IP tables target like this should preserve the sanctity of the interfaces and does provide nice performance improvement since PREROUTING is done before early demux. The NF_INET_PRE_ROUTING hook is still better performance though and what we are using internally (just an incremental change on top of these patches).

maintainer
#14 lore raw

From: Tom Herbert <[email protected]>
Date: Thu, 3 Dec 2015 11:59:31 -0800

Quoted 11 lines · David Miller
Quoted 9 lines

From: Tom Herbert <[email protected]>
Date: Tue, 1 Dec 2015 15:11:07 -0800

Quoted 1 line

ip6tables -t mangle -A PREROUTING --dst 2001:0:0:33::/64 -j ILAIN

The user should have to do anything like this in order to just get proper working functionality of ILA.

It should just work transparently.

Quoted 8 lines

This was transparent in the previously posted patch "ila: Add support for netfilter NF_INET_PRE_ROUTING hook", but there was significant pushback that NF interface was not intended for this purpose. Using an IP tables target like this should preserve the sanctity of the interfaces and does provide nice performance improvement since PREROUTING is done before early demux. The NF_INET_PRE_ROUTING hook is still better performance though and what we are using internally (just an incremental change on top of these patches).

You want to make a transformation before early demux, which edits the packet.

But someone who configures ILA and just wants reasonable performance shouldn't have to configure anything explicitly outside of the ILA config itself.

So again, those are your operating constraints.