netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] tipc: tipc_bcbearer_send(): simplify bearer selection
@ 2013-04-29 14:13 Gerlando Falauto
  2013-04-29 14:13 ` [PATCH v2 2/2] tipc: pskb_copy() buffers when sending on more than one bearer Gerlando Falauto
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Gerlando Falauto @ 2013-04-29 14:13 UTC (permalink / raw)
  To: netdev; +Cc: jon.maloy, erik.hugne, ying.xue, holger.brunck, Gerlando Falauto

Also some minor cosmetic improvements and comment style changes

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
---
 net/tipc/bcast.c |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 2655c9f..be1f945 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -584,8 +584,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
 {
 	int bp_index;
 
-	/*
-	 * Prepare broadcast link message for reliable transmission,
+	/* Prepare broadcast link message for reliable transmission,
 	 * if first time trying to send it;
 	 * preparation is skipped for broadcast link protocol messages
 	 * since they are sent in an unreliable manner and don't need it
@@ -610,31 +609,33 @@ 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 *b = p;
 		struct tipc_bearer *s = bcbearer->bpairs[bp_index].secondary;
 
 		if (!p)
-			break;	/* no more bearers to try */
+			break;	/* No more bearers to try */
+
+		if (tipc_bearer_blocked(p)) {
+			if (!s || tipc_bearer_blocked(s))
+				continue; /* Can't use either bearer */
+			b = s;
+		}
 
-		tipc_nmap_diff(&bcbearer->remains, &p->nodes, &bcbearer->remains_new);
+		tipc_nmap_diff(&bcbearer->remains, &b->nodes,
+			&bcbearer->remains_new);
 		if (bcbearer->remains_new.count == bcbearer->remains.count)
-			continue;	/* bearer pair doesn't add anything */
+			continue;  /* Nothing added by bearer pair */
 
-		if (!tipc_bearer_blocked(p))
-			tipc_bearer_send(p, buf, &p->media->bcast_addr);
-		else if (s && !tipc_bearer_blocked(s))
-			/* unable to send on primary bearer */
-			tipc_bearer_send(s, buf, &s->media->bcast_addr);
-		else
-			/* unable to send on either bearer */
-			continue;
+		tipc_bearer_send(b, buf, &s->media->bcast_addr);
 
+		/* Swap bearers for next packet */
 		if (s) {
 			bcbearer->bpairs[bp_index].primary = s;
 			bcbearer->bpairs[bp_index].secondary = p;
 		}
 
 		if (bcbearer->remains_new.count == 0)
-			break;	/* all targets reached */
+			break;	/* All targets reached */
 
 		bcbearer->remains = bcbearer->remains_new;
 	}
-- 
1.7.10.1

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

end of thread, other threads:[~2013-05-01 17:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-29 14:13 [PATCH v2 1/2] tipc: tipc_bcbearer_send(): simplify bearer selection Gerlando Falauto
2013-04-29 14:13 ` [PATCH v2 2/2] tipc: pskb_copy() buffers when sending on more than one bearer Gerlando Falauto
2013-04-29 19:45   ` David Miller
2013-04-29 19:44 ` [PATCH v2 1/2] tipc: tipc_bcbearer_send(): simplify bearer selection David Miller
2013-04-30  7:33 ` [PATCH v3 1/3] tipc: cosmetic: clean up comments Gerlando Falauto
2013-04-30  7:33   ` [PATCH v3 2/3] tipc: tipc_bcbearer_send(): simplify bearer selection Gerlando Falauto
2013-04-30  7:33   ` [PATCH v3 3/3] tipc: pskb_copy() buffers when sending on more than one bearer Gerlando Falauto
2013-04-30 11:54   ` [PATCH v3 1/3] tipc: cosmetic: clean up comments Sergei Shtylyov
2013-04-30 19:07     ` David Miller
2013-05-01  7:37     ` Gerlando Falauto
2013-05-01 16:18       ` Sergei Shtylyov
2013-05-01 16:41         ` [PATCH v3b 1/3] tipc: cosmetic: clean up comments and break a long line Gerlando Falauto
2013-05-01 17:16           ` David Miller
2013-05-01 17:35             ` Gerlando Falauto
2013-05-01 17:43               ` David Miller
2013-05-01 17:56                 ` Gerlando Falauto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).