Skip to contentSkip to conversation

lib: checksum: Fix build with CONFIG_NET=n

PATCH In review Palmer Dabbelt 2 participants 2 messages Jan 19, 2024 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: checksum: Fix build with CONFIG_NET=n

From: Palmer Dabbelt <[email protected]>

The generic ipv6 checksums are only defined with CONFIG_NET=y, so gate the test as well.

Fixes 6f4c45cbcb00 ("kunit: Add tests for csum_ipv6_magic and ip_fast_csum")

---
That Fixes tag is against a PR I just sent up to Linus [1], sorry for missing this but it came in right when I was sending out the PR.

1: https://lore.kernel.org/linux-riscv/mhng-690cf774-fd28-4d25-be9f-69e19fb84d5c@palmer-ri-x1c9/T/#u

---
 lib/checksum_kunit.c | 2 ++
 1 file changed, 2 insertions(+)
lib/checksum_kunit.c +2 -0
index af3e5ca4e170..225bb7701460 100644
@@ -593,6 +593,7 @@ static void test_ip_fast_csum(struct kunit *test)
 
 static void test_csum_ipv6_magic(struct kunit *test)
 {
+#if defined(CONFIG_NET)
 	const struct in6_addr *saddr;
 	const struct in6_addr *daddr;
 	unsigned int len;
@@ -616,6 +617,7 @@ static void test_csum_ipv6_magic(struct kunit *test)
 		CHECK_EQ(expected_csum_ipv6_magic[i],
 			 csum_ipv6_magic(saddr, daddr, len, proto, csum));
 	}
+#endif /* !CONFIG_NET */
 }
 
 static struct kunit_case __refdata checksum_test_cases[] = {
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

The generic ipv6 checksums are only defined with CONFIG_NET=y, so gate the test as well.

Quoted 37 lines
Fixes 6f4c45cbcb00 ("kunit: Add tests for csum_ipv6_magic and ip_fast_csum")

---
That Fixes tag is against a PR I just sent up to Linus [1], sorry for missing this but it came in right when I was sending out the PR.

1: https://lore.kernel.org/linux-riscv/mhng-690cf774-fd28-4d25-be9f-69e19fb84d5c@palmer-ri-x1c9/T/#u

---
 lib/checksum_kunit.c | 2 ++
 1 file changed, 2 insertions(+)
lib/checksum_kunit.c +2 -0
index af3e5ca4e170..225bb7701460 100644
@@ -593,6 +593,7 @@ static void test_ip_fast_csum(struct kunit *test)
 
 static void test_csum_ipv6_magic(struct kunit *test)
 {
+#if defined(CONFIG_NET)
 	const struct in6_addr *saddr;
 	const struct in6_addr *daddr;
 	unsigned int len;
@@ -616,6 +617,7 @@ static void test_csum_ipv6_magic(struct kunit *test)
 		CHECK_EQ(expected_csum_ipv6_magic[i],
 			 csum_ipv6_magic(saddr, daddr, len, proto, csum));
 	}
+#endif /* !CONFIG_NET */
 }
 
 static struct kunit_case __refdata checksum_test_cases[] = {
Signature · 1 line
2.43.0