public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: Anshu Kumari <anskuma@redhat.com>,
	passt-dev@passt.top, david@gibson.dropbear.id.au
Subject: Re: [PATCH v1 2/2] tap, tcp, udp: Use rate-limited logging
Date: Thu, 02 Apr 2026 17:33:07 +0200 (CEST)	[thread overview]
Message-ID: <20260402173306.6eee89b6@elisabeth> (raw)
In-Reply-To: <d6a25c28-f6db-4e32-b8f5-752361d7c478@redhat.com>

On Thu, 2 Apr 2026 17:10:12 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> On 4/1/26 20:29, Anshu Kumari wrote:
>
> [...]
>
> > +++ b/tap.c
> > @@ -686,17 +686,11 @@ static bool tap4_is_fragment(const struct iphdr *iph,
> >   			     const struct timespec *now)
> >   {
> >   	if (ntohs(iph->frag_off) & ~IP_DF) {
> > -		/* Ratelimit messages */
> > -		static time_t last_message;
> >   		static unsigned num_dropped;
> >   
> >   		num_dropped++;
> > -		if (now->tv_sec - last_message > FRAGMENT_MSG_RATE) {  
> 
> the #define FRAGMENT_MSG_RATE can be removed from the file as it is unused now.
> 
> > -			warn("Can't process IPv4 fragments (%u dropped)",
> > -			     num_dropped);
> > -			last_message = now->tv_sec;
> > -			num_dropped = 0;
> > -		}
> > +		warn_ratelimit(now, "Can't process IPv4 fragments (%u dropped)",
> > +			       num_dropped);  
> 
> I don't think we should keep the num_dropped value here as it is never reset, the 
> "suppressed %u similar messages" will give the information.

Wait, that was actually my suggestion based on the previous patch:

  https://archives.passt.top/passt-dev/20260324210145.1f530a59@elisabeth/

reporting here for convenience:

---
If you just drop "(%u dropped)", it will be pretty hard to understand
the rate at which fragments are being sent: is it one per second or a
thousand? That makes a difference while debugging things.

I would suggest to keep the 'num_dropped' counter, keep printing the
number (without zeroing it, because you don't know when to do it here),
and yes, it will wrap eventually (become 0 again), but the wrapping
should be very obvious, and it's better than having no indication at
all.
---

-- 
Stefano


      reply	other threads:[~2026-04-02 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 18:29 Anshu Kumari
2026-04-02 15:10 ` Laurent Vivier
2026-04-02 15:33   ` Stefano Brivio [this message]

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=20260402173306.6eee89b6@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=anskuma@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).