public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: lemmi@nerd2nerd.org, passt-dev@passt.top
Subject: Re: [PATCH 3/4] tcp, tcp_splice: CONN_IDX subtraction of pointers isn't always long
Date: Thu, 30 Nov 2023 11:27:21 +1100	[thread overview]
Message-ID: <ZWfW6WXplWRtsJUS@zatzit> (raw)
In-Reply-To: <20231129145842.5ed82f48@elisabeth>

[-- Attachment #1: Type: text/plain, Size: 2135 bytes --]

On Wed, Nov 29, 2023 at 02:58:42PM +0100, Stefano Brivio wrote:
> On Wed, 29 Nov 2023 14:46:09 +0100
> Stefano Brivio <sbrivio@redhat.com> wrote:
> 
> > On 32-bit architectures, it's a regular int. C99 introduced ptrdiff_t
> > for this case, with a matching length modifier, 't'.
> > 
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> > ---
> >  tcp.c        | 39 +++++++++++++++++++++------------------
> >  tcp_splice.c | 14 +++++++-------
> >  2 files changed, 28 insertions(+), 25 deletions(-)
> > 
> > diff --git a/tcp.c b/tcp.c
> > index 44468ca..c32c9cb 100644
> > --- a/tcp.c
> > +++ b/tcp.c
> > @@ -727,7 +727,7 @@ static void tcp_timer_ctl(const struct ctx *c, struct tcp_tap_conn *conn)
> >  		it.it_value.tv_sec = ACT_TIMEOUT;
> >  	}
> >  
> > -	debug("TCP: index %li, timer expires in %lu.%03lus", CONN_IDX(conn),
> > +	debug("TCP: index %ti, timer expires in %lu.%03lus", CONN_IDX(conn),
> >
> > [...]
> 
> Oops, I just realised this clashes with your "[PATCH v2 03/11] flow,
> tcp: Consolidate flow pointer<->index helpers".

And then a bunch will be obsoleted by "flow, tcp: Add logging helpers
for connection related messages".

> There, however, I guess that the new flow_idx() should return ptrdiff_t,
> which is signed.

Actually, no, I don't think so.  Yes the expression that generates it
is naturally of type ptrdiff_t.  But it's a bug to call flow_idx() on
something not in the flow table, and places where we want to pass *in*
a flow table index it makes more sense for it to be unsigned.  So I
think flow indices should be unsigned throughout.

> I can drop this patch if you re-spin it (assuming it makes sense to
> you), or I can adapt it on top of your patch -- whatever is most
> convenient for you.

I have a couple of reasons to re-spin anyway.  So how about you drop
this, and I'll double check that I get the format specifiers sane
after my series?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-11-30  0:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 13:46 [PATCH 0/4] Fix build warnings and errors for 32-bit and musl Stefano Brivio
2023-11-29 13:46 ` [PATCH 1/4] treewide: Use 'z' length modifier for size_t/ssize_t conversions Stefano Brivio
2023-11-30  0:15   ` David Gibson
2023-11-30  9:06     ` Stefano Brivio
2023-11-30 23:10       ` David Gibson
2023-11-29 13:46 ` [PATCH 2/4] packet: Offset plus length is not always uint32_t, but it's always size_t Stefano Brivio
2023-11-30  0:18   ` David Gibson
2023-11-30  9:06     ` Stefano Brivio
2023-11-30  9:07     ` Stefano Brivio
2023-11-30 23:12       ` David Gibson
2023-11-29 13:46 ` [PATCH 3/4] tcp, tcp_splice: CONN_IDX subtraction of pointers isn't always long Stefano Brivio
2023-11-29 13:58   ` Stefano Brivio
2023-11-30  0:27     ` David Gibson [this message]
2023-11-30  9:07       ` Stefano Brivio
2023-11-30 23:13         ` David Gibson
2023-11-29 13:46 ` [PATCH 4/4] port_fwd, util: Include additional headers to fix build with musl Stefano Brivio
2023-11-30  0:30   ` David Gibson

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=ZWfW6WXplWRtsJUS@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=lemmi@nerd2nerd.org \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /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).