diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2015-10-22 08:51:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-24 09:56:25 -0400 |
commit | 0043550b0a88b72216161d6f25eb0a2e0e78babf (patch) | |
tree | c1adb7278bfe35dfa7fcf4e5b33531fca713317a /net/tipc | |
parent | 6beb19a62a87ef6f7107fcd43c2cc1ebad3edfb5 (diff) |
tipc: move broadcast link lock to struct tipc_net
The broadcast lock will need to be acquired outside bcast.c in a later
commit. For this reason, we move the lock to struct tipc_net. Consistent
with the changes in the previous commit, we also introducee two new
functions tipc_bcast_lock() and tipc_bcast_unlock(). The code that is
currently using tipc_bclink_lock()/unlock() will be phased out during
the coming commits in this series.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/bcast.c | 12 | ||||
-rw-r--r-- | net/tipc/bcast.h | 10 | ||||
-rw-r--r-- | net/tipc/core.h | 1 |
3 files changed, 14 insertions, 9 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 2c5f5443354a..ebf4fd7c3749 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -90,7 +90,6 @@ struct tipc_bcbearer { | |||
90 | 90 | ||
91 | /** | 91 | /** |
92 | * struct tipc_bc_base - link used for broadcast messages | 92 | * struct tipc_bc_base - link used for broadcast messages |
93 | * @lock: spinlock governing access to structure | ||
94 | * @link: (non-standard) broadcast link structure | 93 | * @link: (non-standard) broadcast link structure |
95 | * @node: (non-standard) node structure representing b'cast link's peer node | 94 | * @node: (non-standard) node structure representing b'cast link's peer node |
96 | * @bcast_nodes: map of broadcast-capable nodes | 95 | * @bcast_nodes: map of broadcast-capable nodes |
@@ -99,7 +98,6 @@ struct tipc_bcbearer { | |||
99 | * Handles sequence numbering, fragmentation, bundling, etc. | 98 | * Handles sequence numbering, fragmentation, bundling, etc. |
100 | */ | 99 | */ |
101 | struct tipc_bc_base { | 100 | struct tipc_bc_base { |
102 | spinlock_t lock; /* spinlock protecting broadcast structs */ | ||
103 | struct tipc_link link; | 101 | struct tipc_link link; |
104 | struct tipc_node node; | 102 | struct tipc_node node; |
105 | struct sk_buff_head arrvq; | 103 | struct sk_buff_head arrvq; |
@@ -124,16 +122,12 @@ static void tipc_nmap_add(struct tipc_node_map *nm_ptr, u32 node); | |||
124 | static void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node); | 122 | static void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node); |
125 | static void tipc_bclink_lock(struct net *net) | 123 | static void tipc_bclink_lock(struct net *net) |
126 | { | 124 | { |
127 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 125 | tipc_bcast_lock(net); |
128 | |||
129 | spin_lock_bh(&tn->bcbase->lock); | ||
130 | } | 126 | } |
131 | 127 | ||
132 | static void tipc_bclink_unlock(struct net *net) | 128 | static void tipc_bclink_unlock(struct net *net) |
133 | { | 129 | { |
134 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 130 | tipc_bcast_unlock(net); |
135 | |||
136 | spin_unlock_bh(&tn->bcbase->lock); | ||
137 | } | 131 | } |
138 | 132 | ||
139 | void tipc_bclink_input(struct net *net) | 133 | void tipc_bclink_input(struct net *net) |
@@ -1031,7 +1025,7 @@ int tipc_bcast_init(struct net *net) | |||
1031 | bcbearer->media.send_msg = tipc_bcbearer_send; | 1025 | bcbearer->media.send_msg = tipc_bcbearer_send; |
1032 | sprintf(bcbearer->media.name, "tipc-broadcast"); | 1026 | sprintf(bcbearer->media.name, "tipc-broadcast"); |
1033 | 1027 | ||
1034 | spin_lock_init(&bclink->lock); | 1028 | spin_lock_init(&tipc_net(net)->bclock); |
1035 | __skb_queue_head_init(&bcl->transmq); | 1029 | __skb_queue_head_init(&bcl->transmq); |
1036 | __skb_queue_head_init(&bcl->backlogq); | 1030 | __skb_queue_head_init(&bcl->backlogq); |
1037 | __skb_queue_head_init(&bcl->deferdq); | 1031 | __skb_queue_head_init(&bcl->deferdq); |
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index d379b0afe8e8..eac912abacd2 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h | |||
@@ -69,4 +69,14 @@ int tipc_nl_bc_link_set(struct net *net, struct nlattr *attrs[]); | |||
69 | void tipc_bclink_input(struct net *net); | 69 | void tipc_bclink_input(struct net *net); |
70 | void tipc_bclink_sync_state(struct tipc_node *n, struct tipc_msg *msg); | 70 | void tipc_bclink_sync_state(struct tipc_node *n, struct tipc_msg *msg); |
71 | 71 | ||
72 | static inline void tipc_bcast_lock(struct net *net) | ||
73 | { | ||
74 | spin_lock_bh(&tipc_net(net)->bclock); | ||
75 | } | ||
76 | |||
77 | static inline void tipc_bcast_unlock(struct net *net) | ||
78 | { | ||
79 | spin_unlock_bh(&tipc_net(net)->bclock); | ||
80 | } | ||
81 | |||
72 | #endif | 82 | #endif |
diff --git a/net/tipc/core.h b/net/tipc/core.h index e4e9a56de64b..645dcac9575d 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -93,6 +93,7 @@ struct tipc_net { | |||
93 | struct tipc_bearer __rcu *bearer_list[MAX_BEARERS + 1]; | 93 | struct tipc_bearer __rcu *bearer_list[MAX_BEARERS + 1]; |
94 | 94 | ||
95 | /* Broadcast link */ | 95 | /* Broadcast link */ |
96 | spinlock_t bclock; | ||
96 | struct tipc_bcbearer *bcbearer; | 97 | struct tipc_bcbearer *bcbearer; |
97 | struct tipc_bc_base *bcbase; | 98 | struct tipc_bc_base *bcbase; |
98 | struct tipc_link *bcl; | 99 | struct tipc_link *bcl; |