aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-02-09 09:25:21 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-11 02:20:15 -0500
commitc43072852649d8382b81237ce51195bcec36f24a (patch)
tree5e55d65bd4d1db35418d2990310bd2c765d60405
parentcca5172a7ec10dfdb0b787cd8e9d5b0b8f179793 (diff)
[NET] TIPC: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/tipc/addr.c14
-rw-r--r--net/tipc/addr.h6
-rw-r--r--net/tipc/bcast.c98
-rw-r--r--net/tipc/bcast.h6
-rw-r--r--net/tipc/bearer.c58
-rw-r--r--net/tipc/bearer.h22
-rw-r--r--net/tipc/cluster.c22
-rw-r--r--net/tipc/cluster.h4
-rw-r--r--net/tipc/config.c16
-rw-r--r--net/tipc/config.h8
-rw-r--r--net/tipc/core.c18
-rw-r--r--net/tipc/core.h40
-rw-r--r--net/tipc/dbg.c56
-rw-r--r--net/tipc/dbg.h2
-rw-r--r--net/tipc/discover.c50
-rw-r--r--net/tipc/discover.h2
-rw-r--r--net/tipc/eth_media.c58
-rw-r--r--net/tipc/handler.c6
-rw-r--r--net/tipc/link.c394
-rw-r--r--net/tipc/link.h32
-rw-r--r--net/tipc/msg.c2
-rw-r--r--net/tipc/msg.h138
-rw-r--r--net/tipc/name_distr.c64
-rw-r--r--net/tipc/name_distr.h2
-rw-r--r--net/tipc/name_table.c106
-rw-r--r--net/tipc/name_table.h10
-rw-r--r--net/tipc/net.c74
-rw-r--r--net/tipc/net.h4
-rw-r--r--net/tipc/netlink.c16
-rw-r--r--net/tipc/node.c220
-rw-r--r--net/tipc/node.h8
-rw-r--r--net/tipc/node_subscr.c6
-rw-r--r--net/tipc/node_subscr.h2
-rw-r--r--net/tipc/port.c226
-rw-r--r--net/tipc/port.h28
-rw-r--r--net/tipc/ref.c24
-rw-r--r--net/tipc/ref.h8
-rw-r--r--net/tipc/socket.c426
-rw-r--r--net/tipc/subscr.c82
-rw-r--r--net/tipc/subscr.h16
-rw-r--r--net/tipc/user_reg.c22
-rw-r--r--net/tipc/user_reg.h2
-rw-r--r--net/tipc/zone.c4
-rw-r--r--net/tipc/zone.h4
44 files changed, 1203 insertions, 1203 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index 0be25e175b93..e5207a11edf6 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/addr.c: TIPC address utility routines 2 * net/tipc/addr.c: TIPC address utility routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -48,10 +48,10 @@ u32 tipc_get_addr(void)
48 48
49/** 49/**
50 * tipc_addr_domain_valid - validates a network domain address 50 * tipc_addr_domain_valid - validates a network domain address
51 * 51 *
52 * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, 52 * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>,
53 * where Z, C, and N are non-zero and do not exceed the configured limits. 53 * where Z, C, and N are non-zero and do not exceed the configured limits.
54 * 54 *
55 * Returns 1 if domain address is valid, otherwise 0 55 * Returns 1 if domain address is valid, otherwise 0
56 */ 56 */
57 57
@@ -80,10 +80,10 @@ int tipc_addr_domain_valid(u32 addr)
80 80
81/** 81/**
82 * tipc_addr_node_valid - validates a proposed network address for this node 82 * tipc_addr_node_valid - validates a proposed network address for this node
83 * 83 *
84 * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed 84 * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed
85 * the configured limits. 85 * the configured limits.
86 * 86 *
87 * Returns 1 if address can be used, otherwise 0 87 * Returns 1 if address can be used, otherwise 0
88 */ 88 */
89 89
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index bcfebb3cbbf3..e4bd5335e48d 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/addr.h: Include file for TIPC address utility routines 2 * net/tipc/addr.h: Include file for TIPC address utility routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -100,8 +100,8 @@ static inline int addr_scope(u32 domain)
100 100
101/** 101/**
102 * addr_domain - convert 2-bit scope value to equivalent message lookup domain 102 * addr_domain - convert 2-bit scope value to equivalent message lookup domain
103 * 103 *
104 * Needed when address of a named message must be looked up a second time 104 * Needed when address of a named message must be looked up a second time
105 * after a network hop. 105 * after a network hop.
106 */ 106 */
107 107
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 730c5c47ed8d..e7880172ef19 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/bcast.c: TIPC broadcast code 2 * net/tipc/bcast.c: TIPC broadcast code
3 * 3 *
4 * Copyright (c) 2004-2006, Ericsson AB 4 * Copyright (c) 2004-2006, Ericsson AB
5 * Copyright (c) 2004, Intel Corporation. 5 * Copyright (c) 2004, Intel Corporation.
6 * Copyright (c) 2005, Wind River Systems 6 * Copyright (c) 2005, Wind River Systems
@@ -59,15 +59,15 @@
59 * Loss rate for incoming broadcast frames; used to test retransmission code. 59 * Loss rate for incoming broadcast frames; used to test retransmission code.
60 * Set to N to cause every N'th frame to be discarded; 0 => don't discard any. 60 * Set to N to cause every N'th frame to be discarded; 0 => don't discard any.
61 */ 61 */
62 62
63#define TIPC_BCAST_LOSS_RATE 0 63#define TIPC_BCAST_LOSS_RATE 0
64 64
65/** 65/**
66 * struct bcbearer_pair - a pair of bearers used by broadcast link 66 * struct bcbearer_pair - a pair of bearers used by broadcast link
67 * @primary: pointer to primary bearer 67 * @primary: pointer to primary bearer
68 * @secondary: pointer to secondary bearer 68 * @secondary: pointer to secondary bearer
69 * 69 *
70 * Bearers must have same priority and same set of reachable destinations 70 * Bearers must have same priority and same set of reachable destinations
71 * to be paired. 71 * to be paired.
72 */ 72 */
73 73
@@ -84,7 +84,7 @@ struct bcbearer_pair {
84 * @bpairs_temp: temporary array of bearer pairs used by tipc_bcbearer_sort() 84 * @bpairs_temp: temporary array of bearer pairs used by tipc_bcbearer_sort()
85 * @remains: temporary node map used by tipc_bcbearer_send() 85 * @remains: temporary node map used by tipc_bcbearer_send()
86 * @remains_new: temporary node map used tipc_bcbearer_send() 86 * @remains_new: temporary node map used tipc_bcbearer_send()
87 * 87 *
88 * Note: The fields labelled "temporary" are incorporated into the bearer 88 * Note: The fields labelled "temporary" are incorporated into the bearer
89 * to avoid consuming potentially limited stack space through the use of 89 * to avoid consuming potentially limited stack space through the use of
90 * large local variables within multicast routines. Concurrent access is 90 * large local variables within multicast routines. Concurrent access is
@@ -104,7 +104,7 @@ struct bcbearer {
104 * struct bclink - link used for broadcast messages 104 * struct bclink - link used for broadcast messages
105 * @link: (non-standard) broadcast link structure 105 * @link: (non-standard) broadcast link structure
106 * @node: (non-standard) node structure representing b'cast link's peer node 106 * @node: (non-standard) node structure representing b'cast link's peer node
107 * 107 *
108 * Handles sequence numbering, fragmentation, bundling, etc. 108 * Handles sequence numbering, fragmentation, bundling, etc.
109 */ 109 */
110 110
@@ -125,7 +125,7 @@ char tipc_bclink_name[] = "multicast-link";
125static u32 buf_seqno(struct sk_buff *buf) 125static u32 buf_seqno(struct sk_buff *buf)
126{ 126{
127 return msg_seqno(buf_msg(buf)); 127 return msg_seqno(buf_msg(buf));
128} 128}
129 129
130static u32 bcbuf_acks(struct sk_buff *buf) 130static u32 bcbuf_acks(struct sk_buff *buf)
131{ 131{
@@ -143,9 +143,9 @@ static void bcbuf_decr_acks(struct sk_buff *buf)
143} 143}
144 144
145 145
146/** 146/**
147 * bclink_set_gap - set gap according to contents of current deferred pkt queue 147 * bclink_set_gap - set gap according to contents of current deferred pkt queue
148 * 148 *
149 * Called with 'node' locked, bc_lock unlocked 149 * Called with 'node' locked, bc_lock unlocked
150 */ 150 */
151 151
@@ -159,14 +159,14 @@ static void bclink_set_gap(struct node *n_ptr)
159 n_ptr->bclink.gap_to = mod(buf_seqno(buf) - 1); 159 n_ptr->bclink.gap_to = mod(buf_seqno(buf) - 1);
160} 160}
161 161
162/** 162/**
163 * bclink_ack_allowed - test if ACK or NACK message can be sent at this moment 163 * bclink_ack_allowed - test if ACK or NACK message can be sent at this moment
164 * 164 *
165 * This mechanism endeavours to prevent all nodes in network from trying 165 * This mechanism endeavours to prevent all nodes in network from trying
166 * to ACK or NACK at the same time. 166 * to ACK or NACK at the same time.
167 * 167 *
168 * Note: TIPC uses a different trigger to distribute ACKs than it does to 168 * Note: TIPC uses a different trigger to distribute ACKs than it does to
169 * distribute NACKs, but tries to use the same spacing (divide by 16). 169 * distribute NACKs, but tries to use the same spacing (divide by 16).
170 */ 170 */
171 171
172static int bclink_ack_allowed(u32 n) 172static int bclink_ack_allowed(u32 n)
@@ -175,11 +175,11 @@ static int bclink_ack_allowed(u32 n)
175} 175}
176 176
177 177
178/** 178/**
179 * bclink_retransmit_pkt - retransmit broadcast packets 179 * bclink_retransmit_pkt - retransmit broadcast packets
180 * @after: sequence number of last packet to *not* retransmit 180 * @after: sequence number of last packet to *not* retransmit
181 * @to: sequence number of last packet to retransmit 181 * @to: sequence number of last packet to retransmit
182 * 182 *
183 * Called with bc_lock locked 183 * Called with bc_lock locked
184 */ 184 */
185 185
@@ -189,16 +189,16 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
189 189
190 buf = bcl->first_out; 190 buf = bcl->first_out;
191 while (buf && less_eq(buf_seqno(buf), after)) { 191 while (buf && less_eq(buf_seqno(buf), after)) {
192 buf = buf->next; 192 buf = buf->next;
193 } 193 }
194 tipc_link_retransmit(bcl, buf, mod(to - after)); 194 tipc_link_retransmit(bcl, buf, mod(to - after));
195} 195}
196 196
197/** 197/**
198 * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets 198 * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets
199 * @n_ptr: node that sent acknowledgement info 199 * @n_ptr: node that sent acknowledgement info
200 * @acked: broadcast sequence # that has been acknowledged 200 * @acked: broadcast sequence # that has been acknowledged
201 * 201 *
202 * Node is locked, bc_lock unlocked. 202 * Node is locked, bc_lock unlocked.
203 */ 203 */
204 204
@@ -244,9 +244,9 @@ void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked)
244 spin_unlock_bh(&bc_lock); 244 spin_unlock_bh(&bc_lock);
245} 245}
246 246
247/** 247/**
248 * bclink_send_ack - unicast an ACK msg 248 * bclink_send_ack - unicast an ACK msg
249 * 249 *
250 * tipc_net_lock and node lock set 250 * tipc_net_lock and node lock set
251 */ 251 */
252 252
@@ -258,9 +258,9 @@ static void bclink_send_ack(struct node *n_ptr)
258 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 258 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
259} 259}
260 260
261/** 261/**
262 * bclink_send_nack- broadcast a NACK msg 262 * bclink_send_nack- broadcast a NACK msg
263 * 263 *
264 * tipc_net_lock and node lock set 264 * tipc_net_lock and node lock set
265 */ 265 */
266 266
@@ -278,7 +278,7 @@ static void bclink_send_nack(struct node *n_ptr)
278 msg_init(msg, BCAST_PROTOCOL, STATE_MSG, 278 msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
279 TIPC_OK, INT_H_SIZE, n_ptr->addr); 279 TIPC_OK, INT_H_SIZE, n_ptr->addr);
280 msg_set_mc_netid(msg, tipc_net_id); 280 msg_set_mc_netid(msg, tipc_net_id);
281 msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); 281 msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in));
282 msg_set_bcgap_after(msg, n_ptr->bclink.gap_after); 282 msg_set_bcgap_after(msg, n_ptr->bclink.gap_after);
283 msg_set_bcgap_to(msg, n_ptr->bclink.gap_to); 283 msg_set_bcgap_to(msg, n_ptr->bclink.gap_to);
284 msg_set_bcast_tag(msg, tipc_own_tag); 284 msg_set_bcast_tag(msg, tipc_own_tag);
@@ -292,17 +292,17 @@ static void bclink_send_nack(struct node *n_ptr)
292 bcl->stats.bearer_congs++; 292 bcl->stats.bearer_congs++;
293 } 293 }
294 294
295 /* 295 /*
296 * Ensure we doesn't send another NACK msg to the node 296 * Ensure we doesn't send another NACK msg to the node
297 * until 16 more deferred messages arrive from it 297 * until 16 more deferred messages arrive from it
298 * (i.e. helps prevent all nodes from NACK'ing at same time) 298 * (i.e. helps prevent all nodes from NACK'ing at same time)
299 */ 299 */
300 300
301 n_ptr->bclink.nack_sync = tipc_own_tag; 301 n_ptr->bclink.nack_sync = tipc_own_tag;
302 } 302 }
303} 303}
304 304
305/** 305/**
306 * tipc_bclink_check_gap - send a NACK if a sequence gap exists 306 * tipc_bclink_check_gap - send a NACK if a sequence gap exists
307 * 307 *
308 * tipc_net_lock and node lock set 308 * tipc_net_lock and node lock set
@@ -320,9 +320,9 @@ void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent)
320 bclink_send_nack(n_ptr); 320 bclink_send_nack(n_ptr);
321} 321}
322 322
323/** 323/**
324 * tipc_bclink_peek_nack - process a NACK msg meant for another node 324 * tipc_bclink_peek_nack - process a NACK msg meant for another node
325 * 325 *
326 * Only tipc_net_lock set. 326 * Only tipc_net_lock set.
327 */ 327 */
328 328
@@ -349,7 +349,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g
349 if (less_eq(my_to, gap_to)) 349 if (less_eq(my_to, gap_to))
350 n_ptr->bclink.gap_to = gap_after; 350 n_ptr->bclink.gap_to = gap_after;
351 } else { 351 } else {
352 /* 352 /*
353 * Expand gap if missing bufs not in deferred queue: 353 * Expand gap if missing bufs not in deferred queue:
354 */ 354 */
355 struct sk_buff *buf = n_ptr->bclink.deferred_head; 355 struct sk_buff *buf = n_ptr->bclink.deferred_head;
@@ -371,7 +371,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g
371 } 371 }
372 /* 372 /*
373 * Some nodes may send a complementary NACK now: 373 * Some nodes may send a complementary NACK now:
374 */ 374 */
375 if (bclink_ack_allowed(sender_tag + 1)) { 375 if (bclink_ack_allowed(sender_tag + 1)) {
376 if (n_ptr->bclink.gap_to != n_ptr->bclink.gap_after) { 376 if (n_ptr->bclink.gap_to != n_ptr->bclink.gap_after) {
377 bclink_send_nack(n_ptr); 377 bclink_send_nack(n_ptr);
@@ -408,7 +408,7 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
408 408
409/** 409/**
410 * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards 410 * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards
411 * 411 *
412 * tipc_net_lock is read_locked, no other locks set 412 * tipc_net_lock is read_locked, no other locks set
413 */ 413 */
414 414
@@ -425,7 +425,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
425 425
426 msg_dbg(msg, "<BC<<<"); 426 msg_dbg(msg, "<BC<<<");
427 427
428 if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported || 428 if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported ||
429 (msg_mc_netid(msg) != tipc_net_id))) { 429 (msg_mc_netid(msg) != tipc_net_id))) {
430 buf_discard(buf); 430 buf_discard(buf);
431 return; 431 return;
@@ -443,7 +443,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
443 bclink_retransmit_pkt(msg_bcgap_after(msg), 443 bclink_retransmit_pkt(msg_bcgap_after(msg),
444 msg_bcgap_to(msg)); 444 msg_bcgap_to(msg));
445 bcl->owner->next = NULL; 445 bcl->owner->next = NULL;
446 spin_unlock_bh(&bc_lock); 446 spin_unlock_bh(&bc_lock);
447 } else { 447 } else {
448 tipc_bclink_peek_nack(msg_destnode(msg), 448 tipc_bclink_peek_nack(msg_destnode(msg),
449 msg_bcast_tag(msg), 449 msg_bcast_tag(msg),
@@ -547,10 +547,10 @@ u32 tipc_bclink_acks_missing(struct node *n_ptr)
547 547
548/** 548/**
549 * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer 549 * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer
550 * 550 *
551 * Send through as many bearers as necessary to reach all nodes 551 * Send through as many bearers as necessary to reach all nodes
552 * that support TIPC multicasting. 552 * that support TIPC multicasting.
553 * 553 *
554 * Returns 0 if packet sent successfully, non-zero if not 554 * Returns 0 if packet sent successfully, non-zero if not
555 */ 555 */
556 556
@@ -581,7 +581,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
581 send_count = 0; 581 send_count = 0;
582 582
583 /* Send buffer over bearers until all targets reached */ 583 /* Send buffer over bearers until all targets reached */
584 584
585 bcbearer->remains = tipc_cltr_bcast_nodes; 585 bcbearer->remains = tipc_cltr_bcast_nodes;
586 586
587 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { 587 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
@@ -615,7 +615,7 @@ update:
615 615
616 bcbearer->remains = bcbearer->remains_new; 616 bcbearer->remains = bcbearer->remains_new;
617 } 617 }
618 618
619 /* Unable to reach all targets */ 619 /* Unable to reach all targets */
620 620
621 bcbearer->bearer.publ.blocked = 1; 621 bcbearer->bearer.publ.blocked = 1;
@@ -682,7 +682,7 @@ void tipc_bcbearer_sort(void)
682 682
683/** 683/**
684 * tipc_bcbearer_push - resolve bearer congestion 684 * tipc_bcbearer_push - resolve bearer congestion
685 * 685 *
686 * Forces bclink to push out any unsent packets, until all packets are gone 686 * Forces bclink to push out any unsent packets, until all packets are gone
687 * or congestion reoccurs. 687 * or congestion reoccurs.
688 * No locks set when function called 688 * No locks set when function called
@@ -714,27 +714,27 @@ int tipc_bclink_stats(char *buf, const u32 buf_size)
714 spin_lock_bh(&bc_lock); 714 spin_lock_bh(&bc_lock);
715 715
716 tipc_printf(&pb, "Link <%s>\n" 716 tipc_printf(&pb, "Link <%s>\n"
717 " Window:%u packets\n", 717 " Window:%u packets\n",
718 bcl->name, bcl->queue_limit[0]); 718 bcl->name, bcl->queue_limit[0]);
719 tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", 719 tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
720 bcl->stats.recv_info, 720 bcl->stats.recv_info,
721 bcl->stats.recv_fragments, 721 bcl->stats.recv_fragments,
722 bcl->stats.recv_fragmented, 722 bcl->stats.recv_fragmented,
723 bcl->stats.recv_bundles, 723 bcl->stats.recv_bundles,
724 bcl->stats.recv_bundled); 724 bcl->stats.recv_bundled);
725 tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", 725 tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n",
726 bcl->stats.sent_info, 726 bcl->stats.sent_info,
727 bcl->stats.sent_fragments, 727 bcl->stats.sent_fragments,
728 bcl->stats.sent_fragmented, 728 bcl->stats.sent_fragmented,
729 bcl->stats.sent_bundles, 729 bcl->stats.sent_bundles,
730 bcl->stats.sent_bundled); 730 bcl->stats.sent_bundled);
731 tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n", 731 tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n",
732 bcl->stats.recv_nacks, 732 bcl->stats.recv_nacks,
733 bcl->stats.deferred_recv, 733 bcl->stats.deferred_recv,
734 bcl->stats.duplicates); 734 bcl->stats.duplicates);
735 tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n", 735 tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n",
736 bcl->stats.sent_nacks, 736 bcl->stats.sent_nacks,
737 bcl->stats.sent_acks, 737 bcl->stats.sent_acks,
738 bcl->stats.retransmitted); 738 bcl->stats.retransmitted);
739 tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", 739 tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n",
740 bcl->stats.bearer_congs, 740 bcl->stats.bearer_congs,
@@ -778,7 +778,7 @@ int tipc_bclink_init(void)
778 bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC); 778 bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC);
779 if (!bcbearer || !bclink) { 779 if (!bcbearer || !bclink) {
780 nomem: 780 nomem:
781 warn("Multicast link creation failed, no memory\n"); 781 warn("Multicast link creation failed, no memory\n");
782 kfree(bcbearer); 782 kfree(bcbearer);
783 bcbearer = NULL; 783 bcbearer = NULL;
784 kfree(bclink); 784 kfree(bclink);
@@ -796,7 +796,7 @@ int tipc_bclink_init(void)
796 bcl->next_out_no = 1; 796 bcl->next_out_no = 1;
797 spin_lock_init(&bclink->node.lock); 797 spin_lock_init(&bclink->node.lock);
798 bcl->owner = &bclink->node; 798 bcl->owner = &bclink->node;
799 bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; 799 bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
800 tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); 800 tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
801 bcl->b_ptr = &bcbearer->bearer; 801 bcl->b_ptr = &bcbearer->bearer;
802 bcl->state = WORKING_WORKING; 802 bcl->state = WORKING_WORKING;
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
index b243d9d495f0..f910ed29d055 100644
--- a/net/tipc/bcast.h
+++ b/net/tipc/bcast.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/bcast.h: Include file for TIPC broadcast code 2 * net/tipc/bcast.h: Include file for TIPC broadcast code
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -102,7 +102,7 @@ static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node)
102 } 102 }
103} 103}
104 104
105/** 105/**
106 * nmap_remove - remove a node from a node map 106 * nmap_remove - remove a node from a node map
107 */ 107 */
108 108
@@ -190,7 +190,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port)
190 190
191/** 191/**
192 * port_list_free - free dynamically created entries in port_list chain 192 * port_list_free - free dynamically created entries in port_list chain
193 * 193 *
194 * Note: First item is on stack, so it doesn't need to be released 194 * Note: First item is on stack, so it doesn't need to be released
195 */ 195 */
196 196
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 39744a33bd36..271a375b49b7 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/bearer.c: TIPC bearer code 2 * net/tipc/bearer.c: TIPC bearer code
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2004-2006, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -52,7 +52,7 @@ struct bearer *tipc_bearers = NULL;
52 52
53/** 53/**
54 * media_name_valid - validate media name 54 * media_name_valid - validate media name
55 * 55 *
56 * Returns 1 if media name is valid, otherwise 0. 56 * Returns 1 if media name is valid, otherwise 0.
57 */ 57 */
58 58
@@ -84,17 +84,17 @@ static struct media *media_find(const char *name)
84 84
85/** 85/**
86 * tipc_register_media - register a media type 86 * tipc_register_media - register a media type
87 * 87 *
88 * Bearers for this media type must be activated separately at a later stage. 88 * Bearers for this media type must be activated separately at a later stage.
89 */ 89 */
90 90
91int tipc_register_media(u32 media_type, 91int tipc_register_media(u32 media_type,
92 char *name, 92 char *name,
93 int (*enable)(struct tipc_bearer *), 93 int (*enable)(struct tipc_bearer *),
94 void (*disable)(struct tipc_bearer *), 94 void (*disable)(struct tipc_bearer *),
95 int (*send_msg)(struct sk_buff *, 95 int (*send_msg)(struct sk_buff *,
96 struct tipc_bearer *, 96 struct tipc_bearer *,
97 struct tipc_media_addr *), 97 struct tipc_media_addr *),
98 char *(*addr2str)(struct tipc_media_addr *a, 98 char *(*addr2str)(struct tipc_media_addr *a,
99 char *str_buf, int str_size), 99 char *str_buf, int str_size),
100 struct tipc_media_addr *bcast_addr, 100 struct tipc_media_addr *bcast_addr,
@@ -121,11 +121,11 @@ int tipc_register_media(u32 media_type,
121 } 121 }
122 if ((bearer_priority < TIPC_MIN_LINK_PRI) && 122 if ((bearer_priority < TIPC_MIN_LINK_PRI) &&
123 (bearer_priority > TIPC_MAX_LINK_PRI)) { 123 (bearer_priority > TIPC_MAX_LINK_PRI)) {
124 warn("Media <%s> rejected, illegal priority (%u)\n", name, 124 warn("Media <%s> rejected, illegal priority (%u)\n", name,
125 bearer_priority); 125 bearer_priority);
126 goto exit; 126 goto exit;
127 } 127 }
128 if ((link_tolerance < TIPC_MIN_LINK_TOL) || 128 if ((link_tolerance < TIPC_MIN_LINK_TOL) ||
129 (link_tolerance > TIPC_MAX_LINK_TOL)) { 129 (link_tolerance > TIPC_MAX_LINK_TOL)) {
130 warn("Media <%s> rejected, illegal tolerance (%u)\n", name, 130 warn("Media <%s> rejected, illegal tolerance (%u)\n", name,
131 link_tolerance); 131 link_tolerance);
@@ -219,7 +219,7 @@ struct sk_buff *tipc_media_get_names(void)
219 219
220 read_lock_bh(&tipc_net_lock); 220 read_lock_bh(&tipc_net_lock);
221 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { 221 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
222 tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, 222 tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name,
223 strlen(m_ptr->name) + 1); 223 strlen(m_ptr->name) + 1);
224 } 224 }
225 read_unlock_bh(&tipc_net_lock); 225 read_unlock_bh(&tipc_net_lock);
@@ -230,11 +230,11 @@ struct sk_buff *tipc_media_get_names(void)
230 * bearer_name_validate - validate & (optionally) deconstruct bearer name 230 * bearer_name_validate - validate & (optionally) deconstruct bearer name
231 * @name - ptr to bearer name string 231 * @name - ptr to bearer name string
232 * @name_parts - ptr to area for bearer name components (or NULL if not needed) 232 * @name_parts - ptr to area for bearer name components (or NULL if not needed)
233 * 233 *
234 * Returns 1 if bearer name is valid, otherwise 0. 234 * Returns 1 if bearer name is valid, otherwise 0.
235 */ 235 */
236 236
237static int bearer_name_validate(const char *name, 237static int bearer_name_validate(const char *name,
238 struct bearer_name *name_parts) 238 struct bearer_name *name_parts)
239{ 239{
240 char name_copy[TIPC_MAX_BEARER_NAME]; 240 char name_copy[TIPC_MAX_BEARER_NAME];
@@ -262,8 +262,8 @@ static int bearer_name_validate(const char *name,
262 262
263 /* validate component parts of bearer name */ 263 /* validate component parts of bearer name */
264 264
265 if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || 265 if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) ||
266 (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || 266 (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) ||
267 (strspn(media_name, tipc_alphabet) != (media_len - 1)) || 267 (strspn(media_name, tipc_alphabet) != (media_len - 1)) ||
268 (strspn(if_name, tipc_alphabet) != (if_len - 1))) 268 (strspn(if_name, tipc_alphabet) != (if_len - 1)))
269 return 0; 269 return 0;
@@ -336,8 +336,8 @@ struct sk_buff *tipc_bearer_get_names(void)
336 for (j = 0; j < MAX_BEARERS; j++) { 336 for (j = 0; j < MAX_BEARERS; j++) {
337 b_ptr = &tipc_bearers[j]; 337 b_ptr = &tipc_bearers[j];
338 if (b_ptr->active && (b_ptr->media == m_ptr)) { 338 if (b_ptr->active && (b_ptr->media == m_ptr)) {
339 tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, 339 tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME,
340 b_ptr->publ.name, 340 b_ptr->publ.name,
341 strlen(b_ptr->publ.name) + 1); 341 strlen(b_ptr->publ.name) + 1);
342 } 342 }
343 } 343 }
@@ -401,8 +401,8 @@ void tipc_bearer_lock_push(struct bearer *b_ptr)
401 401
402 402
403/* 403/*
404 * Interrupt enabling new requests after bearer congestion or blocking: 404 * Interrupt enabling new requests after bearer congestion or blocking:
405 * See bearer_send(). 405 * See bearer_send().
406 */ 406 */
407void tipc_continue(struct tipc_bearer *tb_ptr) 407void tipc_continue(struct tipc_bearer *tb_ptr)
408{ 408{
@@ -417,9 +417,9 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
417} 417}
418 418
419/* 419/*
420 * Schedule link for sending of messages after the bearer 420 * Schedule link for sending of messages after the bearer
421 * has been deblocked by 'continue()'. This method is called 421 * has been deblocked by 'continue()'. This method is called
422 * when somebody tries to send a message via this link while 422 * when somebody tries to send a message via this link while
423 * the bearer is congested. 'tipc_net_lock' is in read_lock here 423 * the bearer is congested. 'tipc_net_lock' is in read_lock here
424 * bearer.lock is busy 424 * bearer.lock is busy
425 */ 425 */
@@ -430,9 +430,9 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p
430} 430}
431 431
432/* 432/*
433 * Schedule link for sending of messages after the bearer 433 * Schedule link for sending of messages after the bearer
434 * has been deblocked by 'continue()'. This method is called 434 * has been deblocked by 'continue()'. This method is called
435 * when somebody tries to send a message via this link while 435 * when somebody tries to send a message via this link while
436 * the bearer is congested. 'tipc_net_lock' is in read_lock here, 436 * the bearer is congested. 'tipc_net_lock' is in read_lock here,
437 * bearer.lock is free 437 * bearer.lock is free
438 */ 438 */
@@ -468,7 +468,7 @@ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr)
468 468
469/** 469/**
470 * tipc_enable_bearer - enable bearer with the given name 470 * tipc_enable_bearer - enable bearer with the given name
471 */ 471 */
472 472
473int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) 473int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
474{ 474{
@@ -490,7 +490,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
490 warn("Bearer <%s> rejected, illegal name\n", name); 490 warn("Bearer <%s> rejected, illegal name\n", name);
491 return -EINVAL; 491 return -EINVAL;
492 } 492 }
493 if (!tipc_addr_domain_valid(bcast_scope) || 493 if (!tipc_addr_domain_valid(bcast_scope) ||
494 !in_scope(bcast_scope, tipc_own_addr)) { 494 !in_scope(bcast_scope, tipc_own_addr)) {
495 warn("Bearer <%s> rejected, illegal broadcast scope\n", name); 495 warn("Bearer <%s> rejected, illegal broadcast scope\n", name);
496 return -EINVAL; 496 return -EINVAL;
@@ -539,7 +539,7 @@ restart:
539 } 539 }
540 } 540 }
541 if (bearer_id >= MAX_BEARERS) { 541 if (bearer_id >= MAX_BEARERS) {
542 warn("Bearer <%s> rejected, bearer limit reached (%u)\n", 542 warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
543 name, MAX_BEARERS); 543 name, MAX_BEARERS);
544 goto failed; 544 goto failed;
545 } 545 }
@@ -612,7 +612,7 @@ int tipc_block_bearer(const char *name)
612 612
613/** 613/**
614 * bearer_disable - 614 * bearer_disable -
615 * 615 *
616 * Note: This routine assumes caller holds tipc_net_lock. 616 * Note: This routine assumes caller holds tipc_net_lock.
617 */ 617 */
618 618
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index c4e7c1c3655b..6a36b6600e6c 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/bearer.h: Include file for TIPC bearer code 2 * net/tipc/bearer.h: Include file for TIPC bearer code
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -58,14 +58,14 @@
58 * @type_id: TIPC media identifier [defined in tipc_bearer.h] 58 * @type_id: TIPC media identifier [defined in tipc_bearer.h]
59 * @name: media name 59 * @name: media name
60 */ 60 */
61 61
62struct media { 62struct media {
63 int (*send_msg)(struct sk_buff *buf, 63 int (*send_msg)(struct sk_buff *buf,
64 struct tipc_bearer *b_ptr, 64 struct tipc_bearer *b_ptr,
65 struct tipc_media_addr *dest); 65 struct tipc_media_addr *dest);
66 int (*enable_bearer)(struct tipc_bearer *b_ptr); 66 int (*enable_bearer)(struct tipc_bearer *b_ptr);
67 void (*disable_bearer)(struct tipc_bearer *b_ptr); 67 void (*disable_bearer)(struct tipc_bearer *b_ptr);
68 char *(*addr2str)(struct tipc_media_addr *a, 68 char *(*addr2str)(struct tipc_media_addr *a,
69 char *str_buf, int str_size); 69 char *str_buf, int str_size);
70 struct tipc_media_addr bcast_addr; 70 struct tipc_media_addr bcast_addr;
71 int bcast; 71 int bcast;
@@ -91,7 +91,7 @@ struct media {
91 * @net_plane: network plane ('A' through 'H') currently associated with bearer 91 * @net_plane: network plane ('A' through 'H') currently associated with bearer
92 * @nodes: indicates which nodes in cluster can be reached through bearer 92 * @nodes: indicates which nodes in cluster can be reached through bearer
93 */ 93 */
94 94
95struct bearer { 95struct bearer {
96 struct tipc_bearer publ; 96 struct tipc_bearer publ;
97 struct media *media; 97 struct media *media;
@@ -131,21 +131,21 @@ void tipc_bearer_lock_push(struct bearer *b_ptr);
131 131
132 132
133/** 133/**
134 * tipc_bearer_send- sends buffer to destination over bearer 134 * tipc_bearer_send- sends buffer to destination over bearer
135 * 135 *
136 * Returns true (1) if successful, or false (0) if unable to send 136 * Returns true (1) if successful, or false (0) if unable to send
137 * 137 *
138 * IMPORTANT: 138 * IMPORTANT:
139 * The media send routine must not alter the buffer being passed in 139 * The media send routine must not alter the buffer being passed in
140 * as it may be needed for later retransmission! 140 * as it may be needed for later retransmission!
141 * 141 *
142 * If the media send routine returns a non-zero value (indicating that 142 * If the media send routine returns a non-zero value (indicating that
143 * it was unable to send the buffer), it must: 143 * it was unable to send the buffer), it must:
144 * 1) mark the bearer as blocked, 144 * 1) mark the bearer as blocked,
145 * 2) call tipc_continue() once the bearer is able to send again. 145 * 2) call tipc_continue() once the bearer is able to send again.
146 * Media types that are unable to meet these two critera must ensure their 146 * Media types that are unable to meet these two critera must ensure their
147 * send routine always returns success -- even if the buffer was not sent -- 147 * send routine always returns success -- even if the buffer was not sent --
148 * and let TIPC's link code deal with the undelivered message. 148 * and let TIPC's link code deal with the undelivered message.
149 */ 149 */
150 150
151static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf, 151static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf,
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index b46b5188a9fd..95b373913aa0 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/cluster.c: TIPC cluster management routines 2 * net/tipc/cluster.c: TIPC cluster management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -56,7 +56,7 @@ struct cluster *tipc_cltr_create(u32 addr)
56{ 56{
57 struct _zone *z_ptr; 57 struct _zone *z_ptr;
58 struct cluster *c_ptr; 58 struct cluster *c_ptr;
59 int max_nodes; 59 int max_nodes;
60 60
61 c_ptr = kzalloc(sizeof(*c_ptr), GFP_ATOMIC); 61 c_ptr = kzalloc(sizeof(*c_ptr), GFP_ATOMIC);
62 if (c_ptr == NULL) { 62 if (c_ptr == NULL) {
@@ -81,7 +81,7 @@ struct cluster *tipc_cltr_create(u32 addr)
81 tipc_local_nodes = c_ptr->nodes; 81 tipc_local_nodes = c_ptr->nodes;
82 c_ptr->highest_slave = LOWEST_SLAVE - 1; 82 c_ptr->highest_slave = LOWEST_SLAVE - 1;
83 c_ptr->highest_node = 0; 83 c_ptr->highest_node = 0;
84 84
85 z_ptr = tipc_zone_find(tipc_zone(addr)); 85 z_ptr = tipc_zone_find(tipc_zone(addr));
86 if (!z_ptr) { 86 if (!z_ptr) {
87 z_ptr = tipc_zone_create(addr); 87 z_ptr = tipc_zone_create(addr);
@@ -150,7 +150,7 @@ void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr)
150 150
151/** 151/**
152 * tipc_cltr_select_router - select router to a cluster 152 * tipc_cltr_select_router - select router to a cluster
153 * 153 *
154 * Uses deterministic and fair algorithm. 154 * Uses deterministic and fair algorithm.
155 */ 155 */
156 156
@@ -192,7 +192,7 @@ u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref)
192 192
193/** 193/**
194 * tipc_cltr_select_node - select destination node within a remote cluster 194 * tipc_cltr_select_node - select destination node within a remote cluster
195 * 195 *
196 * Uses deterministic and fair algorithm. 196 * Uses deterministic and fair algorithm.
197 */ 197 */
198 198
@@ -295,7 +295,7 @@ void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest)
295 msg_set_remote_node(msg, c_ptr->addr); 295 msg_set_remote_node(msg, c_ptr->addr);
296 msg_set_type(msg, SLAVE_ROUTING_TABLE); 296 msg_set_type(msg, SLAVE_ROUTING_TABLE);
297 for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) { 297 for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) {
298 if (c_ptr->nodes[n_num] && 298 if (c_ptr->nodes[n_num] &&
299 tipc_node_has_active_links(c_ptr->nodes[n_num])) { 299 tipc_node_has_active_links(c_ptr->nodes[n_num])) {
300 send = 1; 300 send = 1;
301 msg_set_dataoctet(msg, n_num); 301 msg_set_dataoctet(msg, n_num);
@@ -329,7 +329,7 @@ void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest)
329 msg_set_remote_node(msg, c_ptr->addr); 329 msg_set_remote_node(msg, c_ptr->addr);
330 msg_set_type(msg, EXT_ROUTING_TABLE); 330 msg_set_type(msg, EXT_ROUTING_TABLE);
331 for (n_num = 1; n_num <= highest; n_num++) { 331 for (n_num = 1; n_num <= highest; n_num++) {
332 if (c_ptr->nodes[n_num] && 332 if (c_ptr->nodes[n_num] &&
333 tipc_node_has_active_links(c_ptr->nodes[n_num])) { 333 tipc_node_has_active_links(c_ptr->nodes[n_num])) {
334 send = 1; 334 send = 1;
335 msg_set_dataoctet(msg, n_num); 335 msg_set_dataoctet(msg, n_num);
@@ -360,7 +360,7 @@ void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest)
360 msg_set_remote_node(msg, c_ptr->addr); 360 msg_set_remote_node(msg, c_ptr->addr);
361 msg_set_type(msg, LOCAL_ROUTING_TABLE); 361 msg_set_type(msg, LOCAL_ROUTING_TABLE);
362 for (n_num = 1; n_num <= highest; n_num++) { 362 for (n_num = 1; n_num <= highest; n_num++) {
363 if (c_ptr->nodes[n_num] && 363 if (c_ptr->nodes[n_num] &&
364 tipc_node_has_active_links(c_ptr->nodes[n_num])) { 364 tipc_node_has_active_links(c_ptr->nodes[n_num])) {
365 send = 1; 365 send = 1;
366 msg_set_dataoctet(msg, n_num); 366 msg_set_dataoctet(msg, n_num);
@@ -492,7 +492,7 @@ void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router)
492} 492}
493 493
494/** 494/**
495 * tipc_cltr_multicast - multicast message to local nodes 495 * tipc_cltr_multicast - multicast message to local nodes
496 */ 496 */
497 497
498static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, 498static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
@@ -554,9 +554,9 @@ void tipc_cltr_broadcast(struct sk_buff *buf)
554 buf_copy = skb_copy(buf, GFP_ATOMIC); 554 buf_copy = skb_copy(buf, GFP_ATOMIC);
555 if (buf_copy == NULL) 555 if (buf_copy == NULL)
556 goto exit; 556 goto exit;
557 msg_set_destnode(buf_msg(buf_copy), 557 msg_set_destnode(buf_msg(buf_copy),
558 n_ptr->addr); 558 n_ptr->addr);
559 tipc_link_send(buf_copy, n_ptr->addr, 559 tipc_link_send(buf_copy, n_ptr->addr,
560 n_ptr->addr); 560 n_ptr->addr);
561 } 561 }
562 } 562 }
diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h
index 1b4cd309495a..62df074afaec 100644
--- a/net/tipc/cluster.h
+++ b/net/tipc/cluster.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/cluster.h: Include file for TIPC cluster management routines 2 * net/tipc/cluster.h: Include file for TIPC cluster management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -50,7 +50,7 @@
50 * @highest_node: id of highest numbered node within cluster 50 * @highest_node: id of highest numbered node within cluster
51 * @highest_slave: (used for secondary node support) 51 * @highest_slave: (used for secondary node support)
52 */ 52 */
53 53
54struct cluster { 54struct cluster {
55 u32 addr; 55 u32 addr;
56 struct _zone *owner; 56 struct _zone *owner;
diff --git a/net/tipc/config.c b/net/tipc/config.c
index baf55c459c8b..14789a82de53 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/config.c: TIPC configuration management code 2 * net/tipc/config.c: TIPC configuration management code
3 * 3 *
4 * Copyright (c) 2002-2006, Ericsson AB 4 * Copyright (c) 2002-2006, Ericsson AB
5 * Copyright (c) 2004-2006, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -86,7 +86,7 @@ struct sk_buff *tipc_cfg_reply_alloc(int payload_size)
86 return buf; 86 return buf;
87} 87}
88 88
89int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, 89int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
90 void *tlv_data, int tlv_data_size) 90 void *tlv_data, int tlv_data_size)
91{ 91{
92 struct tlv_desc *tlv = (struct tlv_desc *)buf->tail; 92 struct tlv_desc *tlv = (struct tlv_desc *)buf->tail;
@@ -112,7 +112,7 @@ struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
112 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); 112 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value)));
113 if (buf) { 113 if (buf) {
114 value_net = htonl(value); 114 value_net = htonl(value);
115 tipc_cfg_append_tlv(buf, tlv_type, &value_net, 115 tipc_cfg_append_tlv(buf, tlv_type, &value_net,
116 sizeof(value_net)); 116 sizeof(value_net));
117 } 117 }
118 return buf; 118 return buf;
@@ -182,7 +182,7 @@ int tipc_cfg_cmd(const struct tipc_cmd_msg * msg,
182 182
183static void cfg_cmd_event(struct tipc_cmd_msg *msg, 183static void cfg_cmd_event(struct tipc_cmd_msg *msg,
184 char *data, 184 char *data,
185 u32 sz, 185 u32 sz,
186 struct tipc_portid const *orig) 186 struct tipc_portid const *orig)
187{ 187{
188 int rv = -EINVAL; 188 int rv = -EINVAL;
@@ -192,7 +192,7 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg,
192 192
193 msg->cmd = ntohl(msg->cmd); 193 msg->cmd = ntohl(msg->cmd);
194 194
195 cfg_prepare_res_msg(msg->cmd, msg->usr_handle, rv, &rmsg, msg_sect, 195 cfg_prepare_res_msg(msg->cmd, msg->usr_handle, rv, &rmsg, msg_sect,
196 data, 0); 196 data, 0);
197 if (ntohl(msg->magic) != TIPC_MAGIC) 197 if (ntohl(msg->magic) != TIPC_MAGIC)
198 goto exit; 198 goto exit;
@@ -295,7 +295,7 @@ static struct sk_buff *cfg_set_own_addr(void)
295 " (cannot change node address once assigned)"); 295 " (cannot change node address once assigned)");
296 tipc_own_addr = addr; 296 tipc_own_addr = addr;
297 297
298 /* 298 /*
299 * Must release all spinlocks before calling start_net() because 299 * Must release all spinlocks before calling start_net() because
300 * Linux version of TIPC calls eth_media_start() which calls 300 * Linux version of TIPC calls eth_media_start() which calls
301 * register_netdevice_notifier() which may block! 301 * register_netdevice_notifier() which may block!
@@ -619,7 +619,7 @@ static void cfg_named_msg_event(void *userdata,
619 struct sk_buff **buf, 619 struct sk_buff **buf,
620 const unchar *msg, 620 const unchar *msg,
621 u32 size, 621 u32 size,
622 u32 importance, 622 u32 importance,
623 struct tipc_portid const *orig, 623 struct tipc_portid const *orig,
624 struct tipc_name_seq const *dest) 624 struct tipc_name_seq const *dest)
625{ 625{
@@ -640,7 +640,7 @@ static void cfg_named_msg_event(void *userdata,
640 /* Generate reply for request (if can't, return request) */ 640 /* Generate reply for request (if can't, return request) */
641 641
642 rep_buf = tipc_cfg_do_cmd(orig->node, 642 rep_buf = tipc_cfg_do_cmd(orig->node,
643 ntohs(req_hdr->tcm_type), 643 ntohs(req_hdr->tcm_type),
644 msg + sizeof(*req_hdr), 644 msg + sizeof(*req_hdr),
645 size - sizeof(*req_hdr), 645 size - sizeof(*req_hdr),
646 BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr)); 646 BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr));
diff --git a/net/tipc/config.h b/net/tipc/config.h
index 7a728f954d84..5cd7cc56c54d 100644
--- a/net/tipc/config.h
+++ b/net/tipc/config.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/config.h: Include file for TIPC configuration service code 2 * net/tipc/config.h: Include file for TIPC configuration service code
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -43,7 +43,7 @@
43#include "link.h" 43#include "link.h"
44 44
45struct sk_buff *tipc_cfg_reply_alloc(int payload_size); 45struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
46int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, 46int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
47 void *tlv_data, int tlv_data_size); 47 void *tlv_data, int tlv_data_size);
48struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value); 48struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
49struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string); 49struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
@@ -68,8 +68,8 @@ static inline struct sk_buff *tipc_cfg_reply_ultra_string(char *string)
68 return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); 68 return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string);
69} 69}
70 70
71struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, 71struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd,
72 const void *req_tlv_area, int req_tlv_space, 72 const void *req_tlv_area, int req_tlv_space,
73 int headroom); 73 int headroom);
74 74
75void tipc_cfg_link_event(u32 addr, char *name, int up); 75void tipc_cfg_link_event(u32 addr, char *name, int up);
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 6f5b7ee31180..d2d7d32c02c7 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -89,7 +89,7 @@ int tipc_mode = TIPC_NOT_RUNNING;
89int tipc_random; 89int tipc_random;
90atomic_t tipc_user_count = ATOMIC_INIT(0); 90atomic_t tipc_user_count = ATOMIC_INIT(0);
91 91
92const char tipc_alphabet[] = 92const char tipc_alphabet[] =
93 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."; 93 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
94 94
95/* configurable TIPC parameters */ 95/* configurable TIPC parameters */
@@ -171,13 +171,13 @@ int tipc_core_start(void)
171 get_random_bytes(&tipc_random, sizeof(tipc_random)); 171 get_random_bytes(&tipc_random, sizeof(tipc_random));
172 tipc_mode = TIPC_NODE_MODE; 172 tipc_mode = TIPC_NODE_MODE;
173 173
174 if ((res = tipc_handler_start()) || 174 if ((res = tipc_handler_start()) ||
175 (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions, 175 (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions,
176 tipc_random)) || 176 tipc_random)) ||
177 (res = tipc_reg_start()) || 177 (res = tipc_reg_start()) ||
178 (res = tipc_nametbl_init()) || 178 (res = tipc_nametbl_init()) ||
179 (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) || 179 (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) ||
180 (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) || 180 (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) ||
181 (res = tipc_netlink_start()) || 181 (res = tipc_netlink_start()) ||
182 (res = tipc_socket_init())) { 182 (res = tipc_socket_init())) {
183 tipc_core_stop(); 183 tipc_core_stop();
@@ -191,7 +191,7 @@ static int __init tipc_init(void)
191 int res; 191 int res;
192 192
193 tipc_log_reinit(CONFIG_TIPC_LOG); 193 tipc_log_reinit(CONFIG_TIPC_LOG);
194 info("Activated (version " TIPC_MOD_VER 194 info("Activated (version " TIPC_MOD_VER
195 " compiled " __DATE__ " " __TIME__ ")\n"); 195 " compiled " __DATE__ " " __TIME__ ")\n");
196 196
197 tipc_own_addr = 0; 197 tipc_own_addr = 0;
@@ -207,9 +207,9 @@ static int __init tipc_init(void)
207 207
208 if ((res = tipc_core_start())) 208 if ((res = tipc_core_start()))
209 err("Unable to start in single node mode\n"); 209 err("Unable to start in single node mode\n");
210 else 210 else
211 info("Started in single node mode\n"); 211 info("Started in single node mode\n");
212 return res; 212 return res;
213} 213}
214 214
215static void __exit tipc_exit(void) 215static void __exit tipc_exit(void)
@@ -268,11 +268,11 @@ EXPORT_SYMBOL(tipc_available_nodes);
268/* TIPC API for external bearers (see tipc_bearer.h) */ 268/* TIPC API for external bearers (see tipc_bearer.h) */
269 269
270EXPORT_SYMBOL(tipc_block_bearer); 270EXPORT_SYMBOL(tipc_block_bearer);
271EXPORT_SYMBOL(tipc_continue); 271EXPORT_SYMBOL(tipc_continue);
272EXPORT_SYMBOL(tipc_disable_bearer); 272EXPORT_SYMBOL(tipc_disable_bearer);
273EXPORT_SYMBOL(tipc_enable_bearer); 273EXPORT_SYMBOL(tipc_enable_bearer);
274EXPORT_SYMBOL(tipc_recv_msg); 274EXPORT_SYMBOL(tipc_recv_msg);
275EXPORT_SYMBOL(tipc_register_media); 275EXPORT_SYMBOL(tipc_register_media);
276 276
277/* TIPC API for external APIs (see tipc_port.h) */ 277/* TIPC API for external APIs (see tipc_port.h) */
278 278
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 4638947c2326..e40ada964d6e 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/core.h: Include file for TIPC global declarations 2 * net/tipc/core.h: Include file for TIPC global declarations
3 * 3 *
4 * Copyright (c) 2005-2006, Ericsson AB 4 * Copyright (c) 2005-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -54,7 +54,7 @@
54#include <asm/atomic.h> 54#include <asm/atomic.h>
55#include <asm/hardirq.h> 55#include <asm/hardirq.h>
56#include <linux/netdevice.h> 56#include <linux/netdevice.h>
57#include <linux/in.h> 57#include <linux/in.h>
58#include <linux/list.h> 58#include <linux/list.h>
59#include <linux/vmalloc.h> 59#include <linux/vmalloc.h>
60 60
@@ -88,7 +88,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
88#define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) 88#define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0)
89 89
90 90
91/* 91/*
92 * By default, TIPC_OUTPUT is defined to be system console and TIPC log buffer, 92 * By default, TIPC_OUTPUT is defined to be system console and TIPC log buffer,
93 * while DBG_OUTPUT is the null print buffer. These defaults can be changed 93 * while DBG_OUTPUT is the null print buffer. These defaults can be changed
94 * here, or on a per .c file basis, by redefining these symbols. The following 94 * here, or on a per .c file basis, by redefining these symbols. The following
@@ -126,9 +126,9 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
126#define dump(fmt,arg...) do {} while (0) 126#define dump(fmt,arg...) do {} while (0)
127 127
128 128
129/* 129/*
130 * TIPC_OUTPUT is defined to be the system console, while DBG_OUTPUT is 130 * TIPC_OUTPUT is defined to be the system console, while DBG_OUTPUT is
131 * the null print buffer. Thes ensures that any system or debug messages 131 * the null print buffer. Thes ensures that any system or debug messages
132 * that are generated without using the above macros are handled correctly. 132 * that are generated without using the above macros are handled correctly.
133 */ 133 */
134 134
@@ -138,10 +138,10 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
138#undef DBG_OUTPUT 138#undef DBG_OUTPUT
139#define DBG_OUTPUT TIPC_NULL 139#define DBG_OUTPUT TIPC_NULL
140 140
141#endif 141#endif
142 142
143 143
144/* 144/*
145 * TIPC-specific error codes 145 * TIPC-specific error codes
146 */ 146 */
147 147
@@ -204,11 +204,11 @@ u32 tipc_k_signal(Handler routine, unsigned long argument);
204 * @timer: pointer to timer structure 204 * @timer: pointer to timer structure
205 * @routine: pointer to routine to invoke when timer expires 205 * @routine: pointer to routine to invoke when timer expires
206 * @argument: value to pass to routine when timer expires 206 * @argument: value to pass to routine when timer expires
207 * 207 *
208 * Timer must be initialized before use (and terminated when no longer needed). 208 * Timer must be initialized before use (and terminated when no longer needed).
209 */ 209 */
210 210
211static inline void k_init_timer(struct timer_list *timer, Handler routine, 211static inline void k_init_timer(struct timer_list *timer, Handler routine,
212 unsigned long argument) 212 unsigned long argument)
213{ 213{
214 dbg("initializing timer %p\n", timer); 214 dbg("initializing timer %p\n", timer);
@@ -221,13 +221,13 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine,
221 * k_start_timer - start a timer 221 * k_start_timer - start a timer
222 * @timer: pointer to timer structure 222 * @timer: pointer to timer structure
223 * @msec: time to delay (in ms) 223 * @msec: time to delay (in ms)
224 * 224 *
225 * Schedules a previously initialized timer for later execution. 225 * Schedules a previously initialized timer for later execution.
226 * If timer is already running, the new timeout overrides the previous request. 226 * If timer is already running, the new timeout overrides the previous request.
227 * 227 *
228 * To ensure the timer doesn't expire before the specified delay elapses, 228 * To ensure the timer doesn't expire before the specified delay elapses,
229 * the amount of delay is rounded up when converting to the jiffies 229 * the amount of delay is rounded up when converting to the jiffies
230 * then an additional jiffy is added to account for the fact that 230 * then an additional jiffy is added to account for the fact that
231 * the starting time may be in the middle of the current jiffy. 231 * the starting time may be in the middle of the current jiffy.
232 */ 232 */
233 233
@@ -240,10 +240,10 @@ static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
240/** 240/**
241 * k_cancel_timer - cancel a timer 241 * k_cancel_timer - cancel a timer
242 * @timer: pointer to timer structure 242 * @timer: pointer to timer structure
243 * 243 *
244 * Cancels a previously initialized timer. 244 * Cancels a previously initialized timer.
245 * Can be called safely even if the timer is already inactive. 245 * Can be called safely even if the timer is already inactive.
246 * 246 *
247 * WARNING: Must not be called when holding locks required by the timer's 247 * WARNING: Must not be called when holding locks required by the timer's
248 * timeout routine, otherwise deadlock can occur on SMP systems! 248 * timeout routine, otherwise deadlock can occur on SMP systems!
249 */ 249 */
@@ -257,11 +257,11 @@ static inline void k_cancel_timer(struct timer_list *timer)
257/** 257/**
258 * k_term_timer - terminate a timer 258 * k_term_timer - terminate a timer
259 * @timer: pointer to timer structure 259 * @timer: pointer to timer structure
260 * 260 *
261 * Prevents further use of a previously initialized timer. 261 * Prevents further use of a previously initialized timer.
262 * 262 *
263 * WARNING: Caller must ensure timer isn't currently running. 263 * WARNING: Caller must ensure timer isn't currently running.
264 * 264 *
265 * (Do not "enhance" this routine to automatically cancel an active timer, 265 * (Do not "enhance" this routine to automatically cancel an active timer,
266 * otherwise deadlock can arise when a timeout routine calls k_term_timer.) 266 * otherwise deadlock can arise when a timeout routine calls k_term_timer.)
267 */ 267 */
@@ -302,7 +302,7 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
302 * @size: message size (including TIPC header) 302 * @size: message size (including TIPC header)
303 * 303 *
304 * Returns a new buffer with data pointers set to the specified size. 304 * Returns a new buffer with data pointers set to the specified size.
305 * 305 *
306 * NOTE: Headroom is reserved to allow prepending of a data link header. 306 * NOTE: Headroom is reserved to allow prepending of a data link header.
307 * There may also be unrequested tailroom present at the buffer's end. 307 * There may also be unrequested tailroom present at the buffer's end.
308 */ 308 */
@@ -334,4 +334,4 @@ static inline void buf_discard(struct sk_buff *skb)
334 kfree_skb(skb); 334 kfree_skb(skb);
335} 335}
336 336
337#endif 337#endif
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index 627f99b7afdf..e809d2a2ce06 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/dbg.c: TIPC print buffer routines for debugging 2 * net/tipc/dbg.c: TIPC print buffer routines for debugging
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -123,34 +123,34 @@ int tipc_printbuf_empty(struct print_buf *pb)
123/** 123/**
124 * tipc_printbuf_validate - check for print buffer overflow 124 * tipc_printbuf_validate - check for print buffer overflow
125 * @pb: pointer to print buffer structure 125 * @pb: pointer to print buffer structure
126 * 126 *
127 * Verifies that a print buffer has captured all data written to it. 127 * Verifies that a print buffer has captured all data written to it.
128 * If data has been lost, linearize buffer and prepend an error message 128 * If data has been lost, linearize buffer and prepend an error message
129 * 129 *
130 * Returns length of print buffer data string (including trailing NUL) 130 * Returns length of print buffer data string (including trailing NUL)
131 */ 131 */
132 132
133int tipc_printbuf_validate(struct print_buf *pb) 133int tipc_printbuf_validate(struct print_buf *pb)
134{ 134{
135 char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; 135 char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n";
136 char *cp_buf; 136 char *cp_buf;
137 struct print_buf cb; 137 struct print_buf cb;
138 138
139 if (!pb->buf) 139 if (!pb->buf)
140 return 0; 140 return 0;
141 141
142 if (pb->buf[pb->size - 1] == 0) { 142 if (pb->buf[pb->size - 1] == 0) {
143 cp_buf = kmalloc(pb->size, GFP_ATOMIC); 143 cp_buf = kmalloc(pb->size, GFP_ATOMIC);
144 if (cp_buf != NULL){ 144 if (cp_buf != NULL){
145 tipc_printbuf_init(&cb, cp_buf, pb->size); 145 tipc_printbuf_init(&cb, cp_buf, pb->size);
146 tipc_printbuf_move(&cb, pb); 146 tipc_printbuf_move(&cb, pb);
147 tipc_printbuf_move(pb, &cb); 147 tipc_printbuf_move(pb, &cb);
148 kfree(cp_buf); 148 kfree(cp_buf);
149 memcpy(pb->buf, err, strlen(err)); 149 memcpy(pb->buf, err, strlen(err));
150 } else { 150 } else {
151 tipc_printbuf_reset(pb); 151 tipc_printbuf_reset(pb);
152 tipc_printf(pb, err); 152 tipc_printf(pb, err);
153 } 153 }
154 } 154 }
155 return (pb->crs - pb->buf + 1); 155 return (pb->crs - pb->buf + 1);
156} 156}
@@ -159,7 +159,7 @@ int tipc_printbuf_validate(struct print_buf *pb)
159 * tipc_printbuf_move - move print buffer contents to another print buffer 159 * tipc_printbuf_move - move print buffer contents to another print buffer
160 * @pb_to: pointer to destination print buffer structure 160 * @pb_to: pointer to destination print buffer structure
161 * @pb_from: pointer to source print buffer structure 161 * @pb_from: pointer to source print buffer structure
162 * 162 *
163 * Current contents of destination print buffer (if any) are discarded. 163 * Current contents of destination print buffer (if any) are discarded.
164 * Source print buffer becomes empty if a successful move occurs. 164 * Source print buffer becomes empty if a successful move occurs.
165 */ 165 */
@@ -234,13 +234,13 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
234 pb->crs = pb->buf + pb->size - 1; 234 pb->crs = pb->buf + pb->size - 1;
235 } else { 235 } else {
236 strcpy(pb->buf, print_string + chars_left); 236 strcpy(pb->buf, print_string + chars_left);
237 save_char = print_string[chars_left]; 237 save_char = print_string[chars_left];
238 print_string[chars_left] = 0; 238 print_string[chars_left] = 0;
239 strcpy(pb->crs, print_string); 239 strcpy(pb->crs, print_string);
240 print_string[chars_left] = save_char; 240 print_string[chars_left] = save_char;
241 pb->crs = pb->buf + chars_to_add - chars_left; 241 pb->crs = pb->buf + chars_to_add - chars_left;
242 } 242 }
243 } 243 }
244 pb_next = pb->next; 244 pb_next = pb->next;
245 pb->next = NULL; 245 pb->next = NULL;
246 pb = pb_next; 246 pb = pb_next;
@@ -249,7 +249,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
249} 249}
250 250
251/** 251/**
252 * TIPC_TEE - perform next output operation on both print buffers 252 * TIPC_TEE - perform next output operation on both print buffers
253 * @b0: pointer to chain of print buffers (may be NULL) 253 * @b0: pointer to chain of print buffers (may be NULL)
254 * @b1: pointer to print buffer to add to chain 254 * @b1: pointer to print buffer to add to chain
255 * 255 *
@@ -350,7 +350,7 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...)
350} 350}
351 351
352/** 352/**
353 * tipc_log_stop - free up TIPC log print buffer 353 * tipc_log_stop - free up TIPC log print buffer
354 */ 354 */
355 355
356void tipc_log_stop(void) 356void tipc_log_stop(void)
diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h
index 467c0bc78a79..c01b085000e0 100644
--- a/net/tipc/dbg.h
+++ b/net/tipc/dbg.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/dbg.h: Include file for TIPC print buffer routines 2 * net/tipc/dbg.h: Include file for TIPC print buffer routines
3 * 3 *
4 * Copyright (c) 1997-2006, Ericsson AB 4 * Copyright (c) 1997-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 3b0cd12f37da..5d643e5721eb 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/discover.c 2 * net/tipc/discover.c
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -56,10 +56,10 @@
56#define CHECK_LINK_COUNT 306 56#define CHECK_LINK_COUNT 306
57#endif 57#endif
58 58
59/* 59/*
60 * TODO: Most of the inter-cluster setup stuff should be 60 * TODO: Most of the inter-cluster setup stuff should be
61 * rewritten, and be made conformant with specification. 61 * rewritten, and be made conformant with specification.
62 */ 62 */
63 63
64 64
65/** 65/**
@@ -80,10 +80,10 @@ struct link_req {
80 80
81 81
82#if 0 82#if 0
83int disc_create_link(const struct tipc_link_create *argv) 83int disc_create_link(const struct tipc_link_create *argv)
84{ 84{
85 /* 85 /*
86 * Code for inter cluster link setup here 86 * Code for inter cluster link setup here
87 */ 87 */
88 return TIPC_OK; 88 return TIPC_OK;
89} 89}
@@ -93,16 +93,16 @@ int disc_create_link(const struct tipc_link_create *argv)
93 * disc_lost_link(): A link has lost contact 93 * disc_lost_link(): A link has lost contact
94 */ 94 */
95 95
96void tipc_disc_link_event(u32 addr, char *name, int up) 96void tipc_disc_link_event(u32 addr, char *name, int up)
97{ 97{
98 if (in_own_cluster(addr)) 98 if (in_own_cluster(addr))
99 return; 99 return;
100 /* 100 /*
101 * Code for inter cluster link setup here 101 * Code for inter cluster link setup here
102 */ 102 */
103} 103}
104 104
105/** 105/**
106 * tipc_disc_init_msg - initialize a link setup message 106 * tipc_disc_init_msg - initialize a link setup message
107 * @type: message type (request or response) 107 * @type: message type (request or response)
108 * @req_links: number of links associated with message 108 * @req_links: number of links associated with message
@@ -210,7 +210,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
210 dbg("creating link\n"); 210 dbg("creating link\n");
211 link = tipc_link_create(b_ptr, orig, &media_addr); 211 link = tipc_link_create(b_ptr, orig, &media_addr);
212 if (!link) { 212 if (!link) {
213 spin_unlock_bh(&n_ptr->lock); 213 spin_unlock_bh(&n_ptr->lock);
214 return; 214 return;
215 } 215 }
216 } 216 }
@@ -224,10 +224,10 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
224 warn("Resetting link <%s>, peer interface address changed\n", 224 warn("Resetting link <%s>, peer interface address changed\n",
225 link->name); 225 link->name);
226 memcpy(addr, &media_addr, sizeof(*addr)); 226 memcpy(addr, &media_addr, sizeof(*addr));
227 tipc_link_reset(link); 227 tipc_link_reset(link);
228 } 228 }
229 link_fully_up = (link->state == WORKING_WORKING); 229 link_fully_up = (link->state == WORKING_WORKING);
230 spin_unlock_bh(&n_ptr->lock); 230 spin_unlock_bh(&n_ptr->lock);
231 if ((type == DSC_RESP_MSG) || link_fully_up) 231 if ((type == DSC_RESP_MSG) || link_fully_up)
232 return; 232 return;
233 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); 233 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr);
@@ -244,23 +244,23 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
244 * @req: ptr to link request structure 244 * @req: ptr to link request structure
245 */ 245 */
246 246
247void tipc_disc_stop_link_req(struct link_req *req) 247void tipc_disc_stop_link_req(struct link_req *req)
248{ 248{
249 if (!req) 249 if (!req)
250 return; 250 return;
251 251
252 k_cancel_timer(&req->timer); 252 k_cancel_timer(&req->timer);
253 k_term_timer(&req->timer); 253 k_term_timer(&req->timer);
254 buf_discard(req->buf); 254 buf_discard(req->buf);
255 kfree(req); 255 kfree(req);
256} 256}
257 257
258/** 258/**
259 * tipc_disc_update_link_req - update frequency of periodic link setup requests 259 * tipc_disc_update_link_req - update frequency of periodic link setup requests
260 * @req: ptr to link request structure 260 * @req: ptr to link request structure
261 */ 261 */
262 262
263void tipc_disc_update_link_req(struct link_req *req) 263void tipc_disc_update_link_req(struct link_req *req)
264{ 264{
265 if (!req) 265 if (!req)
266 return; 266 return;
@@ -278,16 +278,16 @@ void tipc_disc_update_link_req(struct link_req *req)
278 } else { 278 } else {
279 /* leave timer "as is" if haven't yet reached a "normal" rate */ 279 /* leave timer "as is" if haven't yet reached a "normal" rate */
280 } 280 }
281} 281}
282 282
283/** 283/**
284 * disc_timeout - send a periodic link setup request 284 * disc_timeout - send a periodic link setup request
285 * @req: ptr to link request structure 285 * @req: ptr to link request structure
286 * 286 *
287 * Called whenever a link setup request timer associated with a bearer expires. 287 * Called whenever a link setup request timer associated with a bearer expires.
288 */ 288 */
289 289
290static void disc_timeout(struct link_req *req) 290static void disc_timeout(struct link_req *req)
291{ 291{
292 spin_lock_bh(&req->bearer->publ.lock); 292 spin_lock_bh(&req->bearer->publ.lock);
293 293
@@ -300,7 +300,7 @@ static void disc_timeout(struct link_req *req)
300 req->timer_intv *= 2; 300 req->timer_intv *= 2;
301 if (req->timer_intv > TIPC_LINK_REQ_FAST) 301 if (req->timer_intv > TIPC_LINK_REQ_FAST)
302 req->timer_intv = TIPC_LINK_REQ_FAST; 302 req->timer_intv = TIPC_LINK_REQ_FAST;
303 if ((req->timer_intv == TIPC_LINK_REQ_FAST) && 303 if ((req->timer_intv == TIPC_LINK_REQ_FAST) &&
304 (req->bearer->nodes.count)) 304 (req->bearer->nodes.count))
305 req->timer_intv = TIPC_LINK_REQ_SLOW; 305 req->timer_intv = TIPC_LINK_REQ_SLOW;
306 } 306 }
@@ -315,14 +315,14 @@ static void disc_timeout(struct link_req *req)
315 * @dest: destination address for request messages 315 * @dest: destination address for request messages
316 * @dest_domain: network domain of node(s) which should respond to message 316 * @dest_domain: network domain of node(s) which should respond to message
317 * @req_links: max number of desired links 317 * @req_links: max number of desired links
318 * 318 *
319 * Returns pointer to link request structure, or NULL if unable to create. 319 * Returns pointer to link request structure, or NULL if unable to create.
320 */ 320 */
321 321
322struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, 322struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
323 const struct tipc_media_addr *dest, 323 const struct tipc_media_addr *dest,
324 u32 dest_domain, 324 u32 dest_domain,
325 u32 req_links) 325 u32 req_links)
326{ 326{
327 struct link_req *req; 327 struct link_req *req;
328 328
@@ -342,5 +342,5 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
342 k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req); 342 k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req);
343 k_start_timer(&req->timer, req->timer_intv); 343 k_start_timer(&req->timer, req->timer_intv);
344 return req; 344 return req;
345} 345}
346 346
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index 0454fd1ae7f3..9fd7587b143a 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -41,7 +41,7 @@
41 41
42struct link_req; 42struct link_req;
43 43
44struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, 44struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
45 const struct tipc_media_addr *dest, 45 const struct tipc_media_addr *dest,
46 u32 dest_domain, 46 u32 dest_domain,
47 u32 req_links); 47 u32 req_links);
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 682da4a28041..9be4839e32c5 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/eth_media.c: Ethernet bearer support for TIPC 2 * net/tipc/eth_media.c: Ethernet bearer support for TIPC
3 * 3 *
4 * Copyright (c) 2001-2006, Ericsson AB 4 * Copyright (c) 2001-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -50,7 +50,7 @@
50 * @dev: ptr to associated Ethernet network device 50 * @dev: ptr to associated Ethernet network device
51 * @tipc_packet_type: used in binding TIPC to Ethernet driver 51 * @tipc_packet_type: used in binding TIPC to Ethernet driver
52 */ 52 */
53 53
54struct eth_bearer { 54struct eth_bearer {
55 struct tipc_bearer *bearer; 55 struct tipc_bearer *bearer;
56 struct net_device *dev; 56 struct net_device *dev;
@@ -62,10 +62,10 @@ static int eth_started = 0;
62static struct notifier_block notifier; 62static struct notifier_block notifier;
63 63
64/** 64/**
65 * send_msg - send a TIPC message out over an Ethernet interface 65 * send_msg - send a TIPC message out over an Ethernet interface
66 */ 66 */
67 67
68static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, 68static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
69 struct tipc_media_addr *dest) 69 struct tipc_media_addr *dest)
70{ 70{
71 struct sk_buff *clone; 71 struct sk_buff *clone;
@@ -76,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
76 clone->nh.raw = clone->data; 76 clone->nh.raw = clone->data;
77 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; 77 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev;
78 clone->dev = dev; 78 clone->dev = dev;
79 dev->hard_header(clone, dev, ETH_P_TIPC, 79 dev->hard_header(clone, dev, ETH_P_TIPC,
80 &dest->dev_addr.eth_addr, 80 &dest->dev_addr.eth_addr,
81 dev->dev_addr, clone->len); 81 dev->dev_addr, clone->len);
82 dev_queue_xmit(clone); 82 dev_queue_xmit(clone);
@@ -86,12 +86,12 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
86 86
87/** 87/**
88 * recv_msg - handle incoming TIPC message from an Ethernet interface 88 * recv_msg - handle incoming TIPC message from an Ethernet interface
89 * 89 *
90 * Routine truncates any Ethernet padding/CRC appended to the message, 90 * Routine truncates any Ethernet padding/CRC appended to the message,
91 * and ensures message size matches actual length 91 * and ensures message size matches actual length
92 */ 92 */
93 93
94static int recv_msg(struct sk_buff *buf, struct net_device *dev, 94static int recv_msg(struct sk_buff *buf, struct net_device *dev,
95 struct packet_type *pt, struct net_device *orig_dev) 95 struct packet_type *pt, struct net_device *orig_dev)
96{ 96{
97 struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; 97 struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv;
@@ -99,14 +99,14 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
99 99
100 if (likely(eb_ptr->bearer)) { 100 if (likely(eb_ptr->bearer)) {
101 if (likely(!dev->promiscuity) || 101 if (likely(!dev->promiscuity) ||
102 !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || 102 !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) ||
103 !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { 103 !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) {
104 size = msg_size((struct tipc_msg *)buf->data); 104 size = msg_size((struct tipc_msg *)buf->data);
105 skb_trim(buf, size); 105 skb_trim(buf, size);
106 if (likely(buf->len == size)) { 106 if (likely(buf->len == size)) {
107 buf->next = NULL; 107 buf->next = NULL;
108 tipc_recv_msg(buf, eb_ptr->bearer); 108 tipc_recv_msg(buf, eb_ptr->bearer);
109 return TIPC_OK; 109 return TIPC_OK;
110 } 110 }
111 } 111 }
112 } 112 }
@@ -115,7 +115,7 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
115} 115}
116 116
117/** 117/**
118 * enable_bearer - attach TIPC bearer to an Ethernet interface 118 * enable_bearer - attach TIPC bearer to an Ethernet interface
119 */ 119 */
120 120
121static int enable_bearer(struct tipc_bearer *tb_ptr) 121static int enable_bearer(struct tipc_bearer *tb_ptr)
@@ -127,7 +127,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
127 127
128 /* Find device with specified name */ 128 /* Find device with specified name */
129 129
130 while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { 130 while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) {
131 dev = dev->next; 131 dev = dev->next;
132 } 132 }
133 if (!dev) 133 if (!dev)
@@ -154,14 +154,14 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
154 eb_ptr->bearer = tb_ptr; 154 eb_ptr->bearer = tb_ptr;
155 tb_ptr->usr_handle = (void *)eb_ptr; 155 tb_ptr->usr_handle = (void *)eb_ptr;
156 tb_ptr->mtu = dev->mtu; 156 tb_ptr->mtu = dev->mtu;
157 tb_ptr->blocked = 0; 157 tb_ptr->blocked = 0;
158 tb_ptr->addr.type = htonl(TIPC_MEDIA_TYPE_ETH); 158 tb_ptr->addr.type = htonl(TIPC_MEDIA_TYPE_ETH);
159 memcpy(&tb_ptr->addr.dev_addr, &dev->dev_addr, ETH_ALEN); 159 memcpy(&tb_ptr->addr.dev_addr, &dev->dev_addr, ETH_ALEN);
160 return 0; 160 return 0;
161} 161}
162 162
163/** 163/**
164 * disable_bearer - detach TIPC bearer from an Ethernet interface 164 * disable_bearer - detach TIPC bearer from an Ethernet interface
165 * 165 *
166 * We really should do dev_remove_pack() here, but this function can not be 166 * We really should do dev_remove_pack() here, but this function can not be
167 * called at tasklet level. => Use eth_bearer->bearer as a flag to throw away 167 * called at tasklet level. => Use eth_bearer->bearer as a flag to throw away
@@ -176,11 +176,11 @@ static void disable_bearer(struct tipc_bearer *tb_ptr)
176/** 176/**
177 * recv_notification - handle device updates from OS 177 * recv_notification - handle device updates from OS
178 * 178 *
179 * Change the state of the Ethernet bearer (if any) associated with the 179 * Change the state of the Ethernet bearer (if any) associated with the
180 * specified device. 180 * specified device.
181 */ 181 */
182 182
183static int recv_notification(struct notifier_block *nb, unsigned long evt, 183static int recv_notification(struct notifier_block *nb, unsigned long evt,
184 void *dv) 184 void *dv)
185{ 185{
186 struct net_device *dev = (struct net_device *)dv; 186 struct net_device *dev = (struct net_device *)dv;
@@ -194,7 +194,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
194 if (!eb_ptr->bearer) 194 if (!eb_ptr->bearer)
195 return NOTIFY_DONE; /* bearer had been disabled */ 195 return NOTIFY_DONE; /* bearer had been disabled */
196 196
197 eb_ptr->bearer->mtu = dev->mtu; 197 eb_ptr->bearer->mtu = dev->mtu;
198 198
199 switch (evt) { 199 switch (evt) {
200 case NETDEV_CHANGE: 200 case NETDEV_CHANGE:
@@ -210,12 +210,12 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
210 tipc_block_bearer(eb_ptr->bearer->name); 210 tipc_block_bearer(eb_ptr->bearer->name);
211 break; 211 break;
212 case NETDEV_CHANGEMTU: 212 case NETDEV_CHANGEMTU:
213 case NETDEV_CHANGEADDR: 213 case NETDEV_CHANGEADDR:
214 tipc_block_bearer(eb_ptr->bearer->name); 214 tipc_block_bearer(eb_ptr->bearer->name);
215 tipc_continue(eb_ptr->bearer); 215 tipc_continue(eb_ptr->bearer);
216 break; 216 break;
217 case NETDEV_UNREGISTER: 217 case NETDEV_UNREGISTER:
218 case NETDEV_CHANGENAME: 218 case NETDEV_CHANGENAME:
219 tipc_disable_bearer(eb_ptr->bearer->name); 219 tipc_disable_bearer(eb_ptr->bearer->name);
220 break; 220 break;
221 } 221 }
@@ -227,7 +227,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
227 */ 227 */
228 228
229static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) 229static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size)
230{ 230{
231 unchar *addr = (unchar *)&a->dev_addr; 231 unchar *addr = (unchar *)&a->dev_addr;
232 232
233 if (str_size < 18) 233 if (str_size < 18)
@@ -246,7 +246,7 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size
246 */ 246 */
247 247
248int tipc_eth_media_start(void) 248int tipc_eth_media_start(void)
249{ 249{
250 struct tipc_media_addr bcast_addr; 250 struct tipc_media_addr bcast_addr;
251 int res; 251 int res;
252 252
@@ -259,8 +259,8 @@ int tipc_eth_media_start(void)
259 memset(eth_bearers, 0, sizeof(eth_bearers)); 259 memset(eth_bearers, 0, sizeof(eth_bearers));
260 260
261 res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", 261 res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth",
262 enable_bearer, disable_bearer, send_msg, 262 enable_bearer, disable_bearer, send_msg,
263 eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, 263 eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY,
264 ETH_LINK_TOLERANCE, ETH_LINK_WINDOW); 264 ETH_LINK_TOLERANCE, ETH_LINK_WINDOW);
265 if (res) 265 if (res)
266 return res; 266 return res;
diff --git a/net/tipc/handler.c b/net/tipc/handler.c
index eb80778d6d9c..e1dcf663f8a6 100644
--- a/net/tipc/handler.c
+++ b/net/tipc/handler.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/handler.c: TIPC signal handling 2 * net/tipc/handler.c: TIPC signal handling
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -95,7 +95,7 @@ static void process_signal_queue(unsigned long dummy)
95 95
96int tipc_handler_start(void) 96int tipc_handler_start(void)
97{ 97{
98 tipc_queue_item_cache = 98 tipc_queue_item_cache =
99 kmem_cache_create("tipc_queue_items", sizeof(struct queue_item), 99 kmem_cache_create("tipc_queue_items", sizeof(struct queue_item),
100 0, SLAB_HWCACHE_ALIGN, NULL, NULL); 100 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
101 if (!tipc_queue_item_cache) 101 if (!tipc_queue_item_cache)
@@ -110,7 +110,7 @@ int tipc_handler_start(void)
110void tipc_handler_stop(void) 110void tipc_handler_stop(void)
111{ 111{
112 struct list_head *l, *n; 112 struct list_head *l, *n;
113 struct queue_item *item; 113 struct queue_item *item;
114 114
115 if (!handler_enabled) 115 if (!handler_enabled)
116 return; 116 return;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 1bb983c8130b..71c2f2fd405c 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/link.c: TIPC link code 2 * net/tipc/link.c: TIPC link code
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2004-2006, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -50,29 +50,29 @@
50#include "bcast.h" 50#include "bcast.h"
51 51
52 52
53/* 53/*
54 * Limit for deferred reception queue: 54 * Limit for deferred reception queue:
55 */ 55 */
56 56
57#define DEF_QUEUE_LIMIT 256u 57#define DEF_QUEUE_LIMIT 256u
58 58
59/* 59/*
60 * Link state events: 60 * Link state events:
61 */ 61 */
62 62
63#define STARTING_EVT 856384768 /* link processing trigger */ 63#define STARTING_EVT 856384768 /* link processing trigger */
64#define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */ 64#define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */
65#define TIMEOUT_EVT 560817u /* link timer expired */ 65#define TIMEOUT_EVT 560817u /* link timer expired */
66 66
67/* 67/*
68 * The following two 'message types' is really just implementation 68 * The following two 'message types' is really just implementation
69 * data conveniently stored in the message header. 69 * data conveniently stored in the message header.
70 * They must not be considered part of the protocol 70 * They must not be considered part of the protocol
71 */ 71 */
72#define OPEN_MSG 0 72#define OPEN_MSG 0
73#define CLOSED_MSG 1 73#define CLOSED_MSG 1
74 74
75/* 75/*
76 * State value stored in 'exp_msg_count' 76 * State value stored in 'exp_msg_count'
77 */ 77 */
78 78
@@ -97,7 +97,7 @@ struct link_name {
97 97
98/* LINK EVENT CODE IS NOT SUPPORTED AT PRESENT */ 98/* LINK EVENT CODE IS NOT SUPPORTED AT PRESENT */
99 99
100/** 100/**
101 * struct link_event - link up/down event notification 101 * struct link_event - link up/down event notification
102 */ 102 */
103 103
@@ -121,7 +121,7 @@ static int link_send_sections_long(struct port *sender,
121static void link_check_defragm_bufs(struct link *l_ptr); 121static void link_check_defragm_bufs(struct link *l_ptr);
122static void link_state_event(struct link *l_ptr, u32 event); 122static void link_state_event(struct link *l_ptr, u32 event);
123static void link_reset_statistics(struct link *l_ptr); 123static void link_reset_statistics(struct link *l_ptr);
124static void link_print(struct link *l_ptr, struct print_buf *buf, 124static void link_print(struct link *l_ptr, struct print_buf *buf,
125 const char *str); 125 const char *str);
126 126
127/* 127/*
@@ -136,13 +136,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
136 * 136 *
137 * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size 137 * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size
138 * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0, 138 * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0,
139 * the dbg_link_XXX() routines simply send their output to the standard 139 * the dbg_link_XXX() routines simply send their output to the standard
140 * debug print buffer (DBG_OUTPUT), if it has been defined; this can be useful 140 * debug print buffer (DBG_OUTPUT), if it has been defined; this can be useful
141 * when there is only a single link in the system being debugged. 141 * when there is only a single link in the system being debugged.
142 * 142 *
143 * Notes: 143 * Notes:
144 * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE 144 * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE
145 * - "l_ptr" must be valid when using dbg_link_XXX() macros 145 * - "l_ptr" must be valid when using dbg_link_XXX() macros
146 */ 146 */
147 147
148#define LINK_LOG_BUF_SIZE 0 148#define LINK_LOG_BUF_SIZE 0
@@ -222,18 +222,18 @@ static u32 link_max_pkt(struct link *l_ptr)
222static void link_init_max_pkt(struct link *l_ptr) 222static void link_init_max_pkt(struct link *l_ptr)
223{ 223{
224 u32 max_pkt; 224 u32 max_pkt;
225 225
226 max_pkt = (l_ptr->b_ptr->publ.mtu & ~3); 226 max_pkt = (l_ptr->b_ptr->publ.mtu & ~3);
227 if (max_pkt > MAX_MSG_SIZE) 227 if (max_pkt > MAX_MSG_SIZE)
228 max_pkt = MAX_MSG_SIZE; 228 max_pkt = MAX_MSG_SIZE;
229 229
230 l_ptr->max_pkt_target = max_pkt; 230 l_ptr->max_pkt_target = max_pkt;
231 if (l_ptr->max_pkt_target < MAX_PKT_DEFAULT) 231 if (l_ptr->max_pkt_target < MAX_PKT_DEFAULT)
232 l_ptr->max_pkt = l_ptr->max_pkt_target; 232 l_ptr->max_pkt = l_ptr->max_pkt_target;
233 else 233 else
234 l_ptr->max_pkt = MAX_PKT_DEFAULT; 234 l_ptr->max_pkt = MAX_PKT_DEFAULT;
235 235
236 l_ptr->max_pkt_probes = 0; 236 l_ptr->max_pkt_probes = 0;
237} 237}
238 238
239static u32 link_next_sent(struct link *l_ptr) 239static u32 link_next_sent(struct link *l_ptr)
@@ -269,7 +269,7 @@ int tipc_link_is_active(struct link *l_ptr)
269 * link_name_validate - validate & (optionally) deconstruct link name 269 * link_name_validate - validate & (optionally) deconstruct link name
270 * @name - ptr to link name string 270 * @name - ptr to link name string
271 * @name_parts - ptr to area for link name components (or NULL if not needed) 271 * @name_parts - ptr to area for link name components (or NULL if not needed)
272 * 272 *
273 * Returns 1 if link name is valid, otherwise 0. 273 * Returns 1 if link name is valid, otherwise 0.
274 */ 274 */
275 275
@@ -317,8 +317,8 @@ static int link_name_validate(const char *name, struct link_name *name_parts)
317 &z_peer, &c_peer, &n_peer, &dummy) != 3) || 317 &z_peer, &c_peer, &n_peer, &dummy) != 3) ||
318 (z_local > 255) || (c_local > 4095) || (n_local > 4095) || 318 (z_local > 255) || (c_local > 4095) || (n_local > 4095) ||
319 (z_peer > 255) || (c_peer > 4095) || (n_peer > 4095) || 319 (z_peer > 255) || (c_peer > 4095) || (n_peer > 4095) ||
320 (if_local_len <= 1) || (if_local_len > TIPC_MAX_IF_NAME) || 320 (if_local_len <= 1) || (if_local_len > TIPC_MAX_IF_NAME) ||
321 (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME) || 321 (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME) ||
322 (strspn(if_local, tipc_alphabet) != (if_local_len - 1)) || 322 (strspn(if_local, tipc_alphabet) != (if_local_len - 1)) ||
323 (strspn(if_peer, tipc_alphabet) != (if_peer_len - 1))) 323 (strspn(if_peer, tipc_alphabet) != (if_peer_len - 1)))
324 return 0; 324 return 0;
@@ -337,7 +337,7 @@ static int link_name_validate(const char *name, struct link_name *name_parts)
337/** 337/**
338 * link_timeout - handle expiration of link timer 338 * link_timeout - handle expiration of link timer
339 * @l_ptr: pointer to link 339 * @l_ptr: pointer to link
340 * 340 *
341 * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict 341 * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict
342 * with tipc_link_delete(). (There is no risk that the node will be deleted by 342 * with tipc_link_delete(). (There is no risk that the node will be deleted by
343 * another thread because tipc_link_delete() always cancels the link timer before 343 * another thread because tipc_link_delete() always cancels the link timer before
@@ -406,7 +406,7 @@ static void link_set_timer(struct link *l_ptr, u32 time)
406 * @b_ptr: pointer to associated bearer 406 * @b_ptr: pointer to associated bearer
407 * @peer: network address of node at other end of link 407 * @peer: network address of node at other end of link
408 * @media_addr: media address to use when sending messages over link 408 * @media_addr: media address to use when sending messages over link
409 * 409 *
410 * Returns pointer to link. 410 * Returns pointer to link.
411 */ 411 */
412 412
@@ -427,7 +427,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
427 if_name = strchr(b_ptr->publ.name, ':') + 1; 427 if_name = strchr(b_ptr->publ.name, ':') + 1;
428 sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", 428 sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:",
429 tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), 429 tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr),
430 tipc_node(tipc_own_addr), 430 tipc_node(tipc_own_addr),
431 if_name, 431 if_name,
432 tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); 432 tipc_zone(peer), tipc_cluster(peer), tipc_node(peer));
433 /* note: peer i/f is appended to link name by reset/activate */ 433 /* note: peer i/f is appended to link name by reset/activate */
@@ -478,17 +478,17 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
478 478
479 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", 479 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
480 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); 480 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
481 481
482 return l_ptr; 482 return l_ptr;
483} 483}
484 484
485/** 485/**
486 * tipc_link_delete - delete a link 486 * tipc_link_delete - delete a link
487 * @l_ptr: pointer to link 487 * @l_ptr: pointer to link
488 * 488 *
489 * Note: 'tipc_net_lock' is write_locked, bearer is locked. 489 * Note: 'tipc_net_lock' is write_locked, bearer is locked.
490 * This routine must not grab the node lock until after link timer cancellation 490 * This routine must not grab the node lock until after link timer cancellation
491 * to avoid a potential deadlock situation. 491 * to avoid a potential deadlock situation.
492 */ 492 */
493 493
494void tipc_link_delete(struct link *l_ptr) 494void tipc_link_delete(struct link *l_ptr)
@@ -501,7 +501,7 @@ void tipc_link_delete(struct link *l_ptr)
501 dbg("tipc_link_delete()\n"); 501 dbg("tipc_link_delete()\n");
502 502
503 k_cancel_timer(&l_ptr->timer); 503 k_cancel_timer(&l_ptr->timer);
504 504
505 tipc_node_lock(l_ptr->owner); 505 tipc_node_lock(l_ptr->owner);
506 tipc_link_reset(l_ptr); 506 tipc_link_reset(l_ptr);
507 tipc_node_detach_link(l_ptr->owner, l_ptr); 507 tipc_node_detach_link(l_ptr->owner, l_ptr);
@@ -521,12 +521,12 @@ void tipc_link_start(struct link *l_ptr)
521} 521}
522 522
523/** 523/**
524 * link_schedule_port - schedule port for deferred sending 524 * link_schedule_port - schedule port for deferred sending
525 * @l_ptr: pointer to link 525 * @l_ptr: pointer to link
526 * @origport: reference to sending port 526 * @origport: reference to sending port
527 * @sz: amount of data to be sent 527 * @sz: amount of data to be sent
528 * 528 *
529 * Schedules port for renewed sending of messages after link congestion 529 * Schedules port for renewed sending of messages after link congestion
530 * has abated. 530 * has abated.
531 */ 531 */
532 532
@@ -567,7 +567,7 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all)
567 return; 567 return;
568 if (link_congested(l_ptr)) 568 if (link_congested(l_ptr))
569 goto exit; 569 goto exit;
570 list_for_each_entry_safe(p_ptr, temp_p_ptr, &l_ptr->waiting_ports, 570 list_for_each_entry_safe(p_ptr, temp_p_ptr, &l_ptr->waiting_ports,
571 wait_list) { 571 wait_list) {
572 if (win <= 0) 572 if (win <= 0)
573 break; 573 break;
@@ -584,7 +584,7 @@ exit:
584 spin_unlock_bh(&tipc_port_list_lock); 584 spin_unlock_bh(&tipc_port_list_lock);
585} 585}
586 586
587/** 587/**
588 * link_release_outqueue - purge link's outbound message queue 588 * link_release_outqueue - purge link's outbound message queue
589 * @l_ptr: pointer to link 589 * @l_ptr: pointer to link
590 */ 590 */
@@ -621,7 +621,7 @@ void tipc_link_reset_fragments(struct link *l_ptr)
621 l_ptr->defragm_buf = NULL; 621 l_ptr->defragm_buf = NULL;
622} 622}
623 623
624/** 624/**
625 * tipc_link_stop - purge all inbound and outbound messages associated with link 625 * tipc_link_stop - purge all inbound and outbound messages associated with link
626 * @l_ptr: pointer to link 626 * @l_ptr: pointer to link
627 */ 627 */
@@ -665,7 +665,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up),
665 struct link *l_ptr, int up) 665 struct link *l_ptr, int up)
666{ 666{
667 struct link_event *ev; 667 struct link_event *ev;
668 668
669 ev = kmalloc(sizeof(*ev), GFP_ATOMIC); 669 ev = kmalloc(sizeof(*ev), GFP_ATOMIC);
670 if (!ev) { 670 if (!ev) {
671 warn("Link event allocation failure\n"); 671 warn("Link event allocation failure\n");
@@ -690,15 +690,15 @@ void tipc_link_reset(struct link *l_ptr)
690 u32 prev_state = l_ptr->state; 690 u32 prev_state = l_ptr->state;
691 u32 checkpoint = l_ptr->next_in_no; 691 u32 checkpoint = l_ptr->next_in_no;
692 int was_active_link = tipc_link_is_active(l_ptr); 692 int was_active_link = tipc_link_is_active(l_ptr);
693 693
694 msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1); 694 msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1);
695 695
696 /* Link is down, accept any session: */ 696 /* Link is down, accept any session: */
697 l_ptr->peer_session = 0; 697 l_ptr->peer_session = 0;
698 698
699 /* Prepare for max packet size negotiation */ 699 /* Prepare for max packet size negotiation */
700 link_init_max_pkt(l_ptr); 700 link_init_max_pkt(l_ptr);
701 701
702 l_ptr->state = RESET_UNKNOWN; 702 l_ptr->state = RESET_UNKNOWN;
703 dbg_link_state("Resetting Link\n"); 703 dbg_link_state("Resetting Link\n");
704 704
@@ -770,7 +770,7 @@ static void link_activate(struct link *l_ptr)
770 770
771static void link_state_event(struct link *l_ptr, unsigned event) 771static void link_state_event(struct link *l_ptr, unsigned event)
772{ 772{
773 struct link *other; 773 struct link *other;
774 u32 cont_intv = l_ptr->continuity_interval; 774 u32 cont_intv = l_ptr->continuity_interval;
775 775
776 if (!l_ptr->started && (event != STARTING_EVT)) 776 if (!l_ptr->started && (event != STARTING_EVT))
@@ -799,11 +799,11 @@ static void link_state_event(struct link *l_ptr, unsigned event)
799 if (l_ptr->next_in_no != l_ptr->checkpoint) { 799 if (l_ptr->next_in_no != l_ptr->checkpoint) {
800 l_ptr->checkpoint = l_ptr->next_in_no; 800 l_ptr->checkpoint = l_ptr->next_in_no;
801 if (tipc_bclink_acks_missing(l_ptr->owner)) { 801 if (tipc_bclink_acks_missing(l_ptr->owner)) {
802 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 802 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
803 0, 0, 0, 0, 0); 803 0, 0, 0, 0, 0);
804 l_ptr->fsm_msg_cnt++; 804 l_ptr->fsm_msg_cnt++;
805 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { 805 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) {
806 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 806 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
807 1, 0, 0, 0, 0); 807 1, 0, 0, 0, 0);
808 l_ptr->fsm_msg_cnt++; 808 l_ptr->fsm_msg_cnt++;
809 } 809 }
@@ -819,7 +819,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
819 break; 819 break;
820 case RESET_MSG: 820 case RESET_MSG:
821 dbg_link("RES -> RR\n"); 821 dbg_link("RES -> RR\n");
822 info("Resetting link <%s>, requested by peer\n", 822 info("Resetting link <%s>, requested by peer\n",
823 l_ptr->name); 823 l_ptr->name);
824 tipc_link_reset(l_ptr); 824 tipc_link_reset(l_ptr);
825 l_ptr->state = RESET_RESET; 825 l_ptr->state = RESET_RESET;
@@ -871,7 +871,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
871 dbg_link("Probing %u/%u,timer = %u ms)\n", 871 dbg_link("Probing %u/%u,timer = %u ms)\n",
872 l_ptr->fsm_msg_cnt, l_ptr->abort_limit, 872 l_ptr->fsm_msg_cnt, l_ptr->abort_limit,
873 cont_intv / 4); 873 cont_intv / 4);
874 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 874 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
875 1, 0, 0, 0, 0); 875 1, 0, 0, 0, 0);
876 l_ptr->fsm_msg_cnt++; 876 l_ptr->fsm_msg_cnt++;
877 link_set_timer(l_ptr, cont_intv / 4); 877 link_set_timer(l_ptr, cont_intv / 4);
@@ -977,11 +977,11 @@ static void link_state_event(struct link *l_ptr, unsigned event)
977 977
978/* 978/*
979 * link_bundle_buf(): Append contents of a buffer to 979 * link_bundle_buf(): Append contents of a buffer to
980 * the tail of an existing one. 980 * the tail of an existing one.
981 */ 981 */
982 982
983static int link_bundle_buf(struct link *l_ptr, 983static int link_bundle_buf(struct link *l_ptr,
984 struct sk_buff *bundler, 984 struct sk_buff *bundler,
985 struct sk_buff *buf) 985 struct sk_buff *buf)
986{ 986{
987 struct tipc_msg *bundler_msg = buf_msg(bundler); 987 struct tipc_msg *bundler_msg = buf_msg(bundler);
@@ -1030,8 +1030,8 @@ static void link_add_to_outqueue(struct link *l_ptr,
1030 l_ptr->out_queue_size++; 1030 l_ptr->out_queue_size++;
1031} 1031}
1032 1032
1033/* 1033/*
1034 * tipc_link_send_buf() is the 'full path' for messages, called from 1034 * tipc_link_send_buf() is the 'full path' for messages, called from
1035 * inside TIPC when the 'fast path' in tipc_send_buf 1035 * inside TIPC when the 'fast path' in tipc_send_buf
1036 * has failed, and from link_send() 1036 * has failed, and from link_send()
1037 */ 1037 */
@@ -1074,7 +1074,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1074 if (queue_size > l_ptr->stats.max_queue_sz) 1074 if (queue_size > l_ptr->stats.max_queue_sz)
1075 l_ptr->stats.max_queue_sz = queue_size; 1075 l_ptr->stats.max_queue_sz = queue_size;
1076 1076
1077 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && 1077 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
1078 !link_congested(l_ptr))) { 1078 !link_congested(l_ptr))) {
1079 link_add_to_outqueue(l_ptr, buf, msg); 1079 link_add_to_outqueue(l_ptr, buf, msg);
1080 1080
@@ -1094,7 +1094,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1094 1094
1095 /* Try adding message to an existing bundle */ 1095 /* Try adding message to an existing bundle */
1096 1096
1097 if (l_ptr->next_out && 1097 if (l_ptr->next_out &&
1098 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { 1098 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
1099 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); 1099 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
1100 return dsz; 1100 return dsz;
@@ -1109,7 +1109,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1109 if (bundler) { 1109 if (bundler) {
1110 msg_init(&bundler_hdr, MSG_BUNDLER, OPEN_MSG, 1110 msg_init(&bundler_hdr, MSG_BUNDLER, OPEN_MSG,
1111 TIPC_OK, INT_H_SIZE, l_ptr->addr); 1111 TIPC_OK, INT_H_SIZE, l_ptr->addr);
1112 memcpy(bundler->data, (unchar *)&bundler_hdr, 1112 memcpy(bundler->data, (unchar *)&bundler_hdr,
1113 INT_H_SIZE); 1113 INT_H_SIZE);
1114 skb_trim(bundler, INT_H_SIZE); 1114 skb_trim(bundler, INT_H_SIZE);
1115 link_bundle_buf(l_ptr, bundler, buf); 1115 link_bundle_buf(l_ptr, bundler, buf);
@@ -1126,8 +1126,8 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1126 return dsz; 1126 return dsz;
1127} 1127}
1128 1128
1129/* 1129/*
1130 * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has 1130 * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has
1131 * not been selected yet, and the the owner node is not locked 1131 * not been selected yet, and the the owner node is not locked
1132 * Called by TIPC internal users, e.g. the name distributor 1132 * Called by TIPC internal users, e.g. the name distributor
1133 */ 1133 */
@@ -1161,8 +1161,8 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
1161 return res; 1161 return res;
1162} 1162}
1163 1163
1164/* 1164/*
1165 * link_send_buf_fast: Entry for data messages where the 1165 * link_send_buf_fast: Entry for data messages where the
1166 * destination link is known and the header is complete, 1166 * destination link is known and the header is complete,
1167 * inclusive total message length. Very time critical. 1167 * inclusive total message length. Very time critical.
1168 * Link is locked. Returns user data length. 1168 * Link is locked. Returns user data length.
@@ -1197,8 +1197,8 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
1197 return tipc_link_send_buf(l_ptr, buf); /* All other cases */ 1197 return tipc_link_send_buf(l_ptr, buf); /* All other cases */
1198} 1198}
1199 1199
1200/* 1200/*
1201 * tipc_send_buf_fast: Entry for data messages where the 1201 * tipc_send_buf_fast: Entry for data messages where the
1202 * destination node is known and the header is complete, 1202 * destination node is known and the header is complete,
1203 * inclusive total message length. 1203 * inclusive total message length.
1204 * Returns user data length. 1204 * Returns user data length.
@@ -1236,15 +1236,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
1236} 1236}
1237 1237
1238 1238
1239/* 1239/*
1240 * tipc_link_send_sections_fast: Entry for messages where the 1240 * tipc_link_send_sections_fast: Entry for messages where the
1241 * destination processor is known and the header is complete, 1241 * destination processor is known and the header is complete,
1242 * except for total message length. 1242 * except for total message length.
1243 * Returns user data length or errno. 1243 * Returns user data length or errno.
1244 */ 1244 */
1245int tipc_link_send_sections_fast(struct port *sender, 1245int tipc_link_send_sections_fast(struct port *sender,
1246 struct iovec const *msg_sect, 1246 struct iovec const *msg_sect,
1247 const u32 num_sect, 1247 const u32 num_sect,
1248 u32 destaddr) 1248 u32 destaddr)
1249{ 1249{
1250 struct tipc_msg *hdr = &sender->publ.phdr; 1250 struct tipc_msg *hdr = &sender->publ.phdr;
@@ -1287,14 +1287,14 @@ exit:
1287 1287
1288 /* Exit if link (or bearer) is congested */ 1288 /* Exit if link (or bearer) is congested */
1289 1289
1290 if (link_congested(l_ptr) || 1290 if (link_congested(l_ptr) ||
1291 !list_empty(&l_ptr->b_ptr->cong_links)) { 1291 !list_empty(&l_ptr->b_ptr->cong_links)) {
1292 res = link_schedule_port(l_ptr, 1292 res = link_schedule_port(l_ptr,
1293 sender->publ.ref, res); 1293 sender->publ.ref, res);
1294 goto exit; 1294 goto exit;
1295 } 1295 }
1296 1296
1297 /* 1297 /*
1298 * Message size exceeds max_pkt hint; update hint, 1298 * Message size exceeds max_pkt hint; update hint,
1299 * then re-try fast path or fragment the message 1299 * then re-try fast path or fragment the message
1300 */ 1300 */
@@ -1324,10 +1324,10 @@ exit:
1324 return res; 1324 return res;
1325} 1325}
1326 1326
1327/* 1327/*
1328 * link_send_sections_long(): Entry for long messages where the 1328 * link_send_sections_long(): Entry for long messages where the
1329 * destination node is known and the header is complete, 1329 * destination node is known and the header is complete,
1330 * inclusive total message length. 1330 * inclusive total message length.
1331 * Link and bearer congestion status have been checked to be ok, 1331 * Link and bearer congestion status have been checked to be ok,
1332 * and are ignored if they change. 1332 * and are ignored if they change.
1333 * 1333 *
@@ -1357,9 +1357,9 @@ static int link_send_sections_long(struct port *sender,
1357 1357
1358again: 1358again:
1359 fragm_no = 1; 1359 fragm_no = 1;
1360 max_pkt = sender->max_pkt - INT_H_SIZE; 1360 max_pkt = sender->max_pkt - INT_H_SIZE;
1361 /* leave room for tunnel header in case of link changeover */ 1361 /* leave room for tunnel header in case of link changeover */
1362 fragm_sz = max_pkt - INT_H_SIZE; 1362 fragm_sz = max_pkt - INT_H_SIZE;
1363 /* leave room for fragmentation header in each fragment */ 1363 /* leave room for fragmentation header in each fragment */
1364 rest = dsz; 1364 rest = dsz;
1365 fragm_crs = 0; 1365 fragm_crs = 0;
@@ -1440,7 +1440,7 @@ error:
1440 if (!buf) 1440 if (!buf)
1441 goto error; 1441 goto error;
1442 1442
1443 buf->next = NULL; 1443 buf->next = NULL;
1444 prev->next = buf; 1444 prev->next = buf;
1445 memcpy(buf->data, (unchar *)&fragm_hdr, INT_H_SIZE); 1445 memcpy(buf->data, (unchar *)&fragm_hdr, INT_H_SIZE);
1446 fragm_crs = INT_H_SIZE; 1446 fragm_crs = INT_H_SIZE;
@@ -1450,7 +1450,7 @@ error:
1450 } 1450 }
1451 while (rest > 0); 1451 while (rest > 0);
1452 1452
1453 /* 1453 /*
1454 * Now we have a buffer chain. Select a link and check 1454 * Now we have a buffer chain. Select a link and check
1455 * that packet size is still OK 1455 * that packet size is still OK
1456 */ 1456 */
@@ -1506,7 +1506,7 @@ reject:
1506 return dsz; 1506 return dsz;
1507} 1507}
1508 1508
1509/* 1509/*
1510 * tipc_link_push_packet: Push one unsent packet to the media 1510 * tipc_link_push_packet: Push one unsent packet to the media
1511 */ 1511 */
1512u32 tipc_link_push_packet(struct link *l_ptr) 1512u32 tipc_link_push_packet(struct link *l_ptr)
@@ -1519,7 +1519,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
1519 /* consider that buffers may have been released in meantime */ 1519 /* consider that buffers may have been released in meantime */
1520 1520
1521 if (r_q_size && buf) { 1521 if (r_q_size && buf) {
1522 u32 last = lesser(mod(r_q_head + r_q_size), 1522 u32 last = lesser(mod(r_q_head + r_q_size),
1523 link_last_sent(l_ptr)); 1523 link_last_sent(l_ptr));
1524 u32 first = msg_seqno(buf_msg(buf)); 1524 u32 first = msg_seqno(buf_msg(buf));
1525 1525
@@ -1535,7 +1535,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
1535 1535
1536 if (r_q_size && buf && !skb_cloned(buf)) { 1536 if (r_q_size && buf && !skb_cloned(buf)) {
1537 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1537 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1538 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); 1538 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
1539 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1539 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1540 msg_dbg(buf_msg(buf), ">DEF-RETR>"); 1540 msg_dbg(buf_msg(buf), ">DEF-RETR>");
1541 l_ptr->retransm_queue_head = mod(++r_q_head); 1541 l_ptr->retransm_queue_head = mod(++r_q_head);
@@ -1554,7 +1554,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
1554 buf = l_ptr->proto_msg_queue; 1554 buf = l_ptr->proto_msg_queue;
1555 if (buf) { 1555 if (buf) {
1556 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1556 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1557 msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in); 1557 msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in);
1558 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1558 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1559 msg_dbg(buf_msg(buf), ">DEF-PROT>"); 1559 msg_dbg(buf_msg(buf), ">DEF-PROT>");
1560 l_ptr->unacked_window = 0; 1560 l_ptr->unacked_window = 0;
@@ -1578,7 +1578,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
1578 1578
1579 if (mod(next - first) < l_ptr->queue_limit[0]) { 1579 if (mod(next - first) < l_ptr->queue_limit[0]) {
1580 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 1580 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
1581 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1581 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
1582 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1582 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1583 if (msg_user(msg) == MSG_BUNDLER) 1583 if (msg_user(msg) == MSG_BUNDLER)
1584 msg_set_type(msg, CLOSED_MSG); 1584 msg_set_type(msg, CLOSED_MSG);
@@ -1629,12 +1629,12 @@ static void link_reset_all(unsigned long addr)
1629 1629
1630 tipc_node_lock(n_ptr); 1630 tipc_node_lock(n_ptr);
1631 1631
1632 warn("Resetting all links to %s\n", 1632 warn("Resetting all links to %s\n",
1633 addr_string_fill(addr_string, n_ptr->addr)); 1633 addr_string_fill(addr_string, n_ptr->addr));
1634 1634
1635 for (i = 0; i < MAX_BEARERS; i++) { 1635 for (i = 0; i < MAX_BEARERS; i++) {
1636 if (n_ptr->links[i]) { 1636 if (n_ptr->links[i]) {
1637 link_print(n_ptr->links[i], TIPC_OUTPUT, 1637 link_print(n_ptr->links[i], TIPC_OUTPUT,
1638 "Resetting link\n"); 1638 "Resetting link\n");
1639 tipc_link_reset(n_ptr->links[i]); 1639 tipc_link_reset(n_ptr->links[i]);
1640 } 1640 }
@@ -1689,7 +1689,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf)
1689 } 1689 }
1690} 1690}
1691 1691
1692void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, 1692void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1693 u32 retransmits) 1693 u32 retransmits)
1694{ 1694{
1695 struct tipc_msg *msg; 1695 struct tipc_msg *msg;
@@ -1698,7 +1698,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1698 return; 1698 return;
1699 1699
1700 msg = buf_msg(buf); 1700 msg = buf_msg(buf);
1701 1701
1702 dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); 1702 dbg("Retransmitting %u in link %x\n", retransmits, l_ptr);
1703 1703
1704 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { 1704 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
@@ -1728,7 +1728,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1728 while (retransmits && (buf != l_ptr->next_out) && buf && !skb_cloned(buf)) { 1728 while (retransmits && (buf != l_ptr->next_out) && buf && !skb_cloned(buf)) {
1729 msg = buf_msg(buf); 1729 msg = buf_msg(buf);
1730 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 1730 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
1731 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1731 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
1732 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1732 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1733 msg_dbg(buf_msg(buf), ">RETR>"); 1733 msg_dbg(buf_msg(buf), ">RETR>");
1734 buf = buf->next; 1734 buf = buf->next;
@@ -1746,7 +1746,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1746 l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0; 1746 l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0;
1747} 1747}
1748 1748
1749/* 1749/*
1750 * link_recv_non_seq: Receive packets which are outside 1750 * link_recv_non_seq: Receive packets which are outside
1751 * the link sequence flow 1751 * the link sequence flow
1752 */ 1752 */
@@ -1761,11 +1761,11 @@ static void link_recv_non_seq(struct sk_buff *buf)
1761 tipc_bclink_recv_pkt(buf); 1761 tipc_bclink_recv_pkt(buf);
1762} 1762}
1763 1763
1764/** 1764/**
1765 * link_insert_deferred_queue - insert deferred messages back into receive chain 1765 * link_insert_deferred_queue - insert deferred messages back into receive chain
1766 */ 1766 */
1767 1767
1768static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, 1768static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr,
1769 struct sk_buff *buf) 1769 struct sk_buff *buf)
1770{ 1770{
1771 u32 seq_no; 1771 u32 seq_no;
@@ -1813,11 +1813,11 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1813 link_recv_non_seq(buf); 1813 link_recv_non_seq(buf);
1814 continue; 1814 continue;
1815 } 1815 }
1816 1816
1817 if (unlikely(!msg_short(msg) && 1817 if (unlikely(!msg_short(msg) &&
1818 (msg_destnode(msg) != tipc_own_addr))) 1818 (msg_destnode(msg) != tipc_own_addr)))
1819 goto cont; 1819 goto cont;
1820 1820
1821 n_ptr = tipc_node_find(msg_prevnode(msg)); 1821 n_ptr = tipc_node_find(msg_prevnode(msg));
1822 if (unlikely(!n_ptr)) 1822 if (unlikely(!n_ptr))
1823 goto cont; 1823 goto cont;
@@ -1828,8 +1828,8 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1828 tipc_node_unlock(n_ptr); 1828 tipc_node_unlock(n_ptr);
1829 goto cont; 1829 goto cont;
1830 } 1830 }
1831 /* 1831 /*
1832 * Release acked messages 1832 * Release acked messages
1833 */ 1833 */
1834 if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { 1834 if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) {
1835 if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported) 1835 if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
@@ -1837,7 +1837,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1837 } 1837 }
1838 1838
1839 crs = l_ptr->first_out; 1839 crs = l_ptr->first_out;
1840 while ((crs != l_ptr->next_out) && 1840 while ((crs != l_ptr->next_out) &&
1841 less_eq(msg_seqno(buf_msg(crs)), ackd)) { 1841 less_eq(msg_seqno(buf_msg(crs)), ackd)) {
1842 struct sk_buff *next = crs->next; 1842 struct sk_buff *next = crs->next;
1843 1843
@@ -1875,7 +1875,7 @@ deliver:
1875 switch (msg_user(msg)) { 1875 switch (msg_user(msg)) {
1876 case MSG_BUNDLER: 1876 case MSG_BUNDLER:
1877 l_ptr->stats.recv_bundles++; 1877 l_ptr->stats.recv_bundles++;
1878 l_ptr->stats.recv_bundled += 1878 l_ptr->stats.recv_bundled +=
1879 msg_msgcnt(msg); 1879 msg_msgcnt(msg);
1880 tipc_node_unlock(n_ptr); 1880 tipc_node_unlock(n_ptr);
1881 tipc_link_recv_bundle(buf); 1881 tipc_link_recv_bundle(buf);
@@ -1894,7 +1894,7 @@ deliver:
1894 continue; 1894 continue;
1895 case MSG_FRAGMENTER: 1895 case MSG_FRAGMENTER:
1896 l_ptr->stats.recv_fragments++; 1896 l_ptr->stats.recv_fragments++;
1897 if (tipc_link_recv_fragment(&l_ptr->defragm_buf, 1897 if (tipc_link_recv_fragment(&l_ptr->defragm_buf,
1898 &buf, &msg)) { 1898 &buf, &msg)) {
1899 l_ptr->stats.recv_fragmented++; 1899 l_ptr->stats.recv_fragmented++;
1900 goto deliver; 1900 goto deliver;
@@ -1905,7 +1905,7 @@ deliver:
1905 if (link_recv_changeover_msg(&l_ptr, &buf)) { 1905 if (link_recv_changeover_msg(&l_ptr, &buf)) {
1906 msg = buf_msg(buf); 1906 msg = buf_msg(buf);
1907 seq_no = msg_seqno(msg); 1907 seq_no = msg_seqno(msg);
1908 TIPC_SKB_CB(buf)->handle 1908 TIPC_SKB_CB(buf)->handle
1909 = b_ptr; 1909 = b_ptr;
1910 if (type == ORIGINAL_MSG) 1910 if (type == ORIGINAL_MSG)
1911 goto deliver; 1911 goto deliver;
@@ -1948,8 +1948,8 @@ cont:
1948 read_unlock_bh(&tipc_net_lock); 1948 read_unlock_bh(&tipc_net_lock);
1949} 1949}
1950 1950
1951/* 1951/*
1952 * link_defer_buf(): Sort a received out-of-sequence packet 1952 * link_defer_buf(): Sort a received out-of-sequence packet
1953 * into the deferred reception queue. 1953 * into the deferred reception queue.
1954 * Returns the increase of the queue length,i.e. 0 or 1 1954 * Returns the increase of the queue length,i.e. 0 or 1
1955 */ 1955 */
@@ -1986,7 +1986,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
1986 if (prev) 1986 if (prev)
1987 prev->next = buf; 1987 prev->next = buf;
1988 else 1988 else
1989 *head = buf; 1989 *head = buf;
1990 return 1; 1990 return 1;
1991 } 1991 }
1992 if (seq_no == msg_seqno(msg)) { 1992 if (seq_no == msg_seqno(msg)) {
@@ -2003,11 +2003,11 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
2003 return 0; 2003 return 0;
2004} 2004}
2005 2005
2006/** 2006/**
2007 * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet 2007 * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet
2008 */ 2008 */
2009 2009
2010static void link_handle_out_of_seq_msg(struct link *l_ptr, 2010static void link_handle_out_of_seq_msg(struct link *l_ptr,
2011 struct sk_buff *buf) 2011 struct sk_buff *buf)
2012{ 2012{
2013 u32 seq_no = msg_seqno(buf_msg(buf)); 2013 u32 seq_no = msg_seqno(buf_msg(buf));
@@ -2017,14 +2017,14 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
2017 return; 2017 return;
2018 } 2018 }
2019 2019
2020 dbg("rx OOS msg: seq_no %u, expecting %u (%u)\n", 2020 dbg("rx OOS msg: seq_no %u, expecting %u (%u)\n",
2021 seq_no, mod(l_ptr->next_in_no), l_ptr->next_in_no); 2021 seq_no, mod(l_ptr->next_in_no), l_ptr->next_in_no);
2022 2022
2023 /* Record OOS packet arrival (force mismatch on next timeout) */ 2023 /* Record OOS packet arrival (force mismatch on next timeout) */
2024 2024
2025 l_ptr->checkpoint--; 2025 l_ptr->checkpoint--;
2026 2026
2027 /* 2027 /*
2028 * Discard packet if a duplicate; otherwise add it to deferred queue 2028 * Discard packet if a duplicate; otherwise add it to deferred queue
2029 * and notify peer of gap as per protocol specification 2029 * and notify peer of gap as per protocol specification
2030 */ 2030 */
@@ -2053,13 +2053,13 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2053{ 2053{
2054 struct sk_buff *buf = NULL; 2054 struct sk_buff *buf = NULL;
2055 struct tipc_msg *msg = l_ptr->pmsg; 2055 struct tipc_msg *msg = l_ptr->pmsg;
2056 u32 msg_size = sizeof(l_ptr->proto_msg); 2056 u32 msg_size = sizeof(l_ptr->proto_msg);
2057 2057
2058 if (link_blocked(l_ptr)) 2058 if (link_blocked(l_ptr))
2059 return; 2059 return;
2060 msg_set_type(msg, msg_typ); 2060 msg_set_type(msg, msg_typ);
2061 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); 2061 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
2062 msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in)); 2062 msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in));
2063 msg_set_last_bcast(msg, tipc_bclink_get_last_sent()); 2063 msg_set_last_bcast(msg, tipc_bclink_get_last_sent());
2064 2064
2065 if (msg_typ == STATE_MSG) { 2065 if (msg_typ == STATE_MSG) {
@@ -2082,23 +2082,23 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2082 msg_set_max_pkt(msg, ack_mtu); 2082 msg_set_max_pkt(msg, ack_mtu);
2083 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 2083 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
2084 msg_set_probe(msg, probe_msg != 0); 2084 msg_set_probe(msg, probe_msg != 0);
2085 if (probe_msg) { 2085 if (probe_msg) {
2086 u32 mtu = l_ptr->max_pkt; 2086 u32 mtu = l_ptr->max_pkt;
2087 2087
2088 if ((mtu < l_ptr->max_pkt_target) && 2088 if ((mtu < l_ptr->max_pkt_target) &&
2089 link_working_working(l_ptr) && 2089 link_working_working(l_ptr) &&
2090 l_ptr->fsm_msg_cnt) { 2090 l_ptr->fsm_msg_cnt) {
2091 msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3; 2091 msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3;
2092 if (l_ptr->max_pkt_probes == 10) { 2092 if (l_ptr->max_pkt_probes == 10) {
2093 l_ptr->max_pkt_target = (msg_size - 4); 2093 l_ptr->max_pkt_target = (msg_size - 4);
2094 l_ptr->max_pkt_probes = 0; 2094 l_ptr->max_pkt_probes = 0;
2095 msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3; 2095 msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3;
2096 } 2096 }
2097 l_ptr->max_pkt_probes++; 2097 l_ptr->max_pkt_probes++;
2098 } 2098 }
2099 2099
2100 l_ptr->stats.sent_probes++; 2100 l_ptr->stats.sent_probes++;
2101 } 2101 }
2102 l_ptr->stats.sent_states++; 2102 l_ptr->stats.sent_states++;
2103 } else { /* RESET_MSG or ACTIVATE_MSG */ 2103 } else { /* RESET_MSG or ACTIVATE_MSG */
2104 msg_set_ack(msg, mod(l_ptr->reset_checkpoint - 1)); 2104 msg_set_ack(msg, mod(l_ptr->reset_checkpoint - 1));
@@ -2144,7 +2144,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2144 return; 2144 return;
2145 2145
2146 memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); 2146 memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg));
2147 msg_set_size(buf_msg(buf), msg_size); 2147 msg_set_size(buf_msg(buf), msg_size);
2148 2148
2149 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 2149 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
2150 l_ptr->unacked_window = 0; 2150 l_ptr->unacked_window = 0;
@@ -2160,15 +2160,15 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2160 2160
2161/* 2161/*
2162 * Receive protocol message : 2162 * Receive protocol message :
2163 * Note that network plane id propagates through the network, and may 2163 * Note that network plane id propagates through the network, and may
2164 * change at any time. The node with lowest address rules 2164 * change at any time. The node with lowest address rules
2165 */ 2165 */
2166 2166
2167static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) 2167static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2168{ 2168{
2169 u32 rec_gap = 0; 2169 u32 rec_gap = 0;
2170 u32 max_pkt_info; 2170 u32 max_pkt_info;
2171 u32 max_pkt_ack; 2171 u32 max_pkt_ack;
2172 u32 msg_tol; 2172 u32 msg_tol;
2173 struct tipc_msg *msg = buf_msg(buf); 2173 struct tipc_msg *msg = buf_msg(buf);
2174 2174
@@ -2188,12 +2188,12 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2188 l_ptr->owner->permit_changeover = msg_redundant_link(msg); 2188 l_ptr->owner->permit_changeover = msg_redundant_link(msg);
2189 2189
2190 switch (msg_type(msg)) { 2190 switch (msg_type(msg)) {
2191 2191
2192 case RESET_MSG: 2192 case RESET_MSG:
2193 if (!link_working_unknown(l_ptr) && l_ptr->peer_session) { 2193 if (!link_working_unknown(l_ptr) && l_ptr->peer_session) {
2194 if (msg_session(msg) == l_ptr->peer_session) { 2194 if (msg_session(msg) == l_ptr->peer_session) {
2195 dbg("Duplicate RESET: %u<->%u\n", 2195 dbg("Duplicate RESET: %u<->%u\n",
2196 msg_session(msg), l_ptr->peer_session); 2196 msg_session(msg), l_ptr->peer_session);
2197 break; /* duplicate: ignore */ 2197 break; /* duplicate: ignore */
2198 } 2198 }
2199 } 2199 }
@@ -2211,13 +2211,13 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2211 l_ptr->priority = msg_linkprio(msg); 2211 l_ptr->priority = msg_linkprio(msg);
2212 2212
2213 max_pkt_info = msg_max_pkt(msg); 2213 max_pkt_info = msg_max_pkt(msg);
2214 if (max_pkt_info) { 2214 if (max_pkt_info) {
2215 if (max_pkt_info < l_ptr->max_pkt_target) 2215 if (max_pkt_info < l_ptr->max_pkt_target)
2216 l_ptr->max_pkt_target = max_pkt_info; 2216 l_ptr->max_pkt_target = max_pkt_info;
2217 if (l_ptr->max_pkt > l_ptr->max_pkt_target) 2217 if (l_ptr->max_pkt > l_ptr->max_pkt_target)
2218 l_ptr->max_pkt = l_ptr->max_pkt_target; 2218 l_ptr->max_pkt = l_ptr->max_pkt_target;
2219 } else { 2219 } else {
2220 l_ptr->max_pkt = l_ptr->max_pkt_target; 2220 l_ptr->max_pkt = l_ptr->max_pkt_target;
2221 } 2221 }
2222 l_ptr->owner->bclink.supported = (max_pkt_info != 0); 2222 l_ptr->owner->bclink.supported = (max_pkt_info != 0);
2223 2223
@@ -2235,8 +2235,8 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2235 2235
2236 if ((msg_tol = msg_link_tolerance(msg))) 2236 if ((msg_tol = msg_link_tolerance(msg)))
2237 link_set_supervision_props(l_ptr, msg_tol); 2237 link_set_supervision_props(l_ptr, msg_tol);
2238 2238
2239 if (msg_linkprio(msg) && 2239 if (msg_linkprio(msg) &&
2240 (msg_linkprio(msg) != l_ptr->priority)) { 2240 (msg_linkprio(msg) != l_ptr->priority)) {
2241 warn("Resetting link <%s>, priority change %u->%u\n", 2241 warn("Resetting link <%s>, priority change %u->%u\n",
2242 l_ptr->name, l_ptr->priority, msg_linkprio(msg)); 2242 l_ptr->name, l_ptr->priority, msg_linkprio(msg));
@@ -2250,25 +2250,25 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2250 break; 2250 break;
2251 2251
2252 if (less_eq(mod(l_ptr->next_in_no), msg_next_sent(msg))) { 2252 if (less_eq(mod(l_ptr->next_in_no), msg_next_sent(msg))) {
2253 rec_gap = mod(msg_next_sent(msg) - 2253 rec_gap = mod(msg_next_sent(msg) -
2254 mod(l_ptr->next_in_no)); 2254 mod(l_ptr->next_in_no));
2255 } 2255 }
2256 2256
2257 max_pkt_ack = msg_max_pkt(msg); 2257 max_pkt_ack = msg_max_pkt(msg);
2258 if (max_pkt_ack > l_ptr->max_pkt) { 2258 if (max_pkt_ack > l_ptr->max_pkt) {
2259 dbg("Link <%s> updated MTU %u -> %u\n", 2259 dbg("Link <%s> updated MTU %u -> %u\n",
2260 l_ptr->name, l_ptr->max_pkt, max_pkt_ack); 2260 l_ptr->name, l_ptr->max_pkt, max_pkt_ack);
2261 l_ptr->max_pkt = max_pkt_ack; 2261 l_ptr->max_pkt = max_pkt_ack;
2262 l_ptr->max_pkt_probes = 0; 2262 l_ptr->max_pkt_probes = 0;
2263 } 2263 }
2264 2264
2265 max_pkt_ack = 0; 2265 max_pkt_ack = 0;
2266 if (msg_probe(msg)) { 2266 if (msg_probe(msg)) {
2267 l_ptr->stats.recv_probes++; 2267 l_ptr->stats.recv_probes++;
2268 if (msg_size(msg) > sizeof(l_ptr->proto_msg)) { 2268 if (msg_size(msg) > sizeof(l_ptr->proto_msg)) {
2269 max_pkt_ack = msg_size(msg); 2269 max_pkt_ack = msg_size(msg);
2270 } 2270 }
2271 } 2271 }
2272 2272
2273 /* Protocol message before retransmits, reduce loss risk */ 2273 /* Protocol message before retransmits, reduce loss risk */
2274 2274
@@ -2294,11 +2294,11 @@ exit:
2294 2294
2295 2295
2296/* 2296/*
2297 * tipc_link_tunnel(): Send one message via a link belonging to 2297 * tipc_link_tunnel(): Send one message via a link belonging to
2298 * another bearer. Owner node is locked. 2298 * another bearer. Owner node is locked.
2299 */ 2299 */
2300void tipc_link_tunnel(struct link *l_ptr, 2300void tipc_link_tunnel(struct link *l_ptr,
2301 struct tipc_msg *tunnel_hdr, 2301 struct tipc_msg *tunnel_hdr,
2302 struct tipc_msg *msg, 2302 struct tipc_msg *msg,
2303 u32 selector) 2303 u32 selector)
2304{ 2304{
@@ -2374,7 +2374,7 @@ void tipc_link_changeover(struct link *l_ptr)
2374 return; 2374 return;
2375 } 2375 }
2376 2376
2377 split_bundles = (l_ptr->owner->active_links[0] != 2377 split_bundles = (l_ptr->owner->active_links[0] !=
2378 l_ptr->owner->active_links[1]); 2378 l_ptr->owner->active_links[1]);
2379 2379
2380 while (crs) { 2380 while (crs) {
@@ -2418,7 +2418,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2418 if (msg_user(msg) == MSG_BUNDLER) 2418 if (msg_user(msg) == MSG_BUNDLER)
2419 msg_set_type(msg, CLOSED_MSG); 2419 msg_set_type(msg, CLOSED_MSG);
2420 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */ 2420 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */
2421 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 2421 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
2422 msg_set_size(&tunnel_hdr, length + INT_H_SIZE); 2422 msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
2423 outbuf = buf_acquire(length + INT_H_SIZE); 2423 outbuf = buf_acquire(length + INT_H_SIZE);
2424 if (outbuf == NULL) { 2424 if (outbuf == NULL) {
@@ -2445,7 +2445,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2445 * @skb: encapsulating message buffer 2445 * @skb: encapsulating message buffer
2446 * @from_pos: offset to extract from 2446 * @from_pos: offset to extract from
2447 * 2447 *
2448 * Returns a new message buffer containing an embedded message. The 2448 * Returns a new message buffer containing an embedded message. The
2449 * encapsulating message itself is left unchanged. 2449 * encapsulating message itself is left unchanged.
2450 */ 2450 */
2451 2451
@@ -2461,7 +2461,7 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
2461 return eb; 2461 return eb;
2462} 2462}
2463 2463
2464/* 2464/*
2465 * link_recv_changeover_msg(): Receive tunneled packet sent 2465 * link_recv_changeover_msg(): Receive tunneled packet sent
2466 * via other link. Node is locked. Return extracted buffer. 2466 * via other link. Node is locked. Return extracted buffer.
2467 */ 2467 */
@@ -2482,7 +2482,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2482 goto exit; 2482 goto exit;
2483 } 2483 }
2484 if (dest_link == *l_ptr) { 2484 if (dest_link == *l_ptr) {
2485 err("Unexpected changeover message on link <%s>\n", 2485 err("Unexpected changeover message on link <%s>\n",
2486 (*l_ptr)->name); 2486 (*l_ptr)->name);
2487 goto exit; 2487 goto exit;
2488 } 2488 }
@@ -2582,9 +2582,9 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2582 */ 2582 */
2583 2583
2584 2584
2585/* 2585/*
2586 * tipc_link_send_long_buf: Entry for buffers needing fragmentation. 2586 * tipc_link_send_long_buf: Entry for buffers needing fragmentation.
2587 * The buffer is complete, inclusive total message length. 2587 * The buffer is complete, inclusive total message length.
2588 * Returns user data length. 2588 * Returns user data length.
2589 */ 2589 */
2590int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) 2590int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
@@ -2650,9 +2650,9 @@ exit:
2650 return dsz; 2650 return dsz;
2651} 2651}
2652 2652
2653/* 2653/*
2654 * A pending message being re-assembled must store certain values 2654 * A pending message being re-assembled must store certain values
2655 * to handle subsequent fragments correctly. The following functions 2655 * to handle subsequent fragments correctly. The following functions
2656 * help storing these values in unused, available fields in the 2656 * help storing these values in unused, available fields in the
2657 * pending message. This makes dynamic memory allocation unecessary. 2657 * pending message. This makes dynamic memory allocation unecessary.
2658 */ 2658 */
@@ -2692,11 +2692,11 @@ static void incr_timer_cnt(struct sk_buff *buf)
2692 msg_incr_reroute_cnt(buf_msg(buf)); 2692 msg_incr_reroute_cnt(buf_msg(buf));
2693} 2693}
2694 2694
2695/* 2695/*
2696 * tipc_link_recv_fragment(): Called with node lock on. Returns 2696 * tipc_link_recv_fragment(): Called with node lock on. Returns
2697 * the reassembled buffer if message is complete. 2697 * the reassembled buffer if message is complete.
2698 */ 2698 */
2699int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, 2699int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2700 struct tipc_msg **m) 2700 struct tipc_msg **m)
2701{ 2701{
2702 struct sk_buff *prev = NULL; 2702 struct sk_buff *prev = NULL;
@@ -2737,9 +2737,9 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2737 2737
2738 /* Prepare buffer for subsequent fragments. */ 2738 /* Prepare buffer for subsequent fragments. */
2739 2739
2740 set_long_msg_seqno(pbuf, long_msg_seq_no); 2740 set_long_msg_seqno(pbuf, long_msg_seq_no);
2741 set_fragm_size(pbuf,fragm_sz); 2741 set_fragm_size(pbuf,fragm_sz);
2742 set_expected_frags(pbuf,exp_fragm_cnt - 1); 2742 set_expected_frags(pbuf,exp_fragm_cnt - 1);
2743 } else { 2743 } else {
2744 warn("Link unable to reassemble fragmented message\n"); 2744 warn("Link unable to reassemble fragmented message\n");
2745 } 2745 }
@@ -2765,7 +2765,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2765 *m = buf_msg(pbuf); 2765 *m = buf_msg(pbuf);
2766 return 1; 2766 return 1;
2767 } 2767 }
2768 set_expected_frags(pbuf,exp_frags); 2768 set_expected_frags(pbuf,exp_frags);
2769 return 0; 2769 return 0;
2770 } 2770 }
2771 dbg(" Discarding orphan fragment %x\n",fbuf); 2771 dbg(" Discarding orphan fragment %x\n",fbuf);
@@ -2849,10 +2849,10 @@ void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
2849 * link_find_link - locate link by name 2849 * link_find_link - locate link by name
2850 * @name - ptr to link name string 2850 * @name - ptr to link name string
2851 * @node - ptr to area to be filled with ptr to associated node 2851 * @node - ptr to area to be filled with ptr to associated node
2852 * 2852 *
2853 * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted; 2853 * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted;
2854 * this also prevents link deletion. 2854 * this also prevents link deletion.
2855 * 2855 *
2856 * Returns pointer to link (or 0 if invalid link name). 2856 * Returns pointer to link (or 0 if invalid link name).
2857 */ 2857 */
2858 2858
@@ -2860,7 +2860,7 @@ static struct link *link_find_link(const char *name, struct node **node)
2860{ 2860{
2861 struct link_name link_name_parts; 2861 struct link_name link_name_parts;
2862 struct bearer *b_ptr; 2862 struct bearer *b_ptr;
2863 struct link *l_ptr; 2863 struct link *l_ptr;
2864 2864
2865 if (!link_name_validate(name, &link_name_parts)) 2865 if (!link_name_validate(name, &link_name_parts))
2866 return NULL; 2866 return NULL;
@@ -2869,7 +2869,7 @@ static struct link *link_find_link(const char *name, struct node **node)
2869 if (!b_ptr) 2869 if (!b_ptr)
2870 return NULL; 2870 return NULL;
2871 2871
2872 *node = tipc_node_find(link_name_parts.addr_peer); 2872 *node = tipc_node_find(link_name_parts.addr_peer);
2873 if (!*node) 2873 if (!*node)
2874 return NULL; 2874 return NULL;
2875 2875
@@ -2880,14 +2880,14 @@ static struct link *link_find_link(const char *name, struct node **node)
2880 return l_ptr; 2880 return l_ptr;
2881} 2881}
2882 2882
2883struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, 2883struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space,
2884 u16 cmd) 2884 u16 cmd)
2885{ 2885{
2886 struct tipc_link_config *args; 2886 struct tipc_link_config *args;
2887 u32 new_value; 2887 u32 new_value;
2888 struct link *l_ptr; 2888 struct link *l_ptr;
2889 struct node *node; 2889 struct node *node;
2890 int res; 2890 int res;
2891 2891
2892 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) 2892 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG))
2893 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2893 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
@@ -2899,40 +2899,40 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
2899 if ((cmd == TIPC_CMD_SET_LINK_WINDOW) && 2899 if ((cmd == TIPC_CMD_SET_LINK_WINDOW) &&
2900 (tipc_bclink_set_queue_limits(new_value) == 0)) 2900 (tipc_bclink_set_queue_limits(new_value) == 0))
2901 return tipc_cfg_reply_none(); 2901 return tipc_cfg_reply_none();
2902 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 2902 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
2903 " (cannot change setting on broadcast link)"); 2903 " (cannot change setting on broadcast link)");
2904 } 2904 }
2905 2905
2906 read_lock_bh(&tipc_net_lock); 2906 read_lock_bh(&tipc_net_lock);
2907 l_ptr = link_find_link(args->name, &node); 2907 l_ptr = link_find_link(args->name, &node);
2908 if (!l_ptr) { 2908 if (!l_ptr) {
2909 read_unlock_bh(&tipc_net_lock); 2909 read_unlock_bh(&tipc_net_lock);
2910 return tipc_cfg_reply_error_string("link not found"); 2910 return tipc_cfg_reply_error_string("link not found");
2911 } 2911 }
2912 2912
2913 tipc_node_lock(node); 2913 tipc_node_lock(node);
2914 res = -EINVAL; 2914 res = -EINVAL;
2915 switch (cmd) { 2915 switch (cmd) {
2916 case TIPC_CMD_SET_LINK_TOL: 2916 case TIPC_CMD_SET_LINK_TOL:
2917 if ((new_value >= TIPC_MIN_LINK_TOL) && 2917 if ((new_value >= TIPC_MIN_LINK_TOL) &&
2918 (new_value <= TIPC_MAX_LINK_TOL)) { 2918 (new_value <= TIPC_MAX_LINK_TOL)) {
2919 link_set_supervision_props(l_ptr, new_value); 2919 link_set_supervision_props(l_ptr, new_value);
2920 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 2920 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2921 0, 0, new_value, 0, 0); 2921 0, 0, new_value, 0, 0);
2922 res = TIPC_OK; 2922 res = TIPC_OK;
2923 } 2923 }
2924 break; 2924 break;
2925 case TIPC_CMD_SET_LINK_PRI: 2925 case TIPC_CMD_SET_LINK_PRI:
2926 if ((new_value >= TIPC_MIN_LINK_PRI) && 2926 if ((new_value >= TIPC_MIN_LINK_PRI) &&
2927 (new_value <= TIPC_MAX_LINK_PRI)) { 2927 (new_value <= TIPC_MAX_LINK_PRI)) {
2928 l_ptr->priority = new_value; 2928 l_ptr->priority = new_value;
2929 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 2929 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2930 0, 0, 0, new_value, 0); 2930 0, 0, 0, new_value, 0);
2931 res = TIPC_OK; 2931 res = TIPC_OK;
2932 } 2932 }
2933 break; 2933 break;
2934 case TIPC_CMD_SET_LINK_WINDOW: 2934 case TIPC_CMD_SET_LINK_WINDOW:
2935 if ((new_value >= TIPC_MIN_LINK_WIN) && 2935 if ((new_value >= TIPC_MIN_LINK_WIN) &&
2936 (new_value <= TIPC_MAX_LINK_WIN)) { 2936 (new_value <= TIPC_MAX_LINK_WIN)) {
2937 tipc_link_set_queue_limits(l_ptr, new_value); 2937 tipc_link_set_queue_limits(l_ptr, new_value);
2938 res = TIPC_OK; 2938 res = TIPC_OK;
@@ -2943,7 +2943,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
2943 2943
2944 read_unlock_bh(&tipc_net_lock); 2944 read_unlock_bh(&tipc_net_lock);
2945 if (res) 2945 if (res)
2946 return tipc_cfg_reply_error_string("cannot change link setting"); 2946 return tipc_cfg_reply_error_string("cannot change link setting");
2947 2947
2948 return tipc_cfg_reply_none(); 2948 return tipc_cfg_reply_none();
2949} 2949}
@@ -2963,7 +2963,7 @@ static void link_reset_statistics(struct link *l_ptr)
2963struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) 2963struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space)
2964{ 2964{
2965 char *link_name; 2965 char *link_name;
2966 struct link *l_ptr; 2966 struct link *l_ptr;
2967 struct node *node; 2967 struct node *node;
2968 2968
2969 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) 2969 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
@@ -2977,7 +2977,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
2977 } 2977 }
2978 2978
2979 read_lock_bh(&tipc_net_lock); 2979 read_lock_bh(&tipc_net_lock);
2980 l_ptr = link_find_link(link_name, &node); 2980 l_ptr = link_find_link(link_name, &node);
2981 if (!l_ptr) { 2981 if (!l_ptr) {
2982 read_unlock_bh(&tipc_net_lock); 2982 read_unlock_bh(&tipc_net_lock);
2983 return tipc_cfg_reply_error_string("link not found"); 2983 return tipc_cfg_reply_error_string("link not found");
@@ -3004,14 +3004,14 @@ static u32 percent(u32 count, u32 total)
3004 * @name: link name 3004 * @name: link name
3005 * @buf: print buffer area 3005 * @buf: print buffer area
3006 * @buf_size: size of print buffer area 3006 * @buf_size: size of print buffer area
3007 * 3007 *
3008 * Returns length of print buffer data string (or 0 if error) 3008 * Returns length of print buffer data string (or 0 if error)
3009 */ 3009 */
3010 3010
3011static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) 3011static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
3012{ 3012{
3013 struct print_buf pb; 3013 struct print_buf pb;
3014 struct link *l_ptr; 3014 struct link *l_ptr;
3015 struct node *node; 3015 struct node *node;
3016 char *status; 3016 char *status;
3017 u32 profile_total = 0; 3017 u32 profile_total = 0;
@@ -3022,7 +3022,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
3022 tipc_printbuf_init(&pb, buf, buf_size); 3022 tipc_printbuf_init(&pb, buf, buf_size);
3023 3023
3024 read_lock_bh(&tipc_net_lock); 3024 read_lock_bh(&tipc_net_lock);
3025 l_ptr = link_find_link(name, &node); 3025 l_ptr = link_find_link(name, &node);
3026 if (!l_ptr) { 3026 if (!l_ptr) {
3027 read_unlock_bh(&tipc_net_lock); 3027 read_unlock_bh(&tipc_net_lock);
3028 return 0; 3028 return 0;
@@ -3036,28 +3036,28 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
3036 else 3036 else
3037 status = "DEFUNCT"; 3037 status = "DEFUNCT";
3038 tipc_printf(&pb, "Link <%s>\n" 3038 tipc_printf(&pb, "Link <%s>\n"
3039 " %s MTU:%u Priority:%u Tolerance:%u ms" 3039 " %s MTU:%u Priority:%u Tolerance:%u ms"
3040 " Window:%u packets\n", 3040 " Window:%u packets\n",
3041 l_ptr->name, status, link_max_pkt(l_ptr), 3041 l_ptr->name, status, link_max_pkt(l_ptr),
3042 l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]); 3042 l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]);
3043 tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", 3043 tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
3044 l_ptr->next_in_no - l_ptr->stats.recv_info, 3044 l_ptr->next_in_no - l_ptr->stats.recv_info,
3045 l_ptr->stats.recv_fragments, 3045 l_ptr->stats.recv_fragments,
3046 l_ptr->stats.recv_fragmented, 3046 l_ptr->stats.recv_fragmented,
3047 l_ptr->stats.recv_bundles, 3047 l_ptr->stats.recv_bundles,
3048 l_ptr->stats.recv_bundled); 3048 l_ptr->stats.recv_bundled);
3049 tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", 3049 tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n",
3050 l_ptr->next_out_no - l_ptr->stats.sent_info, 3050 l_ptr->next_out_no - l_ptr->stats.sent_info,
3051 l_ptr->stats.sent_fragments, 3051 l_ptr->stats.sent_fragments,
3052 l_ptr->stats.sent_fragmented, 3052 l_ptr->stats.sent_fragmented,
3053 l_ptr->stats.sent_bundles, 3053 l_ptr->stats.sent_bundles,
3054 l_ptr->stats.sent_bundled); 3054 l_ptr->stats.sent_bundled);
3055 profile_total = l_ptr->stats.msg_length_counts; 3055 profile_total = l_ptr->stats.msg_length_counts;
3056 if (!profile_total) 3056 if (!profile_total)
3057 profile_total = 1; 3057 profile_total = 1;
3058 tipc_printf(&pb, " TX profile sample:%u packets average:%u octets\n" 3058 tipc_printf(&pb, " TX profile sample:%u packets average:%u octets\n"
3059 " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% " 3059 " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% "
3060 "-16354:%u%% -32768:%u%% -66000:%u%%\n", 3060 "-16354:%u%% -32768:%u%% -66000:%u%%\n",
3061 l_ptr->stats.msg_length_counts, 3061 l_ptr->stats.msg_length_counts,
3062 l_ptr->stats.msg_lengths_total / profile_total, 3062 l_ptr->stats.msg_lengths_total / profile_total,
3063 percent(l_ptr->stats.msg_length_profile[0], profile_total), 3063 percent(l_ptr->stats.msg_length_profile[0], profile_total),
@@ -3067,21 +3067,21 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
3067 percent(l_ptr->stats.msg_length_profile[4], profile_total), 3067 percent(l_ptr->stats.msg_length_profile[4], profile_total),
3068 percent(l_ptr->stats.msg_length_profile[5], profile_total), 3068 percent(l_ptr->stats.msg_length_profile[5], profile_total),
3069 percent(l_ptr->stats.msg_length_profile[6], profile_total)); 3069 percent(l_ptr->stats.msg_length_profile[6], profile_total));
3070 tipc_printf(&pb, " RX states:%u probes:%u naks:%u defs:%u dups:%u\n", 3070 tipc_printf(&pb, " RX states:%u probes:%u naks:%u defs:%u dups:%u\n",
3071 l_ptr->stats.recv_states, 3071 l_ptr->stats.recv_states,
3072 l_ptr->stats.recv_probes, 3072 l_ptr->stats.recv_probes,
3073 l_ptr->stats.recv_nacks, 3073 l_ptr->stats.recv_nacks,
3074 l_ptr->stats.deferred_recv, 3074 l_ptr->stats.deferred_recv,
3075 l_ptr->stats.duplicates); 3075 l_ptr->stats.duplicates);
3076 tipc_printf(&pb, " TX states:%u probes:%u naks:%u acks:%u dups:%u\n", 3076 tipc_printf(&pb, " TX states:%u probes:%u naks:%u acks:%u dups:%u\n",
3077 l_ptr->stats.sent_states, 3077 l_ptr->stats.sent_states,
3078 l_ptr->stats.sent_probes, 3078 l_ptr->stats.sent_probes,
3079 l_ptr->stats.sent_nacks, 3079 l_ptr->stats.sent_nacks,
3080 l_ptr->stats.sent_acks, 3080 l_ptr->stats.sent_acks,
3081 l_ptr->stats.retransmitted); 3081 l_ptr->stats.retransmitted);
3082 tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", 3082 tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n",
3083 l_ptr->stats.bearer_congs, 3083 l_ptr->stats.bearer_congs,
3084 l_ptr->stats.link_congs, 3084 l_ptr->stats.link_congs,
3085 l_ptr->stats.max_queue_sz, 3085 l_ptr->stats.max_queue_sz,
3086 l_ptr->stats.queue_sz_counts 3086 l_ptr->stats.queue_sz_counts
3087 ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts) 3087 ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts)
@@ -3113,7 +3113,7 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
3113 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); 3113 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
3114 if (!str_len) { 3114 if (!str_len) {
3115 buf_discard(buf); 3115 buf_discard(buf);
3116 return tipc_cfg_reply_error_string("link not found"); 3116 return tipc_cfg_reply_error_string("link not found");
3117 } 3117 }
3118 3118
3119 skb_put(buf, TLV_SPACE(str_len)); 3119 skb_put(buf, TLV_SPACE(str_len));
@@ -3164,7 +3164,7 @@ int link_control(const char *name, u32 op, u32 val)
3164 * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination 3164 * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination
3165 * @dest: network address of destination node 3165 * @dest: network address of destination node
3166 * @selector: used to select from set of active links 3166 * @selector: used to select from set of active links
3167 * 3167 *
3168 * If no active link can be found, uses default maximum packet size. 3168 * If no active link can be found, uses default maximum packet size.
3169 */ 3169 */
3170 3170
@@ -3173,11 +3173,11 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
3173 struct node *n_ptr; 3173 struct node *n_ptr;
3174 struct link *l_ptr; 3174 struct link *l_ptr;
3175 u32 res = MAX_PKT_DEFAULT; 3175 u32 res = MAX_PKT_DEFAULT;
3176 3176
3177 if (dest == tipc_own_addr) 3177 if (dest == tipc_own_addr)
3178 return MAX_MSG_SIZE; 3178 return MAX_MSG_SIZE;
3179 3179
3180 read_lock_bh(&tipc_net_lock); 3180 read_lock_bh(&tipc_net_lock);
3181 n_ptr = tipc_node_select(dest, selector); 3181 n_ptr = tipc_node_select(dest, selector);
3182 if (n_ptr) { 3182 if (n_ptr) {
3183 tipc_node_lock(n_ptr); 3183 tipc_node_lock(n_ptr);
@@ -3186,7 +3186,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
3186 res = link_max_pkt(l_ptr); 3186 res = link_max_pkt(l_ptr);
3187 tipc_node_unlock(n_ptr); 3187 tipc_node_unlock(n_ptr);
3188 } 3188 }
3189 read_unlock_bh(&tipc_net_lock); 3189 read_unlock_bh(&tipc_net_lock);
3190 return res; 3190 return res;
3191} 3191}
3192 3192
@@ -3244,8 +3244,8 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
3244 tipc_printf(buf, "%u]", 3244 tipc_printf(buf, "%u]",
3245 msg_seqno(buf_msg 3245 msg_seqno(buf_msg
3246 (l_ptr->last_out)), l_ptr->out_queue_size); 3246 (l_ptr->last_out)), l_ptr->out_queue_size);
3247 if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) - 3247 if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) -
3248 msg_seqno(buf_msg(l_ptr->first_out))) 3248 msg_seqno(buf_msg(l_ptr->first_out)))
3249 != (l_ptr->out_queue_size - 1)) 3249 != (l_ptr->out_queue_size - 1))
3250 || (l_ptr->last_out->next != 0)) { 3250 || (l_ptr->last_out->next != 0)) {
3251 tipc_printf(buf, "\nSend queue inconsistency\n"); 3251 tipc_printf(buf, "\nSend queue inconsistency\n");
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 2d3c157f707d..52f3e7c1871f 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/link.h: Include file for TIPC link code 2 * net/tipc/link.h: Include file for TIPC link code
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -45,8 +45,8 @@
45#define PUSH_FAILED 1 45#define PUSH_FAILED 1
46#define PUSH_FINISHED 2 46#define PUSH_FINISHED 2
47 47
48/* 48/*
49 * Link states 49 * Link states
50 */ 50 */
51 51
52#define WORKING_WORKING 560810u 52#define WORKING_WORKING 560810u
@@ -54,7 +54,7 @@
54#define RESET_UNKNOWN 560812u 54#define RESET_UNKNOWN 560812u
55#define RESET_RESET 560813u 55#define RESET_RESET 560813u
56 56
57/* 57/*
58 * Starting value for maximum packet size negotiation on unicast links 58 * Starting value for maximum packet size negotiation on unicast links
59 * (unless bearer MTU is less) 59 * (unless bearer MTU is less)
60 */ 60 */
@@ -74,7 +74,7 @@
74 * @peer_session: link session # being used by peer end of link 74 * @peer_session: link session # being used by peer end of link
75 * @peer_bearer_id: bearer id used by link's peer endpoint 75 * @peer_bearer_id: bearer id used by link's peer endpoint
76 * @b_ptr: pointer to bearer used by link 76 * @b_ptr: pointer to bearer used by link
77 * @tolerance: minimum link continuity loss needed to reset link [in ms] 77 * @tolerance: minimum link continuity loss needed to reset link [in ms]
78 * @continuity_interval: link continuity testing interval [in ms] 78 * @continuity_interval: link continuity testing interval [in ms]
79 * @abort_limit: # of unacknowledged continuity probes needed to reset link 79 * @abort_limit: # of unacknowledged continuity probes needed to reset link
80 * @state: current state of link FSM 80 * @state: current state of link FSM
@@ -110,7 +110,7 @@
110 * @stats: collects statistics regarding link activity 110 * @stats: collects statistics regarding link activity
111 * @print_buf: print buffer used to log link activity 111 * @print_buf: print buffer used to log link activity
112 */ 112 */
113 113
114struct link { 114struct link {
115 u32 addr; 115 u32 addr;
116 char name[TIPC_MAX_LINK_NAME]; 116 char name[TIPC_MAX_LINK_NAME];
@@ -143,18 +143,18 @@ struct link {
143 u32 exp_msg_count; 143 u32 exp_msg_count;
144 u32 reset_checkpoint; 144 u32 reset_checkpoint;
145 145
146 /* Max packet negotiation */ 146 /* Max packet negotiation */
147 u32 max_pkt; 147 u32 max_pkt;
148 u32 max_pkt_target; 148 u32 max_pkt_target;
149 u32 max_pkt_probes; 149 u32 max_pkt_probes;
150 150
151 /* Sending */ 151 /* Sending */
152 u32 out_queue_size; 152 u32 out_queue_size;
153 struct sk_buff *first_out; 153 struct sk_buff *first_out;
154 struct sk_buff *last_out; 154 struct sk_buff *last_out;
155 u32 next_out_no; 155 u32 next_out_no;
156 u32 last_retransmitted; 156 u32 last_retransmitted;
157 u32 stale_count; 157 u32 stale_count;
158 158
159 /* Reception */ 159 /* Reception */
160 u32 next_in_no; 160 u32 next_in_no;
@@ -174,7 +174,7 @@ struct link {
174 u32 long_msg_seq_no; 174 u32 long_msg_seq_no;
175 struct sk_buff *defragm_buf; 175 struct sk_buff *defragm_buf;
176 176
177 /* Statistics */ 177 /* Statistics */
178 struct { 178 struct {
179 u32 sent_info; /* used in counting # sent packets */ 179 u32 sent_info; /* used in counting # sent packets */
180 u32 recv_info; /* used in counting # recv'd packets */ 180 u32 recv_info; /* used in counting # recv'd packets */
@@ -239,9 +239,9 @@ void tipc_link_reset(struct link *l_ptr);
239int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); 239int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector);
240int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf); 240int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf);
241u32 tipc_link_get_max_pkt(u32 dest,u32 selector); 241u32 tipc_link_get_max_pkt(u32 dest,u32 selector);
242int tipc_link_send_sections_fast(struct port* sender, 242int tipc_link_send_sections_fast(struct port* sender,
243 struct iovec const *msg_sect, 243 struct iovec const *msg_sect,
244 const u32 num_sect, 244 const u32 num_sect,
245 u32 destnode); 245 u32 destnode);
246int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); 246int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
247void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr, 247void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
@@ -250,7 +250,7 @@ void tipc_link_recv_bundle(struct sk_buff *buf);
250int tipc_link_recv_fragment(struct sk_buff **pending, 250int tipc_link_recv_fragment(struct sk_buff **pending,
251 struct sk_buff **fb, 251 struct sk_buff **fb,
252 struct tipc_msg **msg); 252 struct tipc_msg **msg);
253void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, 253void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap,
254 u32 tolerance, u32 priority, u32 acked_mtu); 254 u32 tolerance, u32 priority, u32 acked_mtu);
255void tipc_link_push_queue(struct link *l_ptr); 255void tipc_link_push_queue(struct link *l_ptr);
256u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, 256u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 3bd345a344e5..782485468fb2 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/msg.c: TIPC message header routines 2 * net/tipc/msg.c: TIPC message header routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 6699aaf7bd4c..62d549063604 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/msg.h: Include file for TIPC message header routines 2 * net/tipc/msg.h: Include file for TIPC message header routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -56,10 +56,10 @@
56 56
57/* 57/*
58 TIPC user data message header format, version 2 58 TIPC user data message header format, version 2
59 59
60 - Fundamental definitions available to privileged TIPC users 60 - Fundamental definitions available to privileged TIPC users
61 are located in tipc_msg.h. 61 are located in tipc_msg.h.
62 - Remaining definitions available to TIPC internal users appear below. 62 - Remaining definitions available to TIPC internal users appear below.
63*/ 63*/
64 64
65 65
@@ -75,7 +75,7 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
75 msg_set_word(m, w, (word |= (val << pos))); 75 msg_set_word(m, w, (word |= (val << pos)));
76} 76}
77 77
78/* 78/*
79 * Word 0 79 * Word 0
80 */ 80 */
81 81
@@ -84,7 +84,7 @@ static inline u32 msg_version(struct tipc_msg *m)
84 return msg_bits(m, 0, 29, 7); 84 return msg_bits(m, 0, 29, 7);
85} 85}
86 86
87static inline void msg_set_version(struct tipc_msg *m) 87static inline void msg_set_version(struct tipc_msg *m)
88{ 88{
89 msg_set_bits(m, 0, 29, 0xf, TIPC_VERSION); 89 msg_set_bits(m, 0, 29, 0xf, TIPC_VERSION);
90} 90}
@@ -99,47 +99,47 @@ static inline u32 msg_isdata(struct tipc_msg *m)
99 return (msg_user(m) <= DATA_CRITICAL); 99 return (msg_user(m) <= DATA_CRITICAL);
100} 100}
101 101
102static inline void msg_set_user(struct tipc_msg *m, u32 n) 102static inline void msg_set_user(struct tipc_msg *m, u32 n)
103{ 103{
104 msg_set_bits(m, 0, 25, 0xf, n); 104 msg_set_bits(m, 0, 25, 0xf, n);
105} 105}
106 106
107static inline void msg_set_importance(struct tipc_msg *m, u32 i) 107static inline void msg_set_importance(struct tipc_msg *m, u32 i)
108{ 108{
109 msg_set_user(m, i); 109 msg_set_user(m, i);
110} 110}
111 111
112static inline void msg_set_hdr_sz(struct tipc_msg *m,u32 n) 112static inline void msg_set_hdr_sz(struct tipc_msg *m,u32 n)
113{ 113{
114 msg_set_bits(m, 0, 21, 0xf, n>>2); 114 msg_set_bits(m, 0, 21, 0xf, n>>2);
115} 115}
116 116
117static inline int msg_non_seq(struct tipc_msg *m) 117static inline int msg_non_seq(struct tipc_msg *m)
118{ 118{
119 return msg_bits(m, 0, 20, 1); 119 return msg_bits(m, 0, 20, 1);
120} 120}
121 121
122static inline void msg_set_non_seq(struct tipc_msg *m) 122static inline void msg_set_non_seq(struct tipc_msg *m)
123{ 123{
124 msg_set_bits(m, 0, 20, 1, 1); 124 msg_set_bits(m, 0, 20, 1, 1);
125} 125}
126 126
127static inline int msg_dest_droppable(struct tipc_msg *m) 127static inline int msg_dest_droppable(struct tipc_msg *m)
128{ 128{
129 return msg_bits(m, 0, 19, 1); 129 return msg_bits(m, 0, 19, 1);
130} 130}
131 131
132static inline void msg_set_dest_droppable(struct tipc_msg *m, u32 d) 132static inline void msg_set_dest_droppable(struct tipc_msg *m, u32 d)
133{ 133{
134 msg_set_bits(m, 0, 19, 1, d); 134 msg_set_bits(m, 0, 19, 1, d);
135} 135}
136 136
137static inline int msg_src_droppable(struct tipc_msg *m) 137static inline int msg_src_droppable(struct tipc_msg *m)
138{ 138{
139 return msg_bits(m, 0, 18, 1); 139 return msg_bits(m, 0, 18, 1);
140} 140}
141 141
142static inline void msg_set_src_droppable(struct tipc_msg *m, u32 d) 142static inline void msg_set_src_droppable(struct tipc_msg *m, u32 d)
143{ 143{
144 msg_set_bits(m, 0, 18, 1, d); 144 msg_set_bits(m, 0, 18, 1, d);
145} 145}
@@ -150,31 +150,31 @@ static inline void msg_set_size(struct tipc_msg *m, u32 sz)
150} 150}
151 151
152 152
153/* 153/*
154 * Word 1 154 * Word 1
155 */ 155 */
156 156
157static inline void msg_set_type(struct tipc_msg *m, u32 n) 157static inline void msg_set_type(struct tipc_msg *m, u32 n)
158{ 158{
159 msg_set_bits(m, 1, 29, 0x7, n); 159 msg_set_bits(m, 1, 29, 0x7, n);
160} 160}
161 161
162static inline void msg_set_errcode(struct tipc_msg *m, u32 err) 162static inline void msg_set_errcode(struct tipc_msg *m, u32 err)
163{ 163{
164 msg_set_bits(m, 1, 25, 0xf, err); 164 msg_set_bits(m, 1, 25, 0xf, err);
165} 165}
166 166
167static inline u32 msg_reroute_cnt(struct tipc_msg *m) 167static inline u32 msg_reroute_cnt(struct tipc_msg *m)
168{ 168{
169 return msg_bits(m, 1, 21, 0xf); 169 return msg_bits(m, 1, 21, 0xf);
170} 170}
171 171
172static inline void msg_incr_reroute_cnt(struct tipc_msg *m) 172static inline void msg_incr_reroute_cnt(struct tipc_msg *m)
173{ 173{
174 msg_set_bits(m, 1, 21, 0xf, msg_reroute_cnt(m) + 1); 174 msg_set_bits(m, 1, 21, 0xf, msg_reroute_cnt(m) + 1);
175} 175}
176 176
177static inline void msg_reset_reroute_cnt(struct tipc_msg *m) 177static inline void msg_reset_reroute_cnt(struct tipc_msg *m)
178{ 178{
179 msg_set_bits(m, 1, 21, 0xf, 0); 179 msg_set_bits(m, 1, 21, 0xf, 0);
180} 180}
@@ -184,12 +184,12 @@ static inline u32 msg_lookup_scope(struct tipc_msg *m)
184 return msg_bits(m, 1, 19, 0x3); 184 return msg_bits(m, 1, 19, 0x3);
185} 185}
186 186
187static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n) 187static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n)
188{ 188{
189 msg_set_bits(m, 1, 19, 0x3, n); 189 msg_set_bits(m, 1, 19, 0x3, n);
190} 190}
191 191
192static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz) 192static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz)
193{ 193{
194 u32 hsz = msg_hdr_sz(m); 194 u32 hsz = msg_hdr_sz(m);
195 char *to = (char *)&m->hdr[hsz/4]; 195 char *to = (char *)&m->hdr[hsz/4];
@@ -206,13 +206,13 @@ static inline u32 msg_bcast_ack(struct tipc_msg *m)
206 return msg_bits(m, 1, 0, 0xffff); 206 return msg_bits(m, 1, 0, 0xffff);
207} 207}
208 208
209static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n) 209static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n)
210{ 210{
211 msg_set_bits(m, 1, 0, 0xffff, n); 211 msg_set_bits(m, 1, 0, 0xffff, n);
212} 212}
213 213
214 214
215/* 215/*
216 * Word 2 216 * Word 2
217 */ 217 */
218 218
@@ -221,7 +221,7 @@ static inline u32 msg_ack(struct tipc_msg *m)
221 return msg_bits(m, 2, 16, 0xffff); 221 return msg_bits(m, 2, 16, 0xffff);
222} 222}
223 223
224static inline void msg_set_ack(struct tipc_msg *m, u32 n) 224static inline void msg_set_ack(struct tipc_msg *m, u32 n)
225{ 225{
226 msg_set_bits(m, 2, 16, 0xffff, n); 226 msg_set_bits(m, 2, 16, 0xffff, n);
227} 227}
@@ -231,48 +231,48 @@ static inline u32 msg_seqno(struct tipc_msg *m)
231 return msg_bits(m, 2, 0, 0xffff); 231 return msg_bits(m, 2, 0, 0xffff);
232} 232}
233 233
234static inline void msg_set_seqno(struct tipc_msg *m, u32 n) 234static inline void msg_set_seqno(struct tipc_msg *m, u32 n)
235{ 235{
236 msg_set_bits(m, 2, 0, 0xffff, n); 236 msg_set_bits(m, 2, 0, 0xffff, n);
237} 237}
238 238
239 239
240/* 240/*
241 * Words 3-10 241 * Words 3-10
242 */ 242 */
243 243
244 244
245static inline void msg_set_prevnode(struct tipc_msg *m, u32 a) 245static inline void msg_set_prevnode(struct tipc_msg *m, u32 a)
246{ 246{
247 msg_set_word(m, 3, a); 247 msg_set_word(m, 3, a);
248} 248}
249 249
250static inline void msg_set_origport(struct tipc_msg *m, u32 p) 250static inline void msg_set_origport(struct tipc_msg *m, u32 p)
251{ 251{
252 msg_set_word(m, 4, p); 252 msg_set_word(m, 4, p);
253} 253}
254 254
255static inline void msg_set_destport(struct tipc_msg *m, u32 p) 255static inline void msg_set_destport(struct tipc_msg *m, u32 p)
256{ 256{
257 msg_set_word(m, 5, p); 257 msg_set_word(m, 5, p);
258} 258}
259 259
260static inline void msg_set_mc_netid(struct tipc_msg *m, u32 p) 260static inline void msg_set_mc_netid(struct tipc_msg *m, u32 p)
261{ 261{
262 msg_set_word(m, 5, p); 262 msg_set_word(m, 5, p);
263} 263}
264 264
265static inline void msg_set_orignode(struct tipc_msg *m, u32 a) 265static inline void msg_set_orignode(struct tipc_msg *m, u32 a)
266{ 266{
267 msg_set_word(m, 6, a); 267 msg_set_word(m, 6, a);
268} 268}
269 269
270static inline void msg_set_destnode(struct tipc_msg *m, u32 a) 270static inline void msg_set_destnode(struct tipc_msg *m, u32 a)
271{ 271{
272 msg_set_word(m, 7, a); 272 msg_set_word(m, 7, a);
273} 273}
274 274
275static inline int msg_is_dest(struct tipc_msg *m, u32 d) 275static inline int msg_is_dest(struct tipc_msg *m, u32 d)
276{ 276{
277 return(msg_short(m) || (msg_destnode(m) == d)); 277 return(msg_short(m) || (msg_destnode(m) == d));
278} 278}
@@ -284,7 +284,7 @@ static inline u32 msg_routed(struct tipc_msg *m)
284 return(msg_destnode(m) ^ msg_orignode(m)) >> 11; 284 return(msg_destnode(m) ^ msg_orignode(m)) >> 11;
285} 285}
286 286
287static inline void msg_set_nametype(struct tipc_msg *m, u32 n) 287static inline void msg_set_nametype(struct tipc_msg *m, u32 n)
288{ 288{
289 msg_set_word(m, 8, n); 289 msg_set_word(m, 8, n);
290} 290}
@@ -309,17 +309,17 @@ static inline void msg_set_transp_seqno(struct tipc_msg *m, u32 n)
309 msg_set_word(m, 8, n); 309 msg_set_word(m, 8, n);
310} 310}
311 311
312static inline void msg_set_namelower(struct tipc_msg *m, u32 n) 312static inline void msg_set_namelower(struct tipc_msg *m, u32 n)
313{ 313{
314 msg_set_word(m, 9, n); 314 msg_set_word(m, 9, n);
315} 315}
316 316
317static inline void msg_set_nameinst(struct tipc_msg *m, u32 n) 317static inline void msg_set_nameinst(struct tipc_msg *m, u32 n)
318{ 318{
319 msg_set_namelower(m, n); 319 msg_set_namelower(m, n);
320} 320}
321 321
322static inline void msg_set_nameupper(struct tipc_msg *m, u32 n) 322static inline void msg_set_nameupper(struct tipc_msg *m, u32 n)
323{ 323{
324 msg_set_word(m, 10, n); 324 msg_set_word(m, 10, n);
325} 325}
@@ -329,7 +329,7 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
329 return (struct tipc_msg *)msg_data(m); 329 return (struct tipc_msg *)msg_data(m);
330} 330}
331 331
332static inline void msg_expand(struct tipc_msg *m, u32 destnode) 332static inline void msg_expand(struct tipc_msg *m, u32 destnode)
333{ 333{
334 if (!msg_short(m)) 334 if (!msg_short(m))
335 return; 335 return;
@@ -344,7 +344,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode)
344/* 344/*
345 TIPC internal message header format, version 2 345 TIPC internal message header format, version 2
346 346
347 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 347 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0
348 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 348 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
349 w0:|vers |msg usr|hdr sz |n|resrv| packet size | 349 w0:|vers |msg usr|hdr sz |n|resrv| packet size |
350 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 350 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -372,9 +372,9 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode)
372 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 372 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
373 373
374 NB: CONN_MANAGER use data message format. LINK_CONFIG has own format. 374 NB: CONN_MANAGER use data message format. LINK_CONFIG has own format.
375*/ 375*/
376 376
377/* 377/*
378 * Internal users 378 * Internal users
379 */ 379 */
380 380
@@ -390,7 +390,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode)
390#define INT_H_SIZE 40 390#define INT_H_SIZE 40
391#define DSC_H_SIZE 40 391#define DSC_H_SIZE 40
392 392
393/* 393/*
394 * Connection management protocol messages 394 * Connection management protocol messages
395 */ 395 */
396 396
@@ -398,7 +398,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode)
398#define CONN_PROBE_REPLY 1 398#define CONN_PROBE_REPLY 1
399#define CONN_ACK 2 399#define CONN_ACK 2
400 400
401/* 401/*
402 * Name distributor messages 402 * Name distributor messages
403 */ 403 */
404 404
@@ -406,7 +406,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode)
406#define WITHDRAWAL 1 406#define WITHDRAWAL 1
407 407
408 408
409/* 409/*
410 * Word 1 410 * Word 1
411 */ 411 */
412 412
@@ -425,13 +425,13 @@ static inline u32 msg_req_links(struct tipc_msg *m)
425 return msg_bits(m, 1, 16, 0xfff); 425 return msg_bits(m, 1, 16, 0xfff);
426} 426}
427 427
428static inline void msg_set_req_links(struct tipc_msg *m, u32 n) 428static inline void msg_set_req_links(struct tipc_msg *m, u32 n)
429{ 429{
430 msg_set_bits(m, 1, 16, 0xfff, n); 430 msg_set_bits(m, 1, 16, 0xfff, n);
431} 431}
432 432
433 433
434/* 434/*
435 * Word 2 435 * Word 2
436 */ 436 */
437 437
@@ -440,7 +440,7 @@ static inline u32 msg_dest_domain(struct tipc_msg *m)
440 return msg_word(m, 2); 440 return msg_word(m, 2);
441} 441}
442 442
443static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n) 443static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n)
444{ 444{
445 msg_set_word(m, 2, n); 445 msg_set_word(m, 2, n);
446} 446}
@@ -460,13 +460,13 @@ static inline u32 msg_bcgap_to(struct tipc_msg *m)
460 return msg_bits(m, 2, 0, 0xffff); 460 return msg_bits(m, 2, 0, 0xffff);
461} 461}
462 462
463static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n) 463static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n)
464{ 464{
465 msg_set_bits(m, 2, 0, 0xffff, n); 465 msg_set_bits(m, 2, 0, 0xffff, n);
466} 466}
467 467
468 468
469/* 469/*
470 * Word 4 470 * Word 4
471 */ 471 */
472 472
@@ -533,7 +533,7 @@ static inline void msg_set_link_selector(struct tipc_msg *m, u32 n)
533 msg_set_bits(m, 4, 0, 1, (n & 1)); 533 msg_set_bits(m, 4, 0, 1, (n & 1));
534} 534}
535 535
536/* 536/*
537 * Word 5 537 * Word 5
538 */ 538 */
539 539
@@ -603,7 +603,7 @@ static inline void msg_clear_redundant_link(struct tipc_msg *m)
603} 603}
604 604
605 605
606/* 606/*
607 * Word 9 607 * Word 9
608 */ 608 */
609 609
@@ -627,12 +627,12 @@ static inline void msg_set_bcast_tag(struct tipc_msg *m, u32 n)
627 msg_set_bits(m, 9, 16, 0xffff, n); 627 msg_set_bits(m, 9, 16, 0xffff, n);
628} 628}
629 629
630static inline u32 msg_max_pkt(struct tipc_msg *m) 630static inline u32 msg_max_pkt(struct tipc_msg *m)
631{ 631{
632 return (msg_bits(m, 9, 16, 0xffff) * 4); 632 return (msg_bits(m, 9, 16, 0xffff) * 4);
633} 633}
634 634
635static inline void msg_set_max_pkt(struct tipc_msg *m, u32 n) 635static inline void msg_set_max_pkt(struct tipc_msg *m, u32 n)
636{ 636{
637 msg_set_bits(m, 9, 16, 0xffff, (n / 4)); 637 msg_set_bits(m, 9, 16, 0xffff, (n / 4));
638} 638}
@@ -647,7 +647,7 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n)
647 msg_set_bits(m, 9, 0, 0xffff, n); 647 msg_set_bits(m, 9, 0, 0xffff, n);
648} 648}
649 649
650/* 650/*
651 * Routing table message data 651 * Routing table message data
652 */ 652 */
653 653
@@ -672,7 +672,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos)
672 msg_data(m)[pos + 4] = 1; 672 msg_data(m)[pos + 4] = 1;
673} 673}
674 674
675/* 675/*
676 * Segmentation message types 676 * Segmentation message types
677 */ 677 */
678 678
@@ -680,7 +680,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos)
680#define FRAGMENT 1 680#define FRAGMENT 1
681#define LAST_FRAGMENT 2 681#define LAST_FRAGMENT 2
682 682
683/* 683/*
684 * Link management protocol message types 684 * Link management protocol message types
685 */ 685 */
686 686
@@ -688,13 +688,13 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos)
688#define RESET_MSG 1 688#define RESET_MSG 1
689#define ACTIVATE_MSG 2 689#define ACTIVATE_MSG 2
690 690
691/* 691/*
692 * Changeover tunnel message types 692 * Changeover tunnel message types
693 */ 693 */
694#define DUPLICATE_MSG 0 694#define DUPLICATE_MSG 0
695#define ORIGINAL_MSG 1 695#define ORIGINAL_MSG 1
696 696
697/* 697/*
698 * Routing table message types 698 * Routing table message types
699 */ 699 */
700#define EXT_ROUTING_TABLE 0 700#define EXT_ROUTING_TABLE 0
@@ -703,7 +703,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos)
703#define ROUTE_ADDITION 3 703#define ROUTE_ADDITION 3
704#define ROUTE_REMOVAL 4 704#define ROUTE_REMOVAL 4
705 705
706/* 706/*
707 * Config protocol message types 707 * Config protocol message types
708 */ 708 */
709 709
@@ -724,7 +724,7 @@ static inline u32 msg_tot_importance(struct tipc_msg *m)
724} 724}
725 725
726 726
727static inline void msg_init(struct tipc_msg *m, u32 user, u32 type, 727static inline void msg_init(struct tipc_msg *m, u32 user, u32 type,
728 u32 err, u32 hsize, u32 destnode) 728 u32 err, u32 hsize, u32 destnode)
729{ 729{
730 memset(m, 0, hsize); 730 memset(m, 0, hsize);
@@ -741,7 +741,7 @@ static inline void msg_init(struct tipc_msg *m, u32 user, u32 type,
741 } 741 }
742} 742}
743 743
744/** 744/**
745 * msg_calc_data_size - determine total data size for message 745 * msg_calc_data_size - determine total data size for message
746 */ 746 */
747 747
@@ -755,15 +755,15 @@ static inline int msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect)
755 return dsz; 755 return dsz;
756} 756}
757 757
758/** 758/**
759 * msg_build - create message using specified header and data 759 * msg_build - create message using specified header and data
760 * 760 *
761 * Note: Caller must not hold any locks in case copy_from_user() is interrupted! 761 * Note: Caller must not hold any locks in case copy_from_user() is interrupted!
762 * 762 *
763 * Returns message data size or errno 763 * Returns message data size or errno
764 */ 764 */
765 765
766static inline int msg_build(struct tipc_msg *hdr, 766static inline int msg_build(struct tipc_msg *hdr,
767 struct iovec const *msg_sect, u32 num_sect, 767 struct iovec const *msg_sect, u32 num_sect,
768 int max_size, int usrmem, struct sk_buff** buf) 768 int max_size, int usrmem, struct sk_buff** buf)
769{ 769{
@@ -789,11 +789,11 @@ static inline int msg_build(struct tipc_msg *hdr,
789 memcpy((*buf)->data, (unchar *)hdr, hsz); 789 memcpy((*buf)->data, (unchar *)hdr, hsz);
790 for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { 790 for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) {
791 if (likely(usrmem)) 791 if (likely(usrmem))
792 res = !copy_from_user((*buf)->data + pos, 792 res = !copy_from_user((*buf)->data + pos,
793 msg_sect[cnt].iov_base, 793 msg_sect[cnt].iov_base,
794 msg_sect[cnt].iov_len); 794 msg_sect[cnt].iov_len);
795 else 795 else
796 memcpy((*buf)->data + pos, msg_sect[cnt].iov_base, 796 memcpy((*buf)->data + pos, msg_sect[cnt].iov_base,
797 msg_sect[cnt].iov_len); 797 msg_sect[cnt].iov_len);
798 pos += msg_sect[cnt].iov_len; 798 pos += msg_sect[cnt].iov_len;
799 } 799 }
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 7bf87cb26ef3..39fd1619febf 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/name_distr.c: TIPC name distribution code 2 * net/tipc/name_distr.c: TIPC name distribution code
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -53,15 +53,15 @@
53 * @upper: name sequence upper bound 53 * @upper: name sequence upper bound
54 * @ref: publishing port reference 54 * @ref: publishing port reference
55 * @key: publication key 55 * @key: publication key
56 * 56 *
57 * ===> All fields are stored in network byte order. <=== 57 * ===> All fields are stored in network byte order. <===
58 * 58 *
59 * First 3 fields identify (name or) name sequence being published. 59 * First 3 fields identify (name or) name sequence being published.
60 * Reference field uniquely identifies port that published name sequence. 60 * Reference field uniquely identifies port that published name sequence.
61 * Key field uniquely identifies publication, in the event a port has 61 * Key field uniquely identifies publication, in the event a port has
62 * multiple publications of the same name sequence. 62 * multiple publications of the same name sequence.
63 * 63 *
64 * Note: There is no field that identifies the publishing node because it is 64 * Note: There is no field that identifies the publishing node because it is
65 * the same for all items contained within a publication message. 65 * the same for all items contained within a publication message.
66 */ 66 */
67 67
@@ -74,12 +74,12 @@ struct distr_item {
74}; 74};
75 75
76/** 76/**
77 * List of externally visible publications by this node -- 77 * List of externally visible publications by this node --
78 * that is, all publications having scope > TIPC_NODE_SCOPE. 78 * that is, all publications having scope > TIPC_NODE_SCOPE.
79 */ 79 */
80 80
81static LIST_HEAD(publ_root); 81static LIST_HEAD(publ_root);
82static u32 publ_cnt = 0; 82static u32 publ_cnt = 0;
83 83
84/** 84/**
85 * publ_to_item - add publication info to a publication message 85 * publ_to_item - add publication info to a publication message
@@ -101,12 +101,12 @@ static void publ_to_item(struct distr_item *i, struct publication *p)
101 101
102static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) 102static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
103{ 103{
104 struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size); 104 struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size);
105 struct tipc_msg *msg; 105 struct tipc_msg *msg;
106 106
107 if (buf != NULL) { 107 if (buf != NULL) {
108 msg = buf_msg(buf); 108 msg = buf_msg(buf);
109 msg_init(msg, NAME_DISTRIBUTOR, type, TIPC_OK, 109 msg_init(msg, NAME_DISTRIBUTOR, type, TIPC_OK,
110 LONG_H_SIZE, dest); 110 LONG_H_SIZE, dest);
111 msg_set_size(msg, LONG_H_SIZE + size); 111 msg_set_size(msg, LONG_H_SIZE + size);
112 } 112 }
@@ -174,7 +174,7 @@ void tipc_named_node_up(unsigned long node)
174 u32 rest; 174 u32 rest;
175 u32 max_item_buf; 175 u32 max_item_buf;
176 176
177 read_lock_bh(&tipc_nametbl_lock); 177 read_lock_bh(&tipc_nametbl_lock);
178 max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; 178 max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
179 max_item_buf *= ITEM_SIZE; 179 max_item_buf *= ITEM_SIZE;
180 rest = publ_cnt * ITEM_SIZE; 180 rest = publ_cnt * ITEM_SIZE;
@@ -183,7 +183,7 @@ void tipc_named_node_up(unsigned long node)
183 if (!buf) { 183 if (!buf) {
184 left = (rest <= max_item_buf) ? rest : max_item_buf; 184 left = (rest <= max_item_buf) ? rest : max_item_buf;
185 rest -= left; 185 rest -= left;
186 buf = named_prepare_buf(PUBLICATION, left, node); 186 buf = named_prepare_buf(PUBLICATION, left, node);
187 if (!buf) { 187 if (!buf) {
188 warn("Bulk publication distribution failure\n"); 188 warn("Bulk publication distribution failure\n");
189 goto exit; 189 goto exit;
@@ -196,20 +196,20 @@ void tipc_named_node_up(unsigned long node)
196 if (!left) { 196 if (!left) {
197 msg_set_link_selector(buf_msg(buf), node); 197 msg_set_link_selector(buf_msg(buf), node);
198 dbg("tipc_named_node_up: sending publish msg to " 198 dbg("tipc_named_node_up: sending publish msg to "
199 "<%u.%u.%u>\n", tipc_zone(node), 199 "<%u.%u.%u>\n", tipc_zone(node),
200 tipc_cluster(node), tipc_node(node)); 200 tipc_cluster(node), tipc_node(node));
201 tipc_link_send(buf, node, node); 201 tipc_link_send(buf, node, node);
202 buf = NULL; 202 buf = NULL;
203 } 203 }
204 } 204 }
205exit: 205exit:
206 read_unlock_bh(&tipc_nametbl_lock); 206 read_unlock_bh(&tipc_nametbl_lock);
207} 207}
208 208
209/** 209/**
210 * node_is_down - remove publication associated with a failed node 210 * node_is_down - remove publication associated with a failed node
211 * 211 *
212 * Invoked for each publication issued by a newly failed node. 212 * Invoked for each publication issued by a newly failed node.
213 * Removes publication structure from name table & deletes it. 213 * Removes publication structure from name table & deletes it.
214 * In rare cases the link may have come back up again when this 214 * In rare cases the link may have come back up again when this
215 * function is called, and we have two items representing the same 215 * function is called, and we have two items representing the same
@@ -221,15 +221,15 @@ static void node_is_down(struct publication *publ)
221{ 221{
222 struct publication *p; 222 struct publication *p;
223 223
224 write_lock_bh(&tipc_nametbl_lock); 224 write_lock_bh(&tipc_nametbl_lock);
225 dbg("node_is_down: withdrawing %u, %u, %u\n", 225 dbg("node_is_down: withdrawing %u, %u, %u\n",
226 publ->type, publ->lower, publ->upper); 226 publ->type, publ->lower, publ->upper);
227 publ->key += 1222345; 227 publ->key += 1222345;
228 p = tipc_nametbl_remove_publ(publ->type, publ->lower, 228 p = tipc_nametbl_remove_publ(publ->type, publ->lower,
229 publ->node, publ->ref, publ->key); 229 publ->node, publ->ref, publ->key);
230 write_unlock_bh(&tipc_nametbl_lock); 230 write_unlock_bh(&tipc_nametbl_lock);
231 231
232 if (p != publ) { 232 if (p != publ) {
233 err("Unable to remove publication from failed node\n" 233 err("Unable to remove publication from failed node\n"
234 "(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n", 234 "(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
235 publ->type, publ->lower, publ->node, publ->ref, publ->key); 235 publ->type, publ->lower, publ->node, publ->ref, publ->key);
@@ -251,27 +251,27 @@ void tipc_named_recv(struct sk_buff *buf)
251 struct distr_item *item = (struct distr_item *)msg_data(msg); 251 struct distr_item *item = (struct distr_item *)msg_data(msg);
252 u32 count = msg_data_sz(msg) / ITEM_SIZE; 252 u32 count = msg_data_sz(msg) / ITEM_SIZE;
253 253
254 write_lock_bh(&tipc_nametbl_lock); 254 write_lock_bh(&tipc_nametbl_lock);
255 while (count--) { 255 while (count--) {
256 if (msg_type(msg) == PUBLICATION) { 256 if (msg_type(msg) == PUBLICATION) {
257 dbg("tipc_named_recv: got publication for %u, %u, %u\n", 257 dbg("tipc_named_recv: got publication for %u, %u, %u\n",
258 ntohl(item->type), ntohl(item->lower), 258 ntohl(item->type), ntohl(item->lower),
259 ntohl(item->upper)); 259 ntohl(item->upper));
260 publ = tipc_nametbl_insert_publ(ntohl(item->type), 260 publ = tipc_nametbl_insert_publ(ntohl(item->type),
261 ntohl(item->lower), 261 ntohl(item->lower),
262 ntohl(item->upper), 262 ntohl(item->upper),
263 TIPC_CLUSTER_SCOPE, 263 TIPC_CLUSTER_SCOPE,
264 msg_orignode(msg), 264 msg_orignode(msg),
265 ntohl(item->ref), 265 ntohl(item->ref),
266 ntohl(item->key)); 266 ntohl(item->key));
267 if (publ) { 267 if (publ) {
268 tipc_nodesub_subscribe(&publ->subscr, 268 tipc_nodesub_subscribe(&publ->subscr,
269 msg_orignode(msg), 269 msg_orignode(msg),
270 publ, 270 publ,
271 (net_ev_handler)node_is_down); 271 (net_ev_handler)node_is_down);
272 } 272 }
273 } else if (msg_type(msg) == WITHDRAWAL) { 273 } else if (msg_type(msg) == WITHDRAWAL) {
274 dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n", 274 dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n",
275 ntohl(item->type), ntohl(item->lower), 275 ntohl(item->type), ntohl(item->lower),
276 ntohl(item->upper)); 276 ntohl(item->upper));
277 publ = tipc_nametbl_remove_publ(ntohl(item->type), 277 publ = tipc_nametbl_remove_publ(ntohl(item->type),
@@ -282,7 +282,7 @@ void tipc_named_recv(struct sk_buff *buf)
282 282
283 if (publ) { 283 if (publ) {
284 tipc_nodesub_unsubscribe(&publ->subscr); 284 tipc_nodesub_unsubscribe(&publ->subscr);
285 kfree(publ); 285 kfree(publ);
286 } else { 286 } else {
287 err("Unable to remove publication by node 0x%x\n" 287 err("Unable to remove publication by node 0x%x\n"
288 "(type=%u, lower=%u, ref=%u, key=%u)\n", 288 "(type=%u, lower=%u, ref=%u, key=%u)\n",
@@ -295,13 +295,13 @@ void tipc_named_recv(struct sk_buff *buf)
295 } 295 }
296 item++; 296 item++;
297 } 297 }
298 write_unlock_bh(&tipc_nametbl_lock); 298 write_unlock_bh(&tipc_nametbl_lock);
299 buf_discard(buf); 299 buf_discard(buf);
300} 300}
301 301
302/** 302/**
303 * tipc_named_reinit - re-initialize local publication list 303 * tipc_named_reinit - re-initialize local publication list
304 * 304 *
305 * This routine is called whenever TIPC networking is (re)enabled. 305 * This routine is called whenever TIPC networking is (re)enabled.
306 * All existing publications by this node that have "cluster" or "zone" scope 306 * All existing publications by this node that have "cluster" or "zone" scope
307 * are updated to reflect the node's current network address. 307 * are updated to reflect the node's current network address.
@@ -312,11 +312,11 @@ void tipc_named_reinit(void)
312{ 312{
313 struct publication *publ; 313 struct publication *publ;
314 314
315 write_lock_bh(&tipc_nametbl_lock); 315 write_lock_bh(&tipc_nametbl_lock);
316 list_for_each_entry(publ, &publ_root, local_list) { 316 list_for_each_entry(publ, &publ_root, local_list) {
317 if (publ->node == tipc_own_addr) 317 if (publ->node == tipc_own_addr)
318 break; 318 break;
319 publ->node = tipc_own_addr; 319 publ->node = tipc_own_addr;
320 } 320 }
321 write_unlock_bh(&tipc_nametbl_lock); 321 write_unlock_bh(&tipc_nametbl_lock);
322} 322}
diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h
index 843da0172f4e..1e41bdd4f255 100644
--- a/net/tipc/name_distr.h
+++ b/net/tipc/name_distr.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/name_distr.h: Include file for TIPC name distribution code 2 * net/tipc/name_distr.h: Include file for TIPC name distribution code
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 049242ea5c38..9dfc9127acdd 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/name_table.c: TIPC name table code 2 * net/tipc/name_table.c: TIPC name table code
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -65,7 +65,7 @@ struct sub_seq {
65 struct publication *zone_list; 65 struct publication *zone_list;
66}; 66};
67 67
68/** 68/**
69 * struct name_seq - container for all published instances of a name type 69 * struct name_seq - container for all published instances of a name type
70 * @type: 32 bit 'type' value for name sequence 70 * @type: 32 bit 'type' value for name sequence
71 * @sseq: pointer to dynamically-sized array of sub-sequences of this 'type'; 71 * @sseq: pointer to dynamically-sized array of sub-sequences of this 'type';
@@ -89,7 +89,7 @@ struct name_seq {
89 89
90/** 90/**
91 * struct name_table - table containing all existing port name publications 91 * struct name_table - table containing all existing port name publications
92 * @types: pointer to fixed-sized array of name sequence lists, 92 * @types: pointer to fixed-sized array of name sequence lists,
93 * accessed via hashing on 'type'; name sequence lists are *not* sorted 93 * accessed via hashing on 'type'; name sequence lists are *not* sorted
94 * @local_publ_count: number of publications issued by this node 94 * @local_publ_count: number of publications issued by this node
95 */ 95 */
@@ -113,8 +113,8 @@ static int hash(int x)
113 * publ_create - create a publication structure 113 * publ_create - create a publication structure
114 */ 114 */
115 115
116static struct publication *publ_create(u32 type, u32 lower, u32 upper, 116static struct publication *publ_create(u32 type, u32 lower, u32 upper,
117 u32 scope, u32 node, u32 port_ref, 117 u32 scope, u32 node, u32 port_ref,
118 u32 key) 118 u32 key)
119{ 119{
120 struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC); 120 struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC);
@@ -148,7 +148,7 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt)
148 148
149/** 149/**
150 * tipc_nameseq_create - create a name sequence structure for the specified 'type' 150 * tipc_nameseq_create - create a name sequence structure for the specified 'type'
151 * 151 *
152 * Allocates a single sub-sequence structure and sets it to all 0's. 152 * Allocates a single sub-sequence structure and sets it to all 0's.
153 */ 153 */
154 154
@@ -178,7 +178,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea
178 178
179/** 179/**
180 * nameseq_find_subseq - find sub-sequence (if any) matching a name instance 180 * nameseq_find_subseq - find sub-sequence (if any) matching a name instance
181 * 181 *
182 * Very time-critical, so binary searches through sub-sequence array. 182 * Very time-critical, so binary searches through sub-sequence array.
183 */ 183 */
184 184
@@ -204,7 +204,7 @@ static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
204 204
205/** 205/**
206 * nameseq_locate_subseq - determine position of name instance in sub-sequence 206 * nameseq_locate_subseq - determine position of name instance in sub-sequence
207 * 207 *
208 * Returns index in sub-sequence array of the entry that contains the specified 208 * Returns index in sub-sequence array of the entry that contains the specified
209 * instance value; if no entry contains that value, returns the position 209 * instance value; if no entry contains that value, returns the position
210 * where a new entry for it would be inserted in the array. 210 * where a new entry for it would be inserted in the array.
@@ -232,7 +232,7 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
232} 232}
233 233
234/** 234/**
235 * tipc_nameseq_insert_publ - 235 * tipc_nameseq_insert_publ -
236 */ 236 */
237 237
238static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, 238static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
@@ -343,8 +343,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
343 } 343 }
344 } 344 }
345 345
346 /* 346 /*
347 * Any subscriptions waiting for notification? 347 * Any subscriptions waiting for notification?
348 */ 348 */
349 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { 349 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
350 dbg("calling report_overlap()\n"); 350 dbg("calling report_overlap()\n");
@@ -352,7 +352,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
352 publ->lower, 352 publ->lower,
353 publ->upper, 353 publ->upper,
354 TIPC_PUBLISHED, 354 TIPC_PUBLISHED,
355 publ->ref, 355 publ->ref,
356 publ->node, 356 publ->node,
357 created_subseq); 357 created_subseq);
358 } 358 }
@@ -361,7 +361,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
361 361
362/** 362/**
363 * tipc_nameseq_remove_publ - 363 * tipc_nameseq_remove_publ -
364 * 364 *
365 * NOTE: There may be cases where TIPC is asked to remove a publication 365 * NOTE: There may be cases where TIPC is asked to remove a publication
366 * that is not in the name table. For example, if another node issues a 366 * that is not in the name table. For example, if another node issues a
367 * publication for a name sequence that overlaps an existing name sequence 367 * publication for a name sequence that overlaps an existing name sequence
@@ -392,12 +392,12 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i
392 392
393 prev = sseq->zone_list; 393 prev = sseq->zone_list;
394 publ = sseq->zone_list->zone_list_next; 394 publ = sseq->zone_list->zone_list_next;
395 while ((publ->key != key) || (publ->ref != ref) || 395 while ((publ->key != key) || (publ->ref != ref) ||
396 (publ->node && (publ->node != node))) { 396 (publ->node && (publ->node != node))) {
397 prev = publ; 397 prev = publ;
398 publ = publ->zone_list_next; 398 publ = publ->zone_list_next;
399 if (prev == sseq->zone_list) { 399 if (prev == sseq->zone_list) {
400 400
401 /* Prevent endless loop if publication not found */ 401 /* Prevent endless loop if publication not found */
402 402
403 return NULL; 403 return NULL;
@@ -426,7 +426,7 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i
426 426
427 err("Unable to de-list cluster publication\n" 427 err("Unable to de-list cluster publication\n"
428 "{%u%u}, node=0x%x, ref=%u, key=%u)\n", 428 "{%u%u}, node=0x%x, ref=%u, key=%u)\n",
429 publ->type, publ->lower, publ->node, 429 publ->type, publ->lower, publ->node,
430 publ->ref, publ->key); 430 publ->ref, publ->key);
431 goto end_cluster; 431 goto end_cluster;
432 } 432 }
@@ -456,7 +456,7 @@ end_cluster:
456 456
457 err("Unable to de-list node publication\n" 457 err("Unable to de-list node publication\n"
458 "{%u%u}, node=0x%x, ref=%u, key=%u)\n", 458 "{%u%u}, node=0x%x, ref=%u, key=%u)\n",
459 publ->type, publ->lower, publ->node, 459 publ->type, publ->lower, publ->node,
460 publ->ref, publ->key); 460 publ->ref, publ->key);
461 goto end_node; 461 goto end_node;
462 } 462 }
@@ -486,8 +486,8 @@ end_node:
486 tipc_subscr_report_overlap(s, 486 tipc_subscr_report_overlap(s,
487 publ->lower, 487 publ->lower,
488 publ->upper, 488 publ->upper,
489 TIPC_WITHDRAWN, 489 TIPC_WITHDRAWN,
490 publ->ref, 490 publ->ref,
491 publ->node, 491 publ->node,
492 removed_subseq); 492 removed_subseq);
493 } 493 }
@@ -517,8 +517,8 @@ void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
517 int must_report = 1; 517 int must_report = 1;
518 518
519 do { 519 do {
520 tipc_subscr_report_overlap(s, 520 tipc_subscr_report_overlap(s,
521 sseq->lower, 521 sseq->lower,
522 sseq->upper, 522 sseq->upper,
523 TIPC_PUBLISHED, 523 TIPC_PUBLISHED,
524 crs->ref, 524 crs->ref,
@@ -576,7 +576,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
576 scope, node, port, key); 576 scope, node, port, key);
577} 577}
578 578
579struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, 579struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
580 u32 node, u32 ref, u32 key) 580 u32 node, u32 ref, u32 key)
581{ 581{
582 struct publication *publ; 582 struct publication *publ;
@@ -676,14 +676,14 @@ not_found:
676 676
677/** 677/**
678 * tipc_nametbl_mc_translate - find multicast destinations 678 * tipc_nametbl_mc_translate - find multicast destinations
679 * 679 *
680 * Creates list of all local ports that overlap the given multicast address; 680 * Creates list of all local ports that overlap the given multicast address;
681 * also determines if any off-node ports overlap. 681 * also determines if any off-node ports overlap.
682 * 682 *
683 * Note: Publications with a scope narrower than 'limit' are ignored. 683 * Note: Publications with a scope narrower than 'limit' are ignored.
684 * (i.e. local node-scope publications mustn't receive messages arriving 684 * (i.e. local node-scope publications mustn't receive messages arriving
685 * from another node, even if the multcast link brought it here) 685 * from another node, even if the multcast link brought it here)
686 * 686 *
687 * Returns non-zero if any off-node ports overlap 687 * Returns non-zero if any off-node ports overlap
688 */ 688 */
689 689
@@ -730,7 +730,7 @@ exit:
730 * tipc_nametbl_publish_rsv - publish port name using a reserved name type 730 * tipc_nametbl_publish_rsv - publish port name using a reserved name type
731 */ 731 */
732 732
733int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, 733int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
734 struct tipc_name_seq const *seq) 734 struct tipc_name_seq const *seq)
735{ 735{
736 int res; 736 int res;
@@ -745,13 +745,13 @@ int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
745 * tipc_nametbl_publish - add name publication to network name tables 745 * tipc_nametbl_publish - add name publication to network name tables
746 */ 746 */
747 747
748struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, 748struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
749 u32 scope, u32 port_ref, u32 key) 749 u32 scope, u32 port_ref, u32 key)
750{ 750{
751 struct publication *publ; 751 struct publication *publ;
752 752
753 if (table.local_publ_count >= tipc_max_publications) { 753 if (table.local_publ_count >= tipc_max_publications) {
754 warn("Publication failed, local publication limit reached (%u)\n", 754 warn("Publication failed, local publication limit reached (%u)\n",
755 tipc_max_publications); 755 tipc_max_publications);
756 return NULL; 756 return NULL;
757 } 757 }
@@ -808,22 +808,22 @@ void tipc_nametbl_subscribe(struct subscription *s)
808 u32 type = s->seq.type; 808 u32 type = s->seq.type;
809 struct name_seq *seq; 809 struct name_seq *seq;
810 810
811 write_lock_bh(&tipc_nametbl_lock); 811 write_lock_bh(&tipc_nametbl_lock);
812 seq = nametbl_find_seq(type); 812 seq = nametbl_find_seq(type);
813 if (!seq) { 813 if (!seq) {
814 seq = tipc_nameseq_create(type, &table.types[hash(type)]); 814 seq = tipc_nameseq_create(type, &table.types[hash(type)]);
815 } 815 }
816 if (seq){ 816 if (seq){
817 spin_lock_bh(&seq->lock); 817 spin_lock_bh(&seq->lock);
818 dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n", 818 dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n",
819 seq, type, s->seq.lower, s->seq.upper); 819 seq, type, s->seq.lower, s->seq.upper);
820 tipc_nameseq_subscribe(seq, s); 820 tipc_nameseq_subscribe(seq, s);
821 spin_unlock_bh(&seq->lock); 821 spin_unlock_bh(&seq->lock);
822 } else { 822 } else {
823 warn("Failed to create subscription for {%u,%u,%u}\n", 823 warn("Failed to create subscription for {%u,%u,%u}\n",
824 s->seq.type, s->seq.lower, s->seq.upper); 824 s->seq.type, s->seq.lower, s->seq.upper);
825 } 825 }
826 write_unlock_bh(&tipc_nametbl_lock); 826 write_unlock_bh(&tipc_nametbl_lock);
827} 827}
828 828
829/** 829/**
@@ -834,19 +834,19 @@ void tipc_nametbl_unsubscribe(struct subscription *s)
834{ 834{
835 struct name_seq *seq; 835 struct name_seq *seq;
836 836
837 write_lock_bh(&tipc_nametbl_lock); 837 write_lock_bh(&tipc_nametbl_lock);
838 seq = nametbl_find_seq(s->seq.type); 838 seq = nametbl_find_seq(s->seq.type);
839 if (seq != NULL){ 839 if (seq != NULL){
840 spin_lock_bh(&seq->lock); 840 spin_lock_bh(&seq->lock);
841 list_del_init(&s->nameseq_list); 841 list_del_init(&s->nameseq_list);
842 spin_unlock_bh(&seq->lock); 842 spin_unlock_bh(&seq->lock);
843 if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) { 843 if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) {
844 hlist_del_init(&seq->ns_list); 844 hlist_del_init(&seq->ns_list);
845 kfree(seq->sseqs); 845 kfree(seq->sseqs);
846 kfree(seq); 846 kfree(seq);
847 } 847 }
848 } 848 }
849 write_unlock_bh(&tipc_nametbl_lock); 849 write_unlock_bh(&tipc_nametbl_lock);
850} 850}
851 851
852 852
@@ -952,7 +952,7 @@ static void nametbl_header(struct print_buf *buf, u32 depth)
952 * nametbl_list - print specified name table contents into the given buffer 952 * nametbl_list - print specified name table contents into the given buffer
953 */ 953 */
954 954
955static void nametbl_list(struct print_buf *buf, u32 depth_info, 955static void nametbl_list(struct print_buf *buf, u32 depth_info,
956 u32 type, u32 lowbound, u32 upbound) 956 u32 type, u32 lowbound, u32 upbound)
957{ 957{
958 struct hlist_head *seq_head; 958 struct hlist_head *seq_head;
@@ -976,7 +976,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
976 for (i = 0; i < tipc_nametbl_size; i++) { 976 for (i = 0; i < tipc_nametbl_size; i++) {
977 seq_head = &table.types[i]; 977 seq_head = &table.types[i];
978 hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { 978 hlist_for_each_entry(seq, seq_node, seq_head, ns_list) {
979 nameseq_list(seq, buf, depth, seq->type, 979 nameseq_list(seq, buf, depth, seq->type,
980 lowbound, upbound, i); 980 lowbound, upbound, i);
981 } 981 }
982 } 982 }
@@ -991,7 +991,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
991 seq_head = &table.types[i]; 991 seq_head = &table.types[i];
992 hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { 992 hlist_for_each_entry(seq, seq_node, seq_head, ns_list) {
993 if (seq->type == type) { 993 if (seq->type == type) {
994 nameseq_list(seq, buf, depth, type, 994 nameseq_list(seq, buf, depth, type,
995 lowbound, upbound, i); 995 lowbound, upbound, i);
996 break; 996 break;
997 } 997 }
@@ -1030,7 +1030,7 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
1030 tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); 1030 tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY);
1031 argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); 1031 argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area);
1032 read_lock_bh(&tipc_nametbl_lock); 1032 read_lock_bh(&tipc_nametbl_lock);
1033 nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), 1033 nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type),
1034 ntohl(argv->lowbound), ntohl(argv->upbound)); 1034 ntohl(argv->lowbound), ntohl(argv->upbound));
1035 read_unlock_bh(&tipc_nametbl_lock); 1035 read_unlock_bh(&tipc_nametbl_lock);
1036 str_len = tipc_printbuf_validate(&b); 1036 str_len = tipc_printbuf_validate(&b);
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index e8a3d71763ce..b9e7cd336d76 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/name_table.h: Include file for TIPC name table code 2 * net/tipc/name_table.h: Include file for TIPC name table code
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -64,7 +64,7 @@ struct port_list;
64 * @node_list: next matching name seq publication with >= node scope 64 * @node_list: next matching name seq publication with >= node scope
65 * @cluster_list: next matching name seq publication with >= cluster scope 65 * @cluster_list: next matching name seq publication with >= cluster scope
66 * @zone_list: next matching name seq publication with >= zone scope 66 * @zone_list: next matching name seq publication with >= zone scope
67 * 67 *
68 * Note that the node list, cluster list, and zone list are circular lists. 68 * Note that the node list, cluster list, and zone list are circular lists.
69 */ 69 */
70 70
@@ -89,16 +89,16 @@ extern rwlock_t tipc_nametbl_lock;
89 89
90struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space); 90struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space);
91u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node); 91u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node);
92int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, 92int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
93 struct port_list *dports); 93 struct port_list *dports);
94int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, 94int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
95 struct tipc_name_seq const *seq); 95 struct tipc_name_seq const *seq);
96struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, 96struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
97 u32 scope, u32 port_ref, u32 key); 97 u32 scope, u32 port_ref, u32 key);
98int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); 98int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key);
99struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, 99struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
100 u32 scope, u32 node, u32 ref, u32 key); 100 u32 scope, u32 node, u32 ref, u32 key);
101struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, 101struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
102 u32 node, u32 ref, u32 key); 102 u32 node, u32 ref, u32 key);
103void tipc_nametbl_subscribe(struct subscription *s); 103void tipc_nametbl_subscribe(struct subscription *s);
104void tipc_nametbl_unsubscribe(struct subscription *s); 104void tipc_nametbl_unsubscribe(struct subscription *s);
diff --git a/net/tipc/net.c b/net/tipc/net.c
index a991bf8a7f74..c39c76201e8e 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/net.c: TIPC network routing code 2 * net/tipc/net.c: TIPC network routing code
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -49,63 +49,63 @@
49#include "discover.h" 49#include "discover.h"
50#include "config.h" 50#include "config.h"
51 51
52/* 52/*
53 * The TIPC locking policy is designed to ensure a very fine locking 53 * The TIPC locking policy is designed to ensure a very fine locking
54 * granularity, permitting complete parallel access to individual 54 * granularity, permitting complete parallel access to individual
55 * port and node/link instances. The code consists of three major 55 * port and node/link instances. The code consists of three major
56 * locking domains, each protected with their own disjunct set of locks. 56 * locking domains, each protected with their own disjunct set of locks.
57 * 57 *
58 * 1: The routing hierarchy. 58 * 1: The routing hierarchy.
59 * Comprises the structures 'zone', 'cluster', 'node', 'link' 59 * Comprises the structures 'zone', 'cluster', 'node', 'link'
60 * and 'bearer'. The whole hierarchy is protected by a big 60 * and 'bearer'. The whole hierarchy is protected by a big
61 * read/write lock, tipc_net_lock, to enssure that nothing is added 61 * read/write lock, tipc_net_lock, to enssure that nothing is added
62 * or removed while code is accessing any of these structures. 62 * or removed while code is accessing any of these structures.
63 * This layer must not be called from the two others while they 63 * This layer must not be called from the two others while they
64 * hold any of their own locks. 64 * hold any of their own locks.
65 * Neither must it itself do any upcalls to the other two before 65 * Neither must it itself do any upcalls to the other two before
66 * it has released tipc_net_lock and other protective locks. 66 * it has released tipc_net_lock and other protective locks.
67 * 67 *
68 * Within the tipc_net_lock domain there are two sub-domains;'node' and 68 * Within the tipc_net_lock domain there are two sub-domains;'node' and
69 * 'bearer', where local write operations are permitted, 69 * 'bearer', where local write operations are permitted,
70 * provided that those are protected by individual spin_locks 70 * provided that those are protected by individual spin_locks
71 * per instance. Code holding tipc_net_lock(read) and a node spin_lock 71 * per instance. Code holding tipc_net_lock(read) and a node spin_lock
72 * is permitted to poke around in both the node itself and its 72 * is permitted to poke around in both the node itself and its
73 * subordinate links. I.e, it can update link counters and queues, 73 * subordinate links. I.e, it can update link counters and queues,
74 * change link state, send protocol messages, and alter the 74 * change link state, send protocol messages, and alter the
75 * "active_links" array in the node; but it can _not_ remove a link 75 * "active_links" array in the node; but it can _not_ remove a link
76 * or a node from the overall structure. 76 * or a node from the overall structure.
77 * Correspondingly, individual bearers may change status within a 77 * Correspondingly, individual bearers may change status within a
78 * tipc_net_lock(read), protected by an individual spin_lock ber bearer 78 * tipc_net_lock(read), protected by an individual spin_lock ber bearer
79 * instance, but it needs tipc_net_lock(write) to remove/add any bearers. 79 * instance, but it needs tipc_net_lock(write) to remove/add any bearers.
80 *
81 * 80 *
82 * 2: The transport level of the protocol. 81 *
83 * This consists of the structures port, (and its user level 82 * 2: The transport level of the protocol.
84 * representations, such as user_port and tipc_sock), reference and 83 * This consists of the structures port, (and its user level
85 * tipc_user (port.c, reg.c, socket.c). 84 * representations, such as user_port and tipc_sock), reference and
85 * tipc_user (port.c, reg.c, socket.c).
86 * 86 *
87 * This layer has four different locks: 87 * This layer has four different locks:
88 * - The tipc_port spin_lock. This is protecting each port instance 88 * - The tipc_port spin_lock. This is protecting each port instance
89 * from parallel data access and removal. Since we can not place 89 * from parallel data access and removal. Since we can not place
90 * this lock in the port itself, it has been placed in the 90 * this lock in the port itself, it has been placed in the
91 * corresponding reference table entry, which has the same life 91 * corresponding reference table entry, which has the same life
92 * cycle as the module. This entry is difficult to access from 92 * cycle as the module. This entry is difficult to access from
93 * outside the TIPC core, however, so a pointer to the lock has 93 * outside the TIPC core, however, so a pointer to the lock has
94 * been added in the port instance, -to be used for unlocking 94 * been added in the port instance, -to be used for unlocking
95 * only. 95 * only.
96 * - A read/write lock to protect the reference table itself (teg.c). 96 * - A read/write lock to protect the reference table itself (teg.c).
97 * (Nobody is using read-only access to this, so it can just as 97 * (Nobody is using read-only access to this, so it can just as
98 * well be changed to a spin_lock) 98 * well be changed to a spin_lock)
99 * - A spin lock to protect the registry of kernel/driver users (reg.c) 99 * - A spin lock to protect the registry of kernel/driver users (reg.c)
100 * - A global spin_lock (tipc_port_lock), which only task is to ensure 100 * - A global spin_lock (tipc_port_lock), which only task is to ensure
101 * consistency where more than one port is involved in an operation, 101 * consistency where more than one port is involved in an operation,
102 * i.e., whe a port is part of a linked list of ports. 102 * i.e., whe a port is part of a linked list of ports.
103 * There are two such lists; 'port_list', which is used for management, 103 * There are two such lists; 'port_list', which is used for management,
104 * and 'wait_list', which is used to queue ports during congestion. 104 * and 'wait_list', which is used to queue ports during congestion.
105 * 105 *
106 * 3: The name table (name_table.c, name_distr.c, subscription.c) 106 * 3: The name table (name_table.c, name_distr.c, subscription.c)
107 * - There is one big read/write-lock (tipc_nametbl_lock) protecting the 107 * - There is one big read/write-lock (tipc_nametbl_lock) protecting the
108 * overall name table structure. Nothing must be added/removed to 108 * overall name table structure. Nothing must be added/removed to
109 * this structure without holding write access to it. 109 * this structure without holding write access to it.
110 * - There is one local spin_lock per sub_sequence, which can be seen 110 * - There is one local spin_lock per sub_sequence, which can be seen
111 * as a sub-domain to the tipc_nametbl_lock domain. It is used only 111 * as a sub-domain to the tipc_nametbl_lock domain. It is used only
@@ -118,7 +118,7 @@
118DEFINE_RWLOCK(tipc_net_lock); 118DEFINE_RWLOCK(tipc_net_lock);
119struct network tipc_net = { NULL }; 119struct network tipc_net = { NULL };
120 120
121struct node *tipc_net_select_remote_node(u32 addr, u32 ref) 121struct node *tipc_net_select_remote_node(u32 addr, u32 ref)
122{ 122{
123 return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref); 123 return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref);
124} 124}
@@ -224,7 +224,7 @@ void tipc_net_route_msg(struct sk_buff *buf)
224 buf_discard(buf); 224 buf_discard(buf);
225 } else { 225 } else {
226 msg_dbg(msg, "NET>REJ>:"); 226 msg_dbg(msg, "NET>REJ>:");
227 tipc_reject_msg(buf, msg_destport(msg) ? 227 tipc_reject_msg(buf, msg_destport(msg) ?
228 TIPC_ERR_NO_PORT : TIPC_ERR_NO_NAME); 228 TIPC_ERR_NO_PORT : TIPC_ERR_NO_NAME);
229 } 229 }
230 return; 230 return;
@@ -236,7 +236,7 @@ void tipc_net_route_msg(struct sk_buff *buf)
236 dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); 236 dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg);
237 if (in_scope(dnode, tipc_own_addr)) { 237 if (in_scope(dnode, tipc_own_addr)) {
238 if (msg_isdata(msg)) { 238 if (msg_isdata(msg)) {
239 if (msg_mcast(msg)) 239 if (msg_mcast(msg))
240 tipc_port_recv_mcast(buf, NULL); 240 tipc_port_recv_mcast(buf, NULL);
241 else if (msg_destport(msg)) 241 else if (msg_destport(msg))
242 tipc_port_recv_msg(buf); 242 tipc_port_recv_msg(buf);
@@ -284,7 +284,7 @@ int tipc_net_start(void)
284 (res = tipc_bclink_init())) { 284 (res = tipc_bclink_init())) {
285 return res; 285 return res;
286 } 286 }
287 tipc_subscr_stop(); 287 tipc_subscr_stop();
288 tipc_cfg_stop(); 288 tipc_cfg_stop();
289 tipc_k_signal((Handler)tipc_subscr_start, 0); 289 tipc_k_signal((Handler)tipc_subscr_start, 0);
290 tipc_k_signal((Handler)tipc_cfg_init, 0); 290 tipc_k_signal((Handler)tipc_cfg_init, 0);
@@ -298,12 +298,12 @@ void tipc_net_stop(void)
298{ 298{
299 if (tipc_mode != TIPC_NET_MODE) 299 if (tipc_mode != TIPC_NET_MODE)
300 return; 300 return;
301 write_lock_bh(&tipc_net_lock); 301 write_lock_bh(&tipc_net_lock);
302 tipc_bearer_stop(); 302 tipc_bearer_stop();
303 tipc_mode = TIPC_NODE_MODE; 303 tipc_mode = TIPC_NODE_MODE;
304 tipc_bclink_stop(); 304 tipc_bclink_stop();
305 net_stop(); 305 net_stop();
306 write_unlock_bh(&tipc_net_lock); 306 write_unlock_bh(&tipc_net_lock);
307 info("Left network mode \n"); 307 info("Left network mode \n");
308} 308}
309 309
diff --git a/net/tipc/net.h b/net/tipc/net.h
index f3e0b85e6475..a6a0e9976ac9 100644
--- a/net/tipc/net.h
+++ b/net/tipc/net.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/net.h: Include file for TIPC network routing code 2 * net/tipc/net.h: Include file for TIPC network routing code
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -43,7 +43,7 @@ struct _zone;
43 * struct network - TIPC network structure 43 * struct network - TIPC network structure
44 * @zones: array of pointers to all zones within network 44 * @zones: array of pointers to all zones within network
45 */ 45 */
46 46
47struct network { 47struct network {
48 struct _zone **zones; 48 struct _zone **zones;
49}; 49};
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index eb1bb4dce7af..b8e1edc2badc 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/netlink.c: TIPC configuration handling 2 * net/tipc/netlink.c: TIPC configuration handling
3 * 3 *
4 * Copyright (c) 2005-2006, Ericsson AB 4 * Copyright (c) 2005-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -63,15 +63,15 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
63 genlmsg_unicast(rep_buf, req_nlh->nlmsg_pid); 63 genlmsg_unicast(rep_buf, req_nlh->nlmsg_pid);
64 } 64 }
65 65
66 return 0; 66 return 0;
67} 67}
68 68
69static struct genl_family family = { 69static struct genl_family family = {
70 .id = GENL_ID_GENERATE, 70 .id = GENL_ID_GENERATE,
71 .name = TIPC_GENL_NAME, 71 .name = TIPC_GENL_NAME,
72 .version = TIPC_GENL_VERSION, 72 .version = TIPC_GENL_VERSION,
73 .hdrsize = TIPC_GENL_HDRLEN, 73 .hdrsize = TIPC_GENL_HDRLEN,
74 .maxattr = 0, 74 .maxattr = 0,
75}; 75};
76 76
77static struct genl_ops ops = { 77static struct genl_ops ops = {
@@ -93,7 +93,7 @@ int tipc_netlink_start(void)
93 if (genl_register_ops(&family, &ops)) 93 if (genl_register_ops(&family, &ops))
94 goto err_unregister; 94 goto err_unregister;
95 95
96 return 0; 96 return 0;
97 97
98 err_unregister: 98 err_unregister:
99 genl_unregister_family(&family); 99 genl_unregister_family(&family);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 4111a31def79..e2e452a62ba1 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/node.c: TIPC node management routines 2 * net/tipc/node.c: TIPC node management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -58,7 +58,7 @@ struct node *tipc_node_create(u32 addr)
58{ 58{
59 struct cluster *c_ptr; 59 struct cluster *c_ptr;
60 struct node *n_ptr; 60 struct node *n_ptr;
61 struct node **curr_node; 61 struct node **curr_node;
62 62
63 n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC); 63 n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC);
64 if (!n_ptr) { 64 if (!n_ptr) {
@@ -74,16 +74,16 @@ struct node *tipc_node_create(u32 addr)
74 kfree(n_ptr); 74 kfree(n_ptr);
75 return NULL; 75 return NULL;
76 } 76 }
77 77
78 n_ptr->addr = addr; 78 n_ptr->addr = addr;
79 spin_lock_init(&n_ptr->lock); 79 spin_lock_init(&n_ptr->lock);
80 INIT_LIST_HEAD(&n_ptr->nsub); 80 INIT_LIST_HEAD(&n_ptr->nsub);
81 n_ptr->owner = c_ptr; 81 n_ptr->owner = c_ptr;
82 tipc_cltr_attach_node(c_ptr, n_ptr); 82 tipc_cltr_attach_node(c_ptr, n_ptr);
83 n_ptr->last_router = -1; 83 n_ptr->last_router = -1;
84 84
85 /* Insert node into ordered list */ 85 /* Insert node into ordered list */
86 for (curr_node = &tipc_nodes; *curr_node; 86 for (curr_node = &tipc_nodes; *curr_node;
87 curr_node = &(*curr_node)->next) { 87 curr_node = &(*curr_node)->next) {
88 if (addr < (*curr_node)->addr) { 88 if (addr < (*curr_node)->addr) {
89 n_ptr->next = *curr_node; 89 n_ptr->next = *curr_node;
@@ -116,7 +116,7 @@ void tipc_node_delete(struct node *n_ptr)
116 116
117/** 117/**
118 * tipc_node_link_up - handle addition of link 118 * tipc_node_link_up - handle addition of link
119 * 119 *
120 * Link becomes active (alone or shared) or standby, depending on its priority. 120 * Link becomes active (alone or shared) or standby, depending on its priority.
121 */ 121 */
122 122
@@ -128,19 +128,19 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
128 128
129 info("Established link <%s> on network plane %c\n", 129 info("Established link <%s> on network plane %c\n",
130 l_ptr->name, l_ptr->b_ptr->net_plane); 130 l_ptr->name, l_ptr->b_ptr->net_plane);
131 131
132 if (!active[0]) { 132 if (!active[0]) {
133 dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]); 133 dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]);
134 active[0] = active[1] = l_ptr; 134 active[0] = active[1] = l_ptr;
135 node_established_contact(n_ptr); 135 node_established_contact(n_ptr);
136 return; 136 return;
137 } 137 }
138 if (l_ptr->priority < active[0]->priority) { 138 if (l_ptr->priority < active[0]->priority) {
139 info("New link <%s> becomes standby\n", l_ptr->name); 139 info("New link <%s> becomes standby\n", l_ptr->name);
140 return; 140 return;
141 } 141 }
142 tipc_link_send_duplicate(active[0], l_ptr); 142 tipc_link_send_duplicate(active[0], l_ptr);
143 if (l_ptr->priority == active[0]->priority) { 143 if (l_ptr->priority == active[0]->priority) {
144 active[0] = l_ptr; 144 active[0] = l_ptr;
145 return; 145 return;
146 } 146 }
@@ -160,17 +160,17 @@ static void node_select_active_links(struct node *n_ptr)
160 u32 i; 160 u32 i;
161 u32 highest_prio = 0; 161 u32 highest_prio = 0;
162 162
163 active[0] = active[1] = NULL; 163 active[0] = active[1] = NULL;
164 164
165 for (i = 0; i < MAX_BEARERS; i++) { 165 for (i = 0; i < MAX_BEARERS; i++) {
166 struct link *l_ptr = n_ptr->links[i]; 166 struct link *l_ptr = n_ptr->links[i];
167 167
168 if (!l_ptr || !tipc_link_is_up(l_ptr) || 168 if (!l_ptr || !tipc_link_is_up(l_ptr) ||
169 (l_ptr->priority < highest_prio)) 169 (l_ptr->priority < highest_prio))
170 continue; 170 continue;
171 171
172 if (l_ptr->priority > highest_prio) { 172 if (l_ptr->priority > highest_prio) {
173 highest_prio = l_ptr->priority; 173 highest_prio = l_ptr->priority;
174 active[0] = active[1] = l_ptr; 174 active[0] = active[1] = l_ptr;
175 } else { 175 } else {
176 active[1] = l_ptr; 176 active[1] = l_ptr;
@@ -203,15 +203,15 @@ void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr)
203 active[1] = active[0]; 203 active[1] = active[0];
204 if (active[0] == l_ptr) 204 if (active[0] == l_ptr)
205 node_select_active_links(n_ptr); 205 node_select_active_links(n_ptr);
206 if (tipc_node_is_up(n_ptr)) 206 if (tipc_node_is_up(n_ptr))
207 tipc_link_changeover(l_ptr); 207 tipc_link_changeover(l_ptr);
208 else 208 else
209 node_lost_contact(n_ptr); 209 node_lost_contact(n_ptr);
210} 210}
211 211
212int tipc_node_has_active_links(struct node *n_ptr) 212int tipc_node_has_active_links(struct node *n_ptr)
213{ 213{
214 return (n_ptr && 214 return (n_ptr &&
215 ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); 215 ((n_ptr->active_links[0]) || (n_ptr->active_links[1])));
216} 216}
217 217
@@ -236,28 +236,28 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
236 236
237 if (!n_ptr) 237 if (!n_ptr)
238 n_ptr = tipc_node_create(l_ptr->addr); 238 n_ptr = tipc_node_create(l_ptr->addr);
239 if (n_ptr) { 239 if (n_ptr) {
240 u32 bearer_id = l_ptr->b_ptr->identity; 240 u32 bearer_id = l_ptr->b_ptr->identity;
241 char addr_string[16]; 241 char addr_string[16];
242 242
243 if (n_ptr->link_cnt >= 2) { 243 if (n_ptr->link_cnt >= 2) {
244 char addr_string[16]; 244 char addr_string[16];
245 245
246 err("Attempt to create third link to %s\n", 246 err("Attempt to create third link to %s\n",
247 addr_string_fill(addr_string, n_ptr->addr)); 247 addr_string_fill(addr_string, n_ptr->addr));
248 return NULL; 248 return NULL;
249 } 249 }
250 250
251 if (!n_ptr->links[bearer_id]) { 251 if (!n_ptr->links[bearer_id]) {
252 n_ptr->links[bearer_id] = l_ptr; 252 n_ptr->links[bearer_id] = l_ptr;
253 tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; 253 tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
254 n_ptr->link_cnt++; 254 n_ptr->link_cnt++;
255 return n_ptr; 255 return n_ptr;
256 } 256 }
257 err("Attempt to establish second link on <%s> to %s \n", 257 err("Attempt to establish second link on <%s> to %s \n",
258 l_ptr->b_ptr->publ.name, 258 l_ptr->b_ptr->publ.name,
259 addr_string_fill(addr_string, l_ptr->addr)); 259 addr_string_fill(addr_string, l_ptr->addr));
260 } 260 }
261 return NULL; 261 return NULL;
262} 262}
263 263
@@ -272,17 +272,17 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
272 * Routing table management - five cases to handle: 272 * Routing table management - five cases to handle:
273 * 273 *
274 * 1: A link towards a zone/cluster external node comes up. 274 * 1: A link towards a zone/cluster external node comes up.
275 * => Send a multicast message updating routing tables of all 275 * => Send a multicast message updating routing tables of all
276 * system nodes within own cluster that the new destination 276 * system nodes within own cluster that the new destination
277 * can be reached via this node. 277 * can be reached via this node.
278 * (node.establishedContact()=>cluster.multicastNewRoute()) 278 * (node.establishedContact()=>cluster.multicastNewRoute())
279 * 279 *
280 * 2: A link towards a slave node comes up. 280 * 2: A link towards a slave node comes up.
281 * => Send a multicast message updating routing tables of all 281 * => Send a multicast message updating routing tables of all
282 * system nodes within own cluster that the new destination 282 * system nodes within own cluster that the new destination
283 * can be reached via this node. 283 * can be reached via this node.
284 * (node.establishedContact()=>cluster.multicastNewRoute()) 284 * (node.establishedContact()=>cluster.multicastNewRoute())
285 * => Send a message to the slave node about existence 285 * => Send a message to the slave node about existence
286 * of all system nodes within cluster: 286 * of all system nodes within cluster:
287 * (node.establishedContact()=>cluster.sendLocalRoutes()) 287 * (node.establishedContact()=>cluster.sendLocalRoutes())
288 * 288 *
@@ -292,13 +292,13 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
292 * nodes which can be reached via this node. 292 * nodes which can be reached via this node.
293 * (node.establishedContact()==>network.sendExternalRoutes()) 293 * (node.establishedContact()==>network.sendExternalRoutes())
294 * (node.establishedContact()==>network.sendSlaveRoutes()) 294 * (node.establishedContact()==>network.sendSlaveRoutes())
295 * => Send messages to all directly connected slave nodes 295 * => Send messages to all directly connected slave nodes
296 * containing information about the existence of the new node 296 * containing information about the existence of the new node
297 * (node.establishedContact()=>cluster.multicastNewRoute()) 297 * (node.establishedContact()=>cluster.multicastNewRoute())
298 * 298 *
299 * 4: The link towards a zone/cluster external node or slave 299 * 4: The link towards a zone/cluster external node or slave
300 * node goes down. 300 * node goes down.
301 * => Send a multcast message updating routing tables of all 301 * => Send a multcast message updating routing tables of all
302 * nodes within cluster that the new destination can not any 302 * nodes within cluster that the new destination can not any
303 * longer be reached via this node. 303 * longer be reached via this node.
304 * (node.lostAllLinks()=>cluster.bcastLostRoute()) 304 * (node.lostAllLinks()=>cluster.bcastLostRoute())
@@ -308,7 +308,7 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
308 * routing tables. Note: This is a completely node 308 * routing tables. Note: This is a completely node
309 * local operation. 309 * local operation.
310 * (node.lostAllLinks()=>network.removeAsRouter()) 310 * (node.lostAllLinks()=>network.removeAsRouter())
311 * => Send messages to all directly connected slave nodes 311 * => Send messages to all directly connected slave nodes
312 * containing information about loss of the node 312 * containing information about loss of the node
313 * (node.establishedContact()=>cluster.multicastLostRoute()) 313 * (node.establishedContact()=>cluster.multicastLostRoute())
314 * 314 *
@@ -319,12 +319,12 @@ static void node_established_contact(struct node *n_ptr)
319 struct cluster *c_ptr; 319 struct cluster *c_ptr;
320 320
321 dbg("node_established_contact:-> %x\n", n_ptr->addr); 321 dbg("node_established_contact:-> %x\n", n_ptr->addr);
322 if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) { 322 if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) {
323 tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); 323 tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr);
324 } 324 }
325 325
326 /* Syncronize broadcast acks */ 326 /* Syncronize broadcast acks */
327 n_ptr->bclink.acked = tipc_bclink_get_last_sent(); 327 n_ptr->bclink.acked = tipc_bclink_get_last_sent();
328 328
329 if (is_slave(tipc_own_addr)) 329 if (is_slave(tipc_own_addr))
330 return; 330 return;
@@ -333,11 +333,11 @@ static void node_established_contact(struct node *n_ptr)
333 c_ptr = tipc_cltr_find(tipc_own_addr); 333 c_ptr = tipc_cltr_find(tipc_own_addr);
334 if (!c_ptr) 334 if (!c_ptr)
335 c_ptr = tipc_cltr_create(tipc_own_addr); 335 c_ptr = tipc_cltr_create(tipc_own_addr);
336 if (c_ptr) 336 if (c_ptr)
337 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, 337 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
338 tipc_max_nodes); 338 tipc_max_nodes);
339 return; 339 return;
340 } 340 }
341 341
342 c_ptr = n_ptr->owner; 342 c_ptr = n_ptr->owner;
343 if (is_slave(n_ptr->addr)) { 343 if (is_slave(n_ptr->addr)) {
@@ -367,26 +367,26 @@ static void node_lost_contact(struct node *n_ptr)
367 char addr_string[16]; 367 char addr_string[16];
368 u32 i; 368 u32 i;
369 369
370 /* Clean up broadcast reception remains */ 370 /* Clean up broadcast reception remains */
371 n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; 371 n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0;
372 while (n_ptr->bclink.deferred_head) { 372 while (n_ptr->bclink.deferred_head) {
373 struct sk_buff* buf = n_ptr->bclink.deferred_head; 373 struct sk_buff* buf = n_ptr->bclink.deferred_head;
374 n_ptr->bclink.deferred_head = buf->next; 374 n_ptr->bclink.deferred_head = buf->next;
375 buf_discard(buf); 375 buf_discard(buf);
376 } 376 }
377 if (n_ptr->bclink.defragm) { 377 if (n_ptr->bclink.defragm) {
378 buf_discard(n_ptr->bclink.defragm); 378 buf_discard(n_ptr->bclink.defragm);
379 n_ptr->bclink.defragm = NULL; 379 n_ptr->bclink.defragm = NULL;
380 } 380 }
381 if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { 381 if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
382 tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); 382 tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
383 } 383 }
384 384
385 /* Update routing tables */ 385 /* Update routing tables */
386 if (is_slave(tipc_own_addr)) { 386 if (is_slave(tipc_own_addr)) {
387 tipc_net_remove_as_router(n_ptr->addr); 387 tipc_net_remove_as_router(n_ptr->addr);
388 } else { 388 } else {
389 if (!in_own_cluster(n_ptr->addr)) { 389 if (!in_own_cluster(n_ptr->addr)) {
390 /* Case 4 (see above) */ 390 /* Case 4 (see above) */
391 c_ptr = tipc_cltr_find(tipc_own_addr); 391 c_ptr = tipc_cltr_find(tipc_own_addr);
392 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, 392 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
@@ -399,7 +399,7 @@ static void node_lost_contact(struct node *n_ptr)
399 tipc_max_nodes); 399 tipc_max_nodes);
400 } else { 400 } else {
401 if (n_ptr->bclink.supported) { 401 if (n_ptr->bclink.supported) {
402 tipc_nmap_remove(&tipc_cltr_bcast_nodes, 402 tipc_nmap_remove(&tipc_cltr_bcast_nodes,
403 n_ptr->addr); 403 n_ptr->addr);
404 if (n_ptr->addr < tipc_own_addr) 404 if (n_ptr->addr < tipc_own_addr)
405 tipc_own_tag--; 405 tipc_own_tag--;
@@ -414,13 +414,13 @@ static void node_lost_contact(struct node *n_ptr)
414 if (tipc_node_has_active_routes(n_ptr)) 414 if (tipc_node_has_active_routes(n_ptr))
415 return; 415 return;
416 416
417 info("Lost contact with %s\n", 417 info("Lost contact with %s\n",
418 addr_string_fill(addr_string, n_ptr->addr)); 418 addr_string_fill(addr_string, n_ptr->addr));
419 419
420 /* Abort link changeover */ 420 /* Abort link changeover */
421 for (i = 0; i < MAX_BEARERS; i++) { 421 for (i = 0; i < MAX_BEARERS; i++) {
422 struct link *l_ptr = n_ptr->links[i]; 422 struct link *l_ptr = n_ptr->links[i];
423 if (!l_ptr) 423 if (!l_ptr)
424 continue; 424 continue;
425 l_ptr->reset_checkpoint = l_ptr->next_in_no; 425 l_ptr->reset_checkpoint = l_ptr->next_in_no;
426 l_ptr->exp_msg_count = 0; 426 l_ptr->exp_msg_count = 0;
@@ -429,7 +429,7 @@ static void node_lost_contact(struct node *n_ptr)
429 429
430 /* Notify subscribers */ 430 /* Notify subscribers */
431 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { 431 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
432 ns->node = NULL; 432 ns->node = NULL;
433 list_del_init(&ns->nodesub_list); 433 list_del_init(&ns->nodesub_list);
434 tipc_k_signal((Handler)ns->handle_node_down, 434 tipc_k_signal((Handler)ns->handle_node_down,
435 (unsigned long)ns->usr_handle); 435 (unsigned long)ns->usr_handle);
@@ -438,7 +438,7 @@ static void node_lost_contact(struct node *n_ptr)
438 438
439/** 439/**
440 * tipc_node_select_next_hop - find the next-hop node for a message 440 * tipc_node_select_next_hop - find the next-hop node for a message
441 * 441 *
442 * Called by when cluster local lookup has failed. 442 * Called by when cluster local lookup has failed.
443 */ 443 */
444 444
@@ -447,13 +447,13 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
447 struct node *n_ptr; 447 struct node *n_ptr;
448 u32 router_addr; 448 u32 router_addr;
449 449
450 if (!tipc_addr_domain_valid(addr)) 450 if (!tipc_addr_domain_valid(addr))
451 return NULL; 451 return NULL;
452 452
453 /* Look for direct link to destination processsor */ 453 /* Look for direct link to destination processsor */
454 n_ptr = tipc_node_find(addr); 454 n_ptr = tipc_node_find(addr);
455 if (n_ptr && tipc_node_has_active_links(n_ptr)) 455 if (n_ptr && tipc_node_has_active_links(n_ptr))
456 return n_ptr; 456 return n_ptr;
457 457
458 /* Cluster local system nodes *must* have direct links */ 458 /* Cluster local system nodes *must* have direct links */
459 if (!is_slave(addr) && in_own_cluster(addr)) 459 if (!is_slave(addr) && in_own_cluster(addr))
@@ -461,10 +461,10 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
461 461
462 /* Look for cluster local router with direct link to node */ 462 /* Look for cluster local router with direct link to node */
463 router_addr = tipc_node_select_router(n_ptr, selector); 463 router_addr = tipc_node_select_router(n_ptr, selector);
464 if (router_addr) 464 if (router_addr)
465 return tipc_node_select(router_addr, selector); 465 return tipc_node_select(router_addr, selector);
466 466
467 /* Slave nodes can only be accessed within own cluster via a 467 /* Slave nodes can only be accessed within own cluster via a
468 known router with direct link -- if no router was found,give up */ 468 known router with direct link -- if no router was found,give up */
469 if (is_slave(addr)) 469 if (is_slave(addr))
470 return NULL; 470 return NULL;
@@ -473,20 +473,20 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
473 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); 473 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
474 n_ptr = tipc_net_select_remote_node(addr, selector); 474 n_ptr = tipc_net_select_remote_node(addr, selector);
475 if (n_ptr && tipc_node_has_active_links(n_ptr)) 475 if (n_ptr && tipc_node_has_active_links(n_ptr))
476 return n_ptr; 476 return n_ptr;
477 477
478 /* Last resort -- look for any router to anywhere in remote zone */ 478 /* Last resort -- look for any router to anywhere in remote zone */
479 router_addr = tipc_net_select_router(addr, selector); 479 router_addr = tipc_net_select_router(addr, selector);
480 if (router_addr) 480 if (router_addr)
481 return tipc_node_select(router_addr, selector); 481 return tipc_node_select(router_addr, selector);
482 482
483 return NULL; 483 return NULL;
484} 484}
485 485
486/** 486/**
487 * tipc_node_select_router - select router to reach specified node 487 * tipc_node_select_router - select router to reach specified node
488 * 488 *
489 * Uses a deterministic and fair algorithm for selecting router node. 489 * Uses a deterministic and fair algorithm for selecting router node.
490 */ 490 */
491 491
492u32 tipc_node_select_router(struct node *n_ptr, u32 ref) 492u32 tipc_node_select_router(struct node *n_ptr, u32 ref)
@@ -496,8 +496,8 @@ u32 tipc_node_select_router(struct node *n_ptr, u32 ref)
496 u32 start; 496 u32 start;
497 u32 r; 497 u32 r;
498 498
499 if (!n_ptr) 499 if (!n_ptr)
500 return 0; 500 return 0;
501 501
502 if (n_ptr->last_router < 0) 502 if (n_ptr->last_router < 0)
503 return 0; 503 return 0;
@@ -531,10 +531,10 @@ void tipc_node_add_router(struct node *n_ptr, u32 router)
531{ 531{
532 u32 r_num = tipc_node(router); 532 u32 r_num = tipc_node(router);
533 533
534 n_ptr->routers[r_num / 32] = 534 n_ptr->routers[r_num / 32] =
535 ((1 << (r_num % 32)) | n_ptr->routers[r_num / 32]); 535 ((1 << (r_num % 32)) | n_ptr->routers[r_num / 32]);
536 n_ptr->last_router = tipc_max_nodes / 32; 536 n_ptr->last_router = tipc_max_nodes / 32;
537 while ((--n_ptr->last_router >= 0) && 537 while ((--n_ptr->last_router >= 0) &&
538 !n_ptr->routers[n_ptr->last_router]); 538 !n_ptr->routers[n_ptr->last_router]);
539} 539}
540 540
@@ -548,7 +548,7 @@ void tipc_node_remove_router(struct node *n_ptr, u32 router)
548 n_ptr->routers[r_num / 32] = 548 n_ptr->routers[r_num / 32] =
549 ((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32])); 549 ((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32]));
550 n_ptr->last_router = tipc_max_nodes / 32; 550 n_ptr->last_router = tipc_max_nodes / 32;
551 while ((--n_ptr->last_router >= 0) && 551 while ((--n_ptr->last_router >= 0) &&
552 !n_ptr->routers[n_ptr->last_router]); 552 !n_ptr->routers[n_ptr->last_router]);
553 553
554 if (!tipc_node_is_up(n_ptr)) 554 if (!tipc_node_is_up(n_ptr))
@@ -562,7 +562,7 @@ void node_print(struct print_buf *buf, struct node *n_ptr, char *str)
562 562
563 tipc_printf(buf, "\n\n%s", str); 563 tipc_printf(buf, "\n\n%s", str);
564 for (i = 0; i < MAX_BEARERS; i++) { 564 for (i = 0; i < MAX_BEARERS; i++) {
565 if (!n_ptr->links[i]) 565 if (!n_ptr->links[i])
566 continue; 566 continue;
567 tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]); 567 tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]);
568 } 568 }
@@ -590,7 +590,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
590 u32 domain; 590 u32 domain;
591 struct sk_buff *buf; 591 struct sk_buff *buf;
592 struct node *n_ptr; 592 struct node *n_ptr;
593 struct tipc_node_info node_info; 593 struct tipc_node_info node_info;
594 u32 payload_size; 594 u32 payload_size;
595 595
596 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 596 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
@@ -601,10 +601,10 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
601 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 601 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
602 " (network address)"); 602 " (network address)");
603 603
604 if (!tipc_nodes) 604 if (!tipc_nodes)
605 return tipc_cfg_reply_none(); 605 return tipc_cfg_reply_none();
606 606
607 /* For now, get space for all other nodes 607 /* For now, get space for all other nodes
608 (will need to modify this when slave nodes are supported */ 608 (will need to modify this when slave nodes are supported */
609 609
610 payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); 610 payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1);
@@ -620,9 +620,9 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
620 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { 620 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
621 if (!in_scope(domain, n_ptr->addr)) 621 if (!in_scope(domain, n_ptr->addr))
622 continue; 622 continue;
623 node_info.addr = htonl(n_ptr->addr); 623 node_info.addr = htonl(n_ptr->addr);
624 node_info.up = htonl(tipc_node_is_up(n_ptr)); 624 node_info.up = htonl(tipc_node_is_up(n_ptr));
625 tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, 625 tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO,
626 &node_info, sizeof(node_info)); 626 &node_info, sizeof(node_info));
627 } 627 }
628 628
@@ -634,7 +634,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
634 u32 domain; 634 u32 domain;
635 struct sk_buff *buf; 635 struct sk_buff *buf;
636 struct node *n_ptr; 636 struct node *n_ptr;
637 struct tipc_link_info link_info; 637 struct tipc_link_info link_info;
638 u32 payload_size; 638 u32 payload_size;
639 639
640 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 640 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
@@ -645,9 +645,9 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
645 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 645 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
646 " (network address)"); 646 " (network address)");
647 647
648 if (tipc_mode != TIPC_NET_MODE) 648 if (tipc_mode != TIPC_NET_MODE)
649 return tipc_cfg_reply_none(); 649 return tipc_cfg_reply_none();
650 650
651 /* Get space for all unicast links + multicast link */ 651 /* Get space for all unicast links + multicast link */
652 652
653 payload_size = TLV_SPACE(sizeof(link_info)) * 653 payload_size = TLV_SPACE(sizeof(link_info)) *
@@ -661,27 +661,27 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
661 661
662 /* Add TLV for broadcast link */ 662 /* Add TLV for broadcast link */
663 663
664 link_info.dest = htonl(tipc_own_addr & 0xfffff00); 664 link_info.dest = htonl(tipc_own_addr & 0xfffff00);
665 link_info.up = htonl(1); 665 link_info.up = htonl(1);
666 sprintf(link_info.str, tipc_bclink_name); 666 sprintf(link_info.str, tipc_bclink_name);
667 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); 667 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
668 668
669 /* Add TLVs for any other links in scope */ 669 /* Add TLVs for any other links in scope */
670 670
671 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { 671 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
672 u32 i; 672 u32 i;
673 673
674 if (!in_scope(domain, n_ptr->addr)) 674 if (!in_scope(domain, n_ptr->addr))
675 continue; 675 continue;
676 for (i = 0; i < MAX_BEARERS; i++) { 676 for (i = 0; i < MAX_BEARERS; i++) {
677 if (!n_ptr->links[i]) 677 if (!n_ptr->links[i])
678 continue; 678 continue;
679 link_info.dest = htonl(n_ptr->addr); 679 link_info.dest = htonl(n_ptr->addr);
680 link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); 680 link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
681 strcpy(link_info.str, n_ptr->links[i]->name); 681 strcpy(link_info.str, n_ptr->links[i]->name);
682 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, 682 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,
683 &link_info, sizeof(link_info)); 683 &link_info, sizeof(link_info));
684 } 684 }
685 } 685 }
686 686
687 return buf; 687 return buf;
diff --git a/net/tipc/node.h b/net/tipc/node.h
index a07cc79ea637..cd1882654bbb 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/node.h: Include file for TIPC node management routines 2 * net/tipc/node.h: Include file for TIPC node management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -67,7 +67,7 @@
67 * @deferred_tail: newest OOS b'cast message received from node 67 * @deferred_tail: newest OOS b'cast message received from node
68 * @defragm: list of partially reassembled b'cast message fragments from node 68 * @defragm: list of partially reassembled b'cast message fragments from node
69 */ 69 */
70 70
71struct node { 71struct node {
72 u32 addr; 72 u32 addr;
73 spinlock_t lock; 73 spinlock_t lock;
@@ -85,8 +85,8 @@ struct node {
85 int supported; 85 int supported;
86 u32 acked; 86 u32 acked;
87 u32 last_in; 87 u32 last_in;
88 u32 gap_after; 88 u32 gap_after;
89 u32 gap_to; 89 u32 gap_to;
90 u32 nack_sync; 90 u32 nack_sync;
91 struct sk_buff *deferred_head; 91 struct sk_buff *deferred_head;
92 struct sk_buff *deferred_tail; 92 struct sk_buff *deferred_tail;
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c
index cc3fff3dec4f..8ecbd0fb6103 100644
--- a/net/tipc/node_subscr.c
+++ b/net/tipc/node_subscr.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/node_subscr.c: TIPC "node down" subscription handling 2 * net/tipc/node_subscr.c: TIPC "node down" subscription handling
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -44,14 +44,14 @@
44 * tipc_nodesub_subscribe - create "node down" subscription for specified node 44 * tipc_nodesub_subscribe - create "node down" subscription for specified node
45 */ 45 */
46 46
47void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, 47void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
48 void *usr_handle, net_ev_handler handle_down) 48 void *usr_handle, net_ev_handler handle_down)
49{ 49{
50 if (addr == tipc_own_addr) { 50 if (addr == tipc_own_addr) {
51 node_sub->node = NULL; 51 node_sub->node = NULL;
52 return; 52 return;
53 } 53 }
54 54
55 node_sub->node = tipc_node_find(addr); 55 node_sub->node = tipc_node_find(addr);
56 if (!node_sub->node) { 56 if (!node_sub->node) {
57 warn("Node subscription rejected, unknown node 0x%x\n", addr); 57 warn("Node subscription rejected, unknown node 0x%x\n", addr);
diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h
index 01751c4fbb43..5f3f5859b84c 100644
--- a/net/tipc/node_subscr.h
+++ b/net/tipc/node_subscr.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling 2 * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
diff --git a/net/tipc/port.c b/net/tipc/port.c
index b7f3199523ca..5f8217d4b452 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/port.c: TIPC port code 2 * net/tipc/port.c: TIPC port code
3 * 3 *
4 * Copyright (c) 1992-2006, Ericsson AB 4 * Copyright (c) 1992-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -126,8 +126,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
126 126
127 ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper, 127 ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper,
128 TIPC_NODE_SCOPE, &dports); 128 TIPC_NODE_SCOPE, &dports);
129 129
130 /* Send message to destinations (duplicate it only if necessary) */ 130 /* Send message to destinations (duplicate it only if necessary) */
131 131
132 if (ext_targets) { 132 if (ext_targets) {
133 if (dports.count != 0) { 133 if (dports.count != 0) {
@@ -157,7 +157,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
157 157
158/** 158/**
159 * tipc_port_recv_mcast - deliver multicast message to all destination ports 159 * tipc_port_recv_mcast - deliver multicast message to all destination ports
160 * 160 *
161 * If there is no port list, perform a lookup to create one 161 * If there is no port list, perform a lookup to create one
162 */ 162 */
163 163
@@ -213,7 +213,7 @@ exit:
213 213
214/** 214/**
215 * tipc_createport_raw - create a native TIPC port 215 * tipc_createport_raw - create a native TIPC port
216 * 216 *
217 * Returns local port reference 217 * Returns local port reference
218 */ 218 */
219 219
@@ -273,7 +273,7 @@ int tipc_deleteport(u32 ref)
273 273
274 tipc_withdraw(ref, 0, NULL); 274 tipc_withdraw(ref, 0, NULL);
275 p_ptr = tipc_port_lock(ref); 275 p_ptr = tipc_port_lock(ref);
276 if (!p_ptr) 276 if (!p_ptr)
277 return -EINVAL; 277 return -EINVAL;
278 278
279 tipc_ref_discard(ref); 279 tipc_ref_discard(ref);
@@ -302,7 +302,7 @@ int tipc_deleteport(u32 ref)
302 302
303/** 303/**
304 * tipc_get_port() - return port associated with 'ref' 304 * tipc_get_port() - return port associated with 'ref'
305 * 305 *
306 * Note: Port is not locked. 306 * Note: Port is not locked.
307 */ 307 */
308 308
@@ -336,7 +336,7 @@ static int port_unreliable(struct port *p_ptr)
336int tipc_portunreliable(u32 ref, unsigned int *isunreliable) 336int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
337{ 337{
338 struct port *p_ptr; 338 struct port *p_ptr;
339 339
340 p_ptr = tipc_port_lock(ref); 340 p_ptr = tipc_port_lock(ref);
341 if (!p_ptr) 341 if (!p_ptr)
342 return -EINVAL; 342 return -EINVAL;
@@ -348,7 +348,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
348int tipc_set_portunreliable(u32 ref, unsigned int isunreliable) 348int tipc_set_portunreliable(u32 ref, unsigned int isunreliable)
349{ 349{
350 struct port *p_ptr; 350 struct port *p_ptr;
351 351
352 p_ptr = tipc_port_lock(ref); 352 p_ptr = tipc_port_lock(ref);
353 if (!p_ptr) 353 if (!p_ptr)
354 return -EINVAL; 354 return -EINVAL;
@@ -365,7 +365,7 @@ static int port_unreturnable(struct port *p_ptr)
365int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) 365int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable)
366{ 366{
367 struct port *p_ptr; 367 struct port *p_ptr;
368 368
369 p_ptr = tipc_port_lock(ref); 369 p_ptr = tipc_port_lock(ref);
370 if (!p_ptr) 370 if (!p_ptr)
371 return -EINVAL; 371 return -EINVAL;
@@ -377,7 +377,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable)
377int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) 377int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
378{ 378{
379 struct port *p_ptr; 379 struct port *p_ptr;
380 380
381 p_ptr = tipc_port_lock(ref); 381 p_ptr = tipc_port_lock(ref);
382 if (!p_ptr) 382 if (!p_ptr)
383 return -EINVAL; 383 return -EINVAL;
@@ -386,19 +386,19 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
386 return TIPC_OK; 386 return TIPC_OK;
387} 387}
388 388
389/* 389/*
390 * port_build_proto_msg(): build a port level protocol 390 * port_build_proto_msg(): build a port level protocol
391 * or a connection abortion message. Called with 391 * or a connection abortion message. Called with
392 * tipc_port lock on. 392 * tipc_port lock on.
393 */ 393 */
394static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode, 394static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
395 u32 origport, u32 orignode, 395 u32 origport, u32 orignode,
396 u32 usr, u32 type, u32 err, 396 u32 usr, u32 type, u32 err,
397 u32 seqno, u32 ack) 397 u32 seqno, u32 ack)
398{ 398{
399 struct sk_buff *buf; 399 struct sk_buff *buf;
400 struct tipc_msg *msg; 400 struct tipc_msg *msg;
401 401
402 buf = buf_acquire(LONG_H_SIZE); 402 buf = buf_acquire(LONG_H_SIZE);
403 if (buf) { 403 if (buf) {
404 msg = buf_msg(buf); 404 msg = buf_msg(buf);
@@ -461,7 +461,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
461 msg_set_orignode(rmsg, tipc_own_addr); 461 msg_set_orignode(rmsg, tipc_own_addr);
462 else 462 else
463 msg_set_orignode(rmsg, msg_destnode(msg)); 463 msg_set_orignode(rmsg, msg_destnode(msg));
464 msg_set_size(rmsg, data_sz + hdr_sz); 464 msg_set_size(rmsg, data_sz + hdr_sz);
465 msg_set_nametype(rmsg, msg_nametype(msg)); 465 msg_set_nametype(rmsg, msg_nametype(msg));
466 msg_set_nameinst(rmsg, msg_nameinst(msg)); 466 msg_set_nameinst(rmsg, msg_nameinst(msg));
467 memcpy(rbuf->data + hdr_sz, msg_data(msg), data_sz); 467 memcpy(rbuf->data + hdr_sz, msg_data(msg), data_sz);
@@ -492,7 +492,7 @@ int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
492 struct sk_buff *buf; 492 struct sk_buff *buf;
493 int res; 493 int res;
494 494
495 res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, 495 res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE,
496 !p_ptr->user_port, &buf); 496 !p_ptr->user_port, &buf);
497 if (!buf) 497 if (!buf)
498 return res; 498 return res;
@@ -523,7 +523,7 @@ static void port_timeout(unsigned long ref)
523 tipc_own_addr, 523 tipc_own_addr,
524 CONN_MANAGER, 524 CONN_MANAGER,
525 CONN_PROBE, 525 CONN_PROBE,
526 TIPC_OK, 526 TIPC_OK,
527 port_out_seqno(p_ptr), 527 port_out_seqno(p_ptr),
528 0); 528 0);
529 port_incr_out_seqno(p_ptr); 529 port_incr_out_seqno(p_ptr);
@@ -562,7 +562,7 @@ static struct sk_buff *port_build_self_abort_msg(struct port *p_ptr, u32 err)
562 port_peernode(p_ptr), 562 port_peernode(p_ptr),
563 imp, 563 imp,
564 TIPC_CONN_MSG, 564 TIPC_CONN_MSG,
565 err, 565 err,
566 p_ptr->last_in_seqno + 1, 566 p_ptr->last_in_seqno + 1,
567 0); 567 0);
568} 568}
@@ -582,7 +582,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err)
582 tipc_own_addr, 582 tipc_own_addr,
583 imp, 583 imp,
584 TIPC_CONN_MSG, 584 TIPC_CONN_MSG,
585 err, 585 err,
586 port_out_seqno(p_ptr), 586 port_out_seqno(p_ptr),
587 0); 587 0);
588} 588}
@@ -613,7 +613,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
613 } 613 }
614 } 614 }
615 if (msg_type(msg) == CONN_ACK) { 615 if (msg_type(msg) == CONN_ACK) {
616 int wakeup = tipc_port_congested(p_ptr) && 616 int wakeup = tipc_port_congested(p_ptr) &&
617 p_ptr->publ.congested && 617 p_ptr->publ.congested &&
618 p_ptr->wakeup; 618 p_ptr->wakeup;
619 p_ptr->acked += msg_msgcnt(msg); 619 p_ptr->acked += msg_msgcnt(msg);
@@ -630,8 +630,8 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
630 } 630 }
631 if (err) { 631 if (err) {
632 r_buf = port_build_proto_msg(msg_origport(msg), 632 r_buf = port_build_proto_msg(msg_origport(msg),
633 msg_orignode(msg), 633 msg_orignode(msg),
634 msg_destport(msg), 634 msg_destport(msg),
635 tipc_own_addr, 635 tipc_own_addr,
636 DATA_HIGH, 636 DATA_HIGH,
637 TIPC_CONN_MSG, 637 TIPC_CONN_MSG,
@@ -643,10 +643,10 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
643 643
644 /* All is fine */ 644 /* All is fine */
645 if (msg_type(msg) == CONN_PROBE) { 645 if (msg_type(msg) == CONN_PROBE) {
646 r_buf = port_build_proto_msg(msg_origport(msg), 646 r_buf = port_build_proto_msg(msg_origport(msg),
647 msg_orignode(msg), 647 msg_orignode(msg),
648 msg_destport(msg), 648 msg_destport(msg),
649 tipc_own_addr, 649 tipc_own_addr,
650 CONN_MANAGER, 650 CONN_MANAGER,
651 CONN_PROBE_REPLY, 651 CONN_PROBE_REPLY,
652 TIPC_OK, 652 TIPC_OK,
@@ -665,39 +665,39 @@ exit:
665 665
666static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id) 666static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id)
667{ 667{
668 struct publication *publ; 668 struct publication *publ;
669 669
670 if (full_id) 670 if (full_id)
671 tipc_printf(buf, "<%u.%u.%u:%u>:", 671 tipc_printf(buf, "<%u.%u.%u:%u>:",
672 tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), 672 tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr),
673 tipc_node(tipc_own_addr), p_ptr->publ.ref); 673 tipc_node(tipc_own_addr), p_ptr->publ.ref);
674 else 674 else
675 tipc_printf(buf, "%-10u:", p_ptr->publ.ref); 675 tipc_printf(buf, "%-10u:", p_ptr->publ.ref);
676 676
677 if (p_ptr->publ.connected) { 677 if (p_ptr->publ.connected) {
678 u32 dport = port_peerport(p_ptr); 678 u32 dport = port_peerport(p_ptr);
679 u32 destnode = port_peernode(p_ptr); 679 u32 destnode = port_peernode(p_ptr);
680 680
681 tipc_printf(buf, " connected to <%u.%u.%u:%u>", 681 tipc_printf(buf, " connected to <%u.%u.%u:%u>",
682 tipc_zone(destnode), tipc_cluster(destnode), 682 tipc_zone(destnode), tipc_cluster(destnode),
683 tipc_node(destnode), dport); 683 tipc_node(destnode), dport);
684 if (p_ptr->publ.conn_type != 0) 684 if (p_ptr->publ.conn_type != 0)
685 tipc_printf(buf, " via {%u,%u}", 685 tipc_printf(buf, " via {%u,%u}",
686 p_ptr->publ.conn_type, 686 p_ptr->publ.conn_type,
687 p_ptr->publ.conn_instance); 687 p_ptr->publ.conn_instance);
688 } 688 }
689 else if (p_ptr->publ.published) { 689 else if (p_ptr->publ.published) {
690 tipc_printf(buf, " bound to"); 690 tipc_printf(buf, " bound to");
691 list_for_each_entry(publ, &p_ptr->publications, pport_list) { 691 list_for_each_entry(publ, &p_ptr->publications, pport_list) {
692 if (publ->lower == publ->upper) 692 if (publ->lower == publ->upper)
693 tipc_printf(buf, " {%u,%u}", publ->type, 693 tipc_printf(buf, " {%u,%u}", publ->type,
694 publ->lower); 694 publ->lower);
695 else 695 else
696 tipc_printf(buf, " {%u,%u,%u}", publ->type, 696 tipc_printf(buf, " {%u,%u,%u}", publ->type,
697 publ->lower, publ->upper); 697 publ->lower, publ->upper);
698 } 698 }
699 } 699 }
700 tipc_printf(buf, "\n"); 700 tipc_printf(buf, "\n");
701} 701}
702 702
703#define MAX_PORT_QUERY 32768 703#define MAX_PORT_QUERY 32768
@@ -818,7 +818,7 @@ static void port_dispatcher_sigh(void *dummy)
818 struct sk_buff *next = buf->next; 818 struct sk_buff *next = buf->next;
819 struct tipc_msg *msg = buf_msg(buf); 819 struct tipc_msg *msg = buf_msg(buf);
820 u32 dref = msg_destport(msg); 820 u32 dref = msg_destport(msg);
821 821
822 message_type = msg_type(msg); 822 message_type = msg_type(msg);
823 if (message_type > TIPC_DIRECT_MSG) 823 if (message_type > TIPC_DIRECT_MSG)
824 goto reject; /* Unsupported message type */ 824 goto reject; /* Unsupported message type */
@@ -838,7 +838,7 @@ static void port_dispatcher_sigh(void *dummy)
838 goto err; 838 goto err;
839 839
840 switch (message_type) { 840 switch (message_type) {
841 841
842 case TIPC_CONN_MSG:{ 842 case TIPC_CONN_MSG:{
843 tipc_conn_msg_event cb = up_ptr->conn_msg_cb; 843 tipc_conn_msg_event cb = up_ptr->conn_msg_cb;
844 u32 peer_port = port_peerport(p_ptr); 844 u32 peer_port = port_peerport(p_ptr);
@@ -856,9 +856,9 @@ static void port_dispatcher_sigh(void *dummy)
856 goto reject; 856 goto reject;
857 if (unlikely(!cb)) 857 if (unlikely(!cb))
858 goto reject; 858 goto reject;
859 if (unlikely(++p_ptr->publ.conn_unacked >= 859 if (unlikely(++p_ptr->publ.conn_unacked >=
860 TIPC_FLOW_CONTROL_WIN)) 860 TIPC_FLOW_CONTROL_WIN))
861 tipc_acknowledge(dref, 861 tipc_acknowledge(dref,
862 p_ptr->publ.conn_unacked); 862 p_ptr->publ.conn_unacked);
863 skb_pull(buf, msg_hdr_sz(msg)); 863 skb_pull(buf, msg_hdr_sz(msg));
864 cb(usr_handle, dref, &buf, msg_data(msg), 864 cb(usr_handle, dref, &buf, msg_data(msg),
@@ -874,7 +874,7 @@ static void port_dispatcher_sigh(void *dummy)
874 if (unlikely(!cb)) 874 if (unlikely(!cb))
875 goto reject; 875 goto reject;
876 skb_pull(buf, msg_hdr_sz(msg)); 876 skb_pull(buf, msg_hdr_sz(msg));
877 cb(usr_handle, dref, &buf, msg_data(msg), 877 cb(usr_handle, dref, &buf, msg_data(msg),
878 msg_data_sz(msg), msg_importance(msg), 878 msg_data_sz(msg), msg_importance(msg),
879 &orig); 879 &orig);
880 break; 880 break;
@@ -895,7 +895,7 @@ static void port_dispatcher_sigh(void *dummy)
895 dseq.upper = (message_type == TIPC_NAMED_MSG) 895 dseq.upper = (message_type == TIPC_NAMED_MSG)
896 ? dseq.lower : msg_nameupper(msg); 896 ? dseq.lower : msg_nameupper(msg);
897 skb_pull(buf, msg_hdr_sz(msg)); 897 skb_pull(buf, msg_hdr_sz(msg));
898 cb(usr_handle, dref, &buf, msg_data(msg), 898 cb(usr_handle, dref, &buf, msg_data(msg),
899 msg_data_sz(msg), msg_importance(msg), 899 msg_data_sz(msg), msg_importance(msg),
900 &orig, &dseq); 900 &orig, &dseq);
901 break; 901 break;
@@ -907,9 +907,9 @@ static void port_dispatcher_sigh(void *dummy)
907 continue; 907 continue;
908err: 908err:
909 switch (message_type) { 909 switch (message_type) {
910 910
911 case TIPC_CONN_MSG:{ 911 case TIPC_CONN_MSG:{
912 tipc_conn_shutdown_event cb = 912 tipc_conn_shutdown_event cb =
913 up_ptr->conn_err_cb; 913 up_ptr->conn_err_cb;
914 u32 peer_port = port_peerport(p_ptr); 914 u32 peer_port = port_peerport(p_ptr);
915 u32 peer_node = port_peernode(p_ptr); 915 u32 peer_node = port_peernode(p_ptr);
@@ -940,7 +940,7 @@ err:
940 } 940 }
941 case TIPC_MCAST_MSG: 941 case TIPC_MCAST_MSG:
942 case TIPC_NAMED_MSG:{ 942 case TIPC_NAMED_MSG:{
943 tipc_named_msg_err_event cb = 943 tipc_named_msg_err_event cb =
944 up_ptr->named_err_cb; 944 up_ptr->named_err_cb;
945 945
946 spin_unlock_bh(p_ptr->publ.lock); 946 spin_unlock_bh(p_ptr->publ.lock);
@@ -951,7 +951,7 @@ err:
951 dseq.upper = (message_type == TIPC_NAMED_MSG) 951 dseq.upper = (message_type == TIPC_NAMED_MSG)
952 ? dseq.lower : msg_nameupper(msg); 952 ? dseq.lower : msg_nameupper(msg);
953 skb_pull(buf, msg_hdr_sz(msg)); 953 skb_pull(buf, msg_hdr_sz(msg));
954 cb(usr_handle, dref, &buf, msg_data(msg), 954 cb(usr_handle, dref, &buf, msg_data(msg),
955 msg_data_sz(msg), msg_errcode(msg), &dseq); 955 msg_data_sz(msg), msg_errcode(msg), &dseq);
956 break; 956 break;
957 } 957 }
@@ -986,9 +986,9 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf)
986 return TIPC_OK; 986 return TIPC_OK;
987} 987}
988 988
989/* 989/*
990 * Wake up port after congestion: Called with port locked, 990 * Wake up port after congestion: Called with port locked,
991 * 991 *
992 */ 992 */
993 993
994static void port_wakeup_sh(unsigned long ref) 994static void port_wakeup_sh(unsigned long ref)
@@ -1033,7 +1033,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
1033 tipc_own_addr, 1033 tipc_own_addr,
1034 CONN_MANAGER, 1034 CONN_MANAGER,
1035 CONN_ACK, 1035 CONN_ACK,
1036 TIPC_OK, 1036 TIPC_OK,
1037 port_out_seqno(p_ptr), 1037 port_out_seqno(p_ptr),
1038 ack); 1038 ack);
1039 } 1039 }
@@ -1046,20 +1046,20 @@ void tipc_acknowledge(u32 ref, u32 ack)
1046 * registry if non-zero user_ref. 1046 * registry if non-zero user_ref.
1047 */ 1047 */
1048 1048
1049int tipc_createport(u32 user_ref, 1049int tipc_createport(u32 user_ref,
1050 void *usr_handle, 1050 void *usr_handle,
1051 unsigned int importance, 1051 unsigned int importance,
1052 tipc_msg_err_event error_cb, 1052 tipc_msg_err_event error_cb,
1053 tipc_named_msg_err_event named_error_cb, 1053 tipc_named_msg_err_event named_error_cb,
1054 tipc_conn_shutdown_event conn_error_cb, 1054 tipc_conn_shutdown_event conn_error_cb,
1055 tipc_msg_event msg_cb, 1055 tipc_msg_event msg_cb,
1056 tipc_named_msg_event named_msg_cb, 1056 tipc_named_msg_event named_msg_cb,
1057 tipc_conn_msg_event conn_msg_cb, 1057 tipc_conn_msg_event conn_msg_cb,
1058 tipc_continue_event continue_event_cb,/* May be zero */ 1058 tipc_continue_event continue_event_cb,/* May be zero */
1059 u32 *portref) 1059 u32 *portref)
1060{ 1060{
1061 struct user_port *up_ptr; 1061 struct user_port *up_ptr;
1062 struct port *p_ptr; 1062 struct port *p_ptr;
1063 u32 ref; 1063 u32 ref;
1064 1064
1065 up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC); 1065 up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
@@ -1088,7 +1088,7 @@ int tipc_createport(u32 user_ref,
1088 INIT_LIST_HEAD(&up_ptr->uport_list); 1088 INIT_LIST_HEAD(&up_ptr->uport_list);
1089 tipc_reg_add_port(up_ptr); 1089 tipc_reg_add_port(up_ptr);
1090 *portref = p_ptr->publ.ref; 1090 *portref = p_ptr->publ.ref;
1091 dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref); 1091 dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref);
1092 tipc_port_unlock(p_ptr); 1092 tipc_port_unlock(p_ptr);
1093 return TIPC_OK; 1093 return TIPC_OK;
1094} 1094}
@@ -1103,7 +1103,7 @@ int tipc_ownidentity(u32 ref, struct tipc_portid *id)
1103int tipc_portimportance(u32 ref, unsigned int *importance) 1103int tipc_portimportance(u32 ref, unsigned int *importance)
1104{ 1104{
1105 struct port *p_ptr; 1105 struct port *p_ptr;
1106 1106
1107 p_ptr = tipc_port_lock(ref); 1107 p_ptr = tipc_port_lock(ref);
1108 if (!p_ptr) 1108 if (!p_ptr)
1109 return -EINVAL; 1109 return -EINVAL;
@@ -1172,19 +1172,19 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1172 struct publication *publ; 1172 struct publication *publ;
1173 struct publication *tpubl; 1173 struct publication *tpubl;
1174 int res = -EINVAL; 1174 int res = -EINVAL;
1175 1175
1176 p_ptr = tipc_port_lock(ref); 1176 p_ptr = tipc_port_lock(ref);
1177 if (!p_ptr) 1177 if (!p_ptr)
1178 return -EINVAL; 1178 return -EINVAL;
1179 if (!seq) { 1179 if (!seq) {
1180 list_for_each_entry_safe(publ, tpubl, 1180 list_for_each_entry_safe(publ, tpubl,
1181 &p_ptr->publications, pport_list) { 1181 &p_ptr->publications, pport_list) {
1182 tipc_nametbl_withdraw(publ->type, publ->lower, 1182 tipc_nametbl_withdraw(publ->type, publ->lower,
1183 publ->ref, publ->key); 1183 publ->ref, publ->key);
1184 } 1184 }
1185 res = TIPC_OK; 1185 res = TIPC_OK;
1186 } else { 1186 } else {
1187 list_for_each_entry_safe(publ, tpubl, 1187 list_for_each_entry_safe(publ, tpubl,
1188 &p_ptr->publications, pport_list) { 1188 &p_ptr->publications, pport_list) {
1189 if (publ->scope != scope) 1189 if (publ->scope != scope)
1190 continue; 1190 continue;
@@ -1194,7 +1194,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1194 continue; 1194 continue;
1195 if (publ->upper != seq->upper) 1195 if (publ->upper != seq->upper)
1196 break; 1196 break;
1197 tipc_nametbl_withdraw(publ->type, publ->lower, 1197 tipc_nametbl_withdraw(publ->type, publ->lower,
1198 publ->ref, publ->key); 1198 publ->ref, publ->key);
1199 res = TIPC_OK; 1199 res = TIPC_OK;
1200 break; 1200 break;
@@ -1292,7 +1292,7 @@ int tipc_shutdown(u32 ref)
1292 tipc_own_addr, 1292 tipc_own_addr,
1293 imp, 1293 imp,
1294 TIPC_CONN_MSG, 1294 TIPC_CONN_MSG,
1295 TIPC_CONN_SHUTDOWN, 1295 TIPC_CONN_SHUTDOWN,
1296 port_out_seqno(p_ptr), 1296 port_out_seqno(p_ptr),
1297 0); 1297 0);
1298 } 1298 }
@@ -1304,7 +1304,7 @@ int tipc_shutdown(u32 ref)
1304int tipc_isconnected(u32 ref, int *isconnected) 1304int tipc_isconnected(u32 ref, int *isconnected)
1305{ 1305{
1306 struct port *p_ptr; 1306 struct port *p_ptr;
1307 1307
1308 p_ptr = tipc_port_lock(ref); 1308 p_ptr = tipc_port_lock(ref);
1309 if (!p_ptr) 1309 if (!p_ptr)
1310 return -EINVAL; 1310 return -EINVAL;
@@ -1317,7 +1317,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer)
1317{ 1317{
1318 struct port *p_ptr; 1318 struct port *p_ptr;
1319 int res; 1319 int res;
1320 1320
1321 p_ptr = tipc_port_lock(ref); 1321 p_ptr = tipc_port_lock(ref);
1322 if (!p_ptr) 1322 if (!p_ptr)
1323 return -EINVAL; 1323 return -EINVAL;
@@ -1348,7 +1348,7 @@ int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
1348{ 1348{
1349 struct sk_buff *buf; 1349 struct sk_buff *buf;
1350 int res; 1350 int res;
1351 1351
1352 res = msg_build(&sender->publ.phdr, msg_sect, num_sect, 1352 res = msg_build(&sender->publ.phdr, msg_sect, num_sect,
1353 MAX_MSG_SIZE, !sender->user_port, &buf); 1353 MAX_MSG_SIZE, !sender->user_port, &buf);
1354 if (likely(buf)) 1354 if (likely(buf))
@@ -1394,7 +1394,7 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
1394 return -ELINKCONG; 1394 return -ELINKCONG;
1395} 1395}
1396 1396
1397/** 1397/**
1398 * tipc_send_buf - send message buffer on connection 1398 * tipc_send_buf - send message buffer on connection
1399 */ 1399 */
1400 1400
@@ -1406,7 +1406,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
1406 u32 hsz; 1406 u32 hsz;
1407 u32 sz; 1407 u32 sz;
1408 u32 res; 1408 u32 res;
1409 1409
1410 p_ptr = tipc_port_deref(ref); 1410 p_ptr = tipc_port_deref(ref);
1411 if (!p_ptr || !p_ptr->publ.connected) 1411 if (!p_ptr || !p_ptr->publ.connected)
1412 return -EINVAL; 1412 return -EINVAL;
@@ -1447,12 +1447,12 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
1447 * tipc_forward2name - forward message sections to port name 1447 * tipc_forward2name - forward message sections to port name
1448 */ 1448 */
1449 1449
1450int tipc_forward2name(u32 ref, 1450int tipc_forward2name(u32 ref,
1451 struct tipc_name const *name, 1451 struct tipc_name const *name,
1452 u32 domain, 1452 u32 domain,
1453 u32 num_sect, 1453 u32 num_sect,
1454 struct iovec const *msg_sect, 1454 struct iovec const *msg_sect,
1455 struct tipc_portid const *orig, 1455 struct tipc_portid const *orig,
1456 unsigned int importance) 1456 unsigned int importance)
1457{ 1457{
1458 struct port *p_ptr; 1458 struct port *p_ptr;
@@ -1483,7 +1483,7 @@ int tipc_forward2name(u32 ref,
1483 p_ptr->sent++; 1483 p_ptr->sent++;
1484 if (likely(destnode == tipc_own_addr)) 1484 if (likely(destnode == tipc_own_addr))
1485 return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); 1485 return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
1486 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, 1486 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
1487 destnode); 1487 destnode);
1488 if (likely(res != -ELINKCONG)) 1488 if (likely(res != -ELINKCONG))
1489 return res; 1489 return res;
@@ -1493,7 +1493,7 @@ int tipc_forward2name(u32 ref,
1493 } 1493 }
1494 return -ELINKCONG; 1494 return -ELINKCONG;
1495 } 1495 }
1496 return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect, 1496 return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect,
1497 TIPC_ERR_NO_NAME); 1497 TIPC_ERR_NO_NAME);
1498} 1498}
1499 1499
@@ -1501,10 +1501,10 @@ int tipc_forward2name(u32 ref,
1501 * tipc_send2name - send message sections to port name 1501 * tipc_send2name - send message sections to port name
1502 */ 1502 */
1503 1503
1504int tipc_send2name(u32 ref, 1504int tipc_send2name(u32 ref,
1505 struct tipc_name const *name, 1505 struct tipc_name const *name,
1506 unsigned int domain, 1506 unsigned int domain,
1507 unsigned int num_sect, 1507 unsigned int num_sect,
1508 struct iovec const *msg_sect) 1508 struct iovec const *msg_sect)
1509{ 1509{
1510 struct tipc_portid orig; 1510 struct tipc_portid orig;
@@ -1515,7 +1515,7 @@ int tipc_send2name(u32 ref,
1515 TIPC_PORT_IMPORTANCE); 1515 TIPC_PORT_IMPORTANCE);
1516} 1516}
1517 1517
1518/** 1518/**
1519 * tipc_forward_buf2name - forward message buffer to port name 1519 * tipc_forward_buf2name - forward message buffer to port name
1520 */ 1520 */
1521 1521
@@ -1571,14 +1571,14 @@ int tipc_forward_buf2name(u32 ref,
1571 return tipc_reject_msg(buf, TIPC_ERR_NO_NAME); 1571 return tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
1572} 1572}
1573 1573
1574/** 1574/**
1575 * tipc_send_buf2name - send message buffer to port name 1575 * tipc_send_buf2name - send message buffer to port name
1576 */ 1576 */
1577 1577
1578int tipc_send_buf2name(u32 ref, 1578int tipc_send_buf2name(u32 ref,
1579 struct tipc_name const *dest, 1579 struct tipc_name const *dest,
1580 u32 domain, 1580 u32 domain,
1581 struct sk_buff *buf, 1581 struct sk_buff *buf,
1582 unsigned int dsz) 1582 unsigned int dsz)
1583{ 1583{
1584 struct tipc_portid orig; 1584 struct tipc_portid orig;
@@ -1589,15 +1589,15 @@ int tipc_send_buf2name(u32 ref,
1589 TIPC_PORT_IMPORTANCE); 1589 TIPC_PORT_IMPORTANCE);
1590} 1590}
1591 1591
1592/** 1592/**
1593 * tipc_forward2port - forward message sections to port identity 1593 * tipc_forward2port - forward message sections to port identity
1594 */ 1594 */
1595 1595
1596int tipc_forward2port(u32 ref, 1596int tipc_forward2port(u32 ref,
1597 struct tipc_portid const *dest, 1597 struct tipc_portid const *dest,
1598 unsigned int num_sect, 1598 unsigned int num_sect,
1599 struct iovec const *msg_sect, 1599 struct iovec const *msg_sect,
1600 struct tipc_portid const *orig, 1600 struct tipc_portid const *orig,
1601 unsigned int importance) 1601 unsigned int importance)
1602{ 1602{
1603 struct port *p_ptr; 1603 struct port *p_ptr;
@@ -1630,24 +1630,24 @@ int tipc_forward2port(u32 ref,
1630 return -ELINKCONG; 1630 return -ELINKCONG;
1631} 1631}
1632 1632
1633/** 1633/**
1634 * tipc_send2port - send message sections to port identity 1634 * tipc_send2port - send message sections to port identity
1635 */ 1635 */
1636 1636
1637int tipc_send2port(u32 ref, 1637int tipc_send2port(u32 ref,
1638 struct tipc_portid const *dest, 1638 struct tipc_portid const *dest,
1639 unsigned int num_sect, 1639 unsigned int num_sect,
1640 struct iovec const *msg_sect) 1640 struct iovec const *msg_sect)
1641{ 1641{
1642 struct tipc_portid orig; 1642 struct tipc_portid orig;
1643 1643
1644 orig.ref = ref; 1644 orig.ref = ref;
1645 orig.node = tipc_own_addr; 1645 orig.node = tipc_own_addr;
1646 return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, 1646 return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig,
1647 TIPC_PORT_IMPORTANCE); 1647 TIPC_PORT_IMPORTANCE);
1648} 1648}
1649 1649
1650/** 1650/**
1651 * tipc_forward_buf2port - forward message buffer to port identity 1651 * tipc_forward_buf2port - forward message buffer to port identity
1652 */ 1652 */
1653int tipc_forward_buf2port(u32 ref, 1653int tipc_forward_buf2port(u32 ref,
@@ -1692,20 +1692,20 @@ int tipc_forward_buf2port(u32 ref,
1692 return -ELINKCONG; 1692 return -ELINKCONG;
1693} 1693}
1694 1694
1695/** 1695/**
1696 * tipc_send_buf2port - send message buffer to port identity 1696 * tipc_send_buf2port - send message buffer to port identity
1697 */ 1697 */
1698 1698
1699int tipc_send_buf2port(u32 ref, 1699int tipc_send_buf2port(u32 ref,
1700 struct tipc_portid const *dest, 1700 struct tipc_portid const *dest,
1701 struct sk_buff *buf, 1701 struct sk_buff *buf,
1702 unsigned int dsz) 1702 unsigned int dsz)
1703{ 1703{
1704 struct tipc_portid orig; 1704 struct tipc_portid orig;
1705 1705
1706 orig.ref = ref; 1706 orig.ref = ref;
1707 orig.node = tipc_own_addr; 1707 orig.node = tipc_own_addr;
1708 return tipc_forward_buf2port(ref, dest, buf, dsz, &orig, 1708 return tipc_forward_buf2port(ref, dest, buf, dsz, &orig,
1709 TIPC_PORT_IMPORTANCE); 1709 TIPC_PORT_IMPORTANCE);
1710} 1710}
1711 1711
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 839f100da646..7ef4d64b32f7 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/port.h: Include file for TIPC port code 2 * net/tipc/port.h: Include file for TIPC port code
3 * 3 *
4 * Copyright (c) 1994-2006, Ericsson AB 4 * Copyright (c) 1994-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -52,17 +52,17 @@
52 * <various callback routines> 52 * <various callback routines>
53 * @uport_list: adjacent user ports in list of ports held by user 53 * @uport_list: adjacent user ports in list of ports held by user
54 */ 54 */
55 55
56struct user_port { 56struct user_port {
57 u32 user_ref; 57 u32 user_ref;
58 void *usr_handle; 58 void *usr_handle;
59 u32 ref; 59 u32 ref;
60 tipc_msg_err_event err_cb; 60 tipc_msg_err_event err_cb;
61 tipc_named_msg_err_event named_err_cb; 61 tipc_named_msg_err_event named_err_cb;
62 tipc_conn_shutdown_event conn_err_cb; 62 tipc_conn_shutdown_event conn_err_cb;
63 tipc_msg_event msg_cb; 63 tipc_msg_event msg_cb;
64 tipc_named_msg_event named_msg_cb; 64 tipc_named_msg_event named_msg_cb;
65 tipc_conn_msg_event conn_msg_cb; 65 tipc_conn_msg_event conn_msg_cb;
66 tipc_continue_event continue_event_cb; 66 tipc_continue_event continue_event_cb;
67 struct list_head uport_list; 67 struct list_head uport_list;
68}; 68};
@@ -113,7 +113,7 @@ struct port {
113extern spinlock_t tipc_port_list_lock; 113extern spinlock_t tipc_port_list_lock;
114struct port_list; 114struct port_list;
115 115
116int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect, 116int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
117 struct iovec const *msg_sect); 117 struct iovec const *msg_sect);
118int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, 118int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
119 struct iovec const *msg_sect, u32 num_sect, 119 struct iovec const *msg_sect, u32 num_sect,
@@ -133,9 +133,9 @@ static inline struct port *tipc_port_lock(u32 ref)
133 return (struct port *)tipc_ref_lock(ref); 133 return (struct port *)tipc_ref_lock(ref);
134} 134}
135 135
136/** 136/**
137 * tipc_port_unlock - unlock a port instance 137 * tipc_port_unlock - unlock a port instance
138 * 138 *
139 * Can use pointer instead of tipc_ref_unlock() since port is already locked. 139 * Can use pointer instead of tipc_ref_unlock() since port is already locked.
140 */ 140 */
141 141
@@ -164,7 +164,7 @@ static inline int tipc_port_congested(struct port *p_ptr)
164 return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2)); 164 return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2));
165} 165}
166 166
167/** 167/**
168 * tipc_port_recv_msg - receive message from lower layer and deliver to port user 168 * tipc_port_recv_msg - receive message from lower layer and deliver to port user
169 */ 169 */
170 170
@@ -175,7 +175,7 @@ static inline int tipc_port_recv_msg(struct sk_buff *buf)
175 u32 destport = msg_destport(msg); 175 u32 destport = msg_destport(msg);
176 u32 dsz = msg_data_sz(msg); 176 u32 dsz = msg_data_sz(msg);
177 u32 err; 177 u32 err;
178 178
179 /* forward unresolved named message */ 179 /* forward unresolved named message */
180 if (unlikely(!destport)) { 180 if (unlikely(!destport)) {
181 tipc_net_route_msg(buf); 181 tipc_net_route_msg(buf);
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index e6d6ae22ea49..6704a58c7851 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/ref.c: TIPC object registry code 2 * net/tipc/ref.c: TIPC object registry code
3 * 3 *
4 * Copyright (c) 1991-2006, Ericsson AB 4 * Copyright (c) 1991-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -50,11 +50,11 @@
50 * Object reference table consists of 2**N entries. 50 * Object reference table consists of 2**N entries.
51 * 51 *
52 * A used entry has object ptr != 0, reference == XXXX|own index 52 * A used entry has object ptr != 0, reference == XXXX|own index
53 * (XXXX changes each time entry is acquired) 53 * (XXXX changes each time entry is acquired)
54 * A free entry has object ptr == 0, reference == YYYY|next free index 54 * A free entry has object ptr == 0, reference == YYYY|next free index
55 * (YYYY is one more than last used XXXX) 55 * (YYYY is one more than last used XXXX)
56 * 56 *
57 * Free list is initially chained from entry (2**N)-1 to entry 1. 57 * Free list is initially chained from entry (2**N)-1 to entry 1.
58 * Entry 0 is not used to allow index 0 to indicate the end of the free list. 58 * Entry 0 is not used to allow index 0 to indicate the end of the free list.
59 * 59 *
60 * Note: Any accidental reference of the form XXXX|0--0 won't match entry 0 60 * Note: Any accidental reference of the form XXXX|0--0 won't match entry 0
@@ -113,9 +113,9 @@ void tipc_ref_table_stop(void)
113 113
114/** 114/**
115 * tipc_ref_acquire - create reference to an object 115 * tipc_ref_acquire - create reference to an object
116 * 116 *
117 * Return a unique reference value which can be translated back to the pointer 117 * Return a unique reference value which can be translated back to the pointer
118 * 'object' at a later time. Also, pass back a pointer to the lock protecting 118 * 'object' at a later time. Also, pass back a pointer to the lock protecting
119 * the object, but without locking it. 119 * the object, but without locking it.
120 */ 120 */
121 121
@@ -141,15 +141,15 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
141 index = tipc_ref_table.first_free; 141 index = tipc_ref_table.first_free;
142 entry = &(tipc_ref_table.entries[index]); 142 entry = &(tipc_ref_table.entries[index]);
143 index_mask = tipc_ref_table.index_mask; 143 index_mask = tipc_ref_table.index_mask;
144 /* take lock in case a previous user of entry still holds it */ 144 /* take lock in case a previous user of entry still holds it */
145 spin_lock_bh(&entry->lock); 145 spin_lock_bh(&entry->lock);
146 next_plus_upper = entry->data.next_plus_upper; 146 next_plus_upper = entry->data.next_plus_upper;
147 tipc_ref_table.first_free = next_plus_upper & index_mask; 147 tipc_ref_table.first_free = next_plus_upper & index_mask;
148 reference = (next_plus_upper & ~index_mask) + index; 148 reference = (next_plus_upper & ~index_mask) + index;
149 entry->data.reference = reference; 149 entry->data.reference = reference;
150 entry->object = object; 150 entry->object = object;
151 if (lock != 0) 151 if (lock != 0)
152 *lock = &entry->lock; 152 *lock = &entry->lock;
153 spin_unlock_bh(&entry->lock); 153 spin_unlock_bh(&entry->lock);
154 } 154 }
155 write_unlock_bh(&ref_table_lock); 155 write_unlock_bh(&ref_table_lock);
@@ -158,7 +158,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
158 158
159/** 159/**
160 * tipc_ref_discard - invalidate references to an object 160 * tipc_ref_discard - invalidate references to an object
161 * 161 *
162 * Disallow future references to an object and free up the entry for re-use. 162 * Disallow future references to an object and free up the entry for re-use.
163 * Note: The entry's spin_lock may still be busy after discard 163 * Note: The entry's spin_lock may still be busy after discard
164 */ 164 */
@@ -166,7 +166,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
166void tipc_ref_discard(u32 ref) 166void tipc_ref_discard(u32 ref)
167{ 167{
168 struct reference *entry; 168 struct reference *entry;
169 u32 index; 169 u32 index;
170 u32 index_mask; 170 u32 index_mask;
171 171
172 if (!ref) { 172 if (!ref) {
@@ -198,7 +198,7 @@ void tipc_ref_discard(u32 ref)
198 tipc_ref_table.first_free = index; 198 tipc_ref_table.first_free = index;
199 else 199 else
200 /* next_plus_upper is always XXXX|0--0 for last free entry */ 200 /* next_plus_upper is always XXXX|0--0 for last free entry */
201 tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper 201 tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper
202 |= index; 202 |= index;
203 tipc_ref_table.last_free = index; 203 tipc_ref_table.last_free = index;
204 204
diff --git a/net/tipc/ref.h b/net/tipc/ref.h
index 6d20006be45b..38f3a7f4a78d 100644
--- a/net/tipc/ref.h
+++ b/net/tipc/ref.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/ref.h: Include file for TIPC object registry code 2 * net/tipc/ref.h: Include file for TIPC object registry code
3 * 3 *
4 * Copyright (c) 1991-2006, Ericsson AB 4 * Copyright (c) 1991-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -43,7 +43,7 @@
43 * @lock: spinlock controlling access to object 43 * @lock: spinlock controlling access to object
44 * @data: reference value associated with object (or link to next unused entry) 44 * @data: reference value associated with object (or link to next unused entry)
45 */ 45 */
46 46
47struct reference { 47struct reference {
48 void *object; 48 void *object;
49 spinlock_t lock; 49 spinlock_t lock;
@@ -96,7 +96,7 @@ static inline void *tipc_ref_lock(u32 ref)
96} 96}
97 97
98/** 98/**
99 * tipc_ref_unlock - unlock referenced object 99 * tipc_ref_unlock - unlock referenced object
100 */ 100 */
101 101
102static inline void tipc_ref_unlock(u32 ref) 102static inline void tipc_ref_unlock(u32 ref)
@@ -119,7 +119,7 @@ static inline void tipc_ref_unlock(u32 ref)
119static inline void *tipc_ref_deref(u32 ref) 119static inline void *tipc_ref_deref(u32 ref)
120{ 120{
121 if (likely(tipc_ref_table.entries)) { 121 if (likely(tipc_ref_table.entries)) {
122 struct reference *r = 122 struct reference *r =
123 &tipc_ref_table.entries[ref & tipc_ref_table.index_mask]; 123 &tipc_ref_table.entries[ref & tipc_ref_table.index_mask];
124 124
125 if (likely(r->data.reference == ref)) 125 if (likely(r->data.reference == ref))
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2a6a5a6b4c12..b71739fbe2c6 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/socket.c: TIPC socket API 2 * net/tipc/socket.c: TIPC socket API
3 * 3 *
4 * Copyright (c) 2001-2006, Ericsson AB 4 * Copyright (c) 2001-2006, Ericsson AB
5 * Copyright (c) 2004-2006, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -82,29 +82,29 @@ static int sockets_enabled = 0;
82static atomic_t tipc_queue_size = ATOMIC_INIT(0); 82static atomic_t tipc_queue_size = ATOMIC_INIT(0);
83 83
84 84
85/* 85/*
86 * sock_lock(): Lock a port/socket pair. lock_sock() can 86 * sock_lock(): Lock a port/socket pair. lock_sock() can
87 * not be used here, since the same lock must protect ports 87 * not be used here, since the same lock must protect ports
88 * with non-socket interfaces. 88 * with non-socket interfaces.
89 * See net.c for description of locking policy. 89 * See net.c for description of locking policy.
90 */ 90 */
91static void sock_lock(struct tipc_sock* tsock) 91static void sock_lock(struct tipc_sock* tsock)
92{ 92{
93 spin_lock_bh(tsock->p->lock); 93 spin_lock_bh(tsock->p->lock);
94} 94}
95 95
96/* 96/*
97 * sock_unlock(): Unlock a port/socket pair 97 * sock_unlock(): Unlock a port/socket pair
98 */ 98 */
99static void sock_unlock(struct tipc_sock* tsock) 99static void sock_unlock(struct tipc_sock* tsock)
100{ 100{
101 spin_unlock_bh(tsock->p->lock); 101 spin_unlock_bh(tsock->p->lock);
102} 102}
103 103
104/** 104/**
105 * pollmask - determine the current set of poll() events for a socket 105 * pollmask - determine the current set of poll() events for a socket
106 * @sock: socket structure 106 * @sock: socket structure
107 * 107 *
108 * TIPC sets the returned events as follows: 108 * TIPC sets the returned events as follows:
109 * a) POLLRDNORM and POLLIN are set if the socket's receive queue is non-empty 109 * a) POLLRDNORM and POLLIN are set if the socket's receive queue is non-empty
110 * or if a connection-oriented socket is does not have an active connection 110 * or if a connection-oriented socket is does not have an active connection
@@ -115,7 +115,7 @@ static void sock_unlock(struct tipc_sock* tsock)
115 * 115 *
116 * IMPORTANT: The fact that a read or write operation will not block does NOT 116 * IMPORTANT: The fact that a read or write operation will not block does NOT
117 * imply that the operation will succeed! 117 * imply that the operation will succeed!
118 * 118 *
119 * Returns pollmask value 119 * Returns pollmask value
120 */ 120 */
121 121
@@ -130,7 +130,7 @@ static u32 pollmask(struct socket *sock)
130 else 130 else
131 mask = 0; 131 mask = 0;
132 132
133 if (sock->state == SS_DISCONNECTING) 133 if (sock->state == SS_DISCONNECTING)
134 mask |= POLLHUP; 134 mask |= POLLHUP;
135 else 135 else
136 mask |= POLLOUT; 136 mask |= POLLOUT;
@@ -146,9 +146,9 @@ static u32 pollmask(struct socket *sock)
146 146
147static void advance_queue(struct tipc_sock *tsock) 147static void advance_queue(struct tipc_sock *tsock)
148{ 148{
149 sock_lock(tsock); 149 sock_lock(tsock);
150 buf_discard(skb_dequeue(&tsock->sk.sk_receive_queue)); 150 buf_discard(skb_dequeue(&tsock->sk.sk_receive_queue));
151 sock_unlock(tsock); 151 sock_unlock(tsock);
152 atomic_dec(&tipc_queue_size); 152 atomic_dec(&tipc_queue_size);
153} 153}
154 154
@@ -156,7 +156,7 @@ static void advance_queue(struct tipc_sock *tsock)
156 * tipc_create - create a TIPC socket 156 * tipc_create - create a TIPC socket
157 * @sock: pre-allocated socket structure 157 * @sock: pre-allocated socket structure
158 * @protocol: protocol indicator (must be 0) 158 * @protocol: protocol indicator (must be 0)
159 * 159 *
160 * This routine creates and attaches a 'struct sock' to the 'struct socket', 160 * This routine creates and attaches a 'struct sock' to the 'struct socket',
161 * then create and attaches a TIPC port to the 'struct sock' part. 161 * then create and attaches a TIPC port to the 'struct sock' part.
162 * 162 *
@@ -167,7 +167,7 @@ static int tipc_create(struct socket *sock, int protocol)
167 struct tipc_sock *tsock; 167 struct tipc_sock *tsock;
168 struct tipc_port *port; 168 struct tipc_port *port;
169 struct sock *sk; 169 struct sock *sk;
170 u32 ref; 170 u32 ref;
171 171
172 if (unlikely(protocol != 0)) 172 if (unlikely(protocol != 0))
173 return -EPROTONOSUPPORT; 173 return -EPROTONOSUPPORT;
@@ -232,7 +232,7 @@ static int tipc_create(struct socket *sock, int protocol)
232 * For SEQPACKET and STREAM socket types, the first message is rejected 232 * For SEQPACKET and STREAM socket types, the first message is rejected
233 * and any others are discarded. (If the first message on a STREAM socket 233 * and any others are discarded. (If the first message on a STREAM socket
234 * is partially-read, it is discarded and the next one is rejected instead.) 234 * is partially-read, it is discarded and the next one is rejected instead.)
235 * 235 *
236 * NOTE: Rejected messages are not necessarily returned to the sender! They 236 * NOTE: Rejected messages are not necessarily returned to the sender! They
237 * are returned or discarded according to the "destination droppable" setting 237 * are returned or discarded according to the "destination droppable" setting
238 * specified for the message by the sender. 238 * specified for the message by the sender.
@@ -247,7 +247,7 @@ static int release(struct socket *sock)
247 int res = TIPC_OK; 247 int res = TIPC_OK;
248 struct sk_buff *buf; 248 struct sk_buff *buf;
249 249
250 dbg("sock_delete: %x\n",tsock); 250 dbg("sock_delete: %x\n",tsock);
251 if (!tsock) 251 if (!tsock)
252 return 0; 252 return 0;
253 down_interruptible(&tsock->sem); 253 down_interruptible(&tsock->sem);
@@ -255,7 +255,7 @@ static int release(struct socket *sock)
255 up(&tsock->sem); 255 up(&tsock->sem);
256 return 0; 256 return 0;
257 } 257 }
258 258
259 /* Reject unreceived messages, unless no longer connected */ 259 /* Reject unreceived messages, unless no longer connected */
260 260
261 while (sock->state != SS_DISCONNECTING) { 261 while (sock->state != SS_DISCONNECTING) {
@@ -289,7 +289,7 @@ static int release(struct socket *sock)
289 289
290 sock_put(sk); 290 sock_put(sk);
291 291
292 atomic_dec(&tipc_user_count); 292 atomic_dec(&tipc_user_count);
293 return res; 293 return res;
294} 294}
295 295
@@ -298,11 +298,11 @@ static int release(struct socket *sock)
298 * @sock: socket structure 298 * @sock: socket structure
299 * @uaddr: socket address describing name(s) and desired operation 299 * @uaddr: socket address describing name(s) and desired operation
300 * @uaddr_len: size of socket address data structure 300 * @uaddr_len: size of socket address data structure
301 * 301 *
302 * Name and name sequence binding is indicated using a positive scope value; 302 * Name and name sequence binding is indicated using a positive scope value;
303 * a negative scope value unbinds the specified name. Specifying no name 303 * a negative scope value unbinds the specified name. Specifying no name
304 * (i.e. a socket address length of 0) unbinds all names from the socket. 304 * (i.e. a socket address length of 0) unbinds all names from the socket.
305 * 305 *
306 * Returns 0 on success, errno otherwise 306 * Returns 0 on success, errno otherwise
307 */ 307 */
308 308
@@ -314,7 +314,7 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
314 314
315 if (down_interruptible(&tsock->sem)) 315 if (down_interruptible(&tsock->sem))
316 return -ERESTARTSYS; 316 return -ERESTARTSYS;
317 317
318 if (unlikely(!uaddr_len)) { 318 if (unlikely(!uaddr_len)) {
319 res = tipc_withdraw(tsock->p->ref, 0, NULL); 319 res = tipc_withdraw(tsock->p->ref, 0, NULL);
320 goto exit; 320 goto exit;
@@ -335,8 +335,8 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
335 res = -EAFNOSUPPORT; 335 res = -EAFNOSUPPORT;
336 goto exit; 336 goto exit;
337 } 337 }
338 338
339 if (addr->scope > 0) 339 if (addr->scope > 0)
340 res = tipc_publish(tsock->p->ref, addr->scope, 340 res = tipc_publish(tsock->p->ref, addr->scope,
341 &addr->addr.nameseq); 341 &addr->addr.nameseq);
342 else 342 else
@@ -347,17 +347,17 @@ exit:
347 return res; 347 return res;
348} 348}
349 349
350/** 350/**
351 * get_name - get port ID of socket or peer socket 351 * get_name - get port ID of socket or peer socket
352 * @sock: socket structure 352 * @sock: socket structure
353 * @uaddr: area for returned socket address 353 * @uaddr: area for returned socket address
354 * @uaddr_len: area for returned length of socket address 354 * @uaddr_len: area for returned length of socket address
355 * @peer: 0 to obtain socket name, 1 to obtain peer socket name 355 * @peer: 0 to obtain socket name, 1 to obtain peer socket name
356 * 356 *
357 * Returns 0 on success, errno otherwise 357 * Returns 0 on success, errno otherwise
358 */ 358 */
359 359
360static int get_name(struct socket *sock, struct sockaddr *uaddr, 360static int get_name(struct socket *sock, struct sockaddr *uaddr,
361 int *uaddr_len, int peer) 361 int *uaddr_len, int peer)
362{ 362{
363 struct tipc_sock *tsock = tipc_sk(sock->sk); 363 struct tipc_sock *tsock = tipc_sk(sock->sk);
@@ -390,7 +390,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,
390 * Returns the pollmask 390 * Returns the pollmask
391 */ 391 */
392 392
393static unsigned int poll(struct file *file, struct socket *sock, 393static unsigned int poll(struct file *file, struct socket *sock,
394 poll_table *wait) 394 poll_table *wait)
395{ 395{
396 poll_wait(file, sock->sk->sk_sleep, wait); 396 poll_wait(file, sock->sk->sk_sleep, wait);
@@ -398,14 +398,14 @@ static unsigned int poll(struct file *file, struct socket *sock,
398 return pollmask(sock); 398 return pollmask(sock);
399} 399}
400 400
401/** 401/**
402 * dest_name_check - verify user is permitted to send to specified port name 402 * dest_name_check - verify user is permitted to send to specified port name
403 * @dest: destination address 403 * @dest: destination address
404 * @m: descriptor for message to be sent 404 * @m: descriptor for message to be sent
405 * 405 *
406 * Prevents restricted configuration commands from being issued by 406 * Prevents restricted configuration commands from being issued by
407 * unauthorized users. 407 * unauthorized users.
408 * 408 *
409 * Returns 0 if permission is granted, otherwise errno 409 * Returns 0 if permission is granted, otherwise errno
410 */ 410 */
411 411
@@ -413,19 +413,19 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
413{ 413{
414 struct tipc_cfg_msg_hdr hdr; 414 struct tipc_cfg_msg_hdr hdr;
415 415
416 if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES)) 416 if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES))
417 return 0; 417 return 0;
418 if (likely(dest->addr.name.name.type == TIPC_TOP_SRV)) 418 if (likely(dest->addr.name.name.type == TIPC_TOP_SRV))
419 return 0; 419 return 0;
420 420
421 if (likely(dest->addr.name.name.type != TIPC_CFG_SRV)) 421 if (likely(dest->addr.name.name.type != TIPC_CFG_SRV))
422 return -EACCES; 422 return -EACCES;
423 423
424 if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr))) 424 if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr)))
425 return -EFAULT; 425 return -EFAULT;
426 if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN))) 426 if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN)))
427 return -EACCES; 427 return -EACCES;
428 428
429 return 0; 429 return 0;
430} 430}
431 431
@@ -435,12 +435,12 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
435 * @sock: socket structure 435 * @sock: socket structure
436 * @m: message to send 436 * @m: message to send
437 * @total_len: length of message 437 * @total_len: length of message
438 * 438 *
439 * Message must have an destination specified explicitly. 439 * Message must have an destination specified explicitly.
440 * Used for SOCK_RDM and SOCK_DGRAM messages, 440 * Used for SOCK_RDM and SOCK_DGRAM messages,
441 * and for 'SYN' messages on SOCK_SEQPACKET and SOCK_STREAM connections. 441 * and for 'SYN' messages on SOCK_SEQPACKET and SOCK_STREAM connections.
442 * (Note: 'SYN+' is prohibited on SOCK_STREAM.) 442 * (Note: 'SYN+' is prohibited on SOCK_STREAM.)
443 * 443 *
444 * Returns the number of bytes sent on success, or errno otherwise 444 * Returns the number of bytes sent on success, or errno otherwise
445 */ 445 */
446 446
@@ -448,7 +448,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
448 struct msghdr *m, size_t total_len) 448 struct msghdr *m, size_t total_len)
449{ 449{
450 struct tipc_sock *tsock = tipc_sk(sock->sk); 450 struct tipc_sock *tsock = tipc_sk(sock->sk);
451 struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; 451 struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
452 struct sk_buff *buf; 452 struct sk_buff *buf;
453 int needs_conn; 453 int needs_conn;
454 int res = -EINVAL; 454 int res = -EINVAL;
@@ -489,61 +489,61 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
489 sock->state = SS_CONNECTING; 489 sock->state = SS_CONNECTING;
490 } 490 }
491 491
492 do { 492 do {
493 if (dest->addrtype == TIPC_ADDR_NAME) { 493 if (dest->addrtype == TIPC_ADDR_NAME) {
494 if ((res = dest_name_check(dest, m))) 494 if ((res = dest_name_check(dest, m)))
495 goto exit; 495 goto exit;
496 res = tipc_send2name(tsock->p->ref, 496 res = tipc_send2name(tsock->p->ref,
497 &dest->addr.name.name, 497 &dest->addr.name.name,
498 dest->addr.name.domain, 498 dest->addr.name.domain,
499 m->msg_iovlen, 499 m->msg_iovlen,
500 m->msg_iov); 500 m->msg_iov);
501 } 501 }
502 else if (dest->addrtype == TIPC_ADDR_ID) { 502 else if (dest->addrtype == TIPC_ADDR_ID) {
503 res = tipc_send2port(tsock->p->ref, 503 res = tipc_send2port(tsock->p->ref,
504 &dest->addr.id, 504 &dest->addr.id,
505 m->msg_iovlen, 505 m->msg_iovlen,
506 m->msg_iov); 506 m->msg_iov);
507 } 507 }
508 else if (dest->addrtype == TIPC_ADDR_MCAST) { 508 else if (dest->addrtype == TIPC_ADDR_MCAST) {
509 if (needs_conn) { 509 if (needs_conn) {
510 res = -EOPNOTSUPP; 510 res = -EOPNOTSUPP;
511 goto exit; 511 goto exit;
512 } 512 }
513 if ((res = dest_name_check(dest, m))) 513 if ((res = dest_name_check(dest, m)))
514 goto exit; 514 goto exit;
515 res = tipc_multicast(tsock->p->ref, 515 res = tipc_multicast(tsock->p->ref,
516 &dest->addr.nameseq, 516 &dest->addr.nameseq,
517 0, 517 0,
518 m->msg_iovlen, 518 m->msg_iovlen,
519 m->msg_iov); 519 m->msg_iov);
520 } 520 }
521 if (likely(res != -ELINKCONG)) { 521 if (likely(res != -ELINKCONG)) {
522exit: 522exit:
523 up(&tsock->sem); 523 up(&tsock->sem);
524 return res; 524 return res;
525 } 525 }
526 if (m->msg_flags & MSG_DONTWAIT) { 526 if (m->msg_flags & MSG_DONTWAIT) {
527 res = -EWOULDBLOCK; 527 res = -EWOULDBLOCK;
528 goto exit; 528 goto exit;
529 } 529 }
530 if (wait_event_interruptible(*sock->sk->sk_sleep, 530 if (wait_event_interruptible(*sock->sk->sk_sleep,
531 !tsock->p->congested)) { 531 !tsock->p->congested)) {
532 res = -ERESTARTSYS; 532 res = -ERESTARTSYS;
533 goto exit; 533 goto exit;
534 } 534 }
535 } while (1); 535 } while (1);
536} 536}
537 537
538/** 538/**
539 * send_packet - send a connection-oriented message 539 * send_packet - send a connection-oriented message
540 * @iocb: (unused) 540 * @iocb: (unused)
541 * @sock: socket structure 541 * @sock: socket structure
542 * @m: message to send 542 * @m: message to send
543 * @total_len: length of message 543 * @total_len: length of message
544 * 544 *
545 * Used for SOCK_SEQPACKET messages and SOCK_STREAM data. 545 * Used for SOCK_SEQPACKET messages and SOCK_STREAM data.
546 * 546 *
547 * Returns the number of bytes sent on success, or errno otherwise 547 * Returns the number of bytes sent on success, or errno otherwise
548 */ 548 */
549 549
@@ -551,7 +551,7 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
551 struct msghdr *m, size_t total_len) 551 struct msghdr *m, size_t total_len)
552{ 552{
553 struct tipc_sock *tsock = tipc_sk(sock->sk); 553 struct tipc_sock *tsock = tipc_sk(sock->sk);
554 struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; 554 struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
555 int res; 555 int res;
556 556
557 /* Handle implied connection establishment */ 557 /* Handle implied connection establishment */
@@ -561,45 +561,45 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
561 561
562 if (down_interruptible(&tsock->sem)) { 562 if (down_interruptible(&tsock->sem)) {
563 return -ERESTARTSYS; 563 return -ERESTARTSYS;
564 } 564 }
565 565
566 do { 566 do {
567 if (unlikely(sock->state != SS_CONNECTED)) { 567 if (unlikely(sock->state != SS_CONNECTED)) {
568 if (sock->state == SS_DISCONNECTING) 568 if (sock->state == SS_DISCONNECTING)
569 res = -EPIPE; 569 res = -EPIPE;
570 else 570 else
571 res = -ENOTCONN; 571 res = -ENOTCONN;
572 goto exit; 572 goto exit;
573 } 573 }
574 574
575 res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov); 575 res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov);
576 if (likely(res != -ELINKCONG)) { 576 if (likely(res != -ELINKCONG)) {
577exit: 577exit:
578 up(&tsock->sem); 578 up(&tsock->sem);
579 return res; 579 return res;
580 } 580 }
581 if (m->msg_flags & MSG_DONTWAIT) { 581 if (m->msg_flags & MSG_DONTWAIT) {
582 res = -EWOULDBLOCK; 582 res = -EWOULDBLOCK;
583 goto exit; 583 goto exit;
584 } 584 }
585 if (wait_event_interruptible(*sock->sk->sk_sleep, 585 if (wait_event_interruptible(*sock->sk->sk_sleep,
586 !tsock->p->congested)) { 586 !tsock->p->congested)) {
587 res = -ERESTARTSYS; 587 res = -ERESTARTSYS;
588 goto exit; 588 goto exit;
589 } 589 }
590 } while (1); 590 } while (1);
591} 591}
592 592
593/** 593/**
594 * send_stream - send stream-oriented data 594 * send_stream - send stream-oriented data
595 * @iocb: (unused) 595 * @iocb: (unused)
596 * @sock: socket structure 596 * @sock: socket structure
597 * @m: data to send 597 * @m: data to send
598 * @total_len: total length of data to be sent 598 * @total_len: total length of data to be sent
599 * 599 *
600 * Used for SOCK_STREAM data. 600 * Used for SOCK_STREAM data.
601 * 601 *
602 * Returns the number of bytes sent on success (or partial success), 602 * Returns the number of bytes sent on success (or partial success),
603 * or errno if no data sent 603 * or errno if no data sent
604 */ 604 */
605 605
@@ -616,26 +616,26 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
616 int bytes_to_send; 616 int bytes_to_send;
617 int bytes_sent; 617 int bytes_sent;
618 int res; 618 int res;
619 619
620 if (likely(total_len <= TIPC_MAX_USER_MSG_SIZE)) 620 if (likely(total_len <= TIPC_MAX_USER_MSG_SIZE))
621 return send_packet(iocb, sock, m, total_len); 621 return send_packet(iocb, sock, m, total_len);
622 622
623 /* Can only send large data streams if already connected */ 623 /* Can only send large data streams if already connected */
624 624
625 if (unlikely(sock->state != SS_CONNECTED)) { 625 if (unlikely(sock->state != SS_CONNECTED)) {
626 if (sock->state == SS_DISCONNECTING) 626 if (sock->state == SS_DISCONNECTING)
627 return -EPIPE; 627 return -EPIPE;
628 else 628 else
629 return -ENOTCONN; 629 return -ENOTCONN;
630 } 630 }
631 631
632 if (unlikely(m->msg_name)) 632 if (unlikely(m->msg_name))
633 return -EISCONN; 633 return -EISCONN;
634 634
635 /* 635 /*
636 * Send each iovec entry using one or more messages 636 * Send each iovec entry using one or more messages
637 * 637 *
638 * Note: This algorithm is good for the most likely case 638 * Note: This algorithm is good for the most likely case
639 * (i.e. one large iovec entry), but could be improved to pass sets 639 * (i.e. one large iovec entry), but could be improved to pass sets
640 * of small iovec entries into send_packet(). 640 * of small iovec entries into send_packet().
641 */ 641 */
@@ -657,7 +657,7 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
657 ? curr_left : TIPC_MAX_USER_MSG_SIZE; 657 ? curr_left : TIPC_MAX_USER_MSG_SIZE;
658 my_iov.iov_base = curr_start; 658 my_iov.iov_base = curr_start;
659 my_iov.iov_len = bytes_to_send; 659 my_iov.iov_len = bytes_to_send;
660 if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) { 660 if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) {
661 return bytes_sent ? bytes_sent : res; 661 return bytes_sent ? bytes_sent : res;
662 } 662 }
663 curr_left -= bytes_to_send; 663 curr_left -= bytes_to_send;
@@ -676,11 +676,11 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
676 * @sock: socket structure 676 * @sock: socket structure
677 * @tsock: TIPC-specific socket structure 677 * @tsock: TIPC-specific socket structure
678 * @msg: peer's response message 678 * @msg: peer's response message
679 * 679 *
680 * Returns 0 on success, errno otherwise 680 * Returns 0 on success, errno otherwise
681 */ 681 */
682 682
683static int auto_connect(struct socket *sock, struct tipc_sock *tsock, 683static int auto_connect(struct socket *sock, struct tipc_sock *tsock,
684 struct tipc_msg *msg) 684 struct tipc_msg *msg)
685{ 685{
686 struct tipc_portid peer; 686 struct tipc_portid peer;
@@ -702,15 +702,15 @@ static int auto_connect(struct socket *sock, struct tipc_sock *tsock,
702 * set_orig_addr - capture sender's address for received message 702 * set_orig_addr - capture sender's address for received message
703 * @m: descriptor for message info 703 * @m: descriptor for message info
704 * @msg: received message header 704 * @msg: received message header
705 * 705 *
706 * Note: Address is not captured if not requested by receiver. 706 * Note: Address is not captured if not requested by receiver.
707 */ 707 */
708 708
709static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) 709static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
710{ 710{
711 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name; 711 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name;
712 712
713 if (addr) { 713 if (addr) {
714 addr->family = AF_TIPC; 714 addr->family = AF_TIPC;
715 addr->addrtype = TIPC_ADDR_ID; 715 addr->addrtype = TIPC_ADDR_ID;
716 addr->addr.id.ref = msg_origport(msg); 716 addr->addr.id.ref = msg_origport(msg);
@@ -722,13 +722,13 @@ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
722} 722}
723 723
724/** 724/**
725 * anc_data_recv - optionally capture ancillary data for received message 725 * anc_data_recv - optionally capture ancillary data for received message
726 * @m: descriptor for message info 726 * @m: descriptor for message info
727 * @msg: received message header 727 * @msg: received message header
728 * @tport: TIPC port associated with message 728 * @tport: TIPC port associated with message
729 * 729 *
730 * Note: Ancillary data is not captured if not requested by receiver. 730 * Note: Ancillary data is not captured if not requested by receiver.
731 * 731 *
732 * Returns 0 if successful, otherwise errno 732 * Returns 0 if successful, otherwise errno
733 */ 733 */
734 734
@@ -753,7 +753,7 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
753 if ((res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data))) 753 if ((res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data)))
754 return res; 754 return res;
755 if (anc_data[1] && 755 if (anc_data[1] &&
756 (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], 756 (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1],
757 msg_data(msg)))) 757 msg_data(msg))))
758 return res; 758 return res;
759 } 759 }
@@ -790,13 +790,13 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
790 return 0; 790 return 0;
791} 791}
792 792
793/** 793/**
794 * recv_msg - receive packet-oriented message 794 * recv_msg - receive packet-oriented message
795 * @iocb: (unused) 795 * @iocb: (unused)
796 * @m: descriptor for message info 796 * @m: descriptor for message info
797 * @buf_len: total size of user buffer area 797 * @buf_len: total size of user buffer area
798 * @flags: receive flags 798 * @flags: receive flags
799 * 799 *
800 * Used for SOCK_DGRAM, SOCK_RDM, and SOCK_SEQPACKET messages. 800 * Used for SOCK_DGRAM, SOCK_RDM, and SOCK_SEQPACKET messages.
801 * If the complete message doesn't fit in user area, truncate it. 801 * If the complete message doesn't fit in user area, truncate it.
802 * 802 *
@@ -827,9 +827,9 @@ static int recv_msg(struct kiocb *iocb, struct socket *sock,
827 if (sock->type == SOCK_SEQPACKET) { 827 if (sock->type == SOCK_SEQPACKET) {
828 if (unlikely(sock->state == SS_UNCONNECTED)) 828 if (unlikely(sock->state == SS_UNCONNECTED))
829 return -ENOTCONN; 829 return -ENOTCONN;
830 if (unlikely((sock->state == SS_DISCONNECTING) && 830 if (unlikely((sock->state == SS_DISCONNECTING) &&
831 (skb_queue_len(&sock->sk->sk_receive_queue) == 0))) 831 (skb_queue_len(&sock->sk->sk_receive_queue) == 0)))
832 return -ENOTCONN; 832 return -ENOTCONN;
833 } 833 }
834 834
835 /* Look for a message in receive queue; wait if necessary */ 835 /* Look for a message in receive queue; wait if necessary */
@@ -845,7 +845,7 @@ restart:
845 } 845 }
846 846
847 if ((res = wait_event_interruptible( 847 if ((res = wait_event_interruptible(
848 *sock->sk->sk_sleep, 848 *sock->sk->sk_sleep,
849 ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || 849 ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) ||
850 (sock->state == SS_DISCONNECTING))) )) { 850 (sock->state == SS_DISCONNECTING))) )) {
851 goto exit; 851 goto exit;
@@ -890,7 +890,7 @@ restart:
890 goto exit; 890 goto exit;
891 891
892 /* Capture message data (if valid) & compute return value (always) */ 892 /* Capture message data (if valid) & compute return value (always) */
893 893
894 if (!err) { 894 if (!err) {
895 if (unlikely(buf_len < sz)) { 895 if (unlikely(buf_len < sz)) {
896 sz = buf_len; 896 sz = buf_len;
@@ -913,23 +913,23 @@ restart:
913 /* Consume received message (optional) */ 913 /* Consume received message (optional) */
914 914
915 if (likely(!(flags & MSG_PEEK))) { 915 if (likely(!(flags & MSG_PEEK))) {
916 if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) 916 if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
917 tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); 917 tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked);
918 advance_queue(tsock); 918 advance_queue(tsock);
919 } 919 }
920exit: 920exit:
921 up(&tsock->sem); 921 up(&tsock->sem);
922 return res; 922 return res;
923} 923}
924 924
925/** 925/**
926 * recv_stream - receive stream-oriented data 926 * recv_stream - receive stream-oriented data
927 * @iocb: (unused) 927 * @iocb: (unused)
928 * @m: descriptor for message info 928 * @m: descriptor for message info
929 * @buf_len: total size of user buffer area 929 * @buf_len: total size of user buffer area
930 * @flags: receive flags 930 * @flags: receive flags
931 * 931 *
932 * Used for SOCK_STREAM messages only. If not enough data is available 932 * Used for SOCK_STREAM messages only. If not enough data is available
933 * will optionally wait for more; never truncates data. 933 * will optionally wait for more; never truncates data.
934 * 934 *
935 * Returns size of returned message data, errno otherwise 935 * Returns size of returned message data, errno otherwise
@@ -980,7 +980,7 @@ restart:
980 } 980 }
981 981
982 if ((res = wait_event_interruptible( 982 if ((res = wait_event_interruptible(
983 *sock->sk->sk_sleep, 983 *sock->sk->sk_sleep,
984 ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || 984 ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) ||
985 (sock->state == SS_DISCONNECTING))) )) { 985 (sock->state == SS_DISCONNECTING))) )) {
986 goto exit; 986 goto exit;
@@ -1017,7 +1017,7 @@ restart:
1017 } 1017 }
1018 1018
1019 /* Capture message data (if valid) & compute return value (always) */ 1019 /* Capture message data (if valid) & compute return value (always) */
1020 1020
1021 if (!err) { 1021 if (!err) {
1022 buf_crs = (unsigned char *)(TIPC_SKB_CB(buf)->handle); 1022 buf_crs = (unsigned char *)(TIPC_SKB_CB(buf)->handle);
1023 sz = buf->tail - buf_crs; 1023 sz = buf->tail - buf_crs;
@@ -1050,14 +1050,14 @@ restart:
1050 /* Consume received message (optional) */ 1050 /* Consume received message (optional) */
1051 1051
1052 if (likely(!(flags & MSG_PEEK))) { 1052 if (likely(!(flags & MSG_PEEK))) {
1053 if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) 1053 if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
1054 tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); 1054 tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked);
1055 advance_queue(tsock); 1055 advance_queue(tsock);
1056 } 1056 }
1057 1057
1058 /* Loop around if more data is required */ 1058 /* Loop around if more data is required */
1059 1059
1060 if ((sz_copied < buf_len) /* didn't get all requested data */ 1060 if ((sz_copied < buf_len) /* didn't get all requested data */
1061 && (flags & MSG_WAITALL) /* ... and need to wait for more */ 1061 && (flags & MSG_WAITALL) /* ... and need to wait for more */
1062 && (!(flags & MSG_PEEK)) /* ... and aren't just peeking at data */ 1062 && (!(flags & MSG_PEEK)) /* ... and aren't just peeking at data */
1063 && (!err) /* ... and haven't reached a FIN */ 1063 && (!err) /* ... and haven't reached a FIN */
@@ -1074,7 +1074,7 @@ exit:
1074 * @queue_size: current size of queue 1074 * @queue_size: current size of queue
1075 * @base: nominal maximum size of queue 1075 * @base: nominal maximum size of queue
1076 * @msg: message to be added to queue 1076 * @msg: message to be added to queue
1077 * 1077 *
1078 * Returns 1 if queue is currently overloaded, 0 otherwise 1078 * Returns 1 if queue is currently overloaded, 0 otherwise
1079 */ 1079 */
1080 1080
@@ -1098,7 +1098,7 @@ static int queue_overloaded(u32 queue_size, u32 base, struct tipc_msg *msg)
1098 return (queue_size > threshold); 1098 return (queue_size > threshold);
1099} 1099}
1100 1100
1101/** 1101/**
1102 * async_disconnect - wrapper function used to disconnect port 1102 * async_disconnect - wrapper function used to disconnect port
1103 * @portref: TIPC port reference (passed as pointer-sized value) 1103 * @portref: TIPC port reference (passed as pointer-sized value)
1104 */ 1104 */
@@ -1108,13 +1108,13 @@ static void async_disconnect(unsigned long portref)
1108 tipc_disconnect((u32)portref); 1108 tipc_disconnect((u32)portref);
1109} 1109}
1110 1110
1111/** 1111/**
1112 * dispatch - handle arriving message 1112 * dispatch - handle arriving message
1113 * @tport: TIPC port that received message 1113 * @tport: TIPC port that received message
1114 * @buf: message 1114 * @buf: message
1115 * 1115 *
1116 * Called with port locked. Must not take socket lock to avoid deadlock risk. 1116 * Called with port locked. Must not take socket lock to avoid deadlock risk.
1117 * 1117 *
1118 * Returns TIPC error status code (TIPC_OK if message is not to be rejected) 1118 * Returns TIPC error status code (TIPC_OK if message is not to be rejected)
1119 */ 1119 */
1120 1120
@@ -1159,13 +1159,13 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1159 msg_dbg(msg, "dispatch filter 4\n"); 1159 msg_dbg(msg, "dispatch filter 4\n");
1160 return TIPC_ERR_NO_PORT; 1160 return TIPC_ERR_NO_PORT;
1161 } 1161 }
1162 } 1162 }
1163 else if (sock->state == SS_LISTENING) { 1163 else if (sock->state == SS_LISTENING) {
1164 if (msg_connected(msg) || msg_errcode(msg)) { 1164 if (msg_connected(msg) || msg_errcode(msg)) {
1165 msg_dbg(msg, "dispatch filter 5\n"); 1165 msg_dbg(msg, "dispatch filter 5\n");
1166 return TIPC_ERR_NO_PORT; 1166 return TIPC_ERR_NO_PORT;
1167 } 1167 }
1168 } 1168 }
1169 else if (sock->state == SS_DISCONNECTING) { 1169 else if (sock->state == SS_DISCONNECTING) {
1170 msg_dbg(msg, "dispatch filter 6\n"); 1170 msg_dbg(msg, "dispatch filter 6\n");
1171 return TIPC_ERR_NO_PORT; 1171 return TIPC_ERR_NO_PORT;
@@ -1180,18 +1180,18 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1180 1180
1181 /* Reject message if there isn't room to queue it */ 1181 /* Reject message if there isn't room to queue it */
1182 1182
1183 if (unlikely((u32)atomic_read(&tipc_queue_size) > 1183 if (unlikely((u32)atomic_read(&tipc_queue_size) >
1184 OVERLOAD_LIMIT_BASE)) { 1184 OVERLOAD_LIMIT_BASE)) {
1185 if (queue_overloaded(atomic_read(&tipc_queue_size), 1185 if (queue_overloaded(atomic_read(&tipc_queue_size),
1186 OVERLOAD_LIMIT_BASE, msg)) 1186 OVERLOAD_LIMIT_BASE, msg))
1187 return TIPC_ERR_OVERLOAD; 1187 return TIPC_ERR_OVERLOAD;
1188 } 1188 }
1189 recv_q_len = skb_queue_len(&tsock->sk.sk_receive_queue); 1189 recv_q_len = skb_queue_len(&tsock->sk.sk_receive_queue);
1190 if (unlikely(recv_q_len > (OVERLOAD_LIMIT_BASE / 2))) { 1190 if (unlikely(recv_q_len > (OVERLOAD_LIMIT_BASE / 2))) {
1191 if (queue_overloaded(recv_q_len, 1191 if (queue_overloaded(recv_q_len,
1192 OVERLOAD_LIMIT_BASE / 2, msg)) 1192 OVERLOAD_LIMIT_BASE / 2, msg))
1193 return TIPC_ERR_OVERLOAD; 1193 return TIPC_ERR_OVERLOAD;
1194 } 1194 }
1195 1195
1196 /* Initiate connection termination for an incoming 'FIN' */ 1196 /* Initiate connection termination for an incoming 'FIN' */
1197 1197
@@ -1213,10 +1213,10 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1213 return TIPC_OK; 1213 return TIPC_OK;
1214} 1214}
1215 1215
1216/** 1216/**
1217 * wakeupdispatch - wake up port after congestion 1217 * wakeupdispatch - wake up port after congestion
1218 * @tport: port to wakeup 1218 * @tport: port to wakeup
1219 * 1219 *
1220 * Called with port lock on. 1220 * Called with port lock on.
1221 */ 1221 */
1222 1222
@@ -1238,7 +1238,7 @@ static void wakeupdispatch(struct tipc_port *tport)
1238 * Returns 0 on success, errno otherwise 1238 * Returns 0 on success, errno otherwise
1239 */ 1239 */
1240 1240
1241static int connect(struct socket *sock, struct sockaddr *dest, int destlen, 1241static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1242 int flags) 1242 int flags)
1243{ 1243{
1244 struct tipc_sock *tsock = tipc_sk(sock->sk); 1244 struct tipc_sock *tsock = tipc_sk(sock->sk);
@@ -1260,7 +1260,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1260 if (sock->state == SS_CONNECTING) 1260 if (sock->state == SS_CONNECTING)
1261 return -EALREADY; 1261 return -EALREADY;
1262 if (sock->state != SS_UNCONNECTED) 1262 if (sock->state != SS_UNCONNECTED)
1263 return -EISCONN; 1263 return -EISCONN;
1264 1264
1265 /* 1265 /*
1266 * Reject connection attempt using multicast address 1266 * Reject connection attempt using multicast address
@@ -1270,7 +1270,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1270 */ 1270 */
1271 1271
1272 if (dst->addrtype == TIPC_ADDR_MCAST) 1272 if (dst->addrtype == TIPC_ADDR_MCAST)
1273 return -EINVAL; 1273 return -EINVAL;
1274 1274
1275 /* Send a 'SYN-' to destination */ 1275 /* Send a 'SYN-' to destination */
1276 1276
@@ -1281,19 +1281,19 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1281 return res; 1281 return res;
1282 } 1282 }
1283 1283
1284 if (down_interruptible(&tsock->sem)) 1284 if (down_interruptible(&tsock->sem))
1285 return -ERESTARTSYS; 1285 return -ERESTARTSYS;
1286 1286
1287 /* Wait for destination's 'ACK' response */ 1287 /* Wait for destination's 'ACK' response */
1288 1288
1289 res = wait_event_interruptible_timeout(*sock->sk->sk_sleep, 1289 res = wait_event_interruptible_timeout(*sock->sk->sk_sleep,
1290 skb_queue_len(&sock->sk->sk_receive_queue), 1290 skb_queue_len(&sock->sk->sk_receive_queue),
1291 sock->sk->sk_rcvtimeo); 1291 sock->sk->sk_rcvtimeo);
1292 buf = skb_peek(&sock->sk->sk_receive_queue); 1292 buf = skb_peek(&sock->sk->sk_receive_queue);
1293 if (res > 0) { 1293 if (res > 0) {
1294 msg = buf_msg(buf); 1294 msg = buf_msg(buf);
1295 res = auto_connect(sock, tsock, msg); 1295 res = auto_connect(sock, tsock, msg);
1296 if (!res) { 1296 if (!res) {
1297 if (!msg_data_sz(msg)) 1297 if (!msg_data_sz(msg))
1298 advance_queue(tsock); 1298 advance_queue(tsock);
1299 } 1299 }
@@ -1301,7 +1301,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1301 if (res == 0) { 1301 if (res == 0) {
1302 res = -ETIMEDOUT; 1302 res = -ETIMEDOUT;
1303 } else 1303 } else
1304 { /* leave "res" unchanged */ } 1304 { /* leave "res" unchanged */ }
1305 sock->state = SS_DISCONNECTING; 1305 sock->state = SS_DISCONNECTING;
1306 } 1306 }
1307 1307
@@ -1309,11 +1309,11 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1309 return res; 1309 return res;
1310} 1310}
1311 1311
1312/** 1312/**
1313 * listen - allow socket to listen for incoming connections 1313 * listen - allow socket to listen for incoming connections
1314 * @sock: socket structure 1314 * @sock: socket structure
1315 * @len: (unused) 1315 * @len: (unused)
1316 * 1316 *
1317 * Returns 0 on success, errno otherwise 1317 * Returns 0 on success, errno otherwise
1318 */ 1318 */
1319 1319
@@ -1326,15 +1326,15 @@ static int listen(struct socket *sock, int len)
1326 if (sock->state != SS_UNCONNECTED) 1326 if (sock->state != SS_UNCONNECTED)
1327 return -EINVAL; 1327 return -EINVAL;
1328 sock->state = SS_LISTENING; 1328 sock->state = SS_LISTENING;
1329 return 0; 1329 return 0;
1330} 1330}
1331 1331
1332/** 1332/**
1333 * accept - wait for connection request 1333 * accept - wait for connection request
1334 * @sock: listening socket 1334 * @sock: listening socket
1335 * @newsock: new socket that is to be connected 1335 * @newsock: new socket that is to be connected
1336 * @flags: file-related flags associated with socket 1336 * @flags: file-related flags associated with socket
1337 * 1337 *
1338 * Returns 0 on success, errno otherwise 1338 * Returns 0 on success, errno otherwise
1339 */ 1339 */
1340 1340
@@ -1348,15 +1348,15 @@ static int accept(struct socket *sock, struct socket *newsock, int flags)
1348 return -EOPNOTSUPP; 1348 return -EOPNOTSUPP;
1349 if (sock->state != SS_LISTENING) 1349 if (sock->state != SS_LISTENING)
1350 return -EINVAL; 1350 return -EINVAL;
1351 1351
1352 if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && 1352 if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) &&
1353 (flags & O_NONBLOCK))) 1353 (flags & O_NONBLOCK)))
1354 return -EWOULDBLOCK; 1354 return -EWOULDBLOCK;
1355 1355
1356 if (down_interruptible(&tsock->sem)) 1356 if (down_interruptible(&tsock->sem))
1357 return -ERESTARTSYS; 1357 return -ERESTARTSYS;
1358 1358
1359 if (wait_event_interruptible(*sock->sk->sk_sleep, 1359 if (wait_event_interruptible(*sock->sk->sk_sleep,
1360 skb_queue_len(&sock->sk->sk_receive_queue))) { 1360 skb_queue_len(&sock->sk->sk_receive_queue))) {
1361 res = -ERESTARTSYS; 1361 res = -ERESTARTSYS;
1362 goto exit; 1362 goto exit;
@@ -1381,18 +1381,18 @@ static int accept(struct socket *sock, struct socket *newsock, int flags)
1381 new_tsock->p->conn_instance = msg_nameinst(msg); 1381 new_tsock->p->conn_instance = msg_nameinst(msg);
1382 } 1382 }
1383 1383
1384 /* 1384 /*
1385 * Respond to 'SYN-' by discarding it & returning 'ACK'-. 1385 * Respond to 'SYN-' by discarding it & returning 'ACK'-.
1386 * Respond to 'SYN+' by queuing it on new socket. 1386 * Respond to 'SYN+' by queuing it on new socket.
1387 */ 1387 */
1388 1388
1389 msg_dbg(msg,"<ACC<: "); 1389 msg_dbg(msg,"<ACC<: ");
1390 if (!msg_data_sz(msg)) { 1390 if (!msg_data_sz(msg)) {
1391 struct msghdr m = {NULL,}; 1391 struct msghdr m = {NULL,};
1392 1392
1393 send_packet(NULL, newsock, &m, 0); 1393 send_packet(NULL, newsock, &m, 0);
1394 advance_queue(tsock); 1394 advance_queue(tsock);
1395 } else { 1395 } else {
1396 sock_lock(tsock); 1396 sock_lock(tsock);
1397 skb_dequeue(&sock->sk->sk_receive_queue); 1397 skb_dequeue(&sock->sk->sk_receive_queue);
1398 sock_unlock(tsock); 1398 sock_unlock(tsock);
@@ -1410,7 +1410,7 @@ exit:
1410 * @how: direction to close (unused; always treated as read + write) 1410 * @how: direction to close (unused; always treated as read + write)
1411 * 1411 *
1412 * Terminates connection (if necessary), then purges socket's receive queue. 1412 * Terminates connection (if necessary), then purges socket's receive queue.
1413 * 1413 *
1414 * Returns 0 on success, errno otherwise 1414 * Returns 0 on success, errno otherwise
1415 */ 1415 */
1416 1416
@@ -1483,32 +1483,32 @@ restart:
1483 * @opt: option identifier 1483 * @opt: option identifier
1484 * @ov: pointer to new option value 1484 * @ov: pointer to new option value
1485 * @ol: length of option value 1485 * @ol: length of option value
1486 * 1486 *
1487 * For stream sockets only, accepts and ignores all IPPROTO_TCP options 1487 * For stream sockets only, accepts and ignores all IPPROTO_TCP options
1488 * (to ease compatibility). 1488 * (to ease compatibility).
1489 * 1489 *
1490 * Returns 0 on success, errno otherwise 1490 * Returns 0 on success, errno otherwise
1491 */ 1491 */
1492 1492
1493static int setsockopt(struct socket *sock, 1493static int setsockopt(struct socket *sock,
1494 int lvl, int opt, char __user *ov, int ol) 1494 int lvl, int opt, char __user *ov, int ol)
1495{ 1495{
1496 struct tipc_sock *tsock = tipc_sk(sock->sk); 1496 struct tipc_sock *tsock = tipc_sk(sock->sk);
1497 u32 value; 1497 u32 value;
1498 int res; 1498 int res;
1499 1499
1500 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) 1500 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))
1501 return 0; 1501 return 0;
1502 if (lvl != SOL_TIPC) 1502 if (lvl != SOL_TIPC)
1503 return -ENOPROTOOPT; 1503 return -ENOPROTOOPT;
1504 if (ol < sizeof(value)) 1504 if (ol < sizeof(value))
1505 return -EINVAL; 1505 return -EINVAL;
1506 if ((res = get_user(value, (u32 __user *)ov))) 1506 if ((res = get_user(value, (u32 __user *)ov)))
1507 return res; 1507 return res;
1508 1508
1509 if (down_interruptible(&tsock->sem)) 1509 if (down_interruptible(&tsock->sem))
1510 return -ERESTARTSYS; 1510 return -ERESTARTSYS;
1511 1511
1512 switch (opt) { 1512 switch (opt) {
1513 case TIPC_IMPORTANCE: 1513 case TIPC_IMPORTANCE:
1514 res = tipc_set_portimportance(tsock->p->ref, value); 1514 res = tipc_set_portimportance(tsock->p->ref, value);
@@ -1516,7 +1516,7 @@ static int setsockopt(struct socket *sock,
1516 case TIPC_SRC_DROPPABLE: 1516 case TIPC_SRC_DROPPABLE:
1517 if (sock->type != SOCK_STREAM) 1517 if (sock->type != SOCK_STREAM)
1518 res = tipc_set_portunreliable(tsock->p->ref, value); 1518 res = tipc_set_portunreliable(tsock->p->ref, value);
1519 else 1519 else
1520 res = -ENOPROTOOPT; 1520 res = -ENOPROTOOPT;
1521 break; 1521 break;
1522 case TIPC_DEST_DROPPABLE: 1522 case TIPC_DEST_DROPPABLE:
@@ -1540,29 +1540,29 @@ static int setsockopt(struct socket *sock,
1540 * @opt: option identifier 1540 * @opt: option identifier
1541 * @ov: receptacle for option value 1541 * @ov: receptacle for option value
1542 * @ol: receptacle for length of option value 1542 * @ol: receptacle for length of option value
1543 * 1543 *
1544 * For stream sockets only, returns 0 length result for all IPPROTO_TCP options 1544 * For stream sockets only, returns 0 length result for all IPPROTO_TCP options
1545 * (to ease compatibility). 1545 * (to ease compatibility).
1546 * 1546 *
1547 * Returns 0 on success, errno otherwise 1547 * Returns 0 on success, errno otherwise
1548 */ 1548 */
1549 1549
1550static int getsockopt(struct socket *sock, 1550static int getsockopt(struct socket *sock,
1551 int lvl, int opt, char __user *ov, int __user *ol) 1551 int lvl, int opt, char __user *ov, int __user *ol)
1552{ 1552{
1553 struct tipc_sock *tsock = tipc_sk(sock->sk); 1553 struct tipc_sock *tsock = tipc_sk(sock->sk);
1554 int len; 1554 int len;
1555 u32 value; 1555 u32 value;
1556 int res; 1556 int res;
1557 1557
1558 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) 1558 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))
1559 return put_user(0, ol); 1559 return put_user(0, ol);
1560 if (lvl != SOL_TIPC) 1560 if (lvl != SOL_TIPC)
1561 return -ENOPROTOOPT; 1561 return -ENOPROTOOPT;
1562 if ((res = get_user(len, ol))) 1562 if ((res = get_user(len, ol)))
1563 return res; 1563 return res;
1564 1564
1565 if (down_interruptible(&tsock->sem)) 1565 if (down_interruptible(&tsock->sem))
1566 return -ERESTARTSYS; 1566 return -ERESTARTSYS;
1567 1567
1568 switch (opt) { 1568 switch (opt) {
@@ -1595,30 +1595,30 @@ static int getsockopt(struct socket *sock,
1595 res = put_user(sizeof(value), ol); 1595 res = put_user(sizeof(value), ol);
1596 } 1596 }
1597 1597
1598 up(&tsock->sem); 1598 up(&tsock->sem);
1599 return res; 1599 return res;
1600} 1600}
1601 1601
1602/** 1602/**
1603 * Placeholders for non-implemented functionality 1603 * Placeholders for non-implemented functionality
1604 * 1604 *
1605 * Returns error code (POSIX-compliant where defined) 1605 * Returns error code (POSIX-compliant where defined)
1606 */ 1606 */
1607 1607
1608static int ioctl(struct socket *s, u32 cmd, unsigned long arg) 1608static int ioctl(struct socket *s, u32 cmd, unsigned long arg)
1609{ 1609{
1610 return -EINVAL; 1610 return -EINVAL;
1611} 1611}
1612 1612
1613static int no_mmap(struct file *file, struct socket *sock, 1613static int no_mmap(struct file *file, struct socket *sock,
1614 struct vm_area_struct *vma) 1614 struct vm_area_struct *vma)
1615{ 1615{
1616 return -EINVAL; 1616 return -EINVAL;
1617} 1617}
1618static ssize_t no_sendpage(struct socket *sock, struct page *page, 1618static ssize_t no_sendpage(struct socket *sock, struct page *page,
1619 int offset, size_t size, int flags) 1619 int offset, size_t size, int flags)
1620{ 1620{
1621 return -EINVAL; 1621 return -EINVAL;
1622} 1622}
1623 1623
1624static int no_skpair(struct socket *s1, struct socket *s2) 1624static int no_skpair(struct socket *s1, struct socket *s2)
@@ -1647,8 +1647,8 @@ static struct proto_ops msg_ops = {
1647 .getsockopt = getsockopt, 1647 .getsockopt = getsockopt,
1648 .sendmsg = send_msg, 1648 .sendmsg = send_msg,
1649 .recvmsg = recv_msg, 1649 .recvmsg = recv_msg,
1650 .mmap = no_mmap, 1650 .mmap = no_mmap,
1651 .sendpage = no_sendpage 1651 .sendpage = no_sendpage
1652}; 1652};
1653 1653
1654static struct proto_ops packet_ops = { 1654static struct proto_ops packet_ops = {
@@ -1668,8 +1668,8 @@ static struct proto_ops packet_ops = {
1668 .getsockopt = getsockopt, 1668 .getsockopt = getsockopt,
1669 .sendmsg = send_packet, 1669 .sendmsg = send_packet,
1670 .recvmsg = recv_msg, 1670 .recvmsg = recv_msg,
1671 .mmap = no_mmap, 1671 .mmap = no_mmap,
1672 .sendpage = no_sendpage 1672 .sendpage = no_sendpage
1673}; 1673};
1674 1674
1675static struct proto_ops stream_ops = { 1675static struct proto_ops stream_ops = {
@@ -1689,8 +1689,8 @@ static struct proto_ops stream_ops = {
1689 .getsockopt = getsockopt, 1689 .getsockopt = getsockopt,
1690 .sendmsg = send_stream, 1690 .sendmsg = send_stream,
1691 .recvmsg = recv_stream, 1691 .recvmsg = recv_stream,
1692 .mmap = no_mmap, 1692 .mmap = no_mmap,
1693 .sendpage = no_sendpage 1693 .sendpage = no_sendpage
1694}; 1694};
1695 1695
1696static struct net_proto_family tipc_family_ops = { 1696static struct net_proto_family tipc_family_ops = {
@@ -1707,14 +1707,14 @@ static struct proto tipc_proto = {
1707 1707
1708/** 1708/**
1709 * tipc_socket_init - initialize TIPC socket interface 1709 * tipc_socket_init - initialize TIPC socket interface
1710 * 1710 *
1711 * Returns 0 on success, errno otherwise 1711 * Returns 0 on success, errno otherwise
1712 */ 1712 */
1713int tipc_socket_init(void) 1713int tipc_socket_init(void)
1714{ 1714{
1715 int res; 1715 int res;
1716 1716
1717 res = proto_register(&tipc_proto, 1); 1717 res = proto_register(&tipc_proto, 1);
1718 if (res) { 1718 if (res) {
1719 err("Failed to register TIPC protocol type\n"); 1719 err("Failed to register TIPC protocol type\n");
1720 goto out; 1720 goto out;
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index ddade7388aa0..8c01ccd3626c 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/subscr.c: TIPC subscription service 2 * net/tipc/subscr.c: TIPC subscription service
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -49,10 +49,10 @@
49 * @port_ref: object reference to port used to communicate with subscriber 49 * @port_ref: object reference to port used to communicate with subscriber
50 * @swap: indicates if subscriber uses opposite endianness in its messages 50 * @swap: indicates if subscriber uses opposite endianness in its messages
51 */ 51 */
52 52
53struct subscriber { 53struct subscriber {
54 u32 ref; 54 u32 ref;
55 spinlock_t *lock; 55 spinlock_t *lock;
56 struct list_head subscriber_list; 56 struct list_head subscriber_list;
57 struct list_head subscription_list; 57 struct list_head subscription_list;
58 u32 port_ref; 58 u32 port_ref;
@@ -82,7 +82,7 @@ static struct top_srv topsrv = { 0 };
82 * htohl - convert value to endianness used by destination 82 * htohl - convert value to endianness used by destination
83 * @in: value to convert 83 * @in: value to convert
84 * @swap: non-zero if endianness must be reversed 84 * @swap: non-zero if endianness must be reversed
85 * 85 *
86 * Returns converted value 86 * Returns converted value
87 */ 87 */
88 88
@@ -97,11 +97,11 @@ static u32 htohl(u32 in, int swap)
97 * subscr_send_event - send a message containing a tipc_event to the subscriber 97 * subscr_send_event - send a message containing a tipc_event to the subscriber
98 */ 98 */
99 99
100static void subscr_send_event(struct subscription *sub, 100static void subscr_send_event(struct subscription *sub,
101 u32 found_lower, 101 u32 found_lower,
102 u32 found_upper, 102 u32 found_upper,
103 u32 event, 103 u32 event,
104 u32 port_ref, 104 u32 port_ref,
105 u32 node) 105 u32 node)
106{ 106{
107 struct iovec msg_sect; 107 struct iovec msg_sect;
@@ -123,8 +123,8 @@ static void subscr_send_event(struct subscription *sub,
123 * Returns 1 if there is overlap, otherwise 0. 123 * Returns 1 if there is overlap, otherwise 0.
124 */ 124 */
125 125
126int tipc_subscr_overlap(struct subscription *sub, 126int tipc_subscr_overlap(struct subscription *sub,
127 u32 found_lower, 127 u32 found_lower,
128 u32 found_upper) 128 u32 found_upper)
129 129
130{ 130{
@@ -139,15 +139,15 @@ int tipc_subscr_overlap(struct subscription *sub,
139 139
140/** 140/**
141 * tipc_subscr_report_overlap - issue event if there is subscription overlap 141 * tipc_subscr_report_overlap - issue event if there is subscription overlap
142 * 142 *
143 * Protected by nameseq.lock in name_table.c 143 * Protected by nameseq.lock in name_table.c
144 */ 144 */
145 145
146void tipc_subscr_report_overlap(struct subscription *sub, 146void tipc_subscr_report_overlap(struct subscription *sub,
147 u32 found_lower, 147 u32 found_lower,
148 u32 found_upper, 148 u32 found_upper,
149 u32 event, 149 u32 event,
150 u32 port_ref, 150 u32 port_ref,
151 u32 node, 151 u32 node,
152 int must) 152 int must)
153{ 153{
@@ -189,11 +189,11 @@ static void subscr_timeout(struct subscription *sub)
189 189
190 /* Notify subscriber of timeout, then unlink subscription */ 190 /* Notify subscriber of timeout, then unlink subscription */
191 191
192 subscr_send_event(sub, 192 subscr_send_event(sub,
193 sub->evt.s.seq.lower, 193 sub->evt.s.seq.lower,
194 sub->evt.s.seq.upper, 194 sub->evt.s.seq.upper,
195 TIPC_SUBSCR_TIMEOUT, 195 TIPC_SUBSCR_TIMEOUT,
196 0, 196 0,
197 0); 197 0);
198 list_del(&sub->subscription_list); 198 list_del(&sub->subscription_list);
199 199
@@ -221,11 +221,11 @@ static void subscr_del(struct subscription *sub)
221 221
222/** 222/**
223 * subscr_terminate - terminate communication with a subscriber 223 * subscr_terminate - terminate communication with a subscriber
224 * 224 *
225 * Called with subscriber locked. Routine must temporarily release this lock 225 * Called with subscriber locked. Routine must temporarily release this lock
226 * to enable subscription timeout routine(s) to finish without deadlocking; 226 * to enable subscription timeout routine(s) to finish without deadlocking;
227 * the lock is then reclaimed to allow caller to release it upon return. 227 * the lock is then reclaimed to allow caller to release it upon return.
228 * (This should work even in the unlikely event some other thread creates 228 * (This should work even in the unlikely event some other thread creates
229 * a new object reference in the interim that uses this lock; this routine will 229 * a new object reference in the interim that uses this lock; this routine will
230 * simply wait for it to be released, then claim it.) 230 * simply wait for it to be released, then claim it.)
231 */ 231 */
@@ -241,7 +241,7 @@ static void subscr_terminate(struct subscriber *subscriber)
241 spin_unlock_bh(subscriber->lock); 241 spin_unlock_bh(subscriber->lock);
242 242
243 /* Destroy any existing subscriptions for subscriber */ 243 /* Destroy any existing subscriptions for subscriber */
244 244
245 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, 245 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
246 subscription_list) { 246 subscription_list) {
247 if (sub->timeout != TIPC_WAIT_FOREVER) { 247 if (sub->timeout != TIPC_WAIT_FOREVER) {
@@ -315,7 +315,7 @@ static void subscr_cancel(struct tipc_subscr *s,
315 315
316/** 316/**
317 * subscr_subscribe - create subscription for subscriber 317 * subscr_subscribe - create subscription for subscriber
318 * 318 *
319 * Called with subscriber locked 319 * Called with subscriber locked
320 */ 320 */
321 321
@@ -431,7 +431,7 @@ static void subscr_conn_msg_event(void *usr_handle,
431 subscr_terminate(subscriber); 431 subscr_terminate(subscriber);
432 else 432 else
433 subscr_subscribe((struct tipc_subscr *)data, subscriber); 433 subscr_subscribe((struct tipc_subscr *)data, subscriber);
434 434
435 spin_unlock_bh(subscriber_lock); 435 spin_unlock_bh(subscriber_lock);
436} 436}
437 437
@@ -444,7 +444,7 @@ static void subscr_named_msg_event(void *usr_handle,
444 struct sk_buff **buf, 444 struct sk_buff **buf,
445 const unchar *data, 445 const unchar *data,
446 u32 size, 446 u32 size,
447 u32 importance, 447 u32 importance,
448 struct tipc_portid const *orig, 448 struct tipc_portid const *orig,
449 struct tipc_name_seq const *dest) 449 struct tipc_name_seq const *dest)
450{ 450{
@@ -534,22 +534,22 @@ int tipc_subscr_start(void)
534 return res; 534 return res;
535 } 535 }
536 536
537 res = tipc_createport(topsrv.user_ref, 537 res = tipc_createport(topsrv.user_ref,
538 NULL, 538 NULL,
539 TIPC_CRITICAL_IMPORTANCE, 539 TIPC_CRITICAL_IMPORTANCE,
540 NULL, 540 NULL,
541 NULL, 541 NULL,
542 NULL, 542 NULL,
543 NULL, 543 NULL,
544 subscr_named_msg_event, 544 subscr_named_msg_event,
545 NULL, 545 NULL,
546 NULL, 546 NULL,
547 &topsrv.setup_port); 547 &topsrv.setup_port);
548 if (res) 548 if (res)
549 goto failed; 549 goto failed;
550 550
551 res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); 551 res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq);
552 if (res) 552 if (res)
553 goto failed; 553 goto failed;
554 554
555 spin_unlock_bh(&topsrv.lock); 555 spin_unlock_bh(&topsrv.lock);
@@ -571,7 +571,7 @@ void tipc_subscr_stop(void)
571 571
572 if (topsrv.user_ref) { 572 if (topsrv.user_ref) {
573 tipc_deleteport(topsrv.setup_port); 573 tipc_deleteport(topsrv.setup_port);
574 list_for_each_entry_safe(subscriber, subscriber_temp, 574 list_for_each_entry_safe(subscriber, subscriber_temp,
575 &topsrv.subscriber_list, 575 &topsrv.subscriber_list,
576 subscriber_list) { 576 subscriber_list) {
577 tipc_ref_lock(subscriber->ref); 577 tipc_ref_lock(subscriber->ref);
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
index 1e5090465d2e..93a8e674fac1 100644
--- a/net/tipc/subscr.h
+++ b/net/tipc/subscr.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/subscr.h: Include file for TIPC subscription service 2 * net/tipc/subscr.h: Include file for TIPC subscription service
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -48,7 +48,7 @@
48 * @timer_ref: reference to timer governing subscription duration (may be NULL) 48 * @timer_ref: reference to timer governing subscription duration (may be NULL)
49 * @owner: pointer to subscriber object associated with this subscription 49 * @owner: pointer to subscriber object associated with this subscription
50 */ 50 */
51 51
52struct subscription { 52struct subscription {
53 struct tipc_name_seq seq; 53 struct tipc_name_seq seq;
54 u32 timeout; 54 u32 timeout;
@@ -60,15 +60,15 @@ struct subscription {
60 struct subscriber *owner; 60 struct subscriber *owner;
61}; 61};
62 62
63int tipc_subscr_overlap(struct subscription * sub, 63int tipc_subscr_overlap(struct subscription * sub,
64 u32 found_lower, 64 u32 found_lower,
65 u32 found_upper); 65 u32 found_upper);
66 66
67void tipc_subscr_report_overlap(struct subscription * sub, 67void tipc_subscr_report_overlap(struct subscription * sub,
68 u32 found_lower, 68 u32 found_lower,
69 u32 found_upper, 69 u32 found_upper,
70 u32 event, 70 u32 event,
71 u32 port_ref, 71 u32 port_ref,
72 u32 node, 72 u32 node,
73 int must_report); 73 int must_report);
74 74
diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c
index 04d1b9be9c51..4146c40cd20b 100644
--- a/net/tipc/user_reg.c
+++ b/net/tipc/user_reg.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/user_reg.c: TIPC user registry code 2 * net/tipc/user_reg.c: TIPC user registry code
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -40,7 +40,7 @@
40/* 40/*
41 * TIPC user registry keeps track of users of the tipc_port interface. 41 * TIPC user registry keeps track of users of the tipc_port interface.
42 * 42 *
43 * The registry utilizes an array of "TIPC user" entries; 43 * The registry utilizes an array of "TIPC user" entries;
44 * a user's ID is the index of their associated array entry. 44 * a user's ID is the index of their associated array entry.
45 * Array entry 0 is not used, so userid 0 is not valid; 45 * Array entry 0 is not used, so userid 0 is not valid;
46 * TIPC sometimes uses this value to denote an anonymous user. 46 * TIPC sometimes uses this value to denote an anonymous user.
@@ -51,7 +51,7 @@
51 * struct tipc_user - registered TIPC user info 51 * struct tipc_user - registered TIPC user info
52 * @next: index of next free registry entry (or -1 for an allocated entry) 52 * @next: index of next free registry entry (or -1 for an allocated entry)
53 * @callback: ptr to routine to call when TIPC mode changes (NULL if none) 53 * @callback: ptr to routine to call when TIPC mode changes (NULL if none)
54 * @usr_handle: user-defined value passed to callback routine 54 * @usr_handle: user-defined value passed to callback routine
55 * @ports: list of user ports owned by the user 55 * @ports: list of user ports owned by the user
56 */ 56 */
57 57
@@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(reg_lock);
71 71
72/** 72/**
73 * reg_init - create TIPC user registry (but don't activate it) 73 * reg_init - create TIPC user registry (but don't activate it)
74 * 74 *
75 * If registry has been pre-initialized it is left "as is". 75 * If registry has been pre-initialized it is left "as is".
76 * NOTE: This routine may be called when TIPC is inactive. 76 * NOTE: This routine may be called when TIPC is inactive.
77 */ 77 */
@@ -79,7 +79,7 @@ static DEFINE_SPINLOCK(reg_lock);
79static int reg_init(void) 79static int reg_init(void)
80{ 80{
81 u32 i; 81 u32 i;
82 82
83 spin_lock_bh(&reg_lock); 83 spin_lock_bh(&reg_lock);
84 if (!users) { 84 if (!users) {
85 users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC); 85 users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC);
@@ -137,7 +137,7 @@ int tipc_reg_start(void)
137 */ 137 */
138 138
139void tipc_reg_stop(void) 139void tipc_reg_stop(void)
140{ 140{
141 int id; 141 int id;
142 142
143 if (!users) 143 if (!users)
@@ -174,14 +174,14 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle)
174 user_ptr = &users[next_free_user]; 174 user_ptr = &users[next_free_user];
175 *userid = next_free_user; 175 *userid = next_free_user;
176 next_free_user = user_ptr->next; 176 next_free_user = user_ptr->next;
177 user_ptr->next = -1; 177 user_ptr->next = -1;
178 spin_unlock_bh(&reg_lock); 178 spin_unlock_bh(&reg_lock);
179 179
180 user_ptr->callback = cb; 180 user_ptr->callback = cb;
181 user_ptr->usr_handle = usr_handle; 181 user_ptr->usr_handle = usr_handle;
182 INIT_LIST_HEAD(&user_ptr->ports); 182 INIT_LIST_HEAD(&user_ptr->ports);
183 atomic_inc(&tipc_user_count); 183 atomic_inc(&tipc_user_count);
184 184
185 if (cb && (tipc_mode != TIPC_NOT_RUNNING)) 185 if (cb && (tipc_mode != TIPC_NOT_RUNNING))
186 tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr); 186 tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr);
187 return TIPC_OK; 187 return TIPC_OK;
@@ -207,16 +207,16 @@ void tipc_detach(u32 userid)
207 } 207 }
208 208
209 user_ptr = &users[userid]; 209 user_ptr = &users[userid];
210 user_ptr->callback = NULL; 210 user_ptr->callback = NULL;
211 INIT_LIST_HEAD(&ports_temp); 211 INIT_LIST_HEAD(&ports_temp);
212 list_splice(&user_ptr->ports, &ports_temp); 212 list_splice(&user_ptr->ports, &ports_temp);
213 user_ptr->next = next_free_user; 213 user_ptr->next = next_free_user;
214 next_free_user = userid; 214 next_free_user = userid;
215 spin_unlock_bh(&reg_lock); 215 spin_unlock_bh(&reg_lock);
216 216
217 atomic_dec(&tipc_user_count); 217 atomic_dec(&tipc_user_count);
218 218
219 list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { 219 list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) {
220 tipc_deleteport(up_ptr->ref); 220 tipc_deleteport(up_ptr->ref);
221 } 221 }
222} 222}
diff --git a/net/tipc/user_reg.h b/net/tipc/user_reg.h
index d0e88794ed1b..81dc12e2882f 100644
--- a/net/tipc/user_reg.h
+++ b/net/tipc/user_reg.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/user_reg.h: Include file for TIPC user registry code 2 * net/tipc/user_reg.h: Include file for TIPC user registry code
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
diff --git a/net/tipc/zone.c b/net/tipc/zone.c
index f5b00ea2d5ac..114e173f11a5 100644
--- a/net/tipc/zone.c
+++ b/net/tipc/zone.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/zone.c: TIPC zone management routines 2 * net/tipc/zone.c: TIPC zone management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -92,7 +92,7 @@ void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router)
92 92
93 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { 93 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
94 if (z_ptr->clusters[c_num]) { 94 if (z_ptr->clusters[c_num]) {
95 tipc_cltr_remove_as_router(z_ptr->clusters[c_num], 95 tipc_cltr_remove_as_router(z_ptr->clusters[c_num],
96 router); 96 router);
97 } 97 }
98 } 98 }
diff --git a/net/tipc/zone.h b/net/tipc/zone.h
index 5ab3d08602e2..6e7a08df8af5 100644
--- a/net/tipc/zone.h
+++ b/net/tipc/zone.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/zone.h: Include file for TIPC zone management routines 2 * net/tipc/zone.h: Include file for TIPC zone management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -47,7 +47,7 @@
47 * @clusters: array of pointers to all clusters within zone 47 * @clusters: array of pointers to all clusters within zone
48 * @links: number of (unicast) links to zone 48 * @links: number of (unicast) links to zone
49 */ 49 */
50 50
51struct _zone { 51struct _zone {
52 u32 addr; 52 u32 addr;
53 struct cluster *clusters[2]; /* currently limited to just 1 cluster */ 53 struct cluster *clusters[2]; /* currently limited to just 1 cluster */