linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Sean Anderson <sean.anderson@linux.dev>
Cc: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, Michal Simek <michal.simek@amd.com>,
	linux-arm-kernel@lists.infradead.org,
	Ariane Keller <ariane.keller@tik.ee.ethz.ch>,
	linux-kernel@vger.kernel.org,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andy Chiu <andy.chiu@sifive.com>
Subject: Re: [PATCH net] net: xilinx: axienet: Fix IRQ coalescing packet count overflow
Date: Fri, 6 Sep 2024 08:05:25 +0100	[thread overview]
Message-ID: <20240906070525.GK1722938@kernel.org> (raw)
In-Reply-To: <a9ad456d-eeff-4fac-a18d-0219fcc9f5ed@linux.dev>

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 <sean.anderson@linux.dev>
> >> 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.


  reply	other threads:[~2024-09-06  7:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 18:00 [PATCH net] net: xilinx: axienet: Fix IRQ coalescing packet count overflow Sean Anderson
2024-09-04 16:00 ` Simon Horman
2024-09-05 14:34   ` Sean Anderson
2024-09-06  7:05     ` Simon Horman [this message]
2024-09-04 17:19 ` Pandey, Radhey Shyam
2024-09-05 14:55   ` Sean Anderson
2024-09-09 23:53     ` Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240906070525.GK1722938@kernel.org \
    --to=horms@kernel.org \
    --cc=andy.chiu@sifive.com \
    --cc=ariane.keller@tik.ee.ethz.ch \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=sean.anderson@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).