Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E82EDC282CE for ; Fri, 5 Apr 2019 20:32:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE9F72146F for ; Fri, 5 Apr 2019 20:32:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JmMK/+0Y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726264AbfDEUcW (ORCPT ); Fri, 5 Apr 2019 16:32:22 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37671 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbfDEUcW (ORCPT ); Fri, 5 Apr 2019 16:32:22 -0400 Received: by mail-wm1-f67.google.com with SMTP id v14so8483624wmf.2 for ; Fri, 05 Apr 2019 13:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=U6dRdJ/JkqZ7pAx2bQPgus/zOHg+JmQAGVYpvO4p6tg=; b=JmMK/+0YU7qZIxPNid1DWZYabw9X0PSo6R+ZllbwdGSTXQlaKBl/Ia0AaJiw7b9RN0 bPOPPi+X072blsu8E4lsSec7mlqyZGKY/jkNq0hcNQ+ne7B5mYBzpnccfhh7mFK4hrJk 7O5BmSHRvyUmBdt2fftC+lBI8dG1inPqTca97QjT+V7BEWQGJCLnhsMRnaISx1fR+6Jb GaqZLCedZ8htkvzTA1MDdgbM+6r3jjuo2Vao1JrHQ88D6Kbp118PtAIWu671FfOy6DvL wy4PeDSq/oxVEvmdmxbyt6V9k0vFxbneMOVetxp7KDE4DViWHcDWj4WMUHwM4SHUzQEi AQhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=U6dRdJ/JkqZ7pAx2bQPgus/zOHg+JmQAGVYpvO4p6tg=; b=gTATsGUvQDKciswNDFutqqVyTpLYOArjQWfGki7u61OtgMV9QT+Bgz26ZvU9nnFWFj gS7YwublKRwt0T2XwL4upRPr6ylPYirgJBTy6pjDUj4lQnTRSxdf3whPM+botZ5+2u0k gY7tg2gJc+6LxhnPC2LJAH6e2rsO+Jhc/wdQP8lnJrNMfFNLN3iMsLObMSkuOh+Aiw0D XUifuxWsRYmvEXY9eAPhqmg9j9JFA3vJ0MNCT3l7AKxJ5uI78rUp1OgM/Ju3FVCYB/St VzWmRQvVtGvhH49Aw2fwr+tzvv5X/lCOcjOQHMXO/Hcu5/AoPhV7vIKQ4zgJBongpD3m IRig== X-Gm-Message-State: APjAAAV+Iqi6ZwJDZ5XdsZcVxV4dnyBfYqkb72UIJGHCGtIFz9ZCLErr VLdpAMZTdWgyODsH2OYp9OPe9MXC X-Google-Smtp-Source: APXvYqywcFLFc9s+nAVPPaR44aBK9AHZYtAx25DkF7sNzfAV6vDxuDTQUP35fUCq2TAdi+v76oUg+w== X-Received: by 2002:a1c:23cc:: with SMTP id j195mr8683051wmj.74.1554496340567; Fri, 05 Apr 2019 13:32:20 -0700 (PDT) Received: from ?IPv6:2003:ea:8be1:dd00:c5f4:1013:b1cb:d123? (p200300EA8BE1DD00C5F41013B1CBD123.dip0.t-ipconnect.de. [2003:ea:8be1:dd00:c5f4:1013:b1cb:d123]) by smtp.googlemail.com with ESMTPSA id y17sm2732882wma.8.2019.04.05.13.32.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Apr 2019 13:32:19 -0700 (PDT) Subject: Re: [PATCH net-next] net: phy: improve link partner capability detection To: Andrew Lunn Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" References: <20190405194821.GI23536@lunn.ch> <6a86f31f-dda8-77d9-aace-9ad1ad770a28@gmail.com> <20190405202729.GK23536@lunn.ch> From: Heiner Kallweit Message-ID: Date: Fri, 5 Apr 2019 22:32:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190405202729.GK23536@lunn.ch> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 05.04.2019 22:27, Andrew Lunn wrote: > On Fri, Apr 05, 2019 at 10:04:22PM +0200, Heiner Kallweit wrote: >> On 05.04.2019 21:48, Andrew Lunn wrote: >>> On Fri, Apr 05, 2019 at 09:23:13PM +0200, Heiner Kallweit wrote: >>>> genphy_read_status() so far checks phydev->supported, not the actual >>>> PHY capabilities. This can make a difference if the supported speeds >>>> have been limited by of_set_phy_supported() or phy_set_max_speed(). >>>> >>>> It seems that this issue only affects the link partner advertisements >>>> as displayed by ethtool. Also this patch wouldn't apply to older >>>> kernels because linkmode bitmaps have been introduced recently. >>>> Therefore net-next. >>> >>> Hi Heiner >>> >> Hi Andrew, >> >>> Are you saying, if the local PHY/MAC does not support 1000Base-T, we >>> should not check if the peer is advertising 1000Base-T? That seems >>> wrong. We should report everything it offers. The fact we cannot make >>> use of 1000Base-T should not matter, and resolving of the auto-get >>> should do the right thing when presented with modes it cannot use. >>> >> Link partner gigabit advertisement is reported in register MII_STAT1000. >> If we have a 100MBit PHY w/o this register, then we will never know >> whether the link partner supports gigabit. > > Hi Heiner > > There seems to be two uses cases: > > A Fast MAC connected to a Fast PHY. In that case, MII_STAT1000 > probably does not exist, so we should not read it. Hopefully .features > says BASIC, or if we ask the PHY what is it, it reports it is a Fast > PHY. > Right. BMSR_ESTATEN should not be set on a Fast PHY. Handling of this case didn't change. > A Fast MAC connected to a Giga PHY. The MAC driver will of used > phy_set_max_speed() to indicate its limits. In that case, MII_STAT1000 > does exist and we should report what the peer is advertising. > That's what we're doing now with this patch. > Andrew > Heiner