aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.h
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-07-16 16:54:25 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-20 23:41:15 -0400
commitd3504c3449fead545e5254bfb11da916f72c4734 (patch)
tree1c0f11ad521060cc071a17963e8d869874517dbd /net/tipc/link.h
parentaf9b028e270fda6fb812d70d17d902297df1ceb5 (diff)
tipc: clean up definitions and usage of link flags
The status flag LINK_STOPPED is not needed any more, since the mechanism for delayed deletion of links has been removed. Likewise, LINK_STARTED and LINK_START_EVT are unnecessary, because we can just as well start the link timer directly from inside tipc_link_create(). We eliminate these flags in this commit. Instead of the above flags, we now introduce three new link modes, TIPC_LINK_OPEN, TIPC_LINK_BLOCKED and TIPC_LINK_TUNNEL. The values indicate whether, and in the case of TIPC_LINK_TUNNEL, which, messages the link is allowed to receive in this state. TIPC_LINK_BLOCKED also blocks timer-driven protocol messages to be sent out, and any change to the link FSM. Since the modes are mutually exclusive, we convert them to state values, and rename the 'flags' field in struct tipc_link to 'exec_mode'. Finally, we move the #defines for link FSM states and events from link.h into enums inside the file link.c, which is the real usage scope of these definitions. Reviewed-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 'net/tipc/link.h')
-rw-r--r--net/tipc/link.h44
1 files changed, 8 insertions, 36 deletions
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 7add2b90361d..0509c6de03cd 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -49,19 +49,14 @@
49 */ 49 */
50#define INVALID_LINK_SEQ 0x10000 50#define INVALID_LINK_SEQ 0x10000
51 51
52/* Link working states
53 */
54#define WORKING_WORKING 560810u
55#define WORKING_UNKNOWN 560811u
56#define RESET_UNKNOWN 560812u
57#define RESET_RESET 560813u
58 52
59/* Link endpoint execution states 53/* Link endpoint receive states
60 */ 54 */
61#define LINK_STARTED 0x0001 55enum {
62#define LINK_STOPPED 0x0002 56 TIPC_LINK_OPEN,
63#define LINK_SYNCHING 0x0004 57 TIPC_LINK_BLOCKED,
64#define LINK_FAILINGOVER 0x0008 58 TIPC_LINK_TUNNEL
59};
65 60
66/* Starting value for maximum packet size negotiation on unicast links 61/* Starting value for maximum packet size negotiation on unicast links
67 * (unless bearer MTU is less) 62 * (unless bearer MTU is less)
@@ -106,7 +101,6 @@ struct tipc_stats {
106 * @timer: link timer 101 * @timer: link timer
107 * @owner: pointer to peer node 102 * @owner: pointer to peer node
108 * @refcnt: reference counter for permanent references (owner node & timer) 103 * @refcnt: reference counter for permanent references (owner node & timer)
109 * @flags: execution state flags for link endpoint instance
110 * @peer_session: link session # being used by peer end of link 104 * @peer_session: link session # being used by peer end of link
111 * @peer_bearer_id: bearer id used by link's peer endpoint 105 * @peer_bearer_id: bearer id used by link's peer endpoint
112 * @bearer_id: local bearer id used by link 106 * @bearer_id: local bearer id used by link
@@ -119,6 +113,7 @@ struct tipc_stats {
119 * @pmsg: convenience pointer to "proto_msg" field 113 * @pmsg: convenience pointer to "proto_msg" field
120 * @priority: current link priority 114 * @priority: current link priority
121 * @net_plane: current link network plane ('A' through 'H') 115 * @net_plane: current link network plane ('A' through 'H')
116 * @exec_mode: transmit/receive mode for link endpoint instance
122 * @backlog_limit: backlog queue congestion thresholds (indexed by importance) 117 * @backlog_limit: backlog queue congestion thresholds (indexed by importance)
123 * @exp_msg_count: # of tunnelled messages expected during link changeover 118 * @exp_msg_count: # of tunnelled messages expected during link changeover
124 * @reset_rcv_checkpt: seq # of last acknowledged message at time of link reset 119 * @reset_rcv_checkpt: seq # of last acknowledged message at time of link reset
@@ -149,7 +144,6 @@ struct tipc_link {
149 struct kref ref; 144 struct kref ref;
150 145
151 /* Management and link supervision data */ 146 /* Management and link supervision data */
152 unsigned int flags;
153 u32 peer_session; 147 u32 peer_session;
154 u32 peer_bearer_id; 148 u32 peer_bearer_id;
155 u32 bearer_id; 149 u32 bearer_id;
@@ -165,6 +159,7 @@ struct tipc_link {
165 struct tipc_msg *pmsg; 159 struct tipc_msg *pmsg;
166 u32 priority; 160 u32 priority;
167 char net_plane; 161 char net_plane;
162 u8 exec_mode;
168 u16 synch_point; 163 u16 synch_point;
169 164
170 /* Failover */ 165 /* Failover */
@@ -249,27 +244,4 @@ static inline u32 link_own_addr(struct tipc_link *l)
249 return msg_prevnode(l->pmsg); 244 return msg_prevnode(l->pmsg);
250} 245}
251 246
252/*
253 * Link status checking routines
254 */
255static inline int link_working_working(struct tipc_link *l_ptr)
256{
257 return l_ptr->state == WORKING_WORKING;
258}
259
260static inline int link_working_unknown(struct tipc_link *l_ptr)
261{
262 return l_ptr->state == WORKING_UNKNOWN;
263}
264
265static inline int link_reset_unknown(struct tipc_link *l_ptr)
266{
267 return l_ptr->state == RESET_UNKNOWN;
268}
269
270static inline int link_reset_reset(struct tipc_link *l_ptr)
271{
272 return l_ptr->state == RESET_RESET;
273}
274
275#endif 247#endif