From: Jon Maloy <jon.maloy@ericsson.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: tipc-discussion@lists.sourceforge.net, hoang.h.le@dektech.com.au,
mohan.krishna.ghanta.krishnamurthy@ericsson.com
Subject: [net-next 2/2] tipc: simplify small window members' sorting algorithm
Date: Thu, 4 Jan 2018 15:20:45 +0100 [thread overview]
Message-ID: <1515075645-19480-3-git-send-email-jon.maloy@ericsson.com> (raw)
In-Reply-To: <1515075645-19480-1-git-send-email-jon.maloy@ericsson.com>
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
next prev parent reply other threads:[~2018-01-04 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2018-01-05 18:37 ` [net-next 0/2] tipc: two small cleanups David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1515075645-19480-3-git-send-email-jon.maloy@ericsson.com \
--to=jon.maloy@ericsson.com \
--cc=davem@davemloft.net \
--cc=hoang.h.le@dektech.com.au \
--cc=mohan.krishna.ghanta.krishnamurthy@ericsson.com \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox