hash.h 371 B

12345678910111213141516171819202122
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NET_NS_HASH_H__
  3. #define __NET_NS_HASH_H__
  4. #include <asm/cache.h>
  5. struct net;
  6. static inline u32 net_hash_mix(const struct net *net)
  7. {
  8. #ifdef CONFIG_NET_NS
  9. /*
  10. * shift this right to eliminate bits, that are
  11. * always zeroed
  12. */
  13. return (u32)(((unsigned long)net) >> L1_CACHE_SHIFT);
  14. #else
  15. return 0;
  16. #endif
  17. }
  18. #endif