From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>,
"Sudheer Mogilappagari" <sudheer.mogilappagari@intel.com>,
<netdev@vger.kernel.org>
Subject: Re: [PATCH iwl-next] ice: clean up __ice_aq_get_set_rss_lut()
Date: Wed, 7 Jun 2023 14:56:44 +0200 [thread overview]
Message-ID: <5eb058d0-753e-c91a-c014-a33ca249d1d5@intel.com> (raw)
In-Reply-To: <1bd64ee9-4004-ddc8-6bff-6d8fc75c30c1@intel.com>
On 6/6/23 15:31, Alexander Lobakin wrote:
> From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Date: Tue, 6 Jun 2023 13:11:49 +0200
>
>> Refactor __ice_aq_get_set_rss_lut() to improve reader experience and limit
>> misuse scenarios (undesired LUT size for given LUT type).
>
> [...]
>
> <related block begin>
>
>> + opcode = set ? ice_aqc_opc_set_rss_lut : ice_aqc_opc_get_rss_lut;
>> + ice_fill_dflt_direct_cmd_desc(&desc, opcode);
>> + if (set)
>> + desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
>>
>> - lut_size = params->lut_size;
>> - lut_type = params->lut_type;
>> - glob_lut_idx = params->global_lut_id;
>> + desc_params = &desc.params.get_set_rss_lut;
>> vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
>> + desc_params->vsi_id = cpu_to_le16(vsi_id | ICE_AQC_RSS_VSI_VALID);
>>
>> - cmd_resp = &desc.params.get_set_rss_lut;
>> + if (lut_type == ICE_LUT_GLOBAL)
>> + glob_lut_idx = FIELD_PREP(ICE_AQC_LUT_GLOBAL_IDX,
>> + params->global_lut_id);
>>
>> - if (set) {
>> - ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_rss_lut);
>> - desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
>> - } else {
>> - ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_rss_lut);
>> - }
>> + flags = lut_type | glob_lut_idx | ice_lut_size_to_flag(lut_size);
>> + desc_params->flags = cpu_to_le16(flags);
>
> </related block end>
>
> Now the tricky part much harder to discover than FIELD_*(): you have
>
> {u,__be,__le}{8,16,32,64}_{get,encode,replace}_bits()
>
> macros for such cases :D
> They aren't described in any kdoc and the indexers are not able to index
> them (clangd however can IIRC), you even need some brain processing in
> order to realize they exist. See [0].
>
> I'm not saying they're perfectly applicable for this particular case,
> just FYI.
>
>>
>> - cmd_resp->vsi_id = cpu_to_le16(((vsi_id <<
>> - ICE_AQC_GSET_RSS_LUT_VSI_ID_S) &
>> - ICE_AQC_GSET_RSS_LUT_VSI_ID_M) |
>> - ICE_AQC_GSET_RSS_LUT_VSI_VALID);
>
> [...]
>
> [0]
> https://elixir.bootlin.com/linux/v6.4-rc5/source/include/linux/bitfield.h#L174
>
> Thanks,
> Olek
Thank you for the mention :) I will keep that in mind, but for now I
will leave the code with cpu_to_le16(), as the scope of changes is
reaching single-patch size limits ;P
PK
next prev parent reply other threads:[~2023-06-07 12:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 11:11 [PATCH iwl-next] ice: clean up __ice_aq_get_set_rss_lut() Przemek Kitszel
2023-06-06 13:31 ` Alexander Lobakin
2023-06-07 12:56 ` Przemek Kitszel [this message]
2023-06-06 15:38 ` Simon Horman
2023-06-06 15:42 ` Alexander Lobakin
2023-06-06 16:39 ` Simon Horman
2023-06-06 21:14 ` Przemek Kitszel
2023-06-07 7:34 ` Simon Horman
2023-06-07 16:42 ` Jakub Kicinski
2023-06-07 20:38 ` Simon Horman
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=5eb058d0-753e-c91a-c014-a33ca249d1d5@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=anirudh.venkataramanan@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sudheer.mogilappagari@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;
as well as URLs for NNTP newsgroup(s).