From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 6F2945A0279 for ; Thu, 30 Nov 2023 10:07:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701335271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WLVWInPnz6I82xZBKAI+zlKlvlFcLAqOe88AlZ9wj8U=; b=HTALZ6PkXQu3cZed4NEqFoySsw36BkdB2xqryYjfzJSthOmGpk6pYwckAJdfcvJiFpTiq7 hF8LYZkIL+HHiQmUWZeXuXUZrLM9xxniyUs20gtunzVjKMxG7Itao6NpP4p+BIbE6HC0hL nqaAEHuWuw9ipnP7BmDSWId6XdpQeew= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-569-quoz_PL9P6i1GanVgn8X2A-1; Thu, 30 Nov 2023 04:07:48 -0500 X-MC-Unique: quoz_PL9P6i1GanVgn8X2A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A30ED185A783; Thu, 30 Nov 2023 09:07:47 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A0222492BFC; Thu, 30 Nov 2023 09:07:46 +0000 (UTC) Date: Thu, 30 Nov 2023 10:07:44 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 3/4] tcp, tcp_splice: CONN_IDX subtraction of pointers isn't always long Message-ID: <20231130100744.16f105df@elisabeth> In-Reply-To: References: <20231129134610.3796809-1-sbrivio@redhat.com> <20231129134610.3796809-4-sbrivio@redhat.com> <20231129145842.5ed82f48@elisabeth> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: DG725ROAZHU36LGCOIYPWUGDYZJWXLDB X-Message-ID-Hash: DG725ROAZHU36LGCOIYPWUGDYZJWXLDB X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: lemmi@nerd2nerd.org, passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 30 Nov 2023 11:27:21 +1100 David Gibson wrote: > On Wed, Nov 29, 2023 at 02:58:42PM +0100, Stefano Brivio wrote: > > On Wed, 29 Nov 2023 14:46:09 +0100 > > Stefano Brivio 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 > > > --- > > > 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 also think it should be unsigned (s/which is signed/which happens to be signed/ in my comment above). At the same time there's no such thing as an unsigned version of ptrdiff_t, so, given the other choices, I would still argue that we should use ptrdiff_t. > > 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? Sure, dropping this. -- Stefano