diff options
Diffstat (limited to 'net/tipc/msg.h')
-rw-r--r-- | net/tipc/msg.h | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index e5fc5fdb2ea7..bd3969a80dd4 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -54,6 +54,8 @@ struct plist; | |||
54 | * - TIPC_HIGH_IMPORTANCE | 54 | * - TIPC_HIGH_IMPORTANCE |
55 | * - TIPC_CRITICAL_IMPORTANCE | 55 | * - TIPC_CRITICAL_IMPORTANCE |
56 | */ | 56 | */ |
57 | #define TIPC_SYSTEM_IMPORTANCE 4 | ||
58 | |||
57 | 59 | ||
58 | /* | 60 | /* |
59 | * Payload message types | 61 | * Payload message types |
@@ -64,6 +66,19 @@ struct plist; | |||
64 | #define TIPC_DIRECT_MSG 3 | 66 | #define TIPC_DIRECT_MSG 3 |
65 | 67 | ||
66 | /* | 68 | /* |
69 | * Internal message users | ||
70 | */ | ||
71 | #define BCAST_PROTOCOL 5 | ||
72 | #define MSG_BUNDLER 6 | ||
73 | #define LINK_PROTOCOL 7 | ||
74 | #define CONN_MANAGER 8 | ||
75 | #define CHANGEOVER_PROTOCOL 10 | ||
76 | #define NAME_DISTRIBUTOR 11 | ||
77 | #define MSG_FRAGMENTER 12 | ||
78 | #define LINK_CONFIG 13 | ||
79 | #define SOCK_WAKEUP 14 /* pseudo user */ | ||
80 | |||
81 | /* | ||
67 | * Message header sizes | 82 | * Message header sizes |
68 | */ | 83 | */ |
69 | #define SHORT_H_SIZE 24 /* In-cluster basic payload message */ | 84 | #define SHORT_H_SIZE 24 /* In-cluster basic payload message */ |
@@ -170,16 +185,6 @@ static inline void msg_set_user(struct tipc_msg *m, u32 n) | |||
170 | msg_set_bits(m, 0, 25, 0xf, n); | 185 | msg_set_bits(m, 0, 25, 0xf, n); |
171 | } | 186 | } |
172 | 187 | ||
173 | static inline u32 msg_importance(struct tipc_msg *m) | ||
174 | { | ||
175 | return msg_bits(m, 0, 25, 0xf); | ||
176 | } | ||
177 | |||
178 | static inline void msg_set_importance(struct tipc_msg *m, u32 i) | ||
179 | { | ||
180 | msg_set_user(m, i); | ||
181 | } | ||
182 | |||
183 | static inline u32 msg_hdr_sz(struct tipc_msg *m) | 188 | static inline u32 msg_hdr_sz(struct tipc_msg *m) |
184 | { | 189 | { |
185 | return msg_bits(m, 0, 21, 0xf) << 2; | 190 | return msg_bits(m, 0, 21, 0xf) << 2; |
@@ -336,6 +341,25 @@ static inline void msg_set_seqno(struct tipc_msg *m, u32 n) | |||
336 | /* | 341 | /* |
337 | * Words 3-10 | 342 | * Words 3-10 |
338 | */ | 343 | */ |
344 | static inline u32 msg_importance(struct tipc_msg *m) | ||
345 | { | ||
346 | if (unlikely(msg_user(m) == MSG_FRAGMENTER)) | ||
347 | return msg_bits(m, 5, 13, 0x7); | ||
348 | if (likely(msg_isdata(m) && !msg_errcode(m))) | ||
349 | return msg_user(m); | ||
350 | return TIPC_SYSTEM_IMPORTANCE; | ||
351 | } | ||
352 | |||
353 | static inline void msg_set_importance(struct tipc_msg *m, u32 i) | ||
354 | { | ||
355 | if (unlikely(msg_user(m) == MSG_FRAGMENTER)) | ||
356 | msg_set_bits(m, 5, 13, 0x7, i); | ||
357 | else if (likely(i < TIPC_SYSTEM_IMPORTANCE)) | ||
358 | msg_set_user(m, i); | ||
359 | else | ||
360 | pr_warn("Trying to set illegal importance in message\n"); | ||
361 | } | ||
362 | |||
339 | static inline u32 msg_prevnode(struct tipc_msg *m) | 363 | static inline u32 msg_prevnode(struct tipc_msg *m) |
340 | { | 364 | { |
341 | return msg_word(m, 3); | 365 | return msg_word(m, 3); |
@@ -458,20 +482,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m) | |||
458 | */ | 482 | */ |
459 | 483 | ||
460 | /* | 484 | /* |
461 | * Internal message users | ||
462 | */ | ||
463 | #define BCAST_PROTOCOL 5 | ||
464 | #define MSG_BUNDLER 6 | ||
465 | #define LINK_PROTOCOL 7 | ||
466 | #define CONN_MANAGER 8 | ||
467 | #define ROUTE_DISTRIBUTOR 9 /* obsoleted */ | ||
468 | #define CHANGEOVER_PROTOCOL 10 | ||
469 | #define NAME_DISTRIBUTOR 11 | ||
470 | #define MSG_FRAGMENTER 12 | ||
471 | #define LINK_CONFIG 13 | ||
472 | #define SOCK_WAKEUP 14 /* pseudo user */ | ||
473 | |||
474 | /* | ||
475 | * Connection management protocol message types | 485 | * Connection management protocol message types |
476 | */ | 486 | */ |
477 | #define CONN_PROBE 0 | 487 | #define CONN_PROBE 0 |
@@ -743,13 +753,6 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n) | |||
743 | msg_set_bits(m, 9, 0, 0xffff, n); | 753 | msg_set_bits(m, 9, 0, 0xffff, n); |
744 | } | 754 | } |
745 | 755 | ||
746 | static inline u32 tipc_msg_tot_importance(struct tipc_msg *m) | ||
747 | { | ||
748 | if ((msg_user(m) == MSG_FRAGMENTER) && (msg_type(m) == FIRST_FRAGMENT)) | ||
749 | return msg_importance(msg_get_wrapped(m)); | ||
750 | return msg_importance(m); | ||
751 | } | ||
752 | |||
753 | static inline u32 msg_tot_origport(struct tipc_msg *m) | 756 | static inline u32 msg_tot_origport(struct tipc_msg *m) |
754 | { | 757 | { |
755 | if ((msg_user(m) == MSG_FRAGMENTER) && (msg_type(m) == FIRST_FRAGMENT)) | 758 | if ((msg_user(m) == MSG_FRAGMENTER) && (msg_type(m) == FIRST_FRAGMENT)) |