aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/addr.h2
-rw-r--r--net/tipc/config.h4
-rw-r--r--net/tipc/core.c23
-rw-r--r--net/tipc/core.h53
-rw-r--r--net/tipc/link.h4
-rw-r--r--net/tipc/msg.c23
-rw-r--r--net/tipc/msg.h37
-rw-r--r--net/tipc/netlink.h3
-rw-r--r--net/tipc/server.c1
-rw-r--r--net/tipc/server.h3
-rw-r--r--net/tipc/socket.h7
-rw-r--r--net/tipc/subscr.h3
12 files changed, 74 insertions, 89 deletions
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index a74acf9ee804..60b00ab93d74 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -37,8 +37,6 @@
37#ifndef _TIPC_ADDR_H 37#ifndef _TIPC_ADDR_H
38#define _TIPC_ADDR_H 38#define _TIPC_ADDR_H
39 39
40#include "core.h"
41
42#define TIPC_ZONE_MASK 0xff000000u 40#define TIPC_ZONE_MASK 0xff000000u
43#define TIPC_CLUSTER_MASK 0xfffff000u 41#define TIPC_CLUSTER_MASK 0xfffff000u
44 42
diff --git a/net/tipc/config.h b/net/tipc/config.h
index 47b1bf181612..a41a41c58750 100644
--- a/net/tipc/config.h
+++ b/net/tipc/config.h
@@ -37,10 +37,10 @@
37#ifndef _TIPC_CONFIG_H 37#ifndef _TIPC_CONFIG_H
38#define _TIPC_CONFIG_H 38#define _TIPC_CONFIG_H
39 39
40/* ---------------------------------------------------------------------- */
41
42#include "link.h" 40#include "link.h"
43 41
42#define ULTRA_STRING_MAX_LEN 32768
43
44struct sk_buff *tipc_cfg_reply_alloc(int payload_size); 44struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
45int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, 45int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
46 void *tlv_data, int tlv_data_size); 46 void *tlv_data, int tlv_data_size);
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 10bc0bf909e4..b6ec3d7c5f51 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -52,29 +52,6 @@ u32 tipc_own_addr __read_mostly;
52int tipc_net_id __read_mostly; 52int tipc_net_id __read_mostly;
53int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */ 53int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */
54 54
55/**
56 * tipc_buf_acquire - creates a TIPC message buffer
57 * @size: message size (including TIPC header)
58 *
59 * Returns a new buffer with data pointers set to the specified size.
60 *
61 * NOTE: Headroom is reserved to allow prepending of a data link header.
62 * There may also be unrequested tailroom present at the buffer's end.
63 */
64struct sk_buff *tipc_buf_acquire(u32 size)
65{
66 struct sk_buff *skb;
67 unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
68
69 skb = alloc_skb_fclone(buf_size, GFP_ATOMIC);
70 if (skb) {
71 skb_reserve(skb, BUF_HEADROOM);
72 skb_put(skb, size);
73 skb->next = NULL;
74 }
75 return skb;
76}
77
78static int __init tipc_init(void) 55static int __init tipc_init(void)
79{ 56{
80 int err; 57 int err;
diff --git a/net/tipc/core.h b/net/tipc/core.h
index d57068961d4c..a5b3140f1451 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -60,20 +60,9 @@
60 60
61#define TIPC_MOD_VER "2.0.0" 61#define TIPC_MOD_VER "2.0.0"
62 62
63#define ULTRA_STRING_MAX_LEN 32768
64#define TIPC_MAX_SUBSCRIPTIONS 65535
65#define TIPC_MAX_PUBLICATIONS 65535
66
67struct tipc_msg; /* msg.h */
68
69int tipc_snprintf(char *buf, int len, const char *fmt, ...); 63int tipc_snprintf(char *buf, int len, const char *fmt, ...);
70 64
71/* 65/*
72 * TIPC-specific error codes
73 */
74#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
75
76/*
77 * Global configuration variables 66 * Global configuration variables
78 */ 67 */
79extern u32 tipc_own_addr __read_mostly; 68extern u32 tipc_own_addr __read_mostly;
@@ -86,18 +75,6 @@ extern int sysctl_tipc_named_timeout __read_mostly;
86 */ 75 */
87extern int tipc_random __read_mostly; 76extern int tipc_random __read_mostly;
88 77
89/*
90 * Routines available to privileged subsystems
91 */
92int tipc_netlink_start(void);
93void tipc_netlink_stop(void);
94int tipc_socket_init(void);
95void tipc_socket_stop(void);
96int tipc_sock_create_local(int type, struct socket **res);
97void tipc_sock_release_local(struct socket *sock);
98int tipc_sock_accept_local(struct socket *sock, struct socket **newsock,
99 int flags);
100
101#ifdef CONFIG_SYSCTL 78#ifdef CONFIG_SYSCTL
102int tipc_register_sysctl(void); 79int tipc_register_sysctl(void);
103void tipc_unregister_sysctl(void); 80void tipc_unregister_sysctl(void);
@@ -106,34 +83,4 @@ void tipc_unregister_sysctl(void);
106#define tipc_unregister_sysctl() 83#define tipc_unregister_sysctl()
107#endif 84#endif
108 85
109/*
110 * TIPC message buffer code
111 *
112 * TIPC message buffer headroom reserves space for the worst-case
113 * link-level device header (in case the message is sent off-node).
114 *
115 * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields
116 * are word aligned for quicker access
117 */
118#define BUF_HEADROOM LL_MAX_HEADER
119
120struct tipc_skb_cb {
121 void *handle;
122 struct sk_buff *tail;
123 bool deferred;
124 bool wakeup_pending;
125 bool bundling;
126 u16 chain_sz;
127 u16 chain_imp;
128};
129
130#define TIPC_SKB_CB(__skb) ((struct tipc_skb_cb *)&((__skb)->cb[0]))
131
132static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
133{
134 return (struct tipc_msg *)skb->data;
135}
136
137struct sk_buff *tipc_buf_acquire(u32 size);
138
139#endif 86#endif
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 15ca850391df..e96c318f5c73 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -41,6 +41,10 @@
41#include "msg.h" 41#include "msg.h"
42#include "node.h" 42#include "node.h"
43 43
44/* TIPC-specific error codes
45*/
46#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
47
44/* Out-of-range value for link sequence numbers 48/* Out-of-range value for link sequence numbers
45 */ 49 */
46#define INVALID_LINK_SEQ 0x10000 50#define INVALID_LINK_SEQ 0x10000
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index a687b30a699c..35523fb6668c 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -46,6 +46,29 @@ static unsigned int align(unsigned int i)
46 return (i + 3) & ~3u; 46 return (i + 3) & ~3u;
47} 47}
48 48
49/**
50 * tipc_buf_acquire - creates a TIPC message buffer
51 * @size: message size (including TIPC header)
52 *
53 * Returns a new buffer with data pointers set to the specified size.
54 *
55 * NOTE: Headroom is reserved to allow prepending of a data link header.
56 * There may also be unrequested tailroom present at the buffer's end.
57 */
58struct sk_buff *tipc_buf_acquire(u32 size)
59{
60 struct sk_buff *skb;
61 unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
62
63 skb = alloc_skb_fclone(buf_size, GFP_ATOMIC);
64 if (skb) {
65 skb_reserve(skb, BUF_HEADROOM);
66 skb_put(skb, size);
67 skb->next = NULL;
68 }
69 return skb;
70}
71
49void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize, 72void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize,
50 u32 destnode) 73 u32 destnode)
51{ 74{
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 1a52f7cf3cd3..0065a2e8ad9b 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -77,10 +77,38 @@
77 77
78#define TIPC_MEDIA_ADDR_OFFSET 5 78#define TIPC_MEDIA_ADDR_OFFSET 5
79 79
80/**
81 * TIPC message buffer code
82 *
83 * TIPC message buffer headroom reserves space for the worst-case
84 * link-level device header (in case the message is sent off-node).
85 *
86 * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields
87 * are word aligned for quicker access
88 */
89#define BUF_HEADROOM LL_MAX_HEADER
90
91struct tipc_skb_cb {
92 void *handle;
93 struct sk_buff *tail;
94 bool deferred;
95 bool wakeup_pending;
96 bool bundling;
97 u16 chain_sz;
98 u16 chain_imp;
99};
100
101#define TIPC_SKB_CB(__skb) ((struct tipc_skb_cb *)&((__skb)->cb[0]))
102
80struct tipc_msg { 103struct tipc_msg {
81 __be32 hdr[15]; 104 __be32 hdr[15];
82}; 105};
83 106
107static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
108{
109 return (struct tipc_msg *)skb->data;
110}
111
84static inline u32 msg_word(struct tipc_msg *m, u32 pos) 112static inline u32 msg_word(struct tipc_msg *m, u32 pos)
85{ 113{
86 return ntohl(m->hdr[pos]); 114 return ntohl(m->hdr[pos]);
@@ -719,27 +747,20 @@ static inline u32 msg_tot_origport(struct tipc_msg *m)
719 return msg_origport(m); 747 return msg_origport(m);
720} 748}
721 749
750struct sk_buff *tipc_buf_acquire(u32 size);
722bool tipc_msg_reverse(struct sk_buff *buf, u32 *dnode, int err); 751bool tipc_msg_reverse(struct sk_buff *buf, u32 *dnode, int err);
723
724int tipc_msg_eval(struct sk_buff *buf, u32 *dnode); 752int tipc_msg_eval(struct sk_buff *buf, u32 *dnode);
725
726void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize, 753void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize,
727 u32 destnode); 754 u32 destnode);
728
729struct sk_buff *tipc_msg_create(uint user, uint type, uint hdr_sz, 755struct sk_buff *tipc_msg_create(uint user, uint type, uint hdr_sz,
730 uint data_sz, u32 dnode, u32 onode, 756 uint data_sz, u32 dnode, u32 onode,
731 u32 dport, u32 oport, int errcode); 757 u32 dport, u32 oport, int errcode);
732
733int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf); 758int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf);
734
735bool tipc_msg_bundle(struct sk_buff_head *list, struct sk_buff *skb, u32 mtu); 759bool tipc_msg_bundle(struct sk_buff_head *list, struct sk_buff *skb, u32 mtu);
736
737bool tipc_msg_make_bundle(struct sk_buff_head *list, struct sk_buff *skb, 760bool tipc_msg_make_bundle(struct sk_buff_head *list, struct sk_buff *skb,
738 u32 mtu, u32 dnode); 761 u32 mtu, u32 dnode);
739
740int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, int offset, 762int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, int offset,
741 int dsz, int mtu, struct sk_buff_head *list); 763 int dsz, int mtu, struct sk_buff_head *list);
742
743struct sk_buff *tipc_msg_reassemble(struct sk_buff_head *list); 764struct sk_buff *tipc_msg_reassemble(struct sk_buff_head *list);
744 765
745#endif 766#endif
diff --git a/net/tipc/netlink.h b/net/tipc/netlink.h
index 1425c6869de0..ae2f2d923a15 100644
--- a/net/tipc/netlink.h
+++ b/net/tipc/netlink.h
@@ -45,4 +45,7 @@ struct tipc_nl_msg {
45 u32 seq; 45 u32 seq;
46}; 46};
47 47
48int tipc_netlink_start(void);
49void tipc_netlink_stop(void);
50
48#endif 51#endif
diff --git a/net/tipc/server.c b/net/tipc/server.c
index a538a02f869b..869eb0905754 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -35,6 +35,7 @@
35 35
36#include "server.h" 36#include "server.h"
37#include "core.h" 37#include "core.h"
38#include "socket.h"
38#include <net/sock.h> 39#include <net/sock.h>
39 40
40/* Number of messages to send before rescheduling */ 41/* Number of messages to send before rescheduling */
diff --git a/net/tipc/server.h b/net/tipc/server.h
index be817b0b547e..87bc05c70dce 100644
--- a/net/tipc/server.h
+++ b/net/tipc/server.h
@@ -36,7 +36,8 @@
36#ifndef _TIPC_SERVER_H 36#ifndef _TIPC_SERVER_H
37#define _TIPC_SERVER_H 37#define _TIPC_SERVER_H
38 38
39#include "core.h" 39#include <linux/idr.h>
40#include <linux/tipc.h>
40 41
41#define TIPC_SERVER_NAME_LEN 32 42#define TIPC_SERVER_NAME_LEN 32
42 43
diff --git a/net/tipc/socket.h b/net/tipc/socket.h
index c7d46d069d89..46bc370d82c7 100644
--- a/net/tipc/socket.h
+++ b/net/tipc/socket.h
@@ -42,6 +42,13 @@
42#define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2) 42#define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2)
43#define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \ 43#define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \
44 SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) 44 SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE))
45
46int tipc_socket_init(void);
47void tipc_socket_stop(void);
48int tipc_sock_create_local(int type, struct socket **res);
49void tipc_sock_release_local(struct socket *sock);
50int tipc_sock_accept_local(struct socket *sock, struct socket **newsock,
51 int flags);
45int tipc_sk_rcv(struct sk_buff *buf); 52int tipc_sk_rcv(struct sk_buff *buf);
46struct sk_buff *tipc_sk_socks_show(void); 53struct sk_buff *tipc_sk_socks_show(void);
47void tipc_sk_mcast_rcv(struct sk_buff *buf); 54void tipc_sk_mcast_rcv(struct sk_buff *buf);
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
index ab01713bfe32..0d3958956aca 100644
--- a/net/tipc/subscr.h
+++ b/net/tipc/subscr.h
@@ -39,6 +39,9 @@
39 39
40#include "server.h" 40#include "server.h"
41 41
42#define TIPC_MAX_SUBSCRIPTIONS 65535
43#define TIPC_MAX_PUBLICATIONS 65535
44
42struct tipc_subscription; 45struct tipc_subscription;
43struct tipc_subscriber; 46struct tipc_subscriber;
44 47