> -----Original Message-----
> From: Slepecki, Jakub <[email protected]>
> Sent: Tuesday, November 25, 2025 9:35 AM
> To: [email protected]
> Cc: [email protected]; [email protected]; Kitszel,
> Przemyslaw <[email protected]>; Nguyen, Anthony L
> <[email protected]>; [email protected]; Slepecki,
> Jakub <[email protected]>; Loktionov, Aleksandr
> <[email protected]>
> Subject: [PATCH iwl-next v2 4/8] ice: allow overriding lan_en, lb_en in
> switch
>
> Currently, lan_en and lb_en are determined based on switching mode,
> destination MAC, and the lookup type, action type and flags of the rule in
> question. This gives little to no options for the user (such as
> ice_fltr.c) to enforce rules to behave in a specific way.
>
> Such functionality is needed to work with pairs of rules, for example, when
> handling MAC forward to LAN together with MAC,VLAN forward to loopback rules
> pair. This case could not be easily deduced in a context of a single filter
> without adding a specialized flag.
>
> Instead of adding a specialized flag to mark special scenario rules, we add
> a slightly more generic flag to the lan_en and lb_en themselves for the
> ice_fltr.c to request specific destination flags later on, for example, to
> override value:
>
> struct ice_fltr_info fi;
> fi.lb_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED;
> fi.lan_en = ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED;
>
> Signed-off-by: Jakub Slepecki <[email protected]>
>
> ---
> Dropping reviewed-by from MichaĆ due to changes.
>
> Changes in v2:
> - Use FIELD_GET et al. when handling fi.lb_en and fi.lan_en.
> - Rename /LB_LAN/s/_MASK/_M/ because one of uses would need to break
> line.
> ---
...
> if (fi->flag & ICE_FLTR_TX_ONLY)
> - fi->lan_en = false;
> + lan_en = false;
> + if (!FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_M, fi->lb_en))
> + FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_M, &fi->lb_en,
> lb_en);
> + if (!FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_M, fi->lan_en))
> + FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_M, &fi->lan_en,
fi->lb_en and fi->lan_en are declared as bool in struct ice_fltr_info, but you
are now treating them as bitfields using FIELD_GET and FIELD_MODIFY.
I realize it could be something like:
struct ice_fltr_info {
...
u8 lb_lan_flags; /* bitfield: value + force */
...
};
#define ICE_FLTR_INFO_LB_LAN_VALUE_M BIT(0)
#define ICE_FLTR_INFO_LB_LAN_FORCE_M BIT(1)
#define ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED \
(FIELD_PREP_CONST(ICE_FLTR_INFO_LB_LAN_VALUE_M, 1) | \
FIELD_PREP_CONST(ICE_FLTR_INFO_LB_LAN_FORCE_M, 1))
#define ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED \
(FIELD_PREP_CONST(ICE_FLTR_INFO_LB_LAN_FORCE_M, 1))
...