From mboxrd@z Thu Jan 1 00:00:00 1970 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 AC299C25B76 for ; Sat, 8 Jun 2024 11:16:52 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/zrebX8YePMMKUv1Wq0bI79yVp+OBXBt4ewYCt/08BI=; b=xaGHwCYhWjjGcI etWWVCSqbjV4nhOCeGzwYdjzS++3M+4SZdwD+XZbnqHwjEc2ro1qFXL7DxHzLGjNKGYXeT/0PPBP5 0ENYGeD2afp//kYzY+fj+Lrc6KauM3NhnGkM3qB26UmknhG4IcqBTWFUjfJbVpz3X988ZoyIu6uQY JNLFIGeT/YwYbErWBduo6HaLdHUSwKjslETNKnRBdCl/2ivA5O2IPFCUcUezfqZWLrd2sZvFFHjYj MjywogN22giI3azcVexzz4Dhr/J6Kg79ZR6/QCO17DJpQnYaXQOlHmTTg+OLZQaVd9extg3pe2x1u sacY6EsaqN+4AOxODeDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFu3k-0000000HGbd-1IDA; Sat, 08 Jun 2024 11:16:32 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFu3g-0000000HGZm-1bOr for linux-arm-kernel@lists.infradead.org; Sat, 08 Jun 2024 11:16:29 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-57c6d3e6606so541620a12.0 for ; Sat, 08 Jun 2024 04:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717845386; x=1718450186; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=PtXxKMBWiGQ1B2oZBxOrPQhSy0IwrF0BuuPyQk2cWyw=; b=D3juWWuClhsBuJuZnIUojiVakVHK6DS277xoOhlffg7vSzo6qmxmC6D9GFGyca4xB0 zhB6SYqthlaNUP8pxgYXUh2hqZq1ZtmPXEK5HHBY6SdXm6YQNH4M4mqyweV+cdjeLvGo E51ymptVEFsTyJuJWTP4p9calmXWP88HZlSBwkb/jNyNClG2n+YOtK2VwqiXlDsF7tDz afE/14XoqZFRwVvcUXKjDzdQiibocl0aLrjkX5hN/jevjGROQuu9+TPF18+eEJXHwce5 vzkj+EAzCnI2k9OMWKFbL7SXuU0g7u8jcUFACPYSlclRPI3z5MftNrq1rr4OL/yUjlxR PEFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717845386; x=1718450186; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PtXxKMBWiGQ1B2oZBxOrPQhSy0IwrF0BuuPyQk2cWyw=; b=f+rRBzF1YWwxdE4N+Ac4JyzGCvPdSaxO+g/DoSRcPT74iUzPXa+T3Az8/nQ1K1lGd7 GTQZfkiJyVI/kkS9BdtUgB5Gs9t34enZ3IsCUPu0eCxVB9inDiuF1QsGvSTSQrMnDQU7 vwzWh+ptXEukiWFOOcQg8eg2dmnqehnrStTn6Bg1O1fvcYrbToXhTyDt8tgFTsGPNXtK MmI0uNpUlQI0vqxunLaC34N59W7nucv5+aiiuce+S5q7ltJ0Vx72CK0S/l6tm2cUQ3kZ 3wzu3lFe9HlCe+OgvKW3Z2h213GWWEuteOStKmLCnhCDsQJvevP5zPg8b3Qa/8fvrO1n /PnA== X-Forwarded-Encrypted: i=1; AJvYcCWajyApNZVOdFF4o9mlhjaARymKyH1oHvqN2aMS9QokVUM3LaeGGPqKS5t2Qz5z5O5am2m9r9g5S/z6RnuMPq63x46Gk3pxwWnFsWZM3B5RMv1icbQ= X-Gm-Message-State: AOJu0YxX/uYyIMIhe1a1sG1Qu6Mm72GvJbno+0M8SkT6IyfOg7S+YX1a INB4SYxgVqXTnKtz2JDdawZs5UXAyg4lFozicEbOB6fm0RnPLErc X-Google-Smtp-Source: AGHT+IELhGMfpxFt70JA2lImQ9hXz89V1CMxUo0K9yLXNAygI/b4E25TAhfw7hwBUPVqr4qgvlH2TA== X-Received: by 2002:a17:906:b897:b0:a6e:2c34:6c0e with SMTP id a640c23a62f3a-a6e2c717611mr287777666b.22.1717845385591; Sat, 08 Jun 2024 04:16:25 -0700 (PDT) Received: from skbuf ([188.25.55.166]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6c806eaa4dsm370256066b.110.2024.06.08.04.16.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 04:16:24 -0700 (PDT) Date: Sat, 8 Jun 2024 14:16:21 +0300 From: Vladimir Oltean To: Xiaolei Wang Cc: linux@armlinux.org.uk, andrew@lunn.ch, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, wojciech.drewek@intel.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [net v4 PATCH] net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters Message-ID: <20240608111621.oasttwwkhsmpcl4y@skbuf> References: <20240608044557.1380550-1-xiaolei.wang@windriver.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240608044557.1380550-1-xiaolei.wang@windriver.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240608_041628_477478_614D5CA7 X-CRM114-Status: GOOD ( 20.77 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Jun 08, 2024 at 12:45:57PM +0800, Xiaolei Wang wrote: > The current cbs parameter depends on speed after uplinking, > which is not needed and will report a configuration error > if the port is not initially connected. The UAPI exposed by > tc-cbs requires userspace to recalculate the send slope anyway, > because the formula depends on port_transmit_rate (see man tc-cbs), > which is not an invariant from tc's perspective. Therefore, we > use offload->sendslope and offload->idleslope to derive the > original port_transmit_rate from the CBS formula. > > Fixes: 1f705bc61aee ("net: stmmac: Add support for CBS QDISC") > Signed-off-by: Xiaolei Wang > Reviewed-by: Wojciech Drewek > --- > > Change log: > > v1: > https://patchwork.kernel.org/project/linux-arm-kernel/patch/20240528092010.439089-1-xiaolei.wang@windriver.com/ > v2: > Update CBS parameters when speed changes after linking up > https://patchwork.kernel.org/project/linux-arm-kernel/patch/20240530061453.561708-1-xiaolei.wang@windriver.com/ > v3: > replace priv->speed with the portTransmitRate from the tc-cbs parameters suggested by Vladimir Oltean > link: https://patchwork.kernel.org/project/linux-arm-kernel/patch/20240607103327.438455-1-xiaolei.wang@windriver.com/ > v4: > Delete speed_div variable, delete redundant port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope; and update commit log > > .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 20 +++++++------------ > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c > index 222540b55480..87af129a6a1d 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c > @@ -344,10 +344,11 @@ static int tc_setup_cbs(struct stmmac_priv *priv, > { > u32 tx_queues_count = priv->plat->tx_queues_to_use; > u32 queue = qopt->queue; > - u32 ptr, speed_div; > + u32 ptr; > u32 mode_to_use; > u64 value; > int ret; > + s64 port_transmit_rate_kbps; The feedback that came along with Wojciech's review in v3 was to use reverse Christmas tree (RCT) variable ordering. That means to sort variable declarations from longest line to shortest. It is the de facto coding style standard for kernel networking code. pw-bot: changes-requested _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel