From: David Laight <David.Laight@ACULAB.COM>
To: 'Guenter Roeck' <linux@roeck-us.net>,
Charlie Jenkins <charlie@rivosinc.com>,
Palmer Dabbelt <palmer@dabbelt.com>
Cc: Conor Dooley <conor@kernel.org>,
"samuel.holland@sifive.com" <samuel.holland@sifive.com>,
"xiao.w.wang@intel.com" <xiao.w.wang@intel.com>,
Evan Green <evan@rivosinc.com>,
"guoren@kernel.org" <guoren@kernel.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
Arnd Bergmann <arnd@arndb.de>
Subject: RE: [PATCH v15 5/5] kunit: Add tests for csum_ipv6_magic and ip_fast_csum
Date: Tue, 23 Jan 2024 10:16:06 +0000 [thread overview]
Message-ID: <86411bbab15c42b8819aeb923fe42644@AcuMS.aculab.com> (raw)
In-Reply-To: <e548f697-650e-4333-9f39-19a472b7d90a@roeck-us.net>
From: Guenter Roeck
> Sent: 23 January 2024 01:06
...
> >> +#define SUPPORTED_ALIGNMENT (1 << NET_IP_ALIGN)
> >> /* Values for a little endian CPU. Byte swap each half on big endian CPU. */
> >> static const u32 random_init_sum = 0x2847aab;
> >> @@ -486,7 +488,7 @@ static void test_csum_fixed_random_inputs(struct kunit *test)
> >> __sum16 result, expec;
> >> assert_setup_correct(test);
> >> - for (align = 0; align < TEST_BUFLEN; ++align) {
> >> + for (align = 0; align < TEST_BUFLEN; align += SUPPORTED_ALIGNMENT) {
...
That is all wrong.
NET_IP_ALIGN is the offset for the base of ethernet frames.
If zero the IP header will (usually) be misaligned.
If two the mac addresses are misaligned in order to align
the IP header (6+6+2 bytes in).
I don't think any other values are actually valid, but
there is always that possibility.
So the definition should really be:
#define SUPPORTED_ALIGNMENT (NET_IP_ALIGN ? 4 : 1)
(Which might happen to be the same values :-)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2024-01-23 10:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 23:57 [PATCH v15 0/5] riscv: Add fine-tuned checksum functions Charlie Jenkins
2024-01-08 23:57 ` [PATCH v15 1/5] asm-generic: Improve csum_fold Charlie Jenkins
2024-01-08 23:57 ` [PATCH v15 2/5] riscv: Add static key for misaligned accesses Charlie Jenkins
2024-01-08 23:57 ` [PATCH v15 3/5] riscv: Add checksum header Charlie Jenkins
2024-01-08 23:57 ` [PATCH v15 4/5] riscv: Add checksum library Charlie Jenkins
2024-01-08 23:57 ` [PATCH v15 5/5] kunit: Add tests for csum_ipv6_magic and ip_fast_csum Charlie Jenkins
2024-01-22 16:40 ` Guenter Roeck
2024-01-22 16:52 ` David Laight
2024-01-22 17:15 ` Guenter Roeck
2024-01-22 21:41 ` David Laight
2024-01-22 23:39 ` Palmer Dabbelt
2024-01-22 23:55 ` Charlie Jenkins
2024-01-23 1:06 ` Guenter Roeck
2024-01-23 10:16 ` David Laight [this message]
2024-01-20 21:09 ` [PATCH v15 0/5] riscv: Add fine-tuned checksum functions patchwork-bot+linux-riscv
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=86411bbab15c42b8819aeb923fe42644@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=charlie@rivosinc.com \
--cc=conor@kernel.org \
--cc=evan@rivosinc.com \
--cc=guoren@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@roeck-us.net \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=xiao.w.wang@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