Patchwork [v5,2/3] tipc: tipc_bcbearer_send(): simplify bearer selection

login
register
mail settings
Submitter Gerlando Falauto
Date May 1, 2013, 10:04 p.m.
Message ID <1367445886-30879-2-git-send-email-gerlando.falauto@keymile.com>
Download mbox | patch
Permalink /patch/240823/
State Accepted
Delegated to: David Miller
Headers show

Comments

Gerlando Falauto - May 1, 2013, 10:04 p.m.
Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
---
Changes from v4:
* Rebased on net-next 
* fixed bcast_addr (no longer within b->media)
Changes from v3: NONE
Changes from v2:
* Fixed non-bisectability; was tipc_bearer_send(b, buf, &s->media...)

 net/tipc/bcast.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Patch

diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 0e2f432..d9d848d 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -610,23 +610,23 @@  static int tipc_bcbearer_send(struct sk_buff *buf,
 	for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
 		struct tipc_bearer *p = bcbearer->bpairs[bp_index].primary;
 		struct tipc_bearer *s = bcbearer->bpairs[bp_index].secondary;
+		struct tipc_bearer *b = p;
 
 		if (!p)
 			break; /* No more bearers to try */
 
-		tipc_nmap_diff(&bcbearer->remains, &p->nodes,
+		if (tipc_bearer_blocked(p)) {
+			if (!s || tipc_bearer_blocked(s))
+				continue; /* Can't use either bearer */
+			b = s;
+		}
+
+		tipc_nmap_diff(&bcbearer->remains, &b->nodes,
 			       &bcbearer->remains_new);
 		if (bcbearer->remains_new.count == bcbearer->remains.count)
 			continue; /* Nothing added by bearer pair */
 
-		if (!tipc_bearer_blocked(p))
-			tipc_bearer_send(p, buf, &p->bcast_addr);
-		else if (s && !tipc_bearer_blocked(s))
-			/* unable to send on primary bearer */
-			tipc_bearer_send(s, buf, &s->bcast_addr);
-		else
-			/* unable to send on either bearer */
-			continue;
+		tipc_bearer_send(b, buf, &b->bcast_addr);
 
 		/* Swap bearers for next packet */
 		if (s) {