aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/port.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r--net/tipc/port.c226
1 files changed, 113 insertions, 113 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c
index b7f3199523ca..5f8217d4b452 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/port.c: TIPC port code 2 * net/tipc/port.c: TIPC port code
3 * 3 *
4 * Copyright (c) 1992-2006, Ericsson AB 4 * Copyright (c) 1992-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -126,8 +126,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
126 126
127 ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper, 127 ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper,
128 TIPC_NODE_SCOPE, &dports); 128 TIPC_NODE_SCOPE, &dports);
129 129
130 /* Send message to destinations (duplicate it only if necessary) */ 130 /* Send message to destinations (duplicate it only if necessary) */
131 131
132 if (ext_targets) { 132 if (ext_targets) {
133 if (dports.count != 0) { 133 if (dports.count != 0) {
@@ -157,7 +157,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
157 157
158/** 158/**
159 * tipc_port_recv_mcast - deliver multicast message to all destination ports 159 * tipc_port_recv_mcast - deliver multicast message to all destination ports
160 * 160 *
161 * If there is no port list, perform a lookup to create one 161 * If there is no port list, perform a lookup to create one
162 */ 162 */
163 163
@@ -213,7 +213,7 @@ exit:
213 213
214/** 214/**
215 * tipc_createport_raw - create a native TIPC port 215 * tipc_createport_raw - create a native TIPC port
216 * 216 *
217 * Returns local port reference 217 * Returns local port reference
218 */ 218 */
219 219
@@ -273,7 +273,7 @@ int tipc_deleteport(u32 ref)
273 273
274 tipc_withdraw(ref, 0, NULL); 274 tipc_withdraw(ref, 0, NULL);
275 p_ptr = tipc_port_lock(ref); 275 p_ptr = tipc_port_lock(ref);
276 if (!p_ptr) 276 if (!p_ptr)
277 return -EINVAL; 277 return -EINVAL;
278 278
279 tipc_ref_discard(ref); 279 tipc_ref_discard(ref);
@@ -302,7 +302,7 @@ int tipc_deleteport(u32 ref)
302 302
303/** 303/**
304 * tipc_get_port() - return port associated with 'ref' 304 * tipc_get_port() - return port associated with 'ref'
305 * 305 *
306 * Note: Port is not locked. 306 * Note: Port is not locked.
307 */ 307 */
308 308
@@ -336,7 +336,7 @@ static int port_unreliable(struct port *p_ptr)
336int tipc_portunreliable(u32 ref, unsigned int *isunreliable) 336int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
337{ 337{
338 struct port *p_ptr; 338 struct port *p_ptr;
339 339
340 p_ptr = tipc_port_lock(ref); 340 p_ptr = tipc_port_lock(ref);
341 if (!p_ptr) 341 if (!p_ptr)
342 return -EINVAL; 342 return -EINVAL;
@@ -348,7 +348,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
348int tipc_set_portunreliable(u32 ref, unsigned int isunreliable) 348int tipc_set_portunreliable(u32 ref, unsigned int isunreliable)
349{ 349{
350 struct port *p_ptr; 350 struct port *p_ptr;
351 351
352 p_ptr = tipc_port_lock(ref); 352 p_ptr = tipc_port_lock(ref);
353 if (!p_ptr) 353 if (!p_ptr)
354 return -EINVAL; 354 return -EINVAL;
@@ -365,7 +365,7 @@ static int port_unreturnable(struct port *p_ptr)
365int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) 365int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable)
366{ 366{
367 struct port *p_ptr; 367 struct port *p_ptr;
368 368
369 p_ptr = tipc_port_lock(ref); 369 p_ptr = tipc_port_lock(ref);
370 if (!p_ptr) 370 if (!p_ptr)
371 return -EINVAL; 371 return -EINVAL;
@@ -377,7 +377,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable)
377int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) 377int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
378{ 378{
379 struct port *p_ptr; 379 struct port *p_ptr;
380 380
381 p_ptr = tipc_port_lock(ref); 381 p_ptr = tipc_port_lock(ref);
382 if (!p_ptr) 382 if (!p_ptr)
383 return -EINVAL; 383 return -EINVAL;
@@ -386,19 +386,19 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
386 return TIPC_OK; 386 return TIPC_OK;
387} 387}
388 388
389/* 389/*
390 * port_build_proto_msg(): build a port level protocol 390 * port_build_proto_msg(): build a port level protocol
391 * or a connection abortion message. Called with 391 * or a connection abortion message. Called with
392 * tipc_port lock on. 392 * tipc_port lock on.
393 */ 393 */
394static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode, 394static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
395 u32 origport, u32 orignode, 395 u32 origport, u32 orignode,
396 u32 usr, u32 type, u32 err, 396 u32 usr, u32 type, u32 err,
397 u32 seqno, u32 ack) 397 u32 seqno, u32 ack)
398{ 398{
399 struct sk_buff *buf; 399 struct sk_buff *buf;
400 struct tipc_msg *msg; 400 struct tipc_msg *msg;
401 401
402 buf = buf_acquire(LONG_H_SIZE); 402 buf = buf_acquire(LONG_H_SIZE);
403 if (buf) { 403 if (buf) {
404 msg = buf_msg(buf); 404 msg = buf_msg(buf);
@@ -461,7 +461,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
461 msg_set_orignode(rmsg, tipc_own_addr); 461 msg_set_orignode(rmsg, tipc_own_addr);
462 else 462 else
463 msg_set_orignode(rmsg, msg_destnode(msg)); 463 msg_set_orignode(rmsg, msg_destnode(msg));
464 msg_set_size(rmsg, data_sz + hdr_sz); 464 msg_set_size(rmsg, data_sz + hdr_sz);
465 msg_set_nametype(rmsg, msg_nametype(msg)); 465 msg_set_nametype(rmsg, msg_nametype(msg));
466 msg_set_nameinst(rmsg, msg_nameinst(msg)); 466 msg_set_nameinst(rmsg, msg_nameinst(msg));
467 memcpy(rbuf->data + hdr_sz, msg_data(msg), data_sz); 467 memcpy(rbuf->data + hdr_sz, msg_data(msg), data_sz);
@@ -492,7 +492,7 @@ int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
492 struct sk_buff *buf; 492 struct sk_buff *buf;
493 int res; 493 int res;
494 494
495 res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, 495 res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE,
496 !p_ptr->user_port, &buf); 496 !p_ptr->user_port, &buf);
497 if (!buf) 497 if (!buf)
498 return res; 498 return res;
@@ -523,7 +523,7 @@ static void port_timeout(unsigned long ref)
523 tipc_own_addr, 523 tipc_own_addr,
524 CONN_MANAGER, 524 CONN_MANAGER,
525 CONN_PROBE, 525 CONN_PROBE,
526 TIPC_OK, 526 TIPC_OK,
527 port_out_seqno(p_ptr), 527 port_out_seqno(p_ptr),
528 0); 528 0);
529 port_incr_out_seqno(p_ptr); 529 port_incr_out_seqno(p_ptr);
@@ -562,7 +562,7 @@ static struct sk_buff *port_build_self_abort_msg(struct port *p_ptr, u32 err)
562 port_peernode(p_ptr), 562 port_peernode(p_ptr),
563 imp, 563 imp,
564 TIPC_CONN_MSG, 564 TIPC_CONN_MSG,
565 err, 565 err,
566 p_ptr->last_in_seqno + 1, 566 p_ptr->last_in_seqno + 1,
567 0); 567 0);
568} 568}
@@ -582,7 +582,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err)
582 tipc_own_addr, 582 tipc_own_addr,
583 imp, 583 imp,
584 TIPC_CONN_MSG, 584 TIPC_CONN_MSG,
585 err, 585 err,
586 port_out_seqno(p_ptr), 586 port_out_seqno(p_ptr),
587 0); 587 0);
588} 588}
@@ -613,7 +613,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
613 } 613 }
614 } 614 }
615 if (msg_type(msg) == CONN_ACK) { 615 if (msg_type(msg) == CONN_ACK) {
616 int wakeup = tipc_port_congested(p_ptr) && 616 int wakeup = tipc_port_congested(p_ptr) &&
617 p_ptr->publ.congested && 617 p_ptr->publ.congested &&
618 p_ptr->wakeup; 618 p_ptr->wakeup;
619 p_ptr->acked += msg_msgcnt(msg); 619 p_ptr->acked += msg_msgcnt(msg);
@@ -630,8 +630,8 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
630 } 630 }
631 if (err) { 631 if (err) {
632 r_buf = port_build_proto_msg(msg_origport(msg), 632 r_buf = port_build_proto_msg(msg_origport(msg),
633 msg_orignode(msg), 633 msg_orignode(msg),
634 msg_destport(msg), 634 msg_destport(msg),
635 tipc_own_addr, 635 tipc_own_addr,
636 DATA_HIGH, 636 DATA_HIGH,
637 TIPC_CONN_MSG, 637 TIPC_CONN_MSG,
@@ -643,10 +643,10 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
643 643
644 /* All is fine */ 644 /* All is fine */
645 if (msg_type(msg) == CONN_PROBE) { 645 if (msg_type(msg) == CONN_PROBE) {
646 r_buf = port_build_proto_msg(msg_origport(msg), 646 r_buf = port_build_proto_msg(msg_origport(msg),
647 msg_orignode(msg), 647 msg_orignode(msg),
648 msg_destport(msg), 648 msg_destport(msg),
649 tipc_own_addr, 649 tipc_own_addr,
650 CONN_MANAGER, 650 CONN_MANAGER,
651 CONN_PROBE_REPLY, 651 CONN_PROBE_REPLY,
652 TIPC_OK, 652 TIPC_OK,
@@ -665,39 +665,39 @@ exit:
665 665
666static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id) 666static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id)
667{ 667{
668 struct publication *publ; 668 struct publication *publ;
669 669
670 if (full_id) 670 if (full_id)
671 tipc_printf(buf, "<%u.%u.%u:%u>:", 671 tipc_printf(buf, "<%u.%u.%u:%u>:",
672 tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), 672 tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr),
673 tipc_node(tipc_own_addr), p_ptr->publ.ref); 673 tipc_node(tipc_own_addr), p_ptr->publ.ref);
674 else 674 else
675 tipc_printf(buf, "%-10u:", p_ptr->publ.ref); 675 tipc_printf(buf, "%-10u:", p_ptr->publ.ref);
676 676
677 if (p_ptr->publ.connected) { 677 if (p_ptr->publ.connected) {
678 u32 dport = port_peerport(p_ptr); 678 u32 dport = port_peerport(p_ptr);
679 u32 destnode = port_peernode(p_ptr); 679 u32 destnode = port_peernode(p_ptr);
680 680
681 tipc_printf(buf, " connected to <%u.%u.%u:%u>", 681 tipc_printf(buf, " connected to <%u.%u.%u:%u>",
682 tipc_zone(destnode), tipc_cluster(destnode), 682 tipc_zone(destnode), tipc_cluster(destnode),
683 tipc_node(destnode), dport); 683 tipc_node(destnode), dport);
684 if (p_ptr->publ.conn_type != 0) 684 if (p_ptr->publ.conn_type != 0)
685 tipc_printf(buf, " via {%u,%u}", 685 tipc_printf(buf, " via {%u,%u}",
686 p_ptr->publ.conn_type, 686 p_ptr->publ.conn_type,
687 p_ptr->publ.conn_instance); 687 p_ptr->publ.conn_instance);
688 } 688 }
689 else if (p_ptr->publ.published) { 689 else if (p_ptr->publ.published) {
690 tipc_printf(buf, " bound to"); 690 tipc_printf(buf, " bound to");
691 list_for_each_entry(publ, &p_ptr->publications, pport_list) { 691 list_for_each_entry(publ, &p_ptr->publications, pport_list) {
692 if (publ->lower == publ->upper) 692 if (publ->lower == publ->upper)
693 tipc_printf(buf, " {%u,%u}", publ->type, 693 tipc_printf(buf, " {%u,%u}", publ->type,
694 publ->lower); 694 publ->lower);
695 else 695 else
696 tipc_printf(buf, " {%u,%u,%u}", publ->type, 696 tipc_printf(buf, " {%u,%u,%u}", publ->type,
697 publ->lower, publ->upper); 697 publ->lower, publ->upper);
698 } 698 }
699 } 699 }
700 tipc_printf(buf, "\n"); 700 tipc_printf(buf, "\n");
701} 701}
702 702
703#define MAX_PORT_QUERY 32768 703#define MAX_PORT_QUERY 32768
@@ -818,7 +818,7 @@ static void port_dispatcher_sigh(void *dummy)
818 struct sk_buff *next = buf->next; 818 struct sk_buff *next = buf->next;
819 struct tipc_msg *msg = buf_msg(buf); 819 struct tipc_msg *msg = buf_msg(buf);
820 u32 dref = msg_destport(msg); 820 u32 dref = msg_destport(msg);
821 821
822 message_type = msg_type(msg); 822 message_type = msg_type(msg);
823 if (message_type > TIPC_DIRECT_MSG) 823 if (message_type > TIPC_DIRECT_MSG)
824 goto reject; /* Unsupported message type */ 824 goto reject; /* Unsupported message type */
@@ -838,7 +838,7 @@ static void port_dispatcher_sigh(void *dummy)
838 goto err; 838 goto err;
839 839
840 switch (message_type) { 840 switch (message_type) {
841 841
842 case TIPC_CONN_MSG:{ 842 case TIPC_CONN_MSG:{
843 tipc_conn_msg_event cb = up_ptr->conn_msg_cb; 843 tipc_conn_msg_event cb = up_ptr->conn_msg_cb;
844 u32 peer_port = port_peerport(p_ptr); 844 u32 peer_port = port_peerport(p_ptr);
@@ -856,9 +856,9 @@ static void port_dispatcher_sigh(void *dummy)
856 goto reject; 856 goto reject;
857 if (unlikely(!cb)) 857 if (unlikely(!cb))
858 goto reject; 858 goto reject;
859 if (unlikely(++p_ptr->publ.conn_unacked >= 859 if (unlikely(++p_ptr->publ.conn_unacked >=
860 TIPC_FLOW_CONTROL_WIN)) 860 TIPC_FLOW_CONTROL_WIN))
861 tipc_acknowledge(dref, 861 tipc_acknowledge(dref,
862 p_ptr->publ.conn_unacked); 862 p_ptr->publ.conn_unacked);
863 skb_pull(buf, msg_hdr_sz(msg)); 863 skb_pull(buf, msg_hdr_sz(msg));
864 cb(usr_handle, dref, &buf, msg_data(msg), 864 cb(usr_handle, dref, &buf, msg_data(msg),
@@ -874,7 +874,7 @@ static void port_dispatcher_sigh(void *dummy)
874 if (unlikely(!cb)) 874 if (unlikely(!cb))
875 goto reject; 875 goto reject;
876 skb_pull(buf, msg_hdr_sz(msg)); 876 skb_pull(buf, msg_hdr_sz(msg));
877 cb(usr_handle, dref, &buf, msg_data(msg), 877 cb(usr_handle, dref, &buf, msg_data(msg),
878 msg_data_sz(msg), msg_importance(msg), 878 msg_data_sz(msg), msg_importance(msg),
879 &orig); 879 &orig);
880 break; 880 break;
@@ -895,7 +895,7 @@ static void port_dispatcher_sigh(void *dummy)
895 dseq.upper = (message_type == TIPC_NAMED_MSG) 895 dseq.upper = (message_type == TIPC_NAMED_MSG)
896 ? dseq.lower : msg_nameupper(msg); 896 ? dseq.lower : msg_nameupper(msg);
897 skb_pull(buf, msg_hdr_sz(msg)); 897 skb_pull(buf, msg_hdr_sz(msg));
898 cb(usr_handle, dref, &buf, msg_data(msg), 898 cb(usr_handle, dref, &buf, msg_data(msg),
899 msg_data_sz(msg), msg_importance(msg), 899 msg_data_sz(msg), msg_importance(msg),
900 &orig, &dseq); 900 &orig, &dseq);
901 break; 901 break;
@@ -907,9 +907,9 @@ static void port_dispatcher_sigh(void *dummy)
907 continue; 907 continue;
908err: 908err:
909 switch (message_type) { 909 switch (message_type) {
910 910
911 case TIPC_CONN_MSG:{ 911 case TIPC_CONN_MSG:{
912 tipc_conn_shutdown_event cb = 912 tipc_conn_shutdown_event cb =
913 up_ptr->conn_err_cb; 913 up_ptr->conn_err_cb;
914 u32 peer_port = port_peerport(p_ptr); 914 u32 peer_port = port_peerport(p_ptr);
915 u32 peer_node = port_peernode(p_ptr); 915 u32 peer_node = port_peernode(p_ptr);
@@ -940,7 +940,7 @@ err:
940 } 940 }
941 case TIPC_MCAST_MSG: 941 case TIPC_MCAST_MSG:
942 case TIPC_NAMED_MSG:{ 942 case TIPC_NAMED_MSG:{
943 tipc_named_msg_err_event cb = 943 tipc_named_msg_err_event cb =
944 up_ptr->named_err_cb; 944 up_ptr->named_err_cb;
945 945
946 spin_unlock_bh(p_ptr->publ.lock); 946 spin_unlock_bh(p_ptr->publ.lock);
@@ -951,7 +951,7 @@ err:
951 dseq.upper = (message_type == TIPC_NAMED_MSG) 951 dseq.upper = (message_type == TIPC_NAMED_MSG)
952 ? dseq.lower : msg_nameupper(msg); 952 ? dseq.lower : msg_nameupper(msg);
953 skb_pull(buf, msg_hdr_sz(msg)); 953 skb_pull(buf, msg_hdr_sz(msg));
954 cb(usr_handle, dref, &buf, msg_data(msg), 954 cb(usr_handle, dref, &buf, msg_data(msg),
955 msg_data_sz(msg), msg_errcode(msg), &dseq); 955 msg_data_sz(msg), msg_errcode(msg), &dseq);
956 break; 956 break;
957 } 957 }
@@ -986,9 +986,9 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf)
986 return TIPC_OK; 986 return TIPC_OK;
987} 987}
988 988
989/* 989/*
990 * Wake up port after congestion: Called with port locked, 990 * Wake up port after congestion: Called with port locked,
991 * 991 *
992 */ 992 */
993 993
994static void port_wakeup_sh(unsigned long ref) 994static void port_wakeup_sh(unsigned long ref)
@@ -1033,7 +1033,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
1033 tipc_own_addr, 1033 tipc_own_addr,
1034 CONN_MANAGER, 1034 CONN_MANAGER,
1035 CONN_ACK, 1035 CONN_ACK,
1036 TIPC_OK, 1036 TIPC_OK,
1037 port_out_seqno(p_ptr), 1037 port_out_seqno(p_ptr),
1038 ack); 1038 ack);
1039 } 1039 }
@@ -1046,20 +1046,20 @@ void tipc_acknowledge(u32 ref, u32 ack)
1046 * registry if non-zero user_ref. 1046 * registry if non-zero user_ref.
1047 */ 1047 */
1048 1048
1049int tipc_createport(u32 user_ref, 1049int tipc_createport(u32 user_ref,
1050 void *usr_handle, 1050 void *usr_handle,
1051 unsigned int importance, 1051 unsigned int importance,
1052 tipc_msg_err_event error_cb, 1052 tipc_msg_err_event error_cb,
1053 tipc_named_msg_err_event named_error_cb, 1053 tipc_named_msg_err_event named_error_cb,
1054 tipc_conn_shutdown_event conn_error_cb, 1054 tipc_conn_shutdown_event conn_error_cb,
1055 tipc_msg_event msg_cb, 1055 tipc_msg_event msg_cb,
1056 tipc_named_msg_event named_msg_cb, 1056 tipc_named_msg_event named_msg_cb,
1057 tipc_conn_msg_event conn_msg_cb, 1057 tipc_conn_msg_event conn_msg_cb,
1058 tipc_continue_event continue_event_cb,/* May be zero */ 1058 tipc_continue_event continue_event_cb,/* May be zero */
1059 u32 *portref) 1059 u32 *portref)
1060{ 1060{
1061 struct user_port *up_ptr; 1061 struct user_port *up_ptr;
1062 struct port *p_ptr; 1062 struct port *p_ptr;
1063 u32 ref; 1063 u32 ref;
1064 1064
1065 up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC); 1065 up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
@@ -1088,7 +1088,7 @@ int tipc_createport(u32 user_ref,
1088 INIT_LIST_HEAD(&up_ptr->uport_list); 1088 INIT_LIST_HEAD(&up_ptr->uport_list);
1089 tipc_reg_add_port(up_ptr); 1089 tipc_reg_add_port(up_ptr);
1090 *portref = p_ptr->publ.ref; 1090 *portref = p_ptr->publ.ref;
1091 dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref); 1091 dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref);
1092 tipc_port_unlock(p_ptr); 1092 tipc_port_unlock(p_ptr);
1093 return TIPC_OK; 1093 return TIPC_OK;
1094} 1094}
@@ -1103,7 +1103,7 @@ int tipc_ownidentity(u32 ref, struct tipc_portid *id)
1103int tipc_portimportance(u32 ref, unsigned int *importance) 1103int tipc_portimportance(u32 ref, unsigned int *importance)
1104{ 1104{
1105 struct port *p_ptr; 1105 struct port *p_ptr;
1106 1106
1107 p_ptr = tipc_port_lock(ref); 1107 p_ptr = tipc_port_lock(ref);
1108 if (!p_ptr) 1108 if (!p_ptr)
1109 return -EINVAL; 1109 return -EINVAL;
@@ -1172,19 +1172,19 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1172 struct publication *publ; 1172 struct publication *publ;
1173 struct publication *tpubl; 1173 struct publication *tpubl;
1174 int res = -EINVAL; 1174 int res = -EINVAL;
1175 1175
1176 p_ptr = tipc_port_lock(ref); 1176 p_ptr = tipc_port_lock(ref);
1177 if (!p_ptr) 1177 if (!p_ptr)
1178 return -EINVAL; 1178 return -EINVAL;
1179 if (!seq) { 1179 if (!seq) {
1180 list_for_each_entry_safe(publ, tpubl, 1180 list_for_each_entry_safe(publ, tpubl,
1181 &p_ptr->publications, pport_list) { 1181 &p_ptr->publications, pport_list) {
1182 tipc_nametbl_withdraw(publ->type, publ->lower, 1182 tipc_nametbl_withdraw(publ->type, publ->lower,
1183 publ->ref, publ->key); 1183 publ->ref, publ->key);
1184 } 1184 }
1185 res = TIPC_OK; 1185 res = TIPC_OK;
1186 } else { 1186 } else {
1187 list_for_each_entry_safe(publ, tpubl, 1187 list_for_each_entry_safe(publ, tpubl,
1188 &p_ptr->publications, pport_list) { 1188 &p_ptr->publications, pport_list) {
1189 if (publ->scope != scope) 1189 if (publ->scope != scope)
1190 continue; 1190 continue;
@@ -1194,7 +1194,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1194 continue; 1194 continue;
1195 if (publ->upper != seq->upper) 1195 if (publ->upper != seq->upper)
1196 break; 1196 break;
1197 tipc_nametbl_withdraw(publ->type, publ->lower, 1197 tipc_nametbl_withdraw(publ->type, publ->lower,
1198 publ->ref, publ->key); 1198 publ->ref, publ->key);
1199 res = TIPC_OK; 1199 res = TIPC_OK;
1200 break; 1200 break;
@@ -1292,7 +1292,7 @@ int tipc_shutdown(u32 ref)
1292 tipc_own_addr, 1292 tipc_own_addr,
1293 imp, 1293 imp,
1294 TIPC_CONN_MSG, 1294 TIPC_CONN_MSG,
1295 TIPC_CONN_SHUTDOWN, 1295 TIPC_CONN_SHUTDOWN,
1296 port_out_seqno(p_ptr), 1296 port_out_seqno(p_ptr),
1297 0); 1297 0);
1298 } 1298 }
@@ -1304,7 +1304,7 @@ int tipc_shutdown(u32 ref)
1304int tipc_isconnected(u32 ref, int *isconnected) 1304int tipc_isconnected(u32 ref, int *isconnected)
1305{ 1305{
1306 struct port *p_ptr; 1306 struct port *p_ptr;
1307 1307
1308 p_ptr = tipc_port_lock(ref); 1308 p_ptr = tipc_port_lock(ref);
1309 if (!p_ptr) 1309 if (!p_ptr)
1310 return -EINVAL; 1310 return -EINVAL;
@@ -1317,7 +1317,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer)
1317{ 1317{
1318 struct port *p_ptr; 1318 struct port *p_ptr;
1319 int res; 1319 int res;
1320 1320
1321 p_ptr = tipc_port_lock(ref); 1321 p_ptr = tipc_port_lock(ref);
1322 if (!p_ptr) 1322 if (!p_ptr)
1323 return -EINVAL; 1323 return -EINVAL;
@@ -1348,7 +1348,7 @@ int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
1348{ 1348{
1349 struct sk_buff *buf; 1349 struct sk_buff *buf;
1350 int res; 1350 int res;
1351 1351
1352 res = msg_build(&sender->publ.phdr, msg_sect, num_sect, 1352 res = msg_build(&sender->publ.phdr, msg_sect, num_sect,
1353 MAX_MSG_SIZE, !sender->user_port, &buf); 1353 MAX_MSG_SIZE, !sender->user_port, &buf);
1354 if (likely(buf)) 1354 if (likely(buf))
@@ -1394,7 +1394,7 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
1394 return -ELINKCONG; 1394 return -ELINKCONG;
1395} 1395}
1396 1396
1397/** 1397/**
1398 * tipc_send_buf - send message buffer on connection 1398 * tipc_send_buf - send message buffer on connection
1399 */ 1399 */
1400 1400
@@ -1406,7 +1406,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
1406 u32 hsz; 1406 u32 hsz;
1407 u32 sz; 1407 u32 sz;
1408 u32 res; 1408 u32 res;
1409 1409
1410 p_ptr = tipc_port_deref(ref); 1410 p_ptr = tipc_port_deref(ref);
1411 if (!p_ptr || !p_ptr->publ.connected) 1411 if (!p_ptr || !p_ptr->publ.connected)
1412 return -EINVAL; 1412 return -EINVAL;
@@ -1447,12 +1447,12 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
1447 * tipc_forward2name - forward message sections to port name 1447 * tipc_forward2name - forward message sections to port name
1448 */ 1448 */
1449 1449
1450int tipc_forward2name(u32 ref, 1450int tipc_forward2name(u32 ref,
1451 struct tipc_name const *name, 1451 struct tipc_name const *name,
1452 u32 domain, 1452 u32 domain,
1453 u32 num_sect, 1453 u32 num_sect,
1454 struct iovec const *msg_sect, 1454 struct iovec const *msg_sect,
1455 struct tipc_portid const *orig, 1455 struct tipc_portid const *orig,
1456 unsigned int importance) 1456 unsigned int importance)
1457{ 1457{
1458 struct port *p_ptr; 1458 struct port *p_ptr;
@@ -1483,7 +1483,7 @@ int tipc_forward2name(u32 ref,
1483 p_ptr->sent++; 1483 p_ptr->sent++;
1484 if (likely(destnode == tipc_own_addr)) 1484 if (likely(destnode == tipc_own_addr))
1485 return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); 1485 return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
1486 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, 1486 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
1487 destnode); 1487 destnode);
1488 if (likely(res != -ELINKCONG)) 1488 if (likely(res != -ELINKCONG))
1489 return res; 1489 return res;
@@ -1493,7 +1493,7 @@ int tipc_forward2name(u32 ref,
1493 } 1493 }
1494 return -ELINKCONG; 1494 return -ELINKCONG;
1495 } 1495 }
1496 return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect, 1496 return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect,
1497 TIPC_ERR_NO_NAME); 1497 TIPC_ERR_NO_NAME);
1498} 1498}
1499 1499
@@ -1501,10 +1501,10 @@ int tipc_forward2name(u32 ref,
1501 * tipc_send2name - send message sections to port name 1501 * tipc_send2name - send message sections to port name
1502 */ 1502 */
1503 1503
1504int tipc_send2name(u32 ref, 1504int tipc_send2name(u32 ref,
1505 struct tipc_name const *name, 1505 struct tipc_name const *name,
1506 unsigned int domain, 1506 unsigned int domain,
1507 unsigned int num_sect, 1507 unsigned int num_sect,
1508 struct iovec const *msg_sect) 1508 struct iovec const *msg_sect)
1509{ 1509{
1510 struct tipc_portid orig; 1510 struct tipc_portid orig;
@@ -1515,7 +1515,7 @@ int tipc_send2name(u32 ref,
1515 TIPC_PORT_IMPORTANCE); 1515 TIPC_PORT_IMPORTANCE);
1516} 1516}
1517 1517
1518/** 1518/**
1519 * tipc_forward_buf2name - forward message buffer to port name 1519 * tipc_forward_buf2name - forward message buffer to port name
1520 */ 1520 */
1521 1521
@@ -1571,14 +1571,14 @@ int tipc_forward_buf2name(u32 ref,
1571 return tipc_reject_msg(buf, TIPC_ERR_NO_NAME); 1571 return tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
1572} 1572}
1573 1573
1574/** 1574/**
1575 * tipc_send_buf2name - send message buffer to port name 1575 * tipc_send_buf2name - send message buffer to port name
1576 */ 1576 */
1577 1577
1578int tipc_send_buf2name(u32 ref, 1578int tipc_send_buf2name(u32 ref,
1579 struct tipc_name const *dest, 1579 struct tipc_name const *dest,
1580 u32 domain, 1580 u32 domain,
1581 struct sk_buff *buf, 1581 struct sk_buff *buf,
1582 unsigned int dsz) 1582 unsigned int dsz)
1583{ 1583{
1584 struct tipc_portid orig; 1584 struct tipc_portid orig;
@@ -1589,15 +1589,15 @@ int tipc_send_buf2name(u32 ref,
1589 TIPC_PORT_IMPORTANCE); 1589 TIPC_PORT_IMPORTANCE);
1590} 1590}
1591 1591
1592/** 1592/**
1593 * tipc_forward2port - forward message sections to port identity 1593 * tipc_forward2port - forward message sections to port identity
1594 */ 1594 */
1595 1595
1596int tipc_forward2port(u32 ref, 1596int tipc_forward2port(u32 ref,
1597 struct tipc_portid const *dest, 1597 struct tipc_portid const *dest,
1598 unsigned int num_sect, 1598 unsigned int num_sect,
1599 struct iovec const *msg_sect, 1599 struct iovec const *msg_sect,
1600 struct tipc_portid const *orig, 1600 struct tipc_portid const *orig,
1601 unsigned int importance) 1601 unsigned int importance)
1602{ 1602{
1603 struct port *p_ptr; 1603 struct port *p_ptr;
@@ -1630,24 +1630,24 @@ int tipc_forward2port(u32 ref,
1630 return -ELINKCONG; 1630 return -ELINKCONG;
1631} 1631}
1632 1632
1633/** 1633/**
1634 * tipc_send2port - send message sections to port identity 1634 * tipc_send2port - send message sections to port identity
1635 */ 1635 */
1636 1636
1637int tipc_send2port(u32 ref, 1637int tipc_send2port(u32 ref,
1638 struct tipc_portid const *dest, 1638 struct tipc_portid const *dest,
1639 unsigned int num_sect, 1639 unsigned int num_sect,
1640 struct iovec const *msg_sect) 1640 struct iovec const *msg_sect)
1641{ 1641{
1642 struct tipc_portid orig; 1642 struct tipc_portid orig;
1643 1643
1644 orig.ref = ref; 1644 orig.ref = ref;
1645 orig.node = tipc_own_addr; 1645 orig.node = tipc_own_addr;
1646 return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, 1646 return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig,
1647 TIPC_PORT_IMPORTANCE); 1647 TIPC_PORT_IMPORTANCE);
1648} 1648}
1649 1649
1650/** 1650/**
1651 * tipc_forward_buf2port - forward message buffer to port identity 1651 * tipc_forward_buf2port - forward message buffer to port identity
1652 */ 1652 */
1653int tipc_forward_buf2port(u32 ref, 1653int tipc_forward_buf2port(u32 ref,
@@ -1692,20 +1692,20 @@ int tipc_forward_buf2port(u32 ref,
1692 return -ELINKCONG; 1692 return -ELINKCONG;
1693} 1693}
1694 1694
1695/** 1695/**
1696 * tipc_send_buf2port - send message buffer to port identity 1696 * tipc_send_buf2port - send message buffer to port identity
1697 */ 1697 */
1698 1698
1699int tipc_send_buf2port(u32 ref, 1699int tipc_send_buf2port(u32 ref,
1700 struct tipc_portid const *dest, 1700 struct tipc_portid const *dest,
1701 struct sk_buff *buf, 1701 struct sk_buff *buf,
1702 unsigned int dsz) 1702 unsigned int dsz)
1703{ 1703{
1704 struct tipc_portid orig; 1704 struct tipc_portid orig;
1705 1705
1706 orig.ref = ref; 1706 orig.ref = ref;
1707 orig.node = tipc_own_addr; 1707 orig.node = tipc_own_addr;
1708 return tipc_forward_buf2port(ref, dest, buf, dsz, &orig, 1708 return tipc_forward_buf2port(ref, dest, buf, dsz, &orig,
1709 TIPC_PORT_IMPORTANCE); 1709 TIPC_PORT_IMPORTANCE);
1710} 1710}
1711 1711