aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/core.c11
-rw-r--r--net/tipc/core.h6
-rw-r--r--net/tipc/link.c16
-rw-r--r--net/tipc/msg.c16
-rw-r--r--net/tipc/msg.h50
-rw-r--r--net/tipc/port.c12
-rw-r--r--net/tipc/socket.c5
7 files changed, 42 insertions, 74 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c
index d2d7d32c02c7..740aac5cdfb6 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -48,16 +48,8 @@
48#include "subscr.h" 48#include "subscr.h"
49#include "config.h" 49#include "config.h"
50 50
51int tipc_eth_media_start(void);
52void tipc_eth_media_stop(void);
53int tipc_handler_start(void);
54void tipc_handler_stop(void);
55int tipc_socket_init(void);
56void tipc_socket_stop(void);
57int tipc_netlink_start(void);
58void tipc_netlink_stop(void);
59 51
60#define TIPC_MOD_VER "1.6.2" 52#define TIPC_MOD_VER "1.6.3"
61 53
62#ifndef CONFIG_TIPC_ZONES 54#ifndef CONFIG_TIPC_ZONES
63#define CONFIG_TIPC_ZONES 3 55#define CONFIG_TIPC_ZONES 3
@@ -277,7 +269,6 @@ EXPORT_SYMBOL(tipc_register_media);
277/* TIPC API for external APIs (see tipc_port.h) */ 269/* TIPC API for external APIs (see tipc_port.h) */
278 270
279EXPORT_SYMBOL(tipc_createport_raw); 271EXPORT_SYMBOL(tipc_createport_raw);
280EXPORT_SYMBOL(tipc_set_msg_option);
281EXPORT_SYMBOL(tipc_reject_msg); 272EXPORT_SYMBOL(tipc_reject_msg);
282EXPORT_SYMBOL(tipc_send_buf_fast); 273EXPORT_SYMBOL(tipc_send_buf_fast);
283EXPORT_SYMBOL(tipc_acknowledge); 274EXPORT_SYMBOL(tipc_acknowledge);
diff --git a/net/tipc/core.h b/net/tipc/core.h
index feabca580820..3fe9b70331d9 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -180,6 +180,12 @@ extern int tipc_core_start(void);
180extern void tipc_core_stop(void); 180extern void tipc_core_stop(void);
181extern int tipc_core_start_net(void); 181extern int tipc_core_start_net(void);
182extern void tipc_core_stop_net(void); 182extern void tipc_core_stop_net(void);
183extern int tipc_handler_start(void);
184extern void tipc_handler_stop(void);
185extern int tipc_netlink_start(void);
186extern void tipc_netlink_stop(void);
187extern int tipc_socket_init(void);
188extern void tipc_socket_stop(void);
183 189
184static inline int delimit(int val, int min, int max) 190static inline int delimit(int val, int min, int max)
185{ 191{
diff --git a/net/tipc/link.c b/net/tipc/link.c
index cefa99824c58..a42f43430101 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2832,15 +2832,15 @@ static void link_set_supervision_props(struct link *l_ptr, u32 tolerance)
2832void tipc_link_set_queue_limits(struct link *l_ptr, u32 window) 2832void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
2833{ 2833{
2834 /* Data messages from this node, inclusive FIRST_FRAGM */ 2834 /* Data messages from this node, inclusive FIRST_FRAGM */
2835 l_ptr->queue_limit[DATA_LOW] = window; 2835 l_ptr->queue_limit[TIPC_LOW_IMPORTANCE] = window;
2836 l_ptr->queue_limit[DATA_MEDIUM] = (window / 3) * 4; 2836 l_ptr->queue_limit[TIPC_MEDIUM_IMPORTANCE] = (window / 3) * 4;
2837 l_ptr->queue_limit[DATA_HIGH] = (window / 3) * 5; 2837 l_ptr->queue_limit[TIPC_HIGH_IMPORTANCE] = (window / 3) * 5;
2838 l_ptr->queue_limit[DATA_CRITICAL] = (window / 3) * 6; 2838 l_ptr->queue_limit[TIPC_CRITICAL_IMPORTANCE] = (window / 3) * 6;
2839 /* Transiting data messages,inclusive FIRST_FRAGM */ 2839 /* Transiting data messages,inclusive FIRST_FRAGM */
2840 l_ptr->queue_limit[DATA_LOW + 4] = 300; 2840 l_ptr->queue_limit[TIPC_LOW_IMPORTANCE + 4] = 300;
2841 l_ptr->queue_limit[DATA_MEDIUM + 4] = 600; 2841 l_ptr->queue_limit[TIPC_MEDIUM_IMPORTANCE + 4] = 600;
2842 l_ptr->queue_limit[DATA_HIGH + 4] = 900; 2842 l_ptr->queue_limit[TIPC_HIGH_IMPORTANCE + 4] = 900;
2843 l_ptr->queue_limit[DATA_CRITICAL + 4] = 1200; 2843 l_ptr->queue_limit[TIPC_CRITICAL_IMPORTANCE + 4] = 1200;
2844 l_ptr->queue_limit[CONN_MANAGER] = 1200; 2844 l_ptr->queue_limit[CONN_MANAGER] = 1200;
2845 l_ptr->queue_limit[ROUTE_DISTRIBUTOR] = 1200; 2845 l_ptr->queue_limit[ROUTE_DISTRIBUTOR] = 1200;
2846 l_ptr->queue_limit[CHANGEOVER_PROTOCOL] = 2500; 2846 l_ptr->queue_limit[CHANGEOVER_PROTOCOL] = 2500;
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 782485468fb2..696a8633df75 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -73,10 +73,10 @@ void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str
73 tipc_printf(buf, "NO(%u/%u):",msg_long_msgno(msg), 73 tipc_printf(buf, "NO(%u/%u):",msg_long_msgno(msg),
74 msg_fragm_no(msg)); 74 msg_fragm_no(msg));
75 break; 75 break;
76 case DATA_LOW: 76 case TIPC_LOW_IMPORTANCE:
77 case DATA_MEDIUM: 77 case TIPC_MEDIUM_IMPORTANCE:
78 case DATA_HIGH: 78 case TIPC_HIGH_IMPORTANCE:
79 case DATA_CRITICAL: 79 case TIPC_CRITICAL_IMPORTANCE:
80 tipc_printf(buf, "DAT%u:", msg_user(msg)); 80 tipc_printf(buf, "DAT%u:", msg_user(msg));
81 if (msg_short(msg)) { 81 if (msg_short(msg)) {
82 tipc_printf(buf, "CON:"); 82 tipc_printf(buf, "CON:");
@@ -229,10 +229,10 @@ void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str
229 switch (usr) { 229 switch (usr) {
230 case CONN_MANAGER: 230 case CONN_MANAGER:
231 case NAME_DISTRIBUTOR: 231 case NAME_DISTRIBUTOR:
232 case DATA_LOW: 232 case TIPC_LOW_IMPORTANCE:
233 case DATA_MEDIUM: 233 case TIPC_MEDIUM_IMPORTANCE:
234 case DATA_HIGH: 234 case TIPC_HIGH_IMPORTANCE:
235 case DATA_CRITICAL: 235 case TIPC_CRITICAL_IMPORTANCE:
236 if (msg_short(msg)) 236 if (msg_short(msg))
237 break; /* No error */ 237 break; /* No error */
238 switch (msg_errcode(msg)) { 238 switch (msg_errcode(msg)) {
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index e9ef6df26562..6ad070d87702 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -40,18 +40,16 @@
40#include "core.h" 40#include "core.h"
41 41
42#define TIPC_VERSION 2 42#define TIPC_VERSION 2
43#define DATA_LOW TIPC_LOW_IMPORTANCE 43
44#define DATA_MEDIUM TIPC_MEDIUM_IMPORTANCE 44#define SHORT_H_SIZE 24 /* Connected, in-cluster messages */
45#define DATA_HIGH TIPC_HIGH_IMPORTANCE
46#define DATA_CRITICAL TIPC_CRITICAL_IMPORTANCE
47#define SHORT_H_SIZE 24 /* Connected,in cluster */
48#define DIR_MSG_H_SIZE 32 /* Directly addressed messages */ 45#define DIR_MSG_H_SIZE 32 /* Directly addressed messages */
49#define CONN_MSG_H_SIZE 36 /* Routed connected msgs*/ 46#define LONG_H_SIZE 40 /* Named messages */
50#define LONG_H_SIZE 40 /* Named Messages */
51#define MCAST_H_SIZE 44 /* Multicast messages */ 47#define MCAST_H_SIZE 44 /* Multicast messages */
52#define MAX_H_SIZE 60 /* Inclusive full options */ 48#define INT_H_SIZE 40 /* Internal messages */
49#define MIN_H_SIZE 24 /* Smallest legal TIPC header size */
50#define MAX_H_SIZE 60 /* Largest possible TIPC header size */
51
53#define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) 52#define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE)
54#define LINK_CONFIG 13
55 53
56 54
57/* 55/*
@@ -72,8 +70,10 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
72 u32 pos, u32 mask, u32 val) 70 u32 pos, u32 mask, u32 val)
73{ 71{
74 val = (val & mask) << pos; 72 val = (val & mask) << pos;
75 m->hdr[w] &= ~htonl(mask << pos); 73 val = htonl(val);
76 m->hdr[w] |= htonl(val); 74 mask = htonl(mask << pos);
75 m->hdr[w] &= ~mask;
76 m->hdr[w] |= val;
77} 77}
78 78
79/* 79/*
@@ -87,7 +87,7 @@ static inline u32 msg_version(struct tipc_msg *m)
87 87
88static inline void msg_set_version(struct tipc_msg *m) 88static inline void msg_set_version(struct tipc_msg *m)
89{ 89{
90 msg_set_bits(m, 0, 29, 0xf, TIPC_VERSION); 90 msg_set_bits(m, 0, 29, 7, TIPC_VERSION);
91} 91}
92 92
93static inline u32 msg_user(struct tipc_msg *m) 93static inline u32 msg_user(struct tipc_msg *m)
@@ -97,7 +97,7 @@ static inline u32 msg_user(struct tipc_msg *m)
97 97
98static inline u32 msg_isdata(struct tipc_msg *m) 98static inline u32 msg_isdata(struct tipc_msg *m)
99{ 99{
100 return (msg_user(m) <= DATA_CRITICAL); 100 return (msg_user(m) <= TIPC_CRITICAL_IMPORTANCE);
101} 101}
102 102
103static inline void msg_set_user(struct tipc_msg *m, u32 n) 103static inline void msg_set_user(struct tipc_msg *m, u32 n)
@@ -190,18 +190,6 @@ static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n)
190 msg_set_bits(m, 1, 19, 0x3, n); 190 msg_set_bits(m, 1, 19, 0x3, n);
191} 191}
192 192
193static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz)
194{
195 u32 hsz = msg_hdr_sz(m);
196 char *to = (char *)&m->hdr[hsz/4];
197
198 if ((hsz < DIR_MSG_H_SIZE) || ((hsz + sz) > MAX_H_SIZE))
199 return;
200 msg_set_bits(m, 1, 16, 0x7, (hsz - 28)/4);
201 msg_set_hdr_sz(m, hsz + sz);
202 memcpy(to, opt, sz);
203}
204
205static inline u32 msg_bcast_ack(struct tipc_msg *m) 193static inline u32 msg_bcast_ack(struct tipc_msg *m)
206{ 194{
207 return msg_bits(m, 1, 0, 0xffff); 195 return msg_bits(m, 1, 0, 0xffff);
@@ -330,17 +318,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
330 return (struct tipc_msg *)msg_data(m); 318 return (struct tipc_msg *)msg_data(m);
331} 319}
332 320
333static inline void msg_expand(struct tipc_msg *m, u32 destnode)
334{
335 if (!msg_short(m))
336 return;
337 msg_set_hdr_sz(m, LONG_H_SIZE);
338 msg_set_orignode(m, msg_prevnode(m));
339 msg_set_destnode(m, destnode);
340 memset(&m->hdr[8], 0, 12);
341}
342
343
344 321
345/* 322/*
346 TIPC internal message header format, version 2 323 TIPC internal message header format, version 2
@@ -388,7 +365,6 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode)
388#define NAME_DISTRIBUTOR 11 365#define NAME_DISTRIBUTOR 11
389#define MSG_FRAGMENTER 12 366#define MSG_FRAGMENTER 12
390#define LINK_CONFIG 13 367#define LINK_CONFIG 13
391#define INT_H_SIZE 40
392#define DSC_H_SIZE 40 368#define DSC_H_SIZE 40
393 369
394/* 370/*
diff --git a/net/tipc/port.c b/net/tipc/port.c
index f508614ca59b..e2646a96935d 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -242,7 +242,8 @@ u32 tipc_createport_raw(void *usr_handle,
242 p_ptr->publ.max_pkt = MAX_PKT_DEFAULT; 242 p_ptr->publ.max_pkt = MAX_PKT_DEFAULT;
243 p_ptr->publ.ref = ref; 243 p_ptr->publ.ref = ref;
244 msg = &p_ptr->publ.phdr; 244 msg = &p_ptr->publ.phdr;
245 msg_init(msg, DATA_LOW, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE, 0); 245 msg_init(msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE,
246 0);
246 msg_set_orignode(msg, tipc_own_addr); 247 msg_set_orignode(msg, tipc_own_addr);
247 msg_set_prevnode(msg, tipc_own_addr); 248 msg_set_prevnode(msg, tipc_own_addr);
248 msg_set_origport(msg, ref); 249 msg_set_origport(msg, ref);
@@ -413,13 +414,6 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
413 return buf; 414 return buf;
414} 415}
415 416
416int tipc_set_msg_option(struct tipc_port *tp_ptr, const char *opt, const u32 sz)
417{
418 msg_expand(&tp_ptr->phdr, msg_destnode(&tp_ptr->phdr));
419 msg_set_options(&tp_ptr->phdr, opt, sz);
420 return TIPC_OK;
421}
422
423int tipc_reject_msg(struct sk_buff *buf, u32 err) 417int tipc_reject_msg(struct sk_buff *buf, u32 err)
424{ 418{
425 struct tipc_msg *msg = buf_msg(buf); 419 struct tipc_msg *msg = buf_msg(buf);
@@ -632,7 +626,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
632 msg_orignode(msg), 626 msg_orignode(msg),
633 msg_destport(msg), 627 msg_destport(msg),
634 tipc_own_addr, 628 tipc_own_addr,
635 DATA_HIGH, 629 TIPC_HIGH_IMPORTANCE,
636 TIPC_CONN_MSG, 630 TIPC_CONN_MSG,
637 err, 631 err,
638 0, 632 0,
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 9ae8e9f74028..3220d5cb5b5d 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1419,7 +1419,7 @@ exit:
1419/** 1419/**
1420 * shutdown - shutdown socket connection 1420 * shutdown - shutdown socket connection
1421 * @sock: socket structure 1421 * @sock: socket structure
1422 * @how: direction to close (unused; always treated as read + write) 1422 * @how: direction to close (must be SHUT_RDWR)
1423 * 1423 *
1424 * Terminates connection (if necessary), then purges socket's receive queue. 1424 * Terminates connection (if necessary), then purges socket's receive queue.
1425 * 1425 *
@@ -1432,7 +1432,8 @@ static int shutdown(struct socket *sock, int how)
1432 struct sk_buff *buf; 1432 struct sk_buff *buf;
1433 int res; 1433 int res;
1434 1434
1435 /* Could return -EINVAL for an invalid "how", but why bother? */ 1435 if (how != SHUT_RDWR)
1436 return -EINVAL;
1436 1437
1437 if (mutex_lock_interruptible(&tsock->lock)) 1438 if (mutex_lock_interruptible(&tsock->lock))
1438 return -ERESTARTSYS; 1439 return -ERESTARTSYS;