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 30939FA3758 for ; Wed, 18 Sep 2024 07:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FLWTg62AkFYXsFN0lnokLNjiHqytNibdSr2EDkOdNJg=; b=SIMvFhhgUO2qWJHUFccarrbEzS E7calND9Oa2m3X8X/CMnY88srzF1jOb6zNgroB/gvjIP1ww0OU0xmQSzEMXfWx/+z6cjhF7EOjiMf ROWlAEJDNmYOisfsYsVlwZdutREmnk4mJ5H7FXO3f0ru1Xuz+ql6QFcVNuoGq4QlXLh6yh0cKvVK5 s4zqp4q20z1vox6cOUhnbWcDLagnIyNgkYd+2+6ilCQVHTEyCu5nRmNEjONtmog1JgCQi7qrxqjI4 7waVeH/hXaLFJXj9RKX/gpkDjwMxsvkT+i9J0SMbJTjsyofEKtXLXXkJtjcs/u2s0U2v0Cx1vClw7 5Ubmr5Kw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sqonE-00000007d3v-2r9z; Wed, 18 Sep 2024 07:08:04 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sqom8-00000007cu1-1b2h for linux-arm-kernel@lists.infradead.org; Wed, 18 Sep 2024 07:06:57 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 614FE5C5440; Wed, 18 Sep 2024 07:06:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4FAC4CECE; Wed, 18 Sep 2024 07:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726643214; bh=JHFisloYJ8iNozFHBXze6I2YOCTCLbb8vU2LUj9xLzE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YjPfdOO6zoXO5DtfASuViQvoPC6Jn+8HRSlyH/Ja2NsNA5j3c7kzMZ7Cgzc75/9Mk 2rUDnDJeMiAAb8SWvctJhsjVtHR6DVJB6LXE1vbRIe/q/xkhT9/sP2p8h15b8lLJbA 6GeRtVhUfX0XggY+yje0tmM6jc1H7NCCxWoyal9sgqQ9/5Zhk9+oA3H5CaEYvs7T9t xFTUL9GlFJBEXawzaHut5UkoqGWOxvQGQHfE5ZeAnQbq0+Xxe+PIjrQ7HwNM53pAQY u7PS2CEdhP/qbusMWyS9Bi8QpCFdL8Jj9omWc5PoNSqN42Np9slQJsFJRXZJaXfcVy fuzboYA/oXy5w== Date: Wed, 18 Sep 2024 08:06:49 +0100 From: Simon Horman To: KhaiWenTan Cc: Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Xiaolei Wang , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Choong Yong Liang , Tan Khai Wen Subject: Re: [PATCH net v2 1/1] net: stmmac: Fix zero-division error when disabling tc cbs Message-ID: <20240918070649.GR167971@kernel.org> References: <20240918061422.1589662-1-khai.wen.tan@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240918061422.1589662-1-khai.wen.tan@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240918_000656_485371_881C9E8A X-CRM114-Status: GOOD ( 14.00 ) 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 On Wed, Sep 18, 2024 at 02:14:22PM +0800, KhaiWenTan wrote: > The commit b8c43360f6e4 ("net: stmmac: No need to calculate speed divider > when offload is disabled") allows the "port_transmit_rate_kbps" to be > set to a value of 0, which is then passed to the "div_s64" function when > tc-cbs is disabled. This leads to a zero-division error. > > When tc-cbs is disabled, the idleslope, sendslope, and credit values the > credit values are not required to be configured. Therefore, adding a return > statement after setting the txQ mode to DCB when tc-cbs is disabled would > prevent a zero-division error. > > Fixes: b8c43360f6e4 ("net: stmmac: No need to calculate speed divider when offload is disabled") > Cc: > Co-developed-by: Choong Yong Liang > Signed-off-by: Choong Yong Liang > Signed-off-by: KhaiWenTan > --- > v2: > - reflected code for better understanding > v1: https://patchwork.kernel.org/project/netdevbpf/patch/20240912015541.363600-1-khai.wen.tan@linux.intel.com/ Thanks for the update. Reviewed-by: Simon Horman