xref: /linux/include/net/aligned_data.h (revision 83081337419cb692eca4ee475d936b1fdcfd49f6)
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;
14*83081337SEric Dumazet #if defined(CONFIG_INET)
15*83081337SEric Dumazet 	atomic_long_t tcp_memory_allocated ____cacheline_aligned_in_smp;
16*83081337SEric Dumazet #endif
173715b5dfSEric Dumazet };
183715b5dfSEric Dumazet 
193715b5dfSEric Dumazet extern struct net_aligned_data net_aligned_data;
203715b5dfSEric Dumazet 
213715b5dfSEric Dumazet #endif /* _NET_ALIGNED_DATA_H */
22