Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp796411imi; Thu, 21 Jul 2022 11:07:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vmdaSYeGy9oW0o3qxI04EmmauOcrHexpm8K4mB0W6pS8QU5so0hpJuAAhf9cyX7uoVb9Qk X-Received: by 2002:a17:907:762f:b0:72b:3203:2f52 with SMTP id jy15-20020a170907762f00b0072b32032f52mr41316623ejc.395.1658426824201; Thu, 21 Jul 2022 11:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658426824; cv=none; d=google.com; s=arc-20160816; b=dTURD/Q5P56ZF7HYae2q84O9JfpGxFVdU3SHYy8Un6expB1ivUEuj+jkEa2d7nUKbl yAcWWhZHYcMRkMv9lerFYBlB6M6cHlzWmSE8Xhi+dOUT8x6gJ0p/s9mBJy1w0PwG+yHQ L/Dl+mM08p0buLiAj6R3s01n/Q0IuW7AW44SIx4EEqpefe6Ne46V5JgcdxcxjjP7/tx4 h0rUdoIgX137uipq/KFnd2Ovf9PmHySR43utRtCmS5oX1VB8SnGyBbkiLLIXiKBCQx54 F00Y1aARzFV9TTVOiZKb4Cv4ejNDu0ufdi4QBAGsWNusqcmKYVUhgyX2boxUQt6IOTWQ ALxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=J2VYcnATE1BBYfEr73NA4avIPlTGJ+FZMlH1oDYhLQI=; b=cGO0Bw/RmOicQmEKSUn6LXpAsIVXNilWmCBHlI6j1/eIn9YLRzMT9bWbWhSZ1624eG dhhfM6wf659vG1p690X9n1g08qKPiQeNx85QBHFJx1lA5QNYGFnBpEk0n6cOeOcYWdUn QOesKhUQbdS5mOWJdGKQV7lDB36Z3hntstTeE3N85e9d1JyFgNg55vdqnvwd6vAiw9x1 ll2xntzEHJcojagfppVWOknSm+JH1MK0wdbP1BXpUnMfdRsgk22pZBD8rN/Gv/9p8LvJ IdNZQcYm/vJZmGP86WTq7/WzzhmABCa1S+3lCPeA2mMUkC8AG+HvsC0sVTyqaBe5SbWT dgJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=dzZpi4nV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa9-20020a170907868900b00712e4774584si3206558ejc.690.2022.07.21.11.06.37; Thu, 21 Jul 2022 11:07:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=dzZpi4nV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbiGUSE1 (ORCPT + 99 others); Thu, 21 Jul 2022 14:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiGUSEZ (ORCPT ); Thu, 21 Jul 2022 14:04:25 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB4FC8C582; Thu, 21 Jul 2022 11:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=J2VYcnATE1BBYfEr73NA4avIPlTGJ+FZMlH1oDYhLQI=; b=dzZpi4nV2ExLsdHmq8UvuDYhlg Ul/KxgZO/Fmp45GWa6h7nebQAPZjEtmA6g8y023qaHnt7ng+UnDcbcoZ+OazVEStbL42TlPf+413x GQVoBZdV6JepIZ6d+FULIvc66iMOy5mkcclcpc7jwSof/MCocBa+5OXYWVMxITLzNvNquiVAlBxF9 Uixwxk0isujSUvK0FbtN2qI3yTurzEF3mb+FZlLhk6hkcA1vFhPpPgLTEitiLZIts5fXbYLRZlvtj jCRKfe8FaLc3kBKVcdbZV9QznCZpMYMBra8avkj7iJWC6Ezwn8LN9ddf/F3bjTp6oV0yJATgBRFiJ Gthu6Dlw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:33486) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oEaX5-0005on-WB; Thu, 21 Jul 2022 19:04:20 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oEaX3-00052g-SX; Thu, 21 Jul 2022 19:04:17 +0100 Date: Thu, 21 Jul 2022 19:04:17 +0100 From: "Russell King (Oracle)" To: Sean Anderson Cc: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Alexandru Marginean , Paolo Abeni , "David S . Miller" , linux-kernel@vger.kernel.org, Vladimir Oltean , Eric Dumazet , Jakub Kicinski Subject: Re: [PATCH v2 08/11] net: phylink: Adjust advertisement based on rate adaptation Message-ID: References: <20220719235002.1944800-1-sean.anderson@seco.com> <20220719235002.1944800-9-sean.anderson@seco.com> <3844f2a6-90fb-354e-ce88-0e9ff0a10475@seco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3844f2a6-90fb-354e-ce88-0e9ff0a10475@seco.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2022 at 12:55:16PM -0400, Sean Anderson wrote: > On 7/20/22 3:08 AM, Russell King (Oracle) wrote: > > On Tue, Jul 19, 2022 at 07:49:58PM -0400, Sean Anderson wrote: > >> @@ -482,7 +529,39 @@ unsigned long phylink_get_capabilities(phy_interface_t interface, > >> break; > >> } > >> > >> - return caps & mac_capabilities; > >> + switch (rate_adaptation) { > >> + case RATE_ADAPT_NONE: > >> + break; > >> + case RATE_ADAPT_PAUSE: { > >> + /* The MAC must support asymmetric pause towards the local > >> + * device for this. We could allow just symmetric pause, but > >> + * then we might have to renegotiate if the link partner > >> + * doesn't support pause. > > > > Why do we need to renegotiate, and what would this achieve? The link > > partner isn't going to say "oh yes I do support pause after all", > > and in any case this function is working out what the capabilities > > of the system is prior to bringing anything up. > > > > All that we need to know here is whether the MAC supports receiving > > pause frames from the PHY - if it doesn't, then the MAC is > > incompatible with the PHY using rate adaption. > > AIUI, MAC_SYM_PAUSE and MAC_ASYM_PAUSE correspond to the PAUSE and > ASM_DIR bits used in autonegotiation. For reference, Table 28B-2 from > 802.3 is: > > PAUSE (A5) ASM_DIR (A6) Capability > ========== ============ ================================================ > 0 0 No PAUSE > 0 1 Asymmetric PAUSE toward link partner > 1 0 Symmetric PAUSE > 1 1 Both Symmetric PAUSE and Asymmetric PAUSE toward > local device > > These correspond to the following valid values for MLO_PAUSE: > > MAC_SYM_PAUSE MAC_ASYM_PAUSE Valid pause modes > ============= ============== ============================== > 0 0 MLO_PAUSE_NONE > 0 1 MLO_PAUSE_NONE, MLO_PAUSE_TX > 1 0 MLO_PAUSE_NONE, MLO_PAUSE_TXRX > 1 1 MLO_PAUSE_NONE, MLO_PAUSE_RX, > MLO_PAUSE_TXRX > > In order to support pause-based rate adaptation, we need MLO_PAUSE_RX to > be valid. This rules out the top two rows. In the bottom mode, we can > enable MLO_PAUSE_RX without MLO_PAUSE_TX. Whatever our link partner > supports, we can still enable it. For the third row, however, we can > only enable MLO_PAUSE_RX if we also enable MLO_PAUSE_TX. This can be a > problem if the link partner does not support pause frames (or the user > has disabled MLO_PAUSE_AN and MLO_PAUSE_TX). So if we were to enable > advertisement of pause-based, rate-adapted modes when only MAC_SYM_PAUSE > was present, then we might end up in a situation where we'd have to > renegotiate without those modes in order to get a valid link state. I > don't want to have to implement that, so for now we only advertise > pause-based, rate-adapted modes if we support MLO_PAUSE_RX without > MLO_PAUSE_TX. Ah, I see. Yes, I agree that we shouldn't do that, and only allow rate adaption in pause mode to be used if we can enable RX pause without TX pause on our local MAC. > > Have you checked the PHY documentation to see what the behaviour is > > in rate adaption mode with pause frames and it negotiates HD on the > > media side? Does it handle the HD issue internally? > > It's not documented. This is just conservative. Presumably, there exists > (or could exist) a duplex-adapting phy, but I don't know if I have one. I guess it would depend on the structure of the PHY - whether the PHY is structured similar to a two port switch internally, having a MAC facing the host and another MAC facing the media side. (I believe this is exactly how the MACSEC versions of the 88x3310 are structured.) If you don't have that kind of structure, then I would guess that doing duplex adaption could be problematical. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!