Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp335727pxb; Thu, 26 Aug 2021 04:27:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnDggcWfBKKqMTLyOUbDTsp69sNe7y8WsKvM64z9yRkplJ9eGe+WAJn6ft0NM7TxcNNNKB X-Received: by 2002:a5d:8b04:: with SMTP id k4mr2615434ion.58.1629977258809; Thu, 26 Aug 2021 04:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629977258; cv=none; d=google.com; s=arc-20160816; b=O/ZzXTxlrvr+oJmnjxkKW95h9mXcVL562GnkbLJlJU+TWiI9IVQLBXB/T+EiKm78uc oFk/jfYqXwa8ZsBsr40r3HwCrSgxfVPq3v1ohs0g4ey0yXHW5WecJDq0OeeqioUt3Cg/ NP2PHoq91xmaeOBe70zjRGrcwexJPU6R4WEFwHKZAfvOZl0CKPEzkQGCVE/ZMSF8Nm75 UYOYdCuG+SqCYwhp00YIDcobjLAmEnzGz4CXca/NYXS3DpAUsYpg1hylZ8wAdcPHQliY 7enND2A3Q6vDLeZVNKUq+iVXfRKhqA3zZxuZYnv/2v3kz/Cn0WADsnwbVJnHBZxQcls6 yoWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=JgrZ8m3ykz6aVwVdcSySVdlmUBPrIPncClZnbKS1UZU=; b=W5aIgR3YibcZaD7BO9OLvAaWInOQh+xyWZChvSm9ux+irIdjurD6FlXmXiWOuv10d2 i0nMoJq9OWdB1evCkYhBqUmV2/deEAZUi0YL1FDNE3URrpBHI21IRiL41ypa8YgGMOYv hMK+/iRWADJ9A5m6CXHno+3NAMuwNi3YWnSBbdTNMMXXpv+dy9WxlyQy6f0uLMP9cUOB 4NPbvGxGq/1y0GPB77R9SC7yADeOizSyAvrP2Rta7bb/wcB8Y1WO8TG6H8C5hrh0WXw6 rNlhTpu24V1VCEuX1YM0qCzBnPEZ+Wg27Ftn8H4u3gVHLXoZPmR3JF/MXapWHd69+VpD DBLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e201si2355685jac.105.2021.08.26.04.27.27; Thu, 26 Aug 2021 04:27:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242375AbhHZL1D (ORCPT + 99 others); Thu, 26 Aug 2021 07:27:03 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:15219 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241887AbhHZL0l (ORCPT ); Thu, 26 Aug 2021 07:26:41 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4GwL9p1tjMz19VdH; Thu, 26 Aug 2021 19:25:18 +0800 (CST) Received: from dggemi759-chm.china.huawei.com (10.1.198.145) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 26 Aug 2021 19:25:52 +0800 Received: from localhost.localdomain (10.67.165.24) by dggemi759-chm.china.huawei.com (10.1.198.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 26 Aug 2021 19:25:52 +0800 From: Guangbin Huang To: , CC: , , , Subject: [PATCH net 3/7] net: hns3: fix speed unknown issue in bond 4 Date: Thu, 26 Aug 2021 19:21:57 +0800 Message-ID: <1629976921-43438-4-git-send-email-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629976921-43438-1-git-send-email-huangguangbin2@huawei.com> References: <1629976921-43438-1-git-send-email-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggemi759-chm.china.huawei.com (10.1.198.145) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yonglong Liu In bond 4, when the link goes down and up repeatedly, the bond may get an unknown speed, and then this port can not work. The driver notify netif_carrier_on() before update the link state, when the bond receive carrier on, will query the speed of the port, if the query operation happens before updating the link state, will get an unknown speed. So need to notify netif_carrier_on() after update the link state. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") Signed-off-by: Yonglong Liu Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index ac88608a94b6..78408136f253 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2952,12 +2952,12 @@ static void hclge_update_link_status(struct hclge_dev *hdev) } if (state != hdev->hw.mac.link) { + hdev->hw.mac.link = state; client->ops->link_status_change(handle, state); hclge_config_mac_tnl_int(hdev, state); if (rclient && rclient->ops->link_status_change) rclient->ops->link_status_change(rhandle, state); - hdev->hw.mac.link = state; hclge_push_link_status(hdev); } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 8784d61e833f..f25580366879 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -506,10 +506,10 @@ void hclgevf_update_link_status(struct hclgevf_dev *hdev, int link_state) link_state = test_bit(HCLGEVF_STATE_DOWN, &hdev->state) ? 0 : link_state; if (link_state != hdev->hw.mac.link) { + hdev->hw.mac.link = link_state; client->ops->link_status_change(handle, !!link_state); if (rclient && rclient->ops->link_status_change) rclient->ops->link_status_change(rhandle, !!link_state); - hdev->hw.mac.link = link_state; } clear_bit(HCLGEVF_STATE_LINK_UPDATING, &hdev->state); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c index 772b2f8acd2e..b339b9bc0625 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -323,8 +323,8 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) flag = (u8)msg_q[5]; /* update upper layer with new link link status */ - hclgevf_update_link_status(hdev, link_status); hclgevf_update_speed_duplex(hdev, speed, duplex); + hclgevf_update_link_status(hdev, link_status); if (flag & HCLGE_MBX_PUSH_LINK_STATUS_EN) set_bit(HCLGEVF_STATE_PF_PUSH_LINK_STATUS, -- 2.8.1