Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6628012ybe; Wed, 18 Sep 2019 06:38:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGgGj2BZRNXJ2dWzqNom6Bq5Nq8zD0DWscejeBwzRyo/N6a4mq6dezIk/5m10i9x/yPhVh X-Received: by 2002:a50:d758:: with SMTP id i24mr10300839edj.246.1568813922726; Wed, 18 Sep 2019 06:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568813922; cv=none; d=google.com; s=arc-20160816; b=H5QJ3AbA/tXgcxIXHSqjkBCUc3WPg4GDK/BsRfjzEuogO2iByc7EP1W6hjtiCPTOAY LNyVdR6/pmzAmb+CD/Q9hmSVhL415yMNTMiK0mtEcvKXu4/iXOeedw6gq5BdmK/P3i05 NrV3SpyKmTYHIea6DGp++2laqlvqBsuSsu/m6sG1HavVAM+fReFrNLYgdVyLRwv6sewn jeDQIjb8kDp0+jLLHl8UZ589o52zsdRg0jguATkOOO7gxJ78xyheMcxFiUyczo5BvQVv d3saWwLTLxS2YjzOOXmiQPQVG30xpJdO0DtynM+6iaGgRBIAbrW67/Ft7ma5c1K0zw7w SchQ== 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:to :from; bh=jy7f7sy9DRu6VZRBGoVWZoGDsLoxFpvAqHgvPHOorFk=; b=KjtZpSUY42DmB2AKJEt5wNKqhj/M0OxwhR8mhptLJ7DfuSfzEt3m9KVUMINusojmrb cADAT4Z0khgEnq1V2jw0oH5eNYBg8vWsJls3eT92gq0zmUdma4JbRfFJMMV9uFfbzSQR cGcrvrRmw+6g35ApsdCOiCt8o8N0v2jxQBdhxCK1UfUQY+qKYUTD7lU+CdH5kGzxJHge fBTCN8obIZynTNVHr7LP1Yv4vnKlgANx2QxBPRzOC3QwlLseS49UGn/JXQEap9NMXK+H FSNELnlgMLSUedjQnnngcbV7ERfuydfMGhWUnZPRBKOkJf7hhpWUs3AP+IC+5Xxsx9bB ebQA== 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 z9si3390436edz.77.2019.09.18.06.38.19; Wed, 18 Sep 2019 06:38:42 -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 S1729691AbfIRNGb (ORCPT + 99 others); Wed, 18 Sep 2019 09:06:31 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2295 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727001AbfIRNGa (ORCPT ); Wed, 18 Sep 2019 09:06:30 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 28F47FAD28D6745F03BD; Wed, 18 Sep 2019 21:06:27 +0800 (CST) Received: from localhost (10.177.220.209) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Wed, 18 Sep 2019 21:06:20 +0800 From: To: , , , , , , , , , Subject: [PATCH v3] bonding: force enable lacp port after link state recovery for 802.3ad Date: Wed, 18 Sep 2019 21:06:20 +0800 Message-ID: <20190918130620.8556-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_DOWN 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 call bond_3ad_handle_link_change() in bond_miimon_commit, this function can enable lacp after port slave speed check. 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 931d9d9..76324a5 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2206,7 +2206,8 @@ static void bond_miimon_commit(struct bonding *bond) */ if (BOND_MODE(bond) == BOND_MODE_8023AD && slave->link == BOND_LINK_UP) - bond_3ad_adapter_speed_duplex_changed(slave); + bond_3ad_handle_link_change(slave, + BOND_LINK_UP); continue; case BOND_LINK_UP: -- 1.8.3.1