From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: [PATCH 1/1] bonding: restrict up state in 802.3ad mode Date: Thu, 7 Jan 2016 14:15:13 +0800 Message-ID: <1452147313-22886-1-git-send-email-zyjzyj2000@gmail.com> References: <87618083B2453E4A8714035B62D6799250504549@FMSMSX105.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , To: , , Return-path: Received: from mail5.windriver.com ([192.103.53.11]:33260 "EHLO mail5.wrs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbcAGGOa (ORCPT ); Thu, 7 Jan 2016 01:14:30 -0500 In-Reply-To: <87618083B2453E4A8714035B62D6799250504549@FMSMSX105.amr.corp.intel.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Zhu Yanjun 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 --- drivers/net/bonding/bond_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 09f8a48..7df8af5 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1991,6 +1991,17 @@ static int bond_miimon_inspect(struct bonding *bond) link_state = bond_check_dev_link(bond, slave->dev, 0); + if ((BMSR_LSTATUS == link_state) && + (BOND_MODE(bond) == BOND_MODE_8023AD)) { + rtnl_lock(); + bond_update_speed_duplex(slave); + rtnl_unlock(); + 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