Commit d0f91938 authored by Erik Hugne's avatar Erik Hugne Committed by David S. Miller

tipc: add ip/udp media type

The ip/udp bearer can be configured in a point-to-point
mode by specifying both local and remote ip/hostname,
or it can be enabled in multicast mode, where links are
established to all tipc nodes that have joined the same
multicast group. The multicast IP address is generated
based on the TIPC network ID, but can be overridden by
using another multicast address as remote ip.
Signed-off-by: default avatarErik Hugne <erik.hugne@ericsson.com>
Reviewed-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 948fa2d1
...@@ -83,11 +83,20 @@ enum { ...@@ -83,11 +83,20 @@ enum {
TIPC_NLA_BEARER_NAME, /* string */ TIPC_NLA_BEARER_NAME, /* string */
TIPC_NLA_BEARER_PROP, /* nest */ TIPC_NLA_BEARER_PROP, /* nest */
TIPC_NLA_BEARER_DOMAIN, /* u32 */ TIPC_NLA_BEARER_DOMAIN, /* u32 */
TIPC_NLA_BEARER_UDP_OPTS, /* nest */
__TIPC_NLA_BEARER_MAX, __TIPC_NLA_BEARER_MAX,
TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1 TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1
}; };
enum {
TIPC_NLA_UDP_UNSPEC,
TIPC_NLA_UDP_LOCAL, /* sockaddr_storage */
TIPC_NLA_UDP_REMOTE, /* sockaddr_storage */
__TIPC_NLA_UDP_MAX,
TIPC_NLA_UDP_MAX = __TIPC_NLA_UDP_MAX - 1
};
/* Socket info */ /* Socket info */
enum { enum {
TIPC_NLA_SOCK_UNSPEC, TIPC_NLA_SOCK_UNSPEC,
......
...@@ -26,3 +26,11 @@ config TIPC_MEDIA_IB ...@@ -26,3 +26,11 @@ config TIPC_MEDIA_IB
help help
Saying Y here will enable support for running TIPC on Saying Y here will enable support for running TIPC on
IP-over-InfiniBand devices. IP-over-InfiniBand devices.
config TIPC_MEDIA_UDP
bool "IP/UDP media type support"
depends on TIPC
select NET_UDP_TUNNEL
help
Saying Y here will enable support for running TIPC over IP/UDP
bool
default y
...@@ -10,5 +10,6 @@ tipc-y += addr.o bcast.o bearer.o \ ...@@ -10,5 +10,6 @@ tipc-y += addr.o bcast.o bearer.o \
netlink.o netlink_compat.o node.o socket.o eth_media.o \ netlink.o netlink_compat.o node.o socket.o eth_media.o \
server.o socket.o server.o socket.o
tipc-$(CONFIG_TIPC_MEDIA_UDP) += udp_media.o
tipc-$(CONFIG_TIPC_MEDIA_IB) += ib_media.o tipc-$(CONFIG_TIPC_MEDIA_IB) += ib_media.o
tipc-$(CONFIG_SYSCTL) += sysctl.o tipc-$(CONFIG_SYSCTL) += sysctl.o
...@@ -47,6 +47,9 @@ static struct tipc_media * const media_info_array[] = { ...@@ -47,6 +47,9 @@ static struct tipc_media * const media_info_array[] = {
&eth_media_info, &eth_media_info,
#ifdef CONFIG_TIPC_MEDIA_IB #ifdef CONFIG_TIPC_MEDIA_IB
&ib_media_info, &ib_media_info,
#endif
#ifdef CONFIG_TIPC_MEDIA_UDP
&udp_media_info,
#endif #endif
NULL NULL
}; };
...@@ -216,7 +219,8 @@ void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest) ...@@ -216,7 +219,8 @@ void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest)
* tipc_enable_bearer - enable bearer with the given name * tipc_enable_bearer - enable bearer with the given name
*/ */
static int tipc_enable_bearer(struct net *net, const char *name, static int tipc_enable_bearer(struct net *net, const char *name,
u32 disc_domain, u32 priority) u32 disc_domain, u32 priority,
struct nlattr *attr[])
{ {
struct tipc_net *tn = net_generic(net, tipc_net_id); struct tipc_net *tn = net_generic(net, tipc_net_id);
struct tipc_bearer *b_ptr; struct tipc_bearer *b_ptr;
...@@ -304,7 +308,7 @@ static int tipc_enable_bearer(struct net *net, const char *name, ...@@ -304,7 +308,7 @@ static int tipc_enable_bearer(struct net *net, const char *name,
strcpy(b_ptr->name, name); strcpy(b_ptr->name, name);
b_ptr->media = m_ptr; b_ptr->media = m_ptr;
res = m_ptr->enable_media(net, b_ptr); res = m_ptr->enable_media(net, b_ptr, attr);
if (res) { if (res) {
pr_warn("Bearer <%s> rejected, enable failure (%d)\n", pr_warn("Bearer <%s> rejected, enable failure (%d)\n",
name, -res); name, -res);
...@@ -372,7 +376,8 @@ static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, ...@@ -372,7 +376,8 @@ static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr,
kfree_rcu(b_ptr, rcu); kfree_rcu(b_ptr, rcu);
} }
int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b) int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
struct nlattr *attr[])
{ {
struct net_device *dev; struct net_device *dev;
char *driver_name = strchr((const char *)b->name, ':') + 1; char *driver_name = strchr((const char *)b->name, ':') + 1;
...@@ -791,7 +796,7 @@ int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) ...@@ -791,7 +796,7 @@ int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info)
} }
rtnl_lock(); rtnl_lock();
err = tipc_enable_bearer(net, bearer, domain, prio); err = tipc_enable_bearer(net, bearer, domain, prio, attrs);
if (err) { if (err) {
rtnl_unlock(); rtnl_unlock();
return err; return err;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <net/genetlink.h> #include <net/genetlink.h>
#define MAX_BEARERS 2 #define MAX_BEARERS 2
#define MAX_MEDIA 2 #define MAX_MEDIA 3
#define MAX_NODES 4096 #define MAX_NODES 4096
#define WSIZE 32 #define WSIZE 32
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
*/ */
#define TIPC_MEDIA_TYPE_ETH 1 #define TIPC_MEDIA_TYPE_ETH 1
#define TIPC_MEDIA_TYPE_IB 2 #define TIPC_MEDIA_TYPE_IB 2
#define TIPC_MEDIA_TYPE_UDP 3
/** /**
* struct tipc_node_map - set of node identifiers * struct tipc_node_map - set of node identifiers
...@@ -104,7 +105,8 @@ struct tipc_media { ...@@ -104,7 +105,8 @@ struct tipc_media {
int (*send_msg)(struct net *net, struct sk_buff *buf, int (*send_msg)(struct net *net, struct sk_buff *buf,
struct tipc_bearer *b_ptr, struct tipc_bearer *b_ptr,
struct tipc_media_addr *dest); struct tipc_media_addr *dest);
int (*enable_media)(struct net *net, struct tipc_bearer *b_ptr); int (*enable_media)(struct net *net, struct tipc_bearer *b_ptr,
struct nlattr *attr[]);
void (*disable_media)(struct tipc_bearer *b_ptr); void (*disable_media)(struct tipc_bearer *b_ptr);
int (*addr2str)(struct tipc_media_addr *addr, int (*addr2str)(struct tipc_media_addr *addr,
char *strbuf, char *strbuf,
...@@ -183,6 +185,9 @@ extern struct tipc_media eth_media_info; ...@@ -183,6 +185,9 @@ extern struct tipc_media eth_media_info;
#ifdef CONFIG_TIPC_MEDIA_IB #ifdef CONFIG_TIPC_MEDIA_IB
extern struct tipc_media ib_media_info; extern struct tipc_media ib_media_info;
#endif #endif
#ifdef CONFIG_TIPC_MEDIA_UDP
extern struct tipc_media udp_media_info;
#endif
int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info); int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info);
int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info); int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info);
...@@ -197,7 +202,8 @@ int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info); ...@@ -197,7 +202,8 @@ int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info);
int tipc_media_set_priority(const char *name, u32 new_value); int tipc_media_set_priority(const char *name, u32 new_value);
int tipc_media_set_window(const char *name, u32 new_value); int tipc_media_set_window(const char *name, u32 new_value);
void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a); void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a);
int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b); int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
struct nlattr *attrs[]);
void tipc_disable_l2_media(struct tipc_bearer *b); void tipc_disable_l2_media(struct tipc_bearer *b);
int tipc_l2_send_msg(struct net *net, struct sk_buff *buf, int tipc_l2_send_msg(struct net *net, struct sk_buff *buf,
struct tipc_bearer *b, struct tipc_media_addr *dest); struct tipc_bearer *b, struct tipc_media_addr *dest);
......
...@@ -87,7 +87,7 @@ struct plist; ...@@ -87,7 +87,7 @@ struct plist;
* Note: Headroom should be a multiple of 4 to ensure the TIPC header fields * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields
* are word aligned for quicker access * are word aligned for quicker access
*/ */
#define BUF_HEADROOM LL_MAX_HEADER #define BUF_HEADROOM (LL_MAX_HEADER + 48)
struct tipc_skb_cb { struct tipc_skb_cb {
void *handle; void *handle;
......
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