Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4075746ybl; Tue, 20 Aug 2019 06:42:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDpYgmExDHtnVVX289UO3yPDibPWqGfFI0gY58d9NCq5C1HrjPk1OQQSnHDLAc56bdjKJN X-Received: by 2002:a17:90a:8a11:: with SMTP id w17mr10810pjn.139.1566308524653; Tue, 20 Aug 2019 06:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566308524; cv=none; d=google.com; s=arc-20160816; b=H/1U0bLoe5/mR4WY1BNH4kH14Oo13slVGig+1Wo8PvtKLfvQNorboOESo00CYqyycL O/MlE5+OicWzZCzb0J5nETKQ6i1bAWFkhfkJlooT8qLgV9cvqUvpQgC4UGH5uk2QEi03 kFDx49l8uo8zMSuA8Nd0Ro+pDl3fZub+HLdYbSYbVlIX6UatBbmNnZ98osBNeLc50cbb H/U2rSrbKfZ48RV0e/djmSF9zLUnGox6JgxYtxlsspgugqN86uSqrOyYPo4wl4SSCXl5 GmzvrtJ2LKeQGdrLJYiCHlT70xcxzXdQZ+Fx7FvkORFhjrrBMRiyM99XG5nClqbkGvSg K91w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=bQFyk3gz4puhNGgfGps7iPFxJG4yoQ4P1iVuN/woer4=; b=dj14lcbY0wkLe2JSmFleNYLfiOTu6axecCCcbWhKNDYX/T9RjBZnD4fD0DbzCgJoiL g3Pmlika2Qa3x/HjdwKCC/kyi1JKkdd5w8lhoHrSEnIel9GbhPt29cVVuOA7vRstkeFD tsXtefiuHbOA58wLwBIY4JutagLIxICiWM0rZscyLVq1rH2nzrBjFgHnzCmM2ab/pKNq gqF8tkTTqkU9C2TnUvV8Vpnl7YzM0kbqhjVaW0RVsb64L0xzWe+6aPxfk7FlnixMCvOX gHGgdvDUubuSgtuov3Yjm/epr+vHCCiUglXXTjqoPD1SplgmxumcHAPsB2xn+0b5NZBO TSpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si211761ple.224.2019.08.20.06.41.49; Tue, 20 Aug 2019 06:42:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729956AbfHTNij (ORCPT + 99 others); Tue, 20 Aug 2019 09:38:39 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:39258 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728947AbfHTNii (ORCPT ); Tue, 20 Aug 2019 09:38:38 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9E7C1243BF4AA7F1792B; Tue, 20 Aug 2019 21:38:29 +0800 (CST) Received: from localhost (10.177.220.209) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Tue, 20 Aug 2019 21:38:23 +0800 From: To: , , , CC: , , , , , Subject: [PATCH] bonding: force enable lacp port after link state recovery for 802.3ad Date: Tue, 20 Aug 2019 21:38:22 +0800 Message-ID: <20190820133822.2508-1-zhangsha.zhang@huawei.com> X-Mailer: git-send-email 2.17.0.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.220.209] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sha Zhang After the commit 334031219a84 ("bonding/802.3ad: fix slave link initialization transition states") merged, the slave's link status will be changed to BOND_LINK_FAIL from BOND_LINK_DOWN in the following scenario: - Driver reports loss of carrier and bonding driver receives NETDEV_CHANGE notifier - slave's duplex and speed is zerod and its port->is_enabled is cleard to 'false'; - Driver reports link recovery and bonding driver receives NETDEV_UP notifier; - If speed/duplex getting failed here, the link status will be changed to BOND_LINK_FAIL; - The MII monotor later recover the slave's speed/duplex and set link status to BOND_LINK_UP, but remains the 'port->is_enabled' to 'false'. In this scenario, the lacp port will not be enabled even its speed and duplex are valid. The bond will not send LACPDU's, and its state is 'AD_STATE_DEFAULTED' forever. The simplest fix I think is to force enable lacp after port slave speed check in bond_miimon_commit. As enabled, the lacp port can run its state machine normally after link recovery. Signed-off-by: Sha Zhang --- drivers/net/bonding/bond_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 931d9d9..379253a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2194,6 +2194,7 @@ static void bond_miimon_commit(struct bonding *bond) { struct list_head *iter; struct slave *slave, *primary; + struct port *port; bond_for_each_slave(bond, slave, iter) { switch (slave->new_link) { @@ -2205,8 +2206,13 @@ static void bond_miimon_commit(struct bonding *bond) * link status */ if (BOND_MODE(bond) == BOND_MODE_8023AD && - slave->link == BOND_LINK_UP) + slave->link == BOND_LINK_UP) { bond_3ad_adapter_speed_duplex_changed(slave); + if (slave->duplex == DUPLEX_FULL) { + port = &(SLAVE_AD_INFO(slave)->port); + port->is_enabled = true; + } + } continue; case BOND_LINK_UP: -- 1.8.3.1