* [PATCH] udp_flow: remove unneeded epoll_ref indirection
@ 2026-01-07 15:06 Laurent Vivier
2026-01-07 23:41 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2026-01-07 15:06 UTC (permalink / raw)
To: passt-dev; +Cc: Laurent Vivier
The fref union was used to convert flow_sidx_t to uint32_t for
assignment to ref.data. This is unnecessary since epoll_ref already
contains a flowside member of type flow_sidx_t, so we can assign
directly.
This aligns with how icmp.c and other callers assign flow_sidx_t to
epoll_ref.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
udp_flow.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/udp_flow.c b/udp_flow.c
index 8907f2f72741..0ba788060db7 100644
--- a/udp_flow.c
+++ b/udp_flow.c
@@ -74,10 +74,6 @@ static int udp_flow_sock(const struct ctx *c,
{
const struct flowside *side = &uflow->f.side[sidei];
uint8_t pif = uflow->f.pif[sidei];
- union {
- flow_sidx_t sidx;
- uint32_t data;
- } fref = { .sidx = FLOW_SIDX(uflow, sidei) };
union epoll_ref ref;
int rc;
int s;
@@ -89,7 +85,7 @@ static int udp_flow_sock(const struct ctx *c,
}
ref.type = EPOLL_TYPE_UDP;
- ref.data = fref.data;
+ ref.flowside = FLOW_SIDX(uflow, sidei);
ref.fd = s;
flow_epollid_set(&uflow->f, EPOLLFD_ID_DEFAULT);
--
2.52.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] udp_flow: remove unneeded epoll_ref indirection
2026-01-07 15:06 [PATCH] udp_flow: remove unneeded epoll_ref indirection Laurent Vivier
@ 2026-01-07 23:41 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2026-01-07 23:41 UTC (permalink / raw)
To: Laurent Vivier; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]
On Wed, Jan 07, 2026 at 04:06:12PM +0100, Laurent Vivier wrote:
> The fref union was used to convert flow_sidx_t to uint32_t for
> assignment to ref.data. This is unnecessary since epoll_ref already
> contains a flowside member of type flow_sidx_t, so we can assign
> directly.
>
> This aligns with how icmp.c and other callers assign flow_sidx_t to
> epoll_ref.
Huh, yes. The UDP flow sockets are definitely supposed to be using
ref.flowside. Sorry I didn't catch this on initial review.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> udp_flow.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/udp_flow.c b/udp_flow.c
> index 8907f2f72741..0ba788060db7 100644
> --- a/udp_flow.c
> +++ b/udp_flow.c
> @@ -74,10 +74,6 @@ static int udp_flow_sock(const struct ctx *c,
> {
> const struct flowside *side = &uflow->f.side[sidei];
> uint8_t pif = uflow->f.pif[sidei];
> - union {
> - flow_sidx_t sidx;
> - uint32_t data;
> - } fref = { .sidx = FLOW_SIDX(uflow, sidei) };
> union epoll_ref ref;
> int rc;
> int s;
> @@ -89,7 +85,7 @@ static int udp_flow_sock(const struct ctx *c,
> }
>
> ref.type = EPOLL_TYPE_UDP;
> - ref.data = fref.data;
> + ref.flowside = FLOW_SIDX(uflow, sidei);
> ref.fd = s;
>
> flow_epollid_set(&uflow->f, EPOLLFD_ID_DEFAULT);
> --
> 2.52.0
>
--
David Gibson (he or they) | 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-07 23:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-07 15:06 [PATCH] udp_flow: remove unneeded epoll_ref indirection Laurent Vivier
2026-01-07 23:41 ` David Gibson
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).