aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2012-04-30 15:29:02 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-04-30 15:53:56 -0400
commit617d3c7a50b3dc15f558d60013047aede79dc055 (patch)
tree03908b63390eae5046618595b29f9ff30aea667a /net/tipc/link.c
parentaad585473fe1e4b07f2ec1e2432475937f90c385 (diff)
tipc: compress out gratuitous extra carriage returns
Some of the comment blocks are floating in limbo between two functions, or between blocks of code. Delete the extra line feeds between any comment and its associated following block of code, to be consistent with the majority of the rest of the kernel. Also delete trailing newlines at EOF and fix a couple trivial typos in existing comments. This is a 100% cosmetic change with no runtime impact. We get rid of over 500 lines of non-code, and being blank line deletes, they won't even show up as noise in git blame. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c120
1 files changed, 5 insertions, 115 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 33cecd6fc37d..7a614f43549d 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -45,13 +45,11 @@
45/* 45/*
46 * Out-of-range value for link session numbers 46 * Out-of-range value for link session numbers
47 */ 47 */
48
49#define INVALID_SESSION 0x10000 48#define INVALID_SESSION 0x10000
50 49
51/* 50/*
52 * Link state events: 51 * Link state events:
53 */ 52 */
54
55#define STARTING_EVT 856384768 /* link processing trigger */ 53#define STARTING_EVT 856384768 /* link processing trigger */
56#define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */ 54#define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */
57#define TIMEOUT_EVT 560817u /* link timer expired */ 55#define TIMEOUT_EVT 560817u /* link timer expired */
@@ -67,7 +65,6 @@
67/* 65/*
68 * State value stored in 'exp_msg_count' 66 * State value stored in 'exp_msg_count'
69 */ 67 */
70
71#define START_CHANGEOVER 100000u 68#define START_CHANGEOVER 100000u
72 69
73/** 70/**
@@ -77,7 +74,6 @@
77 * @addr_peer: network address of node at far end 74 * @addr_peer: network address of node at far end
78 * @if_peer: name of interface at far end 75 * @if_peer: name of interface at far end
79 */ 76 */
80
81struct tipc_link_name { 77struct tipc_link_name {
82 u32 addr_local; 78 u32 addr_local;
83 char if_local[TIPC_MAX_IF_NAME]; 79 char if_local[TIPC_MAX_IF_NAME];
@@ -105,7 +101,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
105/* 101/*
106 * Simple link routines 102 * Simple link routines
107 */ 103 */
108
109static unsigned int align(unsigned int i) 104static unsigned int align(unsigned int i)
110{ 105{
111 return (i + 3) & ~3u; 106 return (i + 3) & ~3u;
@@ -143,7 +138,6 @@ static u32 link_last_sent(struct tipc_link *l_ptr)
143/* 138/*
144 * Simple non-static link routines (i.e. referenced outside this file) 139 * Simple non-static link routines (i.e. referenced outside this file)
145 */ 140 */
146
147int tipc_link_is_up(struct tipc_link *l_ptr) 141int tipc_link_is_up(struct tipc_link *l_ptr)
148{ 142{
149 if (!l_ptr) 143 if (!l_ptr)
@@ -164,7 +158,6 @@ int tipc_link_is_active(struct tipc_link *l_ptr)
164 * 158 *
165 * Returns 1 if link name is valid, otherwise 0. 159 * Returns 1 if link name is valid, otherwise 0.
166 */ 160 */
167
168static int link_name_validate(const char *name, 161static int link_name_validate(const char *name,
169 struct tipc_link_name *name_parts) 162 struct tipc_link_name *name_parts)
170{ 163{
@@ -180,7 +173,6 @@ static int link_name_validate(const char *name,
180 u32 if_peer_len; 173 u32 if_peer_len;
181 174
182 /* copy link name & ensure length is OK */ 175 /* copy link name & ensure length is OK */
183
184 name_copy[TIPC_MAX_LINK_NAME - 1] = 0; 176 name_copy[TIPC_MAX_LINK_NAME - 1] = 0;
185 /* need above in case non-Posix strncpy() doesn't pad with nulls */ 177 /* need above in case non-Posix strncpy() doesn't pad with nulls */
186 strncpy(name_copy, name, TIPC_MAX_LINK_NAME); 178 strncpy(name_copy, name, TIPC_MAX_LINK_NAME);
@@ -188,7 +180,6 @@ static int link_name_validate(const char *name,
188 return 0; 180 return 0;
189 181
190 /* ensure all component parts of link name are present */ 182 /* ensure all component parts of link name are present */
191
192 addr_local = name_copy; 183 addr_local = name_copy;
193 if_local = strchr(addr_local, ':'); 184 if_local = strchr(addr_local, ':');
194 if (if_local == NULL) 185 if (if_local == NULL)
@@ -206,7 +197,6 @@ static int link_name_validate(const char *name,
206 if_peer_len = strlen(if_peer) + 1; 197 if_peer_len = strlen(if_peer) + 1;
207 198
208 /* validate component parts of link name */ 199 /* validate component parts of link name */
209
210 if ((sscanf(addr_local, "%u.%u.%u%c", 200 if ((sscanf(addr_local, "%u.%u.%u%c",
211 &z_local, &c_local, &n_local, &dummy) != 3) || 201 &z_local, &c_local, &n_local, &dummy) != 3) ||
212 (sscanf(addr_peer, "%u.%u.%u%c", 202 (sscanf(addr_peer, "%u.%u.%u%c",
@@ -220,7 +210,6 @@ static int link_name_validate(const char *name,
220 return 0; 210 return 0;
221 211
222 /* return link name components, if necessary */ 212 /* return link name components, if necessary */
223
224 if (name_parts) { 213 if (name_parts) {
225 name_parts->addr_local = tipc_addr(z_local, c_local, n_local); 214 name_parts->addr_local = tipc_addr(z_local, c_local, n_local);
226 strcpy(name_parts->if_local, if_local); 215 strcpy(name_parts->if_local, if_local);
@@ -239,13 +228,11 @@ static int link_name_validate(const char *name,
239 * another thread because tipc_link_delete() always cancels the link timer before 228 * another thread because tipc_link_delete() always cancels the link timer before
240 * tipc_node_delete() is called.) 229 * tipc_node_delete() is called.)
241 */ 230 */
242
243static void link_timeout(struct tipc_link *l_ptr) 231static void link_timeout(struct tipc_link *l_ptr)
244{ 232{
245 tipc_node_lock(l_ptr->owner); 233 tipc_node_lock(l_ptr->owner);
246 234
247 /* update counters used in statistical profiling of send traffic */ 235 /* update counters used in statistical profiling of send traffic */
248
249 l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size; 236 l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size;
250 l_ptr->stats.queue_sz_counts++; 237 l_ptr->stats.queue_sz_counts++;
251 238
@@ -278,7 +265,6 @@ static void link_timeout(struct tipc_link *l_ptr)
278 } 265 }
279 266
280 /* do all other link processing performed on a periodic basis */ 267 /* do all other link processing performed on a periodic basis */
281
282 link_check_defragm_bufs(l_ptr); 268 link_check_defragm_bufs(l_ptr);
283 269
284 link_state_event(l_ptr, TIMEOUT_EVT); 270 link_state_event(l_ptr, TIMEOUT_EVT);
@@ -302,7 +288,6 @@ static void link_set_timer(struct tipc_link *l_ptr, u32 time)
302 * 288 *
303 * Returns pointer to link. 289 * Returns pointer to link.
304 */ 290 */
305
306struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, 291struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
307 struct tipc_bearer *b_ptr, 292 struct tipc_bearer *b_ptr,
308 const struct tipc_media_addr *media_addr) 293 const struct tipc_media_addr *media_addr)
@@ -383,7 +368,6 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
383 * This routine must not grab the node lock until after link timer cancellation 368 * This routine must not grab the node lock until after link timer cancellation
384 * to avoid a potential deadlock situation. 369 * to avoid a potential deadlock situation.
385 */ 370 */
386
387void tipc_link_delete(struct tipc_link *l_ptr) 371void tipc_link_delete(struct tipc_link *l_ptr)
388{ 372{
389 if (!l_ptr) { 373 if (!l_ptr) {
@@ -419,7 +403,6 @@ static void link_start(struct tipc_link *l_ptr)
419 * Schedules port for renewed sending of messages after link congestion 403 * Schedules port for renewed sending of messages after link congestion
420 * has abated. 404 * has abated.
421 */ 405 */
422
423static int link_schedule_port(struct tipc_link *l_ptr, u32 origport, u32 sz) 406static int link_schedule_port(struct tipc_link *l_ptr, u32 origport, u32 sz)
424{ 407{
425 struct tipc_port *p_ptr; 408 struct tipc_port *p_ptr;
@@ -476,7 +459,6 @@ exit:
476 * link_release_outqueue - purge link's outbound message queue 459 * link_release_outqueue - purge link's outbound message queue
477 * @l_ptr: pointer to link 460 * @l_ptr: pointer to link
478 */ 461 */
479
480static void link_release_outqueue(struct tipc_link *l_ptr) 462static void link_release_outqueue(struct tipc_link *l_ptr)
481{ 463{
482 struct sk_buff *buf = l_ptr->first_out; 464 struct sk_buff *buf = l_ptr->first_out;
@@ -495,7 +477,6 @@ static void link_release_outqueue(struct tipc_link *l_ptr)
495 * tipc_link_reset_fragments - purge link's inbound message fragments queue 477 * tipc_link_reset_fragments - purge link's inbound message fragments queue
496 * @l_ptr: pointer to link 478 * @l_ptr: pointer to link
497 */ 479 */
498
499void tipc_link_reset_fragments(struct tipc_link *l_ptr) 480void tipc_link_reset_fragments(struct tipc_link *l_ptr)
500{ 481{
501 struct sk_buff *buf = l_ptr->defragm_buf; 482 struct sk_buff *buf = l_ptr->defragm_buf;
@@ -513,7 +494,6 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr)
513 * tipc_link_stop - purge all inbound and outbound messages associated with link 494 * tipc_link_stop - purge all inbound and outbound messages associated with link
514 * @l_ptr: pointer to link 495 * @l_ptr: pointer to link
515 */ 496 */
516
517void tipc_link_stop(struct tipc_link *l_ptr) 497void tipc_link_stop(struct tipc_link *l_ptr)
518{ 498{
519 struct sk_buff *buf; 499 struct sk_buff *buf;
@@ -569,7 +549,6 @@ void tipc_link_reset(struct tipc_link *l_ptr)
569 } 549 }
570 550
571 /* Clean up all queues: */ 551 /* Clean up all queues: */
572
573 link_release_outqueue(l_ptr); 552 link_release_outqueue(l_ptr);
574 kfree_skb(l_ptr->proto_msg_queue); 553 kfree_skb(l_ptr->proto_msg_queue);
575 l_ptr->proto_msg_queue = NULL; 554 l_ptr->proto_msg_queue = NULL;
@@ -611,7 +590,6 @@ static void link_activate(struct tipc_link *l_ptr)
611 * @l_ptr: pointer to link 590 * @l_ptr: pointer to link
612 * @event: state machine event to process 591 * @event: state machine event to process
613 */ 592 */
614
615static void link_state_event(struct tipc_link *l_ptr, unsigned int event) 593static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
616{ 594{
617 struct tipc_link *other; 595 struct tipc_link *other;
@@ -785,7 +763,6 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
785 * link_bundle_buf(): Append contents of a buffer to 763 * link_bundle_buf(): Append contents of a buffer to
786 * the tail of an existing one. 764 * the tail of an existing one.
787 */ 765 */
788
789static int link_bundle_buf(struct tipc_link *l_ptr, 766static int link_bundle_buf(struct tipc_link *l_ptr,
790 struct sk_buff *bundler, 767 struct sk_buff *bundler,
791 struct sk_buff *buf) 768 struct sk_buff *buf)
@@ -860,7 +837,6 @@ static void link_add_chain_to_outqueue(struct tipc_link *l_ptr,
860 * inside TIPC when the 'fast path' in tipc_send_buf 837 * inside TIPC when the 'fast path' in tipc_send_buf
861 * has failed, and from link_send() 838 * has failed, and from link_send()
862 */ 839 */
863
864int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf) 840int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
865{ 841{
866 struct tipc_msg *msg = buf_msg(buf); 842 struct tipc_msg *msg = buf_msg(buf);
@@ -872,7 +848,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
872 u32 max_packet = l_ptr->max_pkt; 848 u32 max_packet = l_ptr->max_pkt;
873 849
874 /* Match msg importance against queue limits: */ 850 /* Match msg importance against queue limits: */
875
876 if (unlikely(queue_size >= queue_limit)) { 851 if (unlikely(queue_size >= queue_limit)) {
877 if (imp <= TIPC_CRITICAL_IMPORTANCE) { 852 if (imp <= TIPC_CRITICAL_IMPORTANCE) {
878 link_schedule_port(l_ptr, msg_origport(msg), size); 853 link_schedule_port(l_ptr, msg_origport(msg), size);
@@ -888,12 +863,10 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
888 } 863 }
889 864
890 /* Fragmentation needed ? */ 865 /* Fragmentation needed ? */
891
892 if (size > max_packet) 866 if (size > max_packet)
893 return link_send_long_buf(l_ptr, buf); 867 return link_send_long_buf(l_ptr, buf);
894 868
895 /* Packet can be queued or sent: */ 869 /* Packet can be queued or sent. */
896
897 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && 870 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
898 !link_congested(l_ptr))) { 871 !link_congested(l_ptr))) {
899 link_add_to_outqueue(l_ptr, buf, msg); 872 link_add_to_outqueue(l_ptr, buf, msg);
@@ -907,13 +880,11 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
907 } 880 }
908 return dsz; 881 return dsz;
909 } 882 }
910 /* Congestion: can message be bundled ?: */ 883 /* Congestion: can message be bundled ? */
911
912 if ((msg_user(msg) != CHANGEOVER_PROTOCOL) && 884 if ((msg_user(msg) != CHANGEOVER_PROTOCOL) &&
913 (msg_user(msg) != MSG_FRAGMENTER)) { 885 (msg_user(msg) != MSG_FRAGMENTER)) {
914 886
915 /* Try adding message to an existing bundle */ 887 /* Try adding message to an existing bundle */
916
917 if (l_ptr->next_out && 888 if (l_ptr->next_out &&
918 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { 889 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
919 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); 890 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
@@ -921,7 +892,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
921 } 892 }
922 893
923 /* Try creating a new bundle */ 894 /* Try creating a new bundle */
924
925 if (size <= max_packet * 2 / 3) { 895 if (size <= max_packet * 2 / 3) {
926 struct sk_buff *bundler = tipc_buf_acquire(max_packet); 896 struct sk_buff *bundler = tipc_buf_acquire(max_packet);
927 struct tipc_msg bundler_hdr; 897 struct tipc_msg bundler_hdr;
@@ -951,7 +921,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
951 * not been selected yet, and the the owner node is not locked 921 * not been selected yet, and the the owner node is not locked
952 * Called by TIPC internal users, e.g. the name distributor 922 * Called by TIPC internal users, e.g. the name distributor
953 */ 923 */
954
955int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) 924int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
956{ 925{
957 struct tipc_link *l_ptr; 926 struct tipc_link *l_ptr;
@@ -984,7 +953,6 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
984 * small enough not to require fragmentation. 953 * small enough not to require fragmentation.
985 * Called without any locks held. 954 * Called without any locks held.
986 */ 955 */
987
988void tipc_link_send_names(struct list_head *message_list, u32 dest) 956void tipc_link_send_names(struct list_head *message_list, u32 dest)
989{ 957{
990 struct tipc_node *n_ptr; 958 struct tipc_node *n_ptr;
@@ -1013,7 +981,6 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
1013 read_unlock_bh(&tipc_net_lock); 981 read_unlock_bh(&tipc_net_lock);
1014 982
1015 /* discard the messages if they couldn't be sent */ 983 /* discard the messages if they couldn't be sent */
1016
1017 list_for_each_safe(buf, temp_buf, ((struct sk_buff *)message_list)) { 984 list_for_each_safe(buf, temp_buf, ((struct sk_buff *)message_list)) {
1018 list_del((struct list_head *)buf); 985 list_del((struct list_head *)buf);
1019 kfree_skb(buf); 986 kfree_skb(buf);
@@ -1026,7 +993,6 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
1026 * inclusive total message length. Very time critical. 993 * inclusive total message length. Very time critical.
1027 * Link is locked. Returns user data length. 994 * Link is locked. Returns user data length.
1028 */ 995 */
1029
1030static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf, 996static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf,
1031 u32 *used_max_pkt) 997 u32 *used_max_pkt)
1032{ 998{
@@ -1111,7 +1077,6 @@ again:
1111 * Try building message using port's max_pkt hint. 1077 * Try building message using port's max_pkt hint.
1112 * (Must not hold any locks while building message.) 1078 * (Must not hold any locks while building message.)
1113 */ 1079 */
1114
1115 res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, 1080 res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
1116 sender->max_pkt, !sender->user_port, &buf); 1081 sender->max_pkt, !sender->user_port, &buf);
1117 1082
@@ -1131,12 +1096,10 @@ exit:
1131 } 1096 }
1132 1097
1133 /* Exit if build request was invalid */ 1098 /* Exit if build request was invalid */
1134
1135 if (unlikely(res < 0)) 1099 if (unlikely(res < 0))
1136 goto exit; 1100 goto exit;
1137 1101
1138 /* Exit if link (or bearer) is congested */ 1102 /* Exit if link (or bearer) is congested */
1139
1140 if (link_congested(l_ptr) || 1103 if (link_congested(l_ptr) ||
1141 !list_empty(&l_ptr->b_ptr->cong_links)) { 1104 !list_empty(&l_ptr->b_ptr->cong_links)) {
1142 res = link_schedule_port(l_ptr, 1105 res = link_schedule_port(l_ptr,
@@ -1148,7 +1111,6 @@ exit:
1148 * Message size exceeds max_pkt hint; update hint, 1111 * Message size exceeds max_pkt hint; update hint,
1149 * then re-try fast path or fragment the message 1112 * then re-try fast path or fragment the message
1150 */ 1113 */
1151
1152 sender->max_pkt = l_ptr->max_pkt; 1114 sender->max_pkt = l_ptr->max_pkt;
1153 tipc_node_unlock(node); 1115 tipc_node_unlock(node);
1154 read_unlock_bh(&tipc_net_lock); 1116 read_unlock_bh(&tipc_net_lock);
@@ -1166,7 +1128,6 @@ exit:
1166 read_unlock_bh(&tipc_net_lock); 1128 read_unlock_bh(&tipc_net_lock);
1167 1129
1168 /* Couldn't find a link to the destination node */ 1130 /* Couldn't find a link to the destination node */
1169
1170 if (buf) 1131 if (buf)
1171 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1132 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
1172 if (res >= 0) 1133 if (res >= 0)
@@ -1220,15 +1181,13 @@ again:
1220 sect_crs = NULL; 1181 sect_crs = NULL;
1221 curr_sect = -1; 1182 curr_sect = -1;
1222 1183
1223 /* Prepare reusable fragment header: */ 1184 /* Prepare reusable fragment header */
1224
1225 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, 1185 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
1226 INT_H_SIZE, msg_destnode(hdr)); 1186 INT_H_SIZE, msg_destnode(hdr));
1227 msg_set_size(&fragm_hdr, max_pkt); 1187 msg_set_size(&fragm_hdr, max_pkt);
1228 msg_set_fragm_no(&fragm_hdr, 1); 1188 msg_set_fragm_no(&fragm_hdr, 1);
1229 1189
1230 /* Prepare header of first fragment: */ 1190 /* Prepare header of first fragment */
1231
1232 buf_chain = buf = tipc_buf_acquire(max_pkt); 1191 buf_chain = buf = tipc_buf_acquire(max_pkt);
1233 if (!buf) 1192 if (!buf)
1234 return -ENOMEM; 1193 return -ENOMEM;
@@ -1237,8 +1196,7 @@ again:
1237 hsz = msg_hdr_sz(hdr); 1196 hsz = msg_hdr_sz(hdr);
1238 skb_copy_to_linear_data_offset(buf, INT_H_SIZE, hdr, hsz); 1197 skb_copy_to_linear_data_offset(buf, INT_H_SIZE, hdr, hsz);
1239 1198
1240 /* Chop up message: */ 1199 /* Chop up message */
1241
1242 fragm_crs = INT_H_SIZE + hsz; 1200 fragm_crs = INT_H_SIZE + hsz;
1243 fragm_rest = fragm_sz - hsz; 1201 fragm_rest = fragm_sz - hsz;
1244 1202
@@ -1329,7 +1287,6 @@ reject:
1329 } 1287 }
1330 1288
1331 /* Append chain of fragments to send queue & send them */ 1289 /* Append chain of fragments to send queue & send them */
1332
1333 l_ptr->long_msg_seq_no++; 1290 l_ptr->long_msg_seq_no++;
1334 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no); 1291 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
1335 l_ptr->stats.sent_fragments += fragm_no; 1292 l_ptr->stats.sent_fragments += fragm_no;
@@ -1350,7 +1307,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1350 1307
1351 /* Step to position where retransmission failed, if any, */ 1308 /* Step to position where retransmission failed, if any, */
1352 /* consider that buffers may have been released in meantime */ 1309 /* consider that buffers may have been released in meantime */
1353
1354 if (r_q_size && buf) { 1310 if (r_q_size && buf) {
1355 u32 last = lesser(mod(r_q_head + r_q_size), 1311 u32 last = lesser(mod(r_q_head + r_q_size),
1356 link_last_sent(l_ptr)); 1312 link_last_sent(l_ptr));
@@ -1365,7 +1321,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1365 } 1321 }
1366 1322
1367 /* Continue retransmission now, if there is anything: */ 1323 /* Continue retransmission now, if there is anything: */
1368
1369 if (r_q_size && buf) { 1324 if (r_q_size && buf) {
1370 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1325 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1371 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); 1326 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
@@ -1381,7 +1336,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1381 } 1336 }
1382 1337
1383 /* Send deferred protocol message, if any: */ 1338 /* Send deferred protocol message, if any: */
1384
1385 buf = l_ptr->proto_msg_queue; 1339 buf = l_ptr->proto_msg_queue;
1386 if (buf) { 1340 if (buf) {
1387 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1341 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
@@ -1398,7 +1352,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1398 } 1352 }
1399 1353
1400 /* Send one deferred data message, if send window not full: */ 1354 /* Send one deferred data message, if send window not full: */
1401
1402 buf = l_ptr->next_out; 1355 buf = l_ptr->next_out;
1403 if (buf) { 1356 if (buf) {
1404 struct tipc_msg *msg = buf_msg(buf); 1357 struct tipc_msg *msg = buf_msg(buf);
@@ -1478,16 +1431,12 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
1478 warn("Retransmission failure on link <%s>\n", l_ptr->name); 1431 warn("Retransmission failure on link <%s>\n", l_ptr->name);
1479 1432
1480 if (l_ptr->addr) { 1433 if (l_ptr->addr) {
1481
1482 /* Handle failure on standard link */ 1434 /* Handle failure on standard link */
1483
1484 link_print(l_ptr, "Resetting link\n"); 1435 link_print(l_ptr, "Resetting link\n");
1485 tipc_link_reset(l_ptr); 1436 tipc_link_reset(l_ptr);
1486 1437
1487 } else { 1438 } else {
1488
1489 /* Handle failure on broadcast link */ 1439 /* Handle failure on broadcast link */
1490
1491 struct tipc_node *n_ptr; 1440 struct tipc_node *n_ptr;
1492 char addr_string[16]; 1441 char addr_string[16];
1493 1442
@@ -1536,7 +1485,6 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
1536 return; 1485 return;
1537 } else { 1486 } else {
1538 /* Detect repeated retransmit failures on uncongested bearer */ 1487 /* Detect repeated retransmit failures on uncongested bearer */
1539
1540 if (l_ptr->last_retransmitted == msg_seqno(msg)) { 1488 if (l_ptr->last_retransmitted == msg_seqno(msg)) {
1541 if (++l_ptr->stale_count > 100) { 1489 if (++l_ptr->stale_count > 100) {
1542 link_retransmit_failure(l_ptr, buf); 1490 link_retransmit_failure(l_ptr, buf);
@@ -1571,7 +1519,6 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
1571/** 1519/**
1572 * link_insert_deferred_queue - insert deferred messages back into receive chain 1520 * link_insert_deferred_queue - insert deferred messages back into receive chain
1573 */ 1521 */
1574
1575static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr, 1522static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr,
1576 struct sk_buff *buf) 1523 struct sk_buff *buf)
1577{ 1524{
@@ -1602,7 +1549,6 @@ static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr,
1602 * TIPC will ignore the excess, under the assumption that it is optional info 1549 * TIPC will ignore the excess, under the assumption that it is optional info
1603 * introduced by a later release of the protocol. 1550 * introduced by a later release of the protocol.
1604 */ 1551 */
1605
1606static int link_recv_buf_validate(struct sk_buff *buf) 1552static int link_recv_buf_validate(struct sk_buff *buf)
1607{ 1553{
1608 static u32 min_data_hdr_size[8] = { 1554 static u32 min_data_hdr_size[8] = {
@@ -1648,7 +1594,6 @@ static int link_recv_buf_validate(struct sk_buff *buf)
1648 * Invoked with no locks held. Bearer pointer must point to a valid bearer 1594 * Invoked with no locks held. Bearer pointer must point to a valid bearer
1649 * structure (i.e. cannot be NULL), but bearer can be inactive. 1595 * structure (i.e. cannot be NULL), but bearer can be inactive.
1650 */ 1596 */
1651
1652void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr) 1597void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1653{ 1598{
1654 read_lock_bh(&tipc_net_lock); 1599 read_lock_bh(&tipc_net_lock);
@@ -1666,22 +1611,18 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1666 head = head->next; 1611 head = head->next;
1667 1612
1668 /* Ensure bearer is still enabled */ 1613 /* Ensure bearer is still enabled */
1669
1670 if (unlikely(!b_ptr->active)) 1614 if (unlikely(!b_ptr->active))
1671 goto cont; 1615 goto cont;
1672 1616
1673 /* Ensure message is well-formed */ 1617 /* Ensure message is well-formed */
1674
1675 if (unlikely(!link_recv_buf_validate(buf))) 1618 if (unlikely(!link_recv_buf_validate(buf)))
1676 goto cont; 1619 goto cont;
1677 1620
1678 /* Ensure message data is a single contiguous unit */ 1621 /* Ensure message data is a single contiguous unit */
1679
1680 if (unlikely(skb_linearize(buf))) 1622 if (unlikely(skb_linearize(buf)))
1681 goto cont; 1623 goto cont;
1682 1624
1683 /* Handle arrival of a non-unicast link message */ 1625 /* Handle arrival of a non-unicast link message */
1684
1685 msg = buf_msg(buf); 1626 msg = buf_msg(buf);
1686 1627
1687 if (unlikely(msg_non_seq(msg))) { 1628 if (unlikely(msg_non_seq(msg))) {
@@ -1693,20 +1634,17 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1693 } 1634 }
1694 1635
1695 /* Discard unicast link messages destined for another node */ 1636 /* Discard unicast link messages destined for another node */
1696
1697 if (unlikely(!msg_short(msg) && 1637 if (unlikely(!msg_short(msg) &&
1698 (msg_destnode(msg) != tipc_own_addr))) 1638 (msg_destnode(msg) != tipc_own_addr)))
1699 goto cont; 1639 goto cont;
1700 1640
1701 /* Locate neighboring node that sent message */ 1641 /* Locate neighboring node that sent message */
1702
1703 n_ptr = tipc_node_find(msg_prevnode(msg)); 1642 n_ptr = tipc_node_find(msg_prevnode(msg));
1704 if (unlikely(!n_ptr)) 1643 if (unlikely(!n_ptr))
1705 goto cont; 1644 goto cont;
1706 tipc_node_lock(n_ptr); 1645 tipc_node_lock(n_ptr);
1707 1646
1708 /* Locate unicast link endpoint that should handle message */ 1647 /* Locate unicast link endpoint that should handle message */
1709
1710 l_ptr = n_ptr->links[b_ptr->identity]; 1648 l_ptr = n_ptr->links[b_ptr->identity];
1711 if (unlikely(!l_ptr)) { 1649 if (unlikely(!l_ptr)) {
1712 tipc_node_unlock(n_ptr); 1650 tipc_node_unlock(n_ptr);
@@ -1714,7 +1652,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1714 } 1652 }
1715 1653
1716 /* Verify that communication with node is currently allowed */ 1654 /* Verify that communication with node is currently allowed */
1717
1718 if ((n_ptr->block_setup & WAIT_PEER_DOWN) && 1655 if ((n_ptr->block_setup & WAIT_PEER_DOWN) &&
1719 msg_user(msg) == LINK_PROTOCOL && 1656 msg_user(msg) == LINK_PROTOCOL &&
1720 (msg_type(msg) == RESET_MSG || 1657 (msg_type(msg) == RESET_MSG ||
@@ -1728,12 +1665,10 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1728 } 1665 }
1729 1666
1730 /* Validate message sequence number info */ 1667 /* Validate message sequence number info */
1731
1732 seq_no = msg_seqno(msg); 1668 seq_no = msg_seqno(msg);
1733 ackd = msg_ack(msg); 1669 ackd = msg_ack(msg);
1734 1670
1735 /* Release acked messages */ 1671 /* Release acked messages */
1736
1737 if (n_ptr->bclink.supported) 1672 if (n_ptr->bclink.supported)
1738 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg)); 1673 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
1739 1674
@@ -1752,7 +1687,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1752 } 1687 }
1753 1688
1754 /* Try sending any messages link endpoint has pending */ 1689 /* Try sending any messages link endpoint has pending */
1755
1756 if (unlikely(l_ptr->next_out)) 1690 if (unlikely(l_ptr->next_out))
1757 tipc_link_push_queue(l_ptr); 1691 tipc_link_push_queue(l_ptr);
1758 if (unlikely(!list_empty(&l_ptr->waiting_ports))) 1692 if (unlikely(!list_empty(&l_ptr->waiting_ports)))
@@ -1763,7 +1697,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1763 } 1697 }
1764 1698
1765 /* Now (finally!) process the incoming message */ 1699 /* Now (finally!) process the incoming message */
1766
1767protocol_check: 1700protocol_check:
1768 if (likely(link_working_working(l_ptr))) { 1701 if (likely(link_working_working(l_ptr))) {
1769 if (likely(seq_no == mod(l_ptr->next_in_no))) { 1702 if (likely(seq_no == mod(l_ptr->next_in_no))) {
@@ -1859,7 +1792,6 @@ cont:
1859 * 1792 *
1860 * Returns increase in queue length (i.e. 0 or 1) 1793 * Returns increase in queue length (i.e. 0 or 1)
1861 */ 1794 */
1862
1863u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, 1795u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
1864 struct sk_buff *buf) 1796 struct sk_buff *buf)
1865{ 1797{
@@ -1908,7 +1840,6 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
1908/* 1840/*
1909 * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet 1841 * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet
1910 */ 1842 */
1911
1912static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr, 1843static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1913 struct sk_buff *buf) 1844 struct sk_buff *buf)
1914{ 1845{
@@ -1920,14 +1851,12 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1920 } 1851 }
1921 1852
1922 /* Record OOS packet arrival (force mismatch on next timeout) */ 1853 /* Record OOS packet arrival (force mismatch on next timeout) */
1923
1924 l_ptr->checkpoint--; 1854 l_ptr->checkpoint--;
1925 1855
1926 /* 1856 /*
1927 * Discard packet if a duplicate; otherwise add it to deferred queue 1857 * Discard packet if a duplicate; otherwise add it to deferred queue
1928 * and notify peer of gap as per protocol specification 1858 * and notify peer of gap as per protocol specification
1929 */ 1859 */
1930
1931 if (less(seq_no, mod(l_ptr->next_in_no))) { 1860 if (less(seq_no, mod(l_ptr->next_in_no))) {
1932 l_ptr->stats.duplicates++; 1861 l_ptr->stats.duplicates++;
1933 kfree_skb(buf); 1862 kfree_skb(buf);
@@ -1957,7 +1886,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
1957 int r_flag; 1886 int r_flag;
1958 1887
1959 /* Discard any previous message that was deferred due to congestion */ 1888 /* Discard any previous message that was deferred due to congestion */
1960
1961 if (l_ptr->proto_msg_queue) { 1889 if (l_ptr->proto_msg_queue) {
1962 kfree_skb(l_ptr->proto_msg_queue); 1890 kfree_skb(l_ptr->proto_msg_queue);
1963 l_ptr->proto_msg_queue = NULL; 1891 l_ptr->proto_msg_queue = NULL;
@@ -1967,12 +1895,10 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
1967 return; 1895 return;
1968 1896
1969 /* Abort non-RESET send if communication with node is prohibited */ 1897 /* Abort non-RESET send if communication with node is prohibited */
1970
1971 if ((l_ptr->owner->block_setup) && (msg_typ != RESET_MSG)) 1898 if ((l_ptr->owner->block_setup) && (msg_typ != RESET_MSG))
1972 return; 1899 return;
1973 1900
1974 /* Create protocol message with "out-of-sequence" sequence number */ 1901 /* Create protocol message with "out-of-sequence" sequence number */
1975
1976 msg_set_type(msg, msg_typ); 1902 msg_set_type(msg, msg_typ);
1977 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); 1903 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
1978 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1904 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
@@ -2040,14 +1966,12 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
2040 skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); 1966 skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg));
2041 1967
2042 /* Defer message if bearer is already congested */ 1968 /* Defer message if bearer is already congested */
2043
2044 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { 1969 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
2045 l_ptr->proto_msg_queue = buf; 1970 l_ptr->proto_msg_queue = buf;
2046 return; 1971 return;
2047 } 1972 }
2048 1973
2049 /* Defer message if attempting to send results in bearer congestion */ 1974 /* Defer message if attempting to send results in bearer congestion */
2050
2051 if (!tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1975 if (!tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
2052 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); 1976 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
2053 l_ptr->proto_msg_queue = buf; 1977 l_ptr->proto_msg_queue = buf;
@@ -2056,7 +1980,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
2056 } 1980 }
2057 1981
2058 /* Discard message if it was sent successfully */ 1982 /* Discard message if it was sent successfully */
2059
2060 l_ptr->unacked_window = 0; 1983 l_ptr->unacked_window = 0;
2061 kfree_skb(buf); 1984 kfree_skb(buf);
2062} 1985}
@@ -2066,7 +1989,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
2066 * Note that network plane id propagates through the network, and may 1989 * Note that network plane id propagates through the network, and may
2067 * change at any time. The node with lowest address rules 1990 * change at any time. The node with lowest address rules
2068 */ 1991 */
2069
2070static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf) 1992static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2071{ 1993{
2072 u32 rec_gap = 0; 1994 u32 rec_gap = 0;
@@ -2079,7 +2001,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2079 goto exit; 2001 goto exit;
2080 2002
2081 /* record unnumbered packet arrival (force mismatch on next timeout) */ 2003 /* record unnumbered packet arrival (force mismatch on next timeout) */
2082
2083 l_ptr->checkpoint--; 2004 l_ptr->checkpoint--;
2084 2005
2085 if (l_ptr->b_ptr->net_plane != msg_net_plane(msg)) 2006 if (l_ptr->b_ptr->net_plane != msg_net_plane(msg))
@@ -2111,7 +2032,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2111 /* fall thru' */ 2032 /* fall thru' */
2112 case ACTIVATE_MSG: 2033 case ACTIVATE_MSG:
2113 /* Update link settings according other endpoint's values */ 2034 /* Update link settings according other endpoint's values */
2114
2115 strcpy((strrchr(l_ptr->name, ':') + 1), (char *)msg_data(msg)); 2035 strcpy((strrchr(l_ptr->name, ':') + 1), (char *)msg_data(msg));
2116 2036
2117 msg_tol = msg_link_tolerance(msg); 2037 msg_tol = msg_link_tolerance(msg);
@@ -2133,7 +2053,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2133 l_ptr->owner->bclink.supportable = (max_pkt_info != 0); 2053 l_ptr->owner->bclink.supportable = (max_pkt_info != 0);
2134 2054
2135 /* Synchronize broadcast link info, if not done previously */ 2055 /* Synchronize broadcast link info, if not done previously */
2136
2137 if (!tipc_node_is_up(l_ptr->owner)) { 2056 if (!tipc_node_is_up(l_ptr->owner)) {
2138 l_ptr->owner->bclink.last_sent = 2057 l_ptr->owner->bclink.last_sent =
2139 l_ptr->owner->bclink.last_in = 2058 l_ptr->owner->bclink.last_in =
@@ -2185,7 +2104,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2185 } 2104 }
2186 2105
2187 /* Protocol message before retransmits, reduce loss risk */ 2106 /* Protocol message before retransmits, reduce loss risk */
2188
2189 if (l_ptr->owner->bclink.supported) 2107 if (l_ptr->owner->bclink.supported)
2190 tipc_bclink_update_link_state(l_ptr->owner, 2108 tipc_bclink_update_link_state(l_ptr->owner,
2191 msg_last_bcast(msg)); 2109 msg_last_bcast(msg));
@@ -2243,7 +2161,6 @@ static void tipc_link_tunnel(struct tipc_link *l_ptr,
2243 * changeover(): Send whole message queue via the remaining link 2161 * changeover(): Send whole message queue via the remaining link
2244 * Owner node is locked. 2162 * Owner node is locked.
2245 */ 2163 */
2246
2247void tipc_link_changeover(struct tipc_link *l_ptr) 2164void tipc_link_changeover(struct tipc_link *l_ptr)
2248{ 2165{
2249 u32 msgcount = l_ptr->out_queue_size; 2166 u32 msgcount = l_ptr->out_queue_size;
@@ -2343,8 +2260,6 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
2343 } 2260 }
2344} 2261}
2345 2262
2346
2347
2348/** 2263/**
2349 * buf_extract - extracts embedded TIPC message from another message 2264 * buf_extract - extracts embedded TIPC message from another message
2350 * @skb: encapsulating message buffer 2265 * @skb: encapsulating message buffer
@@ -2353,7 +2268,6 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
2353 * Returns a new message buffer containing an embedded message. The 2268 * Returns a new message buffer containing an embedded message. The
2354 * encapsulating message itself is left unchanged. 2269 * encapsulating message itself is left unchanged.
2355 */ 2270 */
2356
2357static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos) 2271static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
2358{ 2272{
2359 struct tipc_msg *msg = (struct tipc_msg *)(skb->data + from_pos); 2273 struct tipc_msg *msg = (struct tipc_msg *)(skb->data + from_pos);
@@ -2370,7 +2284,6 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
2370 * link_recv_changeover_msg(): Receive tunneled packet sent 2284 * link_recv_changeover_msg(): Receive tunneled packet sent
2371 * via other link. Node is locked. Return extracted buffer. 2285 * via other link. Node is locked. Return extracted buffer.
2372 */ 2286 */
2373
2374static int link_recv_changeover_msg(struct tipc_link **l_ptr, 2287static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2375 struct sk_buff **buf) 2288 struct sk_buff **buf)
2376{ 2289{
@@ -2405,7 +2318,6 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2405 } 2318 }
2406 2319
2407 /* First original message ?: */ 2320 /* First original message ?: */
2408
2409 if (tipc_link_is_up(dest_link)) { 2321 if (tipc_link_is_up(dest_link)) {
2410 info("Resetting link <%s>, changeover initiated by peer\n", 2322 info("Resetting link <%s>, changeover initiated by peer\n",
2411 dest_link->name); 2323 dest_link->name);
@@ -2420,7 +2332,6 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2420 } 2332 }
2421 2333
2422 /* Receive original message */ 2334 /* Receive original message */
2423
2424 if (dest_link->exp_msg_count == 0) { 2335 if (dest_link->exp_msg_count == 0) {
2425 warn("Link switchover error, " 2336 warn("Link switchover error, "
2426 "got too many tunnelled messages\n"); 2337 "got too many tunnelled messages\n");
@@ -2469,7 +2380,6 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2469 * Fragmentation/defragmentation: 2380 * Fragmentation/defragmentation:
2470 */ 2381 */
2471 2382
2472
2473/* 2383/*
2474 * link_send_long_buf: Entry for buffers needing fragmentation. 2384 * link_send_long_buf: Entry for buffers needing fragmentation.
2475 * The buffer is complete, inclusive total message length. 2385 * The buffer is complete, inclusive total message length.
@@ -2496,12 +2406,10 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2496 destaddr = msg_destnode(inmsg); 2406 destaddr = msg_destnode(inmsg);
2497 2407
2498 /* Prepare reusable fragment header: */ 2408 /* Prepare reusable fragment header: */
2499
2500 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, 2409 tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
2501 INT_H_SIZE, destaddr); 2410 INT_H_SIZE, destaddr);
2502 2411
2503 /* Chop up message: */ 2412 /* Chop up message: */
2504
2505 while (rest > 0) { 2413 while (rest > 0) {
2506 struct sk_buff *fragm; 2414 struct sk_buff *fragm;
2507 2415
@@ -2535,7 +2443,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2535 kfree_skb(buf); 2443 kfree_skb(buf);
2536 2444
2537 /* Append chain of fragments to send queue & send them */ 2445 /* Append chain of fragments to send queue & send them */
2538
2539 l_ptr->long_msg_seq_no++; 2446 l_ptr->long_msg_seq_no++;
2540 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no); 2447 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
2541 l_ptr->stats.sent_fragments += fragm_no; 2448 l_ptr->stats.sent_fragments += fragm_no;
@@ -2551,7 +2458,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2551 * help storing these values in unused, available fields in the 2458 * help storing these values in unused, available fields in the
2552 * pending message. This makes dynamic memory allocation unnecessary. 2459 * pending message. This makes dynamic memory allocation unnecessary.
2553 */ 2460 */
2554
2555static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno) 2461static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
2556{ 2462{
2557 msg_set_seqno(buf_msg(buf), seqno); 2463 msg_set_seqno(buf_msg(buf), seqno);
@@ -2603,7 +2509,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2603 *fb = NULL; 2509 *fb = NULL;
2604 2510
2605 /* Is there an incomplete message waiting for this fragment? */ 2511 /* Is there an incomplete message waiting for this fragment? */
2606
2607 while (pbuf && ((buf_seqno(pbuf) != long_msg_seq_no) || 2512 while (pbuf && ((buf_seqno(pbuf) != long_msg_seq_no) ||
2608 (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) { 2513 (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) {
2609 prev = pbuf; 2514 prev = pbuf;
@@ -2629,7 +2534,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2629 skb_copy_to_linear_data(pbuf, imsg, 2534 skb_copy_to_linear_data(pbuf, imsg,
2630 msg_data_sz(fragm)); 2535 msg_data_sz(fragm));
2631 /* Prepare buffer for subsequent fragments. */ 2536 /* Prepare buffer for subsequent fragments. */
2632
2633 set_long_msg_seqno(pbuf, long_msg_seq_no); 2537 set_long_msg_seqno(pbuf, long_msg_seq_no);
2634 set_fragm_size(pbuf, fragm_sz); 2538 set_fragm_size(pbuf, fragm_sz);
2635 set_expected_frags(pbuf, exp_fragm_cnt - 1); 2539 set_expected_frags(pbuf, exp_fragm_cnt - 1);
@@ -2650,7 +2554,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2650 kfree_skb(fbuf); 2554 kfree_skb(fbuf);
2651 2555
2652 /* Is message complete? */ 2556 /* Is message complete? */
2653
2654 if (exp_frags == 0) { 2557 if (exp_frags == 0) {
2655 if (prev) 2558 if (prev)
2656 prev->next = pbuf->next; 2559 prev->next = pbuf->next;
@@ -2672,7 +2575,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2672 * link_check_defragm_bufs - flush stale incoming message fragments 2575 * link_check_defragm_bufs - flush stale incoming message fragments
2673 * @l_ptr: pointer to link 2576 * @l_ptr: pointer to link
2674 */ 2577 */
2675
2676static void link_check_defragm_bufs(struct tipc_link *l_ptr) 2578static void link_check_defragm_bufs(struct tipc_link *l_ptr)
2677{ 2579{
2678 struct sk_buff *prev = NULL; 2580 struct sk_buff *prev = NULL;
@@ -2701,8 +2603,6 @@ static void link_check_defragm_bufs(struct tipc_link *l_ptr)
2701 } 2603 }
2702} 2604}
2703 2605
2704
2705
2706static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance) 2606static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance)
2707{ 2607{
2708 if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL)) 2608 if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL))
@@ -2714,7 +2614,6 @@ static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance)
2714 l_ptr->abort_limit = tolerance / (l_ptr->continuity_interval / 4); 2614 l_ptr->abort_limit = tolerance / (l_ptr->continuity_interval / 4);
2715} 2615}
2716 2616
2717
2718void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window) 2617void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
2719{ 2618{
2720 /* Data messages from this node, inclusive FIRST_FRAGM */ 2619 /* Data messages from this node, inclusive FIRST_FRAGM */
@@ -2744,7 +2643,6 @@ void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
2744 * 2643 *
2745 * Returns pointer to link (or 0 if invalid link name). 2644 * Returns pointer to link (or 0 if invalid link name).
2746 */ 2645 */
2747
2748static struct tipc_link *link_find_link(const char *name, 2646static struct tipc_link *link_find_link(const char *name,
2749 struct tipc_node **node) 2647 struct tipc_node **node)
2750{ 2648{
@@ -2778,7 +2676,6 @@ static struct tipc_link *link_find_link(const char *name,
2778 * 2676 *
2779 * Returns 1 if value is within range, 0 if not. 2677 * Returns 1 if value is within range, 0 if not.
2780 */ 2678 */
2781
2782static int link_value_is_valid(u16 cmd, u32 new_value) 2679static int link_value_is_valid(u16 cmd, u32 new_value)
2783{ 2680{
2784 switch (cmd) { 2681 switch (cmd) {
@@ -2794,7 +2691,6 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
2794 return 0; 2691 return 0;
2795} 2692}
2796 2693
2797
2798/** 2694/**
2799 * link_cmd_set_value - change priority/tolerance/window for link/bearer/media 2695 * link_cmd_set_value - change priority/tolerance/window for link/bearer/media
2800 * @name - ptr to link, bearer, or media name 2696 * @name - ptr to link, bearer, or media name
@@ -2805,7 +2701,6 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
2805 * 2701 *
2806 * Returns 0 if value updated and negative value on error. 2702 * Returns 0 if value updated and negative value on error.
2807 */ 2703 */
2808
2809static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd) 2704static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd)
2810{ 2705{
2811 struct tipc_node *node; 2706 struct tipc_node *node;
@@ -2910,7 +2805,6 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
2910 * link_reset_statistics - reset link statistics 2805 * link_reset_statistics - reset link statistics
2911 * @l_ptr: pointer to link 2806 * @l_ptr: pointer to link
2912 */ 2807 */
2913
2914static void link_reset_statistics(struct tipc_link *l_ptr) 2808static void link_reset_statistics(struct tipc_link *l_ptr)
2915{ 2809{
2916 memset(&l_ptr->stats, 0, sizeof(l_ptr->stats)); 2810 memset(&l_ptr->stats, 0, sizeof(l_ptr->stats));
@@ -2951,7 +2845,6 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
2951/** 2845/**
2952 * percent - convert count to a percentage of total (rounding up or down) 2846 * percent - convert count to a percentage of total (rounding up or down)
2953 */ 2847 */
2954
2955static u32 percent(u32 count, u32 total) 2848static u32 percent(u32 count, u32 total)
2956{ 2849{
2957 return (count * 100 + (total / 2)) / total; 2850 return (count * 100 + (total / 2)) / total;
@@ -2965,7 +2858,6 @@ static u32 percent(u32 count, u32 total)
2965 * 2858 *
2966 * Returns length of print buffer data string (or 0 if error) 2859 * Returns length of print buffer data string (or 0 if error)
2967 */ 2860 */
2968
2969static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) 2861static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
2970{ 2862{
2971 struct print_buf pb; 2863 struct print_buf pb;
@@ -3087,7 +2979,6 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
3087 * 2979 *
3088 * If no active link can be found, uses default maximum packet size. 2980 * If no active link can be found, uses default maximum packet size.
3089 */ 2981 */
3090
3091u32 tipc_link_get_max_pkt(u32 dest, u32 selector) 2982u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
3092{ 2983{
3093 struct tipc_node *n_ptr; 2984 struct tipc_node *n_ptr;
@@ -3171,4 +3062,3 @@ print_state:
3171 tipc_printbuf_validate(buf); 3062 tipc_printbuf_validate(buf);
3172 info("%s", print_area); 3063 info("%s", print_area);
3173} 3064}
3174