From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE80EB64DD for ; Sat, 29 Jul 2023 03:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbjG2DL4 (ORCPT ); Fri, 28 Jul 2023 23:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjG2DLz (ORCPT ); Fri, 28 Jul 2023 23:11:55 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2ECE4214; Fri, 28 Jul 2023 20:11:52 -0700 (PDT) Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RCTzJ4y4JzrRgj; Sat, 29 Jul 2023 11:10:52 +0800 (CST) Received: from [10.69.136.139] (10.69.136.139) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 29 Jul 2023 11:11:49 +0800 Message-ID: <2c6514a7-db97-f345-9bc4-affd4eba2dda@huawei.com> Date: Sat, 29 Jul 2023 11:11:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net 5/6] net: hns3: fix wrong print link down up To: Andrew Lunn CC: , , , , , , , , , , , , References: <20230728075840.4022760-1-shaojijie@huawei.com> <20230728075840.4022760-6-shaojijie@huawei.com> <7ce32389-550b-4beb-82b1-1b6183fdeabb@lunn.ch> From: Jijie Shao In-Reply-To: <7ce32389-550b-4beb-82b1-1b6183fdeabb@lunn.ch> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.69.136.139] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Hi Andrew, I understand what you mean, and sorry for my wrong description. The link is not always up. If I turn auto-neg off, the link will go down finally. However, there is an intervel between my operation and the link down. In my experiment, it may be 1 min or evn 10 mins. The phy state is set to PHY_UP immediately when I set auto-neg off. And the phy machine check the state during a very small intervals. Thus, during my experiment, the phy state has a followed varietion: PHY_RUNNING -> PHY_UP -> PHY_RUNNING -> PHY_NOLINK. We print link up/down based on phy state and link state. In aboved case, It print looks like: eth0 link down -- because phy state is set to PHY_UP eth0 link up -- because phy state is set to PHY_RUNNING eth0 link down -- because link down This patch wants to fix the first two wrong print. We will modify this patch description Thanks!   Jijie Shao on 2023/7/28 16:57, Andrew Lunn wrote: > On Fri, Jul 28, 2023 at 03:58:39PM +0800, Jijie Shao wrote: >> From: Peiyang Wang >> >> This patch will fix a wrong print "device link down/up". Consider a case >> that set autoneg to off with same speed and duplex configuration. The link >> is always up while the phy state is set to PHY_UP and set back to >> PHY_RUNNING later. It will print link down when the phy state is not >> PHY_RUNNING. To avoid that, the condition should include PHY_UP. > Does this really happen? If autoneg is on, and there is link, it means > the link peer is auto using auto-neg. If you turn auto-neg off, the > link peer is not going to know what speed to use, and so the link will > go down. The link will only come up again when you reconfigure the > link peer to also not use auto-neg. > > I don't see how you can turn auto-neg off and not loose the link. > > Andrew