Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pktgen: avoid unused-const-variable warning

When extra warnings are enable, there are configurations that build
pktgen without CONFIG_XFRM, which leaves a static const variable unused:

net/core/pktgen.c:213:1: error: unused variable 'F_IPSEC' [-Werror,-Wunused-const-variable]
213 | PKT_FLAGS
| ^~~~~~~~~
net/core/pktgen.c:197:2: note: expanded from macro 'PKT_FLAGS'
197 | pf(IPSEC) /* ipsec on for flows */ \
| ^~~~~~~~~

This could be marked as __maybe_unused, or by making the one use visible
to the compiler by slightly rearranging the #ifdef blocks. The second
variant looks slightly nicer here, so use that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Peter Seiderer <ps.report@gmx.net>
Link: https://patch.msgid.link/20250225085722.469868-1-arnd@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Arnd Bergmann and committed by
Paolo Abeni
af4a5da8 0493f7a5

+2 -7
+2 -7
net/core/pktgen.c
··· 158 158 #include <net/udp.h> 159 159 #include <net/ip6_checksum.h> 160 160 #include <net/addrconf.h> 161 - #ifdef CONFIG_XFRM 162 161 #include <net/xfrm.h> 163 - #endif 164 162 #include <net/netns/generic.h> 165 163 #include <asm/byteorder.h> 166 164 #include <linux/rcupdate.h> ··· 2361 2363 } 2362 2364 2363 2365 2364 - #ifdef CONFIG_XFRM 2365 2366 /* If there was already an IPSEC SA, we keep it as is, else 2366 2367 * we go look for it ... 2367 2368 */ 2368 2369 #define DUMMY_MARK 0 2369 2370 static void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow) 2370 2371 { 2372 + #ifdef CONFIG_XFRM 2371 2373 struct xfrm_state *x = pkt_dev->flows[flow].x; 2372 2374 struct pktgen_net *pn = net_generic(dev_net(pkt_dev->odev), pg_net_id); 2373 2375 if (!x) { ··· 2393 2395 } 2394 2396 2395 2397 } 2396 - } 2397 2398 #endif 2399 + } 2398 2400 static void set_cur_queue_map(struct pktgen_dev *pkt_dev) 2399 2401 { 2400 - 2401 2402 if (pkt_dev->flags & F_QUEUE_MAP_CPU) 2402 2403 pkt_dev->cur_queue_map = smp_processor_id(); 2403 2404 ··· 2571 2574 pkt_dev->flows[flow].flags |= F_INIT; 2572 2575 pkt_dev->flows[flow].cur_daddr = 2573 2576 pkt_dev->cur_daddr; 2574 - #ifdef CONFIG_XFRM 2575 2577 if (pkt_dev->flags & F_IPSEC) 2576 2578 get_ipsec_sa(pkt_dev, flow); 2577 - #endif 2578 2579 pkt_dev->nflows++; 2579 2580 } 2580 2581 }