Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp486687rdb; Fri, 26 Jan 2024 01:27:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGk5BbzKCaHRQyK9vt3AmDb4lNqaW8bgDGLTSubCpp46VcPTc2mySvdU/IUdVFMKYs+/uv X-Received: by 2002:a17:902:c086:b0:1d7:270f:6b8a with SMTP id j6-20020a170902c08600b001d7270f6b8amr1173303pld.17.1706261259721; Fri, 26 Jan 2024 01:27:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706261259; cv=pass; d=google.com; s=arc-20160816; b=ADObiTAHDnCLXUKx2LpiyEvOSuSFPJwDAER/qlztpNM+EobKax2p/A3cROkQe+zFBj +UJb3DS5QHPSv2Jkylgo5DjZBsucY56BHVWWyQbif3RUFLjM/DAICM2HKaB48+rPDDKO UJK55jUJt6ZpCFtNhaA4vekS/pGso/7fqvVlQtlc7FYVphRgvTO6pXXzAq2kryOoESEW G/RXMjYCEBTIPFK/cu0Hire4IVPGUReqXJrgnwwsfMia3wwUXGfqNKBjDzndeQkB4bc5 LJkWCOJxEC9f+/QFkk+3XS0929hwlutCH4l9tJ9bAI/+fMt5Gu3jWIfRM7Beye9AtdRv DzTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=GfWOdJizn9qajP2fgFEpsk2c/JN4N7LIyYRvIOWoG84=; fh=uDHyAw/litrFc3gX5tdiHxJIJ1SqRaXXw7Ra2UvBxUY=; b=MwgTw54R9eVVVyikXlm/eiPUt9oRCcW12KR51zW416n19CgrPtORtiEATkrN8X4WgO mw6CK6uwvO/9NjK49N8BXMAO+clVVV3+vddsZPFMuf+C9zch6wGJret+Jupa8AtrU3vq mTJyDEKWgu9Tp5AuQM/FGc3ahyAznstzq515KN9LW2JjTq3nD5xWUa8MjMw2mDQ+LA0d c6mkEPDlwmPyjS1yV9+fhtsvHK/LznIJI4cgeU/S96AcVfCH7jZI7a0vC0v5uA4PsU33 YAaixWkNZIUkSQMesVu9IfBZdFEMsZprtn4y3QCdo2YcqAu/xzYcNpQLnOtiMFpbZwnn gOpQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@geanix.com header.s=default2211 header.b=z+nrrGxV; arc=pass (i=1 spf=pass spfdomain=geanix.com dkim=pass dkdomain=geanix.com dmarc=pass fromdomain=geanix.com); spf=pass (google.com: domain of linux-kernel+bounces-39768-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h12-20020a170902f7cc00b001cf5c99a61csi822426plw.180.2024.01.26.01.27.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 01:27:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39768-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@geanix.com header.s=default2211 header.b=z+nrrGxV; arc=pass (i=1 spf=pass spfdomain=geanix.com dkim=pass dkdomain=geanix.com dmarc=pass fromdomain=geanix.com); spf=pass (google.com: domain of linux-kernel+bounces-39768-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0A76DB28351 for ; Fri, 26 Jan 2024 09:18:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAC8F1C694; Fri, 26 Jan 2024 08:36:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="z+nrrGxV" Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BE2D14276; Fri, 26 Jan 2024 08:36:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706258181; cv=none; b=MH67avjLsvkeJnczEEywvrnL1kHEUyydKAHPUfksyjOj2FNy34MbIL1eePCNGI3js9lfF9ZSGDm6o/KzrjqBQW/V5jI5GuDyWSmBcAUbKvydgjE/GuG0SW4dtY7E3cNL12NAI25CAL2Osj84QXj6vml+o5ZnT23c3P+EaTgQFN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706258181; c=relaxed/simple; bh=tkg39RAYsAhIELMHYR7dU6szqBbIFK6BgQpLq2STJIE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=LePb6/4pYtT0zakKAaXyyYaRwfIFQA3IRFODohOayGd9jgh6Kef45s3R8kpF2O1frVHDDqn4p32T+CIyZcBUnIn+TfVj4hpmSD/efAWpElEQjz9nTJFVY8vQrrlougheKB8Uy7Q7+GQSpqWM/lhxsppHpDVVGwYki4vhxAVe5N0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=z+nrrGxV; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=GfWOdJizn9qajP2fgFEpsk2c/JN4N7LIyYRvIOWoG84=; b=z+nrrGxVXrBFOfyxlMj3aHedI9 acH/1Fxur1lc7V7veDwL0sRWrLxY1i0lZKHq9i8gvklx0sVnfe+PONud9xMEUOghestnulhzCWIbC At5DzfwRL72qRhozA2gRWzcMAUBcf2YRSP6PWH7S3hHc5Xat2NFuUuIswgEYf6ULyoq+XO6AxufTc JkDoZGTrhBm0FW56xaDfoqm7ABHVqWOwpRjpj4Sx8ODLHvOZEfgOLMfMpJdzMlaxVWy35MMh6vesq y4ngsAXlNb+wxroZRgEe8MBy1ZXN2LAwMyi3eOKKgrcQVRCvh07l53+TgQXTdsZjnjPnUSZbOelRw hCrp8c1w==; Received: from sslproxy04.your-server.de ([78.46.152.42]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTHfy-000AzR-Lb; Fri, 26 Jan 2024 09:35:02 +0100 Received: from [87.49.42.9] (helo=localhost) by sslproxy04.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rTHfx-000Ioh-Jv; Fri, 26 Jan 2024 09:35:01 +0100 From: Esben Haabendal To: Rohan G Thomas Cc: "David S . Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Serge Semin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 2/2] net: stmmac: TBS support for platform driver In-Reply-To: <20230927130919.25683-3-rohan.g.thomas@intel.com> (Rohan G. Thomas's message of "Wed, 27 Sep 2023 21:09:19 +0800") References: <20230927130919.25683-1-rohan.g.thomas@intel.com> <20230927130919.25683-3-rohan.g.thomas@intel.com> Date: Fri, 26 Jan 2024 09:35:01 +0100 Message-ID: <87v87g4hmy.fsf@geanix.com> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Sender: esben@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27165/Thu Jan 25 10:51:15 2024) Rohan G Thomas writes: > Enable Time Based Scheduling(TBS) support for Tx queues through the > stmmac platform driver. For this a new per-queue tx-config property, > tbs-enabled is added to the devicetree. > > Commit 7eadf57290ec ("net: stmmac: pci: Enable TBS on GMAC5 IPK PCI > entry") enables similar support for the stmmac pci driver. > > Also add check whether TBS support is available for a Tx DMA channel > before enabling TBS support for that Tx DMA channel. > > Signed-off-by: Rohan G Thomas > --- > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 25 +++++++++++++++---- > .../ethernet/stmicro/stmmac/stmmac_platform.c | 4 +++ > 2 files changed, 24 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 81b6f3ecdf92..7333f0640b3d 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3773,12 +3773,18 @@ stmmac_setup_dma_desc(struct stmmac_priv *priv, unsigned int mtu) > dma_conf->dma_rx_size = DMA_DEFAULT_RX_SIZE; > > /* Earlier check for TBS */ > - for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) { > - struct stmmac_tx_queue *tx_q = &dma_conf->tx_queue[chan]; > - int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en; > + if (priv->dma_cap.tbssel) { > + /* TBS is available only for tbs_ch_num of Tx DMA channels, > + * starting from the highest Tx DMA channel. > + */ > + chan = priv->dma_cap.number_tx_channel - priv->dma_cap.tbs_ch_num; > + for (; chan < priv->plat->tx_queues_to_use; chan++) { > + struct stmmac_tx_queue *tx_q = &dma_conf->tx_queue[chan]; > + int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en; > > - /* Setup per-TXQ tbs flag before TX descriptor alloc */ > - tx_q->tbs |= tbs_en ? STMMAC_TBS_AVAIL : 0; > + /* Setup per-TXQ tbs flag before TX descriptor alloc */ > + tx_q->tbs |= tbs_en ? STMMAC_TBS_AVAIL : 0; > + } > } > > ret = alloc_dma_desc_resources(priv, dma_conf); > @@ -7505,6 +7511,15 @@ int stmmac_dvr_probe(struct device *device, > } > } > > + /* If TBS feature is supported(i.e. tbssel is true), then at least 1 Tx > + * DMA channel supports TBS. So if tbs_ch_num is 0 and tbssel is true, > + * assume all Tx DMA channels support TBS. TBS_CH field, which gives > + * number of Tx DMA channels with TBS support is only available only for > + * DW xGMAC IP. For other DWMAC IPs all Tx DMA channels can support TBS. The Ethernet QOS controllers found in various i.MX socs does not support TBS on TX queue 0. I believe this patch would break the dwmac driver for these platforms. > + */ > + if (priv->dma_cap.tbssel && !priv->dma_cap.tbs_ch_num) > + priv->dma_cap.tbs_ch_num = priv->dma_cap.number_tx_channel; > + > ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; > ndev->watchdog_timeo = msecs_to_jiffies(watchdog); > #ifdef STMMAC_VLAN_TAG_USED > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index 843bd8804bfa..6c0191c84071 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -279,6 +279,10 @@ static int stmmac_mtl_setup(struct platform_device *pdev, > plat->tx_queues_cfg[queue].coe_unsupported = > of_property_read_bool(q_node, "snps,coe-unsupported"); > > + /* Select TBS for supported queues */ > + plat->tx_queues_cfg[queue].tbs_en = > + of_property_read_bool(q_node, "snps,tbs-enabled"); > + > queue++; > } > if (queue != plat->tx_queues_to_use) { /Esben