Skip to content

Commit 34b9cd6

Browse files
Jon Paul Maloydavem330
authored andcommitted
tipc: let first message on link be a state message
According to the link FSM, a received traffic packet can take a link from state ESTABLISHING to ESTABLISHED, but the link can still not be fully set up in one atomic operation. This means that even if the the very first packet on the link is a traffic packet with sequence number 1 (one), it has to be dropped and retransmitted. This can be avoided if we let the mentioned packet be preceded by a LINK_PROTOCOL/STATE message, which takes up the endpoint before the arrival of the traffic. We add this small feature in this commit. This is a fully compatible change. Acked-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>
1 parent de7e07f commit 34b9cd6

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎net/tipc/link.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,12 +1107,12 @@ static bool tipc_link_release_pkts(struct tipc_link *l, u16 acked)
11071107
return released;
11081108
}
11091109

1110-
/* tipc_link_build_ack_msg: prepare link acknowledge message for transmission
1110+
/* tipc_link_build_state_msg: prepare link state message for transmission
11111111
*
11121112
* Note that sending of broadcast ack is coordinated among nodes, to reduce
11131113
* risk of ack storms towards the sender
11141114
*/
1115-
int tipc_link_build_ack_msg(struct tipc_link *l, struct sk_buff_head *xmitq)
1115+
int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq)
11161116
{
11171117
if (!l)
11181118
return 0;
@@ -1222,7 +1222,7 @@ int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
12221222
if (!tipc_data_input(l, skb, l->inputq))
12231223
rc |= tipc_link_input(l, skb, l->inputq);
12241224
if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN))
1225-
rc |= tipc_link_build_ack_msg(l, xmitq);
1225+
rc |= tipc_link_build_state_msg(l, xmitq);
12261226
if (unlikely(rc & ~TIPC_LINK_SND_BC_ACK))
12271227
break;
12281228
} while ((skb = __skb_dequeue(defq)));

‎net/tipc/link.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
123123
int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq);
124124
int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
125125
struct sk_buff_head *xmitq);
126-
int tipc_link_build_ack_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
126+
int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
127127
void tipc_link_add_bc_peer(struct tipc_link *snd_l,
128128
struct tipc_link *uc_l,
129129
struct sk_buff_head *xmitq);

‎net/tipc/node.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,9 @@ static void __tipc_node_link_up(struct tipc_node *n, int bearer_id,
545545
pr_debug("Established link <%s> on network plane %c\n",
546546
tipc_link_name(nl), tipc_link_plane(nl));
547547

548+
/* Ensure that a STATE message goes first */
549+
tipc_link_build_state_msg(nl, xmitq);
550+
548551
/* First link? => give it both slots */
549552
if (!ol) {
550553
*slot0 = bearer_id;
@@ -1283,7 +1286,7 @@ static void tipc_node_bc_rcv(struct net *net, struct sk_buff *skb, int bearer_id
12831286
/* Broadcast ACKs are sent on a unicast link */
12841287
if (rc & TIPC_LINK_SND_BC_ACK) {
12851288
tipc_node_read_lock(n);
1286-
tipc_link_build_ack_msg(le->link, &xmitq);
1289+
tipc_link_build_state_msg(le->link, &xmitq);
12871290
tipc_node_read_unlock(n);
12881291
}
12891292

0 commit comments

Comments
 (0)