Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp763891rdb; Thu, 19 Oct 2023 20:29:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvmtfvEY353By36HpquldFeFMs6WJmKN78YYQYm6zsLUwZZ2r9u7b9U/ouCe848LIwSN8r X-Received: by 2002:a05:6a20:2451:b0:158:17e6:7a6 with SMTP id t17-20020a056a20245100b0015817e607a6mr737917pzc.42.1697772541841; Thu, 19 Oct 2023 20:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697772541; cv=none; d=google.com; s=arc-20160816; b=rgfZVwQaXSPveJyf/GblKriUxM0NuYWR2jjdcvbH5wZ3XV9pHHGVRIQOicM43bMVfx d9dzOlL5ZYsQK4XM0rgYWAQ9Yk3bEbEZaRBSzccO5ZNkfOAwsSKZDJPSNrykF6Q6yeCW KjbEf1g9hlvvKtauAyr6mQjZWANm7YpFzuJSCDIhDou4fxAlXZ/2EhPZ1scgQTH0zzMC 6efXu+exVT0TlnfRXV8fANkx5UTWTVZ0ZiSz3FqrfuHgx43DYMi/zWlyUcuSGcGdDmaR J/y1BopLBu6bkuiT3yOZNUva08YWC2AvKhi5RZh7DKtEYACRMNNdWhZZEsN8D4WWOK6G DuHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xLweuhMJCqmHEdjm09kabumCAIwkO+0yw6SsiK8gudQ=; fh=ZE8jK/KICYibp5zdxwGwN/ZEfzER6EKdGYOrha7OOvs=; b=zcKwPWty/VDn3Qh8ynlURyaN9AATisYjK7WIUm5G3RmnoAdRSPuxTMeFu0zSTNMWMs UVIAKoGyB3B618J8MHaMPCrWZvcwJhGXRjRbYVQKwqgerjltSZfx7PaeD47/Xy5h2NKi tvnhqjhlo5ssakMwN/vmCvF/uNNxmF5LjZ0sDcWnvMj/OP639ZFZiUtCz7f80Ifu2tHS Zu45UGCJ1SiDnvk6cVjwr46n4+JH8xfsgQxTSxffuomoTNkb6NxCZbO65Uxki3khYirT E+BCW+OY9MIj8ZkoJuScVn0Xxkb/VRqUCO1Qs090999J6TQLhpEUv+Xt92o/KM8X6ePH LC+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SZ5pGjCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l24-20020a637018000000b005898e10f9b9si952740pgc.213.2023.10.19.20.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 20:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SZ5pGjCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 190528298B47; Thu, 19 Oct 2023 20:29:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346877AbjJTD2z (ORCPT + 99 others); Thu, 19 Oct 2023 23:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235594AbjJTD2v (ORCPT ); Thu, 19 Oct 2023 23:28:51 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 245B3D4C; Thu, 19 Oct 2023 20:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697772530; x=1729308530; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=96Gky6mpZZHpzgNi964Tps4EK4L+Pft4fZHmTBB7PZs=; b=SZ5pGjCx+5SdJ/o0PCwaYnm8gfySxrz1JJNucTi/XSx7Q7L8Li+9ByK8 bL/+tCdVU/JYrJ0Hwi77jDyHwYqrCgpKgDoJoZJT4ftxZh7sgJYZmZbjg ecIHF5aWZyP0KoS4SpkVZ8kIYoQwIbFXoa3rHig4LErYH5BgYNCiV40e0 Bvr/TGa6t//NmZlCAVOqgWzbqA5OqJcwpGoH+RY/UNC2jVgUopVQrDL9R SaqJgQX+P7+45khGHwHnLIMcENTJU5BQgzxpDlhGuvAVW3NO4IWg8Bz76 9pW95xj36WGtZoOY3QSzpX0A6NRmG37tu/zYmKzQGaNcM0yqL4Kht0bXH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="472645905" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="472645905" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2023 20:28:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="827592040" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="827592040" Received: from ssid-ilbpg3-teeminta.png.intel.com ([10.88.227.74]) by fmsmga004.fm.intel.com with ESMTP; 19 Oct 2023 20:28:45 -0700 From: Gan Yi Fang To: Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Russell King , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Looi Hong Aun , Voon Weifeng , Song Yoong Siang , Gan Yi Fang Subject: [PATCH net v2 1/1] net: stmmac: update MAC capabilities when tx queues are updated Date: Fri, 20 Oct 2023 11:25:35 +0800 Message-Id: <20231020032535.1777746-1-yi.fang.gan@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.9 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 20:29:01 -0700 (PDT) From: Michael Sit Wei Hong Upon boot up, the driver will configure the MAC capabilities based on the maximum number of tx and rx queues. When the user changes the tx queues to single queue, the MAC should be capable of supporting Half Duplex, but the driver does not update the MAC capabilities when it is configured so. Using the stmmac_reinit_queues() to check the number of tx queues and set the MAC capabilities accordingly. Fixes: 0366f7e06a6b ("net: stmmac: add ethtool support for get/set channels") Cc: # 5.17+ Signed-off-by: Michael Sit Wei Hong Signed-off-by: Gan, Yi Fang --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ed1a5a31a491..5801f4d50f95 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1197,6 +1197,17 @@ 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; @@ -1228,10 +1239,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) 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; + stmmac_set_half_duplex(priv); /* Get the MAC specific capabilities */ stmmac_mac_phylink_get_caps(priv); @@ -7172,6 +7180,7 @@ 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_napi_add(dev); if (netif_running(dev)) -- 2.34.1