From patchwork Fri Apr 12 18:03:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13628223 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 2F437C4345F for ; Fri, 12 Apr 2024 18:04: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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sCHM3J2SNHQ/lvEDYYjTpsv1qwSM+jDuv05MFDemLfA=; b=hr+0DdoCpgVaff mD7B603k8OMS8r3JqHaFy586sCsej0+LrHuTXDmQYKDRTbKRBptVUNv/H5aNYq/mZJgtIrIxBXW/J 9zfq6XrU9Ya3Q7oipuMbZCL8npzGtYHtTV8K60Za+K6WtcgKjtPUcRd8mimQ69Ra73ktpfsC5iCtQ VNcCAX69GeAKB3EDOQARtXBe9o+w9IhOSnPPvEA9j2yhGPMRx60CUAgUSz6vz0VLs2OkiwfI6isq3 TC6v7Zt0l4upn3RqNCAOYBRINMecXyVjUtuSbnItePJC8StU1Cg9TEk9SUzMt7V0T8HYl2FEJbYXl ogA2DqXBGGZVdFnaaNkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvLFz-00000000m4k-0HlI; Fri, 12 Apr 2024 18:04:11 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvLFu-00000000m2D-32Bp for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 18:04:08 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2d6ff0422a2so13641501fa.2 for ; Fri, 12 Apr 2024 11:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712945043; x=1713549843; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CCp+O5zf1XAzEa7QvAx53sYKNLIL8eSplg5NSTorigk=; b=W2DTPdkx1hO7V78LaWM3W+iHsu/R40AXYYAVOwhqCO4nHZiEo+m7GAW5wcTCu5j5dw h0w+gPwsL2pZefmIoPJXn5F8ir7tAZdcZklq5MmA4kgRnKz/UKAAX88zk0jSS9T120G8 dZEP5rIBq4OC5/w5FFjRWyWTOPm40+/QBzTXVXGgFavPCezlcJkwUBmRfKF5mmitIuIB 13cfMHGpQo4szG1M6ru15MP54bULZUSiWts4aLEMePH/eh/4eV4dfz30ukb6tevTk9wm 8gGZq38vOX0/CcmC1uiBVGtcxoRYUj4jDwf27WAv2mD8mN5cvxnSIMTjF+C3akDzLbiQ CIRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712945043; x=1713549843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CCp+O5zf1XAzEa7QvAx53sYKNLIL8eSplg5NSTorigk=; b=GsVaDQwD2LiH3i7wqVwMrHeTlc03uoWjjavllpobsU768Kfcqb+ABsGQbszwC7oULR P9b8MwKqqmjaW2f6ECjj3WoFmpVLrtVXJ+JUs7zU0rZLJ/MVXJvqVzmfFbLr9YJbP15x iFVviY/dEEHz8E6wLpc8NK0y0QUT0ii/7b2sMwH1LXfvvvf4aDmAYi6qTaXW/wkOb5wU R4ez2vhY2g/cNixAgPNR+cgKMOfdIFI1cl5HHp169dOcKzEkzWuvGmnuq7g3wUI9PxKB BjCzmTVotbDp2tNOpD6Bi7LxRhqpsK+SpJhRaHY0fpiDg+/ztIk6rZenrqLGDN5BeDuA AZZw== X-Forwarded-Encrypted: i=1; AJvYcCVNyN6k4Pd3ENbIqudowLdQSdo4a9auB1xK6/aYBXTzPTMKhlKYtbJTS0IFYyRE9GdJG5RprrvarARuIjt87rUXuEwWnLFRSk1OGzIsDKYetARMbKo= X-Gm-Message-State: AOJu0Ywt+Pku0Ndl8IiOoDNz716pOxSD4U26julworNxZCZNAx+P/EdE Te5KJ0eoeJ+HlfGjHQuQYT/uHTmwgCJ20i2MWafxcjHRzD09sf74 X-Google-Smtp-Source: AGHT+IHENBuTlxLf/6N97dtbn3xcV+Dq/EI4bigipZaf5nXjIl76R7vPSnhcP7MwSAR0x+L4seiNwQ== X-Received: by 2002:a05:651c:33c:b0:2d9:fe84:a485 with SMTP id b28-20020a05651c033c00b002d9fe84a485mr2395294ljp.29.1712945043444; Fri, 12 Apr 2024 11:04:03 -0700 (PDT) Received: from localhost ([95.79.241.172]) by smtp.gmail.com with ESMTPSA id by43-20020a05651c1a2b00b002d88d978484sm547676ljb.132.2024.04.12.11.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:04:03 -0700 (PDT) From: Serge Semin To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Yanteng Si , Maxime Coquelin , Bhadram Varka Cc: Serge Semin , Simon Horman , Huacai Chen , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH net 1/4] net: stmmac: Apply half-duplex-less constraint for DW QoS Eth only Date: Fri, 12 Apr 2024 21:03:14 +0300 Message-ID: <20240412180340.7965-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240412180340.7965-1-fancer.lancer@gmail.com> References: <20240412180340.7965-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_110406_823195_C5F4796E X-CRM114-Status: GOOD ( 14.88 ) 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 There are three DW MAC IP-cores which can have the multiple Tx/Rx queues enabled: DW GMAC v3.7+ with AV feature, DW QoS Eth v4.x/v5.x, DW XGMAC/XLGMAC Based on the respective HW databooks, only the DW QoS Eth IP-core doesn't support the half-duplex link mode in case if more than one queues enabled: "In multiple queue/channel configurations, for half-duplex operation, enable only the Q0/CH0 on Tx and Rx. For single queue/channel in full-duplex operation, any queue/channel can be enabled." The rest of the IP-cores don't have such constraint. Thus in order to have the constraint applied for the DW QoS Eth MACs only, let's move the it' implementation to the respective MAC-capabilities getter and make sure the getter is called in the queues re-init procedure. Fixes: b6cfffa7ad92 ("stmmac: fix DMA channel hang in half-duplex mode") Signed-off-by: Serge Semin Reviewed-by: Romain Gantois --- .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 7 +++++++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 +++---------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index cef25efbdff9..ec6a13e644b3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -71,6 +71,13 @@ static void dwmac4_core_init(struct mac_device_info *hw, static void dwmac4_phylink_get_caps(struct stmmac_priv *priv) { priv->phylink_config.mac_capabilities |= MAC_2500FD; + + if (priv->plat->tx_queues_to_use > 1) + priv->phylink_config.mac_capabilities &= + ~(MAC_10HD | MAC_100HD | MAC_1000HD); + else + priv->phylink_config.mac_capabilities |= + (MAC_10HD | MAC_100HD | MAC_1000HD); } static void dwmac4_rx_queue_enable(struct mac_device_info *hw, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 24cd80490d19..dd58c21b53ee 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1198,17 +1198,6 @@ static int stmmac_init_phy(struct net_device *dev) return ret; } -static void stmmac_set_half_duplex(struct stmmac_priv *priv) -{ - /* Half-Duplex can only work with single tx queue */ - if (priv->plat->tx_queues_to_use > 1) - priv->phylink_config.mac_capabilities &= - ~(MAC_10HD | MAC_100HD | MAC_1000HD); - else - priv->phylink_config.mac_capabilities |= - (MAC_10HD | MAC_100HD | MAC_1000HD); -} - static int stmmac_phy_setup(struct stmmac_priv *priv) { struct stmmac_mdio_bus_data *mdio_bus_data; @@ -1237,10 +1226,7 @@ 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_10FD | MAC_100FD | - MAC_1000FD; - - stmmac_set_half_duplex(priv); + MAC_10 | MAC_100 | MAC_1000; /* Get the MAC specific capabilities */ stmmac_mac_phylink_get_caps(priv); @@ -7355,7 +7341,8 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt) priv->rss.table[i] = ethtool_rxfh_indir_default(i, rx_cnt); - stmmac_set_half_duplex(priv); + stmmac_mac_phylink_get_caps(priv); + stmmac_napi_add(dev); if (netif_running(dev))