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.h55
1 files changed, 23 insertions, 32 deletions
diff --git a/net/tipc/link.h b/net/tipc/link.h
index b567a3427fda..55812e87ca1e 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -37,6 +37,7 @@
37#ifndef _TIPC_LINK_H 37#ifndef _TIPC_LINK_H
38#define _TIPC_LINK_H 38#define _TIPC_LINK_H
39 39
40#include <net/genetlink.h>
40#include "msg.h" 41#include "msg.h"
41#include "node.h" 42#include "node.h"
42 43
@@ -118,20 +119,13 @@ struct tipc_stats {
118 * @max_pkt: current maximum packet size for this link 119 * @max_pkt: current maximum packet size for this link
119 * @max_pkt_target: desired maximum packet size for this link 120 * @max_pkt_target: desired maximum packet size for this link
120 * @max_pkt_probes: # of probes based on current (max_pkt, max_pkt_target) 121 * @max_pkt_probes: # of probes based on current (max_pkt, max_pkt_target)
121 * @out_queue_size: # of messages in outbound message queue 122 * @outqueue: outbound message queue
122 * @first_out: ptr to first outbound message in queue
123 * @last_out: ptr to last outbound message in queue
124 * @next_out_no: next sequence number to use for outbound messages 123 * @next_out_no: next sequence number to use for outbound messages
125 * @last_retransmitted: sequence number of most recently retransmitted message 124 * @last_retransmitted: sequence number of most recently retransmitted message
126 * @stale_count: # of identical retransmit requests made by peer 125 * @stale_count: # of identical retransmit requests made by peer
127 * @next_in_no: next sequence number to expect for inbound messages 126 * @next_in_no: next sequence number to expect for inbound messages
128 * @deferred_inqueue_sz: # of messages in inbound message queue 127 * @deferred_queue: deferred queue saved OOS b'cast message received from node
129 * @oldest_deferred_in: ptr to first inbound message in queue
130 * @newest_deferred_in: ptr to last inbound message in queue
131 * @unacked_window: # of inbound messages rx'd without ack'ing back to peer 128 * @unacked_window: # of inbound messages rx'd without ack'ing back to peer
132 * @proto_msg_queue: ptr to (single) outbound control message
133 * @retransm_queue_size: number of messages to retransmit
134 * @retransm_queue_head: sequence number of first message to retransmit
135 * @next_out: ptr to first unsent outbound message in queue 129 * @next_out: ptr to first unsent outbound message in queue
136 * @waiting_sks: linked list of sockets waiting for link congestion to abate 130 * @waiting_sks: linked list of sockets waiting for link congestion to abate
137 * @long_msg_seq_no: next identifier to use for outbound fragmented messages 131 * @long_msg_seq_no: next identifier to use for outbound fragmented messages
@@ -175,24 +169,17 @@ struct tipc_link {
175 u32 max_pkt_probes; 169 u32 max_pkt_probes;
176 170
177 /* Sending */ 171 /* Sending */
178 u32 out_queue_size; 172 struct sk_buff_head outqueue;
179 struct sk_buff *first_out;
180 struct sk_buff *last_out;
181 u32 next_out_no; 173 u32 next_out_no;
182 u32 last_retransmitted; 174 u32 last_retransmitted;
183 u32 stale_count; 175 u32 stale_count;
184 176
185 /* Reception */ 177 /* Reception */
186 u32 next_in_no; 178 u32 next_in_no;
187 u32 deferred_inqueue_sz; 179 struct sk_buff_head deferred_queue;
188 struct sk_buff *oldest_deferred_in;
189 struct sk_buff *newest_deferred_in;
190 u32 unacked_window; 180 u32 unacked_window;
191 181
192 /* Congestion handling */ 182 /* Congestion handling */
193 struct sk_buff *proto_msg_queue;
194 u32 retransm_queue_size;
195 u32 retransm_queue_head;
196 struct sk_buff *next_out; 183 struct sk_buff *next_out;
197 struct sk_buff_head waiting_sks; 184 struct sk_buff_head waiting_sks;
198 185
@@ -226,18 +213,26 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area,
226void tipc_link_reset_all(struct tipc_node *node); 213void tipc_link_reset_all(struct tipc_node *node);
227void tipc_link_reset(struct tipc_link *l_ptr); 214void tipc_link_reset(struct tipc_link *l_ptr);
228void tipc_link_reset_list(unsigned int bearer_id); 215void tipc_link_reset_list(unsigned int bearer_id);
229int tipc_link_xmit(struct sk_buff *buf, u32 dest, u32 selector); 216int tipc_link_xmit_skb(struct sk_buff *skb, u32 dest, u32 selector);
230int __tipc_link_xmit(struct tipc_link *link, struct sk_buff *buf); 217int tipc_link_xmit(struct sk_buff_head *list, u32 dest, u32 selector);
218int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list);
231u32 tipc_link_get_max_pkt(u32 dest, u32 selector); 219u32 tipc_link_get_max_pkt(u32 dest, u32 selector);
232void tipc_link_bundle_rcv(struct sk_buff *buf); 220void tipc_link_bundle_rcv(struct sk_buff *buf);
233void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, 221void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob,
234 u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); 222 u32 gap, u32 tolerance, u32 priority, u32 acked_mtu);
235void tipc_link_push_queue(struct tipc_link *l_ptr); 223void tipc_link_push_packets(struct tipc_link *l_ptr);
236u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, 224u32 tipc_link_defer_pkt(struct sk_buff_head *list, struct sk_buff *buf);
237 struct sk_buff *buf);
238void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window); 225void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window);
239void tipc_link_retransmit(struct tipc_link *l_ptr, 226void tipc_link_retransmit(struct tipc_link *l_ptr,
240 struct sk_buff *start, u32 retransmits); 227 struct sk_buff *start, u32 retransmits);
228struct sk_buff *tipc_skb_queue_next(const struct sk_buff_head *list,
229 const struct sk_buff *skb);
230
231int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb);
232int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info);
233int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info);
234int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info);
235int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
241 236
242/* 237/*
243 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) 238 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
@@ -252,18 +247,14 @@ static inline u32 mod(u32 x)
252 return x & 0xffffu; 247 return x & 0xffffu;
253} 248}
254 249
255static inline int between(u32 lower, u32 upper, u32 n) 250static inline int less_eq(u32 left, u32 right)
256{ 251{
257 if ((lower < n) && (n < upper)) 252 return mod(right - left) < 32768u;
258 return 1;
259 if ((upper < lower) && ((n > lower) || (n < upper)))
260 return 1;
261 return 0;
262} 253}
263 254
264static inline int less_eq(u32 left, u32 right) 255static inline int more(u32 left, u32 right)
265{ 256{
266 return mod(right - left) < 32768u; 257 return !less_eq(left, right);
267} 258}
268 259
269static inline int less(u32 left, u32 right) 260static inline int less(u32 left, u32 right)
@@ -302,7 +293,7 @@ static inline int link_reset_reset(struct tipc_link *l_ptr)
302 293
303static inline int link_congested(struct tipc_link *l_ptr) 294static inline int link_congested(struct tipc_link *l_ptr)
304{ 295{
305 return l_ptr->out_queue_size >= l_ptr->queue_limit[0]; 296 return skb_queue_len(&l_ptr->outqueue) >= l_ptr->queue_limit[0];
306} 297}
307 298
308#endif 299#endif