aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-04-21 11:50:42 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-05-10 16:03:58 -0400
commitdc63d91eb1cf74233c68b0058dcd477f5d019d02 (patch)
tree1efaf54b35b9e6990d45e01172e2ed93c2799815 /net
parent2689690469c9fd76f9db0afcdf2523f48cce4006 (diff)
tipc: Introduce routine to enqueue a chain of messages on link tx queue
Create a helper routine to enqueue a chain of sk_buffs to a link's transmit queue. It improves readability and the new function is anticipated to be used more than just once in the future as well. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/link.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 4bab139d5e74..5ed4b4f7452d 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -843,6 +843,25 @@ static void link_add_to_outqueue(struct link *l_ptr,
843 l_ptr->stats.max_queue_sz = l_ptr->out_queue_size; 843 l_ptr->stats.max_queue_sz = l_ptr->out_queue_size;
844} 844}
845 845
846static void link_add_chain_to_outqueue(struct link *l_ptr,
847 struct sk_buff *buf_chain,
848 u32 long_msgno)
849{
850 struct sk_buff *buf;
851 struct tipc_msg *msg;
852
853 if (!l_ptr->next_out)
854 l_ptr->next_out = buf_chain;
855 while (buf_chain) {
856 buf = buf_chain;
857 buf_chain = buf_chain->next;
858
859 msg = buf_msg(buf);
860 msg_set_long_msgno(msg, long_msgno);
861 link_add_to_outqueue(l_ptr, buf, msg);
862 }
863}
864
846/* 865/*
847 * tipc_link_send_buf() is the 'full path' for messages, called from 866 * tipc_link_send_buf() is the 'full path' for messages, called from
848 * inside TIPC when the 'fast path' in tipc_send_buf 867 * inside TIPC when the 'fast path' in tipc_send_buf
@@ -1276,25 +1295,12 @@ reject:
1276 total_len, TIPC_ERR_NO_NODE); 1295 total_len, TIPC_ERR_NO_NODE);
1277 } 1296 }
1278 1297
1279 /* Append whole chain to send queue: */ 1298 /* Append chain of fragments to send queue & send them */
1280 1299
1281 buf = buf_chain;
1282 l_ptr->long_msg_seq_no++; 1300 l_ptr->long_msg_seq_no++;
1283 if (!l_ptr->next_out) 1301 link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
1284 l_ptr->next_out = buf_chain; 1302 l_ptr->stats.sent_fragments += fragm_no;
1285 l_ptr->stats.sent_fragmented++; 1303 l_ptr->stats.sent_fragmented++;
1286 while (buf) {
1287 struct sk_buff *next = buf->next;
1288 struct tipc_msg *msg = buf_msg(buf);
1289
1290 l_ptr->stats.sent_fragments++;
1291 msg_set_long_msgno(msg, l_ptr->long_msg_seq_no);
1292 link_add_to_outqueue(l_ptr, buf, msg);
1293 buf = next;
1294 }
1295
1296 /* Send it, if possible: */
1297
1298 tipc_link_push_queue(l_ptr); 1304 tipc_link_push_queue(l_ptr);
1299 tipc_node_unlock(node); 1305 tipc_node_unlock(node);
1300 return dsz; 1306 return dsz;