aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.h
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-11-19 14:30:44 -0500
committerDavid S. Miller <davem@davemloft.net>2015-11-20 14:06:10 -0500
commit5405ff6e15f40f2f53e37d2dcd7de521e2b7a96f (patch)
tree226f40f32f063d27a8d9a6abe6708d550721f1fd /net/tipc/node.h
parent2312bf61ae365fdd6b9bfb24558a417859759447 (diff)
tipc: convert node lock to rwlock
According to the node FSM a node in state SELF_UP_PEER_UP cannot change state inside a lock context, except when a TUNNEL_PROTOCOL (SYNCH or FAILOVER) packet arrives. However, the node's individual links may still change state. Since each link now is protected by its own spinlock, we finally have the conditions in place to convert the node spinlock to an rwlock_t. If the node state and arriving packet type are rigth, we can let the link directly receive the packet under protection of its own spinlock and the node lock in read mode. In all other cases we use the node lock in write mode. This enables full concurrent execution between parallel links during steady-state traffic situations, i.e., 99+ % of the time. This commit implements this change. Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.h')
-rw-r--r--net/tipc/node.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 8784907486c0..651a1581a210 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -109,7 +109,7 @@ struct tipc_bclink_entry {
109struct tipc_node { 109struct tipc_node {
110 u32 addr; 110 u32 addr;
111 struct kref kref; 111 struct kref kref;
112 spinlock_t lock; 112 rwlock_t lock;
113 struct net *net; 113 struct net *net;
114 struct hlist_node hash; 114 struct hlist_node hash;
115 int active_links[2]; 115 int active_links[2];
@@ -145,7 +145,8 @@ void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr);
145bool tipc_node_is_up(struct tipc_node *n); 145bool tipc_node_is_up(struct tipc_node *n);
146int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node, 146int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node,
147 char *linkname, size_t len); 147 char *linkname, size_t len);
148void tipc_node_unlock(struct tipc_node *node); 148void tipc_node_read_lock(struct tipc_node *n);
149void tipc_node_read_unlock(struct tipc_node *node);
149int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode, 150int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,
150 int selector); 151 int selector);
151int tipc_node_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest, 152int tipc_node_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest,
@@ -157,11 +158,6 @@ int tipc_node_add_conn(struct net *net, u32 dnode, u32 port, u32 peer_port);
157void tipc_node_remove_conn(struct net *net, u32 dnode, u32 port); 158void tipc_node_remove_conn(struct net *net, u32 dnode, u32 port);
158int tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb); 159int tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb);
159 160
160static inline void tipc_node_lock(struct tipc_node *node)
161{
162 spin_lock_bh(&node->lock);
163}
164
165static inline struct tipc_link *node_active_link(struct tipc_node *n, int sel) 161static inline struct tipc_link *node_active_link(struct tipc_node *n, int sel)
166{ 162{
167 int bearer_id = n->active_links[sel & 1]; 163 int bearer_id = n->active_links[sel & 1];