Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a97b9d3f authored by Jon Paul Maloy's avatar Jon Paul Maloy Committed by David S. Miller
Browse files

tipc: rename fields in struct tipc_link



We rename some fields in struct tipc_link, in order to give them more
descriptive names:

next_in_no -> rcv_nxt
next_out_no-> snd_nxt
fsm_msg_cnt-> silent_intv_cnt
cont_intv  -> keepalive_intv
last_retransmitted -> last_retransm

There are no functional changes in this commit.

Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e4bf4f76
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -118,16 +118,16 @@ static void bclink_set_last_sent(struct net *net)
	struct sk_buff *skb = skb_peek(&bcl->backlogq);
	struct sk_buff *skb = skb_peek(&bcl->backlogq);


	if (skb)
	if (skb)
		bcl->fsm_msg_cnt = mod(buf_seqno(skb) - 1);
		bcl->silent_intv_cnt = mod(buf_seqno(skb) - 1);
	else
	else
		bcl->fsm_msg_cnt = mod(bcl->next_out_no - 1);
		bcl->silent_intv_cnt = mod(bcl->snd_nxt - 1);
}
}


u32 tipc_bclink_get_last_sent(struct net *net)
u32 tipc_bclink_get_last_sent(struct net *net)
{
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);
	struct tipc_net *tn = net_generic(net, tipc_net_id);


	return tn->bcl->fsm_msg_cnt;
	return tn->bcl->silent_intv_cnt;
}
}


static void bclink_update_last_sent(struct tipc_node *node, u32 seqno)
static void bclink_update_last_sent(struct tipc_node *node, u32 seqno)
@@ -212,16 +212,16 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
		 * or both sent and unsent messages (otherwise)
		 * or both sent and unsent messages (otherwise)
		 */
		 */
		if (tn->bclink->bcast_nodes.count)
		if (tn->bclink->bcast_nodes.count)
			acked = tn->bcl->fsm_msg_cnt;
			acked = tn->bcl->silent_intv_cnt;
		else
		else
			acked = tn->bcl->next_out_no;
			acked = tn->bcl->snd_nxt;
	} else {
	} else {
		/*
		/*
		 * Bail out if specified sequence number does not correspond
		 * Bail out if specified sequence number does not correspond
		 * to a message that has been sent and not yet acknowledged
		 * to a message that has been sent and not yet acknowledged
		 */
		 */
		if (less(acked, buf_seqno(skb)) ||
		if (less(acked, buf_seqno(skb)) ||
		    less(tn->bcl->fsm_msg_cnt, acked) ||
		    less(tn->bcl->silent_intv_cnt, acked) ||
		    less_eq(acked, n_ptr->bclink.acked))
		    less_eq(acked, n_ptr->bclink.acked))
			goto exit;
			goto exit;
	}
	}
@@ -803,9 +803,9 @@ int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg)
		goto attr_msg_full;
		goto attr_msg_full;
	if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name))
	if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name))
		goto attr_msg_full;
		goto attr_msg_full;
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, bcl->next_in_no))
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, bcl->rcv_nxt))
		goto attr_msg_full;
		goto attr_msg_full;
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, bcl->next_out_no))
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, bcl->snd_nxt))
		goto attr_msg_full;
		goto attr_msg_full;


	prop = nla_nest_start(msg->skb, TIPC_NLA_LINK_PROP);
	prop = nla_nest_start(msg->skb, TIPC_NLA_LINK_PROP);
@@ -914,7 +914,7 @@ int tipc_bclink_init(struct net *net)
	__skb_queue_head_init(&bcl->backlogq);
	__skb_queue_head_init(&bcl->backlogq);
	__skb_queue_head_init(&bcl->deferdq);
	__skb_queue_head_init(&bcl->deferdq);
	skb_queue_head_init(&bcl->wakeupq);
	skb_queue_head_init(&bcl->wakeupq);
	bcl->next_out_no = 1;
	bcl->snd_nxt = 1;
	spin_lock_init(&bclink->node.lock);
	spin_lock_init(&bclink->node.lock);
	__skb_queue_head_init(&bclink->arrvq);
	__skb_queue_head_init(&bclink->arrvq);
	skb_queue_head_init(&bclink->inputq);
	skb_queue_head_init(&bclink->inputq);
+78 −77
Original line number Original line Diff line number Diff line
@@ -233,7 +233,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,


	if (n_ptr->link_cnt >= MAX_BEARERS) {
	if (n_ptr->link_cnt >= MAX_BEARERS) {
		tipc_addr_string_fill(addr_string, n_ptr->addr);
		tipc_addr_string_fill(addr_string, n_ptr->addr);
		pr_err("Attempt to establish %uth link to %s. Max %u allowed.\n",
		pr_err("Cannot establish %uth link to %s. Max %u allowed.\n",
		       n_ptr->link_cnt, addr_string, MAX_BEARERS);
		       n_ptr->link_cnt, addr_string, MAX_BEARERS);
		return NULL;
		return NULL;
	}
	}
@@ -280,7 +280,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
	l_ptr->mtu = l_ptr->advertised_mtu;
	l_ptr->mtu = l_ptr->advertised_mtu;
	l_ptr->priority = b_ptr->priority;
	l_ptr->priority = b_ptr->priority;
	tipc_link_set_queue_limits(l_ptr, b_ptr->window);
	tipc_link_set_queue_limits(l_ptr, b_ptr->window);
	l_ptr->next_out_no = 1;
	l_ptr->snd_nxt = 1;
	__skb_queue_head_init(&l_ptr->transmq);
	__skb_queue_head_init(&l_ptr->transmq);
	__skb_queue_head_init(&l_ptr->backlogq);
	__skb_queue_head_init(&l_ptr->backlogq);
	__skb_queue_head_init(&l_ptr->deferdq);
	__skb_queue_head_init(&l_ptr->deferdq);
@@ -450,9 +450,9 @@ void tipc_link_reset(struct tipc_link *l_ptr)


	if (was_active_link && tipc_node_is_up(l_ptr->owner) && (pl != l_ptr)) {
	if (was_active_link && tipc_node_is_up(l_ptr->owner) && (pl != l_ptr)) {
		l_ptr->flags |= LINK_FAILINGOVER;
		l_ptr->flags |= LINK_FAILINGOVER;
		l_ptr->failover_checkpt = l_ptr->next_in_no;
		l_ptr->failover_checkpt = l_ptr->rcv_nxt;
		pl->failover_pkts = FIRST_FAILOVER;
		pl->failover_pkts = FIRST_FAILOVER;
		pl->failover_checkpt = l_ptr->next_in_no;
		pl->failover_checkpt = l_ptr->rcv_nxt;
		pl->failover_skb = l_ptr->reasm_buf;
		pl->failover_skb = l_ptr->reasm_buf;
	} else {
	} else {
		kfree_skb(l_ptr->reasm_buf);
		kfree_skb(l_ptr->reasm_buf);
@@ -469,8 +469,8 @@ void tipc_link_reset(struct tipc_link *l_ptr)
	l_ptr->reasm_buf = NULL;
	l_ptr->reasm_buf = NULL;
	l_ptr->rcv_unacked = 0;
	l_ptr->rcv_unacked = 0;
	l_ptr->checkpoint = 1;
	l_ptr->checkpoint = 1;
	l_ptr->next_out_no = 1;
	l_ptr->snd_nxt = 1;
	l_ptr->fsm_msg_cnt = 0;
	l_ptr->silent_intv_cnt = 0;
	l_ptr->stale_count = 0;
	l_ptr->stale_count = 0;
	link_reset_statistics(l_ptr);
	link_reset_statistics(l_ptr);
}
}
@@ -479,7 +479,7 @@ static void link_activate(struct tipc_link *link)
{
{
	struct tipc_node *node = link->owner;
	struct tipc_node *node = link->owner;


	link->next_in_no = 1;
	link->rcv_nxt = 1;
	link->stats.recv_info = 1;
	link->stats.recv_info = 1;
	tipc_node_link_up(node, link);
	tipc_node_link_up(node, link);
	tipc_bearer_add_dest(node->net, link->bearer_id, link->addr);
	tipc_bearer_add_dest(node->net, link->bearer_id, link->addr);
@@ -493,7 +493,7 @@ static void link_activate(struct tipc_link *link)
static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
{
{
	struct tipc_link *other;
	struct tipc_link *other;
	unsigned long cont_intv = l_ptr->cont_intv;
	unsigned long timer_intv = l_ptr->keepalive_intv;


	if (l_ptr->flags & LINK_STOPPED)
	if (l_ptr->flags & LINK_STOPPED)
		return;
		return;
@@ -503,7 +503,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)


	if (l_ptr->flags & LINK_FAILINGOVER) {
	if (l_ptr->flags & LINK_FAILINGOVER) {
		if (event == TIMEOUT_EVT)
		if (event == TIMEOUT_EVT)
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
		return;
		return;
	}
	}


@@ -514,32 +514,32 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
		case ACTIVATE_MSG:
		case ACTIVATE_MSG:
			break;
			break;
		case TIMEOUT_EVT:
		case TIMEOUT_EVT:
			if (l_ptr->next_in_no != l_ptr->checkpoint) {
			if (l_ptr->rcv_nxt != l_ptr->checkpoint) {
				l_ptr->checkpoint = l_ptr->next_in_no;
				l_ptr->checkpoint = l_ptr->rcv_nxt;
				if (tipc_bclink_acks_missing(l_ptr->owner)) {
				if (tipc_bclink_acks_missing(l_ptr->owner)) {
					tipc_link_proto_xmit(l_ptr, STATE_MSG,
					tipc_link_proto_xmit(l_ptr, STATE_MSG,
							     0, 0, 0, 0);
							     0, 0, 0, 0);
					l_ptr->fsm_msg_cnt++;
					l_ptr->silent_intv_cnt++;
				}
				}
				link_set_timer(l_ptr, cont_intv);
				link_set_timer(l_ptr, timer_intv);
				break;
				break;
			}
			}
			l_ptr->state = WORKING_UNKNOWN;
			l_ptr->state = WORKING_UNKNOWN;
			l_ptr->fsm_msg_cnt = 0;
			l_ptr->silent_intv_cnt = 0;
			tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0);
			tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		case RESET_MSG:
		case RESET_MSG:
			pr_debug("%s<%s>, requested by peer\n",
			pr_debug("%s<%s>, requested by peer\n",
				 link_rst_msg, l_ptr->name);
				 link_rst_msg, l_ptr->name);
			tipc_link_reset(l_ptr);
			tipc_link_reset(l_ptr);
			l_ptr->state = RESET_RESET;
			l_ptr->state = RESET_RESET;
			l_ptr->fsm_msg_cnt = 0;
			l_ptr->silent_intv_cnt = 0;
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
					     0, 0, 0, 0);
					     0, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		default:
		default:
			pr_debug("%s%u in WW state\n", link_unk_evt, event);
			pr_debug("%s%u in WW state\n", link_unk_evt, event);
@@ -550,46 +550,47 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
		case TRAFFIC_MSG_EVT:
		case TRAFFIC_MSG_EVT:
		case ACTIVATE_MSG:
		case ACTIVATE_MSG:
			l_ptr->state = WORKING_WORKING;
			l_ptr->state = WORKING_WORKING;
			l_ptr->fsm_msg_cnt = 0;
			l_ptr->silent_intv_cnt = 0;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		case RESET_MSG:
		case RESET_MSG:
			pr_debug("%s<%s>, requested by peer while probing\n",
			pr_debug("%s<%s>, requested by peer while probing\n",
				 link_rst_msg, l_ptr->name);
				 link_rst_msg, l_ptr->name);
			tipc_link_reset(l_ptr);
			tipc_link_reset(l_ptr);
			l_ptr->state = RESET_RESET;
			l_ptr->state = RESET_RESET;
			l_ptr->fsm_msg_cnt = 0;
			l_ptr->silent_intv_cnt = 0;
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
					     0, 0, 0, 0);
					     0, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		case TIMEOUT_EVT:
		case TIMEOUT_EVT:
			if (l_ptr->next_in_no != l_ptr->checkpoint) {
			if (l_ptr->rcv_nxt != l_ptr->checkpoint) {
				l_ptr->state = WORKING_WORKING;
				l_ptr->state = WORKING_WORKING;
				l_ptr->fsm_msg_cnt = 0;
				l_ptr->silent_intv_cnt = 0;
				l_ptr->checkpoint = l_ptr->next_in_no;
				l_ptr->checkpoint = l_ptr->rcv_nxt;
				if (tipc_bclink_acks_missing(l_ptr->owner)) {
				if (tipc_bclink_acks_missing(l_ptr->owner)) {
					tipc_link_proto_xmit(l_ptr, STATE_MSG,
					tipc_link_proto_xmit(l_ptr, STATE_MSG,
							     0, 0, 0, 0);
							     0, 0, 0, 0);
					l_ptr->fsm_msg_cnt++;
					l_ptr->silent_intv_cnt++;
				}
				}
				link_set_timer(l_ptr, cont_intv);
				link_set_timer(l_ptr, timer_intv);
			} else if (l_ptr->fsm_msg_cnt < l_ptr->abort_limit) {
			} else if (l_ptr->silent_intv_cnt <
				   l_ptr->abort_limit) {
				tipc_link_proto_xmit(l_ptr, STATE_MSG,
				tipc_link_proto_xmit(l_ptr, STATE_MSG,
						     1, 0, 0, 0);
						     1, 0, 0, 0);
				l_ptr->fsm_msg_cnt++;
				l_ptr->silent_intv_cnt++;
				link_set_timer(l_ptr, cont_intv);
				link_set_timer(l_ptr, timer_intv);
			} else {	/* Link has failed */
			} else {	/* Link has failed */
				pr_debug("%s<%s>, peer not responding\n",
				pr_debug("%s<%s>, peer not responding\n",
					 link_rst_msg, l_ptr->name);
					 link_rst_msg, l_ptr->name);
				tipc_link_reset(l_ptr);
				tipc_link_reset(l_ptr);
				l_ptr->state = RESET_UNKNOWN;
				l_ptr->state = RESET_UNKNOWN;
				l_ptr->fsm_msg_cnt = 0;
				l_ptr->silent_intv_cnt = 0;
				tipc_link_proto_xmit(l_ptr, RESET_MSG,
				tipc_link_proto_xmit(l_ptr, RESET_MSG,
						     0, 0, 0, 0);
						     0, 0, 0, 0);
				l_ptr->fsm_msg_cnt++;
				l_ptr->silent_intv_cnt++;
				link_set_timer(l_ptr, cont_intv);
				link_set_timer(l_ptr, timer_intv);
			}
			}
			break;
			break;
		default:
		default:
@@ -605,31 +606,31 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
			if (other && link_working_unknown(other))
			if (other && link_working_unknown(other))
				break;
				break;
			l_ptr->state = WORKING_WORKING;
			l_ptr->state = WORKING_WORKING;
			l_ptr->fsm_msg_cnt = 0;
			l_ptr->silent_intv_cnt = 0;
			link_activate(l_ptr);
			link_activate(l_ptr);
			tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0);
			tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			if (l_ptr->owner->working_links == 1)
			if (l_ptr->owner->working_links == 1)
				tipc_link_sync_xmit(l_ptr);
				tipc_link_sync_xmit(l_ptr);
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		case RESET_MSG:
		case RESET_MSG:
			l_ptr->state = RESET_RESET;
			l_ptr->state = RESET_RESET;
			l_ptr->fsm_msg_cnt = 0;
			l_ptr->silent_intv_cnt = 0;
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
					     1, 0, 0, 0);
					     1, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		case STARTING_EVT:
		case STARTING_EVT:
			l_ptr->flags |= LINK_STARTED;
			l_ptr->flags |= LINK_STARTED;
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		case TIMEOUT_EVT:
		case TIMEOUT_EVT:
			tipc_link_proto_xmit(l_ptr, RESET_MSG, 0, 0, 0, 0);
			tipc_link_proto_xmit(l_ptr, RESET_MSG, 0, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		default:
		default:
			pr_err("%s%u in RU state\n", link_unk_evt, event);
			pr_err("%s%u in RU state\n", link_unk_evt, event);
@@ -643,21 +644,21 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
			if (other && link_working_unknown(other))
			if (other && link_working_unknown(other))
				break;
				break;
			l_ptr->state = WORKING_WORKING;
			l_ptr->state = WORKING_WORKING;
			l_ptr->fsm_msg_cnt = 0;
			l_ptr->silent_intv_cnt = 0;
			link_activate(l_ptr);
			link_activate(l_ptr);
			tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0);
			tipc_link_proto_xmit(l_ptr, STATE_MSG, 1, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			if (l_ptr->owner->working_links == 1)
			if (l_ptr->owner->working_links == 1)
				tipc_link_sync_xmit(l_ptr);
				tipc_link_sync_xmit(l_ptr);
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		case RESET_MSG:
		case RESET_MSG:
			break;
			break;
		case TIMEOUT_EVT:
		case TIMEOUT_EVT:
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
			tipc_link_proto_xmit(l_ptr, ACTIVATE_MSG,
					     0, 0, 0, 0);
					     0, 0, 0, 0);
			l_ptr->fsm_msg_cnt++;
			l_ptr->silent_intv_cnt++;
			link_set_timer(l_ptr, cont_intv);
			link_set_timer(l_ptr, timer_intv);
			break;
			break;
		default:
		default:
			pr_err("%s%u in RR state\n", link_unk_evt, event);
			pr_err("%s%u in RR state\n", link_unk_evt, event);
@@ -685,8 +686,8 @@ int __tipc_link_xmit(struct net *net, struct tipc_link *link,
	unsigned int maxwin = link->window;
	unsigned int maxwin = link->window;
	unsigned int imp = msg_importance(msg);
	unsigned int imp = msg_importance(msg);
	uint mtu = link->mtu;
	uint mtu = link->mtu;
	u16 ack = mod(link->next_in_no - 1);
	u16 ack = mod(link->rcv_nxt - 1);
	u16 seqno = link->next_out_no;
	u16 seqno = link->snd_nxt;
	u16 bc_last_in = link->owner->bclink.last_in;
	u16 bc_last_in = link->owner->bclink.last_in;
	struct tipc_media_addr *addr = &link->media_addr;
	struct tipc_media_addr *addr = &link->media_addr;
	struct sk_buff_head *transmq = &link->transmq;
	struct sk_buff_head *transmq = &link->transmq;
@@ -729,7 +730,7 @@ int __tipc_link_xmit(struct net *net, struct tipc_link *link,
		link->backlog[imp].len++;
		link->backlog[imp].len++;
		seqno++;
		seqno++;
	}
	}
	link->next_out_no = seqno;
	link->snd_nxt = seqno;
	return 0;
	return 0;
}
}


@@ -859,7 +860,7 @@ void tipc_link_push_packets(struct tipc_link *link)
{
{
	struct sk_buff *skb;
	struct sk_buff *skb;
	struct tipc_msg *msg;
	struct tipc_msg *msg;
	u16 ack = mod(link->next_in_no - 1);
	u16 ack = mod(link->rcv_nxt - 1);


	while (skb_queue_len(&link->transmq) < link->window) {
	while (skb_queue_len(&link->transmq) < link->window) {
		skb = __skb_dequeue(&link->backlogq);
		skb = __skb_dequeue(&link->backlogq);
@@ -946,13 +947,13 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *skb,
	msg = buf_msg(skb);
	msg = buf_msg(skb);


	/* Detect repeated retransmit failures */
	/* Detect repeated retransmit failures */
	if (l_ptr->last_retransmitted == msg_seqno(msg)) {
	if (l_ptr->last_retransm == msg_seqno(msg)) {
		if (++l_ptr->stale_count > 100) {
		if (++l_ptr->stale_count > 100) {
			link_retransmit_failure(l_ptr, skb);
			link_retransmit_failure(l_ptr, skb);
			return;
			return;
		}
		}
	} else {
	} else {
		l_ptr->last_retransmitted = msg_seqno(msg);
		l_ptr->last_retransm = msg_seqno(msg);
		l_ptr->stale_count = 1;
		l_ptr->stale_count = 1;
	}
	}


@@ -960,7 +961,7 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *skb,
		if (!retransmits)
		if (!retransmits)
			break;
			break;
		msg = buf_msg(skb);
		msg = buf_msg(skb);
		msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
		msg_set_ack(msg, mod(l_ptr->rcv_nxt - 1));
		msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
		msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
		tipc_bearer_send(l_ptr->owner->net, l_ptr->bearer_id, skb,
		tipc_bearer_send(l_ptr->owner->net, l_ptr->bearer_id, skb,
				 &l_ptr->media_addr);
				 &l_ptr->media_addr);
@@ -983,11 +984,11 @@ static bool link_synch(struct tipc_link *l)
		goto synched;
		goto synched;


	/* Was last pre-synch packet added to input queue ? */
	/* Was last pre-synch packet added to input queue ? */
	if (less_eq(pl->next_in_no, l->synch_point))
	if (less_eq(pl->rcv_nxt, l->synch_point))
		return false;
		return false;


	/* Is it still in the input queue ? */
	/* Is it still in the input queue ? */
	post_synch = mod(pl->next_in_no - l->synch_point) - 1;
	post_synch = mod(pl->rcv_nxt - l->synch_point) - 1;
	if (skb_queue_len(&pl->inputq) > post_synch)
	if (skb_queue_len(&pl->inputq) > post_synch)
		return false;
		return false;
synched:
synched:
@@ -1004,7 +1005,7 @@ static void link_retrieve_defq(struct tipc_link *link,
		return;
		return;


	seq_no = buf_seqno(skb_peek(&link->deferdq));
	seq_no = buf_seqno(skb_peek(&link->deferdq));
	if (seq_no == link->next_in_no)
	if (seq_no == link->rcv_nxt)
		skb_queue_splice_tail_init(&link->deferdq, list);
		skb_queue_splice_tail_init(&link->deferdq, list);
}
}


@@ -1119,7 +1120,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b_ptr)
		}
		}


		/* Link is now in state WORKING_WORKING */
		/* Link is now in state WORKING_WORKING */
		if (unlikely(seq_no != l_ptr->next_in_no)) {
		if (unlikely(seq_no != l_ptr->rcv_nxt)) {
			link_handle_out_of_seq_msg(l_ptr, skb);
			link_handle_out_of_seq_msg(l_ptr, skb);
			link_retrieve_defq(l_ptr, &head);
			link_retrieve_defq(l_ptr, &head);
			skb = NULL;
			skb = NULL;
@@ -1130,7 +1131,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b_ptr)
			if (!link_synch(l_ptr))
			if (!link_synch(l_ptr))
				goto unlock;
				goto unlock;
		}
		}
		l_ptr->next_in_no++;
		l_ptr->rcv_nxt++;
		if (unlikely(!skb_queue_empty(&l_ptr->deferdq)))
		if (unlikely(!skb_queue_empty(&l_ptr->deferdq)))
			link_retrieve_defq(l_ptr, &head);
			link_retrieve_defq(l_ptr, &head);
		if (unlikely(++l_ptr->rcv_unacked >= TIPC_MIN_LINK_WIN)) {
		if (unlikely(++l_ptr->rcv_unacked >= TIPC_MIN_LINK_WIN)) {
@@ -1301,7 +1302,7 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
	 * Discard packet if a duplicate; otherwise add it to deferred queue
	 * Discard packet if a duplicate; otherwise add it to deferred queue
	 * and notify peer of gap as per protocol specification
	 * and notify peer of gap as per protocol specification
	 */
	 */
	if (less(seq_no, l_ptr->next_in_no)) {
	if (less(seq_no, l_ptr->rcv_nxt)) {
		l_ptr->stats.duplicates++;
		l_ptr->stats.duplicates++;
		kfree_skb(buf);
		kfree_skb(buf);
		return;
		return;
@@ -1343,7 +1344,7 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg,
	msg_set_last_bcast(msg, tipc_bclink_get_last_sent(l_ptr->owner->net));
	msg_set_last_bcast(msg, tipc_bclink_get_last_sent(l_ptr->owner->net));


	if (msg_typ == STATE_MSG) {
	if (msg_typ == STATE_MSG) {
		u16 next_sent = l_ptr->next_out_no;
		u16 next_sent = l_ptr->snd_nxt;


		if (!tipc_link_is_up(l_ptr))
		if (!tipc_link_is_up(l_ptr))
			return;
			return;
@@ -1352,7 +1353,7 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg,
		msg_set_next_sent(msg, next_sent);
		msg_set_next_sent(msg, next_sent);
		if (!skb_queue_empty(&l_ptr->deferdq)) {
		if (!skb_queue_empty(&l_ptr->deferdq)) {
			last_rcv = buf_seqno(skb_peek(&l_ptr->deferdq));
			last_rcv = buf_seqno(skb_peek(&l_ptr->deferdq));
			gap = mod(last_rcv - l_ptr->next_in_no);
			gap = mod(last_rcv - l_ptr->rcv_nxt);
		}
		}
		msg_set_seq_gap(msg, gap);
		msg_set_seq_gap(msg, gap);
		if (gap)
		if (gap)
@@ -1360,7 +1361,7 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg,
		msg_set_link_tolerance(msg, tolerance);
		msg_set_link_tolerance(msg, tolerance);
		msg_set_linkprio(msg, priority);
		msg_set_linkprio(msg, priority);
		msg_set_max_pkt(msg, l_ptr->mtu);
		msg_set_max_pkt(msg, l_ptr->mtu);
		msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
		msg_set_ack(msg, mod(l_ptr->rcv_nxt - 1));
		msg_set_probe(msg, probe_msg != 0);
		msg_set_probe(msg, probe_msg != 0);
		if (probe_msg)
		if (probe_msg)
			l_ptr->stats.sent_probes++;
			l_ptr->stats.sent_probes++;
@@ -1380,7 +1381,7 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg,
	msg_set_linkprio(msg, l_ptr->priority);
	msg_set_linkprio(msg, l_ptr->priority);
	msg_set_size(msg, msg_size);
	msg_set_size(msg, msg_size);


	msg_set_seqno(msg, mod(l_ptr->next_out_no + (0xffff/2)));
	msg_set_seqno(msg, mod(l_ptr->snd_nxt + (0xffff / 2)));


	buf = tipc_buf_acquire(msg_size);
	buf = tipc_buf_acquire(msg_size);
	if (!buf)
	if (!buf)
@@ -1486,8 +1487,8 @@ static void tipc_link_proto_rcv(struct tipc_link *l_ptr,
		if (link_reset_unknown(l_ptr))
		if (link_reset_unknown(l_ptr))
			break;
			break;


		if (less_eq(l_ptr->next_in_no, msg_next_sent(msg)))
		if (less_eq(l_ptr->rcv_nxt, msg_next_sent(msg)))
			rec_gap = mod(msg_next_sent(msg) - l_ptr->next_in_no);
			rec_gap = mod(msg_next_sent(msg) - l_ptr->rcv_nxt);


		if (msg_probe(msg))
		if (msg_probe(msg))
			l_ptr->stats.recv_probes++;
			l_ptr->stats.recv_probes++;
@@ -1634,7 +1635,7 @@ void tipc_link_dup_queue_xmit(struct tipc_link *link,
		struct tipc_msg *msg = buf_msg(skb);
		struct tipc_msg *msg = buf_msg(skb);
		u32 len = msg_size(msg);
		u32 len = msg_size(msg);


		msg_set_ack(msg, mod(link->next_in_no - 1));
		msg_set_ack(msg, mod(link->rcv_nxt - 1));
		msg_set_bcast_ack(msg, link->owner->bclink.last_in);
		msg_set_bcast_ack(msg, link->owner->bclink.last_in);
		msg_set_size(&tnl_hdr, len + INT_H_SIZE);
		msg_set_size(&tnl_hdr, len + INT_H_SIZE);
		outskb = tipc_buf_acquire(len + INT_H_SIZE);
		outskb = tipc_buf_acquire(len + INT_H_SIZE);
@@ -1723,8 +1724,8 @@ static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tol)
		return;
		return;


	l_ptr->tolerance = tol;
	l_ptr->tolerance = tol;
	l_ptr->cont_intv = msecs_to_jiffies(intv);
	l_ptr->keepalive_intv = msecs_to_jiffies(intv);
	l_ptr->abort_limit = tol / (jiffies_to_msecs(l_ptr->cont_intv));
	l_ptr->abort_limit = tol / (jiffies_to_msecs(l_ptr->keepalive_intv));
}
}


void tipc_link_set_queue_limits(struct tipc_link *l, u32 win)
void tipc_link_set_queue_limits(struct tipc_link *l, u32 win)
@@ -1784,8 +1785,8 @@ static struct tipc_node *tipc_link_find_owner(struct net *net,
static void link_reset_statistics(struct tipc_link *l_ptr)
static void link_reset_statistics(struct tipc_link *l_ptr)
{
{
	memset(&l_ptr->stats, 0, sizeof(l_ptr->stats));
	memset(&l_ptr->stats, 0, sizeof(l_ptr->stats));
	l_ptr->stats.sent_info = l_ptr->next_out_no;
	l_ptr->stats.sent_info = l_ptr->snd_nxt;
	l_ptr->stats.recv_info = l_ptr->next_in_no;
	l_ptr->stats.recv_info = l_ptr->rcv_nxt;
}
}


static void link_print(struct tipc_link *l_ptr, const char *str)
static void link_print(struct tipc_link *l_ptr, const char *str)
@@ -2018,9 +2019,9 @@ static int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
		goto attr_msg_full;
		goto attr_msg_full;
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_MTU, link->mtu))
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_MTU, link->mtu))
		goto attr_msg_full;
		goto attr_msg_full;
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, link->next_in_no))
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, link->rcv_nxt))
		goto attr_msg_full;
		goto attr_msg_full;
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, link->next_out_no))
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, link->snd_nxt))
		goto attr_msg_full;
		goto attr_msg_full;


	if (tipc_link_is_up(link))
	if (tipc_link_is_up(link))
+10 −10
Original line number Original line Diff line number Diff line
@@ -112,25 +112,25 @@ struct tipc_stats {
 * @peer_bearer_id: bearer id used by link's peer endpoint
 * @peer_bearer_id: bearer id used by link's peer endpoint
 * @bearer_id: local bearer id used by link
 * @bearer_id: local bearer id used by link
 * @tolerance: minimum link continuity loss needed to reset link [in ms]
 * @tolerance: minimum link continuity loss needed to reset link [in ms]
 * @cont_intv: link continuity testing interval
 * @keepalive_intv: link keepalive timer interval
 * @abort_limit: # of unacknowledged continuity probes needed to reset link
 * @abort_limit: # of unacknowledged continuity probes needed to reset link
 * @state: current state of link FSM
 * @state: current state of link FSM
 * @fsm_msg_cnt: # of protocol messages link FSM has sent in current state
 * @silent_intv_cnt: # of timer intervals without any reception from peer
 * @proto_msg: template for control messages generated by link
 * @proto_msg: template for control messages generated by link
 * @pmsg: convenience pointer to "proto_msg" field
 * @pmsg: convenience pointer to "proto_msg" field
 * @priority: current link priority
 * @priority: current link priority
 * @net_plane: current link network plane ('A' through 'H')
 * @net_plane: current link network plane ('A' through 'H')
 * @backlog_limit: backlog queue congestion thresholds (indexed by importance)
 * @backlog_limit: backlog queue congestion thresholds (indexed by importance)
 * @exp_msg_count: # of tunnelled messages expected during link changeover
 * @exp_msg_count: # of tunnelled messages expected during link changeover
 * @reset_checkpoint: seq # of last acknowledged message at time of link reset
 * @reset_rcv_checkpt: seq # of last acknowledged message at time of link reset
 * @mtu: current maximum packet size for this link
 * @mtu: current maximum packet size for this link
 * @advertised_mtu: advertised own mtu when link is being established
 * @advertised_mtu: advertised own mtu when link is being established
 * @transmitq: queue for sent, non-acked messages
 * @transmitq: queue for sent, non-acked messages
 * @backlogq: queue for messages waiting to be sent
 * @backlogq: queue for messages waiting to be sent
 * @next_out_no: next sequence number to use for outbound messages
 * @snt_nxt: next sequence number to use for outbound messages
 * @last_retransmitted: sequence number of most recently retransmitted message
 * @last_retransmitted: sequence number of most recently retransmitted message
 * @stale_count: # of identical retransmit requests made by peer
 * @stale_count: # of identical retransmit requests made by peer
 * @next_in_no: next sequence number to expect for inbound messages
 * @rcv_nxt: next sequence number to expect for inbound messages
 * @deferred_queue: deferred queue saved OOS b'cast message received from node
 * @deferred_queue: deferred queue saved OOS b'cast message received from node
 * @unacked_window: # of inbound messages rx'd without ack'ing back to peer
 * @unacked_window: # of inbound messages rx'd without ack'ing back to peer
 * @inputq: buffer queue for messages to be delivered upwards
 * @inputq: buffer queue for messages to be delivered upwards
@@ -156,10 +156,10 @@ struct tipc_link {
	u32 peer_bearer_id;
	u32 peer_bearer_id;
	u32 bearer_id;
	u32 bearer_id;
	u32 tolerance;
	u32 tolerance;
	unsigned long cont_intv;
	unsigned long keepalive_intv;
	u32 abort_limit;
	u32 abort_limit;
	int state;
	int state;
	u32 fsm_msg_cnt;
	u32 silent_intv_cnt;
	struct {
	struct {
		unchar hdr[INT_H_SIZE];
		unchar hdr[INT_H_SIZE];
		unchar body[TIPC_MAX_IF_NAME];
		unchar body[TIPC_MAX_IF_NAME];
@@ -185,13 +185,13 @@ struct tipc_link {
		u16 len;
		u16 len;
		u16 limit;
		u16 limit;
	} backlog[5];
	} backlog[5];
	u16 next_out_no;
	u16 snd_nxt;
	u16 last_retransmitted;
	u16 last_retransm;
	u32 window;
	u32 window;
	u32 stale_count;
	u32 stale_count;


	/* Reception */
	/* Reception */
	u16 next_in_no;
	u16 rcv_nxt;
	u32 rcv_unacked;
	u32 rcv_unacked;
	struct sk_buff_head deferdq;
	struct sk_buff_head deferdq;
	struct sk_buff_head inputq;
	struct sk_buff_head inputq;