Commit 7f00feaf authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

ila: Add generic ILA translation facility

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
Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fc9e50f5
/*
* ILA kernel interface
*
* Copyright (c) 2015 Tom Herbert <tom@herbertland.com>
*
* 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 */
...@@ -3,13 +3,35 @@ ...@@ -3,13 +3,35 @@
#ifndef _UAPI_LINUX_ILA_H #ifndef _UAPI_LINUX_ILA_H
#define _UAPI_LINUX_ILA_H #define _UAPI_LINUX_ILA_H
/* NETLINK_GENERIC related info */
#define ILA_GENL_NAME "ila"
#define ILA_GENL_VERSION 0x1
enum { enum {
ILA_ATTR_UNSPEC, ILA_ATTR_UNSPEC,
ILA_ATTR_LOCATOR, /* u64 */ ILA_ATTR_LOCATOR, /* u64 */
ILA_ATTR_IDENTIFIER, /* u64 */
ILA_ATTR_LOCATOR_MATCH, /* u64 */
ILA_ATTR_IFINDEX, /* s32 */
ILA_ATTR_DIR, /* u32 */
__ILA_ATTR_MAX, __ILA_ATTR_MAX,
}; };
#define ILA_ATTR_MAX (__ILA_ATTR_MAX - 1) #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 */ #endif /* _UAPI_LINUX_ILA_H */
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
obj-$(CONFIG_IPV6_ILA) += ila.o 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
...@@ -42,5 +42,7 @@ void update_ipv6_locator(struct sk_buff *skb, struct ila_params *p); ...@@ -42,5 +42,7 @@ void update_ipv6_locator(struct sk_buff *skb, struct ila_params *p);
int ila_lwt_init(void); int ila_lwt_init(void);
void ila_lwt_fini(void); void ila_lwt_fini(void);
int ila_xlat_init(void);
void ila_xlat_fini(void);
#endif /* __ILA_H */ #endif /* __ILA_H */
...@@ -80,12 +80,20 @@ static int __init ila_init(void) ...@@ -80,12 +80,20 @@ static int __init ila_init(void)
if (ret) if (ret)
goto fail_lwt; goto fail_lwt;
ret = ila_xlat_init();
if (ret)
goto fail_xlat;
return 0;
fail_xlat:
ila_lwt_fini();
fail_lwt: fail_lwt:
return ret; return ret;
} }
static void __exit ila_fini(void) static void __exit ila_fini(void)
{ {
ila_xlat_fini();
ila_lwt_fini(); ila_lwt_fini();
} }
......
This diff is collapsed.
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