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

From: Simon Horman <[email-masked]>
Date: Mon, 16 Mar 2026 08:34:47 +0000

On Sat, Mar 14, 2026 at 10:00:02AM -0700, Jakub Kicinski wrote:
> 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)

Sure, now this has been put to me more than once I agree.

But if we go this way, then can we also simplify some of the existing logic?
As a follow-up?