Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp276599rdh; Thu, 23 Nov 2023 03:56:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGE0xeucdSPrTYepR1R/YXm8i6UCiH1wjh6qrUGGQZ89CEHSbt0m8gCiiF6/sw1N+y5iDrG X-Received: by 2002:a17:903:11d1:b0:1cf:6e3d:d8e7 with SMTP id q17-20020a17090311d100b001cf6e3dd8e7mr6258325plh.26.1700740571029; Thu, 23 Nov 2023 03:56:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700740571; cv=none; d=google.com; s=arc-20160816; b=Z4YXmpESSBdS+09Kt12TMFVhAJDSLg0ov0uNMuiHx2F9BGNjVXOn5BLxfYt+sXlNY5 Xqcr9ezOoZgr61PANgt3g6/YRt7Nhmy4fE43vvQNsJqV6iKKY75v9cSh2n2PtGgZxhqD Fi/3b/rXE5IkjUivXY5hTh/OixpQJ1GWym4vLkeil1lQOmkak6rQHHHRlnE8MgXAfO+i lYBqTzyn9wQesQMuSzIvhHaCNA7SAYnNNWEjJDYHWORQ67zCr1JtNN4m7QRf1JfZ6xWx ylYqLoeNo9WHdnXsTfXM7MUOppqijHp0xoQAb4teBBg5R4a1nnJwuiClXTqFj6jF53/V SrUQ== 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=mIhaEk2/Bwn/CFdd+w824Ydp0u5k25o2zM0VwFISc9M=; fh=82WaqRITOQPouqbQHaJBFYNtql1URDcT4Iue3++DuaA=; b=hB18CUyoGuQwsbPiKlQg8gypI5nbbQFfSovtliuuyd4rw/Us2YQ+uojPFSvnEllnnL TJRuizpBLpqSmqxbqBd4G4hZFQu2kM1XSv72ouCTUPXnkaYM+a9GTGrSDkNMsLILkHyQ OSRLLaEqA3WT612yKk/47E73SHO4fOi+CY+yzSpa2Wn6U0HHEQVNxXbVD6mX1sfc7uAP wTS3qBqMAAF3XMhHrMcE+6mI889d5cftNJyt0vKyrUbIk/FG3SpfawrqkmxodA4C/SxV g13XZjrSSW6e+vyqlAOz1ze2zBIssJ9eCZW3fCpsxwwozvurM6gzF0POWOnJsIM4jt3q GM5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=SHyo6OJB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id n3-20020a170903110300b001c774a25b3bsi1006424plh.233.2023.11.23.03.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 03:56:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=SHyo6OJB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 468FC8028FDB; Thu, 23 Nov 2023 03:55:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345146AbjKWLzV (ORCPT + 99 others); Thu, 23 Nov 2023 06:55:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345118AbjKWLzU (ORCPT ); Thu, 23 Nov 2023 06:55:20 -0500 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 9FD89B2; Thu, 23 Nov 2023 03:55:26 -0800 (PST) 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=mIhaEk2/Bwn/CFdd+w824Ydp0u5k25o2zM0VwFISc9M=; b=SHyo6OJBbSUZtpnYM2fieeibAA gMiVUS679unzKt84r5tzYQJvXeuAsRXysZ91aSIdSRL+o2R9nfXSG1TAqthXo6wFF8PAYaFfrvWgI L1TMd5sKLnSbFSeKQdGSqNpVRNbe7lnUgaD69xDvZ/wEXUGe8KFosRRexlysvfIl+tk01RjkaMJr0 4SWlnJHyb1jV8/EyHcluLw+PI+gbsyzouDtYLMLPRa6EtS5STL3h4klTCYpgtf0Iou5pqaSr8MX+K 3ysMFgylLNN8fvjh7HNKW5/3YiS23wVzrPIQOBfDXXJfvU6+3xCb45aqZ3A5y5rh1PBokDg6QXpn1 rGmGY0vA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:40900) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1r68If-0001Va-0R; Thu, 23 Nov 2023 11:55:17 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1r68Ig-0006Br-M2; Thu, 23 Nov 2023 11:55:18 +0000 Date: Thu, 23 Nov 2023 11:55:18 +0000 From: "Russell King (Oracle)" To: Oleksij Rempel Cc: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh , Arun Ramadoss , Simon Horman , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next v6 2/3] net: dsa: microchip: ksz8: Add function to configure ports with integrated PHYs Message-ID: References: <20231123112051.713142-1-o.rempel@pengutronix.de> <20231123112051.713142-3-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123112051.713142-3-o.rempel@pengutronix.de> Sender: Russell King (Oracle) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 03:55:40 -0800 (PST) On Thu, Nov 23, 2023 at 12:20:50PM +0100, Oleksij Rempel wrote: > This patch introduces the function 'ksz8_phy_port_link_up' to the > Microchip KSZ8xxx driver. This function is responsible for setting up > flow control and duplex settings for the ports that are integrated with > PHYs. > > The KSZ8795 switch supports asymmetric pause control, which can't be > fully utilized since a single bit controls both RX and TX pause. Despite > this, the flow control can be adjusted based on the auto-negotiation > process, taking into account the capabilities of both link partners. > > On the other hand, the KSZ8873's PORT_FORCE_FLOW_CTRL bit can be set by > the hardware bootstrap, which ignores the auto-negotiation result. > Therefore, even in auto-negotiation mode, we need to ensure that this > bit is correctly set. > > When auto-negotiation isn't in use, we enforce symmetric pause control > for the KSZ8795 switch. This doesn't sound right. I would suggest that if PORT_FORCE_FLOW_CTRL is cleared, and autoneg is disabled, the result will be that flow control will be disabled. Also, I think PORT_FORCE_FLOW_CTRL should be used in combination with permit_pause_to_mac, which you can get at in mac_config() using state->pause & MLO_PAUSE_AN. So, what I would suggest is that in mac_config(), the driver stores in its private data something like: dev->manual_flow[port] = !(state->pause & MLO_PAUSE_AN); And then in mac_link_up(), you can examine this, and if manual_flow for the port is set _and_ tx_pause is also set, then you can set PORT_FORCE_FLOW_CTRL. I think this will give a better approximation to the intent of the user API (assuming symmetric pause only): Autoneg Pause Autoneg rx,tx PORT_FORCE_FLOW_CTRL 1 1 x 0 0 1 x 0 (flow control probably disabled) x 0 1 1 (flow control force enabled) 1 0 0 0 (flow control still depends on aneg result due to hardware) 0 0 0 0 (flow control probably disabled) Whereas, what I think you're proposing is: Autoneg Pause Autoneg rx,tx PORT_FORCE_FLOW_CTRL 1 1 x 0 1 0 x 0 (flow control still depends on aneg result) 0 x 1 1 (flow control force enabled) 0 x 0 0 (flow control probably disabled) The difference is that flow control can be forced with my suggestion when Autoneg is still enabled, but the pause autoneg bit is cleared and we want flow control enabled. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!