Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Julia Lawall <julia.lawall@inria.fr>,
	netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1] idpf: refactor some missing field get/prep conversions
Date: Tue, 5 Dec 2023 17:10:58 -0800	[thread overview]
Message-ID: <eff20fb6-d2d3-4b12-8d46-1cd891ad0156@intel.com> (raw)
In-Reply-To: <30c89a45-602f-4fd4-9fe0-70f335859f8f@intel.com>

On 12/4/2023 2:26 AM, Alexander Lobakin wrote:
yping.
> 
> What is "not a constant"?
> 
> 	ring[nta] = FIELD_PREP(IDPF_RX_BI_GEN_M,
> 			       test_bit(__IDPF_Q_GEN_CHK, flags));
> 
> Is there a problem with this ^ code?
> 
> "The scripts ignored that" is not a good argument I'd say :>

Fixed in v2


>> Generally I'd prefer that the kind of check above returned a bool with a
>> constant conversion of the mask (compile time) to an LE16 mask, and then
>> use that, which is why all of our other drivers do that instead.
> 
> Ah, good point. Smth like
> 
> 		gen = !!(tx_desc->qid_comptype_gen &
> 			 IDPF_TXQ_COMPLQ_GEN_M_LE);

Yeah, it would be nice but I didn't add that to this series. But you
have the idea.

> 
> OTOH x86 is always LE and BE is seen more and more rarely nowadays. It
> might just not worth having a LE-version of each such mask for the sake
> of a bit more optimized code on architectures where our drivers are
> barely used.

Our drivers should work on BE, IMO. sparse annotations takes care of
making sure we have the conversions right, they cost nothing on x86.

> 
>>
>>>
>>> Moreover, you could use le*_{get,encode,replace}_bits() to get/set LE
>>> values right away without 2-step operation (from/to CPU + masks), but
>>> you didn't do that here (see below for an example).

Done in v2.

>>
>> Those aren't widely used yet in our drivers so I wasn't picking them up
>> yet. But thank you for pointing that out.
>>
>> <snip>
>>
>>
>>> In general, I would say those two issues are very common in IDPF and
>>> also the whole your series converting the Intel drivers. The scripts
>>> won't check whether the mask has only 1 bit or whether the value gets
>>> converted from/to LE, so they won't help here.
>>
>> I had been hoping to do some more followup work. it's possible that with
>> some tweaking the coccinelle script could learn how to detect non-pow2
>> constants, and therefore possibly one bit constants as well. Maybe
>> @Julia can help us refine the script and possibly get it into the
>> scripts/coccinelle directory to help other drivers as well.
> 
> Every automated change needs polishing by human.
> 
> Don't FIELD_*() macros already check whether the passed mask is actually
> a contiguous mask?

Yes

> 
>>
>>> Could you maybe manually recheck all the places where bitfield masks are
>>> used at least in IDPF (better in ice, iavf, i40e, ..., as well) and
>>> posted a series that would address them? At the end, manual work is more
>>> valuable than automated conversions :p
>>
>> I think a followup series would work better for this, do you agree?
> 
> Nope :D If you want to convert all of our drivers to use bitfield API,
> I'd like to see a complete mature series instead of incremental series
> of series where followups will refactor the code introduced in the
> earlier ones.

v2 of the previous series sent with audit of all *cpu* conversions and
fixing up leXX_*_bits() opportunities.

Appreciate the reviews!

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2023-12-06  1:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 21:45 [Intel-wired-lan] [PATCH iwl-next v1] idpf: refactor some missing field get/prep conversions Jesse Brandeburg
2023-12-01  7:52 ` Przemek Kitszel
2023-12-01 14:32 ` Alexander Lobakin
2023-12-01 20:12   ` Jesse Brandeburg
2023-12-01 20:43     ` Julia Lawall
2023-12-04 10:26     ` Alexander Lobakin
2023-12-06  1:10       ` Jesse Brandeburg [this message]
2023-12-06 12:33         ` Alexander Lobakin

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=eff20fb6-d2d3-4b12-8d46-1cd891ad0156@intel.com \
    --to=jesse.brandeburg@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=julia.lawall@inria.fr \
    --cc=netdev@vger.kernel.org \
    /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