Oracle-bug: 12377284
Signed-off-by: John Haxby <john.haxby@oracle.com>

   This is a port of the upstream commit
   4cd6fe1c6483cde93e2ec91f58b7af9c9eea51ad that prevents an
   aggregator being chosen if its link is down.

   Note that an earlier version of this patch also included the
   ability to set the carrier according to the output of the selection
   logic: this is already present in later RH kernels (though of
   course it would never set the carrier down).

diff -up a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
--- a/drivers/net/bonding/bond_3ad.c	2011-12-19 11:20:08.000000000 +0000
+++ b/drivers/net/bonding/bond_3ad.c	2011-12-19 12:05:46.000000000 +0000
@@ -1416,6 +1416,15 @@ static void ad_port_selection_logic(stru
 	}
 }
 
+static int agg_device_up(const struct aggregator *agg)
+{
+	struct port *port = agg->lag_ports;
+	if (!port)
+		return 0;
+	return (netif_running(port->slave->dev) &&
+		netif_carrier_ok(port->slave->dev));
+}
+
 /**
  * ad_agg_selection_logic - select an aggregation group for a team
  * @aggregator: the aggregator we're looking at
@@ -1496,7 +1505,7 @@ static void ad_agg_selection_logic(struc
 						}
 					}
 				}
-			} else {
+			} else if (agg_device_up(aggregator)) {
 				best_aggregator=aggregator;
 			}
 		}
