13715b5dfSEric Dumazet /* SPDX-License-Identifier: GPL-2.0-or-later */ 23715b5dfSEric Dumazet #ifndef _NET_ALIGNED_DATA_H 33715b5dfSEric Dumazet #define _NET_ALIGNED_DATA_H 43715b5dfSEric Dumazet 5998642e9SEric Dumazet #include <linux/atomic.h> 63715b5dfSEric Dumazet #include <linux/types.h> 73715b5dfSEric Dumazet 83715b5dfSEric Dumazet /* Structure holding cacheline aligned fields on SMP builds. 93715b5dfSEric Dumazet * Each field or group should have an ____cacheline_aligned_in_smp 103715b5dfSEric Dumazet * attribute to ensure no accidental false sharing can happen. 113715b5dfSEric Dumazet */ 123715b5dfSEric Dumazet struct net_aligned_data { 13998642e9SEric Dumazet atomic64_t net_cookie ____cacheline_aligned_in_smp; 1483081337SEric Dumazet #if defined(CONFIG_INET) 1583081337SEric Dumazet atomic_long_t tcp_memory_allocated ____cacheline_aligned_in_smp; 16*e3d48251SEric Dumazet atomic_long_t udp_memory_allocated ____cacheline_aligned_in_smp; 1783081337SEric Dumazet #endif 183715b5dfSEric Dumazet }; 193715b5dfSEric Dumazet 203715b5dfSEric Dumazet extern struct net_aligned_data net_aligned_data; 213715b5dfSEric Dumazet 223715b5dfSEric Dumazet #endif /* _NET_ALIGNED_DATA_H */ 23