From: Simon Horman <horms@kernel.org>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Ariane Keller <ariane.keller@tik.ee.ethz.ch>,
Michal Simek <michal.simek@amd.com>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: net: xilinx: axienet: Query about checksum partial implementation
Date: Fri, 26 Jul 2024 13:07:00 +0100 [thread overview]
Message-ID: <20240726120700.GA1694627@kernel.org> (raw)
Hi Radhey, all,
I am wondering if you could shed some light on the following
checksum partial handling in the axienet_rx_poll():
/* if we're doing Rx csum offload, set it up */
if (lp->features & XAE_FEATURE_FULL_RX_CSUM) {
...
} else if ((lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) != 0 &&
skb->protocol == htons(ETH_P_IP) &&
skb->len > 64) {
skb->csum = be32_to_cpu(cur_p->app3 & 0xFFFF);
...
}
In particluar the "skb->csum =" line.
The type of cur_p->app3 is u32, and 0xFFFF is also host byte order.
So far so good. But after the bitwise operation it is treated
as a big-endian value by passing it to be32_to_cpu.
Perhaps I am missing something obvious, but my question is how does that work?
* Was it only tested on big endian sysgtems where be32_to_cpu() is a no-op
* Was it only tested on little endian systems where be32_to_cpu()
is a byteswap and somehow that works (how?).
* Is the code unecessised because the XAE_FEATURE_FULL_RX_CSUM branch is
always taken?
A grep of dts files shows up arch/microblaze/boot/dts/system.dts which
sets sets xlnx,rxcsum to 0, which corresponds to XAE_NO_CSUM_OFFLOAD.
* Something else
Flagged by Sparse
The in quesoitn code seems to have been introduced by
8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver")
next reply other threads:[~2024-07-26 12:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 12:07 Simon Horman [this message]
2024-07-30 19:15 ` net: xilinx: axienet: Query about checksum partial implementation Pandey, Radhey Shyam
2024-07-31 8:54 ` 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=20240726120700.GA1694627@kernel.org \
--to=horms@kernel.org \
--cc=ariane.keller@tik.ee.ethz.ch \
--cc=daniel@iogearbox.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=radhey.shyam.pandey@amd.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).