aligned_data.h 682 B

12345678910111213141516171819202122
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef _NET_ALIGNED_DATA_H
  3. #define _NET_ALIGNED_DATA_H
  4. #include <linux/atomic.h>
  5. #include <linux/types.h>
  6. /* Structure holding cacheline aligned fields on SMP builds.
  7. * Each field or group should have an ____cacheline_aligned_in_smp
  8. * attribute to ensure no accidental false sharing can happen.
  9. */
  10. struct net_aligned_data {
  11. atomic64_t net_cookie ____cacheline_aligned_in_smp;
  12. #if defined(CONFIG_INET)
  13. atomic_long_t tcp_memory_allocated ____cacheline_aligned_in_smp;
  14. atomic_long_t udp_memory_allocated ____cacheline_aligned_in_smp;
  15. #endif
  16. };
  17. extern struct net_aligned_data net_aligned_data;
  18. #endif /* _NET_ALIGNED_DATA_H */