Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5379538imm; Sun, 26 Aug 2018 18:31:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbCdZZivcKiws5I9PP4P6IYuEHTbn9qMSO7Fa6wPw3+wATj0q3T0eW1Y6h7zlqBne99dfQ4 X-Received: by 2002:a62:7182:: with SMTP id m124-v6mr11967394pfc.73.1535333475566; Sun, 26 Aug 2018 18:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535333475; cv=none; d=google.com; s=arc-20160816; b=pFgyS0PC3BSKBwrGSWHslu8rlgdqo27cGJHXu76gKes7ARzpKa5TMm9figd6gxl47E iq43gdDyOODlMvJ3yE3r/r+UjMIJCnIpR/cjJGVWPe6VvrO4DkRNVX4ccxhjqcrUp3Dz PnULTlFFTBVx4UqsmO/b7sE6mZqKaDAuburZDGl0paKGmIUhbggkO7XCbLlNq5Nki5IB nvTboZN1JyFpYV8vOnLffHMiRYrMNe8BJNT/MqsvH15OSIR0Tyd3X392lQ9dzen982Ty sSgRorXRN1d5OB3ZmMZzvXwQCNCXkFJevYV5NHesj0ZanqYelLBkIytomQuv3aBcTXMN RpMw== 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=s2l7t/aVmEMzW8316Mv1Zh0YiOhGx7obSKNTXQicaEimyAoPn1g2r738sotAEszI/v 0oBghOXHch7IonsQ64x383bf3uZNVnLCrjtjPlpZoL6I5Rt++ETI3RkY4afsQlxt09FB 0CM4MAzQQ1SVk3dckhmGOw0AwMfDt2ot+osTA04H+oJXhk0ddxnB842/ti49zgltKcmP jWzA+q9oVKzaaAP/aflp19aPH6pA5suqpBXsds2kcqRBOv5XoQu/sM1IesEPZsJeLkhJ wtHGlc69D9lSWxSJFlnm6aaGscKp+akdKdnR7LoRRgnyarGqYWatH758ZB9kiLjbO83I 0+DA== 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 u7-v6si13306615pgh.592.2018.08.26.18.31.00; Sun, 26 Aug 2018 18:31:15 -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 S1727110AbeH0FOF (ORCPT + 99 others); Mon, 27 Aug 2018 01:14:05 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11199 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726874AbeH0FOF (ORCPT ); Mon, 27 Aug 2018 01:14:05 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B74A2AEBC2004; Mon, 27 Aug 2018 09:29:38 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.399.0; Mon, 27 Aug 2018 09:29:30 +0800 From: Peng Li To: CC: , , , , , Subject: [PATCH V2 net 2/2] net: hns: add netif_carrier_off before change speed and duplex Date: Mon, 27 Aug 2018 09:59:30 +0800 Message-ID: <1535335170-111030-3-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535335170-111030-1-git-send-email-lipeng321@huawei.com> References: <1535335170-111030-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