Subject: Re: [PATCH net-next v8 1/2] net/sched: cls_flower: remove unions from fl_flow_key

From: Jakub Kicinski <[email-masked]>
Date: Sat, 14 Mar 2026 10:00:02 -0700

On Fri, 13 Mar 2026 13:26:51 +0000 Simon Horman wrote:
> It seems to me that the use of a union is intentional here, as either IPv4
> or IPv6 addresses can be present in each case - never both.  And that
> control.addr_type and enc_control.addr_type are intended to allow
> differentiation of the address type in use for each of these unions.

My reading was that the initial author simply wanted to save space in
the struct.

As the commit message explains this leads to complications in the logic
which sets the keys. The alternative is to complicate
FL_KEY_SET_IF_MASKED - doable, but given that the union feels like a
micro-optimization in the first place the simpler approach of separating
fields seems okay too? (TBH my mind also initially went down the
FL_KEY_SET_IF_MASKED rabbit hole but once I saw the simplicity of
Cedric's patch I changed my mind)