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 X-Spam-Level: X-Spam-Status: No, score=-0.9 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 5470BC43218 for ; Sun, 28 Apr 2019 18:10:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 277622067C for ; Sun, 28 Apr 2019 18:10:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qu0jwSWU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727059AbfD1SKu (ORCPT ); Sun, 28 Apr 2019 14:10:50 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39485 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbfD1SKu (ORCPT ); Sun, 28 Apr 2019 14:10:50 -0400 Received: by mail-wr1-f66.google.com with SMTP id a9so12397677wrp.6 for ; Sun, 28 Apr 2019 11:10:49 -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=Kx6AP3mMLJxCZ3FGvliwX1aQyW//qZb+cXxQajVQnU8=; b=qu0jwSWUW8IdIuht2UzfobsQtwZO5jZeU6JpOvUE4qVX9cjvEi//5UeceQ+NHlC3Rq s4EUzG0+QhsqpX1CjWEojSKvcC/iyH9nOrZnP5ZXGSdLI0039XZCLPrAblzgicqcLIAc xUdDg2UCAqp6NNwJNBi+fMT41vZERj8X6toPuRe2WXnf2BKvPy33rwsetvQzD7x8GfAm suHEm5AlpweSrFSgIZgD+Qo5xbCpHA9gkWsB92zvXyIW1N0xWp7N5aSqc1VQMYkw6/sq GiI3W2Pxl7DBBSQAXuLgbLreTlFN5hHnt0l7KXjs5o/TszVnYgByx2TDxOSbPtiw+PgV 3yQw== 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=Kx6AP3mMLJxCZ3FGvliwX1aQyW//qZb+cXxQajVQnU8=; b=MQ171pl+chsKQkF/Hh9TvYHGYlYJCeAN8LYySuTznriYWO8WnumV/43d5JShlI1nDV 6lPQcHRPZXkCCGP7OjhUkLpIJAnvF1UPBm0zk/FoB3PkswL04zc+rUb+NkkfNE17PTTU QR5JtuoUwy0Xc0yMyvoOnRUxYFN5Lcf34vUgSlKRnshV4bbirvTA8Y//xdHYA0DrE71j dseo644Pr+UX4KGWgHCCamyN2Qez3TeFLY9tzg7qI3PdK6TMQIlGvlqApqcLwWgmHNbg 3BbTstChPPS9gfIgh1XxU4QDB4ixXBWqORxgnRDYw4/Moso1qsJEDar7Bl2fgWknmLpB gKqw== X-Gm-Message-State: APjAAAXNm76ruNV9Sk/332l4Ger9SMSBYH/v+5GmxlQhzoa8RvPG+NYe IDEJj9K8WQn6KY/nQFEiXVi96AF9V0M= X-Google-Smtp-Source: APXvYqwb3db6iMtfoLS9bsh/pcg16cjaAtgzeSn1s0ONcniOGOp5omMZ4eCqODPiW9fgtjg3tC1tuw== X-Received: by 2002:adf:b64e:: with SMTP id i14mr15654785wre.72.1556475048565; Sun, 28 Apr 2019 11:10:48 -0700 (PDT) Received: from ?IPv6:2003:ea:8bd4:5700:8cd5:5d39:576c:7f5f? (p200300EA8BD457008CD55D39576C7F5F.dip0.t-ipconnect.de. [2003:ea:8bd4:5700:8cd5:5d39:576c:7f5f]) by smtp.googlemail.com with ESMTPSA id y133sm34636295wmd.2.2019.04.28.11.10.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 11:10:47 -0700 (PDT) Subject: Re: [PATCH net-next] net: phy: improve setting advertised modes in phy_probe To: Andrew Lunn Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" References: <13d4d69b-86a8-6c0d-a5a3-354f79a82170@gmail.com> <20190428170456.GL23059@lunn.ch> From: Heiner Kallweit Message-ID: Date: Sun, 28 Apr 2019 20:10:43 +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: <20190428170456.GL23059@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 28.04.2019 19:04, Andrew Lunn wrote: > On Sun, Apr 28, 2019 at 03:03:37PM +0200, Heiner Kallweit wrote: >> So far we set the advertising bitmap before setting the pause flags >> in the supported bitmap. This may cause pause not being advertised. > > Hi Heiner > > Pause requires that the PHY can advertise the pause bits, and that the > MAC supports pause. So by default, we don't advertise pause. The MAC > needs to say it supports pause, by calling one of > > void phy_support_sym_pause(struct phy_device *phydev); > void phy_support_asym_pause(struct phy_device *phydev); > > These two then copy supported into advertising. > Right, missed that. After checking the code a little bit more I think we still may have few issues with pause settings. 1. We have functions that copy supported -> advertising, e.g. phy_set_max_speed(). If such a function is called pause gets advertised even w/o the MAC calling one of the two functions. 2. We have PHY's (e.g. KSZ9031) that support sym pause only due to a hw erratum. If the MAC now calls phy_support_asym_pause() it sets the asym pause flag in phydev->supported even though the PHY intentionally disabled it. That's not nice .. Maybe we should do it differently: Apply my patch, then both pause modes are initially advertised. (This also avoids point 3 below) - remove phy_support_asym_pause() - phy_support_sym_pause() clears the asym pause bit and doesn't touch sym pause bit. - and we may need something like phy_support_no_pause(). 3. What's with all the existing drivers where the MAC supports pause but drivers call neither of the two functions? 4. Calling either of the two functions will be effective after an autoneg restart only. Do we have to consider this? > Andrew > Heiner