From patchwork Thu Aug 24 13:38:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13364184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80FDDC27C40 for ; Thu, 24 Aug 2023 13:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=us7gMKQhFK06CJeRiZMKRFPedc+yJ4Me3TXuYWHzpDE=; b=xQgW+vUbagtrmj 5Ek3eGCsQG3awfYqEsb/JYh203TKCAaKSVAGVji9TfsFjROwJ4w4kLl3so3Zn0zkHaNJQJ0UqIkFV 1Mir/7swssxb3Y+y9PPwZYFBWUOlFOzK9OsURTGOlqydt35AY11l+cp3mf6IBomXib6NLxnNlNGrY m9IwHB62rO9WHrtMa2UNTgyWX1+dyuKwkl7y69i4I9d1JIL3g4UXsSMZcUbu/bOuDrPAj2KWOwxys HLRmOZ7shMijEAt6HATVrZDbN/TWvwRExhKoCcGCrsYpKWE0oyPijvu705tbFZqFaM3QZj3L2gqoK 29O+YZD+Y8pJcznOk8Mw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZAY6-003A5x-2I; Thu, 24 Aug 2023 13:38:58 +0000 Received: from [2001:4d48:ad52:32c8:5054:ff:fe00:142] (helo=pandora.armlinux.org.uk) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZAXt-003A02-1n for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 13:38:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=J3e+4Vo84h0ny8OR5GBo+JRGtZ3c958TOz/VATLJd6Y=; b=lmgTDgz83a5mOXKNh+PJ985QvN KEjVZ3UQLkQ9nWZbTeOOx21/M/wHkLTVITHnMD+aL8qtKlBzwOvpfp/fjeBycqmRpzuNHfYzf7YRw iXccBVFYh0CcV/vO7xNy1DoWwSDHL8kd629FQdCZ9dIqAY0mRoQvkWfcUgAe8yi95pvur7jOC7TJO oWzrxRyaIlKvYaAvQlcv16+CUzxZbV6cQm7z3dwSg3dCDeXjWT8WHqFmPzUrk183FHvWbF9mp2jKD 70x62aqTMGKGBgL2uBxSz2ciD2vyVIfxOwn0I8Fd7Po7LDYvU+i/iiA/63d35ZCL/BdG/d32G+dS6 3cBvd7iA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:60606 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qZAXn-0004Ej-1g; Thu, 24 Aug 2023 14:38:39 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qZAXn-005pUb-SP; Thu, 24 Aug 2023 14:38:39 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Alexandre Torgue , Jose Abreu Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Feiyang Chen , Heiner Kallweit , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 10/10] net: stmmac: convert half-duplex support to positive logic MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 24 Aug 2023 14:38:39 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_063845_592628_DEDF220C X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Rather than detecting when half-duplex is not supported, and clearing the MAC capabilities, reverse the if() condition and use it to set the capabilities instead. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7cfc2918c913..33ca5c50bdcd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1223,16 +1223,17 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) priv->phylink_config.supported_interfaces); priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | - MAC_10 | MAC_100 | MAC_1000; + MAC_10FD | MAC_100FD | + MAC_1000FD; + + /* Half-Duplex can only work with single queue */ + if (priv->plat->tx_queues_to_use <= 1) + priv->phylink_config.mac_capabilities |= MAC_10HD | MAC_100HD | + MAC_1000HD; /* Get the MAC specific capabilities */ stmmac_mac_phylink_get_caps(priv); - /* Half-Duplex can only work with single queue */ - if (priv->plat->tx_queues_to_use > 1) - priv->phylink_config.mac_capabilities &= - ~(MAC_10HD | MAC_100HD | MAC_1000HD); - max_speed = priv->plat->max_speed; if (max_speed) phylink_limit_mac_speed(&priv->phylink_config, max_speed);