Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3465851imm; Fri, 24 Aug 2018 18:25:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZLl5HzwoGNzGIRoTXC+7X0t6vcXF7vOaxeCFRsLuWm130O10peCvCmQrzkdxXneTzx7H6o X-Received: by 2002:a63:e54b:: with SMTP id z11-v6mr3757143pgj.328.1535160356366; Fri, 24 Aug 2018 18:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535160356; cv=none; d=google.com; s=arc-20160816; b=oF7FH+7u7qrMzp6x8Ss/16GVZblpv8gCTvsYDUyJbEvC/21X99fSEfY3ZBtgzz5UeX FQiTD1l05pBbsBu4lJa1o5zCFJ6Y8YoWUXadjEnlKxVTT+BR/ULVbJaFN9esMzBDTO8u Ef6DhmL09wFbTSk0m/MRU91zsrCxFpWn+c73J5YgVj3zQ6/+Z8Zxuy0/D/e3Rmxs2YsO mcRwFJJK3BTB+FPpFMiPPRbZ1MZOlri8hl91tVcpuDnVkpdsR8NzvRXSPyU2eC9dqqwB ZY+E2S0LORlJUPB3RD11AqsANp4PqTxqsOvV1avjIRPHMKMRSrbzNVUU4d+Grm1ZxPqv Y4vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=GVi/BrdYb2Q4LwRSh6fePYe3ARNHERimEvhCHEIz3dw=; b=Wz/V2F+mJpGqZ9kIzlzwKxlSrn+IZENrsN3Zg+3xB24nq7p2P1VtHN6cO+mLw8eDQW L5utQr16PUAwaAaYueVSbvrvWPQUanR9MHkeYjYm80zRDegDmnRRKm1o2R2VPEheJkXa YeO+sm8y7zVbm9RIt+rtiZyQ2FPzEeoFh/3T1dkHyioS6SbpZUs0XptfqzScLPxEi3g5 JK1lh/lrPgkT9fCkmnkGqmJerM8l77g2kHINWe9t0MkRDnpXjG4i2c38eiI3aR3XRJX4 oR+0zkGqlaQlLslA7Jv6uVw/crSzJxxxYrNoagJIiAcHS/iA28FsgWpDmo8iFpkqu5ap hNgg== 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 p61-v6si8181061plb.55.2018.08.24.18.25.09; Fri, 24 Aug 2018 18:25:56 -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 S1726533AbeHYE7O (ORCPT + 99 others); Sat, 25 Aug 2018 00:59:14 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11194 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726113AbeHYE7O (ORCPT ); Sat, 25 Aug 2018 00:59:14 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8A6A8DFA87CB7; Sat, 25 Aug 2018 09:22:08 +0800 (CST) Received: from [127.0.0.1] (10.63.173.108) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.399.0; Sat, 25 Aug 2018 09:22:02 +0800 Subject: Re: [PATCH NET 3/3] net: hns: add configuration constraints for 1000M half To: Andrew Lunn CC: , , , , , References: <1535082143-122281-1-git-send-email-lipeng321@huawei.com> <1535082143-122281-4-git-send-email-lipeng321@huawei.com> <20180824034119.GA29111@lunn.ch> <194ac663-94d8-55e2-0231-a6be53e35f04@huawei.com> <20180824132857.GA1999@lunn.ch> From: "lipeng (Y)" Message-ID: <7c40c758-2ef2-665d-f429-0cc4e63a7a38@huawei.com> Date: Sat, 25 Aug 2018 09:21:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180824132857.GA1999@lunn.ch> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.63.173.108] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/8/24 21:28, Andrew Lunn wrote: > On Fri, Aug 24, 2018 at 02:39:36PM +0800, lipeng (Y) wrote: >> >> On 2018/8/24 11:41, Andrew Lunn wrote: >>> On Fri, Aug 24, 2018 at 11:42:23AM +0800, Peng Li wrote: >>>> Hisilicon hip05 and hip06 board network card do not support >>>> 1000M half configuration. Driver can not config gmac as >>>> 1000M half. >>>> >>>> Signed-off-by: Peng Li >>> Hi Peng >>> >>> Does the driver remove SUPPORTED_1000baseT_Half from >>> phydev->supported? If you do that, the PHY should never negotiate >>> this speed. >>> >>> Andrew >> Hi, Andrew, >> >> The driver has removed SUPPORTED_1000baseT_Half from >> >> phydev->supported. >> >> the code is : >> #define MAC_GMAC_SUPPORTED \ >> (SUPPORTED_10baseT_Half \ >> | SUPPORTED_10baseT_Full \ >> | SUPPORTED_100baseT_Half \ >> | SUPPORTED_100baseT_Full \ >> | SUPPORTED_Autoneg) >> h->if_support = MAC_GMAC_SUPPORTED; >> h->if_support |= SUPPORTED_1000baseT_Full; >> phydev->supported &= h->if_support; >> >> As gmac do not support 1000M half, we add this patch to >> make sure that no users can set 1000M half in any case. > Well, not quite. What this patch does is protect the hardware when it > is asked to change to an unsupported mode. This patch has nothing to > do with user APIs. > > The user API for setting link modes is hns_nic_set_link_ksettings(). > > What you do have is > > if (speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF) > return -EINVAL; > > which should stop somebody setting up a fixed speed link at 1000Half. > > But you don't do anything with cmd->link_modes.advertising. However, > when you call phy_ethtool_ksettings_set(), it gets AND'ed with > phydev->supported, which you have already removed 1000Half from. > > So is this a patch for a theoretical problem? Or have you seen it > happen? If it did happen, how did the user configure it to cause this > problem? That user API needs to prevent it. > > Andrew Hi,  Andrew, HW  do not support 1000M half, and the driver has done the 2 things: 1, remove SUPPORTED_1000baseT_Half from phydev->supported. 2,   add the protect in  hns_nic_set_link_ksettings(). This patch is a  theoretical protect, and the problem does not really  happen. I think you really get the point, do you think we need this patch? Thanks > . >