public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Slepecki <jakub.slepecki@intel.com>
To: "Loktionov, Aleksandr" <aleksandr.loktionov@intel.com>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Kitszel, Przemyslaw" <przemyslaw.kitszel@intel.com>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
	"michal.swiatkowski@linux.intel.com"
	<michal.swiatkowski@linux.intel.com>
Subject: Re: [PATCH iwl-next v2 4/8] ice: allow overriding lan_en, lb_en in switch
Date: Fri, 28 Nov 2025 12:55:58 +0100	[thread overview]
Message-ID: <32fd9c75-e133-4f53-b839-101a579fd79f@intel.com> (raw)
In-Reply-To: <IA3PR11MB8986E6C10E42C5DD6DC717B9E5D1A@IA3PR11MB8986.namprd11.prod.outlook.com>

On 2025-11-25 9:59, Loktionov, Aleksandr wrote:
>>   	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, 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 don't see what you mean here.  Both members are u8 without a bit-field
declaration.  Or do you mean they are used as bool or maybe the _en
suffix?

> I realize it could be something like:
> struct ice_fltr_info {
>      ...
>      u8 lb_lan_flags; /* bitfield: value + force */
>      ...
> };

What I see from this sample is that you want me to: pack them, change
their name, and change their description.  Is this correct?

I fully agree about the description.  It's my mistake I left it as-is.
I'll update it according to the overall changes.

I don't think packing them is worth it.  The memory gain is negligible
and the cost is primarily in readability and consistency: we've always
had two fields for these with clear responsibility for each, names
match with datasheet (both "lan en" and "lb en" will hit Table 7-12.),
and packing them would require twice as many constants.

Would the clarification in the description be enough to address your
concerns?  Something like (please ignore bad line breaks):

struct ice_fltr_info {
	...
	/* Rule creation will populate VALUE bit of these members based on switch
	 * type if their FORCE bit is not set.
	 */
	u8 lb_en;	/* VALUE bit: packet can be looped back */
	u8 lan_en;	/* VALUE bit: packet can be forwarded to uplink */
};

> #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))

Does this mean you want me to use {1,0} instead of {true,false}?

In ice_fill_sw_info() I'd prefer to keep them as boolean because they are
semantically correct: we're calculating defaults and then we apply them if
specific values are not forced elsewhere.  Maybe a comment or docs change
would be more in place?  In ICE_FLTR_INFO_LB_LAN_FORCE_{ENABLED,DISABLED},
I used boolean to stay consistent with the ice_fill_sw_info().

But it's not a strong preference.  If it's preferable, I'll change it
to {1,0} across the patch.

Thanks!

  reply	other threads:[~2025-11-28 11:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  8:34 [PATCH iwl-next v2 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
2025-11-25  8:34 ` [PATCH iwl-next v2 1/8] ice: in dvm, use outer VLAN in MAC,VLAN lookup Jakub Slepecki
2025-11-25  8:34 ` [PATCH iwl-next v2 2/8] ice: allow creating mac,vlan filters along mac filters Jakub Slepecki
2025-11-25  8:34 ` [PATCH iwl-next v2 3/8] ice: do not check for zero mac when creating " Jakub Slepecki
2025-11-25  8:34 ` [PATCH iwl-next v2 4/8] ice: allow overriding lan_en, lb_en in switch Jakub Slepecki
2025-11-25  8:59   ` Loktionov, Aleksandr
2025-11-28 11:55     ` Jakub Slepecki [this message]
2025-12-01  7:37       ` Loktionov, Aleksandr
2025-12-02 13:54         ` Jakub Slepecki
2025-11-25  8:34 ` [PATCH iwl-next v2 5/8] ice: update mac,vlan rules when toggling between VEB and VEPA Jakub Slepecki
2025-11-25  8:52   ` Loktionov, Aleksandr
2025-11-28  8:29     ` Jakub Slepecki
2025-11-28  8:36       ` Loktionov, Aleksandr
2025-11-28 12:28         ` Jakub Slepecki
2025-12-01  7:41           ` Loktionov, Aleksandr
2025-11-25  8:34 ` [PATCH iwl-next v2 6/8] ice: add functions to query for vsi's pvids Jakub Slepecki
2025-11-25  8:34 ` [PATCH iwl-next v2 7/8] ice: add mac vlan to filter API Jakub Slepecki
2025-11-25  8:34 ` [PATCH iwl-next v2 8/8] ice: in VEB, prevent "cross-vlan" traffic from hitting loopback Jakub Slepecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32fd9c75-e133-4f53-b839-101a579fd79f@intel.com \
    --to=jakub.slepecki@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox