Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2355197imm; Thu, 23 Aug 2018 20:14:54 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyssGiYrQg8bXZhaOJMJpBlcw7TPi43jJr/SXeP1LMBfU+MRjcdCwcyxEk16GyDxdnMBU4e X-Received: by 2002:a65:6214:: with SMTP id d20-v6mr14991260pgv.420.1535080494539; Thu, 23 Aug 2018 20:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535080494; cv=none; d=google.com; s=arc-20160816; b=siBqD45Ee2+loxSu6OWaaKXgKLkJd5YF2c84S2C8gG+3xh5dol2iUSHN7PJdv4W4ZF 8n0SfBBTGjaDFSm/5cjllXKSPfZ9SN0LrjajYCOZGs+WGf2EdBZyF7hzAEx9jfdOZito kbIpeKZHbmFcMs6tiB/0vOaPGs8bMGRvSGPcoxX5JhqjQv4ZQv65FcCqfdNJkRiYHbcp U4sSJk8WDpdnUbwUa6COQgI+nb1YQCuIQIpaTqyrfASdh7fxcCU7WbJL2ybtgaD0AGlz KACpMFazY7PxahndxkIzTQmjh+/1FJO/8wqCEtQ2Hce+N0rtooVGyFgh8/+pVgu0o4wH A8NA== 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:arc-authentication-results; bh=EXU3/rMM6Y7bGC+Rrl1P42/RfdWyF+sgkmULNnqlurQ=; b=0DOQEDifsGlR9Vj7j4MTFaIgwzZrBgFiqzsVWphykQlMiXFWjPX33BFOCQ6HmP2OOg kRCnDUptPRXy65uuIsu5WW/n5ySPYKjN68xr9QZpSgJ1mBxO9RTvzEVe46nUqYa2lC5y 6pYORXin66PDyPmNtRYSYus6y5+VHgHnT+AtB+/xRNH81lNiYQ3vIjPxCvX73vlWgEOq cRgggFw7I2pPxvslDKQzAf61hv0ClTgVqW0FD1mrQI0u3FrzJzgeKZgiq6JN5xgl5l8G UY0kCgriKrZ/g/xkbiqsfgRh8UFcDeXQDw6hnt+I9XaH81WrYYan4kM4ZI7olZqDU1xb Ms5Q== 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 g21-v6si6011187pgk.232.2018.08.23.20.14.39; Thu, 23 Aug 2018 20:14:54 -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 S1727661AbeHXGpc (ORCPT + 99 others); Fri, 24 Aug 2018 02:45:32 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:35174 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726458AbeHXGpO (ORCPT ); Fri, 24 Aug 2018 02:45:14 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 2A52A37DC480B; Fri, 24 Aug 2018 11:12:33 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.399.0; Fri, 24 Aug 2018 11:12:26 +0800 From: Peng Li To: CC: , , , , , Subject: [PATCH NET 2/3] net: hns: add netif_carrier_off before change speed and duplex Date: Fri, 24 Aug 2018 11:42:22 +0800 Message-ID: <1535082143-122281-3-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535082143-122281-1-git-send-email-lipeng321@huawei.com> References: <1535082143-122281-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If there are packets in hardware when changing the speed or duplex, it may cause hardware hang up. This patch adds netif_carrier_off before change speed and duplex in ethtool_ops.set_link_ksettings, and adds netif_carrier_on after complete the change. Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 08f3c47..774beda 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c @@ -243,7 +243,9 @@ static int hns_nic_set_link_ksettings(struct net_device *net_dev, } if (h->dev->ops->adjust_link) { + netif_carrier_off(net_dev); h->dev->ops->adjust_link(h, (int)speed, cmd->base.duplex); + netif_carrier_on(net_dev); return 0; } -- 2.9.3