aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/addr.h2
-rw-r--r--net/tipc/bcast.c28
-rw-r--r--net/tipc/bcast.h4
-rw-r--r--net/tipc/bearer.c42
-rw-r--r--net/tipc/bearer.h7
-rw-r--r--net/tipc/core.c2
-rw-r--r--net/tipc/discover.c4
-rw-r--r--net/tipc/discover.h2
-rw-r--r--net/tipc/link.c608
-rw-r--r--net/tipc/link.h57
-rw-r--r--net/tipc/name_distr.c8
-rw-r--r--net/tipc/name_distr.h2
-rw-r--r--net/tipc/net.c10
-rw-r--r--net/tipc/node.c14
-rw-r--r--net/tipc/port.c97
-rw-r--r--net/tipc/port.h26
-rw-r--r--net/tipc/socket.c188
17 files changed, 569 insertions, 532 deletions
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index 60b00ab93d74..a74acf9ee804 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -37,6 +37,8 @@
37#ifndef _TIPC_ADDR_H 37#ifndef _TIPC_ADDR_H
38#define _TIPC_ADDR_H 38#define _TIPC_ADDR_H
39 39
40#include "core.h"
41
40#define TIPC_ZONE_MASK 0xff000000u 42#define TIPC_ZONE_MASK 0xff000000u
41#define TIPC_CLUSTER_MASK 0xfffff000u 43#define TIPC_CLUSTER_MASK 0xfffff000u
42 44
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index bf860d9e75af..e0feb7ef1469 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -356,9 +356,9 @@ static void bclink_peek_nack(struct tipc_msg *msg)
356} 356}
357 357
358/* 358/*
359 * tipc_bclink_send_msg - broadcast a packet to all nodes in cluster 359 * tipc_bclink_xmit - broadcast a packet to all nodes in cluster
360 */ 360 */
361int tipc_bclink_send_msg(struct sk_buff *buf) 361int tipc_bclink_xmit(struct sk_buff *buf)
362{ 362{
363 int res; 363 int res;
364 364
@@ -370,7 +370,7 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
370 goto exit; 370 goto exit;
371 } 371 }
372 372
373 res = tipc_link_send_buf(bcl, buf); 373 res = __tipc_link_xmit(bcl, buf);
374 if (likely(res >= 0)) { 374 if (likely(res >= 0)) {
375 bclink_set_last_sent(); 375 bclink_set_last_sent();
376 bcl->stats.queue_sz_counts++; 376 bcl->stats.queue_sz_counts++;
@@ -399,19 +399,18 @@ static void bclink_accept_pkt(struct tipc_node *node, u32 seqno)
399 */ 399 */
400 400
401 if (((seqno - tipc_own_addr) % TIPC_MIN_LINK_WIN) == 0) { 401 if (((seqno - tipc_own_addr) % TIPC_MIN_LINK_WIN) == 0) {
402 tipc_link_send_proto_msg( 402 tipc_link_proto_xmit(node->active_links[node->addr & 1],
403 node->active_links[node->addr & 1], 403 STATE_MSG, 0, 0, 0, 0, 0);
404 STATE_MSG, 0, 0, 0, 0, 0);
405 bcl->stats.sent_acks++; 404 bcl->stats.sent_acks++;
406 } 405 }
407} 406}
408 407
409/** 408/**
410 * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards 409 * tipc_bclink_rcv - receive a broadcast packet, and deliver upwards
411 * 410 *
412 * tipc_net_lock is read_locked, no other locks set 411 * tipc_net_lock is read_locked, no other locks set
413 */ 412 */
414void tipc_bclink_recv_pkt(struct sk_buff *buf) 413void tipc_bclink_rcv(struct sk_buff *buf)
415{ 414{
416 struct tipc_msg *msg = buf_msg(buf); 415 struct tipc_msg *msg = buf_msg(buf);
417 struct tipc_node *node; 416 struct tipc_node *node;
@@ -468,7 +467,7 @@ receive:
468 spin_unlock_bh(&bc_lock); 467 spin_unlock_bh(&bc_lock);
469 tipc_node_unlock(node); 468 tipc_node_unlock(node);
470 if (likely(msg_mcast(msg))) 469 if (likely(msg_mcast(msg)))
471 tipc_port_recv_mcast(buf, NULL); 470 tipc_port_mcast_rcv(buf, NULL);
472 else 471 else
473 kfree_skb(buf); 472 kfree_skb(buf);
474 } else if (msg_user(msg) == MSG_BUNDLER) { 473 } else if (msg_user(msg) == MSG_BUNDLER) {
@@ -478,12 +477,12 @@ receive:
478 bcl->stats.recv_bundled += msg_msgcnt(msg); 477 bcl->stats.recv_bundled += msg_msgcnt(msg);
479 spin_unlock_bh(&bc_lock); 478 spin_unlock_bh(&bc_lock);
480 tipc_node_unlock(node); 479 tipc_node_unlock(node);
481 tipc_link_recv_bundle(buf); 480 tipc_link_bundle_rcv(buf);
482 } else if (msg_user(msg) == MSG_FRAGMENTER) { 481 } else if (msg_user(msg) == MSG_FRAGMENTER) {
483 int ret; 482 int ret;
484 ret = tipc_link_recv_fragment(&node->bclink.reasm_head, 483 ret = tipc_link_frag_rcv(&node->bclink.reasm_head,
485 &node->bclink.reasm_tail, 484 &node->bclink.reasm_tail,
486 &buf); 485 &buf);
487 if (ret == LINK_REASM_ERROR) 486 if (ret == LINK_REASM_ERROR)
488 goto unlock; 487 goto unlock;
489 spin_lock_bh(&bc_lock); 488 spin_lock_bh(&bc_lock);
@@ -503,7 +502,7 @@ receive:
503 bclink_accept_pkt(node, seqno); 502 bclink_accept_pkt(node, seqno);
504 spin_unlock_bh(&bc_lock); 503 spin_unlock_bh(&bc_lock);
505 tipc_node_unlock(node); 504 tipc_node_unlock(node);
506 tipc_named_recv(buf); 505 tipc_named_rcv(buf);
507 } else { 506 } else {
508 spin_lock_bh(&bc_lock); 507 spin_lock_bh(&bc_lock);
509 bclink_accept_pkt(node, seqno); 508 bclink_accept_pkt(node, seqno);
@@ -785,7 +784,6 @@ void tipc_bclink_init(void)
785 bcl->owner = &bclink->node; 784 bcl->owner = &bclink->node;
786 bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; 785 bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
787 tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); 786 tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
788 spin_lock_init(&bcbearer->bearer.lock);
789 bcl->b_ptr = &bcbearer->bearer; 787 bcl->b_ptr = &bcbearer->bearer;
790 bcl->state = WORKING_WORKING; 788 bcl->state = WORKING_WORKING;
791 strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME); 789 strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME);
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
index 6ee587b469fd..a80ef54b818e 100644
--- a/net/tipc/bcast.h
+++ b/net/tipc/bcast.h
@@ -90,8 +90,8 @@ void tipc_bclink_add_node(u32 addr);
90void tipc_bclink_remove_node(u32 addr); 90void tipc_bclink_remove_node(u32 addr);
91struct tipc_node *tipc_bclink_retransmit_to(void); 91struct tipc_node *tipc_bclink_retransmit_to(void);
92void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked); 92void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked);
93int tipc_bclink_send_msg(struct sk_buff *buf); 93int tipc_bclink_xmit(struct sk_buff *buf);
94void tipc_bclink_recv_pkt(struct sk_buff *buf); 94void tipc_bclink_rcv(struct sk_buff *buf);
95u32 tipc_bclink_get_last_sent(void); 95u32 tipc_bclink_get_last_sent(void);
96u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr); 96u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr);
97void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent); 97void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent);
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 574b86193b15..89c4c2d23ac0 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -51,7 +51,7 @@ static struct tipc_media * const media_info_array[] = {
51 51
52struct tipc_bearer tipc_bearers[MAX_BEARERS]; 52struct tipc_bearer tipc_bearers[MAX_BEARERS];
53 53
54static void bearer_disable(struct tipc_bearer *b_ptr); 54static void bearer_disable(struct tipc_bearer *b_ptr, bool shutting_down);
55 55
56/** 56/**
57 * tipc_media_find - locates specified media object by name 57 * tipc_media_find - locates specified media object by name
@@ -327,12 +327,10 @@ restart:
327 b_ptr->net_plane = bearer_id + 'A'; 327 b_ptr->net_plane = bearer_id + 'A';
328 b_ptr->active = 1; 328 b_ptr->active = 1;
329 b_ptr->priority = priority; 329 b_ptr->priority = priority;
330 INIT_LIST_HEAD(&b_ptr->links);
331 spin_lock_init(&b_ptr->lock);
332 330
333 res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain); 331 res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain);
334 if (res) { 332 if (res) {
335 bearer_disable(b_ptr); 333 bearer_disable(b_ptr, false);
336 pr_warn("Bearer <%s> rejected, discovery object creation failed\n", 334 pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
337 name); 335 name);
338 goto exit; 336 goto exit;
@@ -350,20 +348,9 @@ exit:
350 */ 348 */
351static int tipc_reset_bearer(struct tipc_bearer *b_ptr) 349static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
352{ 350{
353 struct tipc_link *l_ptr;
354 struct tipc_link *temp_l_ptr;
355
356 read_lock_bh(&tipc_net_lock); 351 read_lock_bh(&tipc_net_lock);
357 pr_info("Resetting bearer <%s>\n", b_ptr->name); 352 pr_info("Resetting bearer <%s>\n", b_ptr->name);
358 spin_lock_bh(&b_ptr->lock); 353 tipc_link_reset_list(b_ptr->identity);
359 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
360 struct tipc_node *n_ptr = l_ptr->owner;
361
362 spin_lock_bh(&n_ptr->lock);
363 tipc_link_reset(l_ptr);
364 spin_unlock_bh(&n_ptr->lock);
365 }
366 spin_unlock_bh(&b_ptr->lock);
367 read_unlock_bh(&tipc_net_lock); 354 read_unlock_bh(&tipc_net_lock);
368 return 0; 355 return 0;
369} 356}
@@ -373,25 +360,14 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
373 * 360 *
374 * Note: This routine assumes caller holds tipc_net_lock. 361 * Note: This routine assumes caller holds tipc_net_lock.
375 */ 362 */
376static void bearer_disable(struct tipc_bearer *b_ptr) 363static void bearer_disable(struct tipc_bearer *b_ptr, bool shutting_down)
377{ 364{
378 struct tipc_link *l_ptr;
379 struct tipc_link *temp_l_ptr;
380 struct tipc_link_req *temp_req;
381
382 pr_info("Disabling bearer <%s>\n", b_ptr->name); 365 pr_info("Disabling bearer <%s>\n", b_ptr->name);
383 spin_lock_bh(&b_ptr->lock);
384 b_ptr->media->disable_media(b_ptr); 366 b_ptr->media->disable_media(b_ptr);
385 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
386 tipc_link_delete(l_ptr);
387 }
388 temp_req = b_ptr->link_req;
389 b_ptr->link_req = NULL;
390 spin_unlock_bh(&b_ptr->lock);
391
392 if (temp_req)
393 tipc_disc_delete(temp_req);
394 367
368 tipc_link_delete_list(b_ptr->identity, shutting_down);
369 if (b_ptr->link_req)
370 tipc_disc_delete(b_ptr->link_req);
395 memset(b_ptr, 0, sizeof(struct tipc_bearer)); 371 memset(b_ptr, 0, sizeof(struct tipc_bearer));
396} 372}
397 373
@@ -406,7 +382,7 @@ int tipc_disable_bearer(const char *name)
406 pr_warn("Attempt to disable unknown bearer <%s>\n", name); 382 pr_warn("Attempt to disable unknown bearer <%s>\n", name);
407 res = -EINVAL; 383 res = -EINVAL;
408 } else { 384 } else {
409 bearer_disable(b_ptr); 385 bearer_disable(b_ptr, false);
410 res = 0; 386 res = 0;
411 } 387 }
412 write_unlock_bh(&tipc_net_lock); 388 write_unlock_bh(&tipc_net_lock);
@@ -631,6 +607,6 @@ void tipc_bearer_stop(void)
631 607
632 for (i = 0; i < MAX_BEARERS; i++) { 608 for (i = 0; i < MAX_BEARERS; i++) {
633 if (tipc_bearers[i].active) 609 if (tipc_bearers[i].active)
634 bearer_disable(&tipc_bearers[i]); 610 bearer_disable(&tipc_bearers[i], true);
635 } 611 }
636} 612}
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 4f5db9ad5bf6..425dd8107a8f 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -107,10 +107,8 @@ struct tipc_media {
107 107
108/** 108/**
109 * struct tipc_bearer - Generic TIPC bearer structure 109 * struct tipc_bearer - Generic TIPC bearer structure
110 * @dev: ptr to associated network device 110 * @media_ptr: pointer to additional media-specific information about bearer
111 * @usr_handle: pointer to additional media-specific information about bearer
112 * @mtu: max packet size bearer can support 111 * @mtu: max packet size bearer can support
113 * @lock: spinlock for controlling access to bearer
114 * @addr: media-specific address associated with bearer 112 * @addr: media-specific address associated with bearer
115 * @name: bearer name (format = media:interface) 113 * @name: bearer name (format = media:interface)
116 * @media: ptr to media structure associated with bearer 114 * @media: ptr to media structure associated with bearer
@@ -120,7 +118,6 @@ struct tipc_media {
120 * @tolerance: default link tolerance for bearer 118 * @tolerance: default link tolerance for bearer
121 * @identity: array index of this bearer within TIPC bearer array 119 * @identity: array index of this bearer within TIPC bearer array
122 * @link_req: ptr to (optional) structure making periodic link setup requests 120 * @link_req: ptr to (optional) structure making periodic link setup requests
123 * @links: list of non-congested links associated with bearer
124 * @active: non-zero if bearer structure is represents a bearer 121 * @active: non-zero if bearer structure is represents a bearer
125 * @net_plane: network plane ('A' through 'H') currently associated with bearer 122 * @net_plane: network plane ('A' through 'H') currently associated with bearer
126 * @nodes: indicates which nodes in cluster can be reached through bearer 123 * @nodes: indicates which nodes in cluster can be reached through bearer
@@ -134,7 +131,6 @@ struct tipc_bearer {
134 u32 mtu; /* initalized by media */ 131 u32 mtu; /* initalized by media */
135 struct tipc_media_addr addr; /* initalized by media */ 132 struct tipc_media_addr addr; /* initalized by media */
136 char name[TIPC_MAX_BEARER_NAME]; 133 char name[TIPC_MAX_BEARER_NAME];
137 spinlock_t lock;
138 struct tipc_media *media; 134 struct tipc_media *media;
139 struct tipc_media_addr bcast_addr; 135 struct tipc_media_addr bcast_addr;
140 u32 priority; 136 u32 priority;
@@ -142,7 +138,6 @@ struct tipc_bearer {
142 u32 tolerance; 138 u32 tolerance;
143 u32 identity; 139 u32 identity;
144 struct tipc_link_req *link_req; 140 struct tipc_link_req *link_req;
145 struct list_head links;
146 int active; 141 int active;
147 char net_plane; 142 char net_plane;
148 struct tipc_node_map nodes; 143 struct tipc_node_map nodes;
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 80c20647b3d2..e2491b341edb 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/core.c: TIPC module code 2 * net/tipc/core.c: TIPC module code
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, 2013, Ericsson AB
5 * Copyright (c) 2005-2006, 2010-2013, Wind River Systems 5 * Copyright (c) 2005-2006, 2010-2013, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 412ff41b8611..fa94da6db3d4 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -110,11 +110,11 @@ static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr,
110} 110}
111 111
112/** 112/**
113 * tipc_disc_recv_msg - handle incoming link setup message (request or response) 113 * tipc_disc_rcv - handle incoming link setup message (request or response)
114 * @buf: buffer containing message 114 * @buf: buffer containing message
115 * @b_ptr: bearer that message arrived on 115 * @b_ptr: bearer that message arrived on
116 */ 116 */
117void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr) 117void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
118{ 118{
119 struct tipc_node *n_ptr; 119 struct tipc_node *n_ptr;
120 struct tipc_link *link; 120 struct tipc_link *link;
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index 75b67c403aa3..b4fc962c3623 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -44,6 +44,6 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
44void tipc_disc_delete(struct tipc_link_req *req); 44void tipc_disc_delete(struct tipc_link_req *req);
45void tipc_disc_add_dest(struct tipc_link_req *req); 45void tipc_disc_add_dest(struct tipc_link_req *req);
46void tipc_disc_remove_dest(struct tipc_link_req *req); 46void tipc_disc_remove_dest(struct tipc_link_req *req);
47void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr); 47void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr);
48 48
49#endif 49#endif
diff --git a/net/tipc/link.c b/net/tipc/link.c
index da6018beb6eb..d1a764b9b2d8 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -77,19 +77,19 @@ static const char *link_unk_evt = "Unknown link event ";
77 77
78static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr, 78static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
79 struct sk_buff *buf); 79 struct sk_buff *buf);
80static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf); 80static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf);
81static int tipc_link_tunnel_rcv(struct tipc_link **l_ptr, 81static int tipc_link_tunnel_rcv(struct tipc_node *n_ptr,
82 struct sk_buff **buf); 82 struct sk_buff **buf);
83static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance); 83static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance);
84static int link_send_sections_long(struct tipc_port *sender, 84static int tipc_link_iovec_long_xmit(struct tipc_port *sender,
85 struct iovec const *msg_sect, 85 struct iovec const *msg_sect,
86 unsigned int len, u32 destnode); 86 unsigned int len, u32 destnode);
87static void link_state_event(struct tipc_link *l_ptr, u32 event); 87static void link_state_event(struct tipc_link *l_ptr, u32 event);
88static void link_reset_statistics(struct tipc_link *l_ptr); 88static void link_reset_statistics(struct tipc_link *l_ptr);
89static void link_print(struct tipc_link *l_ptr, const char *str); 89static void link_print(struct tipc_link *l_ptr, const char *str);
90static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf); 90static int tipc_link_frag_xmit(struct tipc_link *l_ptr, struct sk_buff *buf);
91static void tipc_link_send_sync(struct tipc_link *l); 91static void tipc_link_sync_xmit(struct tipc_link *l);
92static void tipc_link_recv_sync(struct tipc_node *n, struct sk_buff *buf); 92static void tipc_link_sync_rcv(struct tipc_node *n, struct sk_buff *buf);
93 93
94/* 94/*
95 * Simple link routines 95 * Simple link routines
@@ -147,11 +147,6 @@ int tipc_link_is_active(struct tipc_link *l_ptr)
147/** 147/**
148 * link_timeout - handle expiration of link timer 148 * link_timeout - handle expiration of link timer
149 * @l_ptr: pointer to link 149 * @l_ptr: pointer to link
150 *
151 * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict
152 * with tipc_link_delete(). (There is no risk that the node will be deleted by
153 * another thread because tipc_link_delete() always cancels the link timer before
154 * tipc_node_delete() is called.)
155 */ 150 */
156static void link_timeout(struct tipc_link *l_ptr) 151static void link_timeout(struct tipc_link *l_ptr)
157{ 152{
@@ -213,8 +208,8 @@ static void link_set_timer(struct tipc_link *l_ptr, u32 time)
213 * Returns pointer to link. 208 * Returns pointer to link.
214 */ 209 */
215struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, 210struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
216 struct tipc_bearer *b_ptr, 211 struct tipc_bearer *b_ptr,
217 const struct tipc_media_addr *media_addr) 212 const struct tipc_media_addr *media_addr)
218{ 213{
219 struct tipc_link *l_ptr; 214 struct tipc_link *l_ptr;
220 struct tipc_msg *msg; 215 struct tipc_msg *msg;
@@ -279,41 +274,43 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
279 274
280 k_init_timer(&l_ptr->timer, (Handler)link_timeout, 275 k_init_timer(&l_ptr->timer, (Handler)link_timeout,
281 (unsigned long)l_ptr); 276 (unsigned long)l_ptr);
282 list_add_tail(&l_ptr->link_list, &b_ptr->links);
283 277
284 link_state_event(l_ptr, STARTING_EVT); 278 link_state_event(l_ptr, STARTING_EVT);
285 279
286 return l_ptr; 280 return l_ptr;
287} 281}
288 282
289/**
290 * tipc_link_delete - delete a link
291 * @l_ptr: pointer to link
292 *
293 * Note: 'tipc_net_lock' is write_locked, bearer is locked.
294 * This routine must not grab the node lock until after link timer cancellation
295 * to avoid a potential deadlock situation.
296 */
297void tipc_link_delete(struct tipc_link *l_ptr)
298{
299 if (!l_ptr) {
300 pr_err("Attempt to delete non-existent link\n");
301 return;
302 }
303 283
304 k_cancel_timer(&l_ptr->timer); 284void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down)
285{
286 struct tipc_link *l_ptr;
287 struct tipc_node *n_ptr;
305 288
306 tipc_node_lock(l_ptr->owner); 289 list_for_each_entry(n_ptr, &tipc_node_list, list) {
307 tipc_link_reset(l_ptr); 290 spin_lock_bh(&n_ptr->lock);
308 tipc_node_detach_link(l_ptr->owner, l_ptr); 291 l_ptr = n_ptr->links[bearer_id];
309 tipc_link_purge_queues(l_ptr); 292 if (l_ptr) {
310 list_del_init(&l_ptr->link_list); 293 tipc_link_reset(l_ptr);
311 tipc_node_unlock(l_ptr->owner); 294 if (shutting_down || !tipc_node_is_up(n_ptr)) {
312 k_term_timer(&l_ptr->timer); 295 tipc_node_detach_link(l_ptr->owner, l_ptr);
313 kfree(l_ptr); 296 tipc_link_reset_fragments(l_ptr);
297 spin_unlock_bh(&n_ptr->lock);
298
299 /* Nobody else can access this link now: */
300 del_timer_sync(&l_ptr->timer);
301 kfree(l_ptr);
302 } else {
303 /* Detach/delete when failover is finished: */
304 l_ptr->flags |= LINK_STOPPED;
305 spin_unlock_bh(&n_ptr->lock);
306 del_timer_sync(&l_ptr->timer);
307 }
308 continue;
309 }
310 spin_unlock_bh(&n_ptr->lock);
311 }
314} 312}
315 313
316
317/** 314/**
318 * link_schedule_port - schedule port for deferred sending 315 * link_schedule_port - schedule port for deferred sending
319 * @l_ptr: pointer to link 316 * @l_ptr: pointer to link
@@ -461,6 +458,19 @@ void tipc_link_reset(struct tipc_link *l_ptr)
461 link_reset_statistics(l_ptr); 458 link_reset_statistics(l_ptr);
462} 459}
463 460
461void tipc_link_reset_list(unsigned int bearer_id)
462{
463 struct tipc_link *l_ptr;
464 struct tipc_node *n_ptr;
465
466 list_for_each_entry(n_ptr, &tipc_node_list, list) {
467 spin_lock_bh(&n_ptr->lock);
468 l_ptr = n_ptr->links[bearer_id];
469 if (l_ptr)
470 tipc_link_reset(l_ptr);
471 spin_unlock_bh(&n_ptr->lock);
472 }
473}
464 474
465static void link_activate(struct tipc_link *l_ptr) 475static void link_activate(struct tipc_link *l_ptr)
466{ 476{
@@ -479,7 +489,10 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
479 struct tipc_link *other; 489 struct tipc_link *other;
480 u32 cont_intv = l_ptr->continuity_interval; 490 u32 cont_intv = l_ptr->continuity_interval;
481 491
482 if (!l_ptr->started && (event != STARTING_EVT)) 492 if (l_ptr->flags & LINK_STOPPED)
493 return;
494
495 if (!(l_ptr->flags & LINK_STARTED) && (event != STARTING_EVT))
483 return; /* Not yet. */ 496 return; /* Not yet. */
484 497
485 /* Check whether changeover is going on */ 498 /* Check whether changeover is going on */
@@ -499,12 +512,12 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
499 if (l_ptr->next_in_no != l_ptr->checkpoint) { 512 if (l_ptr->next_in_no != l_ptr->checkpoint) {
500 l_ptr->checkpoint = l_ptr->next_in_no; 513 l_ptr->checkpoint = l_ptr->next_in_no;
501 if (tipc_bclink_acks_missing(l_ptr->owner)) { 514 if (tipc_bclink_acks_missing(l_ptr->owner)) {
502 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 515 tipc_link_proto_xmit(l_ptr, STATE_MSG,
503 0, 0, 0, 0, 0); 516 0, 0, 0, 0, 0);
504 l_ptr->fsm_msg_cnt++; 517 l_ptr->fsm_msg_cnt++;
505 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { 518 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) {
506 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 519 tipc_link_proto_xmit(l_ptr, STATE_MSG,
507 1, 0, 0, 0, 0); 520 1, 0, 0, 0, 0);
508 l_ptr->fsm_msg_cnt++; 521 l_ptr->fsm_msg_cnt++;
509 } 522 }
510 link_set_timer(l_ptr, cont_intv); 523 link_set_timer(l_ptr, cont_intv);
@@ -512,7 +525,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
512 } 525 }
513 l_ptr->state = WORKING_UNKNOWN; 526 l_ptr->state = WORKING_UNKNOWN;
514 l_ptr->fsm_msg_cnt = 0; 527 l_ptr->fsm_msg_cnt = 0;
515 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 528 tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
516 l_ptr->fsm_msg_cnt++; 529 l_ptr->fsm_msg_cnt++;
517 link_set_timer(l_ptr, cont_intv / 4); 530 link_set_timer(l_ptr, cont_intv / 4);
518 break; 531 break;
@@ -522,7 +535,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
522 tipc_link_reset(l_ptr); 535 tipc_link_reset(l_ptr);
523 l_ptr->state = RESET_RESET; 536 l_ptr->state = RESET_RESET;
524 l_ptr->fsm_msg_cnt = 0; 537 l_ptr->fsm_msg_cnt = 0;
525 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 538 tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
539 0, 0, 0, 0, 0);
526 l_ptr->fsm_msg_cnt++; 540 l_ptr->fsm_msg_cnt++;
527 link_set_timer(l_ptr, cont_intv); 541 link_set_timer(l_ptr, cont_intv);
528 break; 542 break;
@@ -544,7 +558,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
544 tipc_link_reset(l_ptr); 558 tipc_link_reset(l_ptr);
545 l_ptr->state = RESET_RESET; 559 l_ptr->state = RESET_RESET;
546 l_ptr->fsm_msg_cnt = 0; 560 l_ptr->fsm_msg_cnt = 0;
547 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 561 tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
562 0, 0, 0, 0, 0);
548 l_ptr->fsm_msg_cnt++; 563 l_ptr->fsm_msg_cnt++;
549 link_set_timer(l_ptr, cont_intv); 564 link_set_timer(l_ptr, cont_intv);
550 break; 565 break;
@@ -554,14 +569,14 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
554 l_ptr->fsm_msg_cnt = 0; 569 l_ptr->fsm_msg_cnt = 0;
555 l_ptr->checkpoint = l_ptr->next_in_no; 570 l_ptr->checkpoint = l_ptr->next_in_no;
556 if (tipc_bclink_acks_missing(l_ptr->owner)) { 571 if (tipc_bclink_acks_missing(l_ptr->owner)) {
557 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 572 tipc_link_proto_xmit(l_ptr, STATE_MSG,
558 0, 0, 0, 0, 0); 573 0, 0, 0, 0, 0);
559 l_ptr->fsm_msg_cnt++; 574 l_ptr->fsm_msg_cnt++;
560 } 575 }
561 link_set_timer(l_ptr, cont_intv); 576 link_set_timer(l_ptr, cont_intv);
562 } else if (l_ptr->fsm_msg_cnt < l_ptr->abort_limit) { 577 } else if (l_ptr->fsm_msg_cnt < l_ptr->abort_limit) {
563 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 578 tipc_link_proto_xmit(l_ptr, STATE_MSG,
564 1, 0, 0, 0, 0); 579 1, 0, 0, 0, 0);
565 l_ptr->fsm_msg_cnt++; 580 l_ptr->fsm_msg_cnt++;
566 link_set_timer(l_ptr, cont_intv / 4); 581 link_set_timer(l_ptr, cont_intv / 4);
567 } else { /* Link has failed */ 582 } else { /* Link has failed */
@@ -570,8 +585,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
570 tipc_link_reset(l_ptr); 585 tipc_link_reset(l_ptr);
571 l_ptr->state = RESET_UNKNOWN; 586 l_ptr->state = RESET_UNKNOWN;
572 l_ptr->fsm_msg_cnt = 0; 587 l_ptr->fsm_msg_cnt = 0;
573 tipc_link_send_proto_msg(l_ptr, RESET_MSG, 588 tipc_link_proto_xmit(l_ptr, RESET_MSG,
574 0, 0, 0, 0, 0); 589 0, 0, 0, 0, 0);
575 l_ptr->fsm_msg_cnt++; 590 l_ptr->fsm_msg_cnt++;
576 link_set_timer(l_ptr, cont_intv); 591 link_set_timer(l_ptr, cont_intv);
577 } 592 }
@@ -591,24 +606,25 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
591 l_ptr->state = WORKING_WORKING; 606 l_ptr->state = WORKING_WORKING;
592 l_ptr->fsm_msg_cnt = 0; 607 l_ptr->fsm_msg_cnt = 0;
593 link_activate(l_ptr); 608 link_activate(l_ptr);
594 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 609 tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
595 l_ptr->fsm_msg_cnt++; 610 l_ptr->fsm_msg_cnt++;
596 if (l_ptr->owner->working_links == 1) 611 if (l_ptr->owner->working_links == 1)
597 tipc_link_send_sync(l_ptr); 612 tipc_link_sync_xmit(l_ptr);
598 link_set_timer(l_ptr, cont_intv); 613 link_set_timer(l_ptr, cont_intv);
599 break; 614 break;
600 case RESET_MSG: 615 case RESET_MSG:
601 l_ptr->state = RESET_RESET; 616 l_ptr->state = RESET_RESET;
602 l_ptr->fsm_msg_cnt = 0; 617 l_ptr->fsm_msg_cnt = 0;
603 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0); 618 tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
619 1, 0, 0, 0, 0);
604 l_ptr->fsm_msg_cnt++; 620 l_ptr->fsm_msg_cnt++;
605 link_set_timer(l_ptr, cont_intv); 621 link_set_timer(l_ptr, cont_intv);
606 break; 622 break;
607 case STARTING_EVT: 623 case STARTING_EVT:
608 l_ptr->started = 1; 624 l_ptr->flags |= LINK_STARTED;
609 /* fall through */ 625 /* fall through */
610 case TIMEOUT_EVT: 626 case TIMEOUT_EVT:
611 tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0); 627 tipc_link_proto_xmit(l_ptr, RESET_MSG, 0, 0, 0, 0, 0);
612 l_ptr->fsm_msg_cnt++; 628 l_ptr->fsm_msg_cnt++;
613 link_set_timer(l_ptr, cont_intv); 629 link_set_timer(l_ptr, cont_intv);
614 break; 630 break;
@@ -626,16 +642,17 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
626 l_ptr->state = WORKING_WORKING; 642 l_ptr->state = WORKING_WORKING;
627 l_ptr->fsm_msg_cnt = 0; 643 l_ptr->fsm_msg_cnt = 0;
628 link_activate(l_ptr); 644 link_activate(l_ptr);
629 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 645 tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
630 l_ptr->fsm_msg_cnt++; 646 l_ptr->fsm_msg_cnt++;
631 if (l_ptr->owner->working_links == 1) 647 if (l_ptr->owner->working_links == 1)
632 tipc_link_send_sync(l_ptr); 648 tipc_link_sync_xmit(l_ptr);
633 link_set_timer(l_ptr, cont_intv); 649 link_set_timer(l_ptr, cont_intv);
634 break; 650 break;
635 case RESET_MSG: 651 case RESET_MSG:
636 break; 652 break;
637 case TIMEOUT_EVT: 653 case TIMEOUT_EVT:
638 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 654 tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
655 0, 0, 0, 0, 0);
639 l_ptr->fsm_msg_cnt++; 656 l_ptr->fsm_msg_cnt++;
640 link_set_timer(l_ptr, cont_intv); 657 link_set_timer(l_ptr, cont_intv);
641 break; 658 break;
@@ -721,11 +738,11 @@ static void link_add_chain_to_outqueue(struct tipc_link *l_ptr,
721} 738}
722 739
723/* 740/*
724 * tipc_link_send_buf() is the 'full path' for messages, called from 741 * tipc_link_xmit() is the 'full path' for messages, called from
725 * inside TIPC when the 'fast path' in tipc_send_buf 742 * inside TIPC when the 'fast path' in tipc_send_xmit
726 * has failed, and from link_send() 743 * has failed, and from link_send()
727 */ 744 */
728int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf) 745int __tipc_link_xmit(struct tipc_link *l_ptr, struct sk_buff *buf)
729{ 746{
730 struct tipc_msg *msg = buf_msg(buf); 747 struct tipc_msg *msg = buf_msg(buf);
731 u32 size = msg_size(msg); 748 u32 size = msg_size(msg);
@@ -753,7 +770,7 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
753 770
754 /* Fragmentation needed ? */ 771 /* Fragmentation needed ? */
755 if (size > max_packet) 772 if (size > max_packet)
756 return link_send_long_buf(l_ptr, buf); 773 return tipc_link_frag_xmit(l_ptr, buf);
757 774
758 /* Packet can be queued or sent. */ 775 /* Packet can be queued or sent. */
759 if (likely(!link_congested(l_ptr))) { 776 if (likely(!link_congested(l_ptr))) {
@@ -797,11 +814,11 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
797} 814}
798 815
799/* 816/*
800 * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has 817 * tipc_link_xmit(): same as __tipc_link_xmit(), but the link to use
801 * not been selected yet, and the the owner node is not locked 818 * has not been selected yet, and the the owner node is not locked
802 * Called by TIPC internal users, e.g. the name distributor 819 * Called by TIPC internal users, e.g. the name distributor
803 */ 820 */
804int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) 821int tipc_link_xmit(struct sk_buff *buf, u32 dest, u32 selector)
805{ 822{
806 struct tipc_link *l_ptr; 823 struct tipc_link *l_ptr;
807 struct tipc_node *n_ptr; 824 struct tipc_node *n_ptr;
@@ -813,7 +830,7 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
813 tipc_node_lock(n_ptr); 830 tipc_node_lock(n_ptr);
814 l_ptr = n_ptr->active_links[selector & 1]; 831 l_ptr = n_ptr->active_links[selector & 1];
815 if (l_ptr) 832 if (l_ptr)
816 res = tipc_link_send_buf(l_ptr, buf); 833 res = __tipc_link_xmit(l_ptr, buf);
817 else 834 else
818 kfree_skb(buf); 835 kfree_skb(buf);
819 tipc_node_unlock(n_ptr); 836 tipc_node_unlock(n_ptr);
@@ -825,14 +842,14 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
825} 842}
826 843
827/* 844/*
828 * tipc_link_send_sync - synchronize broadcast link endpoints. 845 * tipc_link_sync_xmit - synchronize broadcast link endpoints.
829 * 846 *
830 * Give a newly added peer node the sequence number where it should 847 * Give a newly added peer node the sequence number where it should
831 * start receiving and acking broadcast packets. 848 * start receiving and acking broadcast packets.
832 * 849 *
833 * Called with node locked 850 * Called with node locked
834 */ 851 */
835static void tipc_link_send_sync(struct tipc_link *l) 852static void tipc_link_sync_xmit(struct tipc_link *l)
836{ 853{
837 struct sk_buff *buf; 854 struct sk_buff *buf;
838 struct tipc_msg *msg; 855 struct tipc_msg *msg;
@@ -849,14 +866,14 @@ static void tipc_link_send_sync(struct tipc_link *l)
849} 866}
850 867
851/* 868/*
852 * tipc_link_recv_sync - synchronize broadcast link endpoints. 869 * tipc_link_sync_rcv - synchronize broadcast link endpoints.
853 * Receive the sequence number where we should start receiving and 870 * Receive the sequence number where we should start receiving and
854 * acking broadcast packets from a newly added peer node, and open 871 * acking broadcast packets from a newly added peer node, and open
855 * up for reception of such packets. 872 * up for reception of such packets.
856 * 873 *
857 * Called with node locked 874 * Called with node locked
858 */ 875 */
859static void tipc_link_recv_sync(struct tipc_node *n, struct sk_buff *buf) 876static void tipc_link_sync_rcv(struct tipc_node *n, struct sk_buff *buf)
860{ 877{
861 struct tipc_msg *msg = buf_msg(buf); 878 struct tipc_msg *msg = buf_msg(buf);
862 879
@@ -866,7 +883,7 @@ static void tipc_link_recv_sync(struct tipc_node *n, struct sk_buff *buf)
866} 883}
867 884
868/* 885/*
869 * tipc_link_send_names - send name table entries to new neighbor 886 * tipc_link_names_xmit - send name table entries to new neighbor
870 * 887 *
871 * Send routine for bulk delivery of name table messages when contact 888 * Send routine for bulk delivery of name table messages when contact
872 * with a new neighbor occurs. No link congestion checking is performed 889 * with a new neighbor occurs. No link congestion checking is performed
@@ -874,7 +891,7 @@ static void tipc_link_recv_sync(struct tipc_node *n, struct sk_buff *buf)
874 * small enough not to require fragmentation. 891 * small enough not to require fragmentation.
875 * Called without any locks held. 892 * Called without any locks held.
876 */ 893 */
877void tipc_link_send_names(struct list_head *message_list, u32 dest) 894void tipc_link_names_xmit(struct list_head *message_list, u32 dest)
878{ 895{
879 struct tipc_node *n_ptr; 896 struct tipc_node *n_ptr;
880 struct tipc_link *l_ptr; 897 struct tipc_link *l_ptr;
@@ -909,13 +926,13 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
909} 926}
910 927
911/* 928/*
912 * link_send_buf_fast: Entry for data messages where the 929 * tipc_link_xmit_fast: Entry for data messages where the
913 * destination link is known and the header is complete, 930 * destination link is known and the header is complete,
914 * inclusive total message length. Very time critical. 931 * inclusive total message length. Very time critical.
915 * Link is locked. Returns user data length. 932 * Link is locked. Returns user data length.
916 */ 933 */
917static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf, 934static int tipc_link_xmit_fast(struct tipc_link *l_ptr, struct sk_buff *buf,
918 u32 *used_max_pkt) 935 u32 *used_max_pkt)
919{ 936{
920 struct tipc_msg *msg = buf_msg(buf); 937 struct tipc_msg *msg = buf_msg(buf);
921 int res = msg_data_sz(msg); 938 int res = msg_data_sz(msg);
@@ -931,18 +948,18 @@ static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf,
931 else 948 else
932 *used_max_pkt = l_ptr->max_pkt; 949 *used_max_pkt = l_ptr->max_pkt;
933 } 950 }
934 return tipc_link_send_buf(l_ptr, buf); /* All other cases */ 951 return __tipc_link_xmit(l_ptr, buf); /* All other cases */
935} 952}
936 953
937/* 954/*
938 * tipc_link_send_sections_fast: Entry for messages where the 955 * tipc_link_iovec_xmit_fast: Entry for messages where the
939 * destination processor is known and the header is complete, 956 * destination processor is known and the header is complete,
940 * except for total message length. 957 * except for total message length.
941 * Returns user data length or errno. 958 * Returns user data length or errno.
942 */ 959 */
943int tipc_link_send_sections_fast(struct tipc_port *sender, 960int tipc_link_iovec_xmit_fast(struct tipc_port *sender,
944 struct iovec const *msg_sect, 961 struct iovec const *msg_sect,
945 unsigned int len, u32 destaddr) 962 unsigned int len, u32 destaddr)
946{ 963{
947 struct tipc_msg *hdr = &sender->phdr; 964 struct tipc_msg *hdr = &sender->phdr;
948 struct tipc_link *l_ptr; 965 struct tipc_link *l_ptr;
@@ -968,8 +985,8 @@ again:
968 l_ptr = node->active_links[selector]; 985 l_ptr = node->active_links[selector];
969 if (likely(l_ptr)) { 986 if (likely(l_ptr)) {
970 if (likely(buf)) { 987 if (likely(buf)) {
971 res = link_send_buf_fast(l_ptr, buf, 988 res = tipc_link_xmit_fast(l_ptr, buf,
972 &sender->max_pkt); 989 &sender->max_pkt);
973exit: 990exit:
974 tipc_node_unlock(node); 991 tipc_node_unlock(node);
975 read_unlock_bh(&tipc_net_lock); 992 read_unlock_bh(&tipc_net_lock);
@@ -995,24 +1012,21 @@ exit:
995 if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt) 1012 if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt)
996 goto again; 1013 goto again;
997 1014
998 return link_send_sections_long(sender, msg_sect, len, 1015 return tipc_link_iovec_long_xmit(sender, msg_sect,
999 destaddr); 1016 len, destaddr);
1000 } 1017 }
1001 tipc_node_unlock(node); 1018 tipc_node_unlock(node);
1002 } 1019 }
1003 read_unlock_bh(&tipc_net_lock); 1020 read_unlock_bh(&tipc_net_lock);
1004 1021
1005 /* Couldn't find a link to the destination node */ 1022 /* Couldn't find a link to the destination node */
1006 if (buf) 1023 kfree_skb(buf);
1007 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1024 tipc_port_iovec_reject(sender, hdr, msg_sect, len, TIPC_ERR_NO_NODE);
1008 if (res >= 0) 1025 return -ENETUNREACH;
1009 return tipc_port_reject_sections(sender, hdr, msg_sect,
1010 len, TIPC_ERR_NO_NODE);
1011 return res;
1012} 1026}
1013 1027
1014/* 1028/*
1015 * link_send_sections_long(): Entry for long messages where the 1029 * tipc_link_iovec_long_xmit(): Entry for long messages where the
1016 * destination node is known and the header is complete, 1030 * destination node is known and the header is complete,
1017 * inclusive total message length. 1031 * inclusive total message length.
1018 * Link and bearer congestion status have been checked to be ok, 1032 * Link and bearer congestion status have been checked to be ok,
@@ -1025,9 +1039,9 @@ exit:
1025 * 1039 *
1026 * Returns user data length or errno. 1040 * Returns user data length or errno.
1027 */ 1041 */
1028static int link_send_sections_long(struct tipc_port *sender, 1042static int tipc_link_iovec_long_xmit(struct tipc_port *sender,
1029 struct iovec const *msg_sect, 1043 struct iovec const *msg_sect,
1030 unsigned int len, u32 destaddr) 1044 unsigned int len, u32 destaddr)
1031{ 1045{
1032 struct tipc_link *l_ptr; 1046 struct tipc_link *l_ptr;
1033 struct tipc_node *node; 1047 struct tipc_node *node;
@@ -1146,8 +1160,9 @@ error:
1146 } else { 1160 } else {
1147reject: 1161reject:
1148 kfree_skb_list(buf_chain); 1162 kfree_skb_list(buf_chain);
1149 return tipc_port_reject_sections(sender, hdr, msg_sect, 1163 tipc_port_iovec_reject(sender, hdr, msg_sect, len,
1150 len, TIPC_ERR_NO_NODE); 1164 TIPC_ERR_NO_NODE);
1165 return -ENETUNREACH;
1151 } 1166 }
1152 1167
1153 /* Append chain of fragments to send queue & send them */ 1168 /* Append chain of fragments to send queue & send them */
@@ -1441,7 +1456,6 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr)
1441 u32 seq_no; 1456 u32 seq_no;
1442 u32 ackd; 1457 u32 ackd;
1443 u32 released = 0; 1458 u32 released = 0;
1444 int type;
1445 1459
1446 head = head->next; 1460 head = head->next;
1447 buf->next = NULL; 1461 buf->next = NULL;
@@ -1463,9 +1477,9 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr)
1463 1477
1464 if (unlikely(msg_non_seq(msg))) { 1478 if (unlikely(msg_non_seq(msg))) {
1465 if (msg_user(msg) == LINK_CONFIG) 1479 if (msg_user(msg) == LINK_CONFIG)
1466 tipc_disc_recv_msg(buf, b_ptr); 1480 tipc_disc_rcv(buf, b_ptr);
1467 else 1481 else
1468 tipc_bclink_recv_pkt(buf); 1482 tipc_bclink_rcv(buf);
1469 continue; 1483 continue;
1470 } 1484 }
1471 1485
@@ -1489,7 +1503,7 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr)
1489 if ((n_ptr->block_setup & WAIT_PEER_DOWN) && 1503 if ((n_ptr->block_setup & WAIT_PEER_DOWN) &&
1490 msg_user(msg) == LINK_PROTOCOL && 1504 msg_user(msg) == LINK_PROTOCOL &&
1491 (msg_type(msg) == RESET_MSG || 1505 (msg_type(msg) == RESET_MSG ||
1492 msg_type(msg) == ACTIVATE_MSG) && 1506 msg_type(msg) == ACTIVATE_MSG) &&
1493 !msg_redundant_link(msg)) 1507 !msg_redundant_link(msg))
1494 n_ptr->block_setup &= ~WAIT_PEER_DOWN; 1508 n_ptr->block_setup &= ~WAIT_PEER_DOWN;
1495 1509
@@ -1508,7 +1522,6 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr)
1508 while ((crs != l_ptr->next_out) && 1522 while ((crs != l_ptr->next_out) &&
1509 less_eq(buf_seqno(crs), ackd)) { 1523 less_eq(buf_seqno(crs), ackd)) {
1510 struct sk_buff *next = crs->next; 1524 struct sk_buff *next = crs->next;
1511
1512 kfree_skb(crs); 1525 kfree_skb(crs);
1513 crs = next; 1526 crs = next;
1514 released++; 1527 released++;
@@ -1521,18 +1534,19 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr)
1521 /* Try sending any messages link endpoint has pending */ 1534 /* Try sending any messages link endpoint has pending */
1522 if (unlikely(l_ptr->next_out)) 1535 if (unlikely(l_ptr->next_out))
1523 tipc_link_push_queue(l_ptr); 1536 tipc_link_push_queue(l_ptr);
1537
1524 if (unlikely(!list_empty(&l_ptr->waiting_ports))) 1538 if (unlikely(!list_empty(&l_ptr->waiting_ports)))
1525 tipc_link_wakeup_ports(l_ptr, 0); 1539 tipc_link_wakeup_ports(l_ptr, 0);
1540
1526 if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) { 1541 if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) {
1527 l_ptr->stats.sent_acks++; 1542 l_ptr->stats.sent_acks++;
1528 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 1543 tipc_link_proto_xmit(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
1529 } 1544 }
1530 1545
1531 /* Now (finally!) process the incoming message */ 1546 /* Process the incoming packet */
1532protocol_check:
1533 if (unlikely(!link_working_working(l_ptr))) { 1547 if (unlikely(!link_working_working(l_ptr))) {
1534 if (msg_user(msg) == LINK_PROTOCOL) { 1548 if (msg_user(msg) == LINK_PROTOCOL) {
1535 link_recv_proto_msg(l_ptr, buf); 1549 tipc_link_proto_rcv(l_ptr, buf);
1536 head = link_insert_deferred_queue(l_ptr, head); 1550 head = link_insert_deferred_queue(l_ptr, head);
1537 tipc_node_unlock(n_ptr); 1551 tipc_node_unlock(n_ptr);
1538 continue; 1552 continue;
@@ -1561,67 +1575,65 @@ protocol_check:
1561 l_ptr->next_in_no++; 1575 l_ptr->next_in_no++;
1562 if (unlikely(l_ptr->oldest_deferred_in)) 1576 if (unlikely(l_ptr->oldest_deferred_in))
1563 head = link_insert_deferred_queue(l_ptr, head); 1577 head = link_insert_deferred_queue(l_ptr, head);
1564deliver: 1578
1565 if (likely(msg_isdata(msg))) { 1579 /* Deliver packet/message to correct user: */
1566 tipc_node_unlock(n_ptr); 1580 if (unlikely(msg_user(msg) == CHANGEOVER_PROTOCOL)) {
1567 tipc_port_recv_msg(buf); 1581 if (!tipc_link_tunnel_rcv(n_ptr, &buf)) {
1568 continue; 1582 tipc_node_unlock(n_ptr);
1583 continue;
1584 }
1585 msg = buf_msg(buf);
1586 } else if (msg_user(msg) == MSG_FRAGMENTER) {
1587 int rc;
1588
1589 l_ptr->stats.recv_fragments++;
1590 rc = tipc_link_frag_rcv(&l_ptr->reasm_head,
1591 &l_ptr->reasm_tail,
1592 &buf);
1593 if (rc == LINK_REASM_COMPLETE) {
1594 l_ptr->stats.recv_fragmented++;
1595 msg = buf_msg(buf);
1596 } else {
1597 if (rc == LINK_REASM_ERROR)
1598 tipc_link_reset(l_ptr);
1599 tipc_node_unlock(n_ptr);
1600 continue;
1601 }
1569 } 1602 }
1603
1570 switch (msg_user(msg)) { 1604 switch (msg_user(msg)) {
1571 int ret; 1605 case TIPC_LOW_IMPORTANCE:
1606 case TIPC_MEDIUM_IMPORTANCE:
1607 case TIPC_HIGH_IMPORTANCE:
1608 case TIPC_CRITICAL_IMPORTANCE:
1609 tipc_node_unlock(n_ptr);
1610 tipc_port_rcv(buf);
1611 continue;
1572 case MSG_BUNDLER: 1612 case MSG_BUNDLER:
1573 l_ptr->stats.recv_bundles++; 1613 l_ptr->stats.recv_bundles++;
1574 l_ptr->stats.recv_bundled += msg_msgcnt(msg); 1614 l_ptr->stats.recv_bundled += msg_msgcnt(msg);
1575 tipc_node_unlock(n_ptr); 1615 tipc_node_unlock(n_ptr);
1576 tipc_link_recv_bundle(buf); 1616 tipc_link_bundle_rcv(buf);
1577 continue; 1617 continue;
1578 case NAME_DISTRIBUTOR: 1618 case NAME_DISTRIBUTOR:
1579 n_ptr->bclink.recv_permitted = true; 1619 n_ptr->bclink.recv_permitted = true;
1580 tipc_node_unlock(n_ptr); 1620 tipc_node_unlock(n_ptr);
1581 tipc_named_recv(buf); 1621 tipc_named_rcv(buf);
1582 continue;
1583 case BCAST_PROTOCOL:
1584 tipc_link_recv_sync(n_ptr, buf);
1585 tipc_node_unlock(n_ptr);
1586 continue; 1622 continue;
1587 case CONN_MANAGER: 1623 case CONN_MANAGER:
1588 tipc_node_unlock(n_ptr); 1624 tipc_node_unlock(n_ptr);
1589 tipc_port_recv_proto_msg(buf); 1625 tipc_port_proto_rcv(buf);
1590 continue; 1626 continue;
1591 case MSG_FRAGMENTER: 1627 case BCAST_PROTOCOL:
1592 l_ptr->stats.recv_fragments++; 1628 tipc_link_sync_rcv(n_ptr, buf);
1593 ret = tipc_link_recv_fragment(&l_ptr->reasm_head,
1594 &l_ptr->reasm_tail,
1595 &buf);
1596 if (ret == LINK_REASM_COMPLETE) {
1597 l_ptr->stats.recv_fragmented++;
1598 msg = buf_msg(buf);
1599 goto deliver;
1600 }
1601 if (ret == LINK_REASM_ERROR)
1602 tipc_link_reset(l_ptr);
1603 tipc_node_unlock(n_ptr);
1604 continue;
1605 case CHANGEOVER_PROTOCOL:
1606 type = msg_type(msg);
1607 if (tipc_link_tunnel_rcv(&l_ptr, &buf)) {
1608 msg = buf_msg(buf);
1609 seq_no = msg_seqno(msg);
1610 if (type == ORIGINAL_MSG)
1611 goto deliver;
1612 goto protocol_check;
1613 }
1614 break; 1629 break;
1615 default: 1630 default:
1616 kfree_skb(buf); 1631 kfree_skb(buf);
1617 buf = NULL;
1618 break; 1632 break;
1619 } 1633 }
1620 tipc_node_unlock(n_ptr); 1634 tipc_node_unlock(n_ptr);
1621 tipc_net_route_msg(buf);
1622 continue; 1635 continue;
1623unlock_discard: 1636unlock_discard:
1624
1625 tipc_node_unlock(n_ptr); 1637 tipc_node_unlock(n_ptr);
1626discard: 1638discard:
1627 kfree_skb(buf); 1639 kfree_skb(buf);
@@ -1688,7 +1700,7 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1688 u32 seq_no = buf_seqno(buf); 1700 u32 seq_no = buf_seqno(buf);
1689 1701
1690 if (likely(msg_user(buf_msg(buf)) == LINK_PROTOCOL)) { 1702 if (likely(msg_user(buf_msg(buf)) == LINK_PROTOCOL)) {
1691 link_recv_proto_msg(l_ptr, buf); 1703 tipc_link_proto_rcv(l_ptr, buf);
1692 return; 1704 return;
1693 } 1705 }
1694 1706
@@ -1711,7 +1723,7 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1711 l_ptr->stats.deferred_recv++; 1723 l_ptr->stats.deferred_recv++;
1712 TIPC_SKB_CB(buf)->deferred = true; 1724 TIPC_SKB_CB(buf)->deferred = true;
1713 if ((l_ptr->deferred_inqueue_sz % 16) == 1) 1725 if ((l_ptr->deferred_inqueue_sz % 16) == 1)
1714 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 1726 tipc_link_proto_xmit(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
1715 } else 1727 } else
1716 l_ptr->stats.duplicates++; 1728 l_ptr->stats.duplicates++;
1717} 1729}
@@ -1719,9 +1731,8 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1719/* 1731/*
1720 * Send protocol message to the other endpoint. 1732 * Send protocol message to the other endpoint.
1721 */ 1733 */
1722void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ, 1734void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg,
1723 int probe_msg, u32 gap, u32 tolerance, 1735 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
1724 u32 priority, u32 ack_mtu)
1725{ 1736{
1726 struct sk_buff *buf = NULL; 1737 struct sk_buff *buf = NULL;
1727 struct tipc_msg *msg = l_ptr->pmsg; 1738 struct tipc_msg *msg = l_ptr->pmsg;
@@ -1820,7 +1831,7 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
1820 * Note that network plane id propagates through the network, and may 1831 * Note that network plane id propagates through the network, and may
1821 * change at any time. The node with lowest address rules 1832 * change at any time. The node with lowest address rules
1822 */ 1833 */
1823static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf) 1834static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf)
1824{ 1835{
1825 u32 rec_gap = 0; 1836 u32 rec_gap = 0;
1826 u32 max_pkt_info; 1837 u32 max_pkt_info;
@@ -1939,8 +1950,8 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
1939 msg_last_bcast(msg)); 1950 msg_last_bcast(msg));
1940 1951
1941 if (rec_gap || (msg_probe(msg))) { 1952 if (rec_gap || (msg_probe(msg))) {
1942 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1953 tipc_link_proto_xmit(l_ptr, STATE_MSG, 0, rec_gap, 0,
1943 0, rec_gap, 0, 0, max_pkt_ack); 1954 0, max_pkt_ack);
1944 } 1955 }
1945 if (msg_seq_gap(msg)) { 1956 if (msg_seq_gap(msg)) {
1946 l_ptr->stats.recv_nacks++; 1957 l_ptr->stats.recv_nacks++;
@@ -1979,7 +1990,7 @@ static void tipc_link_tunnel_xmit(struct tipc_link *l_ptr,
1979 } 1990 }
1980 skb_copy_to_linear_data(buf, tunnel_hdr, INT_H_SIZE); 1991 skb_copy_to_linear_data(buf, tunnel_hdr, INT_H_SIZE);
1981 skb_copy_to_linear_data_offset(buf, INT_H_SIZE, msg, length); 1992 skb_copy_to_linear_data_offset(buf, INT_H_SIZE, msg, length);
1982 tipc_link_send_buf(tunnel, buf); 1993 __tipc_link_xmit(tunnel, buf);
1983} 1994}
1984 1995
1985 1996
@@ -2012,7 +2023,7 @@ void tipc_link_failover_send_queue(struct tipc_link *l_ptr)
2012 if (buf) { 2023 if (buf) {
2013 skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE); 2024 skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE);
2014 msg_set_size(&tunnel_hdr, INT_H_SIZE); 2025 msg_set_size(&tunnel_hdr, INT_H_SIZE);
2015 tipc_link_send_buf(tunnel, buf); 2026 __tipc_link_xmit(tunnel, buf);
2016 } else { 2027 } else {
2017 pr_warn("%sunable to send changeover msg\n", 2028 pr_warn("%sunable to send changeover msg\n",
2018 link_co_err); 2029 link_co_err);
@@ -2046,7 +2057,7 @@ void tipc_link_failover_send_queue(struct tipc_link *l_ptr)
2046 } 2057 }
2047} 2058}
2048 2059
2049/* tipc_link_dup_send_queue(): A second link has become active. Tunnel a 2060/* tipc_link_dup_queue_xmit(): A second link has become active. Tunnel a
2050 * duplicate of the first link's send queue via the new link. This way, we 2061 * duplicate of the first link's send queue via the new link. This way, we
2051 * are guaranteed that currently queued packets from a socket are delivered 2062 * are guaranteed that currently queued packets from a socket are delivered
2052 * before future traffic from the same socket, even if this is using the 2063 * before future traffic from the same socket, even if this is using the
@@ -2055,7 +2066,7 @@ void tipc_link_failover_send_queue(struct tipc_link *l_ptr)
2055 * and sequence order is preserved per sender/receiver socket pair. 2066 * and sequence order is preserved per sender/receiver socket pair.
2056 * Owner node is locked. 2067 * Owner node is locked.
2057 */ 2068 */
2058void tipc_link_dup_send_queue(struct tipc_link *l_ptr, 2069void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr,
2059 struct tipc_link *tunnel) 2070 struct tipc_link *tunnel)
2060{ 2071{
2061 struct sk_buff *iter; 2072 struct sk_buff *iter;
@@ -2085,7 +2096,7 @@ void tipc_link_dup_send_queue(struct tipc_link *l_ptr,
2085 skb_copy_to_linear_data(outbuf, &tunnel_hdr, INT_H_SIZE); 2096 skb_copy_to_linear_data(outbuf, &tunnel_hdr, INT_H_SIZE);
2086 skb_copy_to_linear_data_offset(outbuf, INT_H_SIZE, iter->data, 2097 skb_copy_to_linear_data_offset(outbuf, INT_H_SIZE, iter->data,
2087 length); 2098 length);
2088 tipc_link_send_buf(tunnel, outbuf); 2099 __tipc_link_xmit(tunnel, outbuf);
2089 if (!tipc_link_is_up(l_ptr)) 2100 if (!tipc_link_is_up(l_ptr))
2090 return; 2101 return;
2091 iter = iter->next; 2102 iter = iter->next;
@@ -2112,89 +2123,114 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
2112 return eb; 2123 return eb;
2113} 2124}
2114 2125
2115/* tipc_link_tunnel_rcv(): Receive a tunneled packet, sent 2126
2116 * via other link as result of a failover (ORIGINAL_MSG) or 2127
2117 * a new active link (DUPLICATE_MSG). Failover packets are 2128/* tipc_link_dup_rcv(): Receive a tunnelled DUPLICATE_MSG packet.
2118 * returned to the active link for delivery upwards. 2129 * Owner node is locked.
2130 */
2131static void tipc_link_dup_rcv(struct tipc_link *l_ptr,
2132 struct sk_buff *t_buf)
2133{
2134 struct sk_buff *buf;
2135
2136 if (!tipc_link_is_up(l_ptr))
2137 return;
2138
2139 buf = buf_extract(t_buf, INT_H_SIZE);
2140 if (buf == NULL) {
2141 pr_warn("%sfailed to extract inner dup pkt\n", link_co_err);
2142 return;
2143 }
2144
2145 /* Add buffer to deferred queue, if applicable: */
2146 link_handle_out_of_seq_msg(l_ptr, buf);
2147}
2148
2149/* tipc_link_failover_rcv(): Receive a tunnelled ORIGINAL_MSG packet
2119 * Owner node is locked. 2150 * Owner node is locked.
2120 */ 2151 */
2121static int tipc_link_tunnel_rcv(struct tipc_link **l_ptr, 2152static struct sk_buff *tipc_link_failover_rcv(struct tipc_link *l_ptr,
2122 struct sk_buff **buf) 2153 struct sk_buff *t_buf)
2123{ 2154{
2124 struct sk_buff *tunnel_buf = *buf; 2155 struct tipc_msg *t_msg = buf_msg(t_buf);
2125 struct tipc_link *dest_link; 2156 struct sk_buff *buf = NULL;
2126 struct tipc_msg *msg; 2157 struct tipc_msg *msg;
2127 struct tipc_msg *tunnel_msg = buf_msg(tunnel_buf);
2128 u32 msg_typ = msg_type(tunnel_msg);
2129 u32 msg_count = msg_msgcnt(tunnel_msg);
2130 u32 bearer_id = msg_bearer_id(tunnel_msg);
2131 2158
2132 if (bearer_id >= MAX_BEARERS) 2159 if (tipc_link_is_up(l_ptr))
2133 goto exit; 2160 tipc_link_reset(l_ptr);
2134 dest_link = (*l_ptr)->owner->links[bearer_id];
2135 if (!dest_link)
2136 goto exit;
2137 if (dest_link == *l_ptr) {
2138 pr_err("Unexpected changeover message on link <%s>\n",
2139 (*l_ptr)->name);
2140 goto exit;
2141 }
2142 *l_ptr = dest_link;
2143 msg = msg_get_wrapped(tunnel_msg);
2144 2161
2145 if (msg_typ == DUPLICATE_MSG) { 2162 /* First failover packet? */
2146 if (less(msg_seqno(msg), mod(dest_link->next_in_no))) 2163 if (l_ptr->exp_msg_count == START_CHANGEOVER)
2147 goto exit; 2164 l_ptr->exp_msg_count = msg_msgcnt(t_msg);
2148 *buf = buf_extract(tunnel_buf, INT_H_SIZE); 2165
2149 if (*buf == NULL) { 2166 /* Should there be an inner packet? */
2150 pr_warn("%sduplicate msg dropped\n", link_co_err); 2167 if (l_ptr->exp_msg_count) {
2168 l_ptr->exp_msg_count--;
2169 buf = buf_extract(t_buf, INT_H_SIZE);
2170 if (buf == NULL) {
2171 pr_warn("%sno inner failover pkt\n", link_co_err);
2151 goto exit; 2172 goto exit;
2152 } 2173 }
2153 kfree_skb(tunnel_buf); 2174 msg = buf_msg(buf);
2154 return 1;
2155 }
2156 2175
2157 /* First original message ?: */ 2176 if (less(msg_seqno(msg), l_ptr->reset_checkpoint)) {
2158 if (tipc_link_is_up(dest_link)) { 2177 kfree_skb(buf);
2159 pr_info("%s<%s>, changeover initiated by peer\n", link_rst_msg, 2178 buf = NULL;
2160 dest_link->name);
2161 tipc_link_reset(dest_link);
2162 dest_link->exp_msg_count = msg_count;
2163 if (!msg_count)
2164 goto exit;
2165 } else if (dest_link->exp_msg_count == START_CHANGEOVER) {
2166 dest_link->exp_msg_count = msg_count;
2167 if (!msg_count)
2168 goto exit; 2179 goto exit;
2180 }
2181 if (msg_user(msg) == MSG_FRAGMENTER) {
2182 l_ptr->stats.recv_fragments++;
2183 tipc_link_frag_rcv(&l_ptr->reasm_head,
2184 &l_ptr->reasm_tail,
2185 &buf);
2186 }
2169 } 2187 }
2188exit:
2189 if ((l_ptr->exp_msg_count == 0) && (l_ptr->flags & LINK_STOPPED)) {
2190 tipc_node_detach_link(l_ptr->owner, l_ptr);
2191 kfree(l_ptr);
2192 }
2193 return buf;
2194}
2170 2195
2171 /* Receive original message */ 2196/* tipc_link_tunnel_rcv(): Receive a tunnelled packet, sent
2172 if (dest_link->exp_msg_count == 0) { 2197 * via other link as result of a failover (ORIGINAL_MSG) or
2173 pr_warn("%sgot too many tunnelled messages\n", link_co_err); 2198 * a new active link (DUPLICATE_MSG). Failover packets are
2199 * returned to the active link for delivery upwards.
2200 * Owner node is locked.
2201 */
2202static int tipc_link_tunnel_rcv(struct tipc_node *n_ptr,
2203 struct sk_buff **buf)
2204{
2205 struct sk_buff *t_buf = *buf;
2206 struct tipc_link *l_ptr;
2207 struct tipc_msg *t_msg = buf_msg(t_buf);
2208 u32 bearer_id = msg_bearer_id(t_msg);
2209
2210 *buf = NULL;
2211
2212 if (bearer_id >= MAX_BEARERS)
2174 goto exit; 2213 goto exit;
2175 } 2214
2176 dest_link->exp_msg_count--; 2215 l_ptr = n_ptr->links[bearer_id];
2177 if (less(msg_seqno(msg), dest_link->reset_checkpoint)) { 2216 if (!l_ptr)
2178 goto exit; 2217 goto exit;
2179 } else { 2218
2180 *buf = buf_extract(tunnel_buf, INT_H_SIZE); 2219 if (msg_type(t_msg) == DUPLICATE_MSG)
2181 if (*buf != NULL) { 2220 tipc_link_dup_rcv(l_ptr, t_buf);
2182 kfree_skb(tunnel_buf); 2221 else if (msg_type(t_msg) == ORIGINAL_MSG)
2183 return 1; 2222 *buf = tipc_link_failover_rcv(l_ptr, t_buf);
2184 } else { 2223 else
2185 pr_warn("%soriginal msg dropped\n", link_co_err); 2224 pr_warn("%sunknown tunnel pkt received\n", link_co_err);
2186 }
2187 }
2188exit: 2225exit:
2189 *buf = NULL; 2226 kfree_skb(t_buf);
2190 kfree_skb(tunnel_buf); 2227 return *buf != NULL;
2191 return 0;
2192} 2228}
2193 2229
2194/* 2230/*
2195 * Bundler functionality: 2231 * Bundler functionality:
2196 */ 2232 */
2197void tipc_link_recv_bundle(struct sk_buff *buf) 2233void tipc_link_bundle_rcv(struct sk_buff *buf)
2198{ 2234{
2199 u32 msgcount = msg_msgcnt(buf_msg(buf)); 2235 u32 msgcount = msg_msgcnt(buf_msg(buf));
2200 u32 pos = INT_H_SIZE; 2236 u32 pos = INT_H_SIZE;
@@ -2217,11 +2253,11 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2217 */ 2253 */
2218 2254
2219/* 2255/*
2220 * link_send_long_buf: Entry for buffers needing fragmentation. 2256 * tipc_link_frag_xmit: Entry for buffers needing fragmentation.
2221 * The buffer is complete, inclusive total message length. 2257 * The buffer is complete, inclusive total message length.
2222 * Returns user data length. 2258 * Returns user data length.
2223 */ 2259 */
2224static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf) 2260static int tipc_link_frag_xmit(struct tipc_link *l_ptr, struct sk_buff *buf)
2225{ 2261{
2226 struct sk_buff *buf_chain = NULL; 2262 struct sk_buff *buf_chain = NULL;
2227 struct sk_buff *buf_chain_tail = (struct sk_buff *)&buf_chain; 2263 struct sk_buff *buf_chain_tail = (struct sk_buff *)&buf_chain;
@@ -2284,12 +2320,11 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2284 return dsz; 2320 return dsz;
2285} 2321}
2286 2322
2287/* 2323/* tipc_link_frag_rcv(): Called with node lock on. Returns
2288 * tipc_link_recv_fragment(): Called with node lock on. Returns
2289 * the reassembled buffer if message is complete. 2324 * the reassembled buffer if message is complete.
2290 */ 2325 */
2291int tipc_link_recv_fragment(struct sk_buff **head, struct sk_buff **tail, 2326int tipc_link_frag_rcv(struct sk_buff **head, struct sk_buff **tail,
2292 struct sk_buff **fbuf) 2327 struct sk_buff **fbuf)
2293{ 2328{
2294 struct sk_buff *frag = *fbuf; 2329 struct sk_buff *frag = *fbuf;
2295 struct tipc_msg *msg = buf_msg(frag); 2330 struct tipc_msg *msg = buf_msg(frag);
@@ -2303,6 +2338,7 @@ int tipc_link_recv_fragment(struct sk_buff **head, struct sk_buff **tail,
2303 goto out_free; 2338 goto out_free;
2304 *head = frag; 2339 *head = frag;
2305 skb_frag_list_init(*head); 2340 skb_frag_list_init(*head);
2341 *fbuf = NULL;
2306 return 0; 2342 return 0;
2307 } else if (*head && 2343 } else if (*head &&
2308 skb_try_coalesce(*head, frag, &headstolen, &delta)) { 2344 skb_try_coalesce(*head, frag, &headstolen, &delta)) {
@@ -2322,10 +2358,12 @@ int tipc_link_recv_fragment(struct sk_buff **head, struct sk_buff **tail,
2322 *tail = *head = NULL; 2358 *tail = *head = NULL;
2323 return LINK_REASM_COMPLETE; 2359 return LINK_REASM_COMPLETE;
2324 } 2360 }
2361 *fbuf = NULL;
2325 return 0; 2362 return 0;
2326out_free: 2363out_free:
2327 pr_warn_ratelimited("Link unable to reassemble fragmented message\n"); 2364 pr_warn_ratelimited("Link unable to reassemble fragmented message\n");
2328 kfree_skb(*fbuf); 2365 kfree_skb(*fbuf);
2366 *fbuf = NULL;
2329 return LINK_REASM_ERROR; 2367 return LINK_REASM_ERROR;
2330} 2368}
2331 2369
@@ -2359,35 +2397,40 @@ void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
2359 l_ptr->queue_limit[MSG_FRAGMENTER] = 4000; 2397 l_ptr->queue_limit[MSG_FRAGMENTER] = 4000;
2360} 2398}
2361 2399
2362/** 2400/* tipc_link_find_owner - locate owner node of link by link's name
2363 * link_find_link - locate link by name 2401 * @name: pointer to link name string
2364 * @name: ptr to link name string 2402 * @bearer_id: pointer to index in 'node->links' array where the link was found.
2365 * @node: ptr to area to be filled with ptr to associated node
2366 *
2367 * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted; 2403 * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted;
2368 * this also prevents link deletion. 2404 * this also prevents link deletion.
2369 * 2405 *
2370 * Returns pointer to link (or 0 if invalid link name). 2406 * Returns pointer to node owning the link, or 0 if no matching link is found.
2371 */ 2407 */
2372static struct tipc_link *link_find_link(const char *name, 2408static struct tipc_node *tipc_link_find_owner(const char *link_name,
2373 struct tipc_node **node) 2409 unsigned int *bearer_id)
2374{ 2410{
2375 struct tipc_link *l_ptr; 2411 struct tipc_link *l_ptr;
2376 struct tipc_node *n_ptr; 2412 struct tipc_node *n_ptr;
2413 struct tipc_node *tmp_n_ptr;
2414 struct tipc_node *found_node = 0;
2415
2377 int i; 2416 int i;
2378 2417
2379 list_for_each_entry(n_ptr, &tipc_node_list, list) { 2418 *bearer_id = 0;
2419 list_for_each_entry_safe(n_ptr, tmp_n_ptr, &tipc_node_list, list) {
2420 tipc_node_lock(n_ptr);
2380 for (i = 0; i < MAX_BEARERS; i++) { 2421 for (i = 0; i < MAX_BEARERS; i++) {
2381 l_ptr = n_ptr->links[i]; 2422 l_ptr = n_ptr->links[i];
2382 if (l_ptr && !strcmp(l_ptr->name, name)) 2423 if (l_ptr && !strcmp(l_ptr->name, link_name)) {
2383 goto found; 2424 *bearer_id = i;
2425 found_node = n_ptr;
2426 break;
2427 }
2384 } 2428 }
2429 tipc_node_unlock(n_ptr);
2430 if (found_node)
2431 break;
2385 } 2432 }
2386 l_ptr = NULL; 2433 return found_node;
2387 n_ptr = NULL;
2388found:
2389 *node = n_ptr;
2390 return l_ptr;
2391} 2434}
2392 2435
2393/** 2436/**
@@ -2429,32 +2472,33 @@ static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd)
2429 struct tipc_link *l_ptr; 2472 struct tipc_link *l_ptr;
2430 struct tipc_bearer *b_ptr; 2473 struct tipc_bearer *b_ptr;
2431 struct tipc_media *m_ptr; 2474 struct tipc_media *m_ptr;
2475 int bearer_id;
2432 int res = 0; 2476 int res = 0;
2433 2477
2434 l_ptr = link_find_link(name, &node); 2478 node = tipc_link_find_owner(name, &bearer_id);
2435 if (l_ptr) { 2479 if (node) {
2436 /*
2437 * acquire node lock for tipc_link_send_proto_msg().
2438 * see "TIPC locking policy" in net.c.
2439 */
2440 tipc_node_lock(node); 2480 tipc_node_lock(node);
2441 switch (cmd) { 2481 l_ptr = node->links[bearer_id];
2442 case TIPC_CMD_SET_LINK_TOL: 2482
2443 link_set_supervision_props(l_ptr, new_value); 2483 if (l_ptr) {
2444 tipc_link_send_proto_msg(l_ptr, 2484 switch (cmd) {
2445 STATE_MSG, 0, 0, new_value, 0, 0); 2485 case TIPC_CMD_SET_LINK_TOL:
2446 break; 2486 link_set_supervision_props(l_ptr, new_value);
2447 case TIPC_CMD_SET_LINK_PRI: 2487 tipc_link_proto_xmit(l_ptr, STATE_MSG, 0, 0,
2448 l_ptr->priority = new_value; 2488 new_value, 0, 0);
2449 tipc_link_send_proto_msg(l_ptr, 2489 break;
2450 STATE_MSG, 0, 0, 0, new_value, 0); 2490 case TIPC_CMD_SET_LINK_PRI:
2451 break; 2491 l_ptr->priority = new_value;
2452 case TIPC_CMD_SET_LINK_WINDOW: 2492 tipc_link_proto_xmit(l_ptr, STATE_MSG, 0, 0,
2453 tipc_link_set_queue_limits(l_ptr, new_value); 2493 0, new_value, 0);
2454 break; 2494 break;
2455 default: 2495 case TIPC_CMD_SET_LINK_WINDOW:
2456 res = -EINVAL; 2496 tipc_link_set_queue_limits(l_ptr, new_value);
2457 break; 2497 break;
2498 default:
2499 res = -EINVAL;
2500 break;
2501 }
2458 } 2502 }
2459 tipc_node_unlock(node); 2503 tipc_node_unlock(node);
2460 return res; 2504 return res;
@@ -2549,6 +2593,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
2549 char *link_name; 2593 char *link_name;
2550 struct tipc_link *l_ptr; 2594 struct tipc_link *l_ptr;
2551 struct tipc_node *node; 2595 struct tipc_node *node;
2596 unsigned int bearer_id;
2552 2597
2553 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) 2598 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
2554 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2599 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
@@ -2559,15 +2604,19 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
2559 return tipc_cfg_reply_error_string("link not found"); 2604 return tipc_cfg_reply_error_string("link not found");
2560 return tipc_cfg_reply_none(); 2605 return tipc_cfg_reply_none();
2561 } 2606 }
2562
2563 read_lock_bh(&tipc_net_lock); 2607 read_lock_bh(&tipc_net_lock);
2564 l_ptr = link_find_link(link_name, &node); 2608 node = tipc_link_find_owner(link_name, &bearer_id);
2565 if (!l_ptr) { 2609 if (!node) {
2566 read_unlock_bh(&tipc_net_lock); 2610 read_unlock_bh(&tipc_net_lock);
2567 return tipc_cfg_reply_error_string("link not found"); 2611 return tipc_cfg_reply_error_string("link not found");
2568 } 2612 }
2569
2570 tipc_node_lock(node); 2613 tipc_node_lock(node);
2614 l_ptr = node->links[bearer_id];
2615 if (!l_ptr) {
2616 tipc_node_unlock(node);
2617 read_unlock_bh(&tipc_net_lock);
2618 return tipc_cfg_reply_error_string("link not found");
2619 }
2571 link_reset_statistics(l_ptr); 2620 link_reset_statistics(l_ptr);
2572 tipc_node_unlock(node); 2621 tipc_node_unlock(node);
2573 read_unlock_bh(&tipc_net_lock); 2622 read_unlock_bh(&tipc_net_lock);
@@ -2597,18 +2646,27 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
2597 struct tipc_node *node; 2646 struct tipc_node *node;
2598 char *status; 2647 char *status;
2599 u32 profile_total = 0; 2648 u32 profile_total = 0;
2649 unsigned int bearer_id;
2600 int ret; 2650 int ret;
2601 2651
2602 if (!strcmp(name, tipc_bclink_name)) 2652 if (!strcmp(name, tipc_bclink_name))
2603 return tipc_bclink_stats(buf, buf_size); 2653 return tipc_bclink_stats(buf, buf_size);
2604 2654
2605 read_lock_bh(&tipc_net_lock); 2655 read_lock_bh(&tipc_net_lock);
2606 l = link_find_link(name, &node); 2656 node = tipc_link_find_owner(name, &bearer_id);
2607 if (!l) { 2657 if (!node) {
2608 read_unlock_bh(&tipc_net_lock); 2658 read_unlock_bh(&tipc_net_lock);
2609 return 0; 2659 return 0;
2610 } 2660 }
2611 tipc_node_lock(node); 2661 tipc_node_lock(node);
2662
2663 l = node->links[bearer_id];
2664 if (!l) {
2665 tipc_node_unlock(node);
2666 read_unlock_bh(&tipc_net_lock);
2667 return 0;
2668 }
2669
2612 s = &l->stats; 2670 s = &l->stats;
2613 2671
2614 if (tipc_link_is_active(l)) 2672 if (tipc_link_is_active(l))
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 3b6aa65b608c..8c0b49b5b2ee 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/link.h: Include file for TIPC link code 2 * net/tipc/link.h: Include file for TIPC link code
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, 2013, Ericsson AB
5 * Copyright (c) 2004-2005, 2010-2011, Wind River Systems 5 * Copyright (c) 2004-2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -40,27 +40,28 @@
40#include "msg.h" 40#include "msg.h"
41#include "node.h" 41#include "node.h"
42 42
43/* 43/* Link reassembly status codes
44 * Link reassembly status codes
45 */ 44 */
46#define LINK_REASM_ERROR -1 45#define LINK_REASM_ERROR -1
47#define LINK_REASM_COMPLETE 1 46#define LINK_REASM_COMPLETE 1
48 47
49/* 48/* Out-of-range value for link sequence numbers
50 * Out-of-range value for link sequence numbers
51 */ 49 */
52#define INVALID_LINK_SEQ 0x10000 50#define INVALID_LINK_SEQ 0x10000
53 51
54/* 52/* Link working states
55 * Link states
56 */ 53 */
57#define WORKING_WORKING 560810u 54#define WORKING_WORKING 560810u
58#define WORKING_UNKNOWN 560811u 55#define WORKING_UNKNOWN 560811u
59#define RESET_UNKNOWN 560812u 56#define RESET_UNKNOWN 560812u
60#define RESET_RESET 560813u 57#define RESET_RESET 560813u
61 58
62/* 59/* Link endpoint execution states
63 * Starting value for maximum packet size negotiation on unicast links 60 */
61#define LINK_STARTED 0x0001
62#define LINK_STOPPED 0x0002
63
64/* Starting value for maximum packet size negotiation on unicast links
64 * (unless bearer MTU is less) 65 * (unless bearer MTU is less)
65 */ 66 */
66#define MAX_PKT_DEFAULT 1500 67#define MAX_PKT_DEFAULT 1500
@@ -102,8 +103,7 @@ struct tipc_stats {
102 * @media_addr: media address to use when sending messages over link 103 * @media_addr: media address to use when sending messages over link
103 * @timer: link timer 104 * @timer: link timer
104 * @owner: pointer to peer node 105 * @owner: pointer to peer node
105 * @link_list: adjacent links in bearer's list of links 106 * @flags: execution state flags for link endpoint instance
106 * @started: indicates if link has been started
107 * @checkpoint: reference point for triggering link continuity checking 107 * @checkpoint: reference point for triggering link continuity checking
108 * @peer_session: link session # being used by peer end of link 108 * @peer_session: link session # being used by peer end of link
109 * @peer_bearer_id: bearer id used by link's peer endpoint 109 * @peer_bearer_id: bearer id used by link's peer endpoint
@@ -149,10 +149,9 @@ struct tipc_link {
149 struct tipc_media_addr media_addr; 149 struct tipc_media_addr media_addr;
150 struct timer_list timer; 150 struct timer_list timer;
151 struct tipc_node *owner; 151 struct tipc_node *owner;
152 struct list_head link_list;
153 152
154 /* Management and link supervision data */ 153 /* Management and link supervision data */
155 int started; 154 unsigned int flags;
156 u32 checkpoint; 155 u32 checkpoint;
157 u32 peer_session; 156 u32 peer_session;
158 u32 peer_bearer_id; 157 u32 peer_bearer_id;
@@ -215,10 +214,9 @@ struct tipc_port;
215struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, 214struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
216 struct tipc_bearer *b_ptr, 215 struct tipc_bearer *b_ptr,
217 const struct tipc_media_addr *media_addr); 216 const struct tipc_media_addr *media_addr);
218void tipc_link_delete(struct tipc_link *l_ptr); 217void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down);
219void tipc_link_failover_send_queue(struct tipc_link *l_ptr); 218void tipc_link_failover_send_queue(struct tipc_link *l_ptr);
220void tipc_link_dup_send_queue(struct tipc_link *l_ptr, 219void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest);
221 struct tipc_link *dest);
222void tipc_link_reset_fragments(struct tipc_link *l_ptr); 220void tipc_link_reset_fragments(struct tipc_link *l_ptr);
223int tipc_link_is_up(struct tipc_link *l_ptr); 221int tipc_link_is_up(struct tipc_link *l_ptr);
224int tipc_link_is_active(struct tipc_link *l_ptr); 222int tipc_link_is_active(struct tipc_link *l_ptr);
@@ -231,23 +229,24 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area,
231struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, 229struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area,
232 int req_tlv_space); 230 int req_tlv_space);
233void tipc_link_reset(struct tipc_link *l_ptr); 231void tipc_link_reset(struct tipc_link *l_ptr);
234int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); 232void tipc_link_reset_list(unsigned int bearer_id);
235void tipc_link_send_names(struct list_head *message_list, u32 dest); 233int tipc_link_xmit(struct sk_buff *buf, u32 dest, u32 selector);
234void tipc_link_names_xmit(struct list_head *message_list, u32 dest);
235int __tipc_link_xmit(struct tipc_link *l_ptr, struct sk_buff *buf);
236int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf); 236int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
237u32 tipc_link_get_max_pkt(u32 dest, u32 selector); 237u32 tipc_link_get_max_pkt(u32 dest, u32 selector);
238int tipc_link_send_sections_fast(struct tipc_port *sender, 238int tipc_link_iovec_xmit_fast(struct tipc_port *sender,
239 struct iovec const *msg_sect, 239 struct iovec const *msg_sect,
240 unsigned int len, u32 destnode); 240 unsigned int len, u32 destnode);
241void tipc_link_recv_bundle(struct sk_buff *buf); 241void tipc_link_bundle_rcv(struct sk_buff *buf);
242int tipc_link_recv_fragment(struct sk_buff **reasm_head, 242int tipc_link_frag_rcv(struct sk_buff **reasm_head,
243 struct sk_buff **reasm_tail, 243 struct sk_buff **reasm_tail,
244 struct sk_buff **fbuf); 244 struct sk_buff **fbuf);
245void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ, int prob, 245void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob,
246 u32 gap, u32 tolerance, u32 priority, 246 u32 gap, u32 tolerance, u32 priority, u32 acked_mtu);
247 u32 acked_mtu);
248void tipc_link_push_queue(struct tipc_link *l_ptr); 247void tipc_link_push_queue(struct tipc_link *l_ptr);
249u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, 248u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
250 struct sk_buff *buf); 249 struct sk_buff *buf);
251void tipc_link_wakeup_ports(struct tipc_link *l_ptr, int all); 250void tipc_link_wakeup_ports(struct tipc_link *l_ptr, int all);
252void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window); 251void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window);
253void tipc_link_retransmit(struct tipc_link *l_ptr, 252void tipc_link_retransmit(struct tipc_link *l_ptr,
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index e0d08055754e..893c49a3d98a 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -138,7 +138,7 @@ static void named_cluster_distribute(struct sk_buff *buf)
138 if (!buf_copy) 138 if (!buf_copy)
139 break; 139 break;
140 msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); 140 msg_set_destnode(buf_msg(buf_copy), n_ptr->addr);
141 tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr); 141 tipc_link_xmit(buf_copy, n_ptr->addr, n_ptr->addr);
142 } 142 }
143 } 143 }
144 144
@@ -262,7 +262,7 @@ void tipc_named_node_up(unsigned long nodearg)
262 named_distribute(&message_list, node, &publ_zone, max_item_buf); 262 named_distribute(&message_list, node, &publ_zone, max_item_buf);
263 read_unlock_bh(&tipc_nametbl_lock); 263 read_unlock_bh(&tipc_nametbl_lock);
264 264
265 tipc_link_send_names(&message_list, node); 265 tipc_link_names_xmit(&message_list, node);
266} 266}
267 267
268/** 268/**
@@ -293,9 +293,9 @@ static void named_purge_publ(struct publication *publ)
293} 293}
294 294
295/** 295/**
296 * tipc_named_recv - process name table update message sent by another node 296 * tipc_named_rcv - process name table update message sent by another node
297 */ 297 */
298void tipc_named_recv(struct sk_buff *buf) 298void tipc_named_rcv(struct sk_buff *buf)
299{ 299{
300 struct publication *publ; 300 struct publication *publ;
301 struct tipc_msg *msg = buf_msg(buf); 301 struct tipc_msg *msg = buf_msg(buf);
diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h
index 1e41bdd4f255..9b312ccfd43e 100644
--- a/net/tipc/name_distr.h
+++ b/net/tipc/name_distr.h
@@ -42,7 +42,7 @@
42void tipc_named_publish(struct publication *publ); 42void tipc_named_publish(struct publication *publ);
43void tipc_named_withdraw(struct publication *publ); 43void tipc_named_withdraw(struct publication *publ);
44void tipc_named_node_up(unsigned long node); 44void tipc_named_node_up(unsigned long node);
45void tipc_named_recv(struct sk_buff *buf); 45void tipc_named_rcv(struct sk_buff *buf);
46void tipc_named_reinit(void); 46void tipc_named_reinit(void);
47 47
48#endif 48#endif
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 7d305ecc09c2..31b606e3916c 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -146,19 +146,19 @@ void tipc_net_route_msg(struct sk_buff *buf)
146 if (tipc_in_scope(dnode, tipc_own_addr)) { 146 if (tipc_in_scope(dnode, tipc_own_addr)) {
147 if (msg_isdata(msg)) { 147 if (msg_isdata(msg)) {
148 if (msg_mcast(msg)) 148 if (msg_mcast(msg))
149 tipc_port_recv_mcast(buf, NULL); 149 tipc_port_mcast_rcv(buf, NULL);
150 else if (msg_destport(msg)) 150 else if (msg_destport(msg))
151 tipc_port_recv_msg(buf); 151 tipc_port_rcv(buf);
152 else 152 else
153 net_route_named_msg(buf); 153 net_route_named_msg(buf);
154 return; 154 return;
155 } 155 }
156 switch (msg_user(msg)) { 156 switch (msg_user(msg)) {
157 case NAME_DISTRIBUTOR: 157 case NAME_DISTRIBUTOR:
158 tipc_named_recv(buf); 158 tipc_named_rcv(buf);
159 break; 159 break;
160 case CONN_MANAGER: 160 case CONN_MANAGER:
161 tipc_port_recv_proto_msg(buf); 161 tipc_port_proto_rcv(buf);
162 break; 162 break;
163 default: 163 default:
164 kfree_skb(buf); 164 kfree_skb(buf);
@@ -168,7 +168,7 @@ void tipc_net_route_msg(struct sk_buff *buf)
168 168
169 /* Handle message for another node */ 169 /* Handle message for another node */
170 skb_trim(buf, msg_size(msg)); 170 skb_trim(buf, msg_size(msg));
171 tipc_link_send(buf, dnode, msg_link_selector(msg)); 171 tipc_link_xmit(buf, dnode, msg_link_selector(msg));
172} 172}
173 173
174void tipc_net_start(u32 addr) 174void tipc_net_start(u32 addr)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index efe4d41bf11b..0b0f6c7da965 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -162,7 +162,7 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
162 pr_info("New link <%s> becomes standby\n", l_ptr->name); 162 pr_info("New link <%s> becomes standby\n", l_ptr->name);
163 return; 163 return;
164 } 164 }
165 tipc_link_dup_send_queue(active[0], l_ptr); 165 tipc_link_dup_queue_xmit(active[0], l_ptr);
166 if (l_ptr->priority == active[0]->priority) { 166 if (l_ptr->priority == active[0]->priority) {
167 active[0] = l_ptr; 167 active[0] = l_ptr;
168 return; 168 return;
@@ -249,9 +249,15 @@ void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
249 249
250void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr) 250void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
251{ 251{
252 n_ptr->links[l_ptr->b_ptr->identity] = NULL; 252 int i;
253 atomic_dec(&tipc_num_links); 253
254 n_ptr->link_cnt--; 254 for (i = 0; i < MAX_BEARERS; i++) {
255 if (l_ptr != n_ptr->links[i])
256 continue;
257 n_ptr->links[i] = NULL;
258 atomic_dec(&tipc_num_links);
259 n_ptr->link_cnt--;
260 }
255} 261}
256 262
257static void node_established_contact(struct tipc_node *n_ptr) 263static void node_established_contact(struct tipc_node *n_ptr)
diff --git a/net/tipc/port.c b/net/tipc/port.c
index b742b2654525..c7c2b549a39e 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -87,10 +87,11 @@ int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg)
87} 87}
88 88
89/** 89/**
90 * tipc_multicast - send a multicast message to local and remote destinations 90 * tipc_port_mcast_xmit - send a multicast message to local and remote
91 * destinations
91 */ 92 */
92int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, 93int tipc_port_mcast_xmit(u32 ref, struct tipc_name_seq const *seq,
93 struct iovec const *msg_sect, unsigned int len) 94 struct iovec const *msg_sect, unsigned int len)
94{ 95{
95 struct tipc_msg *hdr; 96 struct tipc_msg *hdr;
96 struct sk_buff *buf; 97 struct sk_buff *buf;
@@ -131,7 +132,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
131 return -ENOMEM; 132 return -ENOMEM;
132 } 133 }
133 } 134 }
134 res = tipc_bclink_send_msg(buf); 135 res = tipc_bclink_xmit(buf);
135 if ((res < 0) && (dports.count != 0)) 136 if ((res < 0) && (dports.count != 0))
136 kfree_skb(ibuf); 137 kfree_skb(ibuf);
137 } else { 138 } else {
@@ -140,7 +141,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
140 141
141 if (res >= 0) { 142 if (res >= 0) {
142 if (ibuf) 143 if (ibuf)
143 tipc_port_recv_mcast(ibuf, &dports); 144 tipc_port_mcast_rcv(ibuf, &dports);
144 } else { 145 } else {
145 tipc_port_list_free(&dports); 146 tipc_port_list_free(&dports);
146 } 147 }
@@ -148,11 +149,11 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
148} 149}
149 150
150/** 151/**
151 * tipc_port_recv_mcast - deliver multicast message to all destination ports 152 * tipc_port_mcast_rcv - deliver multicast message to all destination ports
152 * 153 *
153 * If there is no port list, perform a lookup to create one 154 * If there is no port list, perform a lookup to create one
154 */ 155 */
155void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp) 156void tipc_port_mcast_rcv(struct sk_buff *buf, struct tipc_port_list *dp)
156{ 157{
157 struct tipc_msg *msg; 158 struct tipc_msg *msg;
158 struct tipc_port_list dports = {0, NULL, }; 159 struct tipc_port_list dports = {0, NULL, };
@@ -176,7 +177,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
176 msg_set_destnode(msg, tipc_own_addr); 177 msg_set_destnode(msg, tipc_own_addr);
177 if (dp->count == 1) { 178 if (dp->count == 1) {
178 msg_set_destport(msg, dp->ports[0]); 179 msg_set_destport(msg, dp->ports[0]);
179 tipc_port_recv_msg(buf); 180 tipc_port_rcv(buf);
180 tipc_port_list_free(dp); 181 tipc_port_list_free(dp);
181 return; 182 return;
182 } 183 }
@@ -191,7 +192,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
191 if ((index == 0) && (cnt != 0)) 192 if ((index == 0) && (cnt != 0))
192 item = item->next; 193 item = item->next;
193 msg_set_destport(buf_msg(b), item->ports[index]); 194 msg_set_destport(buf_msg(b), item->ports[index]);
194 tipc_port_recv_msg(b); 195 tipc_port_rcv(b);
195 } 196 }
196 } 197 }
197exit: 198exit:
@@ -422,17 +423,17 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
422 /* send returned message & dispose of rejected message */ 423 /* send returned message & dispose of rejected message */
423 src_node = msg_prevnode(msg); 424 src_node = msg_prevnode(msg);
424 if (in_own_node(src_node)) 425 if (in_own_node(src_node))
425 tipc_port_recv_msg(rbuf); 426 tipc_port_rcv(rbuf);
426 else 427 else
427 tipc_link_send(rbuf, src_node, msg_link_selector(rmsg)); 428 tipc_link_xmit(rbuf, src_node, msg_link_selector(rmsg));
428exit: 429exit:
429 kfree_skb(buf); 430 kfree_skb(buf);
430 return data_sz; 431 return data_sz;
431} 432}
432 433
433int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr, 434int tipc_port_iovec_reject(struct tipc_port *p_ptr, struct tipc_msg *hdr,
434 struct iovec const *msg_sect, unsigned int len, 435 struct iovec const *msg_sect, unsigned int len,
435 int err) 436 int err)
436{ 437{
437 struct sk_buff *buf; 438 struct sk_buff *buf;
438 int res; 439 int res;
@@ -519,7 +520,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *p_ptr, u32 er
519 return buf; 520 return buf;
520} 521}
521 522
522void tipc_port_recv_proto_msg(struct sk_buff *buf) 523void tipc_port_proto_rcv(struct sk_buff *buf)
523{ 524{
524 struct tipc_msg *msg = buf_msg(buf); 525 struct tipc_msg *msg = buf_msg(buf);
525 struct tipc_port *p_ptr; 526 struct tipc_port *p_ptr;
@@ -760,7 +761,7 @@ int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope,
760 return res; 761 return res;
761} 762}
762 763
763int tipc_connect(u32 ref, struct tipc_portid const *peer) 764int tipc_port_connect(u32 ref, struct tipc_portid const *peer)
764{ 765{
765 struct tipc_port *p_ptr; 766 struct tipc_port *p_ptr;
766 int res; 767 int res;
@@ -768,17 +769,17 @@ int tipc_connect(u32 ref, struct tipc_portid const *peer)
768 p_ptr = tipc_port_lock(ref); 769 p_ptr = tipc_port_lock(ref);
769 if (!p_ptr) 770 if (!p_ptr)
770 return -EINVAL; 771 return -EINVAL;
771 res = __tipc_connect(ref, p_ptr, peer); 772 res = __tipc_port_connect(ref, p_ptr, peer);
772 tipc_port_unlock(p_ptr); 773 tipc_port_unlock(p_ptr);
773 return res; 774 return res;
774} 775}
775 776
776/* 777/*
777 * __tipc_connect - connect to a remote peer 778 * __tipc_port_connect - connect to a remote peer
778 * 779 *
779 * Port must be locked. 780 * Port must be locked.
780 */ 781 */
781int __tipc_connect(u32 ref, struct tipc_port *p_ptr, 782int __tipc_port_connect(u32 ref, struct tipc_port *p_ptr,
782 struct tipc_portid const *peer) 783 struct tipc_portid const *peer)
783{ 784{
784 struct tipc_msg *msg; 785 struct tipc_msg *msg;
@@ -815,7 +816,7 @@ exit:
815 * 816 *
816 * Port must be locked. 817 * Port must be locked.
817 */ 818 */
818int __tipc_disconnect(struct tipc_port *tp_ptr) 819int __tipc_port_disconnect(struct tipc_port *tp_ptr)
819{ 820{
820 if (tp_ptr->connected) { 821 if (tp_ptr->connected) {
821 tp_ptr->connected = 0; 822 tp_ptr->connected = 0;
@@ -828,10 +829,10 @@ int __tipc_disconnect(struct tipc_port *tp_ptr)
828} 829}
829 830
830/* 831/*
831 * tipc_disconnect(): Disconnect port form peer. 832 * tipc_port_disconnect(): Disconnect port form peer.
832 * This is a node local operation. 833 * This is a node local operation.
833 */ 834 */
834int tipc_disconnect(u32 ref) 835int tipc_port_disconnect(u32 ref)
835{ 836{
836 struct tipc_port *p_ptr; 837 struct tipc_port *p_ptr;
837 int res; 838 int res;
@@ -839,15 +840,15 @@ int tipc_disconnect(u32 ref)
839 p_ptr = tipc_port_lock(ref); 840 p_ptr = tipc_port_lock(ref);
840 if (!p_ptr) 841 if (!p_ptr)
841 return -EINVAL; 842 return -EINVAL;
842 res = __tipc_disconnect(p_ptr); 843 res = __tipc_port_disconnect(p_ptr);
843 tipc_port_unlock(p_ptr); 844 tipc_port_unlock(p_ptr);
844 return res; 845 return res;
845} 846}
846 847
847/* 848/*
848 * tipc_shutdown(): Send a SHUTDOWN msg to peer and disconnect 849 * tipc_port_shutdown(): Send a SHUTDOWN msg to peer and disconnect
849 */ 850 */
850int tipc_shutdown(u32 ref) 851int tipc_port_shutdown(u32 ref)
851{ 852{
852 struct tipc_port *p_ptr; 853 struct tipc_port *p_ptr;
853 struct sk_buff *buf = NULL; 854 struct sk_buff *buf = NULL;
@@ -859,13 +860,13 @@ int tipc_shutdown(u32 ref)
859 buf = port_build_peer_abort_msg(p_ptr, TIPC_CONN_SHUTDOWN); 860 buf = port_build_peer_abort_msg(p_ptr, TIPC_CONN_SHUTDOWN);
860 tipc_port_unlock(p_ptr); 861 tipc_port_unlock(p_ptr);
861 tipc_net_route_msg(buf); 862 tipc_net_route_msg(buf);
862 return tipc_disconnect(ref); 863 return tipc_port_disconnect(ref);
863} 864}
864 865
865/** 866/**
866 * tipc_port_recv_msg - receive message from lower layer and deliver to port user 867 * tipc_port_rcv - receive message from lower layer and deliver to port user
867 */ 868 */
868int tipc_port_recv_msg(struct sk_buff *buf) 869int tipc_port_rcv(struct sk_buff *buf)
869{ 870{
870 struct tipc_port *p_ptr; 871 struct tipc_port *p_ptr;
871 struct tipc_msg *msg = buf_msg(buf); 872 struct tipc_msg *msg = buf_msg(buf);
@@ -894,19 +895,19 @@ int tipc_port_recv_msg(struct sk_buff *buf)
894} 895}
895 896
896/* 897/*
897 * tipc_port_recv_sections(): Concatenate and deliver sectioned 898 * tipc_port_iovec_rcv: Concatenate and deliver sectioned
898 * message for this node. 899 * message for this node.
899 */ 900 */
900static int tipc_port_recv_sections(struct tipc_port *sender, 901static int tipc_port_iovec_rcv(struct tipc_port *sender,
901 struct iovec const *msg_sect, 902 struct iovec const *msg_sect,
902 unsigned int len) 903 unsigned int len)
903{ 904{
904 struct sk_buff *buf; 905 struct sk_buff *buf;
905 int res; 906 int res;
906 907
907 res = tipc_msg_build(&sender->phdr, msg_sect, len, MAX_MSG_SIZE, &buf); 908 res = tipc_msg_build(&sender->phdr, msg_sect, len, MAX_MSG_SIZE, &buf);
908 if (likely(buf)) 909 if (likely(buf))
909 tipc_port_recv_msg(buf); 910 tipc_port_rcv(buf);
910 return res; 911 return res;
911} 912}
912 913
@@ -927,10 +928,10 @@ int tipc_send(u32 ref, struct iovec const *msg_sect, unsigned int len)
927 if (!tipc_port_congested(p_ptr)) { 928 if (!tipc_port_congested(p_ptr)) {
928 destnode = port_peernode(p_ptr); 929 destnode = port_peernode(p_ptr);
929 if (likely(!in_own_node(destnode))) 930 if (likely(!in_own_node(destnode)))
930 res = tipc_link_send_sections_fast(p_ptr, msg_sect, 931 res = tipc_link_iovec_xmit_fast(p_ptr, msg_sect, len,
931 len, destnode); 932 destnode);
932 else 933 else
933 res = tipc_port_recv_sections(p_ptr, msg_sect, len); 934 res = tipc_port_iovec_rcv(p_ptr, msg_sect, len);
934 935
935 if (likely(res != -ELINKCONG)) { 936 if (likely(res != -ELINKCONG)) {
936 p_ptr->congested = 0; 937 p_ptr->congested = 0;
@@ -974,13 +975,13 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
974 975
975 if (likely(destport || destnode)) { 976 if (likely(destport || destnode)) {
976 if (likely(in_own_node(destnode))) 977 if (likely(in_own_node(destnode)))
977 res = tipc_port_recv_sections(p_ptr, msg_sect, len); 978 res = tipc_port_iovec_rcv(p_ptr, msg_sect, len);
978 else if (tipc_own_addr) 979 else if (tipc_own_addr)
979 res = tipc_link_send_sections_fast(p_ptr, msg_sect, 980 res = tipc_link_iovec_xmit_fast(p_ptr, msg_sect, len,
980 len, destnode); 981 destnode);
981 else 982 else
982 res = tipc_port_reject_sections(p_ptr, msg, msg_sect, 983 res = tipc_port_iovec_reject(p_ptr, msg, msg_sect,
983 len, TIPC_ERR_NO_NODE); 984 len, TIPC_ERR_NO_NODE);
984 if (likely(res != -ELINKCONG)) { 985 if (likely(res != -ELINKCONG)) {
985 if (res > 0) 986 if (res > 0)
986 p_ptr->sent++; 987 p_ptr->sent++;
@@ -991,8 +992,8 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
991 } 992 }
992 return -ELINKCONG; 993 return -ELINKCONG;
993 } 994 }
994 return tipc_port_reject_sections(p_ptr, msg, msg_sect, len, 995 return tipc_port_iovec_reject(p_ptr, msg, msg_sect, len,
995 TIPC_ERR_NO_NAME); 996 TIPC_ERR_NO_NAME);
996} 997}
997 998
998/** 999/**
@@ -1017,12 +1018,12 @@ int tipc_send2port(u32 ref, struct tipc_portid const *dest,
1017 msg_set_hdr_sz(msg, BASIC_H_SIZE); 1018 msg_set_hdr_sz(msg, BASIC_H_SIZE);
1018 1019
1019 if (in_own_node(dest->node)) 1020 if (in_own_node(dest->node))
1020 res = tipc_port_recv_sections(p_ptr, msg_sect, len); 1021 res = tipc_port_iovec_rcv(p_ptr, msg_sect, len);
1021 else if (tipc_own_addr) 1022 else if (tipc_own_addr)
1022 res = tipc_link_send_sections_fast(p_ptr, msg_sect, len, 1023 res = tipc_link_iovec_xmit_fast(p_ptr, msg_sect, len,
1023 dest->node); 1024 dest->node);
1024 else 1025 else
1025 res = tipc_port_reject_sections(p_ptr, msg, msg_sect, len, 1026 res = tipc_port_iovec_reject(p_ptr, msg, msg_sect, len,
1026 TIPC_ERR_NO_NODE); 1027 TIPC_ERR_NO_NODE);
1027 if (likely(res != -ELINKCONG)) { 1028 if (likely(res != -ELINKCONG)) {
1028 if (res > 0) 1029 if (res > 0)
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 34f12bd4074e..3ec3e94e4334 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -132,25 +132,25 @@ int tipc_publish(struct tipc_port *p_ptr, unsigned int scope,
132int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope, 132int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope,
133 struct tipc_name_seq const *name_seq); 133 struct tipc_name_seq const *name_seq);
134 134
135int tipc_connect(u32 portref, struct tipc_portid const *port); 135int tipc_port_connect(u32 portref, struct tipc_portid const *port);
136 136
137int tipc_disconnect(u32 portref); 137int tipc_port_disconnect(u32 portref);
138 138
139int tipc_shutdown(u32 ref); 139int tipc_port_shutdown(u32 ref);
140 140
141 141
142/* 142/*
143 * The following routines require that the port be locked on entry 143 * The following routines require that the port be locked on entry
144 */ 144 */
145int __tipc_disconnect(struct tipc_port *tp_ptr); 145int __tipc_port_disconnect(struct tipc_port *tp_ptr);
146int __tipc_connect(u32 ref, struct tipc_port *p_ptr, 146int __tipc_port_connect(u32 ref, struct tipc_port *p_ptr,
147 struct tipc_portid const *peer); 147 struct tipc_portid const *peer);
148int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg); 148int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg);
149 149
150/* 150/*
151 * TIPC messaging routines 151 * TIPC messaging routines
152 */ 152 */
153int tipc_port_recv_msg(struct sk_buff *buf); 153int tipc_port_rcv(struct sk_buff *buf);
154int tipc_send(u32 portref, struct iovec const *msg_sect, unsigned int len); 154int tipc_send(u32 portref, struct iovec const *msg_sect, unsigned int len);
155 155
156int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain, 156int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain,
@@ -159,15 +159,15 @@ int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain,
159int tipc_send2port(u32 portref, struct tipc_portid const *dest, 159int tipc_send2port(u32 portref, struct tipc_portid const *dest,
160 struct iovec const *msg_sect, unsigned int len); 160 struct iovec const *msg_sect, unsigned int len);
161 161
162int tipc_multicast(u32 portref, struct tipc_name_seq const *seq, 162int tipc_port_mcast_xmit(u32 portref, struct tipc_name_seq const *seq,
163 struct iovec const *msg, unsigned int len); 163 struct iovec const *msg, unsigned int len);
164 164
165int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr, 165int tipc_port_iovec_reject(struct tipc_port *p_ptr, struct tipc_msg *hdr,
166 struct iovec const *msg_sect, unsigned int len, 166 struct iovec const *msg_sect, unsigned int len,
167 int err); 167 int err);
168struct sk_buff *tipc_port_get_ports(void); 168struct sk_buff *tipc_port_get_ports(void);
169void tipc_port_recv_proto_msg(struct sk_buff *buf); 169void tipc_port_proto_rcv(struct sk_buff *buf);
170void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp); 170void tipc_port_mcast_rcv(struct sk_buff *buf, struct tipc_port_list *dp);
171void tipc_port_reinit(void); 171void tipc_port_reinit(void);
172 172
173/** 173/**
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index a4cf274455aa..336e18d6cf46 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -60,8 +60,8 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf);
60static void wakeupdispatch(struct tipc_port *tport); 60static void wakeupdispatch(struct tipc_port *tport);
61static void tipc_data_ready(struct sock *sk, int len); 61static void tipc_data_ready(struct sock *sk, int len);
62static void tipc_write_space(struct sock *sk); 62static void tipc_write_space(struct sock *sk);
63static int release(struct socket *sock); 63static int tipc_release(struct socket *sock);
64static int accept(struct socket *sock, struct socket *new_sock, int flags); 64static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags);
65 65
66static const struct proto_ops packet_ops; 66static const struct proto_ops packet_ops;
67static const struct proto_ops stream_ops; 67static const struct proto_ops stream_ops;
@@ -254,7 +254,7 @@ int tipc_sock_create_local(int type, struct socket **res)
254 */ 254 */
255void tipc_sock_release_local(struct socket *sock) 255void tipc_sock_release_local(struct socket *sock)
256{ 256{
257 release(sock); 257 tipc_release(sock);
258 sock->ops = NULL; 258 sock->ops = NULL;
259 sock_release(sock); 259 sock_release(sock);
260} 260}
@@ -280,7 +280,7 @@ int tipc_sock_accept_local(struct socket *sock, struct socket **newsock,
280 if (ret < 0) 280 if (ret < 0)
281 return ret; 281 return ret;
282 282
283 ret = accept(sock, *newsock, flags); 283 ret = tipc_accept(sock, *newsock, flags);
284 if (ret < 0) { 284 if (ret < 0) {
285 sock_release(*newsock); 285 sock_release(*newsock);
286 return ret; 286 return ret;
@@ -290,7 +290,7 @@ int tipc_sock_accept_local(struct socket *sock, struct socket **newsock,
290} 290}
291 291
292/** 292/**
293 * release - destroy a TIPC socket 293 * tipc_release - destroy a TIPC socket
294 * @sock: socket to destroy 294 * @sock: socket to destroy
295 * 295 *
296 * This routine cleans up any messages that are still queued on the socket. 296 * This routine cleans up any messages that are still queued on the socket.
@@ -305,7 +305,7 @@ int tipc_sock_accept_local(struct socket *sock, struct socket **newsock,
305 * 305 *
306 * Returns 0 on success, errno otherwise 306 * Returns 0 on success, errno otherwise
307 */ 307 */
308static int release(struct socket *sock) 308static int tipc_release(struct socket *sock)
309{ 309{
310 struct sock *sk = sock->sk; 310 struct sock *sk = sock->sk;
311 struct tipc_port *tport; 311 struct tipc_port *tport;
@@ -336,7 +336,7 @@ static int release(struct socket *sock)
336 if ((sock->state == SS_CONNECTING) || 336 if ((sock->state == SS_CONNECTING) ||
337 (sock->state == SS_CONNECTED)) { 337 (sock->state == SS_CONNECTED)) {
338 sock->state = SS_DISCONNECTING; 338 sock->state = SS_DISCONNECTING;
339 tipc_disconnect(tport->ref); 339 tipc_port_disconnect(tport->ref);
340 } 340 }
341 tipc_reject_msg(buf, TIPC_ERR_NO_PORT); 341 tipc_reject_msg(buf, TIPC_ERR_NO_PORT);
342 } 342 }
@@ -362,7 +362,7 @@ static int release(struct socket *sock)
362} 362}
363 363
364/** 364/**
365 * bind - associate or disassocate TIPC name(s) with a socket 365 * tipc_bind - associate or disassocate TIPC name(s) with a socket
366 * @sock: socket structure 366 * @sock: socket structure
367 * @uaddr: socket address describing name(s) and desired operation 367 * @uaddr: socket address describing name(s) and desired operation
368 * @uaddr_len: size of socket address data structure 368 * @uaddr_len: size of socket address data structure
@@ -376,7 +376,8 @@ static int release(struct socket *sock)
376 * NOTE: This routine doesn't need to take the socket lock since it doesn't 376 * NOTE: This routine doesn't need to take the socket lock since it doesn't
377 * access any non-constant socket information. 377 * access any non-constant socket information.
378 */ 378 */
379static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) 379static int tipc_bind(struct socket *sock, struct sockaddr *uaddr,
380 int uaddr_len)
380{ 381{
381 struct sock *sk = sock->sk; 382 struct sock *sk = sock->sk;
382 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr; 383 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
@@ -421,7 +422,7 @@ exit:
421} 422}
422 423
423/** 424/**
424 * get_name - get port ID of socket or peer socket 425 * tipc_getname - get port ID of socket or peer socket
425 * @sock: socket structure 426 * @sock: socket structure
426 * @uaddr: area for returned socket address 427 * @uaddr: area for returned socket address
427 * @uaddr_len: area for returned length of socket address 428 * @uaddr_len: area for returned length of socket address
@@ -433,8 +434,8 @@ exit:
433 * accesses socket information that is unchanging (or which changes in 434 * accesses socket information that is unchanging (or which changes in
434 * a completely predictable manner). 435 * a completely predictable manner).
435 */ 436 */
436static int get_name(struct socket *sock, struct sockaddr *uaddr, 437static int tipc_getname(struct socket *sock, struct sockaddr *uaddr,
437 int *uaddr_len, int peer) 438 int *uaddr_len, int peer)
438{ 439{
439 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr; 440 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
440 struct tipc_sock *tsock = tipc_sk(sock->sk); 441 struct tipc_sock *tsock = tipc_sk(sock->sk);
@@ -461,7 +462,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,
461} 462}
462 463
463/** 464/**
464 * poll - read and possibly block on pollmask 465 * tipc_poll - read and possibly block on pollmask
465 * @file: file structure associated with the socket 466 * @file: file structure associated with the socket
466 * @sock: socket for which to calculate the poll bits 467 * @sock: socket for which to calculate the poll bits
467 * @wait: ??? 468 * @wait: ???
@@ -500,8 +501,8 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,
500 * imply that the operation will succeed, merely that it should be performed 501 * imply that the operation will succeed, merely that it should be performed
501 * and will not block. 502 * and will not block.
502 */ 503 */
503static unsigned int poll(struct file *file, struct socket *sock, 504static unsigned int tipc_poll(struct file *file, struct socket *sock,
504 poll_table *wait) 505 poll_table *wait)
505{ 506{
506 struct sock *sk = sock->sk; 507 struct sock *sk = sock->sk;
507 u32 mask = 0; 508 u32 mask = 0;
@@ -588,7 +589,7 @@ static int tipc_wait_for_sndmsg(struct socket *sock, long *timeo_p)
588} 589}
589 590
590/** 591/**
591 * send_msg - send message in connectionless manner 592 * tipc_sendmsg - send message in connectionless manner
592 * @iocb: if NULL, indicates that socket lock is already held 593 * @iocb: if NULL, indicates that socket lock is already held
593 * @sock: socket structure 594 * @sock: socket structure
594 * @m: message to send 595 * @m: message to send
@@ -601,8 +602,8 @@ static int tipc_wait_for_sndmsg(struct socket *sock, long *timeo_p)
601 * 602 *
602 * Returns the number of bytes sent on success, or errno otherwise 603 * Returns the number of bytes sent on success, or errno otherwise
603 */ 604 */
604static int send_msg(struct kiocb *iocb, struct socket *sock, 605static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock,
605 struct msghdr *m, size_t total_len) 606 struct msghdr *m, size_t total_len)
606{ 607{
607 struct sock *sk = sock->sk; 608 struct sock *sk = sock->sk;
608 struct tipc_port *tport = tipc_sk_port(sk); 609 struct tipc_port *tport = tipc_sk_port(sk);
@@ -669,10 +670,10 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
669 res = dest_name_check(dest, m); 670 res = dest_name_check(dest, m);
670 if (res) 671 if (res)
671 break; 672 break;
672 res = tipc_multicast(tport->ref, 673 res = tipc_port_mcast_xmit(tport->ref,
673 &dest->addr.nameseq, 674 &dest->addr.nameseq,
674 m->msg_iov, 675 m->msg_iov,
675 total_len); 676 total_len);
676 } 677 }
677 if (likely(res != -ELINKCONG)) { 678 if (likely(res != -ELINKCONG)) {
678 if (needs_conn && (res >= 0)) 679 if (needs_conn && (res >= 0))
@@ -719,7 +720,7 @@ static int tipc_wait_for_sndpkt(struct socket *sock, long *timeo_p)
719} 720}
720 721
721/** 722/**
722 * send_packet - send a connection-oriented message 723 * tipc_send_packet - send a connection-oriented message
723 * @iocb: if NULL, indicates that socket lock is already held 724 * @iocb: if NULL, indicates that socket lock is already held
724 * @sock: socket structure 725 * @sock: socket structure
725 * @m: message to send 726 * @m: message to send
@@ -729,8 +730,8 @@ static int tipc_wait_for_sndpkt(struct socket *sock, long *timeo_p)
729 * 730 *
730 * Returns the number of bytes sent on success, or errno otherwise 731 * Returns the number of bytes sent on success, or errno otherwise
731 */ 732 */
732static int send_packet(struct kiocb *iocb, struct socket *sock, 733static int tipc_send_packet(struct kiocb *iocb, struct socket *sock,
733 struct msghdr *m, size_t total_len) 734 struct msghdr *m, size_t total_len)
734{ 735{
735 struct sock *sk = sock->sk; 736 struct sock *sk = sock->sk;
736 struct tipc_port *tport = tipc_sk_port(sk); 737 struct tipc_port *tport = tipc_sk_port(sk);
@@ -740,7 +741,7 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
740 741
741 /* Handle implied connection establishment */ 742 /* Handle implied connection establishment */
742 if (unlikely(dest)) 743 if (unlikely(dest))
743 return send_msg(iocb, sock, m, total_len); 744 return tipc_sendmsg(iocb, sock, m, total_len);
744 745
745 if (total_len > TIPC_MAX_USER_MSG_SIZE) 746 if (total_len > TIPC_MAX_USER_MSG_SIZE)
746 return -EMSGSIZE; 747 return -EMSGSIZE;
@@ -772,7 +773,7 @@ exit:
772} 773}
773 774
774/** 775/**
775 * send_stream - send stream-oriented data 776 * tipc_send_stream - send stream-oriented data
776 * @iocb: (unused) 777 * @iocb: (unused)
777 * @sock: socket structure 778 * @sock: socket structure
778 * @m: data to send 779 * @m: data to send
@@ -783,8 +784,8 @@ exit:
783 * Returns the number of bytes sent on success (or partial success), 784 * Returns the number of bytes sent on success (or partial success),
784 * or errno if no data sent 785 * or errno if no data sent
785 */ 786 */
786static int send_stream(struct kiocb *iocb, struct socket *sock, 787static int tipc_send_stream(struct kiocb *iocb, struct socket *sock,
787 struct msghdr *m, size_t total_len) 788 struct msghdr *m, size_t total_len)
788{ 789{
789 struct sock *sk = sock->sk; 790 struct sock *sk = sock->sk;
790 struct tipc_port *tport = tipc_sk_port(sk); 791 struct tipc_port *tport = tipc_sk_port(sk);
@@ -804,7 +805,7 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
804 /* Handle special cases where there is no connection */ 805 /* Handle special cases where there is no connection */
805 if (unlikely(sock->state != SS_CONNECTED)) { 806 if (unlikely(sock->state != SS_CONNECTED)) {
806 if (sock->state == SS_UNCONNECTED) 807 if (sock->state == SS_UNCONNECTED)
807 res = send_packet(NULL, sock, m, total_len); 808 res = tipc_send_packet(NULL, sock, m, total_len);
808 else 809 else
809 res = sock->state == SS_DISCONNECTING ? -EPIPE : -ENOTCONN; 810 res = sock->state == SS_DISCONNECTING ? -EPIPE : -ENOTCONN;
810 goto exit; 811 goto exit;
@@ -849,7 +850,8 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
849 bytes_to_send = curr_left; 850 bytes_to_send = curr_left;
850 my_iov.iov_base = curr_start; 851 my_iov.iov_base = curr_start;
851 my_iov.iov_len = bytes_to_send; 852 my_iov.iov_len = bytes_to_send;
852 res = send_packet(NULL, sock, &my_msg, bytes_to_send); 853 res = tipc_send_packet(NULL, sock, &my_msg,
854 bytes_to_send);
853 if (res < 0) { 855 if (res < 0) {
854 if (bytes_sent) 856 if (bytes_sent)
855 res = bytes_sent; 857 res = bytes_sent;
@@ -886,7 +888,7 @@ static int auto_connect(struct socket *sock, struct tipc_msg *msg)
886 if (!p_ptr) 888 if (!p_ptr)
887 return -EINVAL; 889 return -EINVAL;
888 890
889 __tipc_connect(tsock->p->ref, p_ptr, &tsock->peer_name); 891 __tipc_port_connect(tsock->p->ref, p_ptr, &tsock->peer_name);
890 892
891 if (msg_importance(msg) > TIPC_CRITICAL_IMPORTANCE) 893 if (msg_importance(msg) > TIPC_CRITICAL_IMPORTANCE)
892 return -EINVAL; 894 return -EINVAL;
@@ -1021,7 +1023,7 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo)
1021} 1023}
1022 1024
1023/** 1025/**
1024 * recv_msg - receive packet-oriented message 1026 * tipc_recvmsg - receive packet-oriented message
1025 * @iocb: (unused) 1027 * @iocb: (unused)
1026 * @m: descriptor for message info 1028 * @m: descriptor for message info
1027 * @buf_len: total size of user buffer area 1029 * @buf_len: total size of user buffer area
@@ -1032,8 +1034,8 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo)
1032 * 1034 *
1033 * Returns size of returned message data, errno otherwise 1035 * Returns size of returned message data, errno otherwise
1034 */ 1036 */
1035static int recv_msg(struct kiocb *iocb, struct socket *sock, 1037static int tipc_recvmsg(struct kiocb *iocb, struct socket *sock,
1036 struct msghdr *m, size_t buf_len, int flags) 1038 struct msghdr *m, size_t buf_len, int flags)
1037{ 1039{
1038 struct sock *sk = sock->sk; 1040 struct sock *sk = sock->sk;
1039 struct tipc_port *tport = tipc_sk_port(sk); 1041 struct tipc_port *tport = tipc_sk_port(sk);
@@ -1115,7 +1117,7 @@ exit:
1115} 1117}
1116 1118
1117/** 1119/**
1118 * recv_stream - receive stream-oriented data 1120 * tipc_recv_stream - receive stream-oriented data
1119 * @iocb: (unused) 1121 * @iocb: (unused)
1120 * @m: descriptor for message info 1122 * @m: descriptor for message info
1121 * @buf_len: total size of user buffer area 1123 * @buf_len: total size of user buffer area
@@ -1126,8 +1128,8 @@ exit:
1126 * 1128 *
1127 * Returns size of returned message data, errno otherwise 1129 * Returns size of returned message data, errno otherwise
1128 */ 1130 */
1129static int recv_stream(struct kiocb *iocb, struct socket *sock, 1131static int tipc_recv_stream(struct kiocb *iocb, struct socket *sock,
1130 struct msghdr *m, size_t buf_len, int flags) 1132 struct msghdr *m, size_t buf_len, int flags)
1131{ 1133{
1132 struct sock *sk = sock->sk; 1134 struct sock *sk = sock->sk;
1133 struct tipc_port *tport = tipc_sk_port(sk); 1135 struct tipc_port *tport = tipc_sk_port(sk);
@@ -1289,7 +1291,7 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf)
1289 if (msg_connected(msg) && tipc_port_peer_msg(tsock->p, msg)) { 1291 if (msg_connected(msg) && tipc_port_peer_msg(tsock->p, msg)) {
1290 if (unlikely(msg_errcode(msg))) { 1292 if (unlikely(msg_errcode(msg))) {
1291 sock->state = SS_DISCONNECTING; 1293 sock->state = SS_DISCONNECTING;
1292 __tipc_disconnect(tsock->p); 1294 __tipc_port_disconnect(tsock->p);
1293 } 1295 }
1294 retval = TIPC_OK; 1296 retval = TIPC_OK;
1295 } 1297 }
@@ -1504,7 +1506,7 @@ static int tipc_wait_for_connect(struct socket *sock, long *timeo_p)
1504} 1506}
1505 1507
1506/** 1508/**
1507 * connect - establish a connection to another TIPC port 1509 * tipc_connect - establish a connection to another TIPC port
1508 * @sock: socket structure 1510 * @sock: socket structure
1509 * @dest: socket address for destination port 1511 * @dest: socket address for destination port
1510 * @destlen: size of socket address data structure 1512 * @destlen: size of socket address data structure
@@ -1512,8 +1514,8 @@ static int tipc_wait_for_connect(struct socket *sock, long *timeo_p)
1512 * 1514 *
1513 * Returns 0 on success, errno otherwise 1515 * Returns 0 on success, errno otherwise
1514 */ 1516 */
1515static int connect(struct socket *sock, struct sockaddr *dest, int destlen, 1517static int tipc_connect(struct socket *sock, struct sockaddr *dest,
1516 int flags) 1518 int destlen, int flags)
1517{ 1519{
1518 struct sock *sk = sock->sk; 1520 struct sock *sk = sock->sk;
1519 struct sockaddr_tipc *dst = (struct sockaddr_tipc *)dest; 1521 struct sockaddr_tipc *dst = (struct sockaddr_tipc *)dest;
@@ -1554,7 +1556,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1554 if (!timeout) 1556 if (!timeout)
1555 m.msg_flags = MSG_DONTWAIT; 1557 m.msg_flags = MSG_DONTWAIT;
1556 1558
1557 res = send_msg(NULL, sock, &m, 0); 1559 res = tipc_sendmsg(NULL, sock, &m, 0);
1558 if ((res < 0) && (res != -EWOULDBLOCK)) 1560 if ((res < 0) && (res != -EWOULDBLOCK))
1559 goto exit; 1561 goto exit;
1560 1562
@@ -1585,13 +1587,13 @@ exit:
1585} 1587}
1586 1588
1587/** 1589/**
1588 * listen - allow socket to listen for incoming connections 1590 * tipc_listen - allow socket to listen for incoming connections
1589 * @sock: socket structure 1591 * @sock: socket structure
1590 * @len: (unused) 1592 * @len: (unused)
1591 * 1593 *
1592 * Returns 0 on success, errno otherwise 1594 * Returns 0 on success, errno otherwise
1593 */ 1595 */
1594static int listen(struct socket *sock, int len) 1596static int tipc_listen(struct socket *sock, int len)
1595{ 1597{
1596 struct sock *sk = sock->sk; 1598 struct sock *sk = sock->sk;
1597 int res; 1599 int res;
@@ -1646,14 +1648,14 @@ static int tipc_wait_for_accept(struct socket *sock, long timeo)
1646} 1648}
1647 1649
1648/** 1650/**
1649 * accept - wait for connection request 1651 * tipc_accept - wait for connection request
1650 * @sock: listening socket 1652 * @sock: listening socket
1651 * @newsock: new socket that is to be connected 1653 * @newsock: new socket that is to be connected
1652 * @flags: file-related flags associated with socket 1654 * @flags: file-related flags associated with socket
1653 * 1655 *
1654 * Returns 0 on success, errno otherwise 1656 * Returns 0 on success, errno otherwise
1655 */ 1657 */
1656static int accept(struct socket *sock, struct socket *new_sock, int flags) 1658static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags)
1657{ 1659{
1658 struct sock *new_sk, *sk = sock->sk; 1660 struct sock *new_sk, *sk = sock->sk;
1659 struct sk_buff *buf; 1661 struct sk_buff *buf;
@@ -1700,7 +1702,7 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags)
1700 /* Connect new socket to it's peer */ 1702 /* Connect new socket to it's peer */
1701 new_tsock->peer_name.ref = msg_origport(msg); 1703 new_tsock->peer_name.ref = msg_origport(msg);
1702 new_tsock->peer_name.node = msg_orignode(msg); 1704 new_tsock->peer_name.node = msg_orignode(msg);
1703 tipc_connect(new_ref, &new_tsock->peer_name); 1705 tipc_port_connect(new_ref, &new_tsock->peer_name);
1704 new_sock->state = SS_CONNECTED; 1706 new_sock->state = SS_CONNECTED;
1705 1707
1706 tipc_set_portimportance(new_ref, msg_importance(msg)); 1708 tipc_set_portimportance(new_ref, msg_importance(msg));
@@ -1717,7 +1719,7 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags)
1717 struct msghdr m = {NULL,}; 1719 struct msghdr m = {NULL,};
1718 1720
1719 advance_rx_queue(sk); 1721 advance_rx_queue(sk);
1720 send_packet(NULL, new_sock, &m, 0); 1722 tipc_send_packet(NULL, new_sock, &m, 0);
1721 } else { 1723 } else {
1722 __skb_dequeue(&sk->sk_receive_queue); 1724 __skb_dequeue(&sk->sk_receive_queue);
1723 __skb_queue_head(&new_sk->sk_receive_queue, buf); 1725 __skb_queue_head(&new_sk->sk_receive_queue, buf);
@@ -1731,7 +1733,7 @@ exit:
1731} 1733}
1732 1734
1733/** 1735/**
1734 * shutdown - shutdown socket connection 1736 * tipc_shutdown - shutdown socket connection
1735 * @sock: socket structure 1737 * @sock: socket structure
1736 * @how: direction to close (must be SHUT_RDWR) 1738 * @how: direction to close (must be SHUT_RDWR)
1737 * 1739 *
@@ -1739,7 +1741,7 @@ exit:
1739 * 1741 *
1740 * Returns 0 on success, errno otherwise 1742 * Returns 0 on success, errno otherwise
1741 */ 1743 */
1742static int shutdown(struct socket *sock, int how) 1744static int tipc_shutdown(struct socket *sock, int how)
1743{ 1745{
1744 struct sock *sk = sock->sk; 1746 struct sock *sk = sock->sk;
1745 struct tipc_port *tport = tipc_sk_port(sk); 1747 struct tipc_port *tport = tipc_sk_port(sk);
@@ -1763,10 +1765,10 @@ restart:
1763 kfree_skb(buf); 1765 kfree_skb(buf);
1764 goto restart; 1766 goto restart;
1765 } 1767 }
1766 tipc_disconnect(tport->ref); 1768 tipc_port_disconnect(tport->ref);
1767 tipc_reject_msg(buf, TIPC_CONN_SHUTDOWN); 1769 tipc_reject_msg(buf, TIPC_CONN_SHUTDOWN);
1768 } else { 1770 } else {
1769 tipc_shutdown(tport->ref); 1771 tipc_port_shutdown(tport->ref);
1770 } 1772 }
1771 1773
1772 sock->state = SS_DISCONNECTING; 1774 sock->state = SS_DISCONNECTING;
@@ -1792,7 +1794,7 @@ restart:
1792} 1794}
1793 1795
1794/** 1796/**
1795 * setsockopt - set socket option 1797 * tipc_setsockopt - set socket option
1796 * @sock: socket structure 1798 * @sock: socket structure
1797 * @lvl: option level 1799 * @lvl: option level
1798 * @opt: option identifier 1800 * @opt: option identifier
@@ -1804,8 +1806,8 @@ restart:
1804 * 1806 *
1805 * Returns 0 on success, errno otherwise 1807 * Returns 0 on success, errno otherwise
1806 */ 1808 */
1807static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, 1809static int tipc_setsockopt(struct socket *sock, int lvl, int opt,
1808 unsigned int ol) 1810 char __user *ov, unsigned int ol)
1809{ 1811{
1810 struct sock *sk = sock->sk; 1812 struct sock *sk = sock->sk;
1811 struct tipc_port *tport = tipc_sk_port(sk); 1813 struct tipc_port *tport = tipc_sk_port(sk);
@@ -1851,7 +1853,7 @@ static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov,
1851} 1853}
1852 1854
1853/** 1855/**
1854 * getsockopt - get socket option 1856 * tipc_getsockopt - get socket option
1855 * @sock: socket structure 1857 * @sock: socket structure
1856 * @lvl: option level 1858 * @lvl: option level
1857 * @opt: option identifier 1859 * @opt: option identifier
@@ -1863,8 +1865,8 @@ static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov,
1863 * 1865 *
1864 * Returns 0 on success, errno otherwise 1866 * Returns 0 on success, errno otherwise
1865 */ 1867 */
1866static int getsockopt(struct socket *sock, int lvl, int opt, char __user *ov, 1868static int tipc_getsockopt(struct socket *sock, int lvl, int opt,
1867 int __user *ol) 1869 char __user *ov, int __user *ol)
1868{ 1870{
1869 struct sock *sk = sock->sk; 1871 struct sock *sk = sock->sk;
1870 struct tipc_port *tport = tipc_sk_port(sk); 1872 struct tipc_port *tport = tipc_sk_port(sk);
@@ -1925,20 +1927,20 @@ static int getsockopt(struct socket *sock, int lvl, int opt, char __user *ov,
1925static const struct proto_ops msg_ops = { 1927static const struct proto_ops msg_ops = {
1926 .owner = THIS_MODULE, 1928 .owner = THIS_MODULE,
1927 .family = AF_TIPC, 1929 .family = AF_TIPC,
1928 .release = release, 1930 .release = tipc_release,
1929 .bind = bind, 1931 .bind = tipc_bind,
1930 .connect = connect, 1932 .connect = tipc_connect,
1931 .socketpair = sock_no_socketpair, 1933 .socketpair = sock_no_socketpair,
1932 .accept = sock_no_accept, 1934 .accept = sock_no_accept,
1933 .getname = get_name, 1935 .getname = tipc_getname,
1934 .poll = poll, 1936 .poll = tipc_poll,
1935 .ioctl = sock_no_ioctl, 1937 .ioctl = sock_no_ioctl,
1936 .listen = sock_no_listen, 1938 .listen = sock_no_listen,
1937 .shutdown = shutdown, 1939 .shutdown = tipc_shutdown,
1938 .setsockopt = setsockopt, 1940 .setsockopt = tipc_setsockopt,
1939 .getsockopt = getsockopt, 1941 .getsockopt = tipc_getsockopt,
1940 .sendmsg = send_msg, 1942 .sendmsg = tipc_sendmsg,
1941 .recvmsg = recv_msg, 1943 .recvmsg = tipc_recvmsg,
1942 .mmap = sock_no_mmap, 1944 .mmap = sock_no_mmap,
1943 .sendpage = sock_no_sendpage 1945 .sendpage = sock_no_sendpage
1944}; 1946};
@@ -1946,20 +1948,20 @@ static const struct proto_ops msg_ops = {
1946static const struct proto_ops packet_ops = { 1948static const struct proto_ops packet_ops = {
1947 .owner = THIS_MODULE, 1949 .owner = THIS_MODULE,
1948 .family = AF_TIPC, 1950 .family = AF_TIPC,
1949 .release = release, 1951 .release = tipc_release,
1950 .bind = bind, 1952 .bind = tipc_bind,
1951 .connect = connect, 1953 .connect = tipc_connect,
1952 .socketpair = sock_no_socketpair, 1954 .socketpair = sock_no_socketpair,
1953 .accept = accept, 1955 .accept = tipc_accept,
1954 .getname = get_name, 1956 .getname = tipc_getname,
1955 .poll = poll, 1957 .poll = tipc_poll,
1956 .ioctl = sock_no_ioctl, 1958 .ioctl = sock_no_ioctl,
1957 .listen = listen, 1959 .listen = tipc_listen,
1958 .shutdown = shutdown, 1960 .shutdown = tipc_shutdown,
1959 .setsockopt = setsockopt, 1961 .setsockopt = tipc_setsockopt,
1960 .getsockopt = getsockopt, 1962 .getsockopt = tipc_getsockopt,
1961 .sendmsg = send_packet, 1963 .sendmsg = tipc_send_packet,
1962 .recvmsg = recv_msg, 1964 .recvmsg = tipc_recvmsg,
1963 .mmap = sock_no_mmap, 1965 .mmap = sock_no_mmap,
1964 .sendpage = sock_no_sendpage 1966 .sendpage = sock_no_sendpage
1965}; 1967};
@@ -1967,20 +1969,20 @@ static const struct proto_ops packet_ops = {
1967static const struct proto_ops stream_ops = { 1969static const struct proto_ops stream_ops = {
1968 .owner = THIS_MODULE, 1970 .owner = THIS_MODULE,
1969 .family = AF_TIPC, 1971 .family = AF_TIPC,
1970 .release = release, 1972 .release = tipc_release,
1971 .bind = bind, 1973 .bind = tipc_bind,
1972 .connect = connect, 1974 .connect = tipc_connect,
1973 .socketpair = sock_no_socketpair, 1975 .socketpair = sock_no_socketpair,
1974 .accept = accept, 1976 .accept = tipc_accept,
1975 .getname = get_name, 1977 .getname = tipc_getname,
1976 .poll = poll, 1978 .poll = tipc_poll,
1977 .ioctl = sock_no_ioctl, 1979 .ioctl = sock_no_ioctl,
1978 .listen = listen, 1980 .listen = tipc_listen,
1979 .shutdown = shutdown, 1981 .shutdown = tipc_shutdown,
1980 .setsockopt = setsockopt, 1982 .setsockopt = tipc_setsockopt,
1981 .getsockopt = getsockopt, 1983 .getsockopt = tipc_getsockopt,
1982 .sendmsg = send_stream, 1984 .sendmsg = tipc_send_stream,
1983 .recvmsg = recv_stream, 1985 .recvmsg = tipc_recv_stream,
1984 .mmap = sock_no_mmap, 1986 .mmap = sock_no_mmap,
1985 .sendpage = sock_no_sendpage 1987 .sendpage = sock_no_sendpage
1986}; 1988};