All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next 0/2] tipc: two small cleanups
@ 2018-01-04 14:20 Jon Maloy
  2018-01-04 14:20 ` [net-next 1/2] tipc: some clarifying name changes Jon Maloy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jon Maloy @ 2018-01-04 14:20 UTC (permalink / raw)
  To: davem, netdev
  Cc: mohan.krishna.ghanta.krishnamurthy, tung.q.nguyen, hoang.h.le,
	jon.maloy, canh.d.luu, ying.xue, tipc-discussion

These two commits are based on commit f9c935db8086 ("tipc: fix 
problems with multipoint-to-point flow control") which has been
applied to 'net' but not yet to 'net-next'.

Jon Maloy (2):
  tipc: some clarifying name changes
  tipc: simplify small window members' sorting algorithm

 net/tipc/group.c | 53 ++++++++++++++++++++++++-----------------------------
 1 file changed, 24 insertions(+), 29 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [net-next 1/2] tipc: some clarifying name changes
  2018-01-04 14:20 [net-next 0/2] tipc: two small cleanups Jon Maloy
@ 2018-01-04 14:20 ` Jon Maloy
  2018-01-04 14:20 ` [net-next 2/2] tipc: simplify small window members' sorting algorithm Jon Maloy
  2018-01-05 18:37 ` [net-next 0/2] tipc: two small cleanups David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jon Maloy @ 2018-01-04 14:20 UTC (permalink / raw)
  To: davem, netdev
  Cc: tipc-discussion, hoang.h.le, mohan.krishna.ghanta.krishnamurthy

We rename some functions and variables, to make their purpose clearer.

- tipc_group::congested -> tipc_group::small_win. Members in this list
  are not necessarily (and typically) congested. Instead, they may
  *potentially* be subject to congestion because their send window is
  less than ADV_IDLE, and therefore need to be checked during message
  transmission.

- tipc_group_is_receiver() -> tipc_group_is_sender(). This socket will
  accept messages coming from members fulfilling this condition, i.e.,
  they are senders from this member's viewpoint.

- tipc_group_is_enabled() -> tipc_group_is_receiver(). Members
  fulfilling this condition will accept messages sent from the current
  socket, i.e., they are receivers from its viewpoint.

There are no functional changes in this commit.

Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/group.c | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/net/tipc/group.c b/net/tipc/group.c
index 5f4ffae..6c99511 100644
--- a/net/tipc/group.c
+++ b/net/tipc/group.c
@@ -64,7 +64,7 @@ enum mbr_state {
 struct tipc_member {
 	struct rb_node tree_node;
 	struct list_head list;
-	struct list_head congested;
+	struct list_head small_win;
 	struct sk_buff *event_msg;
 	struct sk_buff_head deferredq;
 	struct tipc_group *group;
@@ -82,7 +82,7 @@ struct tipc_member {
 
 struct tipc_group {
 	struct rb_root members;
-	struct list_head congested;
+	struct list_head small_win;
 	struct list_head pending;
 	struct list_head active;
 	struct list_head reclaiming;
@@ -137,12 +137,12 @@ u16 tipc_group_bc_snd_nxt(struct tipc_group *grp)
 	return grp->bc_snd_nxt;
 }
 
-static bool tipc_group_is_enabled(struct tipc_member *m)
+static bool tipc_group_is_receiver(struct tipc_member *m)
 {
 	return m->state != MBR_QUARANTINED && m->state != MBR_LEAVING;
 }
 
-static bool tipc_group_is_receiver(struct tipc_member *m)
+static bool tipc_group_is_sender(struct tipc_member *m)
 {
 	return m && m->state >= MBR_JOINED;
 }
@@ -169,7 +169,7 @@ struct tipc_group *tipc_group_create(struct net *net, u32 portid,
 	if (!grp)
 		return NULL;
 	tipc_nlist_init(&grp->dests, tipc_own_addr(net));
-	INIT_LIST_HEAD(&grp->congested);
+	INIT_LIST_HEAD(&grp->small_win);
 	INIT_LIST_HEAD(&grp->active);
 	INIT_LIST_HEAD(&grp->pending);
 	INIT_LIST_HEAD(&grp->reclaiming);
@@ -233,7 +233,7 @@ static struct tipc_member *tipc_group_find_dest(struct tipc_group *grp,
 	struct tipc_member *m;
 
 	m = tipc_group_find_member(grp, node, port);
-	if (m && tipc_group_is_enabled(m))
+	if (m && tipc_group_is_receiver(m))
 		return m;
 	return NULL;
 }
@@ -286,7 +286,7 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
 	if (!m)
 		return NULL;
 	INIT_LIST_HEAD(&m->list);
-	INIT_LIST_HEAD(&m->congested);
+	INIT_LIST_HEAD(&m->small_win);
 	__skb_queue_head_init(&m->deferredq);
 	m->group = grp;
 	m->node = node;
@@ -315,7 +315,7 @@ static void tipc_group_delete_member(struct tipc_group *grp,
 		grp->bc_ackers--;
 
 	list_del_init(&m->list);
-	list_del_init(&m->congested);
+	list_del_init(&m->small_win);
 	tipc_group_decr_active(grp, m);
 
 	/* If last member on a node, remove node from dest list */
@@ -344,7 +344,7 @@ void tipc_group_update_member(struct tipc_member *m, int len)
 	struct tipc_group *grp = m->group;
 	struct tipc_member *_m, *tmp;
 
-	if (!tipc_group_is_enabled(m))
+	if (!tipc_group_is_receiver(m))
 		return;
 
 	m->window -= len;
@@ -352,16 +352,16 @@ void tipc_group_update_member(struct tipc_member *m, int len)
 	if (m->window >= ADV_IDLE)
 		return;
 
-	list_del_init(&m->congested);
+	list_del_init(&m->small_win);
 
-	/* Sort member into congested members' list */
-	list_for_each_entry_safe(_m, tmp, &grp->congested, congested) {
+	/* Sort member into small_window members' list */
+	list_for_each_entry_safe(_m, tmp, &grp->small_win, small_win) {
 		if (m->window > _m->window)
 			continue;
-		list_add_tail(&m->congested, &_m->congested);
+		list_add_tail(&m->small_win, &_m->small_win);
 		return;
 	}
-	list_add_tail(&m->congested, &grp->congested);
+	list_add_tail(&m->small_win, &grp->small_win);
 }
 
 void tipc_group_update_bc_members(struct tipc_group *grp, int len, bool ack)
@@ -373,7 +373,7 @@ void tipc_group_update_bc_members(struct tipc_group *grp, int len, bool ack)
 
 	for (n = rb_first(&grp->members); n; n = rb_next(n)) {
 		m = container_of(n, struct tipc_member, tree_node);
-		if (tipc_group_is_enabled(m)) {
+		if (tipc_group_is_receiver(m)) {
 			tipc_group_update_member(m, len);
 			m->bc_acked = prev;
 			ackers++;
@@ -428,10 +428,10 @@ bool tipc_group_bc_cong(struct tipc_group *grp, int len)
 	if (grp->bc_ackers)
 		return true;
 
-	if (list_empty(&grp->congested))
+	if (list_empty(&grp->small_win))
 		return false;
 
-	m = list_first_entry(&grp->congested, struct tipc_member, congested);
+	m = list_first_entry(&grp->small_win, struct tipc_member, small_win);
 	if (m->window >= len)
 		return false;
 
@@ -486,7 +486,7 @@ void tipc_group_filter_msg(struct tipc_group *grp, struct sk_buff_head *inputq,
 		goto drop;
 
 	m = tipc_group_find_member(grp, node, port);
-	if (!tipc_group_is_receiver(m))
+	if (!tipc_group_is_sender(m))
 		goto drop;
 
 	if (less(msg_grp_bc_seqno(hdr), m->bc_rcv_nxt))
@@ -703,7 +703,7 @@ void tipc_group_proto_rcv(struct tipc_group *grp, bool *usr_wakeup,
 			msg_set_grp_bc_seqno(ehdr, m->bc_syncpt);
 			__skb_queue_tail(inputq, m->event_msg);
 		}
-		list_del_init(&m->congested);
+		list_del_init(&m->small_win);
 		tipc_group_update_member(m, 0);
 		return;
 	case GRP_LEAVE_MSG:
@@ -711,7 +711,7 @@ void tipc_group_proto_rcv(struct tipc_group *grp, bool *usr_wakeup,
 			return;
 		m->bc_syncpt = msg_grp_bc_syncpt(hdr);
 		list_del_init(&m->list);
-		list_del_init(&m->congested);
+		list_del_init(&m->small_win);
 		*usr_wakeup = true;
 
 		/* Wait until WITHDRAW event is received */
@@ -731,7 +731,7 @@ void tipc_group_proto_rcv(struct tipc_group *grp, bool *usr_wakeup,
 		m->window += msg_adv_win(hdr);
 		*usr_wakeup = m->usr_pending;
 		m->usr_pending = false;
-		list_del_init(&m->congested);
+		list_del_init(&m->small_win);
 		return;
 	case GRP_ACK_MSG:
 		if (!m)
@@ -854,7 +854,7 @@ void tipc_group_member_evt(struct tipc_group *grp,
 		if (m->window < ADV_IDLE)
 			tipc_group_update_member(m, 0);
 		else
-			list_del_init(&m->congested);
+			list_del_init(&m->small_win);
 	} else if (event == TIPC_WITHDRAWN) {
 		if (!m)
 			goto drop;
@@ -887,7 +887,7 @@ void tipc_group_member_evt(struct tipc_group *grp,
 			__skb_queue_tail(inputq, skb);
 		}
 		list_del_init(&m->list);
-		list_del_init(&m->congested);
+		list_del_init(&m->small_win);
 	}
 	*sk_rcvbuf = tipc_group_rcvbuf_limit(grp);
 	return;
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [net-next 2/2] tipc: simplify small window members' sorting algorithm
  2018-01-04 14:20 [net-next 0/2] tipc: two small cleanups Jon Maloy
  2018-01-04 14:20 ` [net-next 1/2] tipc: some clarifying name changes Jon Maloy
@ 2018-01-04 14:20 ` Jon Maloy
  2018-01-05 18:37 ` [net-next 0/2] tipc: two small cleanups David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jon Maloy @ 2018-01-04 14:20 UTC (permalink / raw)
  To: davem, netdev
  Cc: tipc-discussion, hoang.h.le, mohan.krishna.ghanta.krishnamurthy

We simplify the sorting algorithm in tipc_update_member(). We also make
the remaining conditional call to this function unconditional, since the
same condition now is tested for inside the said function.

Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/group.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/net/tipc/group.c b/net/tipc/group.c
index 6c99511..3e8268d 100644
--- a/net/tipc/group.c
+++ b/net/tipc/group.c
@@ -356,12 +356,10 @@ void tipc_group_update_member(struct tipc_member *m, int len)
 
 	/* Sort member into small_window members' list */
 	list_for_each_entry_safe(_m, tmp, &grp->small_win, small_win) {
-		if (m->window > _m->window)
-			continue;
-		list_add_tail(&m->small_win, &_m->small_win);
-		return;
+		if (_m->window > m->window)
+			break;
 	}
-	list_add_tail(&m->small_win, &grp->small_win);
+	list_add_tail(&m->small_win, &_m->small_win);
 }
 
 void tipc_group_update_bc_members(struct tipc_group *grp, int len, bool ack)
@@ -851,10 +849,7 @@ void tipc_group_member_evt(struct tipc_group *grp,
 		m->instance = instance;
 		TIPC_SKB_CB(skb)->orig_member = m->instance;
 		tipc_group_proto_xmit(grp, m, GRP_JOIN_MSG, xmitq);
-		if (m->window < ADV_IDLE)
-			tipc_group_update_member(m, 0);
-		else
-			list_del_init(&m->small_win);
+		tipc_group_update_member(m, 0);
 	} else if (event == TIPC_WITHDRAWN) {
 		if (!m)
 			goto drop;
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net-next 0/2] tipc: two small cleanups
  2018-01-04 14:20 [net-next 0/2] tipc: two small cleanups Jon Maloy
  2018-01-04 14:20 ` [net-next 1/2] tipc: some clarifying name changes Jon Maloy
  2018-01-04 14:20 ` [net-next 2/2] tipc: simplify small window members' sorting algorithm Jon Maloy
@ 2018-01-05 18:37 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-01-05 18:37 UTC (permalink / raw)
  To: jon.maloy
  Cc: netdev, tipc-discussion, hoang.h.le, mohan.krishna.ghanta.krishnamurthy

From: Jon Maloy <jon.maloy@ericsson.com>
Date: Thu, 4 Jan 2018 15:20:43 +0100

> These two commits are based on commit f9c935db8086 ("tipc: fix 
> problems with multipoint-to-point flow control") which has been
> applied to 'net' but not yet to 'net-next'.

Series applied, thanks Jon.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-05 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 14:20 [net-next 0/2] tipc: two small cleanups Jon Maloy
2018-01-04 14:20 ` [net-next 1/2] tipc: some clarifying name changes Jon Maloy
2018-01-04 14:20 ` [net-next 2/2] tipc: simplify small window members' sorting algorithm Jon Maloy
2018-01-05 18:37 ` [net-next 0/2] tipc: two small cleanups David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.