2025-06-30 09:35:37 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#ifndef _NET_ALIGNED_DATA_H
|
|
|
|
#define _NET_ALIGNED_DATA_H
|
|
|
|
|
2025-06-30 09:35:38 +00:00
|
|
|
#include <linux/atomic.h>
|
2025-06-30 09:35:37 +00:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
/* Structure holding cacheline aligned fields on SMP builds.
|
|
|
|
* Each field or group should have an ____cacheline_aligned_in_smp
|
|
|
|
* attribute to ensure no accidental false sharing can happen.
|
|
|
|
*/
|
|
|
|
struct net_aligned_data {
|
2025-06-30 09:35:38 +00:00
|
|
|
atomic64_t net_cookie ____cacheline_aligned_in_smp;
|
2025-06-30 09:35:39 +00:00
|
|
|
#if defined(CONFIG_INET)
|
|
|
|
atomic_long_t tcp_memory_allocated ____cacheline_aligned_in_smp;
|
2025-06-30 09:35:40 +00:00
|
|
|
atomic_long_t udp_memory_allocated ____cacheline_aligned_in_smp;
|
2025-06-30 09:35:39 +00:00
|
|
|
#endif
|
2025-06-30 09:35:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct net_aligned_data net_aligned_data;
|
|
|
|
|
|
|
|
#endif /* _NET_ALIGNED_DATA_H */
|