aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/link.h')
-rw-r--r--net/tipc/link.h60
1 files changed, 12 insertions, 48 deletions
diff --git a/net/tipc/link.h b/net/tipc/link.h
index b5b4e3554d4e..ae0a0ea572f2 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -107,30 +107,29 @@ struct tipc_stats {
107 * @owner: pointer to peer node 107 * @owner: pointer to peer node
108 * @refcnt: reference counter for permanent references (owner node & timer) 108 * @refcnt: reference counter for permanent references (owner node & timer)
109 * @flags: execution state flags for link endpoint instance 109 * @flags: execution state flags for link endpoint instance
110 * @checkpoint: reference point for triggering link continuity checking
111 * @peer_session: link session # being used by peer end of link 110 * @peer_session: link session # being used by peer end of link
112 * @peer_bearer_id: bearer id used by link's peer endpoint 111 * @peer_bearer_id: bearer id used by link's peer endpoint
113 * @bearer_id: local bearer id used by link 112 * @bearer_id: local bearer id used by link
114 * @tolerance: minimum link continuity loss needed to reset link [in ms] 113 * @tolerance: minimum link continuity loss needed to reset link [in ms]
115 * @cont_intv: link continuity testing interval 114 * @keepalive_intv: link keepalive timer interval
116 * @abort_limit: # of unacknowledged continuity probes needed to reset link 115 * @abort_limit: # of unacknowledged continuity probes needed to reset link
117 * @state: current state of link FSM 116 * @state: current state of link FSM
118 * @fsm_msg_cnt: # of protocol messages link FSM has sent in current state 117 * @silent_intv_cnt: # of timer intervals without any reception from peer
119 * @proto_msg: template for control messages generated by link 118 * @proto_msg: template for control messages generated by link
120 * @pmsg: convenience pointer to "proto_msg" field 119 * @pmsg: convenience pointer to "proto_msg" field
121 * @priority: current link priority 120 * @priority: current link priority
122 * @net_plane: current link network plane ('A' through 'H') 121 * @net_plane: current link network plane ('A' through 'H')
123 * @backlog_limit: backlog queue congestion thresholds (indexed by importance) 122 * @backlog_limit: backlog queue congestion thresholds (indexed by importance)
124 * @exp_msg_count: # of tunnelled messages expected during link changeover 123 * @exp_msg_count: # of tunnelled messages expected during link changeover
125 * @reset_checkpoint: seq # of last acknowledged message at time of link reset 124 * @reset_rcv_checkpt: seq # of last acknowledged message at time of link reset
126 * @mtu: current maximum packet size for this link 125 * @mtu: current maximum packet size for this link
127 * @advertised_mtu: advertised own mtu when link is being established 126 * @advertised_mtu: advertised own mtu when link is being established
128 * @transmitq: queue for sent, non-acked messages 127 * @transmitq: queue for sent, non-acked messages
129 * @backlogq: queue for messages waiting to be sent 128 * @backlogq: queue for messages waiting to be sent
130 * @next_out_no: next sequence number to use for outbound messages 129 * @snt_nxt: next sequence number to use for outbound messages
131 * @last_retransmitted: sequence number of most recently retransmitted message 130 * @last_retransmitted: sequence number of most recently retransmitted message
132 * @stale_count: # of identical retransmit requests made by peer 131 * @stale_count: # of identical retransmit requests made by peer
133 * @next_in_no: next sequence number to expect for inbound messages 132 * @rcv_nxt: next sequence number to expect for inbound messages
134 * @deferred_queue: deferred queue saved OOS b'cast message received from node 133 * @deferred_queue: deferred queue saved OOS b'cast message received from node
135 * @unacked_window: # of inbound messages rx'd without ack'ing back to peer 134 * @unacked_window: # of inbound messages rx'd without ack'ing back to peer
136 * @inputq: buffer queue for messages to be delivered upwards 135 * @inputq: buffer queue for messages to be delivered upwards
@@ -151,15 +150,14 @@ struct tipc_link {
151 150
152 /* Management and link supervision data */ 151 /* Management and link supervision data */
153 unsigned int flags; 152 unsigned int flags;
154 u32 checkpoint;
155 u32 peer_session; 153 u32 peer_session;
156 u32 peer_bearer_id; 154 u32 peer_bearer_id;
157 u32 bearer_id; 155 u32 bearer_id;
158 u32 tolerance; 156 u32 tolerance;
159 unsigned long cont_intv; 157 unsigned long keepalive_intv;
160 u32 abort_limit; 158 u32 abort_limit;
161 int state; 159 int state;
162 u32 fsm_msg_cnt; 160 u32 silent_intv_cnt;
163 struct { 161 struct {
164 unchar hdr[INT_H_SIZE]; 162 unchar hdr[INT_H_SIZE];
165 unchar body[TIPC_MAX_IF_NAME]; 163 unchar body[TIPC_MAX_IF_NAME];
@@ -185,13 +183,13 @@ struct tipc_link {
185 u16 len; 183 u16 len;
186 u16 limit; 184 u16 limit;
187 } backlog[5]; 185 } backlog[5];
188 u32 next_out_no; 186 u16 snd_nxt;
187 u16 last_retransm;
189 u32 window; 188 u32 window;
190 u32 last_retransmitted;
191 u32 stale_count; 189 u32 stale_count;
192 190
193 /* Reception */ 191 /* Reception */
194 u32 next_in_no; 192 u16 rcv_nxt;
195 u32 rcv_unacked; 193 u32 rcv_unacked;
196 struct sk_buff_head deferdq; 194 struct sk_buff_head deferdq;
197 struct sk_buff_head inputq; 195 struct sk_buff_head inputq;
@@ -213,17 +211,16 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
213 struct tipc_bearer *b_ptr, 211 struct tipc_bearer *b_ptr,
214 const struct tipc_media_addr *media_addr); 212 const struct tipc_media_addr *media_addr);
215void tipc_link_delete(struct tipc_link *link); 213void tipc_link_delete(struct tipc_link *link);
216void tipc_link_delete_list(struct net *net, unsigned int bearer_id, 214void tipc_link_delete_list(struct net *net, unsigned int bearer_id);
217 bool shutting_down);
218void tipc_link_failover_send_queue(struct tipc_link *l_ptr); 215void tipc_link_failover_send_queue(struct tipc_link *l_ptr);
219void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest); 216void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest);
220void tipc_link_reset_fragments(struct tipc_link *l_ptr); 217void tipc_link_reset_fragments(struct tipc_link *l_ptr);
221int tipc_link_is_up(struct tipc_link *l_ptr); 218int tipc_link_is_up(struct tipc_link *l_ptr);
222int tipc_link_is_active(struct tipc_link *l_ptr); 219int tipc_link_is_active(struct tipc_link *l_ptr);
223void tipc_link_purge_queues(struct tipc_link *l_ptr); 220void tipc_link_purge_queues(struct tipc_link *l_ptr);
221void tipc_link_purge_backlog(struct tipc_link *l);
224void tipc_link_reset_all(struct tipc_node *node); 222void tipc_link_reset_all(struct tipc_node *node);
225void tipc_link_reset(struct tipc_link *l_ptr); 223void tipc_link_reset(struct tipc_link *l_ptr);
226void tipc_link_reset_list(struct net *net, unsigned int bearer_id);
227int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest, 224int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest,
228 u32 selector); 225 u32 selector);
229int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest, 226int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest,
@@ -247,39 +244,6 @@ int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info);
247int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]); 244int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
248void link_prepare_wakeup(struct tipc_link *l); 245void link_prepare_wakeup(struct tipc_link *l);
249 246
250/*
251 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
252 */
253static inline u32 buf_seqno(struct sk_buff *buf)
254{
255 return msg_seqno(buf_msg(buf));
256}
257
258static inline u32 mod(u32 x)
259{
260 return x & 0xffffu;
261}
262
263static inline int less_eq(u32 left, u32 right)
264{
265 return mod(right - left) < 32768u;
266}
267
268static inline int more(u32 left, u32 right)
269{
270 return !less_eq(left, right);
271}
272
273static inline int less(u32 left, u32 right)
274{
275 return less_eq(left, right) && (mod(right) != mod(left));
276}
277
278static inline u32 lesser(u32 left, u32 right)
279{
280 return less_eq(left, right) ? left : right;
281}
282
283static inline u32 link_own_addr(struct tipc_link *l) 247static inline u32 link_own_addr(struct tipc_link *l)
284{ 248{
285 return msg_prevnode(l->pmsg); 249 return msg_prevnode(l->pmsg);