[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1450339417-31254-1-git-send-email-zyjzyj2000@gmail.com>
Date: Thu, 17 Dec 2015 16:03:37 +0800
From: <zyjzyj2000@...il.com>
To: <j.vosburgh@...il.com>, <vfalico@...il.com>,
<gospo@...ulusnetworks.com>, <netdev@...r.kernel.org>,
<Boris.Shteinbock@...driver.com>
Subject: [PATCH 1/1] bonding: restrict up state in 802.3ad mode
From: Zhu Yanjun <zyjzyj2000@...il.com>
In 802.3ad mode, the speed and duplex is needed. But in some NIC,
there is a time span between NIC up state and getting speed and duplex.
As such, sometimes a slave in 802.3ad mode is in up state without
speed and duplex. This will make bonding in 802.3ad mode can not
work well.
To make bonding driver be compatible with more NICs, it is
necessary to restrict the up state in 802.3ad mode.
Signed-off-by: Zhu Yanjun <zyjzyj2000@...il.com>
---
drivers/net/bonding/bond_main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9e0f8a7..0a80fb3 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1991,6 +1991,25 @@ static int bond_miimon_inspect(struct bonding *bond)
link_state = bond_check_dev_link(bond, slave->dev, 0);
+ /* Since some NIC has time span between netif_running and
+ * getting speed and duples. That is, after a NIC is up (netif_running),
+ * there is a time span before this NIC is negotiated with speed and duplex.
+ * During this time span, the slave in 802.3ad is configured without speed
+ * and duplex. This 802.3ad bonding will not work because it needs slave's speed
+ * and duplex to generate key field.
+ * As such, we restrict up in 802.3ad mode to: netif_running && peed != SPEED_UNKNOWN &&
+ * duplex != DUPLEX_UNKNOWN
+ */
+ if ((BMSR_LSTATUS == link_state) &&
+ (BOND_MODE(bond) == BOND_MODE_8023AD)) {
+ bond_update_speed_duplex(slave);
+ if ((slave->speed == SPEED_UNKNOWN) ||
+ (slave->duplex == DUPLEX_UNKNOWN)) {
+ link_state = 0;
+ netdev_info(bond->dev, "In 802.3ad mode, it is not enough to up without speed and duplex");
+ }
+ }
+
switch (slave->link) {
case BOND_LINK_UP:
if (link_state)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists