aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2014-06-25 21:41:33 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-27 15:50:55 -0400
commit16e166b88cdfd508b88934ec0c8a0ec97e6b30f8 (patch)
tree0a816f77b87f4e0f56426fe4d849c64a10c92adc /net/tipc/node.c
parent4f1688b2c63cd86f0d7bcf95a9b3040e38bd3c1a (diff)
tipc: make link mtu easily accessible from socket
Message fragmentation is currently performed at link level, inside the protection of node_lock. This potentially binds up the sending link structure for a long time, instead of letting it do other tasks, such as handle reception of new packets. In this commit, we make the MTUs of each active link become easily accessible from the socket level, i.e., without taking any spinlock or dereferencing the target link pointer. This way, we make it possible to perform fragmentation in the sending socket, before sending the whole fragment chain to the link for transport. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r--net/tipc/node.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 5b44c3041be4..d959343043fd 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/node.c: TIPC node management routines 2 * net/tipc/node.c: TIPC node management routines
3 * 3 *
4 * Copyright (c) 2000-2006, 2012 Ericsson AB 4 * Copyright (c) 2000-2006, 2012-2014, Ericsson AB
5 * Copyright (c) 2005-2006, 2010-2014, Wind River Systems 5 * Copyright (c) 2005-2006, 2010-2014, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -155,21 +155,25 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
155 if (!active[0]) { 155 if (!active[0]) {
156 active[0] = active[1] = l_ptr; 156 active[0] = active[1] = l_ptr;
157 node_established_contact(n_ptr); 157 node_established_contact(n_ptr);
158 return; 158 goto exit;
159 } 159 }
160 if (l_ptr->priority < active[0]->priority) { 160 if (l_ptr->priority < active[0]->priority) {
161 pr_info("New link <%s> becomes standby\n", l_ptr->name); 161 pr_info("New link <%s> becomes standby\n", l_ptr->name);
162 return; 162 goto exit;
163 } 163 }
164 tipc_link_dup_queue_xmit(active[0], l_ptr); 164 tipc_link_dup_queue_xmit(active[0], l_ptr);
165 if (l_ptr->priority == active[0]->priority) { 165 if (l_ptr->priority == active[0]->priority) {
166 active[0] = l_ptr; 166 active[0] = l_ptr;
167 return; 167 goto exit;
168 } 168 }
169 pr_info("Old link <%s> becomes standby\n", active[0]->name); 169 pr_info("Old link <%s> becomes standby\n", active[0]->name);
170 if (active[1] != active[0]) 170 if (active[1] != active[0])
171 pr_info("Old link <%s> becomes standby\n", active[1]->name); 171 pr_info("Old link <%s> becomes standby\n", active[1]->name);
172 active[0] = active[1] = l_ptr; 172 active[0] = active[1] = l_ptr;
173exit:
174 /* Leave room for changeover header when returning 'mtu' to users: */
175 n_ptr->act_mtus[0] = active[0]->max_pkt - INT_H_SIZE;
176 n_ptr->act_mtus[1] = active[1]->max_pkt - INT_H_SIZE;
173} 177}
174 178
175/** 179/**
@@ -229,6 +233,19 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
229 tipc_link_failover_send_queue(l_ptr); 233 tipc_link_failover_send_queue(l_ptr);
230 else 234 else
231 node_lost_contact(n_ptr); 235 node_lost_contact(n_ptr);
236
237 /* Leave room for changeover header when returning 'mtu' to users: */
238 if (active[0]) {
239 n_ptr->act_mtus[0] = active[0]->max_pkt - INT_H_SIZE;
240 n_ptr->act_mtus[1] = active[1]->max_pkt - INT_H_SIZE;
241 return;
242 }
243
244 /* Loopback link went down? No fragmentation needed from now on. */
245 if (n_ptr->addr == tipc_own_addr) {
246 n_ptr->act_mtus[0] = MAX_MSG_SIZE;
247 n_ptr->act_mtus[1] = MAX_MSG_SIZE;
248 }
232} 249}
233 250
234int tipc_node_active_links(struct tipc_node *n_ptr) 251int tipc_node_active_links(struct tipc_node *n_ptr)