[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <86411bbab15c42b8819aeb923fe42644@AcuMS.aculab.com>
Date: Tue, 23 Jan 2024 10:16:06 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Guenter Roeck' <linux@...ck-us.net>, Charlie Jenkins
<charlie@...osinc.com>, Palmer Dabbelt <palmer@...belt.com>
CC: Conor Dooley <conor@...nel.org>, "samuel.holland@...ive.com"
<samuel.holland@...ive.com>, "xiao.w.wang@...el.com" <xiao.w.wang@...el.com>,
Evan Green <evan@...osinc.com>, "guoren@...nel.org" <guoren@...nel.org>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>, Paul Walmsley
<paul.walmsley@...ive.com>, "aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
Arnd Bergmann <arnd@...db.de>
Subject: RE: [PATCH v15 5/5] kunit: Add tests for csum_ipv6_magic and
ip_fast_csum
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)
Powered by blists - more mailing lists