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 B9974CE7AB9 for ; Fri, 6 Sep 2024 07:17:50 +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=3byJr3MiASAF+F9GmkgOz3YAatNcqGIh74M9yB98DC8=; b=lP8ethYfLfRPLnR5ZXPlhGDdkO cErr0C7+6RUcQ16luyOJYFQGGYStAHGFtc6cH3OxzVJwDuwCT2tbqc02rldlJyr9kCa01eegv8v+3 QG2gT8lPXphBW9YnVTTKrbfFjg9l2sGuGPvKYqhp4vSEam3B7eoeX9wEhofnFDcdeUC9JWrJgpCG+ 3OcXD4gsqa+fcKulu1NijGRapuQndnc7bU8xAzndrdLqRq330QGxJm7EO6k7rI2qRb07bacYifsDm RQOyWsrDeSZ8/tyB6irORriw8Venbd32AFW5lRixjSNuSzLzh2VanMm72LEQURd0k8d2e4Ey197lO oW89dkpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smTDt-0000000B3Ef-17ol; Fri, 06 Sep 2024 07:17:37 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smT2B-0000000B0ai-1SMW for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 07:05:32 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E9DE25C403F; Fri, 6 Sep 2024 07:05:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 993E6C4CEC4; Fri, 6 Sep 2024 07:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725606330; bh=AScAThAOffqVw8yqskuDOmgtRyO85CMJfzUFPTeIZc8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o/S2BrqNKAOZZ41HBke9mXKrYpk4+EX1pO5GWja2c/32z5j5NuZrVelOa40bhXAZc vsHHY351Es7I2WOhhmMJUjyeWOjZHwDUhriGvdSmcvmGzHmDNt5SdCcs/tzJ2F3DMI i2ADYfiz6g0+IZvgcFEq7wyifo+n+zPMyiA9m4xO1z6tmdtXzihaNNpL3SwXJDYaJW qMvdcX0zn8FL8cMtaJByPW9GhZyFj4gAVisJb91ACBqZAkBKOZoOMGkeW7sEo48FkL vn+mFI3M5LBhVyvIXzwJ7f2IIC2wCK/cP3GchcDtZdcJMEShW/ccswvKoea1GswAPr EggZLUQoOJxGA== Date: Fri, 6 Sep 2024 08:05:25 +0100 From: Simon Horman To: Sean Anderson Cc: Radhey Shyam Pandey , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Michal Simek , linux-arm-kernel@lists.infradead.org, Ariane Keller , linux-kernel@vger.kernel.org, Daniel Borkmann , Andy Chiu Subject: Re: [PATCH net] net: xilinx: axienet: Fix IRQ coalescing packet count overflow Message-ID: <20240906070525.GK1722938@kernel.org> References: <20240903180059.4134461-1-sean.anderson@linux.dev> <20240904160013.GX4792@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_000531_473323_1D7DCF4D X-CRM114-Status: GOOD ( 27.10 ) 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 Thu, Sep 05, 2024 at 10:34:15AM -0400, Sean Anderson wrote: > On 9/4/24 12:00, Simon Horman wrote: > > On Tue, Sep 03, 2024 at 02:00:59PM -0400, Sean Anderson wrote: > >> If coalesce_count is greater than 255 it will not fit in the register and > >> will overflow. Clamp it to 255 for more-predictable results. > > > > Hi Sean, > > > > Can this occur in practice? > > Yes. Simply do `ethtool -C ethX rx-frames 300` or something similar and > you will end up with a limit of 44 instead. I ran into this with DIM and > was wondering why the highest-throughput setting (256) was behaving so > poorly... I think it would be nice to include an explanation along those lines in the patch description. > > >> > >> Signed-off-by: Sean Anderson > >> Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") > > > > nit: I think it is usual for the order of these tags to be reversed. > > OK > > >> --- > >> > >> drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++++-- > >> 1 file changed, 4 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > >> index 9aeb7b9f3ae4..5f27fc1c4375 100644 > >> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > >> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > >> @@ -252,7 +252,8 @@ static u32 axienet_usec_to_timer(struct axienet_local *lp, u32 coalesce_usec) > >> static void axienet_dma_start(struct axienet_local *lp) > >> { > >> /* Start updating the Rx channel control register */ > >> - lp->rx_dma_cr = (lp->coalesce_count_rx << XAXIDMA_COALESCE_SHIFT) | > >> + lp->rx_dma_cr = (min(lp->coalesce_count_rx, 255) << > >> + XAXIDMA_COALESCE_SHIFT) | > >> XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_ERROR_MASK; > > > > nit: it would be nice to avoid using a naked 255 here. > > Perhaps: #define XAXIDMA_COALESCE_MAX 0xff > > OK, but this is the same as the limit used in axienet_usec_to_timer. Ok, that does muddy the waters a bit.