Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp348821ybb; Sat, 28 Mar 2020 00:12:06 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtrQG7wFcWhWaY67jYlwDSoRCvk1cr3tyZPOmEVAOVmuvcE+N7PfnllD/bpHZLRUp7FOOd6 X-Received: by 2002:a9d:414:: with SMTP id 20mr1883432otc.300.1585379526019; Sat, 28 Mar 2020 00:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585379526; cv=none; d=google.com; s=arc-20160816; b=OuzXDP/8muwxcPRNY3mzjzsUUkwUjzENO/ojw6QT0XvFyszerDb+cnqLmSIxc3AZer B6mrAugtHnGzrtggQLf7j6q+xlwJa5ikYjNfHE+wKAV321ZF1X2ImsGVnLUtpFMCq63y nddYu0Xyh2K3reZfnwDLntBV489OzMP6RNyLBCLWcckRIgZ9yKkS6hRgoYWzdAanse2v FKoobUxuH/4/gSvj5OJlI6FgR0j+6XozAcxhFE0I0jsNSvfyAtDwHdC34S/7W9sTKDlC Mg4eMtDDQ3fzKfoMUw3HJKVtWDJWQbHv82Rheu20NfYHk3H5fBLGR4wmQ3yrjUHPV4wM dRtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=JQCdQm2dbBdGOfHXJHPIHIlZSCMlO4IjGr4ENTdpcwI=; b=YrCjM+aFiXcuxYu/2IyljIG2/rsXsSqNqhzKtsaLbDgzt01wGZzD6/WGONz+Oj0KF6 Slv1RvsK5mEu3eEvHcg27xqVKFIOs8BqLBrkTN3q+9pdyTTISeJjq5hfz39JwtaHvJ+i RJVMA7c9fr65oqSt2VvgcZn/00kMqTUFNnpsLjlEuYcAGjxXv50/ST3COwA5NqQKvi3s mDi/29X0IYIYXKHREwtrvAa14Z/UfaLYVKOSFTRY/5XBlSUCEqOwkK6KbkyQXdL7Mhem Ss+WI9uOJsZ2NyJBavtqIGDya9cJDDvx9xIk2/3l4gQUxeSltlbY8RORYBob/CbgeylJ 2OrQ== 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 m193si3392016oig.77.2020.03.28.00.11.41; Sat, 28 Mar 2020 00:12: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 S1726186AbgC1HK4 (ORCPT + 99 others); Sat, 28 Mar 2020 03:10:56 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35100 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725372AbgC1HK4 (ORCPT ); Sat, 28 Mar 2020 03:10:56 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 870DFD21A1FDC62E4E5C; Sat, 28 Mar 2020 15:10:52 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Sat, 28 Mar 2020 15:10:44 +0800 From: Huazhong Tan To: CC: , , , , , , Guangbin Huang , Huazhong Tan Subject: [PATCH net 4/4] net: hns3: fix set and get link ksettings issue Date: Sat, 28 Mar 2020 15:09:58 +0800 Message-ID: <1585379398-36224-5-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1585379398-36224-1-git-send-email-tanhuazhong@huawei.com> References: <1585379398-36224-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guangbin Huang When device is not open, the service task which update the port information per second is not running. In this case, the port capabilities, including speed ability, autoneg ability, media type, may be incorrect. Then get/set link ksetting may fail. This patch fixes it by updating the port information before getting/ setting link ksettings when device is not open, and start timer task immediately by setting delay time to 0 when device opens. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Guangbin Huang Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index b351807..0e03c3a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -6765,7 +6765,7 @@ static void hclge_set_timer_task(struct hnae3_handle *handle, bool enable) struct hclge_dev *hdev = vport->back; if (enable) { - hclge_task_schedule(hdev, round_jiffies_relative(HZ)); + hclge_task_schedule(hdev, 0); } else { /* Set the DOWN flag here to disable link updating */ set_bit(HCLGE_STATE_DOWN, &hdev->state); @@ -8979,6 +8979,12 @@ static void hclge_get_media_type(struct hnae3_handle *handle, u8 *media_type, struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; + /* When nic is down, the service task is not running, doesn't update + * the port information per second. Query the port information before + * return the media type, ensure getting the correct media information. + */ + hclge_update_port_info(hdev); + if (media_type) *media_type = hdev->hw.mac.media_type; -- 2.7.4