aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/tipc.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index 6f71b9b41595..bf049e8fe31b 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -60,26 +60,48 @@ struct tipc_name_seq {
60 __u32 upper; 60 __u32 upper;
61}; 61};
62 62
63/* TIPC Address Size, Offset, Mask specification for Z.C.N
64 */
65#define TIPC_NODE_BITS 12
66#define TIPC_CLUSTER_BITS 12
67#define TIPC_ZONE_BITS 8
68
69#define TIPC_NODE_OFFSET 0
70#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS
71#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)
72
73#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1)
74#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1)
75#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1)
76
77#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
78#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
79#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)
80
81#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)
82
63static inline __u32 tipc_addr(unsigned int zone, 83static inline __u32 tipc_addr(unsigned int zone,
64 unsigned int cluster, 84 unsigned int cluster,
65 unsigned int node) 85 unsigned int node)
66{ 86{
67 return (zone << 24) | (cluster << 12) | node; 87 return (zone << TIPC_ZONE_OFFSET) |
88 (cluster << TIPC_CLUSTER_OFFSET) |
89 node;
68} 90}
69 91
70static inline unsigned int tipc_zone(__u32 addr) 92static inline unsigned int tipc_zone(__u32 addr)
71{ 93{
72 return addr >> 24; 94 return addr >> TIPC_ZONE_OFFSET;
73} 95}
74 96
75static inline unsigned int tipc_cluster(__u32 addr) 97static inline unsigned int tipc_cluster(__u32 addr)
76{ 98{
77 return (addr >> 12) & 0xfff; 99 return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
78} 100}
79 101
80static inline unsigned int tipc_node(__u32 addr) 102static inline unsigned int tipc_node(__u32 addr)
81{ 103{
82 return addr & 0xfff; 104 return addr & TIPC_NODE_MASK;
83} 105}
84 106
85/* 107/*