aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/tipc.h
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-03-15 11:48:51 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-17 17:11:46 -0400
commit928df1880e24bcd47d6359ff86df24db3dfba3c3 (patch)
treeb191aaca13f510bfd7409089d47f5346403a68e3 /include/uapi/linux/tipc.h
parent4f1aec01fcb84faf79bb6fabb82a5c850b186e03 (diff)
tipc: obsolete TIPC_ZONE_SCOPE
Publications for TIPC_CLUSTER_SCOPE and TIPC_ZONE_SCOPE are in all aspects handled the same way, both on the publishing node and on the receiving nodes. Despite previous ambitions to the contrary, this is never going to change, so we take the conseqeunce of this and obsolete TIPC_ZONE_SCOPE and related macros/functions. Whenever a user is doing a bind() or a sendmsg() attempt using ZONE_SCOPE we translate this internally to CLUSTER_SCOPE, while we remain compatible with users and remote nodes still using ZONE_SCOPE. Furthermore, the non-formalized scope value 0 has always been permitted for use during lookup, with the same meaning as ZONE_SCOPE/CLUSTER_SCOPE. We now permit it even as binding scope, but for compatibility reasons we choose to not change the value of TIPC_CLUSTER_SCOPE. Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/tipc.h')
-rw-r--r--include/uapi/linux/tipc.h102
1 files changed, 54 insertions, 48 deletions
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index 14bacc7e6cef..4ac9f1f02b06 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -61,50 +61,6 @@ struct tipc_name_seq {
61 __u32 upper; 61 __u32 upper;
62}; 62};
63 63
64/* TIPC Address Size, Offset, Mask specification for Z.C.N
65 */
66#define TIPC_NODE_BITS 12
67#define TIPC_CLUSTER_BITS 12
68#define TIPC_ZONE_BITS 8
69
70#define TIPC_NODE_OFFSET 0
71#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS
72#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)
73
74#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1)
75#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1)
76#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1)
77
78#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
79#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
80#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)
81
82#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)
83
84static inline __u32 tipc_addr(unsigned int zone,
85 unsigned int cluster,
86 unsigned int node)
87{
88 return (zone << TIPC_ZONE_OFFSET) |
89 (cluster << TIPC_CLUSTER_OFFSET) |
90 node;
91}
92
93static inline unsigned int tipc_zone(__u32 addr)
94{
95 return addr >> TIPC_ZONE_OFFSET;
96}
97
98static inline unsigned int tipc_cluster(__u32 addr)
99{
100 return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
101}
102
103static inline unsigned int tipc_node(__u32 addr)
104{
105 return addr & TIPC_NODE_MASK;
106}
107
108/* 64/*
109 * Application-accessible port name types 65 * Application-accessible port name types
110 */ 66 */
@@ -117,9 +73,10 @@ static inline unsigned int tipc_node(__u32 addr)
117/* 73/*
118 * Publication scopes when binding port names and port name sequences 74 * Publication scopes when binding port names and port name sequences
119 */ 75 */
120#define TIPC_ZONE_SCOPE 1 76enum tipc_scope {
121#define TIPC_CLUSTER_SCOPE 2 77 TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */
122#define TIPC_NODE_SCOPE 3 78 TIPC_NODE_SCOPE = 3
79};
123 80
124/* 81/*
125 * Limiting values for messages 82 * Limiting values for messages
@@ -243,7 +200,7 @@ struct sockaddr_tipc {
243struct tipc_group_req { 200struct tipc_group_req {
244 __u32 type; /* group id */ 201 __u32 type; /* group id */
245 __u32 instance; /* member id */ 202 __u32 instance; /* member id */
246 __u32 scope; /* zone/cluster/node */ 203 __u32 scope; /* cluster/node */
247 __u32 flags; 204 __u32 flags;
248}; 205};
249 206
@@ -268,4 +225,53 @@ struct tipc_sioc_ln_req {
268 __u32 bearer_id; 225 __u32 bearer_id;
269 char linkname[TIPC_MAX_LINK_NAME]; 226 char linkname[TIPC_MAX_LINK_NAME];
270}; 227};
228
229
230/* The macros and functions below are deprecated:
231 */
232
233#define TIPC_ZONE_SCOPE 1
234
235#define TIPC_NODE_BITS 12
236#define TIPC_CLUSTER_BITS 12
237#define TIPC_ZONE_BITS 8
238
239#define TIPC_NODE_OFFSET 0
240#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS
241#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)
242
243#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1)
244#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1)
245#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1)
246
247#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
248#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
249#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)
250
251#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)
252
253static inline __u32 tipc_addr(unsigned int zone,
254 unsigned int cluster,
255 unsigned int node)
256{
257 return (zone << TIPC_ZONE_OFFSET) |
258 (cluster << TIPC_CLUSTER_OFFSET) |
259 node;
260}
261
262static inline unsigned int tipc_zone(__u32 addr)
263{
264 return addr >> TIPC_ZONE_OFFSET;
265}
266
267static inline unsigned int tipc_cluster(__u32 addr)
268{
269 return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
270}
271
272static inline unsigned int tipc_node(__u32 addr)
273{
274 return addr & TIPC_NODE_MASK;
275}
276
271#endif 277#endif