From: Jacob Keller <jacob.e.keller@intel.com>
To: Andrew Lunn <andrew@lunn.ch>,
Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<dan.carpenter@linaro.org>, <horms@kernel.org>,
<pmenzel@molgen.mpg.de>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next] ixgbe: e610: remove redundant assignment
Date: Thu, 29 Jan 2026 10:10:37 -0800 [thread overview]
Message-ID: <8b146fee-a63e-4e22-a1c1-eae052786e66@intel.com> (raw)
In-Reply-To: <60e6bfa6-4267-4d33-9987-24b87c0d0091@lunn.ch>
On 1/29/2026 9:44 AM, Andrew Lunn wrote:
>> /* Read sync Admin Command response */
>> - if ((hicr & IXGBE_PF_HICR_SV)) {
>> - for (i = 0; i < IXGBE_ACI_DESC_SIZE_IN_DWORDS; i++) {
>> + if ((hicr & IXGBE_PF_HICR_SV))
>> + for (i = 0; i < IXGBE_ACI_DESC_SIZE_IN_DWORDS; i++)
>> raw_desc[i] = IXGBE_READ_REG(hw, IXGBE_PF_HIDA(i));
>> - raw_desc[i] = raw_desc[i];
>
> Did you look through the history? When i see code like this it makes
> me want to have an understanding why it exists, since it looks so odd.
>
> Is it a merge conflict resolution gone bad? Is it a typo and there is
> a cooked_desc[i] which could be set?
>
Nope. Looking at git blame for the kernel, this appears to have been
here since its submission. I then went and checked what was done in the
out-of-tree releases out of curiosity, and it looks like there was
originally a CPU_TO_LE32 macro which was doing byte swaps, and an
equivalent when writing the data in to the registers.
raw_desc[1] = read_reg(...);
raw_desc[1] = cpu_to_le32(raw_desc[i]);
I suspect the byte swapping got removed from the original upstream
submission but no one noticed the extra assignment.
Of course the register accesses always read the values in host order,
and I can't imagine an OS not doing that...
Hmm.. But now I have some questions...
The raw_desc value comes from the desc parameter of the function. Thats
libie_aq_desc now, and its defined using __le* values..
We're chunking up the descriptor buffer and writing it to a bunch of
register blocks, and we don't convert from LE32 to CPU now... so on a
BigEndian system this is going to not swap the values properly...
Which makes me think the original change would be required on BE32
systems.. But.. even worse..
I don't think we actually can just blindly copy the values as chunks of
4 bytes and byte swap them.. That would re-arrange the fields, since the
structure layout uses __le16:
> struct libie_aq_desc {
> __le16 flags;
> __le16 opcode;
These would get swapped out of order.
> __le16 datalen;
> __le16 retval;
> __le32 cookie_high;
> __le32 cookie_low;
> union {
> u8 raw[16];
> struct libie_aqc_generic generic;
> struct libie_aqc_get_ver get_ver;
> struct libie_aqc_driver_ver driver_ver;
> struct libie_aqc_req_res res_owner;
> struct libie_aqc_list_caps get_cap;
> struct libie_aqc_fw_log fw_log;
> } params;
> };
> LIBIE_CHECK_STRUCT_LEN(32, libie_aq_desc);
I actually don't know which is "correct", as I don't really understand
what the register interface expects, and how it will get interpreted by
the firmware...
Maybe the byteswap of each 4-byte block is right? but I'm really
uncertain now...
Presumably it expects flags first and then opcode? we're writing it that
way now on a LE system.. But on a BE system thats going to be
byteswapped before going into the register.. so our 4byte chunk would
end up potentially reversing the flags and opcode w.r.t what the
firmware sees??
Hmm.....
>> /* Read async Admin Command response */
>> - if ((hicr & IXGBE_PF_HICR_EV) && !(hicr & IXGBE_PF_HICR_C)) {
>> - for (i = 0; i < IXGBE_ACI_DESC_SIZE_IN_DWORDS; i++) {
>> + if ((hicr & IXGBE_PF_HICR_EV) && !(hicr & IXGBE_PF_HICR_C))
>> + for (i = 0; i < IXGBE_ACI_DESC_SIZE_IN_DWORDS; i++)
>> raw_desc[i] = IXGBE_READ_REG(hw, IXGBE_PF_HIDA_2(i));
>> - raw_desc[i] = raw_desc[i];
>
> and it exists twice. Which makes it even odder....
>
> Andrew
next prev parent reply other threads:[~2026-01-29 18:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 17:54 [PATCH iwl-next] ixgbe: e610: remove redundant assignment Piotr Kwapulinski
2026-01-29 17:44 ` Andrew Lunn
2026-01-29 18:10 ` Jacob Keller [this message]
2026-02-05 8:35 ` [Intel-wired-lan] " Kwapulinski, Piotr
2026-02-05 23:32 ` Jacob Keller
2026-01-30 7:41 ` Loktionov, Aleksandr
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=8b146fee-a63e-4e22-a1c1-eae052786e66@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew@lunn.ch \
--cc=dan.carpenter@linaro.org \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=piotr.kwapulinski@intel.com \
--cc=pmenzel@molgen.mpg.de \
/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