1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #ifndef _NET_RPS_TYPES_H 3 #define _NET_RPS_TYPES_H 4 5 /* Define a rps_tag_ptr: 6 * Low order 5 bits are used to store the ilog2(size) of an RPS table. 7 */ 8 typedef unsigned long rps_tag_ptr; 9 10 static inline u8 rps_tag_to_log(rps_tag_ptr tag_ptr) 11 { 12 return tag_ptr & 31U; 13 } 14 15 static inline u32 rps_tag_to_mask(rps_tag_ptr tag_ptr) 16 { 17 return (1U << rps_tag_to_log(tag_ptr)) - 1; 18 } 19 20 static inline void *rps_tag_to_table(rps_tag_ptr tag_ptr) 21 { 22 return (void *)(tag_ptr & ~31UL); 23 } 24 #endif /* _NET_RPS_TYPES_H */ 25