From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fakghnpn; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 2200D5A0272 for ; Thu, 05 Mar 2026 01:38:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772671118; 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=92t+E8PDTY7dvfAekgyxOEHrluGpF8ajyWuqXfCQL4c=; b=fakghnpndpQ1zQOqYj/T73S0pvixqH8mDGM0QTyqkqPHUdC8bHAAfLndRybVUzBkQ+noeb cle+wC7o5kd5oM/l+4Dbz0CtihR7XMiGwjVWNBkMiZHV/tA6IHeZVhzeexe6opuCgMSWQE nC5t/33RN72i52gnzHC5hW5N7yanhCE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-378-fMVS2D4aMW-zSs3rxPZoqg-1; Wed, 04 Mar 2026 19:38:36 -0500 X-MC-Unique: fMVS2D4aMW-zSs3rxPZoqg-1 X-Mimecast-MFC-AGG-ID: fMVS2D4aMW-zSs3rxPZoqg_1772671116 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4837a71903aso43441915e9.1 for ; Wed, 04 Mar 2026 16:38:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772671115; x=1773275915; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=92t+E8PDTY7dvfAekgyxOEHrluGpF8ajyWuqXfCQL4c=; b=o/7UEABHTeO1OjmePysRIQDIn+Rcg8p0CMe8Kd2zX0DAhbdvBttVdrDd3axyNckLT/ QYnPf7x+hy41CIhzGfqskgsXAOKfD/nVbKsZ1wAaDR3AGXx2mCObiUmPcdqqqJpIS3zG Y6ybqt6+WSOSbBcIrOuf2h26BKCUQsOFn2oX9EpzaqcBWvPQkM6JYIloNGOvmaF2aFU0 t/6Fr0Tch5EPaMMHvoumMH9NJ0qYvtzDMXbaXaiQzr0M5kzl1EDuw6Y78Gck3kZXdOxs 0n7/CWliUGMOpICCArN4sMdC8pYanjqtD7wT5QtYBKCTDXYW4PJKdGQXe1XK2bPx9jSf Axow== X-Gm-Message-State: AOJu0YxOwllHZNPWw3y6OKGMdYeY0md1qN/WqKYx7/jyu4AMx12qweMA JEbiIrL/gdFSjz3O9Cc7aDMVoVyokaJ73hqyDXizCNq8QVhNB8mIeciV1G50z3wbw6K3AxsSKVw NRRpzkTr7LODU+X5yTPczQheLaKYcwIvF14EYiwcrCex4fmQPU9WrQg== X-Gm-Gg: ATEYQzyjr9Tv0DhNZQQ25qIKrdJMt8kapwLl/ZhCUrA4Gv/TYM0fLM0E0VseQjcT7Eg u01Uh1KuIYHTS7I1Dev4mufDw4ukvbqnsiNI8wUqQjmtX1OqsLU8RyT8Ha4H0IE3Pu+sS+k3Stn NkmDrvh45B+IwdY04TIEBX5nOSSsbCgNpVgoB2VJA5fcBA6SgQK0e4kp408qlL4LWZUD2Gm7zCM u1lF4iUsflnblaq5PQ9VEA9Cegq2nEqTfcn+yFQKWTqRCgoA4JnYKxHhz+vApVvcL4I2iu/I8MC 8SyCDx22jZwRNt5b/PQ3wBsBYernenV+lqboNdZgjEw417Gpp+KU9jVZ4zwb72eCh6IwUsOrrau /ue8FdYR0NvPgCZQCnMpWQSsRlNFqN66L8PXlZs/LbsnG/EBODA== X-Received: by 2002:a05:600c:3ba2:b0:47a:814c:ee95 with SMTP id 5b1f17b1804b1-4851984bc7dmr67351245e9.12.1772671115516; Wed, 04 Mar 2026 16:38:35 -0800 (PST) X-Received: by 2002:a05:600c:3ba2:b0:47a:814c:ee95 with SMTP id 5b1f17b1804b1-4851984bc7dmr67351095e9.12.1772671115047; Wed, 04 Mar 2026 16:38:35 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fad02a2sm5597245e9.2.2026.03.04.16.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 16:38:34 -0800 (PST) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 2/3] fwd, pif: Replace with pif_sock_l4() with pif_listen() Message-ID: <20260305013833.74b0cd67@elisabeth> In-Reply-To: References: <20260302043135.800803-1-david@gibson.dropbear.id.au> <20260302043135.800803-3-david@gibson.dropbear.id.au> <20260303201138.293e2f83@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Thu, 05 Mar 2026 01:38:34 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: L6sOOXzRByCrp5DL4kagZJuNBHooerfhmXz8OonzbW8_1772671116 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: HLK7FT3D626NILGK6BW766LV747ORQQY X-Message-ID-Hash: HLK7FT3D626NILGK6BW766LV747ORQQY 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: passt-dev@passt.top, Peter Foley 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 Wed, 4 Mar 2026 09:55:21 +1100 David Gibson wrote: > On Tue, Mar 03, 2026 at 08:11:39PM +0100, Stefano Brivio wrote: > > On Mon, 2 Mar 2026 15:31:34 +1100 > > David Gibson wrote: > > > > > It turns out all users of pif_sock_l4() use it for "listening" sockets, > > > which now all have a common epoll reference format. We can take advantage > > > of that to pass the necessary epoll information into pif_sock_l4() in a > > > more natural way, rather than as an opaque u32. > > > > > > That in turn allows union fwd_listen_ref can become a struct, since the > > > union only exist to allow the meaningful fields to be coerced into a u32 > > > for pif_sock_l4(). > > > > > > Rename pif_sock_l4() to pif_listen() to reflect the new semantics. While > > > we're there, remove the static_assert() on the fwd_listen_ref's size. We > > > do still need it to fit into 32 bits, but that constraint is imposed only > > > by the fact that it needs to fit into the whole, epoll_ref structure, > > > which we already check with a static_assert() in epoll_ctl.h. > > > > > > Signed-off-by: David Gibson > > > --- > > > epoll_ctl.h | 2 +- > > > fwd.h | 14 +++++--------- > > > pif.c | 14 ++++++++------ > > > pif.h | 6 +++--- > > > tcp.c | 8 +------- > > > udp.c | 8 +------- > > > 6 files changed, 19 insertions(+), 33 deletions(-) > > > > > > diff --git a/epoll_ctl.h b/epoll_ctl.h > > > index 2c103cde..879763cb 100644 > > > --- a/epoll_ctl.h > > > +++ b/epoll_ctl.h > > > @@ -35,7 +35,7 @@ union epoll_ref { > > > union { > > > uint32_t flow; > > > flow_sidx_t flowside; > > > - union fwd_listen_ref listen; > > > + struct fwd_listen_ref listen; > > > uint32_t data; > > > int nsdir_fd; > > > int queue; > > > diff --git a/fwd.h b/fwd.h > > > index 16070111..b0e2373d 100644 > > > --- a/fwd.h > > > +++ b/fwd.h > > > @@ -49,20 +49,16 @@ struct fwd_rule { > > > #define FWD_NO_HINT (-1) > > > > > > /** > > > - * union fwd_listen_ref - information about a single listening socket > > > + * struct fwd_listen_ref - information about a single listening socket > > > * @port: Bound port number of the socket > > > * @pif: pif in which the socket is listening > > > * @rule: Index of forwarding rule > > > */ > > > -union fwd_listen_ref { > > > - struct { > > > - in_port_t port; > > > - uint8_t pif; > > > - unsigned rule :FWD_RULE_BITS; > > > - }; > > > - uint32_t u32; > > > +struct fwd_listen_ref { > > > + in_port_t port; > > > + uint8_t pif; > > > + unsigned rule :FWD_RULE_BITS; > > > }; > > > -static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t)); > > > > Reported-by: Peter Foley > > Good point. Can you add this on merge? Sure, done. Applied now. -- Stefano