Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp937561ybl; Fri, 23 Aug 2019 10:35:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyl9xEUGv4nWdr6gC1e7+HaqupXvBFUyKjmSwMwHjAMTssksft3l4yh1dtenoHNr4PG24S+ X-Received: by 2002:a17:902:8696:: with SMTP id g22mr6129026plo.122.1566581706023; Fri, 23 Aug 2019 10:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566581706; cv=none; d=google.com; s=arc-20160816; b=T58CL6zjcrgfHgAdsx/YC1vjGkW/zUVwanhO4C64J7jIKftmJ2TL6oVT2JGx7eccBV kJz6VVuQu3rq/+C1jcHVjzVccR/i1haMCewoD28/ZwCd3hkasWPd/cVbS7IOXcz5baXe B7Mrq2HKtr3f20m2OThHstr2sDwpYwGtWS38Lcoc6J4Ql0hbUEYva8SzO+GvNDRUAaD+ bnWVmr+sj7Y7ouRp9v3lCm2SKsMODRFlsLm+JpChU0QDnrpdo3PR/jbKjwR8g60GUn1q YGQG7MBwjFLQiiY3EGreeaGUtogJPeBQ4OcNIEDNO9BmeSoEXmZOxErHZmJPVXrlSMib hJUg== 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=t5m+zuhYDWrTZ/YiruHEAWf0wqxe/+dbHLGT3HSnJ/I=; b=1JT/bh324iOTp8eQAsMmJrxEWQplZywayn7jSc/UEmf0D58AGlGgutqHEcRc7Gps1q gln80FrPhQqthLnPGKyuLY3PUzEkGnQZqKrvdeqgNLxMUUaLEIXu3dbERpfdOlRerJZA 0saiP80hrieaXCiopbvWTj5Iea1rvisWsavd+Rtkthi9BPyayNBwKVFbJHW5ZRBtdre8 nBhehyJbybRW+AbjRFc6A83gvkGiXmSmurzcrcVtx3n+7LaoipzEjW/A5yor9Y5HQ02d XZfz1q8VSRCyeLR5dgZyOfFLP8iR1Uf3mxMYxuYdyzQLH/+nvp3MA7AqfCBxRgYMmk1s 7ARQ== 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 h1si2961038pls.183.2019.08.23.10.34.51; Fri, 23 Aug 2019 10:35:06 -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 S2391646AbfHWDmY (ORCPT + 99 others); Thu, 22 Aug 2019 23:42:24 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:60332 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732546AbfHWDmY (ORCPT ); Thu, 22 Aug 2019 23:42:24 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8BC8A4FF4B98D984327F; Fri, 23 Aug 2019 11:42:19 +0800 (CST) Received: from localhost (10.177.220.209) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Fri, 23 Aug 2019 11:42:10 +0800 From: To: , , , CC: , , , , , Subject: [PATCH v2] bonding: force enable lacp port after link state recovery for 802.3ad Date: Fri, 23 Aug 2019 11:42:09 +0800 Message-ID: <20190823034209.14596-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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 931d9d9..ef4ec99 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2206,7 +2206,7 @@ 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