aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c2
-rw-r--r--net/tipc/link.c31
-rw-r--r--net/tipc/link.h11
-rw-r--r--net/tipc/node.c7
4 files changed, 29 insertions, 22 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index d8c399d31288..c012ce9e93c7 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -1226,7 +1226,7 @@ int tipc_bcast_init(struct net *net)
1226 spin_lock_init(&tipc_net(net)->bclock); 1226 spin_lock_init(&tipc_net(net)->bclock);
1227 bb->node.net = net; 1227 bb->node.net = net;
1228 1228
1229 if (!tipc_link_bc_create(&bb->node, 0, 0, 1229 if (!tipc_link_bc_create(net, 0, 0,
1230 U16_MAX, 1230 U16_MAX,
1231 BCLINK_WIN_DEFAULT, 1231 BCLINK_WIN_DEFAULT,
1232 0, 1232 0,
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 7d3b6e7d852a..819fb7163fa2 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -175,9 +175,12 @@ bool link_is_bc_rcvlink(struct tipc_link *l)
175 175
176int tipc_link_is_active(struct tipc_link *l) 176int tipc_link_is_active(struct tipc_link *l)
177{ 177{
178 struct tipc_node *n = l->owner; 178 return l->active;
179}
179 180
180 return (node_active_link(n, 0) == l) || (node_active_link(n, 1) == l); 181void tipc_link_set_active(struct tipc_link *l, bool active)
182{
183 l->active = active;
181} 184}
182 185
183void tipc_link_add_bc_peer(struct tipc_link *snd_l, 186void tipc_link_add_bc_peer(struct tipc_link *snd_l,
@@ -250,7 +253,7 @@ static u32 link_own_addr(struct tipc_link *l)
250 * 253 *
251 * Returns true if link was created, otherwise false 254 * Returns true if link was created, otherwise false
252 */ 255 */
253bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id, 256bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
254 int tolerance, char net_plane, u32 mtu, int priority, 257 int tolerance, char net_plane, u32 mtu, int priority,
255 int window, u32 session, u32 ownnode, u32 peer, 258 int window, u32 session, u32 ownnode, u32 peer,
256 u16 peer_caps, 259 u16 peer_caps,
@@ -284,7 +287,7 @@ bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id,
284 l->addr = peer; 287 l->addr = peer;
285 l->peer_caps = peer_caps; 288 l->peer_caps = peer_caps;
286 l->media_addr = maddr; 289 l->media_addr = maddr;
287 l->owner = n; 290 l->net = net;
288 l->peer_session = WILDCARD_SESSION; 291 l->peer_session = WILDCARD_SESSION;
289 l->bearer_id = bearer_id; 292 l->bearer_id = bearer_id;
290 l->tolerance = tolerance; 293 l->tolerance = tolerance;
@@ -318,7 +321,7 @@ bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id,
318 * 321 *
319 * Returns true if link was created, otherwise false 322 * Returns true if link was created, otherwise false
320 */ 323 */
321bool tipc_link_bc_create(struct tipc_node *n, u32 ownnode, u32 peer, 324bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer,
322 int mtu, int window, u16 peer_caps, 325 int mtu, int window, u16 peer_caps,
323 struct sk_buff_head *inputq, 326 struct sk_buff_head *inputq,
324 struct sk_buff_head *namedq, 327 struct sk_buff_head *namedq,
@@ -327,7 +330,7 @@ bool tipc_link_bc_create(struct tipc_node *n, u32 ownnode, u32 peer,
327{ 330{
328 struct tipc_link *l; 331 struct tipc_link *l;
329 332
330 if (!tipc_link_create(n, "", MAX_BEARERS, 0, 'Z', mtu, 0, window, 333 if (!tipc_link_create(net, "", MAX_BEARERS, 0, 'Z', mtu, 0, window,
331 0, ownnode, peer, peer_caps, NULL, bc_sndlink, 334 0, ownnode, peer, peer_caps, NULL, bc_sndlink,
332 NULL, inputq, namedq, link)) 335 NULL, inputq, namedq, link))
333 return false; 336 return false;
@@ -889,10 +892,10 @@ void tipc_link_push_packets(struct tipc_link *link)
889 msg_set_ack(msg, ack); 892 msg_set_ack(msg, ack);
890 msg_set_seqno(msg, seqno); 893 msg_set_seqno(msg, seqno);
891 seqno = mod(seqno + 1); 894 seqno = mod(seqno + 1);
892 msg_set_bcast_ack(msg, link->owner->bclink.last_in); 895 /* msg_set_bcast_ack(msg, link->owner->bclink.last_in); */
893 link->rcv_unacked = 0; 896 link->rcv_unacked = 0;
894 __skb_queue_tail(&link->transmq, skb); 897 __skb_queue_tail(&link->transmq, skb);
895 tipc_bearer_send(link->owner->net, link->bearer_id, 898 tipc_bearer_send(link->net, link->bearer_id,
896 skb, link->media_addr); 899 skb, link->media_addr);
897 } 900 }
898 link->snd_nxt = seqno; 901 link->snd_nxt = seqno;
@@ -966,8 +969,8 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *skb,
966 break; 969 break;
967 msg = buf_msg(skb); 970 msg = buf_msg(skb);
968 msg_set_ack(msg, mod(l_ptr->rcv_nxt - 1)); 971 msg_set_ack(msg, mod(l_ptr->rcv_nxt - 1));
969 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 972 /* msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); */
970 tipc_bearer_send(l_ptr->owner->net, l_ptr->bearer_id, skb, 973 tipc_bearer_send(l_ptr->net, l_ptr->bearer_id, skb,
971 l_ptr->media_addr); 974 l_ptr->media_addr);
972 retransmits--; 975 retransmits--;
973 l_ptr->stats.retransmitted++; 976 l_ptr->stats.retransmitted++;
@@ -1102,9 +1105,9 @@ static int tipc_link_input(struct tipc_link *l, struct sk_buff *skb,
1102 } 1105 }
1103 return 0; 1106 return 0;
1104 } else if (usr == BCAST_PROTOCOL) { 1107 } else if (usr == BCAST_PROTOCOL) {
1105 tipc_bcast_lock(l->owner->net); 1108 tipc_bcast_lock(l->net);
1106 tipc_link_bc_init_rcv(l->bc_rcvlink, hdr); 1109 tipc_link_bc_init_rcv(l->bc_rcvlink, hdr);
1107 tipc_bcast_unlock(l->owner->net); 1110 tipc_bcast_unlock(l->net);
1108 } 1111 }
1109drop: 1112drop:
1110 kfree_skb(skb); 1113 kfree_skb(skb);
@@ -1300,7 +1303,7 @@ void tipc_link_proto_xmit(struct tipc_link *l, u32 msg_typ, int probe_msg,
1300 skb = __skb_dequeue(&xmitq); 1303 skb = __skb_dequeue(&xmitq);
1301 if (!skb) 1304 if (!skb)
1302 return; 1305 return;
1303 tipc_bearer_xmit_skb(l->owner->net, l->bearer_id, skb, l->media_addr); 1306 tipc_bearer_xmit_skb(l->net, l->bearer_id, skb, l->media_addr);
1304 l->rcv_unacked = 0; 1307 l->rcv_unacked = 0;
1305} 1308}
1306 1309
@@ -2004,7 +2007,7 @@ static int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
2004 if (tipc_link_is_up(link)) 2007 if (tipc_link_is_up(link))
2005 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_UP)) 2008 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_UP))
2006 goto attr_msg_full; 2009 goto attr_msg_full;
2007 if (tipc_link_is_active(link)) 2010 if (link->active)
2008 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_ACTIVE)) 2011 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_ACTIVE))
2009 goto attr_msg_full; 2012 goto attr_msg_full;
2010 2013
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 9b5198e90fdf..eb1d7f9d5522 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -111,7 +111,7 @@ struct tipc_stats {
111 * @name: link name character string 111 * @name: link name character string
112 * @media_addr: media address to use when sending messages over link 112 * @media_addr: media address to use when sending messages over link
113 * @timer: link timer 113 * @timer: link timer
114 * @owner: pointer to peer node 114 * @net: pointer to namespace struct
115 * @refcnt: reference counter for permanent references (owner node & timer) 115 * @refcnt: reference counter for permanent references (owner node & timer)
116 * @peer_session: link session # being used by peer end of link 116 * @peer_session: link session # being used by peer end of link
117 * @peer_bearer_id: bearer id used by link's peer endpoint 117 * @peer_bearer_id: bearer id used by link's peer endpoint
@@ -154,7 +154,7 @@ struct tipc_link {
154 u32 addr; 154 u32 addr;
155 char name[TIPC_MAX_LINK_NAME]; 155 char name[TIPC_MAX_LINK_NAME];
156 struct tipc_media_addr *media_addr; 156 struct tipc_media_addr *media_addr;
157 struct tipc_node *owner; 157 struct net *net;
158 158
159 /* Management and link supervision data */ 159 /* Management and link supervision data */
160 u32 peer_session; 160 u32 peer_session;
@@ -165,6 +165,7 @@ struct tipc_link {
165 u32 abort_limit; 165 u32 abort_limit;
166 u32 state; 166 u32 state;
167 u16 peer_caps; 167 u16 peer_caps;
168 bool active;
168 u32 silent_intv_cnt; 169 u32 silent_intv_cnt;
169 struct { 170 struct {
170 unchar hdr[INT_H_SIZE]; 171 unchar hdr[INT_H_SIZE];
@@ -219,7 +220,7 @@ struct tipc_link {
219 struct tipc_stats stats; 220 struct tipc_stats stats;
220}; 221};
221 222
222bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id, 223bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
223 int tolerance, char net_plane, u32 mtu, int priority, 224 int tolerance, char net_plane, u32 mtu, int priority,
224 int window, u32 session, u32 ownnode, u32 peer, 225 int window, u32 session, u32 ownnode, u32 peer,
225 u16 peer_caps, 226 u16 peer_caps,
@@ -229,7 +230,7 @@ bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id,
229 struct sk_buff_head *inputq, 230 struct sk_buff_head *inputq,
230 struct sk_buff_head *namedq, 231 struct sk_buff_head *namedq,
231 struct tipc_link **link); 232 struct tipc_link **link);
232bool tipc_link_bc_create(struct tipc_node *n, u32 ownnode, u32 peer, 233bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer,
233 int mtu, int window, u16 peer_caps, 234 int mtu, int window, u16 peer_caps,
234 struct sk_buff_head *inputq, 235 struct sk_buff_head *inputq,
235 struct sk_buff_head *namedq, 236 struct sk_buff_head *namedq,
@@ -247,7 +248,7 @@ bool tipc_link_is_establishing(struct tipc_link *l);
247bool tipc_link_is_synching(struct tipc_link *l); 248bool tipc_link_is_synching(struct tipc_link *l);
248bool tipc_link_is_failingover(struct tipc_link *l); 249bool tipc_link_is_failingover(struct tipc_link *l);
249bool tipc_link_is_blocked(struct tipc_link *l); 250bool tipc_link_is_blocked(struct tipc_link *l);
250int tipc_link_is_active(struct tipc_link *l_ptr); 251void tipc_link_set_active(struct tipc_link *l, bool active);
251void tipc_link_purge_queues(struct tipc_link *l_ptr); 252void tipc_link_purge_queues(struct tipc_link *l_ptr);
252void tipc_link_purge_backlog(struct tipc_link *l); 253void tipc_link_purge_backlog(struct tipc_link *l);
253void tipc_link_reset(struct tipc_link *l_ptr); 254void tipc_link_reset(struct tipc_link *l_ptr);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index b27439097d6c..eb739d20ed46 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -178,7 +178,7 @@ struct tipc_node *tipc_node_create(struct net *net, u32 addr, u16 capabilities)
178 n_ptr->signature = INVALID_NODE_SIG; 178 n_ptr->signature = INVALID_NODE_SIG;
179 n_ptr->active_links[0] = INVALID_BEARER_ID; 179 n_ptr->active_links[0] = INVALID_BEARER_ID;
180 n_ptr->active_links[1] = INVALID_BEARER_ID; 180 n_ptr->active_links[1] = INVALID_BEARER_ID;
181 if (!tipc_link_bc_create(n_ptr, tipc_own_addr(net), n_ptr->addr, 181 if (!tipc_link_bc_create(net, tipc_own_addr(net), n_ptr->addr,
182 U16_MAX, tipc_bc_sndlink(net)->window, 182 U16_MAX, tipc_bc_sndlink(net)->window,
183 n_ptr->capabilities, 183 n_ptr->capabilities,
184 &n_ptr->bc_entry.inputq1, 184 &n_ptr->bc_entry.inputq1,
@@ -366,7 +366,10 @@ static void __tipc_node_link_up(struct tipc_node *n, int bearer_id,
366 pr_debug("Old link <%s> becomes standby\n", ol->name); 366 pr_debug("Old link <%s> becomes standby\n", ol->name);
367 *slot0 = bearer_id; 367 *slot0 = bearer_id;
368 *slot1 = bearer_id; 368 *slot1 = bearer_id;
369 tipc_link_set_active(nl, true);
370 tipc_link_set_active(ol, false);
369 } else if (nl->priority == ol->priority) { 371 } else if (nl->priority == ol->priority) {
372 tipc_link_set_active(nl, true);
370 *slot0 = bearer_id; 373 *slot0 = bearer_id;
371 } else { 374 } else {
372 pr_debug("New link <%s> is standby\n", nl->name); 375 pr_debug("New link <%s> is standby\n", nl->name);
@@ -599,7 +602,7 @@ void tipc_node_check_dest(struct net *net, u32 onode,
599 goto exit; 602 goto exit;
600 } 603 }
601 if_name = strchr(b->name, ':') + 1; 604 if_name = strchr(b->name, ':') + 1;
602 if (!tipc_link_create(n, if_name, b->identity, b->tolerance, 605 if (!tipc_link_create(net, if_name, b->identity, b->tolerance,
603 b->net_plane, b->mtu, b->priority, 606 b->net_plane, b->mtu, b->priority,
604 b->window, mod(tipc_net(net)->random), 607 b->window, mod(tipc_net(net)->random),
605 tipc_own_addr(net), onode, 608 tipc_own_addr(net), onode,