Message ID | 20231101061920.401582-1-yi.fang.gan@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp216395vqx; Tue, 31 Oct 2023 23:22:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtuGE1ja1EsT2yOeEUXZW2WoTv99TmsEO2V3A3fMSacGZNuke0Dm7umlBDm9Gl10kjmAWu X-Received: by 2002:a05:6358:904c:b0:168:dbac:b94e with SMTP id f12-20020a056358904c00b00168dbacb94emr18735456rwf.32.1698819773451; Tue, 31 Oct 2023 23:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698819773; cv=none; d=google.com; s=arc-20160816; b=fOgWtIeF67S4a5mNoMD05L9tY1u3vq8/tUNb6nD9+prMOZhCJxMCMqnj1faXt6QZPp 0CHMlGLD1MKq9tx72LrOuCilzKUdpNEgizmmjE39bqTVXTRzw7yLmS/69L8/QEcC59Kv +mackZa0nh/L2jY57l9ZRuXYLO7hjB6DGN0xKU/FMraLxkMJzZhZow7wnITIAIJeOhRd 0ZgGOK8yJTbPnT8er2hSjPROkL44JwGMWicYJwrC8IDig2iszeQuErFAr3DrnqakR3x8 GiarXBGejXVy2Y2bXmce+xkdOY+pr+HuSIMT6SyizNriheP3ASazcIoByYN5zI2WqSja lkzA== 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=Ct4Yoos+NVIqxfGauWKSSi+j3xWdlR6eSAnP4cc9/JU=; fh=EtSHjr0LVzFTVFr7/0EuT86GAwHEW/XgWOTDQnQ2zpQ=; b=K1Fqjr4fpjRsFjcGImSXqavBWYqkgh5S5AGnDRCAa2BZa3ndM57RtZPK5hV3+C6BnC lCbQaBN7Pl/qwQPLTAHIrboLgGk7VnT9gQXoiv/tbXjQa8WdV/m4BRh1f7J57Wp09SBA 1me7PWByvj2tQNccsQJ7oJIcD22PTY2vPpWF3LdZFV71CxnxvGv26hsiWrHMLlX0x/R+ letaek+Yp5N2j+CxO8JcDozi1nSogX/ZXhcJMZmtR6iYUL39hRYw0G5hg3Y1irvJi4NJ QAj1JIQPqXdGiqidcQScrqmQU6VsKvThXi0Bo4y13Pu/3SCyQrqqwjVlK+RM9AWJ/iCC wQgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g7T8ht7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x5-20020a654145000000b00563de199314si2363507pgp.896.2023.10.31.23.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 23:22:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g7T8ht7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 8C7B2812D21A; Tue, 31 Oct 2023 23:22:52 -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 S230397AbjKAGWt (ORCPT <rfc822;rbbytesnap@gmail.com> + 35 others); Wed, 1 Nov 2023 02:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbjKAGWs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Nov 2023 02:22:48 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C9A98; Tue, 31 Oct 2023 23:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698819766; x=1730355766; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9wz2LHUoWqpe98OcYQ2/Jx5c2J985NHQToFkCmXdymk=; b=g7T8ht7szX+KKcdvkx4bi2CPwGP4BPuxZDyNrPbwE9MR/1r9HehhaEOB qpLonj9rtYCBivIYLPcD4YwsNzVrVt0DfG4X2CxxsrWDGaDYyDlBoa8+T QpQ+GamJ2IwxNon3odGhtFnFEYV0Cth+k+UoWI/0iajb4/TULW4Fd/2n9 zMvCaFNmk7yBEEjgOuRGo5y5Tvz2l9MxqLDf6WvrYhknM0RUL5bt7V67g APt25+35fzn3BCahNtLei4Bnp+ygN2V6WIJ41mpk1bGYTvyhjYptMJIz3 F4XUw9TyacuPoTisDAUbanncVpyA7LuyuUmDEtFEvxys7VTc2/A61fVcz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="454914644" X-IronPort-AV: E=Sophos;i="6.03,267,1694761200"; d="scan'208";a="454914644" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 23:22:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,267,1694761200"; d="scan'208";a="1995351" Received: from ssid-ilbpg3-teeminta.png.intel.com ([10.88.227.74]) by orviesa002.jf.intel.com with ESMTP; 31 Oct 2023 23:22:41 -0700 From: Gan Yi Fang <yi.fang.gan@intel.com> To: Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, 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 <hong.aun.looi@intel.com>, Voon Weifeng <weifeng.voon@intel.com>, Song Yoong Siang <yoong.siang.song@intel.com>, Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>, Gan Yi Fang <yi.fang.gan@intel.com> Subject: [PATCH net-next v2 1/1] net: stmmac: check CBS input values before configuration Date: Wed, 1 Nov 2023 14:19:20 +0800 Message-Id: <20231101061920.401582-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.4 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,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> 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]); Tue, 31 Oct 2023 23:22:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781341642607829916 X-GMAIL-MSGID: 1781341642607829916 |
Series |
[net-next,v2,1/1] net: stmmac: check CBS input values before configuration
|
|
Commit Message
Gan, Yi Fang
Nov. 1, 2023, 6:19 a.m. UTC
From: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com> Add check for below conditions before proceeding to configuration. A message will be prompted if the input value is invalid. Idleslope minus sendslope should equal speed_div. Idleslope is always a positive value including zero. Sendslope is always a negative value including zero. Hicredit is always a positive value including zero. Locredit is always a negative value including zero. Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com> Signed-off-by: Gan, Yi Fang <yi.fang.gan@intel.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 5 +++++ 1 file changed, 5 insertions(+)
Comments
On Wed, Nov 01, 2023 at 02:19:20PM +0800, Gan Yi Fang wrote: > From: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com> > > Add check for below conditions before proceeding to configuration. > A message will be prompted if the input value is invalid. > > Idleslope minus sendslope should equal speed_div. > Idleslope is always a positive value including zero. > Sendslope is always a negative value including zero. > Hicredit is always a positive value including zero. > Locredit is always a negative value including zero. Which of these conditional are specific to stmmac, and which are generic to CBS? Anything which is generic to CBS i would expect to be checked at a higher level, rather than in every driver implementing CBS. Andrew
Hi Andrew, The values are not specific to stmmac driver. It is more making sense to implement the checking at higher level. Let's close the review for this patch. Best Regards, Fang > -----Original Message----- > From: Andrew Lunn <andrew@lunn.ch> > Sent: Wednesday, November 1, 2023 8:36 PM > To: Gan, Yi Fang <yi.fang.gan@intel.com> > Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>; Jose Abreu > <joabreu@synopsys.com>; David S . Miller <davem@davemloft.net>; Eric > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni <pabeni@redhat.com>; Maxime Coquelin > <mcoquelin.stm32@gmail.com>; netdev@vger.kernel.org; linux-stm32@st-md- > mailman.stormreply.com; linux-arm-kernel@lists.infradead.org; linux- > kernel@vger.kernel.org; Looi, Hong Aun <hong.aun.looi@intel.com>; Voon, > Weifeng <weifeng.voon@intel.com>; Song, Yoong Siang > <yoong.siang.song@intel.com>; Sit, Michael Wei Hong > <michael.wei.hong.sit@intel.com> > Subject: Re: [PATCH net-next v2 1/1] net: stmmac: check CBS input values > before configuration > > On Wed, Nov 01, 2023 at 02:19:20PM +0800, Gan Yi Fang wrote: > > From: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com> > > > > Add check for below conditions before proceeding to configuration. > > A message will be prompted if the input value is invalid. > > > > Idleslope minus sendslope should equal speed_div. > > Idleslope is always a positive value including zero. > > Sendslope is always a negative value including zero. > > Hicredit is always a positive value including zero. > > Locredit is always a negative value including zero. > > Which of these conditional are specific to stmmac, and which are generic to > CBS? Anything which is generic to CBS i would expect to be checked at a higher > level, rather than in every driver implementing CBS. > > Andrew
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index ac41ef4cbd2f..e8a079946f84 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -381,6 +381,11 @@ static int tc_setup_cbs(struct stmmac_priv *priv, return -EOPNOTSUPP; } + if ((qopt->idleslope - qopt->sendslope != speed_div) || + qopt->idleslope < 0 || qopt->sendslope > 0 || + qopt->hicredit < 0 || qopt->locredit > 0) + return -EINVAL; + mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use; if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) { ret = stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_AVB);