aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/tipc/Makefile2
-rw-r--r--net/tipc/addr.c3
-rw-r--r--net/tipc/addr.h3
-rw-r--r--net/tipc/bcast.c22
-rw-r--r--net/tipc/bcast.h3
-rw-r--r--net/tipc/bearer.c22
-rw-r--r--net/tipc/bearer.h4
-rw-r--r--net/tipc/config.c7
-rw-r--r--net/tipc/core.c7
-rw-r--r--net/tipc/core.h14
-rw-r--r--net/tipc/discover.c14
-rw-r--r--net/tipc/eth_media.c19
-rw-r--r--net/tipc/handler.c1
-rw-r--r--net/tipc/link.c120
-rw-r--r--net/tipc/link.h6
-rw-r--r--net/tipc/log.c14
-rw-r--r--net/tipc/log.h1
-rw-r--r--net/tipc/msg.c3
-rw-r--r--net/tipc/msg.h21
-rw-r--r--net/tipc/name_distr.c11
-rw-r--r--net/tipc/name_table.c50
-rw-r--r--net/tipc/name_table.h3
-rw-r--r--net/tipc/node.c13
-rw-r--r--net/tipc/node.h2
-rw-r--r--net/tipc/node_subscr.c3
-rw-r--r--net/tipc/node_subscr.h1
-rw-r--r--net/tipc/port.c33
-rw-r--r--net/tipc/port.h3
-rw-r--r--net/tipc/ref.c13
-rw-r--r--net/tipc/socket.c83
-rw-r--r--net/tipc/subscr.c43
-rw-r--r--net/tipc/subscr.h2
32 files changed, 16 insertions, 530 deletions
diff --git a/net/tipc/Makefile b/net/tipc/Makefile
index 521d24d04ab2..6cd55d671d3a 100644
--- a/net/tipc/Makefile
+++ b/net/tipc/Makefile
@@ -9,5 +9,3 @@ tipc-y += addr.o bcast.o bearer.o config.o \
9 name_distr.o subscr.o name_table.o net.o \ 9 name_distr.o subscr.o name_table.o net.o \
10 netlink.o node.o node_subscr.o port.o ref.o \ 10 netlink.o node.o node_subscr.o port.o ref.o \
11 socket.o log.o eth_media.o 11 socket.o log.o eth_media.o
12
13# End of file
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index a6fdab33877e..357b74b26f9e 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -45,7 +45,6 @@
45 * 45 *
46 * Returns 1 if domain address is valid, otherwise 0 46 * Returns 1 if domain address is valid, otherwise 0
47 */ 47 */
48
49int tipc_addr_domain_valid(u32 addr) 48int tipc_addr_domain_valid(u32 addr)
50{ 49{
51 u32 n = tipc_node(addr); 50 u32 n = tipc_node(addr);
@@ -66,7 +65,6 @@ int tipc_addr_domain_valid(u32 addr)
66 * 65 *
67 * Returns 1 if address can be used, otherwise 0 66 * Returns 1 if address can be used, otherwise 0
68 */ 67 */
69
70int tipc_addr_node_valid(u32 addr) 68int tipc_addr_node_valid(u32 addr)
71{ 69{
72 return tipc_addr_domain_valid(addr) && tipc_node(addr); 70 return tipc_addr_domain_valid(addr) && tipc_node(addr);
@@ -86,7 +84,6 @@ int tipc_in_scope(u32 domain, u32 addr)
86/** 84/**
87 * tipc_addr_scope - convert message lookup domain to a 2-bit scope value 85 * tipc_addr_scope - convert message lookup domain to a 2-bit scope value
88 */ 86 */
89
90int tipc_addr_scope(u32 domain) 87int tipc_addr_scope(u32 domain)
91{ 88{
92 if (likely(!domain)) 89 if (likely(!domain))
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index d706a1d92be8..60b00ab93d74 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -58,7 +58,6 @@ static inline int in_own_cluster_exact(u32 addr)
58/** 58/**
59 * in_own_node - test for node inclusion; <0.0.0> always matches 59 * in_own_node - test for node inclusion; <0.0.0> always matches
60 */ 60 */
61
62static inline int in_own_node(u32 addr) 61static inline int in_own_node(u32 addr)
63{ 62{
64 return (addr == tipc_own_addr) || !addr; 63 return (addr == tipc_own_addr) || !addr;
@@ -67,7 +66,6 @@ static inline int in_own_node(u32 addr)
67/** 66/**
68 * in_own_cluster - test for cluster inclusion; <0.0.0> always matches 67 * in_own_cluster - test for cluster inclusion; <0.0.0> always matches
69 */ 68 */
70
71static inline int in_own_cluster(u32 addr) 69static inline int in_own_cluster(u32 addr)
72{ 70{
73 return in_own_cluster_exact(addr) || !addr; 71 return in_own_cluster_exact(addr) || !addr;
@@ -79,7 +77,6 @@ static inline int in_own_cluster(u32 addr)
79 * Needed when address of a named message must be looked up a second time 77 * Needed when address of a named message must be looked up a second time
80 * after a network hop. 78 * after a network hop.
81 */ 79 */
82
83static inline u32 addr_domain(u32 sc) 80static inline u32 addr_domain(u32 sc)
84{ 81{
85 if (likely(sc == TIPC_NODE_SCOPE)) 82 if (likely(sc == TIPC_NODE_SCOPE))
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index e00441a2092f..2625f5ebe3e8 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -73,7 +73,6 @@ struct tipc_bcbearer_pair {
73 * large local variables within multicast routines. Concurrent access is 73 * large local variables within multicast routines. Concurrent access is
74 * prevented through use of the spinlock "bc_lock". 74 * prevented through use of the spinlock "bc_lock".
75 */ 75 */
76
77struct tipc_bcbearer { 76struct tipc_bcbearer {
78 struct tipc_bearer bearer; 77 struct tipc_bearer bearer;
79 struct tipc_media media; 78 struct tipc_media media;
@@ -92,7 +91,6 @@ struct tipc_bcbearer {
92 * 91 *
93 * Handles sequence numbering, fragmentation, bundling, etc. 92 * Handles sequence numbering, fragmentation, bundling, etc.
94 */ 93 */
95
96struct tipc_bclink { 94struct tipc_bclink {
97 struct tipc_link link; 95 struct tipc_link link;
98 struct tipc_node node; 96 struct tipc_node node;
@@ -169,7 +167,6 @@ static void bclink_update_last_sent(struct tipc_node *node, u32 seqno)
169 * 167 *
170 * Called with bc_lock locked 168 * Called with bc_lock locked
171 */ 169 */
172
173struct tipc_node *tipc_bclink_retransmit_to(void) 170struct tipc_node *tipc_bclink_retransmit_to(void)
174{ 171{
175 return bclink->retransmit_to; 172 return bclink->retransmit_to;
@@ -182,7 +179,6 @@ struct tipc_node *tipc_bclink_retransmit_to(void)
182 * 179 *
183 * Called with bc_lock locked 180 * Called with bc_lock locked
184 */ 181 */
185
186static void bclink_retransmit_pkt(u32 after, u32 to) 182static void bclink_retransmit_pkt(u32 after, u32 to)
187{ 183{
188 struct sk_buff *buf; 184 struct sk_buff *buf;
@@ -200,7 +196,6 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
200 * 196 *
201 * Node is locked, bc_lock unlocked. 197 * Node is locked, bc_lock unlocked.
202 */ 198 */
203
204void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked) 199void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
205{ 200{
206 struct sk_buff *crs; 201 struct sk_buff *crs;
@@ -280,7 +275,6 @@ exit:
280 * 275 *
281 * tipc_net_lock and node lock set 276 * tipc_net_lock and node lock set
282 */ 277 */
283
284void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent) 278void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent)
285{ 279{
286 struct sk_buff *buf; 280 struct sk_buff *buf;
@@ -344,7 +338,6 @@ void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent)
344 * 338 *
345 * Only tipc_net_lock set. 339 * Only tipc_net_lock set.
346 */ 340 */
347
348static void bclink_peek_nack(struct tipc_msg *msg) 341static void bclink_peek_nack(struct tipc_msg *msg)
349{ 342{
350 struct tipc_node *n_ptr = tipc_node_find(msg_destnode(msg)); 343 struct tipc_node *n_ptr = tipc_node_find(msg_destnode(msg));
@@ -365,7 +358,6 @@ static void bclink_peek_nack(struct tipc_msg *msg)
365/* 358/*
366 * tipc_bclink_send_msg - broadcast a packet to all nodes in cluster 359 * tipc_bclink_send_msg - broadcast a packet to all nodes in cluster
367 */ 360 */
368
369int tipc_bclink_send_msg(struct sk_buff *buf) 361int tipc_bclink_send_msg(struct sk_buff *buf)
370{ 362{
371 int res; 363 int res;
@@ -394,7 +386,6 @@ exit:
394 * 386 *
395 * Called with both sending node's lock and bc_lock taken. 387 * Called with both sending node's lock and bc_lock taken.
396 */ 388 */
397
398static void bclink_accept_pkt(struct tipc_node *node, u32 seqno) 389static void bclink_accept_pkt(struct tipc_node *node, u32 seqno)
399{ 390{
400 bclink_update_last_sent(node, seqno); 391 bclink_update_last_sent(node, seqno);
@@ -420,7 +411,6 @@ static void bclink_accept_pkt(struct tipc_node *node, u32 seqno)
420 * 411 *
421 * tipc_net_lock is read_locked, no other locks set 412 * tipc_net_lock is read_locked, no other locks set
422 */ 413 */
423
424void tipc_bclink_recv_pkt(struct sk_buff *buf) 414void tipc_bclink_recv_pkt(struct sk_buff *buf)
425{ 415{
426 struct tipc_msg *msg = buf_msg(buf); 416 struct tipc_msg *msg = buf_msg(buf);
@@ -588,7 +578,6 @@ u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr)
588 * Returns 0 (packet sent successfully) under all circumstances, 578 * Returns 0 (packet sent successfully) under all circumstances,
589 * since the broadcast link's pseudo-bearer never blocks 579 * since the broadcast link's pseudo-bearer never blocks
590 */ 580 */
591
592static int tipc_bcbearer_send(struct sk_buff *buf, 581static int tipc_bcbearer_send(struct sk_buff *buf,
593 struct tipc_bearer *unused1, 582 struct tipc_bearer *unused1,
594 struct tipc_media_addr *unused2) 583 struct tipc_media_addr *unused2)
@@ -601,7 +590,6 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
601 * preparation is skipped for broadcast link protocol messages 590 * preparation is skipped for broadcast link protocol messages
602 * since they are sent in an unreliable manner and don't need it 591 * since they are sent in an unreliable manner and don't need it
603 */ 592 */
604
605 if (likely(!msg_non_seq(buf_msg(buf)))) { 593 if (likely(!msg_non_seq(buf_msg(buf)))) {
606 struct tipc_msg *msg; 594 struct tipc_msg *msg;
607 595
@@ -618,7 +606,6 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
618 } 606 }
619 607
620 /* Send buffer over bearers until all targets reached */ 608 /* Send buffer over bearers until all targets reached */
621
622 bcbearer->remains = bclink->bcast_nodes; 609 bcbearer->remains = bclink->bcast_nodes;
623 610
624 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { 611 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
@@ -660,7 +647,6 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
660/** 647/**
661 * tipc_bcbearer_sort - create sets of bearer pairs used by broadcast bearer 648 * tipc_bcbearer_sort - create sets of bearer pairs used by broadcast bearer
662 */ 649 */
663
664void tipc_bcbearer_sort(void) 650void tipc_bcbearer_sort(void)
665{ 651{
666 struct tipc_bcbearer_pair *bp_temp = bcbearer->bpairs_temp; 652 struct tipc_bcbearer_pair *bp_temp = bcbearer->bpairs_temp;
@@ -671,7 +657,6 @@ void tipc_bcbearer_sort(void)
671 spin_lock_bh(&bc_lock); 657 spin_lock_bh(&bc_lock);
672 658
673 /* Group bearers by priority (can assume max of two per priority) */ 659 /* Group bearers by priority (can assume max of two per priority) */
674
675 memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); 660 memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp));
676 661
677 for (b_index = 0; b_index < MAX_BEARERS; b_index++) { 662 for (b_index = 0; b_index < MAX_BEARERS; b_index++) {
@@ -687,7 +672,6 @@ void tipc_bcbearer_sort(void)
687 } 672 }
688 673
689 /* Create array of bearer pairs for broadcasting */ 674 /* Create array of bearer pairs for broadcasting */
690
691 bp_curr = bcbearer->bpairs; 675 bp_curr = bcbearer->bpairs;
692 memset(bcbearer->bpairs, 0, sizeof(bcbearer->bpairs)); 676 memset(bcbearer->bpairs, 0, sizeof(bcbearer->bpairs));
693 677
@@ -817,7 +801,6 @@ void tipc_bclink_stop(void)
817/** 801/**
818 * tipc_nmap_add - add a node to a node map 802 * tipc_nmap_add - add a node to a node map
819 */ 803 */
820
821void tipc_nmap_add(struct tipc_node_map *nm_ptr, u32 node) 804void tipc_nmap_add(struct tipc_node_map *nm_ptr, u32 node)
822{ 805{
823 int n = tipc_node(node); 806 int n = tipc_node(node);
@@ -833,7 +816,6 @@ void tipc_nmap_add(struct tipc_node_map *nm_ptr, u32 node)
833/** 816/**
834 * tipc_nmap_remove - remove a node from a node map 817 * tipc_nmap_remove - remove a node from a node map
835 */ 818 */
836
837void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node) 819void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node)
838{ 820{
839 int n = tipc_node(node); 821 int n = tipc_node(node);
@@ -852,7 +834,6 @@ void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node)
852 * @nm_b: input node map B 834 * @nm_b: input node map B
853 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B) 835 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
854 */ 836 */
855
856static void tipc_nmap_diff(struct tipc_node_map *nm_a, 837static void tipc_nmap_diff(struct tipc_node_map *nm_a,
857 struct tipc_node_map *nm_b, 838 struct tipc_node_map *nm_b,
858 struct tipc_node_map *nm_diff) 839 struct tipc_node_map *nm_diff)
@@ -878,7 +859,6 @@ static void tipc_nmap_diff(struct tipc_node_map *nm_a,
878/** 859/**
879 * tipc_port_list_add - add a port to a port list, ensuring no duplicates 860 * tipc_port_list_add - add a port to a port list, ensuring no duplicates
880 */ 861 */
881
882void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port) 862void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port)
883{ 863{
884 struct tipc_port_list *item = pl_ptr; 864 struct tipc_port_list *item = pl_ptr;
@@ -912,7 +892,6 @@ void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port)
912 * tipc_port_list_free - free dynamically created entries in port_list chain 892 * tipc_port_list_free - free dynamically created entries in port_list chain
913 * 893 *
914 */ 894 */
915
916void tipc_port_list_free(struct tipc_port_list *pl_ptr) 895void tipc_port_list_free(struct tipc_port_list *pl_ptr)
917{ 896{
918 struct tipc_port_list *item; 897 struct tipc_port_list *item;
@@ -923,4 +902,3 @@ void tipc_port_list_free(struct tipc_port_list *pl_ptr)
923 kfree(item); 902 kfree(item);
924 } 903 }
925} 904}
926
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
index 5571394098f9..a93306557e00 100644
--- a/net/tipc/bcast.h
+++ b/net/tipc/bcast.h
@@ -45,7 +45,6 @@
45 * @count: # of nodes in set 45 * @count: # of nodes in set
46 * @map: bitmap of node identifiers that are in the set 46 * @map: bitmap of node identifiers that are in the set
47 */ 47 */
48
49struct tipc_node_map { 48struct tipc_node_map {
50 u32 count; 49 u32 count;
51 u32 map[MAX_NODES / WSIZE]; 50 u32 map[MAX_NODES / WSIZE];
@@ -59,7 +58,6 @@ struct tipc_node_map {
59 * @next: pointer to next entry in list 58 * @next: pointer to next entry in list
60 * @ports: array of port references 59 * @ports: array of port references
61 */ 60 */
62
63struct tipc_port_list { 61struct tipc_port_list {
64 int count; 62 int count;
65 struct tipc_port_list *next; 63 struct tipc_port_list *next;
@@ -77,7 +75,6 @@ void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node);
77/** 75/**
78 * tipc_nmap_equal - test for equality of node maps 76 * tipc_nmap_equal - test for equality of node maps
79 */ 77 */
80
81static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b) 78static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b)
82{ 79{
83 return !memcmp(nm_a, nm_b, sizeof(*nm_a)); 80 return !memcmp(nm_a, nm_b, sizeof(*nm_a));
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 0bfdeba91d51..a297e3a2e3e7 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -53,7 +53,6 @@ static void bearer_disable(struct tipc_bearer *b_ptr);
53 * 53 *
54 * Returns 1 if media name is valid, otherwise 0. 54 * Returns 1 if media name is valid, otherwise 0.
55 */ 55 */
56
57static int media_name_valid(const char *name) 56static int media_name_valid(const char *name)
58{ 57{
59 u32 len; 58 u32 len;
@@ -67,7 +66,6 @@ static int media_name_valid(const char *name)
67/** 66/**
68 * tipc_media_find - locates specified media object by name 67 * tipc_media_find - locates specified media object by name
69 */ 68 */
70
71struct tipc_media *tipc_media_find(const char *name) 69struct tipc_media *tipc_media_find(const char *name)
72{ 70{
73 u32 i; 71 u32 i;
@@ -82,7 +80,6 @@ struct tipc_media *tipc_media_find(const char *name)
82/** 80/**
83 * media_find_id - locates specified media object by type identifier 81 * media_find_id - locates specified media object by type identifier
84 */ 82 */
85
86static struct tipc_media *media_find_id(u8 type) 83static struct tipc_media *media_find_id(u8 type)
87{ 84{
88 u32 i; 85 u32 i;
@@ -99,7 +96,6 @@ static struct tipc_media *media_find_id(u8 type)
99 * 96 *
100 * Bearers for this media type must be activated separately at a later stage. 97 * Bearers for this media type must be activated separately at a later stage.
101 */ 98 */
102
103int tipc_register_media(struct tipc_media *m_ptr) 99int tipc_register_media(struct tipc_media *m_ptr)
104{ 100{
105 int res = -EINVAL; 101 int res = -EINVAL;
@@ -134,7 +130,6 @@ exit:
134/** 130/**
135 * tipc_media_addr_printf - record media address in print buffer 131 * tipc_media_addr_printf - record media address in print buffer
136 */ 132 */
137
138void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) 133void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
139{ 134{
140 char addr_str[MAX_ADDR_STR]; 135 char addr_str[MAX_ADDR_STR];
@@ -156,7 +151,6 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
156/** 151/**
157 * tipc_media_get_names - record names of registered media in buffer 152 * tipc_media_get_names - record names of registered media in buffer
158 */ 153 */
159
160struct sk_buff *tipc_media_get_names(void) 154struct sk_buff *tipc_media_get_names(void)
161{ 155{
162 struct sk_buff *buf; 156 struct sk_buff *buf;
@@ -183,7 +177,6 @@ struct sk_buff *tipc_media_get_names(void)
183 * 177 *
184 * Returns 1 if bearer name is valid, otherwise 0. 178 * Returns 1 if bearer name is valid, otherwise 0.
185 */ 179 */
186
187static int bearer_name_validate(const char *name, 180static int bearer_name_validate(const char *name,
188 struct tipc_bearer_names *name_parts) 181 struct tipc_bearer_names *name_parts)
189{ 182{
@@ -194,7 +187,6 @@ static int bearer_name_validate(const char *name,
194 u32 if_len; 187 u32 if_len;
195 188
196 /* copy bearer name & ensure length is OK */ 189 /* copy bearer name & ensure length is OK */
197
198 name_copy[TIPC_MAX_BEARER_NAME - 1] = 0; 190 name_copy[TIPC_MAX_BEARER_NAME - 1] = 0;
199 /* need above in case non-Posix strncpy() doesn't pad with nulls */ 191 /* need above in case non-Posix strncpy() doesn't pad with nulls */
200 strncpy(name_copy, name, TIPC_MAX_BEARER_NAME); 192 strncpy(name_copy, name, TIPC_MAX_BEARER_NAME);
@@ -202,7 +194,6 @@ static int bearer_name_validate(const char *name,
202 return 0; 194 return 0;
203 195
204 /* ensure all component parts of bearer name are present */ 196 /* ensure all component parts of bearer name are present */
205
206 media_name = name_copy; 197 media_name = name_copy;
207 if_name = strchr(media_name, ':'); 198 if_name = strchr(media_name, ':');
208 if (if_name == NULL) 199 if (if_name == NULL)
@@ -212,7 +203,6 @@ static int bearer_name_validate(const char *name,
212 if_len = strlen(if_name) + 1; 203 if_len = strlen(if_name) + 1;
213 204
214 /* validate component parts of bearer name */ 205 /* validate component parts of bearer name */
215
216 if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || 206 if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) ||
217 (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || 207 (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) ||
218 (strspn(media_name, tipc_alphabet) != (media_len - 1)) || 208 (strspn(media_name, tipc_alphabet) != (media_len - 1)) ||
@@ -220,7 +210,6 @@ static int bearer_name_validate(const char *name,
220 return 0; 210 return 0;
221 211
222 /* return bearer name components, if necessary */ 212 /* return bearer name components, if necessary */
223
224 if (name_parts) { 213 if (name_parts) {
225 strcpy(name_parts->media_name, media_name); 214 strcpy(name_parts->media_name, media_name);
226 strcpy(name_parts->if_name, if_name); 215 strcpy(name_parts->if_name, if_name);
@@ -231,7 +220,6 @@ static int bearer_name_validate(const char *name,
231/** 220/**
232 * tipc_bearer_find - locates bearer object with matching bearer name 221 * tipc_bearer_find - locates bearer object with matching bearer name
233 */ 222 */
234
235struct tipc_bearer *tipc_bearer_find(const char *name) 223struct tipc_bearer *tipc_bearer_find(const char *name)
236{ 224{
237 struct tipc_bearer *b_ptr; 225 struct tipc_bearer *b_ptr;
@@ -247,7 +235,6 @@ struct tipc_bearer *tipc_bearer_find(const char *name)
247/** 235/**
248 * tipc_bearer_find_interface - locates bearer object with matching interface name 236 * tipc_bearer_find_interface - locates bearer object with matching interface name
249 */ 237 */
250
251struct tipc_bearer *tipc_bearer_find_interface(const char *if_name) 238struct tipc_bearer *tipc_bearer_find_interface(const char *if_name)
252{ 239{
253 struct tipc_bearer *b_ptr; 240 struct tipc_bearer *b_ptr;
@@ -267,7 +254,6 @@ struct tipc_bearer *tipc_bearer_find_interface(const char *if_name)
267/** 254/**
268 * tipc_bearer_get_names - record names of bearers in buffer 255 * tipc_bearer_get_names - record names of bearers in buffer
269 */ 256 */
270
271struct sk_buff *tipc_bearer_get_names(void) 257struct sk_buff *tipc_bearer_get_names(void)
272{ 258{
273 struct sk_buff *buf; 259 struct sk_buff *buf;
@@ -363,7 +349,6 @@ void tipc_continue(struct tipc_bearer *b_ptr)
363 * the bearer is congested. 'tipc_net_lock' is in read_lock here 349 * the bearer is congested. 'tipc_net_lock' is in read_lock here
364 * bearer.lock is busy 350 * bearer.lock is busy
365 */ 351 */
366
367static void tipc_bearer_schedule_unlocked(struct tipc_bearer *b_ptr, 352static void tipc_bearer_schedule_unlocked(struct tipc_bearer *b_ptr,
368 struct tipc_link *l_ptr) 353 struct tipc_link *l_ptr)
369{ 354{
@@ -377,7 +362,6 @@ static void tipc_bearer_schedule_unlocked(struct tipc_bearer *b_ptr,
377 * the bearer is congested. 'tipc_net_lock' is in read_lock here, 362 * the bearer is congested. 'tipc_net_lock' is in read_lock here,
378 * bearer.lock is free 363 * bearer.lock is free
379 */ 364 */
380
381void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct tipc_link *l_ptr) 365void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct tipc_link *l_ptr)
382{ 366{
383 spin_lock_bh(&b_ptr->lock); 367 spin_lock_bh(&b_ptr->lock);
@@ -410,7 +394,6 @@ int tipc_bearer_resolve_congestion(struct tipc_bearer *b_ptr,
410/** 394/**
411 * tipc_bearer_congested - determines if bearer is currently congested 395 * tipc_bearer_congested - determines if bearer is currently congested
412 */ 396 */
413
414int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct tipc_link *l_ptr) 397int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct tipc_link *l_ptr)
415{ 398{
416 if (unlikely(b_ptr->blocked)) 399 if (unlikely(b_ptr->blocked))
@@ -423,7 +406,6 @@ int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct tipc_link *l_ptr)
423/** 406/**
424 * tipc_enable_bearer - enable bearer with the given name 407 * tipc_enable_bearer - enable bearer with the given name
425 */ 408 */
426
427int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority) 409int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
428{ 410{
429 struct tipc_bearer *b_ptr; 411 struct tipc_bearer *b_ptr;
@@ -541,7 +523,6 @@ exit:
541 * tipc_block_bearer(): Block the bearer with the given name, 523 * tipc_block_bearer(): Block the bearer with the given name,
542 * and reset all its links 524 * and reset all its links
543 */ 525 */
544
545int tipc_block_bearer(const char *name) 526int tipc_block_bearer(const char *name)
546{ 527{
547 struct tipc_bearer *b_ptr = NULL; 528 struct tipc_bearer *b_ptr = NULL;
@@ -573,11 +554,10 @@ int tipc_block_bearer(const char *name)
573} 554}
574 555
575/** 556/**
576 * bearer_disable - 557 * bearer_disable
577 * 558 *
578 * Note: This routine assumes caller holds tipc_net_lock. 559 * Note: This routine assumes caller holds tipc_net_lock.
579 */ 560 */
580
581static void bearer_disable(struct tipc_bearer *b_ptr) 561static void bearer_disable(struct tipc_bearer *b_ptr)
582{ 562{
583 struct tipc_link *l_ptr; 563 struct tipc_link *l_ptr;
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index d3eac56b8c21..e3b2be37fb31 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -49,7 +49,6 @@
49 * - media type identifier located at offset 3 49 * - media type identifier located at offset 3
50 * - remaining bytes vary according to media type 50 * - remaining bytes vary according to media type
51 */ 51 */
52
53#define TIPC_MEDIA_ADDR_SIZE 20 52#define TIPC_MEDIA_ADDR_SIZE 20
54#define TIPC_MEDIA_TYPE_OFFSET 3 53#define TIPC_MEDIA_TYPE_OFFSET 3
55 54
@@ -64,7 +63,6 @@
64 * @media_id: TIPC media type identifier 63 * @media_id: TIPC media type identifier
65 * @broadcast: non-zero if address is a broadcast address 64 * @broadcast: non-zero if address is a broadcast address
66 */ 65 */
67
68struct tipc_media_addr { 66struct tipc_media_addr {
69 u8 value[TIPC_MEDIA_ADDR_SIZE]; 67 u8 value[TIPC_MEDIA_ADDR_SIZE];
70 u8 media_id; 68 u8 media_id;
@@ -89,7 +87,6 @@ struct tipc_bearer;
89 * @type_id: TIPC media identifier 87 * @type_id: TIPC media identifier
90 * @name: media name 88 * @name: media name
91 */ 89 */
92
93struct tipc_media { 90struct tipc_media {
94 int (*send_msg)(struct sk_buff *buf, 91 int (*send_msg)(struct sk_buff *buf,
95 struct tipc_bearer *b_ptr, 92 struct tipc_bearer *b_ptr,
@@ -216,7 +213,6 @@ void tipc_bearer_lock_push(struct tipc_bearer *b_ptr);
216 * send routine always returns success -- even if the buffer was not sent -- 213 * send routine always returns success -- even if the buffer was not sent --
217 * and let TIPC's link code deal with the undelivered message. 214 * and let TIPC's link code deal with the undelivered message.
218 */ 215 */
219
220static inline int tipc_bearer_send(struct tipc_bearer *b_ptr, 216static inline int tipc_bearer_send(struct tipc_bearer *b_ptr,
221 struct sk_buff *buf, 217 struct sk_buff *buf,
222 struct tipc_media_addr *dest) 218 struct tipc_media_addr *dest)
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 843d7ae04661..c5712a343810 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -131,7 +131,6 @@ static struct sk_buff *tipc_show_stats(void)
131 tipc_printf(&pb, "TIPC version " TIPC_MOD_VER "\n"); 131 tipc_printf(&pb, "TIPC version " TIPC_MOD_VER "\n");
132 132
133 /* Use additional tipc_printf()'s to return more info ... */ 133 /* Use additional tipc_printf()'s to return more info ... */
134
135 str_len = tipc_printbuf_validate(&pb); 134 str_len = tipc_printbuf_validate(&pb);
136 skb_put(buf, TLV_SPACE(str_len)); 135 skb_put(buf, TLV_SPACE(str_len));
137 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); 136 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
@@ -191,7 +190,6 @@ static struct sk_buff *cfg_set_own_addr(void)
191 * configuration commands can't be received until a local configuration 190 * configuration commands can't be received until a local configuration
192 * command to enable the first bearer is received and processed. 191 * command to enable the first bearer is received and processed.
193 */ 192 */
194
195 spin_unlock_bh(&config_lock); 193 spin_unlock_bh(&config_lock);
196 tipc_core_start_net(addr); 194 tipc_core_start_net(addr);
197 spin_lock_bh(&config_lock); 195 spin_lock_bh(&config_lock);
@@ -283,13 +281,11 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
283 spin_lock_bh(&config_lock); 281 spin_lock_bh(&config_lock);
284 282
285 /* Save request and reply details in a well-known location */ 283 /* Save request and reply details in a well-known location */
286
287 req_tlv_area = request_area; 284 req_tlv_area = request_area;
288 req_tlv_space = request_space; 285 req_tlv_space = request_space;
289 rep_headroom = reply_headroom; 286 rep_headroom = reply_headroom;
290 287
291 /* Check command authorization */ 288 /* Check command authorization */
292
293 if (likely(in_own_node(orig_node))) { 289 if (likely(in_own_node(orig_node))) {
294 /* command is permitted */ 290 /* command is permitted */
295 } else if (cmd >= 0x8000) { 291 } else if (cmd >= 0x8000) {
@@ -310,7 +306,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
310 } 306 }
311 307
312 /* Call appropriate processing routine */ 308 /* Call appropriate processing routine */
313
314 switch (cmd) { 309 switch (cmd) {
315 case TIPC_CMD_NOOP: 310 case TIPC_CMD_NOOP:
316 rep_tlv_buf = tipc_cfg_reply_none(); 311 rep_tlv_buf = tipc_cfg_reply_none();
@@ -433,7 +428,6 @@ static void cfg_named_msg_event(void *userdata,
433 struct sk_buff *rep_buf; 428 struct sk_buff *rep_buf;
434 429
435 /* Validate configuration message header (ignore invalid message) */ 430 /* Validate configuration message header (ignore invalid message) */
436
437 req_hdr = (struct tipc_cfg_msg_hdr *)msg; 431 req_hdr = (struct tipc_cfg_msg_hdr *)msg;
438 if ((size < sizeof(*req_hdr)) || 432 if ((size < sizeof(*req_hdr)) ||
439 (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) || 433 (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
@@ -443,7 +437,6 @@ static void cfg_named_msg_event(void *userdata,
443 } 437 }
444 438
445 /* Generate reply for request (if can't, return request) */ 439 /* Generate reply for request (if can't, return request) */
446
447 rep_buf = tipc_cfg_do_cmd(orig->node, 440 rep_buf = tipc_cfg_do_cmd(orig->node,
448 ntohs(req_hdr->tcm_type), 441 ntohs(req_hdr->tcm_type),
449 msg + sizeof(*req_hdr), 442 msg + sizeof(*req_hdr),
diff --git a/net/tipc/core.c b/net/tipc/core.c
index ba089407b2f7..f7b95239ebda 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -52,14 +52,12 @@
52#endif 52#endif
53 53
54/* global variables used by multiple sub-systems within TIPC */ 54/* global variables used by multiple sub-systems within TIPC */
55
56int tipc_random; 55int tipc_random;
57 56
58const char tipc_alphabet[] = 57const char tipc_alphabet[] =
59 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."; 58 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
60 59
61/* configurable TIPC parameters */ 60/* configurable TIPC parameters */
62
63u32 tipc_own_addr; 61u32 tipc_own_addr;
64int tipc_max_ports; 62int tipc_max_ports;
65int tipc_max_subscriptions; 63int tipc_max_subscriptions;
@@ -77,7 +75,6 @@ int tipc_remote_management;
77 * NOTE: Headroom is reserved to allow prepending of a data link header. 75 * NOTE: Headroom is reserved to allow prepending of a data link header.
78 * There may also be unrequested tailroom present at the buffer's end. 76 * There may also be unrequested tailroom present at the buffer's end.
79 */ 77 */
80
81struct sk_buff *tipc_buf_acquire(u32 size) 78struct sk_buff *tipc_buf_acquire(u32 size)
82{ 79{
83 struct sk_buff *skb; 80 struct sk_buff *skb;
@@ -95,7 +92,6 @@ struct sk_buff *tipc_buf_acquire(u32 size)
95/** 92/**
96 * tipc_core_stop_net - shut down TIPC networking sub-systems 93 * tipc_core_stop_net - shut down TIPC networking sub-systems
97 */ 94 */
98
99static void tipc_core_stop_net(void) 95static void tipc_core_stop_net(void)
100{ 96{
101 tipc_net_stop(); 97 tipc_net_stop();
@@ -105,7 +101,6 @@ static void tipc_core_stop_net(void)
105/** 101/**
106 * start_net - start TIPC networking sub-systems 102 * start_net - start TIPC networking sub-systems
107 */ 103 */
108
109int tipc_core_start_net(unsigned long addr) 104int tipc_core_start_net(unsigned long addr)
110{ 105{
111 int res; 106 int res;
@@ -121,7 +116,6 @@ int tipc_core_start_net(unsigned long addr)
121/** 116/**
122 * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode 117 * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
123 */ 118 */
124
125static void tipc_core_stop(void) 119static void tipc_core_stop(void)
126{ 120{
127 tipc_netlink_stop(); 121 tipc_netlink_stop();
@@ -137,7 +131,6 @@ static void tipc_core_stop(void)
137/** 131/**
138 * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode 132 * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
139 */ 133 */
140
141static int tipc_core_start(void) 134static int tipc_core_start(void)
142{ 135{
143 int res; 136 int res;
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 13837e0e56b1..2a9bb99537b3 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -85,7 +85,6 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
85/* 85/*
86 * TIPC_OUTPUT is the destination print buffer for system messages. 86 * TIPC_OUTPUT is the destination print buffer for system messages.
87 */ 87 */
88
89#ifndef TIPC_OUTPUT 88#ifndef TIPC_OUTPUT
90#define TIPC_OUTPUT TIPC_LOG 89#define TIPC_OUTPUT TIPC_LOG
91#endif 90#endif
@@ -102,7 +101,6 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
102/* 101/*
103 * DBG_OUTPUT is the destination print buffer for debug messages. 102 * DBG_OUTPUT is the destination print buffer for debug messages.
104 */ 103 */
105
106#ifndef DBG_OUTPUT 104#ifndef DBG_OUTPUT
107#define DBG_OUTPUT TIPC_LOG 105#define DBG_OUTPUT TIPC_LOG
108#endif 106#endif
@@ -126,13 +124,11 @@ void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
126/* 124/*
127 * TIPC-specific error codes 125 * TIPC-specific error codes
128 */ 126 */
129
130#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ 127#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
131 128
132/* 129/*
133 * Global configuration variables 130 * Global configuration variables
134 */ 131 */
135
136extern u32 tipc_own_addr; 132extern u32 tipc_own_addr;
137extern int tipc_max_ports; 133extern int tipc_max_ports;
138extern int tipc_max_subscriptions; 134extern int tipc_max_subscriptions;
@@ -143,7 +139,6 @@ extern int tipc_remote_management;
143/* 139/*
144 * Other global variables 140 * Other global variables
145 */ 141 */
146
147extern int tipc_random; 142extern int tipc_random;
148extern const char tipc_alphabet[]; 143extern const char tipc_alphabet[];
149 144
@@ -151,7 +146,6 @@ extern const char tipc_alphabet[];
151/* 146/*
152 * Routines available to privileged subsystems 147 * Routines available to privileged subsystems
153 */ 148 */
154
155extern int tipc_core_start_net(unsigned long); 149extern int tipc_core_start_net(unsigned long);
156extern int tipc_handler_start(void); 150extern int tipc_handler_start(void);
157extern void tipc_handler_stop(void); 151extern void tipc_handler_stop(void);
@@ -163,7 +157,6 @@ extern void tipc_socket_stop(void);
163/* 157/*
164 * TIPC timer and signal code 158 * TIPC timer and signal code
165 */ 159 */
166
167typedef void (*Handler) (unsigned long); 160typedef void (*Handler) (unsigned long);
168 161
169u32 tipc_k_signal(Handler routine, unsigned long argument); 162u32 tipc_k_signal(Handler routine, unsigned long argument);
@@ -176,7 +169,6 @@ u32 tipc_k_signal(Handler routine, unsigned long argument);
176 * 169 *
177 * Timer must be initialized before use (and terminated when no longer needed). 170 * Timer must be initialized before use (and terminated when no longer needed).
178 */ 171 */
179
180static inline void k_init_timer(struct timer_list *timer, Handler routine, 172static inline void k_init_timer(struct timer_list *timer, Handler routine,
181 unsigned long argument) 173 unsigned long argument)
182{ 174{
@@ -196,7 +188,6 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine,
196 * then an additional jiffy is added to account for the fact that 188 * then an additional jiffy is added to account for the fact that
197 * the starting time may be in the middle of the current jiffy. 189 * the starting time may be in the middle of the current jiffy.
198 */ 190 */
199
200static inline void k_start_timer(struct timer_list *timer, unsigned long msec) 191static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
201{ 192{
202 mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1); 193 mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1);
@@ -212,7 +203,6 @@ static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
212 * WARNING: Must not be called when holding locks required by the timer's 203 * WARNING: Must not be called when holding locks required by the timer's
213 * timeout routine, otherwise deadlock can occur on SMP systems! 204 * timeout routine, otherwise deadlock can occur on SMP systems!
214 */ 205 */
215
216static inline void k_cancel_timer(struct timer_list *timer) 206static inline void k_cancel_timer(struct timer_list *timer)
217{ 207{
218 del_timer_sync(timer); 208 del_timer_sync(timer);
@@ -229,12 +219,10 @@ static inline void k_cancel_timer(struct timer_list *timer)
229 * (Do not "enhance" this routine to automatically cancel an active timer, 219 * (Do not "enhance" this routine to automatically cancel an active timer,
230 * otherwise deadlock can arise when a timeout routine calls k_term_timer.) 220 * otherwise deadlock can arise when a timeout routine calls k_term_timer.)
231 */ 221 */
232
233static inline void k_term_timer(struct timer_list *timer) 222static inline void k_term_timer(struct timer_list *timer)
234{ 223{
235} 224}
236 225
237
238/* 226/*
239 * TIPC message buffer code 227 * TIPC message buffer code
240 * 228 *
@@ -244,7 +232,6 @@ static inline void k_term_timer(struct timer_list *timer)
244 * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields 232 * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields
245 * are word aligned for quicker access 233 * are word aligned for quicker access
246 */ 234 */
247
248#define BUF_HEADROOM LL_MAX_HEADER 235#define BUF_HEADROOM LL_MAX_HEADER
249 236
250struct tipc_skb_cb { 237struct tipc_skb_cb {
@@ -253,7 +240,6 @@ struct tipc_skb_cb {
253 240
254#define TIPC_SKB_CB(__skb) ((struct tipc_skb_cb *)&((__skb)->cb[0])) 241#define TIPC_SKB_CB(__skb) ((struct tipc_skb_cb *)&((__skb)->cb[0]))
255 242
256
257static inline struct tipc_msg *buf_msg(struct sk_buff *skb) 243static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
258{ 244{
259 return (struct tipc_msg *)skb->data; 245 return (struct tipc_msg *)skb->data;
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index c630a21b2bed..ae054cfe179f 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -70,7 +70,6 @@ struct tipc_link_req {
70 * @dest_domain: network domain of node(s) which should respond to message 70 * @dest_domain: network domain of node(s) which should respond to message
71 * @b_ptr: ptr to bearer issuing message 71 * @b_ptr: ptr to bearer issuing message
72 */ 72 */
73
74static struct sk_buff *tipc_disc_init_msg(u32 type, 73static struct sk_buff *tipc_disc_init_msg(u32 type,
75 u32 dest_domain, 74 u32 dest_domain,
76 struct tipc_bearer *b_ptr) 75 struct tipc_bearer *b_ptr)
@@ -96,7 +95,6 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
96 * @node_addr: duplicated node address 95 * @node_addr: duplicated node address
97 * @media_addr: media address advertised by duplicated node 96 * @media_addr: media address advertised by duplicated node
98 */ 97 */
99
100static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr, 98static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr,
101 struct tipc_media_addr *media_addr) 99 struct tipc_media_addr *media_addr)
102{ 100{
@@ -117,7 +115,6 @@ static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr,
117 * @buf: buffer containing message 115 * @buf: buffer containing message
118 * @b_ptr: bearer that message arrived on 116 * @b_ptr: bearer that message arrived on
119 */ 117 */
120
121void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr) 118void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
122{ 119{
123 struct tipc_node *n_ptr; 120 struct tipc_node *n_ptr;
@@ -221,7 +218,6 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
221 * the new media address and reset the link to ensure it starts up 218 * the new media address and reset the link to ensure it starts up
222 * cleanly. 219 * cleanly.
223 */ 220 */
224
225 if (addr_mismatch) { 221 if (addr_mismatch) {
226 if (tipc_link_is_up(link)) { 222 if (tipc_link_is_up(link)) {
227 disc_dupl_alert(b_ptr, orig, &media_addr); 223 disc_dupl_alert(b_ptr, orig, &media_addr);
@@ -264,7 +260,6 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
264 * Reinitiates discovery process if discovery object has no associated nodes 260 * Reinitiates discovery process if discovery object has no associated nodes
265 * and is either not currently searching or is searching at a slow rate 261 * and is either not currently searching or is searching at a slow rate
266 */ 262 */
267
268static void disc_update(struct tipc_link_req *req) 263static void disc_update(struct tipc_link_req *req)
269{ 264{
270 if (!req->num_nodes) { 265 if (!req->num_nodes) {
@@ -280,7 +275,6 @@ static void disc_update(struct tipc_link_req *req)
280 * tipc_disc_add_dest - increment set of discovered nodes 275 * tipc_disc_add_dest - increment set of discovered nodes
281 * @req: ptr to link request structure 276 * @req: ptr to link request structure
282 */ 277 */
283
284void tipc_disc_add_dest(struct tipc_link_req *req) 278void tipc_disc_add_dest(struct tipc_link_req *req)
285{ 279{
286 req->num_nodes++; 280 req->num_nodes++;
@@ -290,7 +284,6 @@ void tipc_disc_add_dest(struct tipc_link_req *req)
290 * tipc_disc_remove_dest - decrement set of discovered nodes 284 * tipc_disc_remove_dest - decrement set of discovered nodes
291 * @req: ptr to link request structure 285 * @req: ptr to link request structure
292 */ 286 */
293
294void tipc_disc_remove_dest(struct tipc_link_req *req) 287void tipc_disc_remove_dest(struct tipc_link_req *req)
295{ 288{
296 req->num_nodes--; 289 req->num_nodes--;
@@ -301,7 +294,6 @@ void tipc_disc_remove_dest(struct tipc_link_req *req)
301 * disc_send_msg - send link setup request message 294 * disc_send_msg - send link setup request message
302 * @req: ptr to link request structure 295 * @req: ptr to link request structure
303 */ 296 */
304
305static void disc_send_msg(struct tipc_link_req *req) 297static void disc_send_msg(struct tipc_link_req *req)
306{ 298{
307 if (!req->bearer->blocked) 299 if (!req->bearer->blocked)
@@ -314,7 +306,6 @@ static void disc_send_msg(struct tipc_link_req *req)
314 * 306 *
315 * Called whenever a link setup request timer associated with a bearer expires. 307 * Called whenever a link setup request timer associated with a bearer expires.
316 */ 308 */
317
318static void disc_timeout(struct tipc_link_req *req) 309static void disc_timeout(struct tipc_link_req *req)
319{ 310{
320 int max_delay; 311 int max_delay;
@@ -322,7 +313,6 @@ static void disc_timeout(struct tipc_link_req *req)
322 spin_lock_bh(&req->bearer->lock); 313 spin_lock_bh(&req->bearer->lock);
323 314
324 /* Stop searching if only desired node has been found */ 315 /* Stop searching if only desired node has been found */
325
326 if (tipc_node(req->domain) && req->num_nodes) { 316 if (tipc_node(req->domain) && req->num_nodes) {
327 req->timer_intv = TIPC_LINK_REQ_INACTIVE; 317 req->timer_intv = TIPC_LINK_REQ_INACTIVE;
328 goto exit; 318 goto exit;
@@ -335,7 +325,6 @@ static void disc_timeout(struct tipc_link_req *req)
335 * hold at fast polling rate if don't have any associated nodes, 325 * hold at fast polling rate if don't have any associated nodes,
336 * otherwise hold at slow polling rate 326 * otherwise hold at slow polling rate
337 */ 327 */
338
339 disc_send_msg(req); 328 disc_send_msg(req);
340 329
341 req->timer_intv *= 2; 330 req->timer_intv *= 2;
@@ -359,7 +348,6 @@ exit:
359 * 348 *
360 * Returns 0 if successful, otherwise -errno. 349 * Returns 0 if successful, otherwise -errno.
361 */ 350 */
362
363int tipc_disc_create(struct tipc_bearer *b_ptr, 351int tipc_disc_create(struct tipc_bearer *b_ptr,
364 struct tipc_media_addr *dest, u32 dest_domain) 352 struct tipc_media_addr *dest, u32 dest_domain)
365{ 353{
@@ -391,7 +379,6 @@ int tipc_disc_create(struct tipc_bearer *b_ptr,
391 * tipc_disc_delete - destroy object sending periodic link setup requests 379 * tipc_disc_delete - destroy object sending periodic link setup requests
392 * @req: ptr to link request structure 380 * @req: ptr to link request structure
393 */ 381 */
394
395void tipc_disc_delete(struct tipc_link_req *req) 382void tipc_disc_delete(struct tipc_link_req *req)
396{ 383{
397 k_cancel_timer(&req->timer); 384 k_cancel_timer(&req->timer);
@@ -399,4 +386,3 @@ void tipc_disc_delete(struct tipc_link_req *req)
399 kfree_skb(req->buf); 386 kfree_skb(req->buf);
400 kfree(req); 387 kfree(req);
401} 388}
402
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 527e3f0e165d..90ac9bfa7abb 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -48,7 +48,6 @@
48 * @tipc_packet_type: used in binding TIPC to Ethernet driver 48 * @tipc_packet_type: used in binding TIPC to Ethernet driver
49 * @cleanup: work item used when disabling bearer 49 * @cleanup: work item used when disabling bearer
50 */ 50 */
51
52struct eth_bearer { 51struct eth_bearer {
53 struct tipc_bearer *bearer; 52 struct tipc_bearer *bearer;
54 struct net_device *dev; 53 struct net_device *dev;
@@ -67,7 +66,6 @@ static struct notifier_block notifier;
67 * Media-dependent "value" field stores MAC address in first 6 bytes 66 * Media-dependent "value" field stores MAC address in first 6 bytes
68 * and zeroes out the remaining bytes. 67 * and zeroes out the remaining bytes.
69 */ 68 */
70
71static void eth_media_addr_set(struct tipc_media_addr *a, char *mac) 69static void eth_media_addr_set(struct tipc_media_addr *a, char *mac)
72{ 70{
73 memcpy(a->value, mac, ETH_ALEN); 71 memcpy(a->value, mac, ETH_ALEN);
@@ -79,7 +77,6 @@ static void eth_media_addr_set(struct tipc_media_addr *a, char *mac)
79/** 77/**
80 * send_msg - send a TIPC message out over an Ethernet interface 78 * send_msg - send a TIPC message out over an Ethernet interface
81 */ 79 */
82
83static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, 80static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
84 struct tipc_media_addr *dest) 81 struct tipc_media_addr *dest)
85{ 82{
@@ -115,7 +112,6 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
115 * ignores packets sent using Ethernet multicast, and traffic sent to other 112 * ignores packets sent using Ethernet multicast, and traffic sent to other
116 * nodes (which can happen if interface is running in promiscuous mode). 113 * nodes (which can happen if interface is running in promiscuous mode).
117 */ 114 */
118
119static int recv_msg(struct sk_buff *buf, struct net_device *dev, 115static int recv_msg(struct sk_buff *buf, struct net_device *dev,
120 struct packet_type *pt, struct net_device *orig_dev) 116 struct packet_type *pt, struct net_device *orig_dev)
121{ 117{
@@ -140,7 +136,6 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
140/** 136/**
141 * enable_bearer - attach TIPC bearer to an Ethernet interface 137 * enable_bearer - attach TIPC bearer to an Ethernet interface
142 */ 138 */
143
144static int enable_bearer(struct tipc_bearer *tb_ptr) 139static int enable_bearer(struct tipc_bearer *tb_ptr)
145{ 140{
146 struct net_device *dev = NULL; 141 struct net_device *dev = NULL;
@@ -151,7 +146,6 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
151 int pending_dev = 0; 146 int pending_dev = 0;
152 147
153 /* Find unused Ethernet bearer structure */ 148 /* Find unused Ethernet bearer structure */
154
155 while (eb_ptr->dev) { 149 while (eb_ptr->dev) {
156 if (!eb_ptr->bearer) 150 if (!eb_ptr->bearer)
157 pending_dev++; 151 pending_dev++;
@@ -160,7 +154,6 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
160 } 154 }
161 155
162 /* Find device with specified name */ 156 /* Find device with specified name */
163
164 read_lock(&dev_base_lock); 157 read_lock(&dev_base_lock);
165 for_each_netdev(&init_net, pdev) { 158 for_each_netdev(&init_net, pdev) {
166 if (!strncmp(pdev->name, driver_name, IFNAMSIZ)) { 159 if (!strncmp(pdev->name, driver_name, IFNAMSIZ)) {
@@ -174,7 +167,6 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
174 return -ENODEV; 167 return -ENODEV;
175 168
176 /* Create Ethernet bearer for device */ 169 /* Create Ethernet bearer for device */
177
178 eb_ptr->dev = dev; 170 eb_ptr->dev = dev;
179 eb_ptr->tipc_packet_type.type = htons(ETH_P_TIPC); 171 eb_ptr->tipc_packet_type.type = htons(ETH_P_TIPC);
180 eb_ptr->tipc_packet_type.dev = dev; 172 eb_ptr->tipc_packet_type.dev = dev;
@@ -184,7 +176,6 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
184 dev_add_pack(&eb_ptr->tipc_packet_type); 176 dev_add_pack(&eb_ptr->tipc_packet_type);
185 177
186 /* Associate TIPC bearer with Ethernet bearer */ 178 /* Associate TIPC bearer with Ethernet bearer */
187
188 eb_ptr->bearer = tb_ptr; 179 eb_ptr->bearer = tb_ptr;
189 tb_ptr->usr_handle = (void *)eb_ptr; 180 tb_ptr->usr_handle = (void *)eb_ptr;
190 tb_ptr->mtu = dev->mtu; 181 tb_ptr->mtu = dev->mtu;
@@ -198,7 +189,6 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
198 * 189 *
199 * This routine must be invoked from a work queue because it can sleep. 190 * This routine must be invoked from a work queue because it can sleep.
200 */ 191 */
201
202static void cleanup_bearer(struct work_struct *work) 192static void cleanup_bearer(struct work_struct *work)
203{ 193{
204 struct eth_bearer *eb_ptr = 194 struct eth_bearer *eb_ptr =
@@ -216,7 +206,6 @@ static void cleanup_bearer(struct work_struct *work)
216 * then get worker thread to complete bearer cleanup. (Can't do cleanup 206 * then get worker thread to complete bearer cleanup. (Can't do cleanup
217 * here because cleanup code needs to sleep and caller holds spinlocks.) 207 * here because cleanup code needs to sleep and caller holds spinlocks.)
218 */ 208 */
219
220static void disable_bearer(struct tipc_bearer *tb_ptr) 209static void disable_bearer(struct tipc_bearer *tb_ptr)
221{ 210{
222 struct eth_bearer *eb_ptr = (struct eth_bearer *)tb_ptr->usr_handle; 211 struct eth_bearer *eb_ptr = (struct eth_bearer *)tb_ptr->usr_handle;
@@ -232,7 +221,6 @@ static void disable_bearer(struct tipc_bearer *tb_ptr)
232 * Change the state of the Ethernet bearer (if any) associated with the 221 * Change the state of the Ethernet bearer (if any) associated with the
233 * specified device. 222 * specified device.
234 */ 223 */
235
236static int recv_notification(struct notifier_block *nb, unsigned long evt, 224static int recv_notification(struct notifier_block *nb, unsigned long evt,
237 void *dv) 225 void *dv)
238{ 226{
@@ -281,7 +269,6 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
281/** 269/**
282 * eth_addr2str - convert Ethernet address to string 270 * eth_addr2str - convert Ethernet address to string
283 */ 271 */
284
285static int eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) 272static int eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size)
286{ 273{
287 if (str_size < 18) /* 18 = strlen("aa:bb:cc:dd:ee:ff\0") */ 274 if (str_size < 18) /* 18 = strlen("aa:bb:cc:dd:ee:ff\0") */
@@ -294,7 +281,6 @@ static int eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size)
294/** 281/**
295 * eth_str2addr - convert string to Ethernet address 282 * eth_str2addr - convert string to Ethernet address
296 */ 283 */
297
298static int eth_str2addr(struct tipc_media_addr *a, char *str_buf) 284static int eth_str2addr(struct tipc_media_addr *a, char *str_buf)
299{ 285{
300 char mac[ETH_ALEN]; 286 char mac[ETH_ALEN];
@@ -314,7 +300,6 @@ static int eth_str2addr(struct tipc_media_addr *a, char *str_buf)
314/** 300/**
315 * eth_str2addr - convert Ethernet address format to message header format 301 * eth_str2addr - convert Ethernet address format to message header format
316 */ 302 */
317
318static int eth_addr2msg(struct tipc_media_addr *a, char *msg_area) 303static int eth_addr2msg(struct tipc_media_addr *a, char *msg_area)
319{ 304{
320 memset(msg_area, 0, TIPC_MEDIA_ADDR_SIZE); 305 memset(msg_area, 0, TIPC_MEDIA_ADDR_SIZE);
@@ -326,7 +311,6 @@ static int eth_addr2msg(struct tipc_media_addr *a, char *msg_area)
326/** 311/**
327 * eth_str2addr - convert message header address format to Ethernet format 312 * eth_str2addr - convert message header address format to Ethernet format
328 */ 313 */
329
330static int eth_msg2addr(struct tipc_media_addr *a, char *msg_area) 314static int eth_msg2addr(struct tipc_media_addr *a, char *msg_area)
331{ 315{
332 if (msg_area[TIPC_MEDIA_TYPE_OFFSET] != TIPC_MEDIA_TYPE_ETH) 316 if (msg_area[TIPC_MEDIA_TYPE_OFFSET] != TIPC_MEDIA_TYPE_ETH)
@@ -339,7 +323,6 @@ static int eth_msg2addr(struct tipc_media_addr *a, char *msg_area)
339/* 323/*
340 * Ethernet media registration info 324 * Ethernet media registration info
341 */ 325 */
342
343static struct tipc_media eth_media_info = { 326static struct tipc_media eth_media_info = {
344 .send_msg = send_msg, 327 .send_msg = send_msg,
345 .enable_bearer = enable_bearer, 328 .enable_bearer = enable_bearer,
@@ -363,7 +346,6 @@ static struct tipc_media eth_media_info = {
363 * Register Ethernet media type with TIPC bearer code. Also register 346 * Register Ethernet media type with TIPC bearer code. Also register
364 * with OS for notifications about device state changes. 347 * with OS for notifications about device state changes.
365 */ 348 */
366
367int tipc_eth_media_start(void) 349int tipc_eth_media_start(void)
368{ 350{
369 int res; 351 int res;
@@ -386,7 +368,6 @@ int tipc_eth_media_start(void)
386/** 368/**
387 * tipc_eth_media_stop - deactivate Ethernet bearer support 369 * tipc_eth_media_stop - deactivate Ethernet bearer support
388 */ 370 */
389
390void tipc_eth_media_stop(void) 371void tipc_eth_media_stop(void)
391{ 372{
392 if (!eth_started) 373 if (!eth_started)
diff --git a/net/tipc/handler.c b/net/tipc/handler.c
index 274c98e164b7..9c6f22ff1c6d 100644
--- a/net/tipc/handler.c
+++ b/net/tipc/handler.c
@@ -129,4 +129,3 @@ void tipc_handler_stop(void)
129 129
130 kmem_cache_destroy(tipc_queue_item_cache); 130 kmem_cache_destroy(tipc_queue_item_cache);
131} 131}
132
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 33cecd6fc37d..7a614f43549d 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -45,13 +45,11 @@
45/* 45/*
46 * Out-of-range value for link session numbers 46 * Out-of-range value for link session numbers
47 */ 47 */
48
49#define INVALID_SESSION 0x10000 48#define INVALID_SESSION 0x10000
50 49
51/* 50/*
52 * Link state events: 51 * Link state events:
53 */ 52 */
54
55#define STARTING_EVT 856384768 /* link processing trigger */ 53#define STARTING_EVT 856384768 /* link processing trigger */
56#define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */ 54#define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */
57#define TIMEOUT_EVT 560817u /* link timer expired */ 55#define TIMEOUT_EVT 560817u /* link timer expired */
@@ -67,7 +65,6 @@
67/* 65/*
68 * State value stored in 'exp_msg_count' 66 * State value stored in 'exp_msg_count'
69 */ 67 */
70
71#define START_CHANGEOVER 100000u 68#define START_CHANGEOVER 100000u
72 69
73/** 70/**
@@ -77,7 +74,6 @@
77 * @addr_peer: network address of node at far end 74 * @addr_peer: network address of node at far end
78 * @if_peer: name of interface at far end 75 * @if_peer: name of interface at far end
79 */ 76 */
80
81struct tipc_link_name { 77struct tipc_link_name {
82 u32 addr_local; 78 u32 addr_local;
83 char if_local[TIPC_MAX_IF_NAME]; 79 char if_local[TIPC_MAX_IF_NAME];
@@ -105,7 +101,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
105/* 101/*
106 * Simple link routines 102 * Simple link routines
107 */ 103 */
108
109static unsigned int align(unsigned int i) 104static unsigned int align(unsigned int i)
110{ 105{
111 return (i + 3) & ~3u; 106 return (i + 3) & ~3u;
@@ -143,7 +138,6 @@ static u32 link_last_sent(struct tipc_link *l_ptr)
143/* 138/*
144 * Simple non-static link routines (i.e. referenced outside this file) 139 * Simple non-static link routines (i.e. referenced outside this file)
145 */ 140 */
146
147int tipc_link_is_up(struct tipc_link *l_ptr) 141int tipc_link_is_up(struct tipc_link *l_ptr)
148{ 142{
149 if (!l_ptr) 143 if (!l_ptr)
@@ -164,7 +158,6 @@ int tipc_link_is_active(struct tipc_link *l_ptr)
164 * 158 *
165 * Returns 1 if link name is valid, otherwise 0. 159 * Returns 1 if link name is valid, otherwise 0.
166 */ 160 */
167
168static int link_name_validate(const char *name, 161static int link_name_validate(const char *name,
169 struct tipc_link_name *name_parts) 162 struct tipc_link_name *name_parts)
170{ 163{
@@ -180,7 +173,6 @@ static int link_name_validate(const char *name,
180 u32 if_peer_len; 173 u32 if_peer_len;
181 174
182 /* copy link name & ensure length is OK */ 175 /* copy link name & ensure length is OK */
183
184 name_copy[TIPC_MAX_LINK_NAME - 1] = 0; 176 name_copy[TIPC_MAX_LINK_NAME - 1] = 0;
185 /* need above in case non-Posix strncpy() doesn't pad with nulls */ 177 /* need above in case non-Posix strncpy() doesn't pad with nulls */
186 strncpy(name_copy, name, TIPC_MAX_LINK_NAME); 178 strncpy(name_copy, name, TIPC_MAX_LINK_NAME);
@@ -188,7 +180,6 @@ static int link_name_validate(const char *name,
188 return 0; 180 return 0;
189 181
190 /* ensure all component parts of link name are present */ 182 /* ensure all component parts of link name are present */
191
192 addr_local = name_copy; 183 addr_local = name_copy;
193 if_local = strchr(addr_local, ':'); 184 if_local = strchr(addr_local, ':');
194 if (if_local == NULL) 185 if (if_local == NULL)
@@ -206,7 +197,6 @@ static int link_name_validate(const char *name,
206 if_peer_len = strlen(if_peer) + 1; 197 if_peer_len = strlen(if_peer) + 1;
207 198
208 /* validate component parts of link name */ 199 /* validate component parts of link name */
209
210 if ((sscanf(addr_local, "%u.%u.%u%c", 200 if ((sscanf(addr_local, "%u.%u.%u%c",
211 &z_local, &c_local, &n_local, &dummy) != 3) || 201 &z_local, &c_local, &n_local, &dummy) != 3) ||
212 (sscanf(addr_peer, "%u.%u.%u%c", 202 (sscanf(addr_peer, "%u.%u.%u%c",
@@ -220,7 +210,6 @@ static int link_name_validate(const char *name,
220 return 0; 210 return 0;
221 211
222 /* return link name components, if necessary */ 212 /* return link name components, if necessary */
223
224 if (name_parts) { 213 if (name_parts) {
225 name_parts->addr_local = tipc_addr(z_local, c_local, n_local); 214 name_parts->addr_local = tipc_addr(z_local, c_local, n_local);
226 strcpy(name_parts->if_local, if_local); 215 strcpy(name_parts->if_local, if_local);
@@ -239,13 +228,11 @@ static int link_name_validate(const char *name,
239 * another thread because tipc_link_delete() always cancels the link timer before 228 * another thread because tipc_link_delete() always cancels the link timer before
240 * tipc_node_delete() is called.) 229 * tipc_node_delete() is called.)
241 */ 230 */
242
243static void link_timeout(struct tipc_link *l_ptr) 231static void link_timeout(struct tipc_link *l_ptr)
244{ 232{
245 tipc_node_lock(l_ptr->owner); 233 tipc_node_lock(l_ptr->owner);
246 234
247 /* update counters used in statistical profiling of send traffic */ 235 /* update counters used in statistical profiling of send traffic */
248
249 l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size; 236 l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size;
250 l_ptr->stats.queue_sz_counts++; 237 l_ptr->stats.queue_sz_counts++;
251 238
@@ -278,7 +265,6 @@ static void link_timeout(struct tipc_link *l_ptr)
278 } 265 }
279 266
280 /* do all other link processing performed on a periodic basis */ 267 /* do all other link processing performed on a periodic basis */
281
282 link_check_defragm_bufs(l_ptr); 268 link_check_defragm_bufs(l_ptr);
283 269
284 link_state_event(l_ptr, TIMEOUT_EVT); 270 link_state_event(l_ptr, TIMEOUT_EVT);
@@ -302,7 +288,6 @@ static void link_set_timer(struct tipc_link *l_ptr, u32 time)
302 * 288 *
303 * Returns pointer to link. 289 * Returns pointer to link.
304 */ 290 */
305
306struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, 291struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
307 struct tipc_bearer *b_ptr, 292 struct tipc_bearer *b_ptr,
308 const struct tipc_media_addr *media_addr) 293 const struct tipc_media_addr *media_addr)
@@ -383,7 +368,6 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
383 * This routine must not grab the node lock until after link timer cancellation 368 * This routine must not grab the node lock until after link timer cancellation
384 * to avoid a potential deadlock situation. 369 * to avoid a potential deadlock situation.
385 */ 370 */
386
387void tipc_link_delete(struct tipc_link *l_ptr) 371void tipc_link_delete(struct tipc_link *l_ptr)
388{ 372{
389 if (!l_ptr) { 373 if (!l_ptr) {
@@ -419,7 +403,6 @@ static void link_start(struct tipc_link *l_ptr)
419 * Schedules port for renewed sending of messages after link congestion 403 * Schedules port for renewed sending of messages after link congestion
420 * has abated. 404 * has abated.
421 */ 405 */
422
423static int link_schedule_port(struct tipc_link *l_ptr, u32 origport, u32 sz) 406static int link_schedule_port(struct tipc_link *l_ptr, u32 origport, u32 sz)
424{ 407{
425 struct tipc_port *p_ptr; 408 struct tipc_port *p_ptr;
@@ -476,7 +459,6 @@ exit:
476 * link_release_outqueue - purge link's outbound message queue 459 * link_release_outqueue - purge link's outbound message queue
477 * @l_ptr: pointer to link 460 * @l_ptr: pointer to link
478 */ 461 */
479
480static void link_release_outqueue(struct tipc_link *l_ptr) 462static void link_release_outqueue(struct tipc_link *l_ptr)
481{ 463{
482 struct sk_buff *buf = l_ptr->first_out; 464 struct sk_buff *buf = l_ptr->first_out;
@@ -495,7 +477,6 @@ static void link_release_outqueue(struct tipc_link *l_ptr)
495 * tipc_link_reset_fragments - purge link's inbound message fragments queue 477 * tipc_link_reset_fragments - purge link's inbound message fragments queue
496 * @l_ptr: pointer to link 478 * @l_ptr: pointer to link
497 */ 479 */
498
499void tipc_link_reset_fragments(struct tipc_link *l_ptr) 480void tipc_link_reset_fragments(struct tipc_link *l_ptr)
500{ 481{
501 struct sk_buff *buf = l_ptr->defragm_buf; 482 struct sk_buff *buf = l_ptr->defragm_buf;
@@ -513,7 +494,6 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr)
513 * tipc_link_stop - purge all inbound and outbound messages associated with link 494 * tipc_link_stop - purge all inbound and outbound messages associated with link
514 * @l_ptr: pointer to link 495 * @l_ptr: pointer to link
515 */ 496 */
516
517void tipc_link_stop(struct tipc_link *l_ptr) 497void tipc_link_stop(struct tipc_link *l_ptr)
518{ 498{
519 struct sk_buff *buf; 499 struct sk_buff *buf;
@@ -569,7 +549,6 @@ void tipc_link_reset(struct tipc_link *l_ptr)
569 } 549 }
570 550
571 /* Clean up all queues: */ 551 /* Clean up all queues: */
572
573 link_release_outqueue(l_ptr); 552 link_release_outqueue(l_ptr);
574 kfree_skb(l_ptr->proto_msg_queue); 553 kfree_skb(l_ptr->proto_msg_queue);
575 l_ptr->proto_msg_queue = NULL; 554 l_ptr->proto_msg_queue = NULL;
@@ -611,7 +590,6 @@ static void link_activate(struct tipc_link *l_ptr)
611 * @l_ptr: pointer to link 590 * @l_ptr: pointer to link
612 * @event: state machine event to process 591 * @event: state machine event to process
613 */ 592 */
614
615static void link_state_event(struct tipc_link *l_ptr, unsigned int event) 593static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
616{ 594{
617 struct tipc_link *other; 595 struct tipc_link *other;
@@ -785,7 +763,6 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
785 * link_bundle_buf(): Append contents of a buffer to 763 * link_bundle_buf(): Append contents of a buffer to
786 * the tail of an existing one. 764 * the tail of an existing one.
787 */ 765 */
788
789static int link_bundle_buf(struct tipc_link *l_ptr, 766static int link_bundle_buf(struct tipc_link *l_ptr,
790 struct sk_buff *bundler, 767 struct sk_buff *bundler,
791 struct sk_buff *buf) 768 struct sk_buff *buf)
@@ -860,7 +837,6 @@ static void link_add_chain_to_outqueue(struct tipc_link *l_ptr,
860 * inside TIPC when the 'fast path' in tipc_send_buf 837 * inside TIPC when the 'fast path' in tipc_send_buf
861 * has failed, and from link_send() 838 * has failed, and from link_send()
862 */ 839 */
863
864int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf) 840int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
865{ 841{
866 struct tipc_msg *msg = buf_msg(buf); 842 struct tipc_msg *msg = buf_msg(buf);
@@ -872,7 +848,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
872 u32 max_packet = l_ptr->max_pkt; 848 u32 max_packet = l_ptr->max_pkt;
873 849
874 /* Match msg importance against queue limits: */ 850 /* Match msg importance against queue limits: */
875
876 if (unlikely(queue_size >= queue_limit)) { 851 if (unlikely(queue_size >= queue_limit)) {
877 if (imp <= TIPC_CRITICAL_IMPORTANCE) { 852 if (imp <= TIPC_CRITICAL_IMPORTANCE) {
878 link_schedule_port(l_ptr, msg_origport(msg), size); 853 link_schedule_port(l_ptr, msg_origport(msg), size);
@@ -888,12 +863,10 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
888 } 863 }
889 864
890 /* Fragmentation needed ? */ 865 /* Fragmentation needed ? */
891
892 if (size > max_packet) 866 if (size > max_packet)
893 return link_send_long_buf(l_ptr, buf); 867 return link_send_long_buf(l_ptr, buf);
894 868
895 /* Packet can be queued or sent: */ 869 /* Packet can be queued or sent. */
896
897 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && 870 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
898 !link_congested(l_ptr))) { 871 !link_congested(l_ptr))) {
899 link_add_to_outqueue(l_ptr, buf, msg); 872 link_add_to_outqueue(l_ptr, buf, msg);
@@ -907,13 +880,11 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
907 } 880 }
908 return dsz; 881 return dsz;
909 } 882 }
910 /* Congestion: can message be bundled ?: */ 883 /* Congestion: can message be bundled ? */
911
912 if ((msg_user(msg) != CHANGEOVER_PROTOCOL) && 884 if ((msg_user(msg) != CHANGEOVER_PROTOCOL) &&
913 (msg_user(msg) != MSG_FRAGMENTER)) { 885 (msg_user(msg) != MSG_FRAGMENTER)) {
914 886
915 /* Try adding message to an existing bundle */ 887 /* Try adding message to an existing bundle */
916
917 if (l_ptr->next_out && 888 if (l_ptr->next_out &&
918 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { 889 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
919 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); 890 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
@@ -921,7 +892,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
921 } 892 }
922 893
923 /* Try creating a new bundle */ 894 /* Try creating a new bundle */
924
925 if (size <= max_packet * 2 / 3) { 895 if (size <= max_packet * 2 / 3) {
926 struct sk_buff *bundler = tipc_buf_acquire(max_packet); 896 struct sk_buff *bundler = tipc_buf_acquire(max_packet);
927 struct tipc_msg bundler_hdr; 897 struct tipc_msg bundler_hdr;
@@ -951,7 +921,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
951 * not been selected yet, and the the owner node is not locked 921 * not been selected yet, and the the owner node is not locked
952 * Called by TIPC internal users, e.g. the name distributor 922 * Called by TIPC internal users, e.g. the name distributor
953 */ 923 */
954
955int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) 924int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
956{ 925{
957 struct tipc_link *l_ptr; 926 struct tipc_link *l_ptr;
@@ -984,7 +953,6 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
984 * small enough not to require fragmentation. 953 * small enough not to require fragmentation.
985 * Called without any locks held. 954 * Called without any locks held.
986 */ 955 */
987
988void tipc_link_send_names(struct list_head *message_list, u32 dest) 956void tipc_link_send_names(struct list_head *message_list, u32 dest)
989{ 957{
990 struct tipc_node *n_ptr; 958 struct tipc_node *n_ptr;
@@ -1013,7 +981,6 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
1013 read_unlock_bh(&tipc_net_lock); 981 read_unlock_bh(&tipc_net_lock);
1014 982
1015 /* discard the messages if they couldn't be sent */ 983 /* discard the messages if they couldn't be sent */
1016
1017 list_for_each_safe(buf, temp_buf, ((struct sk_buff *)message_list)) { 984 list_for_each_safe(buf, temp_buf, ((struct sk_buff *)message_list)) {
1018 list_del((struct list_head *)buf); 985 list_del((struct list_head *)buf);
1019 kfree_skb(buf); 986 kfree_skb(buf);
@@ -1026,7 +993,6 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
1026 * inclusive total message length. Very time critical. 993 * inclusive total message length. Very time critical.
1027 * Link is locked. Returns user data length. 994 * Link is locked. Returns user data length.
1028 */ 995 */
1029
1030static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf, 996static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf,
1031 u32 *used_max_pkt) 997 u32 *used_max_pkt)
1032{ 998{
@@ -1111,7 +1077,6 @@ again:
1111 * Try building message using port's max_pkt hint. 1077 * Try building message using port's max_pkt hint.
1112 * (Must not hold any locks while building message.) 1078 * (Must not hold any locks while building message.)
1113 */ 1079 */
1114
1115 res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, 1080 res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
1116 sender->max_pkt, !sender->user_port, &buf); 1081 sender->max_pkt, !sender->user_port, &buf);
1117 1082
@@ -1131,12 +1096,10 @@ exit:
1131 } 1096 }
1132 1097
1133 /* Exit if build request was invalid */ 1098 /* Exit if build request was invalid */
1134
1135 if (unlikely(res < 0)) 1099 if (unlikely(res < 0))
1136 goto exit; 1100 goto exit;
1137 1101
1138 /* Exit if link (or bearer) is congested */ 1102 /* Exit if link (or bearer) is congested */
1139
1140 if (link_congested(l_ptr) || 1103 if (link_congested(l_ptr) ||
1141 !list_empty(&l_ptr->b_ptr->cong_links)) { 1104 !list_empty(&l_ptr->b_ptr->cong_links)) {
1142 res = link_schedule_port(l_ptr, 1105 res = link_schedule_port(l_ptr,
@@ -1148,7 +1111,6 @@ exit:
1148 * Message size exceeds max_pkt hint; update hint, 1111 * Message size exceeds max_pkt hint; update hint,
1149 * then re-try fast path or fragment the message 1112 * then re-try fast path or fragment the message
1150 */ 1113 */
1151
1152 sender->max_pkt = l_ptr->max_pkt; 1114 sender->max_pkt = l_ptr->max_pkt;
1153 tipc_node_unlock(node); 1115 tipc_node_unlock(node);
1154 read_unlock_bh(&tipc_net_lock); 1116 read_unlock_bh(&tipc_net_lock);
@@ -1166,7 +1128,6 @@ exit:
1166 read_unlock_bh(&tipc_net_lock); 1128 read_unlock_bh(&tipc_net_lock);
1167 1129
1168 /* Couldn't find a link to the destination node */ 1130 /* Couldn't find a link to the destination node */
1169
1170 if (buf) 1131 if (buf)
1171 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1132 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
1172 if (res >= 0) 1133 if (res >= 0)
@@ -1220,15 +1181,13 @@ again:
1220 sect_crs = NULL; 1181 sect_crs = NULL;
1221 curr_sect = -1; 1182 curr_sect = -1;
1222 1183
1223 /* Prepare reusable fragment header: */ 1184 /* Prepare reusable fragment header */
1224
1225 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, 1185 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
1226 INT_H_SIZE, msg_destnode(hdr)); 1186 INT_H_SIZE, msg_destnode(hdr));
1227 msg_set_size(&fragm_hdr, max_pkt); 1187 msg_set_size(&fragm_hdr, max_pkt);
1228 msg_set_fragm_no(&fragm_hdr, 1); 1188 msg_set_fragm_no(&fragm_hdr, 1);
1229 1189
1230 /* Prepare header of first fragment: */ 1190 /* Prepare header of first fragment */
1231
1232 buf_chain = buf = tipc_buf_acquire(max_pkt); 1191 buf_chain = buf = tipc_buf_acquire(max_pkt);
1233 if (!buf) 1192 if (!buf)
1234 return -ENOMEM; 1193 return -ENOMEM;
@@ -1237,8 +1196,7 @@ again:
1237 hsz = msg_hdr_sz(hdr); 1196 hsz = msg_hdr_sz(hdr);
1238 skb_copy_to_linear_data_offset(buf, INT_H_SIZE, hdr, hsz); 1197 skb_copy_to_linear_data_offset(buf, INT_H_SIZE, hdr, hsz);
1239 1198
1240 /* Chop up message: */ 1199 /* Chop up message */
1241
1242 fragm_crs = INT_H_SIZE + hsz; 1200 fragm_crs = INT_H_SIZE + hsz;
1243 fragm_rest = fragm_sz - hsz; 1201 fragm_rest = fragm_sz - hsz;
1244 1202
@@ -1329,7 +1287,6 @@ reject:
1329 } 1287 }
1330 1288
1331 /* Append chain of fragments to send queue & send them */ 1289 /* Append chain of fragments to send queue & send them */
1332
1333 l_ptr->long_msg_seq_no++; 1290 l_ptr->long_msg_seq_no++;
1334 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no); 1291 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
1335 l_ptr->stats.sent_fragments += fragm_no; 1292 l_ptr->stats.sent_fragments += fragm_no;
@@ -1350,7 +1307,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1350 1307
1351 /* Step to position where retransmission failed, if any, */ 1308 /* Step to position where retransmission failed, if any, */
1352 /* consider that buffers may have been released in meantime */ 1309 /* consider that buffers may have been released in meantime */
1353
1354 if (r_q_size && buf) { 1310 if (r_q_size && buf) {
1355 u32 last = lesser(mod(r_q_head + r_q_size), 1311 u32 last = lesser(mod(r_q_head + r_q_size),
1356 link_last_sent(l_ptr)); 1312 link_last_sent(l_ptr));
@@ -1365,7 +1321,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1365 } 1321 }
1366 1322
1367 /* Continue retransmission now, if there is anything: */ 1323 /* Continue retransmission now, if there is anything: */
1368
1369 if (r_q_size && buf) { 1324 if (r_q_size && buf) {
1370 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1325 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1371 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); 1326 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
@@ -1381,7 +1336,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1381 } 1336 }
1382 1337
1383 /* Send deferred protocol message, if any: */ 1338 /* Send deferred protocol message, if any: */
1384
1385 buf = l_ptr->proto_msg_queue; 1339 buf = l_ptr->proto_msg_queue;
1386 if (buf) { 1340 if (buf) {
1387 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1341 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
@@ -1398,7 +1352,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1398 } 1352 }
1399 1353
1400 /* Send one deferred data message, if send window not full: */ 1354 /* Send one deferred data message, if send window not full: */
1401
1402 buf = l_ptr->next_out; 1355 buf = l_ptr->next_out;
1403 if (buf) { 1356 if (buf) {
1404 struct tipc_msg *msg = buf_msg(buf); 1357 struct tipc_msg *msg = buf_msg(buf);
@@ -1478,16 +1431,12 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
1478 warn("Retransmission failure on link <%s>\n", l_ptr->name); 1431 warn("Retransmission failure on link <%s>\n", l_ptr->name);
1479 1432
1480 if (l_ptr->addr) { 1433 if (l_ptr->addr) {
1481
1482 /* Handle failure on standard link */ 1434 /* Handle failure on standard link */
1483
1484 link_print(l_ptr, "Resetting link\n"); 1435 link_print(l_ptr, "Resetting link\n");
1485 tipc_link_reset(l_ptr); 1436 tipc_link_reset(l_ptr);
1486 1437
1487 } else { 1438 } else {
1488
1489 /* Handle failure on broadcast link */ 1439 /* Handle failure on broadcast link */
1490
1491 struct tipc_node *n_ptr; 1440 struct tipc_node *n_ptr;
1492 char addr_string[16]; 1441 char addr_string[16];
1493 1442
@@ -1536,7 +1485,6 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
1536 return; 1485 return;
1537 } else { 1486 } else {
1538 /* Detect repeated retransmit failures on uncongested bearer */ 1487 /* Detect repeated retransmit failures on uncongested bearer */
1539
1540 if (l_ptr->last_retransmitted == msg_seqno(msg)) { 1488 if (l_ptr->last_retransmitted == msg_seqno(msg)) {
1541 if (++l_ptr->stale_count > 100) { 1489 if (++l_ptr->stale_count > 100) {
1542 link_retransmit_failure(l_ptr, buf); 1490 link_retransmit_failure(l_ptr, buf);
@@ -1571,7 +1519,6 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
1571/** 1519/**
1572 * link_insert_deferred_queue - insert deferred messages back into receive chain 1520 * link_insert_deferred_queue - insert deferred messages back into receive chain
1573 */ 1521 */
1574
1575static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr, 1522static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr,
1576 struct sk_buff *buf) 1523 struct sk_buff *buf)
1577{ 1524{
@@ -1602,7 +1549,6 @@ static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr,
1602 * TIPC will ignore the excess, under the assumption that it is optional info 1549 * TIPC will ignore the excess, under the assumption that it is optional info
1603 * introduced by a later release of the protocol. 1550 * introduced by a later release of the protocol.
1604 */ 1551 */
1605
1606static int link_recv_buf_validate(struct sk_buff *buf) 1552static int link_recv_buf_validate(struct sk_buff *buf)
1607{ 1553{
1608 static u32 min_data_hdr_size[8] = { 1554 static u32 min_data_hdr_size[8] = {
@@ -1648,7 +1594,6 @@ static int link_recv_buf_validate(struct sk_buff *buf)
1648 * Invoked with no locks held. Bearer pointer must point to a valid bearer 1594 * Invoked with no locks held. Bearer pointer must point to a valid bearer
1649 * structure (i.e. cannot be NULL), but bearer can be inactive. 1595 * structure (i.e. cannot be NULL), but bearer can be inactive.
1650 */ 1596 */
1651
1652void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr) 1597void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1653{ 1598{
1654 read_lock_bh(&tipc_net_lock); 1599 read_lock_bh(&tipc_net_lock);
@@ -1666,22 +1611,18 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1666 head = head->next; 1611 head = head->next;
1667 1612
1668 /* Ensure bearer is still enabled */ 1613 /* Ensure bearer is still enabled */
1669
1670 if (unlikely(!b_ptr->active)) 1614 if (unlikely(!b_ptr->active))
1671 goto cont; 1615 goto cont;
1672 1616
1673 /* Ensure message is well-formed */ 1617 /* Ensure message is well-formed */
1674
1675 if (unlikely(!link_recv_buf_validate(buf))) 1618 if (unlikely(!link_recv_buf_validate(buf)))
1676 goto cont; 1619 goto cont;
1677 1620
1678 /* Ensure message data is a single contiguous unit */ 1621 /* Ensure message data is a single contiguous unit */
1679
1680 if (unlikely(skb_linearize(buf))) 1622 if (unlikely(skb_linearize(buf)))
1681 goto cont; 1623 goto cont;
1682 1624
1683 /* Handle arrival of a non-unicast link message */ 1625 /* Handle arrival of a non-unicast link message */
1684
1685 msg = buf_msg(buf); 1626 msg = buf_msg(buf);
1686 1627
1687 if (unlikely(msg_non_seq(msg))) { 1628 if (unlikely(msg_non_seq(msg))) {
@@ -1693,20 +1634,17 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1693 } 1634 }
1694 1635
1695 /* Discard unicast link messages destined for another node */ 1636 /* Discard unicast link messages destined for another node */
1696
1697 if (unlikely(!msg_short(msg) && 1637 if (unlikely(!msg_short(msg) &&
1698 (msg_destnode(msg) != tipc_own_addr))) 1638 (msg_destnode(msg) != tipc_own_addr)))
1699 goto cont; 1639 goto cont;
1700 1640
1701 /* Locate neighboring node that sent message */ 1641 /* Locate neighboring node that sent message */
1702
1703 n_ptr = tipc_node_find(msg_prevnode(msg)); 1642 n_ptr = tipc_node_find(msg_prevnode(msg));
1704 if (unlikely(!n_ptr)) 1643 if (unlikely(!n_ptr))
1705 goto cont; 1644 goto cont;
1706 tipc_node_lock(n_ptr); 1645 tipc_node_lock(n_ptr);
1707 1646
1708 /* Locate unicast link endpoint that should handle message */ 1647 /* Locate unicast link endpoint that should handle message */
1709
1710 l_ptr = n_ptr->links[b_ptr->identity]; 1648 l_ptr = n_ptr->links[b_ptr->identity];
1711 if (unlikely(!l_ptr)) { 1649 if (unlikely(!l_ptr)) {
1712 tipc_node_unlock(n_ptr); 1650 tipc_node_unlock(n_ptr);
@@ -1714,7 +1652,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1714 } 1652 }
1715 1653
1716 /* Verify that communication with node is currently allowed */ 1654 /* Verify that communication with node is currently allowed */
1717
1718 if ((n_ptr->block_setup & WAIT_PEER_DOWN) && 1655 if ((n_ptr->block_setup & WAIT_PEER_DOWN) &&
1719 msg_user(msg) == LINK_PROTOCOL && 1656 msg_user(msg) == LINK_PROTOCOL &&
1720 (msg_type(msg) == RESET_MSG || 1657 (msg_type(msg) == RESET_MSG ||
@@ -1728,12 +1665,10 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1728 } 1665 }
1729 1666
1730 /* Validate message sequence number info */ 1667 /* Validate message sequence number info */
1731
1732 seq_no = msg_seqno(msg); 1668 seq_no = msg_seqno(msg);
1733 ackd = msg_ack(msg); 1669 ackd = msg_ack(msg);
1734 1670
1735 /* Release acked messages */ 1671 /* Release acked messages */
1736
1737 if (n_ptr->bclink.supported) 1672 if (n_ptr->bclink.supported)
1738 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg)); 1673 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
1739 1674
@@ -1752,7 +1687,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1752 } 1687 }
1753 1688
1754 /* Try sending any messages link endpoint has pending */ 1689 /* Try sending any messages link endpoint has pending */
1755
1756 if (unlikely(l_ptr->next_out)) 1690 if (unlikely(l_ptr->next_out))
1757 tipc_link_push_queue(l_ptr); 1691 tipc_link_push_queue(l_ptr);
1758 if (unlikely(!list_empty(&l_ptr->waiting_ports))) 1692 if (unlikely(!list_empty(&l_ptr->waiting_ports)))
@@ -1763,7 +1697,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1763 } 1697 }
1764 1698
1765 /* Now (finally!) process the incoming message */ 1699 /* Now (finally!) process the incoming message */
1766
1767protocol_check: 1700protocol_check:
1768 if (likely(link_working_working(l_ptr))) { 1701 if (likely(link_working_working(l_ptr))) {
1769 if (likely(seq_no == mod(l_ptr->next_in_no))) { 1702 if (likely(seq_no == mod(l_ptr->next_in_no))) {
@@ -1859,7 +1792,6 @@ cont:
1859 * 1792 *
1860 * Returns increase in queue length (i.e. 0 or 1) 1793 * Returns increase in queue length (i.e. 0 or 1)
1861 */ 1794 */
1862
1863u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, 1795u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
1864 struct sk_buff *buf) 1796 struct sk_buff *buf)
1865{ 1797{
@@ -1908,7 +1840,6 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
1908/* 1840/*
1909 * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet 1841 * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet
1910 */ 1842 */
1911
1912static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr, 1843static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1913 struct sk_buff *buf) 1844 struct sk_buff *buf)
1914{ 1845{
@@ -1920,14 +1851,12 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1920 } 1851 }
1921 1852
1922 /* Record OOS packet arrival (force mismatch on next timeout) */ 1853 /* Record OOS packet arrival (force mismatch on next timeout) */
1923
1924 l_ptr->checkpoint--; 1854 l_ptr->checkpoint--;
1925 1855
1926 /* 1856 /*
1927 * Discard packet if a duplicate; otherwise add it to deferred queue 1857 * Discard packet if a duplicate; otherwise add it to deferred queue
1928 * and notify peer of gap as per protocol specification 1858 * and notify peer of gap as per protocol specification
1929 */ 1859 */
1930
1931 if (less(seq_no, mod(l_ptr->next_in_no))) { 1860 if (less(seq_no, mod(l_ptr->next_in_no))) {
1932 l_ptr->stats.duplicates++; 1861 l_ptr->stats.duplicates++;
1933 kfree_skb(buf); 1862 kfree_skb(buf);
@@ -1957,7 +1886,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
1957 int r_flag; 1886 int r_flag;
1958 1887
1959 /* Discard any previous message that was deferred due to congestion */ 1888 /* Discard any previous message that was deferred due to congestion */
1960
1961 if (l_ptr->proto_msg_queue) { 1889 if (l_ptr->proto_msg_queue) {
1962 kfree_skb(l_ptr->proto_msg_queue); 1890 kfree_skb(l_ptr->proto_msg_queue);
1963 l_ptr->proto_msg_queue = NULL; 1891 l_ptr->proto_msg_queue = NULL;
@@ -1967,12 +1895,10 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
1967 return; 1895 return;
1968 1896
1969 /* Abort non-RESET send if communication with node is prohibited */ 1897 /* Abort non-RESET send if communication with node is prohibited */
1970
1971 if ((l_ptr->owner->block_setup) && (msg_typ != RESET_MSG)) 1898 if ((l_ptr->owner->block_setup) && (msg_typ != RESET_MSG))
1972 return; 1899 return;
1973 1900
1974 /* Create protocol message with "out-of-sequence" sequence number */ 1901 /* Create protocol message with "out-of-sequence" sequence number */
1975
1976 msg_set_type(msg, msg_typ); 1902 msg_set_type(msg, msg_typ);
1977 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); 1903 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
1978 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1904 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
@@ -2040,14 +1966,12 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
2040 skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); 1966 skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg));
2041 1967
2042 /* Defer message if bearer is already congested */ 1968 /* Defer message if bearer is already congested */
2043
2044 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { 1969 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
2045 l_ptr->proto_msg_queue = buf; 1970 l_ptr->proto_msg_queue = buf;
2046 return; 1971 return;
2047 } 1972 }
2048 1973
2049 /* Defer message if attempting to send results in bearer congestion */ 1974 /* Defer message if attempting to send results in bearer congestion */
2050
2051 if (!tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1975 if (!tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
2052 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); 1976 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
2053 l_ptr->proto_msg_queue = buf; 1977 l_ptr->proto_msg_queue = buf;
@@ -2056,7 +1980,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
2056 } 1980 }
2057 1981
2058 /* Discard message if it was sent successfully */ 1982 /* Discard message if it was sent successfully */
2059
2060 l_ptr->unacked_window = 0; 1983 l_ptr->unacked_window = 0;
2061 kfree_skb(buf); 1984 kfree_skb(buf);
2062} 1985}
@@ -2066,7 +1989,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
2066 * Note that network plane id propagates through the network, and may 1989 * Note that network plane id propagates through the network, and may
2067 * change at any time. The node with lowest address rules 1990 * change at any time. The node with lowest address rules
2068 */ 1991 */
2069
2070static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf) 1992static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2071{ 1993{
2072 u32 rec_gap = 0; 1994 u32 rec_gap = 0;
@@ -2079,7 +2001,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2079 goto exit; 2001 goto exit;
2080 2002
2081 /* record unnumbered packet arrival (force mismatch on next timeout) */ 2003 /* record unnumbered packet arrival (force mismatch on next timeout) */
2082
2083 l_ptr->checkpoint--; 2004 l_ptr->checkpoint--;
2084 2005
2085 if (l_ptr->b_ptr->net_plane != msg_net_plane(msg)) 2006 if (l_ptr->b_ptr->net_plane != msg_net_plane(msg))
@@ -2111,7 +2032,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2111 /* fall thru' */ 2032 /* fall thru' */
2112 case ACTIVATE_MSG: 2033 case ACTIVATE_MSG:
2113 /* Update link settings according other endpoint's values */ 2034 /* Update link settings according other endpoint's values */
2114
2115 strcpy((strrchr(l_ptr->name, ':') + 1), (char *)msg_data(msg)); 2035 strcpy((strrchr(l_ptr->name, ':') + 1), (char *)msg_data(msg));
2116 2036
2117 msg_tol = msg_link_tolerance(msg); 2037 msg_tol = msg_link_tolerance(msg);
@@ -2133,7 +2053,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2133 l_ptr->owner->bclink.supportable = (max_pkt_info != 0); 2053 l_ptr->owner->bclink.supportable = (max_pkt_info != 0);
2134 2054
2135 /* Synchronize broadcast link info, if not done previously */ 2055 /* Synchronize broadcast link info, if not done previously */
2136
2137 if (!tipc_node_is_up(l_ptr->owner)) { 2056 if (!tipc_node_is_up(l_ptr->owner)) {
2138 l_ptr->owner->bclink.last_sent = 2057 l_ptr->owner->bclink.last_sent =
2139 l_ptr->owner->bclink.last_in = 2058 l_ptr->owner->bclink.last_in =
@@ -2185,7 +2104,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2185 } 2104 }
2186 2105
2187 /* Protocol message before retransmits, reduce loss risk */ 2106 /* Protocol message before retransmits, reduce loss risk */
2188
2189 if (l_ptr->owner->bclink.supported) 2107 if (l_ptr->owner->bclink.supported)
2190 tipc_bclink_update_link_state(l_ptr->owner, 2108 tipc_bclink_update_link_state(l_ptr->owner,
2191 msg_last_bcast(msg)); 2109 msg_last_bcast(msg));
@@ -2243,7 +2161,6 @@ static void tipc_link_tunnel(struct tipc_link *l_ptr,
2243 * changeover(): Send whole message queue via the remaining link 2161 * changeover(): Send whole message queue via the remaining link
2244 * Owner node is locked. 2162 * Owner node is locked.
2245 */ 2163 */
2246
2247void tipc_link_changeover(struct tipc_link *l_ptr) 2164void tipc_link_changeover(struct tipc_link *l_ptr)
2248{ 2165{
2249 u32 msgcount = l_ptr->out_queue_size; 2166 u32 msgcount = l_ptr->out_queue_size;
@@ -2343,8 +2260,6 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
2343 } 2260 }
2344} 2261}
2345 2262
2346
2347
2348/** 2263/**
2349 * buf_extract - extracts embedded TIPC message from another message 2264 * buf_extract - extracts embedded TIPC message from another message
2350 * @skb: encapsulating message buffer 2265 * @skb: encapsulating message buffer
@@ -2353,7 +2268,6 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
2353 * Returns a new message buffer containing an embedded message. The 2268 * Returns a new message buffer containing an embedded message. The
2354 * encapsulating message itself is left unchanged. 2269 * encapsulating message itself is left unchanged.
2355 */ 2270 */
2356
2357static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos) 2271static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
2358{ 2272{
2359 struct tipc_msg *msg = (struct tipc_msg *)(skb->data + from_pos); 2273 struct tipc_msg *msg = (struct tipc_msg *)(skb->data + from_pos);
@@ -2370,7 +2284,6 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
2370 * link_recv_changeover_msg(): Receive tunneled packet sent 2284 * link_recv_changeover_msg(): Receive tunneled packet sent
2371 * via other link. Node is locked. Return extracted buffer. 2285 * via other link. Node is locked. Return extracted buffer.
2372 */ 2286 */
2373
2374static int link_recv_changeover_msg(struct tipc_link **l_ptr, 2287static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2375 struct sk_buff **buf) 2288 struct sk_buff **buf)
2376{ 2289{
@@ -2405,7 +2318,6 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2405 } 2318 }
2406 2319
2407 /* First original message ?: */ 2320 /* First original message ?: */
2408
2409 if (tipc_link_is_up(dest_link)) { 2321 if (tipc_link_is_up(dest_link)) {
2410 info("Resetting link <%s>, changeover initiated by peer\n", 2322 info("Resetting link <%s>, changeover initiated by peer\n",
2411 dest_link->name); 2323 dest_link->name);
@@ -2420,7 +2332,6 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2420 } 2332 }
2421 2333
2422 /* Receive original message */ 2334 /* Receive original message */
2423
2424 if (dest_link->exp_msg_count == 0) { 2335 if (dest_link->exp_msg_count == 0) {
2425 warn("Link switchover error, " 2336 warn("Link switchover error, "
2426 "got too many tunnelled messages\n"); 2337 "got too many tunnelled messages\n");
@@ -2469,7 +2380,6 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2469 * Fragmentation/defragmentation: 2380 * Fragmentation/defragmentation:
2470 */ 2381 */
2471 2382
2472
2473/* 2383/*
2474 * link_send_long_buf: Entry for buffers needing fragmentation. 2384 * link_send_long_buf: Entry for buffers needing fragmentation.
2475 * The buffer is complete, inclusive total message length. 2385 * The buffer is complete, inclusive total message length.
@@ -2496,12 +2406,10 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2496 destaddr = msg_destnode(inmsg); 2406 destaddr = msg_destnode(inmsg);
2497 2407
2498 /* Prepare reusable fragment header: */ 2408 /* Prepare reusable fragment header: */
2499
2500 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, 2409 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
2501 INT_H_SIZE, destaddr); 2410 INT_H_SIZE, destaddr);
2502 2411
2503 /* Chop up message: */ 2412 /* Chop up message: */
2504
2505 while (rest > 0) { 2413 while (rest > 0) {
2506 struct sk_buff *fragm; 2414 struct sk_buff *fragm;
2507 2415
@@ -2535,7 +2443,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2535 kfree_skb(buf); 2443 kfree_skb(buf);
2536 2444
2537 /* Append chain of fragments to send queue & send them */ 2445 /* Append chain of fragments to send queue & send them */
2538
2539 l_ptr->long_msg_seq_no++; 2446 l_ptr->long_msg_seq_no++;
2540 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no); 2447 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
2541 l_ptr->stats.sent_fragments += fragm_no; 2448 l_ptr->stats.sent_fragments += fragm_no;
@@ -2551,7 +2458,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2551 * help storing these values in unused, available fields in the 2458 * help storing these values in unused, available fields in the
2552 * pending message. This makes dynamic memory allocation unnecessary. 2459 * pending message. This makes dynamic memory allocation unnecessary.
2553 */ 2460 */
2554
2555static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno) 2461static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
2556{ 2462{
2557 msg_set_seqno(buf_msg(buf), seqno); 2463 msg_set_seqno(buf_msg(buf), seqno);
@@ -2603,7 +2509,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2603 *fb = NULL; 2509 *fb = NULL;
2604 2510
2605 /* Is there an incomplete message waiting for this fragment? */ 2511 /* Is there an incomplete message waiting for this fragment? */
2606
2607 while (pbuf && ((buf_seqno(pbuf) != long_msg_seq_no) || 2512 while (pbuf && ((buf_seqno(pbuf) != long_msg_seq_no) ||
2608 (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) { 2513 (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) {
2609 prev = pbuf; 2514 prev = pbuf;
@@ -2629,7 +2534,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2629 skb_copy_to_linear_data(pbuf, imsg, 2534 skb_copy_to_linear_data(pbuf, imsg,
2630 msg_data_sz(fragm)); 2535 msg_data_sz(fragm));
2631 /* Prepare buffer for subsequent fragments. */ 2536 /* Prepare buffer for subsequent fragments. */
2632
2633 set_long_msg_seqno(pbuf, long_msg_seq_no); 2537 set_long_msg_seqno(pbuf, long_msg_seq_no);
2634 set_fragm_size(pbuf, fragm_sz); 2538 set_fragm_size(pbuf, fragm_sz);
2635 set_expected_frags(pbuf, exp_fragm_cnt - 1); 2539 set_expected_frags(pbuf, exp_fragm_cnt - 1);
@@ -2650,7 +2554,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2650 kfree_skb(fbuf); 2554 kfree_skb(fbuf);
2651 2555
2652 /* Is message complete? */ 2556 /* Is message complete? */
2653
2654 if (exp_frags == 0) { 2557 if (exp_frags == 0) {
2655 if (prev) 2558 if (prev)
2656 prev->next = pbuf->next; 2559 prev->next = pbuf->next;
@@ -2672,7 +2575,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2672 * link_check_defragm_bufs - flush stale incoming message fragments 2575 * link_check_defragm_bufs - flush stale incoming message fragments
2673 * @l_ptr: pointer to link 2576 * @l_ptr: pointer to link
2674 */ 2577 */
2675
2676static void link_check_defragm_bufs(struct tipc_link *l_ptr) 2578static void link_check_defragm_bufs(struct tipc_link *l_ptr)
2677{ 2579{
2678 struct sk_buff *prev = NULL; 2580 struct sk_buff *prev = NULL;
@@ -2701,8 +2603,6 @@ static void link_check_defragm_bufs(struct tipc_link *l_ptr)
2701 } 2603 }
2702} 2604}
2703 2605
2704
2705
2706static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance) 2606static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance)
2707{ 2607{
2708 if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL)) 2608 if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL))
@@ -2714,7 +2614,6 @@ static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance)
2714 l_ptr->abort_limit = tolerance / (l_ptr->continuity_interval / 4); 2614 l_ptr->abort_limit = tolerance / (l_ptr->continuity_interval / 4);
2715} 2615}
2716 2616
2717
2718void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window) 2617void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
2719{ 2618{
2720 /* Data messages from this node, inclusive FIRST_FRAGM */ 2619 /* Data messages from this node, inclusive FIRST_FRAGM */
@@ -2744,7 +2643,6 @@ void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
2744 * 2643 *
2745 * Returns pointer to link (or 0 if invalid link name). 2644 * Returns pointer to link (or 0 if invalid link name).
2746 */ 2645 */
2747
2748static struct tipc_link *link_find_link(const char *name, 2646static struct tipc_link *link_find_link(const char *name,
2749 struct tipc_node **node) 2647 struct tipc_node **node)
2750{ 2648{
@@ -2778,7 +2676,6 @@ static struct tipc_link *link_find_link(const char *name,
2778 * 2676 *
2779 * Returns 1 if value is within range, 0 if not. 2677 * Returns 1 if value is within range, 0 if not.
2780 */ 2678 */
2781
2782static int link_value_is_valid(u16 cmd, u32 new_value) 2679static int link_value_is_valid(u16 cmd, u32 new_value)
2783{ 2680{
2784 switch (cmd) { 2681 switch (cmd) {
@@ -2794,7 +2691,6 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
2794 return 0; 2691 return 0;
2795} 2692}
2796 2693
2797
2798/** 2694/**
2799 * link_cmd_set_value - change priority/tolerance/window for link/bearer/media 2695 * link_cmd_set_value - change priority/tolerance/window for link/bearer/media
2800 * @name - ptr to link, bearer, or media name 2696 * @name - ptr to link, bearer, or media name
@@ -2805,7 +2701,6 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
2805 * 2701 *
2806 * Returns 0 if value updated and negative value on error. 2702 * Returns 0 if value updated and negative value on error.
2807 */ 2703 */
2808
2809static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd) 2704static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd)
2810{ 2705{
2811 struct tipc_node *node; 2706 struct tipc_node *node;
@@ -2910,7 +2805,6 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
2910 * link_reset_statistics - reset link statistics 2805 * link_reset_statistics - reset link statistics
2911 * @l_ptr: pointer to link 2806 * @l_ptr: pointer to link
2912 */ 2807 */
2913
2914static void link_reset_statistics(struct tipc_link *l_ptr) 2808static void link_reset_statistics(struct tipc_link *l_ptr)
2915{ 2809{
2916 memset(&l_ptr->stats, 0, sizeof(l_ptr->stats)); 2810 memset(&l_ptr->stats, 0, sizeof(l_ptr->stats));
@@ -2951,7 +2845,6 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
2951/** 2845/**
2952 * percent - convert count to a percentage of total (rounding up or down) 2846 * percent - convert count to a percentage of total (rounding up or down)
2953 */ 2847 */
2954
2955static u32 percent(u32 count, u32 total) 2848static u32 percent(u32 count, u32 total)
2956{ 2849{
2957 return (count * 100 + (total / 2)) / total; 2850 return (count * 100 + (total / 2)) / total;
@@ -2965,7 +2858,6 @@ static u32 percent(u32 count, u32 total)
2965 * 2858 *
2966 * Returns length of print buffer data string (or 0 if error) 2859 * Returns length of print buffer data string (or 0 if error)
2967 */ 2860 */
2968
2969static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) 2861static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
2970{ 2862{
2971 struct print_buf pb; 2863 struct print_buf pb;
@@ -3087,7 +2979,6 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
3087 * 2979 *
3088 * If no active link can be found, uses default maximum packet size. 2980 * If no active link can be found, uses default maximum packet size.
3089 */ 2981 */
3090
3091u32 tipc_link_get_max_pkt(u32 dest, u32 selector) 2982u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
3092{ 2983{
3093 struct tipc_node *n_ptr; 2984 struct tipc_node *n_ptr;
@@ -3171,4 +3062,3 @@ print_state:
3171 tipc_printbuf_validate(buf); 3062 tipc_printbuf_validate(buf);
3172 info("%s", print_area); 3063 info("%s", print_area);
3173} 3064}
3174
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 73c18c140e1d..d6a60a963ce6 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -47,13 +47,11 @@
47/* 47/*
48 * Out-of-range value for link sequence numbers 48 * Out-of-range value for link sequence numbers
49 */ 49 */
50
51#define INVALID_LINK_SEQ 0x10000 50#define INVALID_LINK_SEQ 0x10000
52 51
53/* 52/*
54 * Link states 53 * Link states
55 */ 54 */
56
57#define WORKING_WORKING 560810u 55#define WORKING_WORKING 560810u
58#define WORKING_UNKNOWN 560811u 56#define WORKING_UNKNOWN 560811u
59#define RESET_UNKNOWN 560812u 57#define RESET_UNKNOWN 560812u
@@ -63,7 +61,6 @@
63 * Starting value for maximum packet size negotiation on unicast links 61 * Starting value for maximum packet size negotiation on unicast links
64 * (unless bearer MTU is less) 62 * (unless bearer MTU is less)
65 */ 63 */
66
67#define MAX_PKT_DEFAULT 1500 64#define MAX_PKT_DEFAULT 1500
68 65
69/** 66/**
@@ -114,7 +111,6 @@
114 * @defragm_buf: list of partially reassembled inbound message fragments 111 * @defragm_buf: list of partially reassembled inbound message fragments
115 * @stats: collects statistics regarding link activity 112 * @stats: collects statistics regarding link activity
116 */ 113 */
117
118struct tipc_link { 114struct tipc_link {
119 u32 addr; 115 u32 addr;
120 char name[TIPC_MAX_LINK_NAME]; 116 char name[TIPC_MAX_LINK_NAME];
@@ -255,7 +251,6 @@ void tipc_link_retransmit(struct tipc_link *l_ptr,
255/* 251/*
256 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) 252 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
257 */ 253 */
258
259static inline u32 buf_seqno(struct sk_buff *buf) 254static inline u32 buf_seqno(struct sk_buff *buf)
260{ 255{
261 return msg_seqno(buf_msg(buf)); 256 return msg_seqno(buf_msg(buf));
@@ -294,7 +289,6 @@ static inline u32 lesser(u32 left, u32 right)
294/* 289/*
295 * Link status checking routines 290 * Link status checking routines
296 */ 291 */
297
298static inline int link_working_working(struct tipc_link *l_ptr) 292static inline int link_working_working(struct tipc_link *l_ptr)
299{ 293{
300 return l_ptr->state == WORKING_WORKING; 294 return l_ptr->state == WORKING_WORKING;
diff --git a/net/tipc/log.c b/net/tipc/log.c
index 895c6e530b0b..026733f24919 100644
--- a/net/tipc/log.c
+++ b/net/tipc/log.c
@@ -47,7 +47,6 @@
47 * 47 *
48 * Additional user-defined print buffers are also permitted. 48 * Additional user-defined print buffers are also permitted.
49 */ 49 */
50
51static struct print_buf null_buf = { NULL, 0, NULL, 0 }; 50static struct print_buf null_buf = { NULL, 0, NULL, 0 };
52struct print_buf *const TIPC_NULL = &null_buf; 51struct print_buf *const TIPC_NULL = &null_buf;
53 52
@@ -72,7 +71,6 @@ struct print_buf *const TIPC_LOG = &log_buf;
72 * on the caller to prevent simultaneous use of the print buffer(s) being 71 * on the caller to prevent simultaneous use of the print buffer(s) being
73 * manipulated. 72 * manipulated.
74 */ 73 */
75
76static char print_string[TIPC_PB_MAX_STR]; 74static char print_string[TIPC_PB_MAX_STR];
77static DEFINE_SPINLOCK(print_lock); 75static DEFINE_SPINLOCK(print_lock);
78 76
@@ -97,7 +95,6 @@ static void tipc_printbuf_move(struct print_buf *pb_to,
97 * Note: If the character array is too small (or absent), the print buffer 95 * Note: If the character array is too small (or absent), the print buffer
98 * becomes a null device that discards anything written to it. 96 * becomes a null device that discards anything written to it.
99 */ 97 */
100
101void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size) 98void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size)
102{ 99{
103 pb->buf = raw; 100 pb->buf = raw;
@@ -117,7 +114,6 @@ void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size)
117 * tipc_printbuf_reset - reinitialize print buffer to empty state 114 * tipc_printbuf_reset - reinitialize print buffer to empty state
118 * @pb: pointer to print buffer structure 115 * @pb: pointer to print buffer structure
119 */ 116 */
120
121static void tipc_printbuf_reset(struct print_buf *pb) 117static void tipc_printbuf_reset(struct print_buf *pb)
122{ 118{
123 if (pb->buf) { 119 if (pb->buf) {
@@ -133,7 +129,6 @@ static void tipc_printbuf_reset(struct print_buf *pb)
133 * 129 *
134 * Returns non-zero if print buffer is empty. 130 * Returns non-zero if print buffer is empty.
135 */ 131 */
136
137static int tipc_printbuf_empty(struct print_buf *pb) 132static int tipc_printbuf_empty(struct print_buf *pb)
138{ 133{
139 return !pb->buf || (pb->crs == pb->buf); 134 return !pb->buf || (pb->crs == pb->buf);
@@ -148,7 +143,6 @@ static int tipc_printbuf_empty(struct print_buf *pb)
148 * 143 *
149 * Returns length of print buffer data string (including trailing NUL) 144 * Returns length of print buffer data string (including trailing NUL)
150 */ 145 */
151
152int tipc_printbuf_validate(struct print_buf *pb) 146int tipc_printbuf_validate(struct print_buf *pb)
153{ 147{
154 char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; 148 char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n";
@@ -182,14 +176,12 @@ int tipc_printbuf_validate(struct print_buf *pb)
182 * Current contents of destination print buffer (if any) are discarded. 176 * Current contents of destination print buffer (if any) are discarded.
183 * Source print buffer becomes empty if a successful move occurs. 177 * Source print buffer becomes empty if a successful move occurs.
184 */ 178 */
185
186static void tipc_printbuf_move(struct print_buf *pb_to, 179static void tipc_printbuf_move(struct print_buf *pb_to,
187 struct print_buf *pb_from) 180 struct print_buf *pb_from)
188{ 181{
189 int len; 182 int len;
190 183
191 /* Handle the cases where contents can't be moved */ 184 /* Handle the cases where contents can't be moved */
192
193 if (!pb_to->buf) 185 if (!pb_to->buf)
194 return; 186 return;
195 187
@@ -206,7 +198,6 @@ static void tipc_printbuf_move(struct print_buf *pb_to,
206 } 198 }
207 199
208 /* Copy data from char after cursor to end (if used) */ 200 /* Copy data from char after cursor to end (if used) */
209
210 len = pb_from->buf + pb_from->size - pb_from->crs - 2; 201 len = pb_from->buf + pb_from->size - pb_from->crs - 2;
211 if ((pb_from->buf[pb_from->size - 1] == 0) && (len > 0)) { 202 if ((pb_from->buf[pb_from->size - 1] == 0) && (len > 0)) {
212 strcpy(pb_to->buf, pb_from->crs + 1); 203 strcpy(pb_to->buf, pb_from->crs + 1);
@@ -215,7 +206,6 @@ static void tipc_printbuf_move(struct print_buf *pb_to,
215 pb_to->crs = pb_to->buf; 206 pb_to->crs = pb_to->buf;
216 207
217 /* Copy data from start to cursor (always) */ 208 /* Copy data from start to cursor (always) */
218
219 len = pb_from->crs - pb_from->buf; 209 len = pb_from->crs - pb_from->buf;
220 strcpy(pb_to->crs, pb_from->buf); 210 strcpy(pb_to->crs, pb_from->buf);
221 pb_to->crs += len; 211 pb_to->crs += len;
@@ -228,7 +218,6 @@ static void tipc_printbuf_move(struct print_buf *pb_to,
228 * @pb: pointer to print buffer 218 * @pb: pointer to print buffer
229 * @fmt: formatted info to be printed 219 * @fmt: formatted info to be printed
230 */ 220 */
231
232void tipc_printf(struct print_buf *pb, const char *fmt, ...) 221void tipc_printf(struct print_buf *pb, const char *fmt, ...)
233{ 222{
234 int chars_to_add; 223 int chars_to_add;
@@ -270,7 +259,6 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
270 * tipc_log_resize - change the size of the TIPC log buffer 259 * tipc_log_resize - change the size of the TIPC log buffer
271 * @log_size: print buffer size to use 260 * @log_size: print buffer size to use
272 */ 261 */
273
274int tipc_log_resize(int log_size) 262int tipc_log_resize(int log_size)
275{ 263{
276 int res = 0; 264 int res = 0;
@@ -295,7 +283,6 @@ int tipc_log_resize(int log_size)
295/** 283/**
296 * tipc_log_resize_cmd - reconfigure size of TIPC log buffer 284 * tipc_log_resize_cmd - reconfigure size of TIPC log buffer
297 */ 285 */
298
299struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area, int req_tlv_space) 286struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area, int req_tlv_space)
300{ 287{
301 u32 value; 288 u32 value;
@@ -316,7 +303,6 @@ struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area, int req_tlv_space)
316/** 303/**
317 * tipc_log_dump - capture TIPC log buffer contents in configuration message 304 * tipc_log_dump - capture TIPC log buffer contents in configuration message
318 */ 305 */
319
320struct sk_buff *tipc_log_dump(void) 306struct sk_buff *tipc_log_dump(void)
321{ 307{
322 struct sk_buff *reply; 308 struct sk_buff *reply;
diff --git a/net/tipc/log.h b/net/tipc/log.h
index 2248d96238e6..d1f5eb967fd8 100644
--- a/net/tipc/log.h
+++ b/net/tipc/log.h
@@ -44,7 +44,6 @@
44 * @crs: pointer to first unused space in character array (i.e. final NUL) 44 * @crs: pointer to first unused space in character array (i.e. final NUL)
45 * @echo: echo output to system console if non-zero 45 * @echo: echo output to system console if non-zero
46 */ 46 */
47
48struct print_buf { 47struct print_buf {
49 char *buf; 48 char *buf;
50 u32 size; 49 u32 size;
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index e3afe162c0ac..deea0d232dca 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -72,7 +72,6 @@ void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
72 * 72 *
73 * Returns message data size or errno 73 * Returns message data size or errno
74 */ 74 */
75
76int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, 75int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
77 u32 num_sect, unsigned int total_len, 76 u32 num_sect, unsigned int total_len,
78 int max_size, int usrmem, struct sk_buff **buf) 77 int max_size, int usrmem, struct sk_buff **buf)
@@ -112,7 +111,6 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
112} 111}
113 112
114#ifdef CONFIG_TIPC_DEBUG 113#ifdef CONFIG_TIPC_DEBUG
115
116void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str) 114void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str)
117{ 115{
118 u32 usr = msg_user(msg); 116 u32 usr = msg_user(msg);
@@ -352,5 +350,4 @@ void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str)
352 if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) 350 if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT))
353 tipc_msg_dbg(buf, msg_get_wrapped(msg), " /"); 351 tipc_msg_dbg(buf, msg_get_wrapped(msg), " /");
354} 352}
355
356#endif 353#endif
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index eba524e34a6b..ba2a72beea68 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -44,7 +44,6 @@
44 * 44 *
45 * Note: Some items are also used with TIPC internal message headers 45 * Note: Some items are also used with TIPC internal message headers
46 */ 46 */
47
48#define TIPC_VERSION 2 47#define TIPC_VERSION 2
49 48
50/* 49/*
@@ -58,7 +57,6 @@
58/* 57/*
59 * Payload message types 58 * Payload message types
60 */ 59 */
61
62#define TIPC_CONN_MSG 0 60#define TIPC_CONN_MSG 0
63#define TIPC_MCAST_MSG 1 61#define TIPC_MCAST_MSG 1
64#define TIPC_NAMED_MSG 2 62#define TIPC_NAMED_MSG 2
@@ -67,7 +65,6 @@
67/* 65/*
68 * Message header sizes 66 * Message header sizes
69 */ 67 */
70
71#define SHORT_H_SIZE 24 /* In-cluster basic payload message */ 68#define SHORT_H_SIZE 24 /* In-cluster basic payload message */
72#define BASIC_H_SIZE 32 /* Basic payload message */ 69#define BASIC_H_SIZE 32 /* Basic payload message */
73#define NAMED_H_SIZE 40 /* Named payload message */ 70#define NAMED_H_SIZE 40 /* Named payload message */
@@ -121,7 +118,6 @@ static inline void msg_swap_words(struct tipc_msg *msg, u32 a, u32 b)
121/* 118/*
122 * Word 0 119 * Word 0
123 */ 120 */
124
125static inline u32 msg_version(struct tipc_msg *m) 121static inline u32 msg_version(struct tipc_msg *m)
126{ 122{
127 return msg_bits(m, 0, 29, 7); 123 return msg_bits(m, 0, 29, 7);
@@ -216,7 +212,6 @@ static inline void msg_set_size(struct tipc_msg *m, u32 sz)
216/* 212/*
217 * Word 1 213 * Word 1
218 */ 214 */
219
220static inline u32 msg_type(struct tipc_msg *m) 215static inline u32 msg_type(struct tipc_msg *m)
221{ 216{
222 return msg_bits(m, 1, 29, 0x7); 217 return msg_bits(m, 1, 29, 0x7);
@@ -291,7 +286,6 @@ static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n)
291/* 286/*
292 * Word 2 287 * Word 2
293 */ 288 */
294
295static inline u32 msg_ack(struct tipc_msg *m) 289static inline u32 msg_ack(struct tipc_msg *m)
296{ 290{
297 return msg_bits(m, 2, 16, 0xffff); 291 return msg_bits(m, 2, 16, 0xffff);
@@ -315,8 +309,6 @@ static inline void msg_set_seqno(struct tipc_msg *m, u32 n)
315/* 309/*
316 * Words 3-10 310 * Words 3-10
317 */ 311 */
318
319
320static inline u32 msg_prevnode(struct tipc_msg *m) 312static inline u32 msg_prevnode(struct tipc_msg *m)
321{ 313{
322 return msg_word(m, 3); 314 return msg_word(m, 3);
@@ -434,7 +426,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
434 return (struct tipc_msg *)msg_data(m); 426 return (struct tipc_msg *)msg_data(m);
435} 427}
436 428
437
438/* 429/*
439 * Constants and routines used to read and write TIPC internal message headers 430 * Constants and routines used to read and write TIPC internal message headers
440 */ 431 */
@@ -442,7 +433,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
442/* 433/*
443 * Internal message users 434 * Internal message users
444 */ 435 */
445
446#define BCAST_PROTOCOL 5 436#define BCAST_PROTOCOL 5
447#define MSG_BUNDLER 6 437#define MSG_BUNDLER 6
448#define LINK_PROTOCOL 7 438#define LINK_PROTOCOL 7
@@ -456,7 +446,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
456/* 446/*
457 * Connection management protocol message types 447 * Connection management protocol message types
458 */ 448 */
459
460#define CONN_PROBE 0 449#define CONN_PROBE 0
461#define CONN_PROBE_REPLY 1 450#define CONN_PROBE_REPLY 1
462#define CONN_ACK 2 451#define CONN_ACK 2
@@ -464,14 +453,12 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
464/* 453/*
465 * Name distributor message types 454 * Name distributor message types
466 */ 455 */
467
468#define PUBLICATION 0 456#define PUBLICATION 0
469#define WITHDRAWAL 1 457#define WITHDRAWAL 1
470 458
471/* 459/*
472 * Segmentation message types 460 * Segmentation message types
473 */ 461 */
474
475#define FIRST_FRAGMENT 0 462#define FIRST_FRAGMENT 0
476#define FRAGMENT 1 463#define FRAGMENT 1
477#define LAST_FRAGMENT 2 464#define LAST_FRAGMENT 2
@@ -479,7 +466,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
479/* 466/*
480 * Link management protocol message types 467 * Link management protocol message types
481 */ 468 */
482
483#define STATE_MSG 0 469#define STATE_MSG 0
484#define RESET_MSG 1 470#define RESET_MSG 1
485#define ACTIVATE_MSG 2 471#define ACTIVATE_MSG 2
@@ -493,7 +479,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
493/* 479/*
494 * Config protocol message types 480 * Config protocol message types
495 */ 481 */
496
497#define DSC_REQ_MSG 0 482#define DSC_REQ_MSG 0
498#define DSC_RESP_MSG 1 483#define DSC_RESP_MSG 1
499 484
@@ -501,7 +486,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
501/* 486/*
502 * Word 1 487 * Word 1
503 */ 488 */
504
505static inline u32 msg_seq_gap(struct tipc_msg *m) 489static inline u32 msg_seq_gap(struct tipc_msg *m)
506{ 490{
507 return msg_bits(m, 1, 16, 0x1fff); 491 return msg_bits(m, 1, 16, 0x1fff);
@@ -526,7 +510,6 @@ static inline void msg_set_node_sig(struct tipc_msg *m, u32 n)
526/* 510/*
527 * Word 2 511 * Word 2
528 */ 512 */
529
530static inline u32 msg_dest_domain(struct tipc_msg *m) 513static inline u32 msg_dest_domain(struct tipc_msg *m)
531{ 514{
532 return msg_word(m, 2); 515 return msg_word(m, 2);
@@ -561,7 +544,6 @@ static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n)
561/* 544/*
562 * Word 4 545 * Word 4
563 */ 546 */
564
565static inline u32 msg_last_bcast(struct tipc_msg *m) 547static inline u32 msg_last_bcast(struct tipc_msg *m)
566{ 548{
567 return msg_bits(m, 4, 16, 0xffff); 549 return msg_bits(m, 4, 16, 0xffff);
@@ -628,7 +610,6 @@ static inline void msg_set_link_selector(struct tipc_msg *m, u32 n)
628/* 610/*
629 * Word 5 611 * Word 5
630 */ 612 */
631
632static inline u32 msg_session(struct tipc_msg *m) 613static inline u32 msg_session(struct tipc_msg *m)
633{ 614{
634 return msg_bits(m, 5, 16, 0xffff); 615 return msg_bits(m, 5, 16, 0xffff);
@@ -697,7 +678,6 @@ static inline char *msg_media_addr(struct tipc_msg *m)
697/* 678/*
698 * Word 9 679 * Word 9
699 */ 680 */
700
701static inline u32 msg_msgcnt(struct tipc_msg *m) 681static inline u32 msg_msgcnt(struct tipc_msg *m)
702{ 682{
703 return msg_bits(m, 9, 16, 0xffff); 683 return msg_bits(m, 9, 16, 0xffff);
@@ -744,5 +724,4 @@ void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
744int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, 724int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
745 u32 num_sect, unsigned int total_len, 725 u32 num_sect, unsigned int total_len,
746 int max_size, int usrmem, struct sk_buff **buf); 726 int max_size, int usrmem, struct sk_buff **buf);
747
748#endif 727#endif
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 211c1723a190..158318e67b08 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -58,7 +58,6 @@
58 * Note: There is no field that identifies the publishing node because it is 58 * Note: There is no field that identifies the publishing node because it is
59 * the same for all items contained within a publication message. 59 * the same for all items contained within a publication message.
60 */ 60 */
61
62struct distr_item { 61struct distr_item {
63 __be32 type; 62 __be32 type;
64 __be32 lower; 63 __be32 lower;
@@ -103,7 +102,6 @@ static struct publ_list *publ_lists[] = {
103/** 102/**
104 * publ_to_item - add publication info to a publication message 103 * publ_to_item - add publication info to a publication message
105 */ 104 */
106
107static void publ_to_item(struct distr_item *i, struct publication *p) 105static void publ_to_item(struct distr_item *i, struct publication *p)
108{ 106{
109 i->type = htonl(p->type); 107 i->type = htonl(p->type);
@@ -116,7 +114,6 @@ static void publ_to_item(struct distr_item *i, struct publication *p)
116/** 114/**
117 * named_prepare_buf - allocate & initialize a publication message 115 * named_prepare_buf - allocate & initialize a publication message
118 */ 116 */
119
120static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) 117static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
121{ 118{
122 struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE + size); 119 struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE + size);
@@ -151,7 +148,6 @@ static void named_cluster_distribute(struct sk_buff *buf)
151/** 148/**
152 * tipc_named_publish - tell other nodes about a new publication by this node 149 * tipc_named_publish - tell other nodes about a new publication by this node
153 */ 150 */
154
155void tipc_named_publish(struct publication *publ) 151void tipc_named_publish(struct publication *publ)
156{ 152{
157 struct sk_buff *buf; 153 struct sk_buff *buf;
@@ -177,7 +173,6 @@ void tipc_named_publish(struct publication *publ)
177/** 173/**
178 * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node 174 * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
179 */ 175 */
180
181void tipc_named_withdraw(struct publication *publ) 176void tipc_named_withdraw(struct publication *publ)
182{ 177{
183 struct sk_buff *buf; 178 struct sk_buff *buf;
@@ -236,7 +231,6 @@ static void named_distribute(struct list_head *message_list, u32 node,
236/** 231/**
237 * tipc_named_node_up - tell specified node about all publications by this node 232 * tipc_named_node_up - tell specified node about all publications by this node
238 */ 233 */
239
240void tipc_named_node_up(unsigned long nodearg) 234void tipc_named_node_up(unsigned long nodearg)
241{ 235{
242 struct tipc_node *n_ptr; 236 struct tipc_node *n_ptr;
@@ -246,7 +240,6 @@ void tipc_named_node_up(unsigned long nodearg)
246 u32 max_item_buf = 0; 240 u32 max_item_buf = 0;
247 241
248 /* compute maximum amount of publication data to send per message */ 242 /* compute maximum amount of publication data to send per message */
249
250 read_lock_bh(&tipc_net_lock); 243 read_lock_bh(&tipc_net_lock);
251 n_ptr = tipc_node_find(node); 244 n_ptr = tipc_node_find(node);
252 if (n_ptr) { 245 if (n_ptr) {
@@ -262,7 +255,6 @@ void tipc_named_node_up(unsigned long nodearg)
262 return; 255 return;
263 256
264 /* create list of publication messages, then send them as a unit */ 257 /* create list of publication messages, then send them as a unit */
265
266 INIT_LIST_HEAD(&message_list); 258 INIT_LIST_HEAD(&message_list);
267 259
268 read_lock_bh(&tipc_nametbl_lock); 260 read_lock_bh(&tipc_nametbl_lock);
@@ -279,7 +271,6 @@ void tipc_named_node_up(unsigned long nodearg)
279 * Invoked for each publication issued by a newly failed node. 271 * Invoked for each publication issued by a newly failed node.
280 * Removes publication structure from name table & deletes it. 272 * Removes publication structure from name table & deletes it.
281 */ 273 */
282
283static void named_purge_publ(struct publication *publ) 274static void named_purge_publ(struct publication *publ)
284{ 275{
285 struct publication *p; 276 struct publication *p;
@@ -303,7 +294,6 @@ static void named_purge_publ(struct publication *publ)
303/** 294/**
304 * tipc_named_recv - process name table update message sent by another node 295 * tipc_named_recv - process name table update message sent by another node
305 */ 296 */
306
307void tipc_named_recv(struct sk_buff *buf) 297void tipc_named_recv(struct sk_buff *buf)
308{ 298{
309 struct publication *publ; 299 struct publication *publ;
@@ -361,7 +351,6 @@ void tipc_named_recv(struct sk_buff *buf)
361 * All name table entries published by this node are updated to reflect 351 * All name table entries published by this node are updated to reflect
362 * the node's new network address. 352 * the node's new network address.
363 */ 353 */
364
365void tipc_named_reinit(void) 354void tipc_named_reinit(void)
366{ 355{
367 struct publication *publ; 356 struct publication *publ;
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 4de58dece9b2..010f24a59da2 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -56,7 +56,6 @@ static int tipc_nametbl_size = 1024; /* must be a power of 2 */
56 * publications of the associated name sequence belong to it. 56 * publications of the associated name sequence belong to it.
57 * (The cluster and node lists may be empty.) 57 * (The cluster and node lists may be empty.)
58 */ 58 */
59
60struct name_info { 59struct name_info {
61 struct list_head node_list; 60 struct list_head node_list;
62 struct list_head cluster_list; 61 struct list_head cluster_list;
@@ -72,7 +71,6 @@ struct name_info {
72 * @upper: name sequence upper bound 71 * @upper: name sequence upper bound
73 * @info: pointer to name sequence publication info 72 * @info: pointer to name sequence publication info
74 */ 73 */
75
76struct sub_seq { 74struct sub_seq {
77 u32 lower; 75 u32 lower;
78 u32 upper; 76 u32 upper;
@@ -90,7 +88,6 @@ struct sub_seq {
90 * @subscriptions: list of subscriptions for this 'type' 88 * @subscriptions: list of subscriptions for this 'type'
91 * @lock: spinlock controlling access to publication lists of all sub-sequences 89 * @lock: spinlock controlling access to publication lists of all sub-sequences
92 */ 90 */
93
94struct name_seq { 91struct name_seq {
95 u32 type; 92 u32 type;
96 struct sub_seq *sseqs; 93 struct sub_seq *sseqs;
@@ -107,7 +104,6 @@ struct name_seq {
107 * accessed via hashing on 'type'; name sequence lists are *not* sorted 104 * accessed via hashing on 'type'; name sequence lists are *not* sorted
108 * @local_publ_count: number of publications issued by this node 105 * @local_publ_count: number of publications issued by this node
109 */ 106 */
110
111struct name_table { 107struct name_table {
112 struct hlist_head *types; 108 struct hlist_head *types;
113 u32 local_publ_count; 109 u32 local_publ_count;
@@ -124,7 +120,6 @@ static int hash(int x)
124/** 120/**
125 * publ_create - create a publication structure 121 * publ_create - create a publication structure
126 */ 122 */
127
128static struct publication *publ_create(u32 type, u32 lower, u32 upper, 123static struct publication *publ_create(u32 type, u32 lower, u32 upper,
129 u32 scope, u32 node, u32 port_ref, 124 u32 scope, u32 node, u32 port_ref,
130 u32 key) 125 u32 key)
@@ -151,7 +146,6 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
151/** 146/**
152 * tipc_subseq_alloc - allocate a specified number of sub-sequence structures 147 * tipc_subseq_alloc - allocate a specified number of sub-sequence structures
153 */ 148 */
154
155static struct sub_seq *tipc_subseq_alloc(u32 cnt) 149static struct sub_seq *tipc_subseq_alloc(u32 cnt)
156{ 150{
157 struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC); 151 struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC);
@@ -163,7 +157,6 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt)
163 * 157 *
164 * Allocates a single sub-sequence structure and sets it to all 0's. 158 * Allocates a single sub-sequence structure and sets it to all 0's.
165 */ 159 */
166
167static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) 160static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
168{ 161{
169 struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC); 162 struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC);
@@ -203,7 +196,6 @@ static void nameseq_delete_empty(struct name_seq *seq)
203 * 196 *
204 * Very time-critical, so binary searches through sub-sequence array. 197 * Very time-critical, so binary searches through sub-sequence array.
205 */ 198 */
206
207static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, 199static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
208 u32 instance) 200 u32 instance)
209{ 201{
@@ -233,7 +225,6 @@ static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
233 * 225 *
234 * Note: Similar to binary search code for locating a sub-sequence. 226 * Note: Similar to binary search code for locating a sub-sequence.
235 */ 227 */
236
237static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) 228static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
238{ 229{
239 struct sub_seq *sseqs = nseq->sseqs; 230 struct sub_seq *sseqs = nseq->sseqs;
@@ -254,9 +245,8 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
254} 245}
255 246
256/** 247/**
257 * tipc_nameseq_insert_publ - 248 * tipc_nameseq_insert_publ
258 */ 249 */
259
260static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, 250static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
261 u32 type, u32 lower, u32 upper, 251 u32 type, u32 lower, u32 upper,
262 u32 scope, u32 node, u32 port, u32 key) 252 u32 scope, u32 node, u32 port, u32 key)
@@ -272,7 +262,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
272 if (sseq) { 262 if (sseq) {
273 263
274 /* Lower end overlaps existing entry => need an exact match */ 264 /* Lower end overlaps existing entry => need an exact match */
275
276 if ((sseq->lower != lower) || (sseq->upper != upper)) { 265 if ((sseq->lower != lower) || (sseq->upper != upper)) {
277 warn("Cannot publish {%u,%u,%u}, overlap error\n", 266 warn("Cannot publish {%u,%u,%u}, overlap error\n",
278 type, lower, upper); 267 type, lower, upper);
@@ -292,11 +281,9 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
292 struct sub_seq *freesseq; 281 struct sub_seq *freesseq;
293 282
294 /* Find where lower end should be inserted */ 283 /* Find where lower end should be inserted */
295
296 inspos = nameseq_locate_subseq(nseq, lower); 284 inspos = nameseq_locate_subseq(nseq, lower);
297 285
298 /* Fail if upper end overlaps into an existing entry */ 286 /* Fail if upper end overlaps into an existing entry */
299
300 if ((inspos < nseq->first_free) && 287 if ((inspos < nseq->first_free) &&
301 (upper >= nseq->sseqs[inspos].lower)) { 288 (upper >= nseq->sseqs[inspos].lower)) {
302 warn("Cannot publish {%u,%u,%u}, overlap error\n", 289 warn("Cannot publish {%u,%u,%u}, overlap error\n",
@@ -305,7 +292,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
305 } 292 }
306 293
307 /* Ensure there is space for new sub-sequence */ 294 /* Ensure there is space for new sub-sequence */
308
309 if (nseq->first_free == nseq->alloc) { 295 if (nseq->first_free == nseq->alloc) {
310 struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2); 296 struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2);
311 297
@@ -333,7 +319,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
333 INIT_LIST_HEAD(&info->zone_list); 319 INIT_LIST_HEAD(&info->zone_list);
334 320
335 /* Insert new sub-sequence */ 321 /* Insert new sub-sequence */
336
337 sseq = &nseq->sseqs[inspos]; 322 sseq = &nseq->sseqs[inspos];
338 freesseq = &nseq->sseqs[nseq->first_free]; 323 freesseq = &nseq->sseqs[nseq->first_free];
339 memmove(sseq + 1, sseq, (freesseq - sseq) * sizeof(*sseq)); 324 memmove(sseq + 1, sseq, (freesseq - sseq) * sizeof(*sseq));
@@ -345,8 +330,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
345 created_subseq = 1; 330 created_subseq = 1;
346 } 331 }
347 332
348 /* Insert a publication: */ 333 /* Insert a publication */
349
350 publ = publ_create(type, lower, upper, scope, node, port, key); 334 publ = publ_create(type, lower, upper, scope, node, port, key);
351 if (!publ) 335 if (!publ)
352 return NULL; 336 return NULL;
@@ -364,9 +348,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
364 info->node_list_size++; 348 info->node_list_size++;
365 } 349 }
366 350
367 /* 351 /* Any subscriptions waiting for notification? */
368 * Any subscriptions waiting for notification?
369 */
370 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { 352 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
371 tipc_subscr_report_overlap(s, 353 tipc_subscr_report_overlap(s,
372 publ->lower, 354 publ->lower,
@@ -380,7 +362,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
380} 362}
381 363
382/** 364/**
383 * tipc_nameseq_remove_publ - 365 * tipc_nameseq_remove_publ
384 * 366 *
385 * NOTE: There may be cases where TIPC is asked to remove a publication 367 * NOTE: There may be cases where TIPC is asked to remove a publication
386 * that is not in the name table. For example, if another node issues a 368 * that is not in the name table. For example, if another node issues a
@@ -390,7 +372,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
390 * A failed withdraw request simply returns a failure indication and lets the 372 * A failed withdraw request simply returns a failure indication and lets the
391 * caller issue any error or warning messages associated with such a problem. 373 * caller issue any error or warning messages associated with such a problem.
392 */ 374 */
393
394static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, 375static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
395 u32 node, u32 ref, u32 key) 376 u32 node, u32 ref, u32 key)
396{ 377{
@@ -407,7 +388,6 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i
407 info = sseq->info; 388 info = sseq->info;
408 389
409 /* Locate publication, if it exists */ 390 /* Locate publication, if it exists */
410
411 list_for_each_entry(publ, &info->zone_list, zone_list) { 391 list_for_each_entry(publ, &info->zone_list, zone_list) {
412 if ((publ->key == key) && (publ->ref == ref) && 392 if ((publ->key == key) && (publ->ref == ref) &&
413 (!publ->node || (publ->node == node))) 393 (!publ->node || (publ->node == node)))
@@ -417,26 +397,22 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i
417 397
418found: 398found:
419 /* Remove publication from zone scope list */ 399 /* Remove publication from zone scope list */
420
421 list_del(&publ->zone_list); 400 list_del(&publ->zone_list);
422 info->zone_list_size--; 401 info->zone_list_size--;
423 402
424 /* Remove publication from cluster scope list, if present */ 403 /* Remove publication from cluster scope list, if present */
425
426 if (in_own_cluster(node)) { 404 if (in_own_cluster(node)) {
427 list_del(&publ->cluster_list); 405 list_del(&publ->cluster_list);
428 info->cluster_list_size--; 406 info->cluster_list_size--;
429 } 407 }
430 408
431 /* Remove publication from node scope list, if present */ 409 /* Remove publication from node scope list, if present */
432
433 if (in_own_node(node)) { 410 if (in_own_node(node)) {
434 list_del(&publ->node_list); 411 list_del(&publ->node_list);
435 info->node_list_size--; 412 info->node_list_size--;
436 } 413 }
437 414
438 /* Contract subseq list if no more publications for that subseq */ 415 /* Contract subseq list if no more publications for that subseq */
439
440 if (list_empty(&info->zone_list)) { 416 if (list_empty(&info->zone_list)) {
441 kfree(info); 417 kfree(info);
442 free = &nseq->sseqs[nseq->first_free--]; 418 free = &nseq->sseqs[nseq->first_free--];
@@ -445,7 +421,6 @@ found:
445 } 421 }
446 422
447 /* Notify any waiting subscriptions */ 423 /* Notify any waiting subscriptions */
448
449 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { 424 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
450 tipc_subscr_report_overlap(s, 425 tipc_subscr_report_overlap(s,
451 publ->lower, 426 publ->lower,
@@ -464,7 +439,6 @@ found:
464 * the prescribed number of events if there is any sub- 439 * the prescribed number of events if there is any sub-
465 * sequence overlapping with the requested sequence 440 * sequence overlapping with the requested sequence
466 */ 441 */
467
468static void tipc_nameseq_subscribe(struct name_seq *nseq, 442static void tipc_nameseq_subscribe(struct name_seq *nseq,
469 struct tipc_subscription *s) 443 struct tipc_subscription *s)
470{ 444{
@@ -559,7 +533,6 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
559 * - if name translation is attempted and fails, sets 'destnode' to 0 533 * - if name translation is attempted and fails, sets 'destnode' to 0
560 * and returns 0 534 * and returns 0
561 */ 535 */
562
563u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) 536u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
564{ 537{
565 struct sub_seq *sseq; 538 struct sub_seq *sseq;
@@ -582,7 +555,7 @@ u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
582 spin_lock_bh(&seq->lock); 555 spin_lock_bh(&seq->lock);
583 info = sseq->info; 556 info = sseq->info;
584 557
585 /* Closest-First Algorithm: */ 558 /* Closest-First Algorithm */
586 if (likely(!*destnode)) { 559 if (likely(!*destnode)) {
587 if (!list_empty(&info->node_list)) { 560 if (!list_empty(&info->node_list)) {
588 publ = list_first_entry(&info->node_list, 561 publ = list_first_entry(&info->node_list,
@@ -605,7 +578,7 @@ u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
605 } 578 }
606 } 579 }
607 580
608 /* Round-Robin Algorithm: */ 581 /* Round-Robin Algorithm */
609 else if (*destnode == tipc_own_addr) { 582 else if (*destnode == tipc_own_addr) {
610 if (list_empty(&info->node_list)) 583 if (list_empty(&info->node_list))
611 goto no_match; 584 goto no_match;
@@ -646,7 +619,6 @@ not_found:
646 * 619 *
647 * Returns non-zero if any off-node ports overlap 620 * Returns non-zero if any off-node ports overlap
648 */ 621 */
649
650int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, 622int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
651 struct tipc_port_list *dports) 623 struct tipc_port_list *dports)
652{ 624{
@@ -690,7 +662,6 @@ exit:
690/* 662/*
691 * tipc_nametbl_publish - add name publication to network name tables 663 * tipc_nametbl_publish - add name publication to network name tables
692 */ 664 */
693
694struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, 665struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
695 u32 scope, u32 port_ref, u32 key) 666 u32 scope, u32 port_ref, u32 key)
696{ 667{
@@ -716,7 +687,6 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
716/** 687/**
717 * tipc_nametbl_withdraw - withdraw name publication from network name tables 688 * tipc_nametbl_withdraw - withdraw name publication from network name tables
718 */ 689 */
719
720int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) 690int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
721{ 691{
722 struct publication *publ; 692 struct publication *publ;
@@ -741,7 +711,6 @@ int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
741/** 711/**
742 * tipc_nametbl_subscribe - add a subscription object to the name table 712 * tipc_nametbl_subscribe - add a subscription object to the name table
743 */ 713 */
744
745void tipc_nametbl_subscribe(struct tipc_subscription *s) 714void tipc_nametbl_subscribe(struct tipc_subscription *s)
746{ 715{
747 u32 type = s->seq.type; 716 u32 type = s->seq.type;
@@ -765,7 +734,6 @@ void tipc_nametbl_subscribe(struct tipc_subscription *s)
765/** 734/**
766 * tipc_nametbl_unsubscribe - remove a subscription object from name table 735 * tipc_nametbl_unsubscribe - remove a subscription object from name table
767 */ 736 */
768
769void tipc_nametbl_unsubscribe(struct tipc_subscription *s) 737void tipc_nametbl_unsubscribe(struct tipc_subscription *s)
770{ 738{
771 struct name_seq *seq; 739 struct name_seq *seq;
@@ -785,7 +753,6 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *s)
785/** 753/**
786 * subseq_list: print specified sub-sequence contents into the given buffer 754 * subseq_list: print specified sub-sequence contents into the given buffer
787 */ 755 */
788
789static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth, 756static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
790 u32 index) 757 u32 index)
791{ 758{
@@ -822,7 +789,6 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
822/** 789/**
823 * nameseq_list: print specified name sequence contents into the given buffer 790 * nameseq_list: print specified name sequence contents into the given buffer
824 */ 791 */
825
826static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth, 792static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
827 u32 type, u32 lowbound, u32 upbound, u32 index) 793 u32 type, u32 lowbound, u32 upbound, u32 index)
828{ 794{
@@ -853,7 +819,6 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
853/** 819/**
854 * nametbl_header - print name table header into the given buffer 820 * nametbl_header - print name table header into the given buffer
855 */ 821 */
856
857static void nametbl_header(struct print_buf *buf, u32 depth) 822static void nametbl_header(struct print_buf *buf, u32 depth)
858{ 823{
859 const char *header[] = { 824 const char *header[] = {
@@ -875,7 +840,6 @@ static void nametbl_header(struct print_buf *buf, u32 depth)
875/** 840/**
876 * nametbl_list - print specified name table contents into the given buffer 841 * nametbl_list - print specified name table contents into the given buffer
877 */ 842 */
878
879static void nametbl_list(struct print_buf *buf, u32 depth_info, 843static void nametbl_list(struct print_buf *buf, u32 depth_info,
880 u32 type, u32 lowbound, u32 upbound) 844 u32 type, u32 lowbound, u32 upbound)
881{ 845{
@@ -974,7 +938,6 @@ void tipc_nametbl_stop(void)
974 return; 938 return;
975 939
976 /* Verify name table is empty, then release it */ 940 /* Verify name table is empty, then release it */
977
978 write_lock_bh(&tipc_nametbl_lock); 941 write_lock_bh(&tipc_nametbl_lock);
979 for (i = 0; i < tipc_nametbl_size; i++) { 942 for (i = 0; i < tipc_nametbl_size; i++) {
980 if (!hlist_empty(&table.types[i])) 943 if (!hlist_empty(&table.types[i]))
@@ -984,4 +947,3 @@ void tipc_nametbl_stop(void)
984 table.types = NULL; 947 table.types = NULL;
985 write_unlock_bh(&tipc_nametbl_lock); 948 write_unlock_bh(&tipc_nametbl_lock);
986} 949}
987
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index 207d59ebf849..71cb4dc712df 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -45,10 +45,8 @@ struct tipc_port_list;
45/* 45/*
46 * TIPC name types reserved for internal TIPC use (both current and planned) 46 * TIPC name types reserved for internal TIPC use (both current and planned)
47 */ 47 */
48
49#define TIPC_ZM_SRV 3 /* zone master service name type */ 48#define TIPC_ZM_SRV 3 /* zone master service name type */
50 49
51
52/** 50/**
53 * struct publication - info about a published (name or) name sequence 51 * struct publication - info about a published (name or) name sequence
54 * @type: name sequence type 52 * @type: name sequence type
@@ -67,7 +65,6 @@ struct tipc_port_list;
67 * 65 *
68 * Note that the node list, cluster list, and zone list are circular lists. 66 * Note that the node list, cluster list, and zone list are circular lists.
69 */ 67 */
70
71struct publication { 68struct publication {
72 u32 type; 69 u32 type;
73 u32 lower; 70 u32 lower;
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 76565c9916ab..d4fd341e6e0d 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -66,7 +66,6 @@ static unsigned int tipc_hashfn(u32 addr)
66/* 66/*
67 * tipc_node_find - locate specified node object, if it exists 67 * tipc_node_find - locate specified node object, if it exists
68 */ 68 */
69
70struct tipc_node *tipc_node_find(u32 addr) 69struct tipc_node *tipc_node_find(u32 addr)
71{ 70{
72 struct tipc_node *node; 71 struct tipc_node *node;
@@ -91,7 +90,6 @@ struct tipc_node *tipc_node_find(u32 addr)
91 * time. (It would be preferable to switch to holding net_lock in write mode, 90 * time. (It would be preferable to switch to holding net_lock in write mode,
92 * but this is a non-trivial change.) 91 * but this is a non-trivial change.)
93 */ 92 */
94
95struct tipc_node *tipc_node_create(u32 addr) 93struct tipc_node *tipc_node_create(u32 addr)
96{ 94{
97 struct tipc_node *n_ptr, *temp_node; 95 struct tipc_node *n_ptr, *temp_node;
@@ -142,13 +140,11 @@ void tipc_node_delete(struct tipc_node *n_ptr)
142 tipc_num_nodes--; 140 tipc_num_nodes--;
143} 141}
144 142
145
146/** 143/**
147 * tipc_node_link_up - handle addition of link 144 * tipc_node_link_up - handle addition of link
148 * 145 *
149 * Link becomes active (alone or shared) or standby, depending on its priority. 146 * Link becomes active (alone or shared) or standby, depending on its priority.
150 */ 147 */
151
152void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) 148void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
153{ 149{
154 struct tipc_link **active = &n_ptr->active_links[0]; 150 struct tipc_link **active = &n_ptr->active_links[0];
@@ -181,7 +177,6 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
181/** 177/**
182 * node_select_active_links - select active link 178 * node_select_active_links - select active link
183 */ 179 */
184
185static void node_select_active_links(struct tipc_node *n_ptr) 180static void node_select_active_links(struct tipc_node *n_ptr)
186{ 181{
187 struct tipc_link **active = &n_ptr->active_links[0]; 182 struct tipc_link **active = &n_ptr->active_links[0];
@@ -209,7 +204,6 @@ static void node_select_active_links(struct tipc_node *n_ptr)
209/** 204/**
210 * tipc_node_link_down - handle loss of link 205 * tipc_node_link_down - handle loss of link
211 */ 206 */
212
213void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) 207void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
214{ 208{
215 struct tipc_link **active; 209 struct tipc_link **active;
@@ -300,7 +294,6 @@ static void node_lost_contact(struct tipc_node *n_ptr)
300 tipc_addr_string_fill(addr_string, n_ptr->addr)); 294 tipc_addr_string_fill(addr_string, n_ptr->addr));
301 295
302 /* Flush broadcast link info associated with lost node */ 296 /* Flush broadcast link info associated with lost node */
303
304 if (n_ptr->bclink.supported) { 297 if (n_ptr->bclink.supported) {
305 while (n_ptr->bclink.deferred_head) { 298 while (n_ptr->bclink.deferred_head) {
306 struct sk_buff *buf = n_ptr->bclink.deferred_head; 299 struct sk_buff *buf = n_ptr->bclink.deferred_head;
@@ -334,7 +327,6 @@ static void node_lost_contact(struct tipc_node *n_ptr)
334 tipc_nodesub_notify(n_ptr); 327 tipc_nodesub_notify(n_ptr);
335 328
336 /* Prevent re-contact with node until cleanup is done */ 329 /* Prevent re-contact with node until cleanup is done */
337
338 n_ptr->block_setup = WAIT_PEER_DOWN | WAIT_NAMES_GONE; 330 n_ptr->block_setup = WAIT_PEER_DOWN | WAIT_NAMES_GONE;
339 tipc_k_signal((Handler)node_name_purge_complete, n_ptr->addr); 331 tipc_k_signal((Handler)node_name_purge_complete, n_ptr->addr);
340} 332}
@@ -362,7 +354,6 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
362 } 354 }
363 355
364 /* For now, get space for all other nodes */ 356 /* For now, get space for all other nodes */
365
366 payload_size = TLV_SPACE(sizeof(node_info)) * tipc_num_nodes; 357 payload_size = TLV_SPACE(sizeof(node_info)) * tipc_num_nodes;
367 if (payload_size > 32768u) { 358 if (payload_size > 32768u) {
368 read_unlock_bh(&tipc_net_lock); 359 read_unlock_bh(&tipc_net_lock);
@@ -376,7 +367,6 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
376 } 367 }
377 368
378 /* Add TLVs for all nodes in scope */ 369 /* Add TLVs for all nodes in scope */
379
380 list_for_each_entry(n_ptr, &tipc_node_list, list) { 370 list_for_each_entry(n_ptr, &tipc_node_list, list) {
381 if (!tipc_in_scope(domain, n_ptr->addr)) 371 if (!tipc_in_scope(domain, n_ptr->addr))
382 continue; 372 continue;
@@ -412,7 +402,6 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
412 read_lock_bh(&tipc_net_lock); 402 read_lock_bh(&tipc_net_lock);
413 403
414 /* Get space for all unicast links + broadcast link */ 404 /* Get space for all unicast links + broadcast link */
415
416 payload_size = TLV_SPACE(sizeof(link_info)) * 405 payload_size = TLV_SPACE(sizeof(link_info)) *
417 (atomic_read(&tipc_num_links) + 1); 406 (atomic_read(&tipc_num_links) + 1);
418 if (payload_size > 32768u) { 407 if (payload_size > 32768u) {
@@ -427,14 +416,12 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
427 } 416 }
428 417
429 /* Add TLV for broadcast link */ 418 /* Add TLV for broadcast link */
430
431 link_info.dest = htonl(tipc_cluster_mask(tipc_own_addr)); 419 link_info.dest = htonl(tipc_cluster_mask(tipc_own_addr));
432 link_info.up = htonl(1); 420 link_info.up = htonl(1);
433 strlcpy(link_info.str, tipc_bclink_name, TIPC_MAX_LINK_NAME); 421 strlcpy(link_info.str, tipc_bclink_name, TIPC_MAX_LINK_NAME);
434 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); 422 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
435 423
436 /* Add TLVs for any other links in scope */ 424 /* Add TLVs for any other links in scope */
437
438 list_for_each_entry(n_ptr, &tipc_node_list, list) { 425 list_for_each_entry(n_ptr, &tipc_node_list, list) {
439 u32 i; 426 u32 i;
440 427
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 72561c971d67..cfcaf4d6e480 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -48,7 +48,6 @@
48#define INVALID_NODE_SIG 0x10000 48#define INVALID_NODE_SIG 0x10000
49 49
50/* Flags used to block (re)establishment of contact with a neighboring node */ 50/* Flags used to block (re)establishment of contact with a neighboring node */
51
52#define WAIT_PEER_DOWN 0x0001 /* wait to see that peer's links are down */ 51#define WAIT_PEER_DOWN 0x0001 /* wait to see that peer's links are down */
53#define WAIT_NAMES_GONE 0x0002 /* wait for peer's publications to be purged */ 52#define WAIT_NAMES_GONE 0x0002 /* wait for peer's publications to be purged */
54#define WAIT_NODE_DOWN 0x0004 /* wait until peer node is declared down */ 53#define WAIT_NODE_DOWN 0x0004 /* wait until peer node is declared down */
@@ -79,7 +78,6 @@
79 * @deferred_tail: newest OOS b'cast message received from node 78 * @deferred_tail: newest OOS b'cast message received from node
80 * @defragm: list of partially reassembled b'cast message fragments from node 79 * @defragm: list of partially reassembled b'cast message fragments from node
81 */ 80 */
82
83struct tipc_node { 81struct tipc_node {
84 u32 addr; 82 u32 addr;
85 spinlock_t lock; 83 spinlock_t lock;
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c
index 327ffbbfee00..7a27344108fe 100644
--- a/net/tipc/node_subscr.c
+++ b/net/tipc/node_subscr.c
@@ -41,7 +41,6 @@
41/** 41/**
42 * tipc_nodesub_subscribe - create "node down" subscription for specified node 42 * tipc_nodesub_subscribe - create "node down" subscription for specified node
43 */ 43 */
44
45void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr, 44void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr,
46 void *usr_handle, net_ev_handler handle_down) 45 void *usr_handle, net_ev_handler handle_down)
47{ 46{
@@ -66,7 +65,6 @@ void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr,
66/** 65/**
67 * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any) 66 * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any)
68 */ 67 */
69
70void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub) 68void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub)
71{ 69{
72 if (!node_sub->node) 70 if (!node_sub->node)
@@ -82,7 +80,6 @@ void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub)
82 * 80 *
83 * Note: node is locked by caller 81 * Note: node is locked by caller
84 */ 82 */
85
86void tipc_nodesub_notify(struct tipc_node *node) 83void tipc_nodesub_notify(struct tipc_node *node)
87{ 84{
88 struct tipc_node_subscr *ns; 85 struct tipc_node_subscr *ns;
diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h
index 4bc2ca0867a1..c95d20727ded 100644
--- a/net/tipc/node_subscr.h
+++ b/net/tipc/node_subscr.h
@@ -48,7 +48,6 @@ typedef void (*net_ev_handler) (void *usr_handle);
48 * @usr_handle: argument to pass to routine when node fails 48 * @usr_handle: argument to pass to routine when node fails
49 * @nodesub_list: adjacent entries in list of subscriptions for the node 49 * @nodesub_list: adjacent entries in list of subscriptions for the node
50 */ 50 */
51
52struct tipc_node_subscr { 51struct tipc_node_subscr {
53 struct tipc_node *node; 52 struct tipc_node *node;
54 net_ev_handler handle_node_down; 53 net_ev_handler handle_node_down;
diff --git a/net/tipc/port.c b/net/tipc/port.c
index e6841706967c..2ad37a4db376 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -75,7 +75,6 @@ static u32 port_peerport(struct tipc_port *p_ptr)
75 * Handles cases where the node's network address has changed from 75 * Handles cases where the node's network address has changed from
76 * the default of <0.0.0> to its configured setting. 76 * the default of <0.0.0> to its configured setting.
77 */ 77 */
78
79int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg) 78int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg)
80{ 79{
81 u32 peernode; 80 u32 peernode;
@@ -94,7 +93,6 @@ int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg)
94/** 93/**
95 * tipc_multicast - send a multicast message to local and remote destinations 94 * tipc_multicast - send a multicast message to local and remote destinations
96 */ 95 */
97
98int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, 96int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
99 u32 num_sect, struct iovec const *msg_sect, 97 u32 num_sect, struct iovec const *msg_sect,
100 unsigned int total_len) 98 unsigned int total_len)
@@ -111,7 +109,6 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
111 return -EINVAL; 109 return -EINVAL;
112 110
113 /* Create multicast message */ 111 /* Create multicast message */
114
115 hdr = &oport->phdr; 112 hdr = &oport->phdr;
116 msg_set_type(hdr, TIPC_MCAST_MSG); 113 msg_set_type(hdr, TIPC_MCAST_MSG);
117 msg_set_lookup_scope(hdr, TIPC_CLUSTER_SCOPE); 114 msg_set_lookup_scope(hdr, TIPC_CLUSTER_SCOPE);
@@ -127,12 +124,10 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
127 return res; 124 return res;
128 125
129 /* Figure out where to send multicast message */ 126 /* Figure out where to send multicast message */
130
131 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,
132 TIPC_NODE_SCOPE, &dports); 128 TIPC_NODE_SCOPE, &dports);
133 129
134 /* Send message to destinations (duplicate it only if necessary) */ 130 /* Send message to destinations (duplicate it only if necessary) */
135
136 if (ext_targets) { 131 if (ext_targets) {
137 if (dports.count != 0) { 132 if (dports.count != 0) {
138 ibuf = skb_copy(buf, GFP_ATOMIC); 133 ibuf = skb_copy(buf, GFP_ATOMIC);
@@ -163,7 +158,6 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
163 * 158 *
164 * If there is no port list, perform a lookup to create one 159 * If there is no port list, perform a lookup to create one
165 */ 160 */
166
167void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp) 161void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
168{ 162{
169 struct tipc_msg *msg; 163 struct tipc_msg *msg;
@@ -174,7 +168,6 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
174 msg = buf_msg(buf); 168 msg = buf_msg(buf);
175 169
176 /* Create destination port list, if one wasn't supplied */ 170 /* Create destination port list, if one wasn't supplied */
177
178 if (dp == NULL) { 171 if (dp == NULL) {
179 tipc_nametbl_mc_translate(msg_nametype(msg), 172 tipc_nametbl_mc_translate(msg_nametype(msg),
180 msg_namelower(msg), 173 msg_namelower(msg),
@@ -185,7 +178,6 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
185 } 178 }
186 179
187 /* Deliver a copy of message to each destination port */ 180 /* Deliver a copy of message to each destination port */
188
189 if (dp->count != 0) { 181 if (dp->count != 0) {
190 msg_set_destnode(msg, tipc_own_addr); 182 msg_set_destnode(msg, tipc_own_addr);
191 if (dp->count == 1) { 183 if (dp->count == 1) {
@@ -218,7 +210,6 @@ exit:
218 * 210 *
219 * Returns pointer to (locked) TIPC port, or NULL if unable to create it 211 * Returns pointer to (locked) TIPC port, or NULL if unable to create it
220 */ 212 */
221
222struct tipc_port *tipc_createport_raw(void *usr_handle, 213struct tipc_port *tipc_createport_raw(void *usr_handle,
223 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), 214 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
224 void (*wakeup)(struct tipc_port *), 215 void (*wakeup)(struct tipc_port *),
@@ -257,7 +248,6 @@ struct tipc_port *tipc_createport_raw(void *usr_handle,
257 * to ensure a change to node's own network address doesn't result 248 * to ensure a change to node's own network address doesn't result
258 * in template containing out-dated network address information 249 * in template containing out-dated network address information
259 */ 250 */
260
261 spin_lock_bh(&tipc_port_list_lock); 251 spin_lock_bh(&tipc_port_list_lock);
262 msg = &p_ptr->phdr; 252 msg = &p_ptr->phdr;
263 tipc_msg_init(msg, importance, TIPC_NAMED_MSG, NAMED_H_SIZE, 0); 253 tipc_msg_init(msg, importance, TIPC_NAMED_MSG, NAMED_H_SIZE, 0);
@@ -390,7 +380,6 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
390 u32 rmsg_sz; 380 u32 rmsg_sz;
391 381
392 /* discard rejected message if it shouldn't be returned to sender */ 382 /* discard rejected message if it shouldn't be returned to sender */
393
394 if (WARN(!msg_isdata(msg), 383 if (WARN(!msg_isdata(msg),
395 "attempt to reject message with user=%u", msg_user(msg))) { 384 "attempt to reject message with user=%u", msg_user(msg))) {
396 dump_stack(); 385 dump_stack();
@@ -403,7 +392,6 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
403 * construct returned message by copying rejected message header and 392 * construct returned message by copying rejected message header and
404 * data (or subset), then updating header fields that need adjusting 393 * data (or subset), then updating header fields that need adjusting
405 */ 394 */
406
407 hdr_sz = msg_hdr_sz(msg); 395 hdr_sz = msg_hdr_sz(msg);
408 rmsg_sz = hdr_sz + min_t(u32, data_sz, MAX_REJECT_SIZE); 396 rmsg_sz = hdr_sz + min_t(u32, data_sz, MAX_REJECT_SIZE);
409 397
@@ -442,7 +430,6 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
442 } 430 }
443 431
444 /* send returned message & dispose of rejected message */ 432 /* send returned message & dispose of rejected message */
445
446 src_node = msg_prevnode(msg); 433 src_node = msg_prevnode(msg);
447 if (in_own_node(src_node)) 434 if (in_own_node(src_node))
448 tipc_port_recv_msg(rbuf); 435 tipc_port_recv_msg(rbuf);
@@ -552,7 +539,6 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
552 int wakeable; 539 int wakeable;
553 540
554 /* Validate connection */ 541 /* Validate connection */
555
556 p_ptr = tipc_port_lock(destport); 542 p_ptr = tipc_port_lock(destport);
557 if (!p_ptr || !p_ptr->connected || !tipc_port_peer_msg(p_ptr, msg)) { 543 if (!p_ptr || !p_ptr->connected || !tipc_port_peer_msg(p_ptr, msg)) {
558 r_buf = tipc_buf_acquire(BASIC_H_SIZE); 544 r_buf = tipc_buf_acquire(BASIC_H_SIZE);
@@ -570,7 +556,6 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
570 } 556 }
571 557
572 /* Process protocol message sent by peer */ 558 /* Process protocol message sent by peer */
573
574 switch (msg_type(msg)) { 559 switch (msg_type(msg)) {
575 case CONN_ACK: 560 case CONN_ACK:
576 wakeable = tipc_port_congested(p_ptr) && p_ptr->congested && 561 wakeable = tipc_port_congested(p_ptr) && p_ptr->congested &&
@@ -682,7 +667,6 @@ void tipc_port_reinit(void)
682 * port_dispatcher_sigh(): Signal handler for messages destinated 667 * port_dispatcher_sigh(): Signal handler for messages destinated
683 * to the tipc_port interface. 668 * to the tipc_port interface.
684 */ 669 */
685
686static void port_dispatcher_sigh(void *dummy) 670static void port_dispatcher_sigh(void *dummy)
687{ 671{
688 struct sk_buff *buf; 672 struct sk_buff *buf;
@@ -843,7 +827,6 @@ reject:
843 * port_dispatcher(): Dispatcher for messages destinated 827 * port_dispatcher(): Dispatcher for messages destinated
844 * to the tipc_port interface. Called with port locked. 828 * to the tipc_port interface. Called with port locked.
845 */ 829 */
846
847static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) 830static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf)
848{ 831{
849 buf->next = NULL; 832 buf->next = NULL;
@@ -860,10 +843,8 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf)
860} 843}
861 844
862/* 845/*
863 * Wake up port after congestion: Called with port locked, 846 * Wake up port after congestion: Called with port locked
864 *
865 */ 847 */
866
867static void port_wakeup_sh(unsigned long ref) 848static void port_wakeup_sh(unsigned long ref)
868{ 849{
869 struct tipc_port *p_ptr; 850 struct tipc_port *p_ptr;
@@ -909,7 +890,6 @@ void tipc_acknowledge(u32 ref, u32 ack)
909/* 890/*
910 * tipc_createport(): user level call. 891 * tipc_createport(): user level call.
911 */ 892 */
912
913int tipc_createport(void *usr_handle, 893int tipc_createport(void *usr_handle,
914 unsigned int importance, 894 unsigned int importance,
915 tipc_msg_err_event error_cb, 895 tipc_msg_err_event error_cb,
@@ -918,7 +898,7 @@ int tipc_createport(void *usr_handle,
918 tipc_msg_event msg_cb, 898 tipc_msg_event msg_cb,
919 tipc_named_msg_event named_msg_cb, 899 tipc_named_msg_event named_msg_cb,
920 tipc_conn_msg_event conn_msg_cb, 900 tipc_conn_msg_event conn_msg_cb,
921 tipc_continue_event continue_event_cb,/* May be zero */ 901 tipc_continue_event continue_event_cb, /* May be zero */
922 u32 *portref) 902 u32 *portref)
923{ 903{
924 struct user_port *up_ptr; 904 struct user_port *up_ptr;
@@ -1091,7 +1071,6 @@ exit:
1091 * 1071 *
1092 * Port must be locked. 1072 * Port must be locked.
1093 */ 1073 */
1094
1095int tipc_disconnect_port(struct tipc_port *tp_ptr) 1074int tipc_disconnect_port(struct tipc_port *tp_ptr)
1096{ 1075{
1097 int res; 1076 int res;
@@ -1112,7 +1091,6 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr)
1112 * tipc_disconnect(): Disconnect port form peer. 1091 * tipc_disconnect(): Disconnect port form peer.
1113 * This is a node local operation. 1092 * This is a node local operation.
1114 */ 1093 */
1115
1116int tipc_disconnect(u32 ref) 1094int tipc_disconnect(u32 ref)
1117{ 1095{
1118 struct tipc_port *p_ptr; 1096 struct tipc_port *p_ptr;
@@ -1147,7 +1125,6 @@ int tipc_shutdown(u32 ref)
1147/** 1125/**
1148 * tipc_port_recv_msg - receive message from lower layer and deliver to port user 1126 * tipc_port_recv_msg - receive message from lower layer and deliver to port user
1149 */ 1127 */
1150
1151int tipc_port_recv_msg(struct sk_buff *buf) 1128int tipc_port_recv_msg(struct sk_buff *buf)
1152{ 1129{
1153 struct tipc_port *p_ptr; 1130 struct tipc_port *p_ptr;
@@ -1180,7 +1157,6 @@ int tipc_port_recv_msg(struct sk_buff *buf)
1180 * tipc_port_recv_sections(): Concatenate and deliver sectioned 1157 * tipc_port_recv_sections(): Concatenate and deliver sectioned
1181 * message for this node. 1158 * message for this node.
1182 */ 1159 */
1183
1184static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_sect, 1160static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_sect,
1185 struct iovec const *msg_sect, 1161 struct iovec const *msg_sect,
1186 unsigned int total_len) 1162 unsigned int total_len)
@@ -1198,7 +1174,6 @@ static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_se
1198/** 1174/**
1199 * tipc_send - send message sections on connection 1175 * tipc_send - send message sections on connection
1200 */ 1176 */
1201
1202int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect, 1177int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect,
1203 unsigned int total_len) 1178 unsigned int total_len)
1204{ 1179{
@@ -1237,7 +1212,6 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect,
1237/** 1212/**
1238 * tipc_send2name - send message sections to port name 1213 * tipc_send2name - send message sections to port name
1239 */ 1214 */
1240
1241int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain, 1215int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
1242 unsigned int num_sect, struct iovec const *msg_sect, 1216 unsigned int num_sect, struct iovec const *msg_sect,
1243 unsigned int total_len) 1217 unsigned int total_len)
@@ -1291,7 +1265,6 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
1291/** 1265/**
1292 * tipc_send2port - send message sections to port identity 1266 * tipc_send2port - send message sections to port identity
1293 */ 1267 */
1294
1295int tipc_send2port(u32 ref, struct tipc_portid const *dest, 1268int tipc_send2port(u32 ref, struct tipc_portid const *dest,
1296 unsigned int num_sect, struct iovec const *msg_sect, 1269 unsigned int num_sect, struct iovec const *msg_sect,
1297 unsigned int total_len) 1270 unsigned int total_len)
@@ -1334,7 +1307,6 @@ int tipc_send2port(u32 ref, struct tipc_portid const *dest,
1334/** 1307/**
1335 * tipc_send_buf2port - send message buffer to port identity 1308 * tipc_send_buf2port - send message buffer to port identity
1336 */ 1309 */
1337
1338int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest, 1310int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest,
1339 struct sk_buff *buf, unsigned int dsz) 1311 struct sk_buff *buf, unsigned int dsz)
1340{ 1312{
@@ -1371,4 +1343,3 @@ int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest,
1371 return dsz; 1343 return dsz;
1372 return -ELINKCONG; 1344 return -ELINKCONG;
1373} 1345}
1374
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 301e1bd840d1..98cbec9c4532 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -81,7 +81,6 @@ typedef void (*tipc_continue_event) (void *usr_handle, u32 portref);
81 * @ref: object reference to associated TIPC port 81 * @ref: object reference to associated TIPC port
82 * <various callback routines> 82 * <various callback routines>
83 */ 83 */
84
85struct user_port { 84struct user_port {
86 void *usr_handle; 85 void *usr_handle;
87 u32 ref; 86 u32 ref;
@@ -236,7 +235,6 @@ void tipc_port_reinit(void);
236/** 235/**
237 * tipc_port_lock - lock port instance referred to and return its pointer 236 * tipc_port_lock - lock port instance referred to and return its pointer
238 */ 237 */
239
240static inline struct tipc_port *tipc_port_lock(u32 ref) 238static inline struct tipc_port *tipc_port_lock(u32 ref)
241{ 239{
242 return (struct tipc_port *)tipc_ref_lock(ref); 240 return (struct tipc_port *)tipc_ref_lock(ref);
@@ -247,7 +245,6 @@ static inline struct tipc_port *tipc_port_lock(u32 ref)
247 * 245 *
248 * Can use pointer instead of tipc_ref_unlock() since port is already locked. 246 * Can use pointer instead of tipc_ref_unlock() since port is already locked.
249 */ 247 */
250
251static inline void tipc_port_unlock(struct tipc_port *p_ptr) 248static inline void tipc_port_unlock(struct tipc_port *p_ptr)
252{ 249{
253 spin_unlock_bh(p_ptr->lock); 250 spin_unlock_bh(p_ptr->lock);
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index 9e37b7812c3c..5cada0e38e03 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -43,7 +43,6 @@
43 * @lock: spinlock controlling access to object 43 * @lock: spinlock controlling access to object
44 * @ref: reference value for object (combines instance & array index info) 44 * @ref: reference value for object (combines instance & array index info)
45 */ 45 */
46
47struct reference { 46struct reference {
48 void *object; 47 void *object;
49 spinlock_t lock; 48 spinlock_t lock;
@@ -60,7 +59,6 @@ struct reference {
60 * @index_mask: bitmask for array index portion of reference values 59 * @index_mask: bitmask for array index portion of reference values
61 * @start_mask: initial value for instance value portion of reference values 60 * @start_mask: initial value for instance value portion of reference values
62 */ 61 */
63
64struct ref_table { 62struct ref_table {
65 struct reference *entries; 63 struct reference *entries;
66 u32 capacity; 64 u32 capacity;
@@ -96,7 +94,6 @@ static DEFINE_RWLOCK(ref_table_lock);
96/** 94/**
97 * tipc_ref_table_init - create reference table for objects 95 * tipc_ref_table_init - create reference table for objects
98 */ 96 */
99
100int tipc_ref_table_init(u32 requested_size, u32 start) 97int tipc_ref_table_init(u32 requested_size, u32 start)
101{ 98{
102 struct reference *table; 99 struct reference *table;
@@ -109,7 +106,6 @@ int tipc_ref_table_init(u32 requested_size, u32 start)
109 /* do nothing */ ; 106 /* do nothing */ ;
110 107
111 /* allocate table & mark all entries as uninitialized */ 108 /* allocate table & mark all entries as uninitialized */
112
113 table = vzalloc(actual_size * sizeof(struct reference)); 109 table = vzalloc(actual_size * sizeof(struct reference));
114 if (table == NULL) 110 if (table == NULL)
115 return -ENOMEM; 111 return -ENOMEM;
@@ -128,7 +124,6 @@ int tipc_ref_table_init(u32 requested_size, u32 start)
128/** 124/**
129 * tipc_ref_table_stop - destroy reference table for objects 125 * tipc_ref_table_stop - destroy reference table for objects
130 */ 126 */
131
132void tipc_ref_table_stop(void) 127void tipc_ref_table_stop(void)
133{ 128{
134 if (!tipc_ref_table.entries) 129 if (!tipc_ref_table.entries)
@@ -149,7 +144,6 @@ void tipc_ref_table_stop(void)
149 * register a partially initialized object, without running the risk that 144 * register a partially initialized object, without running the risk that
150 * the object will be accessed before initialization is complete. 145 * the object will be accessed before initialization is complete.
151 */ 146 */
152
153u32 tipc_ref_acquire(void *object, spinlock_t **lock) 147u32 tipc_ref_acquire(void *object, spinlock_t **lock)
154{ 148{
155 u32 index; 149 u32 index;
@@ -168,7 +162,6 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
168 } 162 }
169 163
170 /* take a free entry, if available; otherwise initialize a new entry */ 164 /* take a free entry, if available; otherwise initialize a new entry */
171
172 write_lock_bh(&ref_table_lock); 165 write_lock_bh(&ref_table_lock);
173 if (tipc_ref_table.first_free) { 166 if (tipc_ref_table.first_free) {
174 index = tipc_ref_table.first_free; 167 index = tipc_ref_table.first_free;
@@ -211,7 +204,6 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
211 * Disallow future references to an object and free up the entry for re-use. 204 * Disallow future references to an object and free up the entry for re-use.
212 * Note: The entry's spin_lock may still be busy after discard 205 * Note: The entry's spin_lock may still be busy after discard
213 */ 206 */
214
215void tipc_ref_discard(u32 ref) 207void tipc_ref_discard(u32 ref)
216{ 208{
217 struct reference *entry; 209 struct reference *entry;
@@ -242,12 +234,10 @@ void tipc_ref_discard(u32 ref)
242 * mark entry as unused; increment instance part of entry's reference 234 * mark entry as unused; increment instance part of entry's reference
243 * to invalidate any subsequent references 235 * to invalidate any subsequent references
244 */ 236 */
245
246 entry->object = NULL; 237 entry->object = NULL;
247 entry->ref = (ref & ~index_mask) + (index_mask + 1); 238 entry->ref = (ref & ~index_mask) + (index_mask + 1);
248 239
249 /* append entry to free entry list */ 240 /* append entry to free entry list */
250
251 if (tipc_ref_table.first_free == 0) 241 if (tipc_ref_table.first_free == 0)
252 tipc_ref_table.first_free = index; 242 tipc_ref_table.first_free = index;
253 else 243 else
@@ -261,7 +251,6 @@ exit:
261/** 251/**
262 * tipc_ref_lock - lock referenced object and return pointer to it 252 * tipc_ref_lock - lock referenced object and return pointer to it
263 */ 253 */
264
265void *tipc_ref_lock(u32 ref) 254void *tipc_ref_lock(u32 ref)
266{ 255{
267 if (likely(tipc_ref_table.entries)) { 256 if (likely(tipc_ref_table.entries)) {
@@ -283,7 +272,6 @@ void *tipc_ref_lock(u32 ref)
283/** 272/**
284 * tipc_ref_deref - return pointer referenced object (without locking it) 273 * tipc_ref_deref - return pointer referenced object (without locking it)
285 */ 274 */
286
287void *tipc_ref_deref(u32 ref) 275void *tipc_ref_deref(u32 ref)
288{ 276{
289 if (likely(tipc_ref_table.entries)) { 277 if (likely(tipc_ref_table.entries)) {
@@ -296,4 +284,3 @@ void *tipc_ref_deref(u32 ref)
296 } 284 }
297 return NULL; 285 return NULL;
298} 286}
299
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 3c00b40f815f..5577a447f531 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -123,7 +123,6 @@ static atomic_t tipc_queue_size = ATOMIC_INIT(0);
123 * 123 *
124 * Caller must hold socket lock 124 * Caller must hold socket lock
125 */ 125 */
126
127static void advance_rx_queue(struct sock *sk) 126static void advance_rx_queue(struct sock *sk)
128{ 127{
129 kfree_skb(__skb_dequeue(&sk->sk_receive_queue)); 128 kfree_skb(__skb_dequeue(&sk->sk_receive_queue));
@@ -135,7 +134,6 @@ static void advance_rx_queue(struct sock *sk)
135 * 134 *
136 * Caller must hold socket lock 135 * Caller must hold socket lock
137 */ 136 */
138
139static void discard_rx_queue(struct sock *sk) 137static void discard_rx_queue(struct sock *sk)
140{ 138{
141 struct sk_buff *buf; 139 struct sk_buff *buf;
@@ -151,7 +149,6 @@ static void discard_rx_queue(struct sock *sk)
151 * 149 *
152 * Caller must hold socket lock 150 * Caller must hold socket lock
153 */ 151 */
154
155static void reject_rx_queue(struct sock *sk) 152static void reject_rx_queue(struct sock *sk)
156{ 153{
157 struct sk_buff *buf; 154 struct sk_buff *buf;
@@ -174,7 +171,6 @@ static void reject_rx_queue(struct sock *sk)
174 * 171 *
175 * Returns 0 on success, errno otherwise 172 * Returns 0 on success, errno otherwise
176 */ 173 */
177
178static int tipc_create(struct net *net, struct socket *sock, int protocol, 174static int tipc_create(struct net *net, struct socket *sock, int protocol,
179 int kern) 175 int kern)
180{ 176{
@@ -184,7 +180,6 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
184 struct tipc_port *tp_ptr; 180 struct tipc_port *tp_ptr;
185 181
186 /* Validate arguments */ 182 /* Validate arguments */
187
188 if (unlikely(protocol != 0)) 183 if (unlikely(protocol != 0))
189 return -EPROTONOSUPPORT; 184 return -EPROTONOSUPPORT;
190 185
@@ -207,13 +202,11 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
207 } 202 }
208 203
209 /* Allocate socket's protocol area */ 204 /* Allocate socket's protocol area */
210
211 sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto); 205 sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto);
212 if (sk == NULL) 206 if (sk == NULL)
213 return -ENOMEM; 207 return -ENOMEM;
214 208
215 /* Allocate TIPC port for socket to use */ 209 /* Allocate TIPC port for socket to use */
216
217 tp_ptr = tipc_createport_raw(sk, &dispatch, &wakeupdispatch, 210 tp_ptr = tipc_createport_raw(sk, &dispatch, &wakeupdispatch,
218 TIPC_LOW_IMPORTANCE); 211 TIPC_LOW_IMPORTANCE);
219 if (unlikely(!tp_ptr)) { 212 if (unlikely(!tp_ptr)) {
@@ -222,7 +215,6 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
222 } 215 }
223 216
224 /* Finish initializing socket data structures */ 217 /* Finish initializing socket data structures */
225
226 sock->ops = ops; 218 sock->ops = ops;
227 sock->state = state; 219 sock->state = state;
228 220
@@ -258,7 +250,6 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
258 * 250 *
259 * Returns 0 on success, errno otherwise 251 * Returns 0 on success, errno otherwise
260 */ 252 */
261
262static int release(struct socket *sock) 253static int release(struct socket *sock)
263{ 254{
264 struct sock *sk = sock->sk; 255 struct sock *sk = sock->sk;
@@ -270,7 +261,6 @@ static int release(struct socket *sock)
270 * Exit if socket isn't fully initialized (occurs when a failed accept() 261 * Exit if socket isn't fully initialized (occurs when a failed accept()
271 * releases a pre-allocated child socket that was never used) 262 * releases a pre-allocated child socket that was never used)
272 */ 263 */
273
274 if (sk == NULL) 264 if (sk == NULL)
275 return 0; 265 return 0;
276 266
@@ -281,7 +271,6 @@ static int release(struct socket *sock)
281 * Reject all unreceived messages, except on an active connection 271 * Reject all unreceived messages, except on an active connection
282 * (which disconnects locally & sends a 'FIN+' to peer) 272 * (which disconnects locally & sends a 'FIN+' to peer)
283 */ 273 */
284
285 while (sock->state != SS_DISCONNECTING) { 274 while (sock->state != SS_DISCONNECTING) {
286 buf = __skb_dequeue(&sk->sk_receive_queue); 275 buf = __skb_dequeue(&sk->sk_receive_queue);
287 if (buf == NULL) 276 if (buf == NULL)
@@ -303,15 +292,12 @@ static int release(struct socket *sock)
303 * Delete TIPC port; this ensures no more messages are queued 292 * Delete TIPC port; this ensures no more messages are queued
304 * (also disconnects an active connection & sends a 'FIN-' to peer) 293 * (also disconnects an active connection & sends a 'FIN-' to peer)
305 */ 294 */
306
307 res = tipc_deleteport(tport->ref); 295 res = tipc_deleteport(tport->ref);
308 296
309 /* Discard any remaining (connection-based) messages in receive queue */ 297 /* Discard any remaining (connection-based) messages in receive queue */
310
311 discard_rx_queue(sk); 298 discard_rx_queue(sk);
312 299
313 /* Reject any messages that accumulated in backlog queue */ 300 /* Reject any messages that accumulated in backlog queue */
314
315 sock->state = SS_DISCONNECTING; 301 sock->state = SS_DISCONNECTING;
316 release_sock(sk); 302 release_sock(sk);
317 303
@@ -336,7 +322,6 @@ static int release(struct socket *sock)
336 * NOTE: This routine doesn't need to take the socket lock since it doesn't 322 * NOTE: This routine doesn't need to take the socket lock since it doesn't
337 * access any non-constant socket information. 323 * access any non-constant socket information.
338 */ 324 */
339
340static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) 325static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
341{ 326{
342 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr; 327 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
@@ -376,7 +361,6 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
376 * accesses socket information that is unchanging (or which changes in 361 * accesses socket information that is unchanging (or which changes in
377 * a completely predictable manner). 362 * a completely predictable manner).
378 */ 363 */
379
380static int get_name(struct socket *sock, struct sockaddr *uaddr, 364static int get_name(struct socket *sock, struct sockaddr *uaddr,
381 int *uaddr_len, int peer) 365 int *uaddr_len, int peer)
382{ 366{
@@ -444,7 +428,6 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,
444 * imply that the operation will succeed, merely that it should be performed 428 * imply that the operation will succeed, merely that it should be performed
445 * and will not block. 429 * and will not block.
446 */ 430 */
447
448static unsigned int poll(struct file *file, struct socket *sock, 431static unsigned int poll(struct file *file, struct socket *sock,
449 poll_table *wait) 432 poll_table *wait)
450{ 433{
@@ -482,7 +465,6 @@ static unsigned int poll(struct file *file, struct socket *sock,
482 * 465 *
483 * Returns 0 if permission is granted, otherwise errno 466 * Returns 0 if permission is granted, otherwise errno
484 */ 467 */
485
486static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m) 468static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
487{ 469{
488 struct tipc_cfg_msg_hdr hdr; 470 struct tipc_cfg_msg_hdr hdr;
@@ -518,7 +500,6 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
518 * 500 *
519 * Returns the number of bytes sent on success, or errno otherwise 501 * Returns the number of bytes sent on success, or errno otherwise
520 */ 502 */
521
522static int send_msg(struct kiocb *iocb, struct socket *sock, 503static int send_msg(struct kiocb *iocb, struct socket *sock,
523 struct msghdr *m, size_t total_len) 504 struct msghdr *m, size_t total_len)
524{ 505{
@@ -562,7 +543,6 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
562 } 543 }
563 544
564 /* Abort any pending connection attempts (very unlikely) */ 545 /* Abort any pending connection attempts (very unlikely) */
565
566 reject_rx_queue(sk); 546 reject_rx_queue(sk);
567 } 547 }
568 548
@@ -631,7 +611,6 @@ exit:
631 * 611 *
632 * Returns the number of bytes sent on success, or errno otherwise 612 * Returns the number of bytes sent on success, or errno otherwise
633 */ 613 */
634
635static int send_packet(struct kiocb *iocb, struct socket *sock, 614static int send_packet(struct kiocb *iocb, struct socket *sock,
636 struct msghdr *m, size_t total_len) 615 struct msghdr *m, size_t total_len)
637{ 616{
@@ -642,7 +621,6 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
642 int res; 621 int res;
643 622
644 /* Handle implied connection establishment */ 623 /* Handle implied connection establishment */
645
646 if (unlikely(dest)) 624 if (unlikely(dest))
647 return send_msg(iocb, sock, m, total_len); 625 return send_msg(iocb, sock, m, total_len);
648 626
@@ -695,7 +673,6 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
695 * Returns the number of bytes sent on success (or partial success), 673 * Returns the number of bytes sent on success (or partial success),
696 * or errno if no data sent 674 * or errno if no data sent
697 */ 675 */
698
699static int send_stream(struct kiocb *iocb, struct socket *sock, 676static int send_stream(struct kiocb *iocb, struct socket *sock,
700 struct msghdr *m, size_t total_len) 677 struct msghdr *m, size_t total_len)
701{ 678{
@@ -715,7 +692,6 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
715 lock_sock(sk); 692 lock_sock(sk);
716 693
717 /* Handle special cases where there is no connection */ 694 /* Handle special cases where there is no connection */
718
719 if (unlikely(sock->state != SS_CONNECTED)) { 695 if (unlikely(sock->state != SS_CONNECTED)) {
720 if (sock->state == SS_UNCONNECTED) { 696 if (sock->state == SS_UNCONNECTED) {
721 res = send_packet(NULL, sock, m, total_len); 697 res = send_packet(NULL, sock, m, total_len);
@@ -747,7 +723,6 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
747 * (i.e. one large iovec entry), but could be improved to pass sets 723 * (i.e. one large iovec entry), but could be improved to pass sets
748 * of small iovec entries into send_packet(). 724 * of small iovec entries into send_packet().
749 */ 725 */
750
751 curr_iov = m->msg_iov; 726 curr_iov = m->msg_iov;
752 curr_iovlen = m->msg_iovlen; 727 curr_iovlen = m->msg_iovlen;
753 my_msg.msg_iov = &my_iov; 728 my_msg.msg_iov = &my_iov;
@@ -796,7 +771,6 @@ exit:
796 * 771 *
797 * Returns 0 on success, errno otherwise 772 * Returns 0 on success, errno otherwise
798 */ 773 */
799
800static int auto_connect(struct socket *sock, struct tipc_msg *msg) 774static int auto_connect(struct socket *sock, struct tipc_msg *msg)
801{ 775{
802 struct tipc_sock *tsock = tipc_sk(sock->sk); 776 struct tipc_sock *tsock = tipc_sk(sock->sk);
@@ -821,7 +795,6 @@ static int auto_connect(struct socket *sock, struct tipc_msg *msg)
821 * 795 *
822 * Note: Address is not captured if not requested by receiver. 796 * Note: Address is not captured if not requested by receiver.
823 */ 797 */
824
825static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) 798static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
826{ 799{
827 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name; 800 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name;
@@ -847,7 +820,6 @@ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
847 * 820 *
848 * Returns 0 if successful, otherwise errno 821 * Returns 0 if successful, otherwise errno
849 */ 822 */
850
851static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, 823static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
852 struct tipc_port *tport) 824 struct tipc_port *tport)
853{ 825{
@@ -861,7 +833,6 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
861 return 0; 833 return 0;
862 834
863 /* Optionally capture errored message object(s) */ 835 /* Optionally capture errored message object(s) */
864
865 err = msg ? msg_errcode(msg) : 0; 836 err = msg ? msg_errcode(msg) : 0;
866 if (unlikely(err)) { 837 if (unlikely(err)) {
867 anc_data[0] = err; 838 anc_data[0] = err;
@@ -878,7 +849,6 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
878 } 849 }
879 850
880 /* Optionally capture message destination object */ 851 /* Optionally capture message destination object */
881
882 dest_type = msg ? msg_type(msg) : TIPC_DIRECT_MSG; 852 dest_type = msg ? msg_type(msg) : TIPC_DIRECT_MSG;
883 switch (dest_type) { 853 switch (dest_type) {
884 case TIPC_NAMED_MSG: 854 case TIPC_NAMED_MSG:
@@ -923,7 +893,6 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
923 * 893 *
924 * Returns size of returned message data, errno otherwise 894 * Returns size of returned message data, errno otherwise
925 */ 895 */
926
927static int recv_msg(struct kiocb *iocb, struct socket *sock, 896static int recv_msg(struct kiocb *iocb, struct socket *sock,
928 struct msghdr *m, size_t buf_len, int flags) 897 struct msghdr *m, size_t buf_len, int flags)
929{ 898{
@@ -937,7 +906,6 @@ static int recv_msg(struct kiocb *iocb, struct socket *sock,
937 int res; 906 int res;
938 907
939 /* Catch invalid receive requests */ 908 /* Catch invalid receive requests */
940
941 if (unlikely(!buf_len)) 909 if (unlikely(!buf_len))
942 return -EINVAL; 910 return -EINVAL;
943 911
@@ -952,7 +920,6 @@ static int recv_msg(struct kiocb *iocb, struct socket *sock,
952restart: 920restart:
953 921
954 /* Look for a message in receive queue; wait if necessary */ 922 /* Look for a message in receive queue; wait if necessary */
955
956 while (skb_queue_empty(&sk->sk_receive_queue)) { 923 while (skb_queue_empty(&sk->sk_receive_queue)) {
957 if (sock->state == SS_DISCONNECTING) { 924 if (sock->state == SS_DISCONNECTING) {
958 res = -ENOTCONN; 925 res = -ENOTCONN;
@@ -970,14 +937,12 @@ restart:
970 } 937 }
971 938
972 /* Look at first message in receive queue */ 939 /* Look at first message in receive queue */
973
974 buf = skb_peek(&sk->sk_receive_queue); 940 buf = skb_peek(&sk->sk_receive_queue);
975 msg = buf_msg(buf); 941 msg = buf_msg(buf);
976 sz = msg_data_sz(msg); 942 sz = msg_data_sz(msg);
977 err = msg_errcode(msg); 943 err = msg_errcode(msg);
978 944
979 /* Complete connection setup for an implied connect */ 945 /* Complete connection setup for an implied connect */
980
981 if (unlikely(sock->state == SS_CONNECTING)) { 946 if (unlikely(sock->state == SS_CONNECTING)) {
982 res = auto_connect(sock, msg); 947 res = auto_connect(sock, msg);
983 if (res) 948 if (res)
@@ -985,24 +950,20 @@ restart:
985 } 950 }
986 951
987 /* Discard an empty non-errored message & try again */ 952 /* Discard an empty non-errored message & try again */
988
989 if ((!sz) && (!err)) { 953 if ((!sz) && (!err)) {
990 advance_rx_queue(sk); 954 advance_rx_queue(sk);
991 goto restart; 955 goto restart;
992 } 956 }
993 957
994 /* Capture sender's address (optional) */ 958 /* Capture sender's address (optional) */
995
996 set_orig_addr(m, msg); 959 set_orig_addr(m, msg);
997 960
998 /* Capture ancillary data (optional) */ 961 /* Capture ancillary data (optional) */
999
1000 res = anc_data_recv(m, msg, tport); 962 res = anc_data_recv(m, msg, tport);
1001 if (res) 963 if (res)
1002 goto exit; 964 goto exit;
1003 965
1004 /* Capture message data (if valid) & compute return value (always) */ 966 /* Capture message data (if valid) & compute return value (always) */
1005
1006 if (!err) { 967 if (!err) {
1007 if (unlikely(buf_len < sz)) { 968 if (unlikely(buf_len < sz)) {
1008 sz = buf_len; 969 sz = buf_len;
@@ -1022,7 +983,6 @@ restart:
1022 } 983 }
1023 984
1024 /* Consume received message (optional) */ 985 /* Consume received message (optional) */
1025
1026 if (likely(!(flags & MSG_PEEK))) { 986 if (likely(!(flags & MSG_PEEK))) {
1027 if ((sock->state != SS_READY) && 987 if ((sock->state != SS_READY) &&
1028 (++tport->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) 988 (++tport->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
@@ -1046,7 +1006,6 @@ exit:
1046 * 1006 *
1047 * Returns size of returned message data, errno otherwise 1007 * Returns size of returned message data, errno otherwise
1048 */ 1008 */
1049
1050static int recv_stream(struct kiocb *iocb, struct socket *sock, 1009static int recv_stream(struct kiocb *iocb, struct socket *sock,
1051 struct msghdr *m, size_t buf_len, int flags) 1010 struct msghdr *m, size_t buf_len, int flags)
1052{ 1011{
@@ -1062,7 +1021,6 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
1062 int res = 0; 1021 int res = 0;
1063 1022
1064 /* Catch invalid receive attempts */ 1023 /* Catch invalid receive attempts */
1065
1066 if (unlikely(!buf_len)) 1024 if (unlikely(!buf_len))
1067 return -EINVAL; 1025 return -EINVAL;
1068 1026
@@ -1076,10 +1034,9 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
1076 1034
1077 target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len); 1035 target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len);
1078 timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 1036 timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
1079restart:
1080 1037
1038restart:
1081 /* Look for a message in receive queue; wait if necessary */ 1039 /* Look for a message in receive queue; wait if necessary */
1082
1083 while (skb_queue_empty(&sk->sk_receive_queue)) { 1040 while (skb_queue_empty(&sk->sk_receive_queue)) {
1084 if (sock->state == SS_DISCONNECTING) { 1041 if (sock->state == SS_DISCONNECTING) {
1085 res = -ENOTCONN; 1042 res = -ENOTCONN;
@@ -1097,21 +1054,18 @@ restart:
1097 } 1054 }
1098 1055
1099 /* Look at first message in receive queue */ 1056 /* Look at first message in receive queue */
1100
1101 buf = skb_peek(&sk->sk_receive_queue); 1057 buf = skb_peek(&sk->sk_receive_queue);
1102 msg = buf_msg(buf); 1058 msg = buf_msg(buf);
1103 sz = msg_data_sz(msg); 1059 sz = msg_data_sz(msg);
1104 err = msg_errcode(msg); 1060 err = msg_errcode(msg);
1105 1061
1106 /* Discard an empty non-errored message & try again */ 1062 /* Discard an empty non-errored message & try again */
1107
1108 if ((!sz) && (!err)) { 1063 if ((!sz) && (!err)) {
1109 advance_rx_queue(sk); 1064 advance_rx_queue(sk);
1110 goto restart; 1065 goto restart;
1111 } 1066 }
1112 1067
1113 /* Optionally capture sender's address & ancillary data of first msg */ 1068 /* Optionally capture sender's address & ancillary data of first msg */
1114
1115 if (sz_copied == 0) { 1069 if (sz_copied == 0) {
1116 set_orig_addr(m, msg); 1070 set_orig_addr(m, msg);
1117 res = anc_data_recv(m, msg, tport); 1071 res = anc_data_recv(m, msg, tport);
@@ -1120,7 +1074,6 @@ restart:
1120 } 1074 }
1121 1075
1122 /* Capture message data (if valid) & compute return value (always) */ 1076 /* Capture message data (if valid) & compute return value (always) */
1123
1124 if (!err) { 1077 if (!err) {
1125 u32 offset = (u32)(unsigned long)(TIPC_SKB_CB(buf)->handle); 1078 u32 offset = (u32)(unsigned long)(TIPC_SKB_CB(buf)->handle);
1126 1079
@@ -1152,7 +1105,6 @@ restart:
1152 } 1105 }
1153 1106
1154 /* Consume received message (optional) */ 1107 /* Consume received message (optional) */
1155
1156 if (likely(!(flags & MSG_PEEK))) { 1108 if (likely(!(flags & MSG_PEEK))) {
1157 if (unlikely(++tport->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) 1109 if (unlikely(++tport->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
1158 tipc_acknowledge(tport->ref, tport->conn_unacked); 1110 tipc_acknowledge(tport->ref, tport->conn_unacked);
@@ -1160,7 +1112,6 @@ restart:
1160 } 1112 }
1161 1113
1162 /* Loop around if more data is required */ 1114 /* Loop around if more data is required */
1163
1164 if ((sz_copied < buf_len) && /* didn't get all requested data */ 1115 if ((sz_copied < buf_len) && /* didn't get all requested data */
1165 (!skb_queue_empty(&sk->sk_receive_queue) || 1116 (!skb_queue_empty(&sk->sk_receive_queue) ||
1166 (sz_copied < target)) && /* and more is ready or required */ 1117 (sz_copied < target)) && /* and more is ready or required */
@@ -1181,7 +1132,6 @@ exit:
1181 * 1132 *
1182 * Returns 1 if queue is unable to accept message, 0 otherwise 1133 * Returns 1 if queue is unable to accept message, 0 otherwise
1183 */ 1134 */
1184
1185static int rx_queue_full(struct tipc_msg *msg, u32 queue_size, u32 base) 1135static int rx_queue_full(struct tipc_msg *msg, u32 queue_size, u32 base)
1186{ 1136{
1187 u32 threshold; 1137 u32 threshold;
@@ -1214,7 +1164,6 @@ static int rx_queue_full(struct tipc_msg *msg, u32 queue_size, u32 base)
1214 * 1164 *
1215 * Returns TIPC error status code (TIPC_OK if message is not to be rejected) 1165 * Returns TIPC error status code (TIPC_OK if message is not to be rejected)
1216 */ 1166 */
1217
1218static u32 filter_rcv(struct sock *sk, struct sk_buff *buf) 1167static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
1219{ 1168{
1220 struct socket *sock = sk->sk_socket; 1169 struct socket *sock = sk->sk_socket;
@@ -1222,7 +1171,6 @@ static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
1222 u32 recv_q_len; 1171 u32 recv_q_len;
1223 1172
1224 /* Reject message if it is wrong sort of message for socket */ 1173 /* Reject message if it is wrong sort of message for socket */
1225
1226 if (msg_type(msg) > TIPC_DIRECT_MSG) 1174 if (msg_type(msg) > TIPC_DIRECT_MSG)
1227 return TIPC_ERR_NO_PORT; 1175 return TIPC_ERR_NO_PORT;
1228 1176
@@ -1251,7 +1199,6 @@ static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
1251 } 1199 }
1252 1200
1253 /* Reject message if there isn't room to queue it */ 1201 /* Reject message if there isn't room to queue it */
1254
1255 recv_q_len = (u32)atomic_read(&tipc_queue_size); 1202 recv_q_len = (u32)atomic_read(&tipc_queue_size);
1256 if (unlikely(recv_q_len >= OVERLOAD_LIMIT_BASE)) { 1203 if (unlikely(recv_q_len >= OVERLOAD_LIMIT_BASE)) {
1257 if (rx_queue_full(msg, recv_q_len, OVERLOAD_LIMIT_BASE)) 1204 if (rx_queue_full(msg, recv_q_len, OVERLOAD_LIMIT_BASE))
@@ -1264,13 +1211,11 @@ static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
1264 } 1211 }
1265 1212
1266 /* Enqueue message (finally!) */ 1213 /* Enqueue message (finally!) */
1267
1268 TIPC_SKB_CB(buf)->handle = 0; 1214 TIPC_SKB_CB(buf)->handle = 0;
1269 atomic_inc(&tipc_queue_size); 1215 atomic_inc(&tipc_queue_size);
1270 __skb_queue_tail(&sk->sk_receive_queue, buf); 1216 __skb_queue_tail(&sk->sk_receive_queue, buf);
1271 1217
1272 /* Initiate connection termination for an incoming 'FIN' */ 1218 /* Initiate connection termination for an incoming 'FIN' */
1273
1274 if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) { 1219 if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) {
1275 sock->state = SS_DISCONNECTING; 1220 sock->state = SS_DISCONNECTING;
1276 tipc_disconnect_port(tipc_sk_port(sk)); 1221 tipc_disconnect_port(tipc_sk_port(sk));
@@ -1290,7 +1235,6 @@ static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
1290 * 1235 *
1291 * Returns 0 1236 * Returns 0
1292 */ 1237 */
1293
1294static int backlog_rcv(struct sock *sk, struct sk_buff *buf) 1238static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
1295{ 1239{
1296 u32 res; 1240 u32 res;
@@ -1310,7 +1254,6 @@ static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
1310 * 1254 *
1311 * Returns TIPC error status code (TIPC_OK if message is not to be rejected) 1255 * Returns TIPC error status code (TIPC_OK if message is not to be rejected)
1312 */ 1256 */
1313
1314static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) 1257static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1315{ 1258{
1316 struct sock *sk = (struct sock *)tport->usr_handle; 1259 struct sock *sk = (struct sock *)tport->usr_handle;
@@ -1322,7 +1265,6 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1322 * This code is based on sk_receive_skb(), but must be distinct from it 1265 * This code is based on sk_receive_skb(), but must be distinct from it
1323 * since a TIPC-specific filter/reject mechanism is utilized 1266 * since a TIPC-specific filter/reject mechanism is utilized
1324 */ 1267 */
1325
1326 bh_lock_sock(sk); 1268 bh_lock_sock(sk);
1327 if (!sock_owned_by_user(sk)) { 1269 if (!sock_owned_by_user(sk)) {
1328 res = filter_rcv(sk, buf); 1270 res = filter_rcv(sk, buf);
@@ -1343,7 +1285,6 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1343 * 1285 *
1344 * Called with port lock already taken. 1286 * Called with port lock already taken.
1345 */ 1287 */
1346
1347static void wakeupdispatch(struct tipc_port *tport) 1288static void wakeupdispatch(struct tipc_port *tport)
1348{ 1289{
1349 struct sock *sk = (struct sock *)tport->usr_handle; 1290 struct sock *sk = (struct sock *)tport->usr_handle;
@@ -1361,7 +1302,6 @@ static void wakeupdispatch(struct tipc_port *tport)
1361 * 1302 *
1362 * Returns 0 on success, errno otherwise 1303 * Returns 0 on success, errno otherwise
1363 */ 1304 */
1364
1365static int connect(struct socket *sock, struct sockaddr *dest, int destlen, 1305static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1366 int flags) 1306 int flags)
1367{ 1307{
@@ -1376,21 +1316,18 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1376 lock_sock(sk); 1316 lock_sock(sk);
1377 1317
1378 /* For now, TIPC does not allow use of connect() with DGRAM/RDM types */ 1318 /* For now, TIPC does not allow use of connect() with DGRAM/RDM types */
1379
1380 if (sock->state == SS_READY) { 1319 if (sock->state == SS_READY) {
1381 res = -EOPNOTSUPP; 1320 res = -EOPNOTSUPP;
1382 goto exit; 1321 goto exit;
1383 } 1322 }
1384 1323
1385 /* For now, TIPC does not support the non-blocking form of connect() */ 1324 /* For now, TIPC does not support the non-blocking form of connect() */
1386
1387 if (flags & O_NONBLOCK) { 1325 if (flags & O_NONBLOCK) {
1388 res = -EOPNOTSUPP; 1326 res = -EOPNOTSUPP;
1389 goto exit; 1327 goto exit;
1390 } 1328 }
1391 1329
1392 /* Issue Posix-compliant error code if socket is in the wrong state */ 1330 /* Issue Posix-compliant error code if socket is in the wrong state */
1393
1394 if (sock->state == SS_LISTENING) { 1331 if (sock->state == SS_LISTENING) {
1395 res = -EOPNOTSUPP; 1332 res = -EOPNOTSUPP;
1396 goto exit; 1333 goto exit;
@@ -1410,18 +1347,15 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1410 * Note: send_msg() validates the rest of the address fields, 1347 * Note: send_msg() validates the rest of the address fields,
1411 * so there's no need to do it here 1348 * so there's no need to do it here
1412 */ 1349 */
1413
1414 if (dst->addrtype == TIPC_ADDR_MCAST) { 1350 if (dst->addrtype == TIPC_ADDR_MCAST) {
1415 res = -EINVAL; 1351 res = -EINVAL;
1416 goto exit; 1352 goto exit;
1417 } 1353 }
1418 1354
1419 /* Reject any messages already in receive queue (very unlikely) */ 1355 /* Reject any messages already in receive queue (very unlikely) */
1420
1421 reject_rx_queue(sk); 1356 reject_rx_queue(sk);
1422 1357
1423 /* Send a 'SYN-' to destination */ 1358 /* Send a 'SYN-' to destination */
1424
1425 m.msg_name = dest; 1359 m.msg_name = dest;
1426 m.msg_namelen = destlen; 1360 m.msg_namelen = destlen;
1427 res = send_msg(NULL, sock, &m, 0); 1361 res = send_msg(NULL, sock, &m, 0);
@@ -1429,7 +1363,6 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1429 goto exit; 1363 goto exit;
1430 1364
1431 /* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */ 1365 /* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */
1432
1433 timeout = tipc_sk(sk)->conn_timeout; 1366 timeout = tipc_sk(sk)->conn_timeout;
1434 release_sock(sk); 1367 release_sock(sk);
1435 res = wait_event_interruptible_timeout(*sk_sleep(sk), 1368 res = wait_event_interruptible_timeout(*sk_sleep(sk),
@@ -1474,7 +1407,6 @@ exit:
1474 * 1407 *
1475 * Returns 0 on success, errno otherwise 1408 * Returns 0 on success, errno otherwise
1476 */ 1409 */
1477
1478static int listen(struct socket *sock, int len) 1410static int listen(struct socket *sock, int len)
1479{ 1411{
1480 struct sock *sk = sock->sk; 1412 struct sock *sk = sock->sk;
@@ -1501,7 +1433,6 @@ static int listen(struct socket *sock, int len)
1501 * 1433 *
1502 * Returns 0 on success, errno otherwise 1434 * Returns 0 on success, errno otherwise
1503 */ 1435 */
1504
1505static int accept(struct socket *sock, struct socket *new_sock, int flags) 1436static int accept(struct socket *sock, struct socket *new_sock, int flags)
1506{ 1437{
1507 struct sock *sk = sock->sk; 1438 struct sock *sk = sock->sk;
@@ -1544,11 +1475,9 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags)
1544 * Reject any stray messages received by new socket 1475 * Reject any stray messages received by new socket
1545 * before the socket lock was taken (very, very unlikely) 1476 * before the socket lock was taken (very, very unlikely)
1546 */ 1477 */
1547
1548 reject_rx_queue(new_sk); 1478 reject_rx_queue(new_sk);
1549 1479
1550 /* Connect new socket to it's peer */ 1480 /* Connect new socket to it's peer */
1551
1552 new_tsock->peer_name.ref = msg_origport(msg); 1481 new_tsock->peer_name.ref = msg_origport(msg);
1553 new_tsock->peer_name.node = msg_orignode(msg); 1482 new_tsock->peer_name.node = msg_orignode(msg);
1554 tipc_connect2port(new_ref, &new_tsock->peer_name); 1483 tipc_connect2port(new_ref, &new_tsock->peer_name);
@@ -1564,7 +1493,6 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags)
1564 * Respond to 'SYN-' by discarding it & returning 'ACK'-. 1493 * Respond to 'SYN-' by discarding it & returning 'ACK'-.
1565 * Respond to 'SYN+' by queuing it on new socket. 1494 * Respond to 'SYN+' by queuing it on new socket.
1566 */ 1495 */
1567
1568 if (!msg_data_sz(msg)) { 1496 if (!msg_data_sz(msg)) {
1569 struct msghdr m = {NULL,}; 1497 struct msghdr m = {NULL,};
1570 1498
@@ -1590,7 +1518,6 @@ exit:
1590 * 1518 *
1591 * Returns 0 on success, errno otherwise 1519 * Returns 0 on success, errno otherwise
1592 */ 1520 */
1593
1594static int shutdown(struct socket *sock, int how) 1521static int shutdown(struct socket *sock, int how)
1595{ 1522{
1596 struct sock *sk = sock->sk; 1523 struct sock *sk = sock->sk;
@@ -1607,8 +1534,8 @@ static int shutdown(struct socket *sock, int how)
1607 case SS_CONNECTING: 1534 case SS_CONNECTING:
1608 case SS_CONNECTED: 1535 case SS_CONNECTED:
1609 1536
1610 /* Disconnect and send a 'FIN+' or 'FIN-' message to peer */
1611restart: 1537restart:
1538 /* Disconnect and send a 'FIN+' or 'FIN-' message to peer */
1612 buf = __skb_dequeue(&sk->sk_receive_queue); 1539 buf = __skb_dequeue(&sk->sk_receive_queue);
1613 if (buf) { 1540 if (buf) {
1614 atomic_dec(&tipc_queue_size); 1541 atomic_dec(&tipc_queue_size);
@@ -1629,7 +1556,6 @@ restart:
1629 case SS_DISCONNECTING: 1556 case SS_DISCONNECTING:
1630 1557
1631 /* Discard any unreceived messages; wake up sleeping tasks */ 1558 /* Discard any unreceived messages; wake up sleeping tasks */
1632
1633 discard_rx_queue(sk); 1559 discard_rx_queue(sk);
1634 if (waitqueue_active(sk_sleep(sk))) 1560 if (waitqueue_active(sk_sleep(sk)))
1635 wake_up_interruptible(sk_sleep(sk)); 1561 wake_up_interruptible(sk_sleep(sk));
@@ -1657,7 +1583,6 @@ restart:
1657 * 1583 *
1658 * Returns 0 on success, errno otherwise 1584 * Returns 0 on success, errno otherwise
1659 */ 1585 */
1660
1661static int setsockopt(struct socket *sock, 1586static int setsockopt(struct socket *sock,
1662 int lvl, int opt, char __user *ov, unsigned int ol) 1587 int lvl, int opt, char __user *ov, unsigned int ol)
1663{ 1588{
@@ -1717,7 +1642,6 @@ static int setsockopt(struct socket *sock,
1717 * 1642 *
1718 * Returns 0 on success, errno otherwise 1643 * Returns 0 on success, errno otherwise
1719 */ 1644 */
1720
1721static int getsockopt(struct socket *sock, 1645static int getsockopt(struct socket *sock,
1722 int lvl, int opt, char __user *ov, int __user *ol) 1646 int lvl, int opt, char __user *ov, int __user *ol)
1723{ 1647{
@@ -1778,7 +1702,6 @@ static int getsockopt(struct socket *sock,
1778/** 1702/**
1779 * Protocol switches for the various types of TIPC sockets 1703 * Protocol switches for the various types of TIPC sockets
1780 */ 1704 */
1781
1782static const struct proto_ops msg_ops = { 1705static const struct proto_ops msg_ops = {
1783 .owner = THIS_MODULE, 1706 .owner = THIS_MODULE,
1784 .family = AF_TIPC, 1707 .family = AF_TIPC,
@@ -1884,7 +1807,6 @@ int tipc_socket_init(void)
1884/** 1807/**
1885 * tipc_socket_stop - stop TIPC socket interface 1808 * tipc_socket_stop - stop TIPC socket interface
1886 */ 1809 */
1887
1888void tipc_socket_stop(void) 1810void tipc_socket_stop(void)
1889{ 1811{
1890 if (!sockets_enabled) 1812 if (!sockets_enabled)
@@ -1894,4 +1816,3 @@ void tipc_socket_stop(void)
1894 sock_unregister(tipc_family_ops.family); 1816 sock_unregister(tipc_family_ops.family);
1895 proto_unregister(&tipc_proto); 1817 proto_unregister(&tipc_proto);
1896} 1818}
1897
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index af93ea924f60..f976e9cd6a72 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -46,7 +46,6 @@
46 * @subscriber_list: adjacent subscribers in top. server's list of subscribers 46 * @subscriber_list: adjacent subscribers in top. server's list of subscribers
47 * @subscription_list: list of subscription objects for this subscriber 47 * @subscription_list: list of subscription objects for this subscriber
48 */ 48 */
49
50struct tipc_subscriber { 49struct tipc_subscriber {
51 u32 port_ref; 50 u32 port_ref;
52 spinlock_t *lock; 51 spinlock_t *lock;
@@ -61,7 +60,6 @@ struct tipc_subscriber {
61 * @subscriber_list: list of ports subscribing to service 60 * @subscriber_list: list of ports subscribing to service
62 * @lock: spinlock govering access to subscriber list 61 * @lock: spinlock govering access to subscriber list
63 */ 62 */
64
65struct top_srv { 63struct top_srv {
66 u32 setup_port; 64 u32 setup_port;
67 atomic_t subscription_count; 65 atomic_t subscription_count;
@@ -78,7 +76,6 @@ static struct top_srv topsrv;
78 * 76 *
79 * Returns converted value 77 * Returns converted value
80 */ 78 */
81
82static u32 htohl(u32 in, int swap) 79static u32 htohl(u32 in, int swap)
83{ 80{
84 return swap ? swab32(in) : in; 81 return swap ? swab32(in) : in;
@@ -90,7 +87,6 @@ static u32 htohl(u32 in, int swap)
90 * Note: Must not hold subscriber's server port lock, since tipc_send() will 87 * Note: Must not hold subscriber's server port lock, since tipc_send() will
91 * try to take the lock if the message is rejected and returned! 88 * try to take the lock if the message is rejected and returned!
92 */ 89 */
93
94static void subscr_send_event(struct tipc_subscription *sub, 90static void subscr_send_event(struct tipc_subscription *sub,
95 u32 found_lower, 91 u32 found_lower,
96 u32 found_upper, 92 u32 found_upper,
@@ -116,7 +112,6 @@ static void subscr_send_event(struct tipc_subscription *sub,
116 * 112 *
117 * Returns 1 if there is overlap, otherwise 0. 113 * Returns 1 if there is overlap, otherwise 0.
118 */ 114 */
119
120int tipc_subscr_overlap(struct tipc_subscription *sub, 115int tipc_subscr_overlap(struct tipc_subscription *sub,
121 u32 found_lower, 116 u32 found_lower,
122 u32 found_upper) 117 u32 found_upper)
@@ -136,7 +131,6 @@ int tipc_subscr_overlap(struct tipc_subscription *sub,
136 * 131 *
137 * Protected by nameseq.lock in name_table.c 132 * Protected by nameseq.lock in name_table.c
138 */ 133 */
139
140void tipc_subscr_report_overlap(struct tipc_subscription *sub, 134void tipc_subscr_report_overlap(struct tipc_subscription *sub,
141 u32 found_lower, 135 u32 found_lower,
142 u32 found_upper, 136 u32 found_upper,
@@ -156,43 +150,35 @@ void tipc_subscr_report_overlap(struct tipc_subscription *sub,
156/** 150/**
157 * subscr_timeout - subscription timeout has occurred 151 * subscr_timeout - subscription timeout has occurred
158 */ 152 */
159
160static void subscr_timeout(struct tipc_subscription *sub) 153static void subscr_timeout(struct tipc_subscription *sub)
161{ 154{
162 struct tipc_port *server_port; 155 struct tipc_port *server_port;
163 156
164 /* Validate server port reference (in case subscriber is terminating) */ 157 /* Validate server port reference (in case subscriber is terminating) */
165
166 server_port = tipc_port_lock(sub->server_ref); 158 server_port = tipc_port_lock(sub->server_ref);
167 if (server_port == NULL) 159 if (server_port == NULL)
168 return; 160 return;
169 161
170 /* Validate timeout (in case subscription is being cancelled) */ 162 /* Validate timeout (in case subscription is being cancelled) */
171
172 if (sub->timeout == TIPC_WAIT_FOREVER) { 163 if (sub->timeout == TIPC_WAIT_FOREVER) {
173 tipc_port_unlock(server_port); 164 tipc_port_unlock(server_port);
174 return; 165 return;
175 } 166 }
176 167
177 /* Unlink subscription from name table */ 168 /* Unlink subscription from name table */
178
179 tipc_nametbl_unsubscribe(sub); 169 tipc_nametbl_unsubscribe(sub);
180 170
181 /* Unlink subscription from subscriber */ 171 /* Unlink subscription from subscriber */
182
183 list_del(&sub->subscription_list); 172 list_del(&sub->subscription_list);
184 173
185 /* Release subscriber's server port */ 174 /* Release subscriber's server port */
186
187 tipc_port_unlock(server_port); 175 tipc_port_unlock(server_port);
188 176
189 /* Notify subscriber of timeout */ 177 /* Notify subscriber of timeout */
190
191 subscr_send_event(sub, sub->evt.s.seq.lower, sub->evt.s.seq.upper, 178 subscr_send_event(sub, sub->evt.s.seq.lower, sub->evt.s.seq.upper,
192 TIPC_SUBSCR_TIMEOUT, 0, 0); 179 TIPC_SUBSCR_TIMEOUT, 0, 0);
193 180
194 /* Now destroy subscription */ 181 /* Now destroy subscription */
195
196 k_term_timer(&sub->timer); 182 k_term_timer(&sub->timer);
197 kfree(sub); 183 kfree(sub);
198 atomic_dec(&topsrv.subscription_count); 184 atomic_dec(&topsrv.subscription_count);
@@ -203,7 +189,6 @@ static void subscr_timeout(struct tipc_subscription *sub)
203 * 189 *
204 * Called with subscriber port locked. 190 * Called with subscriber port locked.
205 */ 191 */
206
207static void subscr_del(struct tipc_subscription *sub) 192static void subscr_del(struct tipc_subscription *sub)
208{ 193{
209 tipc_nametbl_unsubscribe(sub); 194 tipc_nametbl_unsubscribe(sub);
@@ -222,7 +207,6 @@ static void subscr_del(struct tipc_subscription *sub)
222 * a new object reference in the interim that uses this lock; this routine will 207 * a new object reference in the interim that uses this lock; this routine will
223 * simply wait for it to be released, then claim it.) 208 * simply wait for it to be released, then claim it.)
224 */ 209 */
225
226static void subscr_terminate(struct tipc_subscriber *subscriber) 210static void subscr_terminate(struct tipc_subscriber *subscriber)
227{ 211{
228 u32 port_ref; 212 u32 port_ref;
@@ -230,18 +214,15 @@ static void subscr_terminate(struct tipc_subscriber *subscriber)
230 struct tipc_subscription *sub_temp; 214 struct tipc_subscription *sub_temp;
231 215
232 /* Invalidate subscriber reference */ 216 /* Invalidate subscriber reference */
233
234 port_ref = subscriber->port_ref; 217 port_ref = subscriber->port_ref;
235 subscriber->port_ref = 0; 218 subscriber->port_ref = 0;
236 spin_unlock_bh(subscriber->lock); 219 spin_unlock_bh(subscriber->lock);
237 220
238 /* Sever connection to subscriber */ 221 /* Sever connection to subscriber */
239
240 tipc_shutdown(port_ref); 222 tipc_shutdown(port_ref);
241 tipc_deleteport(port_ref); 223 tipc_deleteport(port_ref);
242 224
243 /* Destroy any existing subscriptions for subscriber */ 225 /* Destroy any existing subscriptions for subscriber */
244
245 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, 226 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
246 subscription_list) { 227 subscription_list) {
247 if (sub->timeout != TIPC_WAIT_FOREVER) { 228 if (sub->timeout != TIPC_WAIT_FOREVER) {
@@ -252,17 +233,14 @@ static void subscr_terminate(struct tipc_subscriber *subscriber)
252 } 233 }
253 234
254 /* Remove subscriber from topology server's subscriber list */ 235 /* Remove subscriber from topology server's subscriber list */
255
256 spin_lock_bh(&topsrv.lock); 236 spin_lock_bh(&topsrv.lock);
257 list_del(&subscriber->subscriber_list); 237 list_del(&subscriber->subscriber_list);
258 spin_unlock_bh(&topsrv.lock); 238 spin_unlock_bh(&topsrv.lock);
259 239
260 /* Reclaim subscriber lock */ 240 /* Reclaim subscriber lock */
261
262 spin_lock_bh(subscriber->lock); 241 spin_lock_bh(subscriber->lock);
263 242
264 /* Now destroy subscriber */ 243 /* Now destroy subscriber */
265
266 kfree(subscriber); 244 kfree(subscriber);
267} 245}
268 246
@@ -275,7 +253,6 @@ static void subscr_terminate(struct tipc_subscriber *subscriber)
275 * 253 *
276 * Note that fields of 's' use subscriber's endianness! 254 * Note that fields of 's' use subscriber's endianness!
277 */ 255 */
278
279static void subscr_cancel(struct tipc_subscr *s, 256static void subscr_cancel(struct tipc_subscr *s,
280 struct tipc_subscriber *subscriber) 257 struct tipc_subscriber *subscriber)
281{ 258{
@@ -284,7 +261,6 @@ static void subscr_cancel(struct tipc_subscr *s,
284 int found = 0; 261 int found = 0;
285 262
286 /* Find first matching subscription, exit if not found */ 263 /* Find first matching subscription, exit if not found */
287
288 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, 264 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
289 subscription_list) { 265 subscription_list) {
290 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) { 266 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) {
@@ -296,7 +272,6 @@ static void subscr_cancel(struct tipc_subscr *s,
296 return; 272 return;
297 273
298 /* Cancel subscription timer (if used), then delete subscription */ 274 /* Cancel subscription timer (if used), then delete subscription */
299
300 if (sub->timeout != TIPC_WAIT_FOREVER) { 275 if (sub->timeout != TIPC_WAIT_FOREVER) {
301 sub->timeout = TIPC_WAIT_FOREVER; 276 sub->timeout = TIPC_WAIT_FOREVER;
302 spin_unlock_bh(subscriber->lock); 277 spin_unlock_bh(subscriber->lock);
@@ -312,7 +287,6 @@ static void subscr_cancel(struct tipc_subscr *s,
312 * 287 *
313 * Called with subscriber port locked. 288 * Called with subscriber port locked.
314 */ 289 */
315
316static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, 290static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
317 struct tipc_subscriber *subscriber) 291 struct tipc_subscriber *subscriber)
318{ 292{
@@ -320,11 +294,9 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
320 int swap; 294 int swap;
321 295
322 /* Determine subscriber's endianness */ 296 /* Determine subscriber's endianness */
323
324 swap = !(s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE)); 297 swap = !(s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE));
325 298
326 /* Detect & process a subscription cancellation request */ 299 /* Detect & process a subscription cancellation request */
327
328 if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) { 300 if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) {
329 s->filter &= ~htohl(TIPC_SUB_CANCEL, swap); 301 s->filter &= ~htohl(TIPC_SUB_CANCEL, swap);
330 subscr_cancel(s, subscriber); 302 subscr_cancel(s, subscriber);
@@ -332,7 +304,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
332 } 304 }
333 305
334 /* Refuse subscription if global limit exceeded */ 306 /* Refuse subscription if global limit exceeded */
335
336 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) { 307 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
337 warn("Subscription rejected, subscription limit reached (%u)\n", 308 warn("Subscription rejected, subscription limit reached (%u)\n",
338 tipc_max_subscriptions); 309 tipc_max_subscriptions);
@@ -341,7 +312,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
341 } 312 }
342 313
343 /* Allocate subscription object */ 314 /* Allocate subscription object */
344
345 sub = kmalloc(sizeof(*sub), GFP_ATOMIC); 315 sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
346 if (!sub) { 316 if (!sub) {
347 warn("Subscription rejected, no memory\n"); 317 warn("Subscription rejected, no memory\n");
@@ -350,7 +320,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
350 } 320 }
351 321
352 /* Initialize subscription object */ 322 /* Initialize subscription object */
353
354 sub->seq.type = htohl(s->seq.type, swap); 323 sub->seq.type = htohl(s->seq.type, swap);
355 sub->seq.lower = htohl(s->seq.lower, swap); 324 sub->seq.lower = htohl(s->seq.lower, swap);
356 sub->seq.upper = htohl(s->seq.upper, swap); 325 sub->seq.upper = htohl(s->seq.upper, swap);
@@ -384,7 +353,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
384 * 353 *
385 * Called with subscriber's server port unlocked. 354 * Called with subscriber's server port unlocked.
386 */ 355 */
387
388static void subscr_conn_shutdown_event(void *usr_handle, 356static void subscr_conn_shutdown_event(void *usr_handle,
389 u32 port_ref, 357 u32 port_ref,
390 struct sk_buff **buf, 358 struct sk_buff **buf,
@@ -408,7 +376,6 @@ static void subscr_conn_shutdown_event(void *usr_handle,
408 * 376 *
409 * Called with subscriber's server port unlocked. 377 * Called with subscriber's server port unlocked.
410 */ 378 */
411
412static void subscr_conn_msg_event(void *usr_handle, 379static void subscr_conn_msg_event(void *usr_handle,
413 u32 port_ref, 380 u32 port_ref,
414 struct sk_buff **buf, 381 struct sk_buff **buf,
@@ -423,7 +390,6 @@ static void subscr_conn_msg_event(void *usr_handle,
423 * Lock subscriber's server port (& make a local copy of lock pointer, 390 * Lock subscriber's server port (& make a local copy of lock pointer,
424 * in case subscriber is deleted while processing subscription request) 391 * in case subscriber is deleted while processing subscription request)
425 */ 392 */
426
427 if (tipc_port_lock(port_ref) == NULL) 393 if (tipc_port_lock(port_ref) == NULL)
428 return; 394 return;
429 395
@@ -451,7 +417,6 @@ static void subscr_conn_msg_event(void *usr_handle,
451 * timeout code cannot delete the subscription, 417 * timeout code cannot delete the subscription,
452 * so the subscription object is still protected. 418 * so the subscription object is still protected.
453 */ 419 */
454
455 tipc_nametbl_subscribe(sub); 420 tipc_nametbl_subscribe(sub);
456 } 421 }
457 } 422 }
@@ -460,7 +425,6 @@ static void subscr_conn_msg_event(void *usr_handle,
460/** 425/**
461 * subscr_named_msg_event - handle request to establish a new subscriber 426 * subscr_named_msg_event - handle request to establish a new subscriber
462 */ 427 */
463
464static void subscr_named_msg_event(void *usr_handle, 428static void subscr_named_msg_event(void *usr_handle,
465 u32 port_ref, 429 u32 port_ref,
466 struct sk_buff **buf, 430 struct sk_buff **buf,
@@ -474,7 +438,6 @@ static void subscr_named_msg_event(void *usr_handle,
474 u32 server_port_ref; 438 u32 server_port_ref;
475 439
476 /* Create subscriber object */ 440 /* Create subscriber object */
477
478 subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC); 441 subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC);
479 if (subscriber == NULL) { 442 if (subscriber == NULL) {
480 warn("Subscriber rejected, no memory\n"); 443 warn("Subscriber rejected, no memory\n");
@@ -484,7 +447,6 @@ static void subscr_named_msg_event(void *usr_handle,
484 INIT_LIST_HEAD(&subscriber->subscriber_list); 447 INIT_LIST_HEAD(&subscriber->subscriber_list);
485 448
486 /* Create server port & establish connection to subscriber */ 449 /* Create server port & establish connection to subscriber */
487
488 tipc_createport(subscriber, 450 tipc_createport(subscriber,
489 importance, 451 importance,
490 NULL, 452 NULL,
@@ -503,26 +465,21 @@ static void subscr_named_msg_event(void *usr_handle,
503 tipc_connect2port(subscriber->port_ref, orig); 465 tipc_connect2port(subscriber->port_ref, orig);
504 466
505 /* Lock server port (& save lock address for future use) */ 467 /* Lock server port (& save lock address for future use) */
506
507 subscriber->lock = tipc_port_lock(subscriber->port_ref)->lock; 468 subscriber->lock = tipc_port_lock(subscriber->port_ref)->lock;
508 469
509 /* Add subscriber to topology server's subscriber list */ 470 /* Add subscriber to topology server's subscriber list */
510
511 spin_lock_bh(&topsrv.lock); 471 spin_lock_bh(&topsrv.lock);
512 list_add(&subscriber->subscriber_list, &topsrv.subscriber_list); 472 list_add(&subscriber->subscriber_list, &topsrv.subscriber_list);
513 spin_unlock_bh(&topsrv.lock); 473 spin_unlock_bh(&topsrv.lock);
514 474
515 /* Unlock server port */ 475 /* Unlock server port */
516
517 server_port_ref = subscriber->port_ref; 476 server_port_ref = subscriber->port_ref;
518 spin_unlock_bh(subscriber->lock); 477 spin_unlock_bh(subscriber->lock);
519 478
520 /* Send an ACK- to complete connection handshaking */ 479 /* Send an ACK- to complete connection handshaking */
521
522 tipc_send(server_port_ref, 0, NULL, 0); 480 tipc_send(server_port_ref, 0, NULL, 0);
523 481
524 /* Handle optional subscription request */ 482 /* Handle optional subscription request */
525
526 if (size != 0) { 483 if (size != 0) {
527 subscr_conn_msg_event(subscriber, server_port_ref, 484 subscr_conn_msg_event(subscriber, server_port_ref,
528 buf, data, size); 485 buf, data, size);
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
index ef6529c8456f..218d2e07f0cc 100644
--- a/net/tipc/subscr.h
+++ b/net/tipc/subscr.h
@@ -51,7 +51,6 @@ struct tipc_subscription;
51 * @swap: indicates if subscriber uses opposite endianness in its messages 51 * @swap: indicates if subscriber uses opposite endianness in its messages
52 * @evt: template for events generated by subscription 52 * @evt: template for events generated by subscription
53 */ 53 */
54
55struct tipc_subscription { 54struct tipc_subscription {
56 struct tipc_name_seq seq; 55 struct tipc_name_seq seq;
57 u32 timeout; 56 u32 timeout;
@@ -80,5 +79,4 @@ int tipc_subscr_start(void);
80 79
81void tipc_subscr_stop(void); 80void tipc_subscr_stop(void);
82 81
83
84#endif 82#endif