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.h63
1 files changed, 38 insertions, 25 deletions
diff --git a/net/tipc/link.h b/net/tipc/link.h
index e56cb532913e..73c18c140e1d 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -45,6 +45,12 @@
45#define PUSH_FINISHED 2 45#define PUSH_FINISHED 2
46 46
47/* 47/*
48 * Out-of-range value for link sequence numbers
49 */
50
51#define INVALID_LINK_SEQ 0x10000
52
53/*
48 * Link states 54 * Link states
49 */ 55 */
50 56
@@ -61,7 +67,7 @@
61#define MAX_PKT_DEFAULT 1500 67#define MAX_PKT_DEFAULT 1500
62 68
63/** 69/**
64 * struct link - TIPC link data structure 70 * struct tipc_link - TIPC link data structure
65 * @addr: network address of link's peer node 71 * @addr: network address of link's peer node
66 * @name: link name character string 72 * @name: link name character string
67 * @media_addr: media address to use when sending messages over link 73 * @media_addr: media address to use when sending messages over link
@@ -109,7 +115,7 @@
109 * @stats: collects statistics regarding link activity 115 * @stats: collects statistics regarding link activity
110 */ 116 */
111 117
112struct link { 118struct tipc_link {
113 u32 addr; 119 u32 addr;
114 char name[TIPC_MAX_LINK_NAME]; 120 char name[TIPC_MAX_LINK_NAME];
115 struct tipc_media_addr media_addr; 121 struct tipc_media_addr media_addr;
@@ -207,24 +213,24 @@ struct link {
207 213
208struct tipc_port; 214struct tipc_port;
209 215
210struct link *tipc_link_create(struct tipc_node *n_ptr, 216struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
211 struct tipc_bearer *b_ptr, 217 struct tipc_bearer *b_ptr,
212 const struct tipc_media_addr *media_addr); 218 const struct tipc_media_addr *media_addr);
213void tipc_link_delete(struct link *l_ptr); 219void tipc_link_delete(struct tipc_link *l_ptr);
214void tipc_link_changeover(struct link *l_ptr); 220void tipc_link_changeover(struct tipc_link *l_ptr);
215void tipc_link_send_duplicate(struct link *l_ptr, struct link *dest); 221void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *dest);
216void tipc_link_reset_fragments(struct link *l_ptr); 222void tipc_link_reset_fragments(struct tipc_link *l_ptr);
217int tipc_link_is_up(struct link *l_ptr); 223int tipc_link_is_up(struct tipc_link *l_ptr);
218int tipc_link_is_active(struct link *l_ptr); 224int tipc_link_is_active(struct tipc_link *l_ptr);
219u32 tipc_link_push_packet(struct link *l_ptr); 225u32 tipc_link_push_packet(struct tipc_link *l_ptr);
220void tipc_link_stop(struct link *l_ptr); 226void tipc_link_stop(struct tipc_link *l_ptr);
221struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); 227struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
222struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space); 228struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space);
223struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space); 229struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space);
224void tipc_link_reset(struct link *l_ptr); 230void tipc_link_reset(struct tipc_link *l_ptr);
225int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); 231int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector);
226void tipc_link_send_names(struct list_head *message_list, u32 dest); 232void tipc_link_send_names(struct list_head *message_list, u32 dest);
227int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf); 233int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
228u32 tipc_link_get_max_pkt(u32 dest, u32 selector); 234u32 tipc_link_get_max_pkt(u32 dest, u32 selector);
229int tipc_link_send_sections_fast(struct tipc_port *sender, 235int tipc_link_send_sections_fast(struct tipc_port *sender,
230 struct iovec const *msg_sect, 236 struct iovec const *msg_sect,
@@ -235,19 +241,26 @@ void tipc_link_recv_bundle(struct sk_buff *buf);
235int tipc_link_recv_fragment(struct sk_buff **pending, 241int tipc_link_recv_fragment(struct sk_buff **pending,
236 struct sk_buff **fb, 242 struct sk_buff **fb,
237 struct tipc_msg **msg); 243 struct tipc_msg **msg);
238void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, 244void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ, int prob,
239 u32 tolerance, u32 priority, u32 acked_mtu); 245 u32 gap, u32 tolerance, u32 priority,
240void tipc_link_push_queue(struct link *l_ptr); 246 u32 acked_mtu);
247void tipc_link_push_queue(struct tipc_link *l_ptr);
241u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, 248u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
242 struct sk_buff *buf); 249 struct sk_buff *buf);
243void tipc_link_wakeup_ports(struct link *l_ptr, int all); 250void tipc_link_wakeup_ports(struct tipc_link *l_ptr, int all);
244void tipc_link_set_queue_limits(struct link *l_ptr, u32 window); 251void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window);
245void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits); 252void tipc_link_retransmit(struct tipc_link *l_ptr,
253 struct sk_buff *start, u32 retransmits);
246 254
247/* 255/*
248 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) 256 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
249 */ 257 */
250 258
259static inline u32 buf_seqno(struct sk_buff *buf)
260{
261 return msg_seqno(buf_msg(buf));
262}
263
251static inline u32 mod(u32 x) 264static inline u32 mod(u32 x)
252{ 265{
253 return x & 0xffffu; 266 return x & 0xffffu;
@@ -282,32 +295,32 @@ static inline u32 lesser(u32 left, u32 right)
282 * Link status checking routines 295 * Link status checking routines
283 */ 296 */
284 297
285static inline int link_working_working(struct link *l_ptr) 298static inline int link_working_working(struct tipc_link *l_ptr)
286{ 299{
287 return l_ptr->state == WORKING_WORKING; 300 return l_ptr->state == WORKING_WORKING;
288} 301}
289 302
290static inline int link_working_unknown(struct link *l_ptr) 303static inline int link_working_unknown(struct tipc_link *l_ptr)
291{ 304{
292 return l_ptr->state == WORKING_UNKNOWN; 305 return l_ptr->state == WORKING_UNKNOWN;
293} 306}
294 307
295static inline int link_reset_unknown(struct link *l_ptr) 308static inline int link_reset_unknown(struct tipc_link *l_ptr)
296{ 309{
297 return l_ptr->state == RESET_UNKNOWN; 310 return l_ptr->state == RESET_UNKNOWN;
298} 311}
299 312
300static inline int link_reset_reset(struct link *l_ptr) 313static inline int link_reset_reset(struct tipc_link *l_ptr)
301{ 314{
302 return l_ptr->state == RESET_RESET; 315 return l_ptr->state == RESET_RESET;
303} 316}
304 317
305static inline int link_blocked(struct link *l_ptr) 318static inline int link_blocked(struct tipc_link *l_ptr)
306{ 319{
307 return l_ptr->exp_msg_count || l_ptr->blocked; 320 return l_ptr->exp_msg_count || l_ptr->blocked;
308} 321}
309 322
310static inline int link_congested(struct link *l_ptr) 323static inline int link_congested(struct tipc_link *l_ptr)
311{ 324{
312 return l_ptr->out_queue_size >= l_ptr->queue_limit[0]; 325 return l_ptr->out_queue_size >= l_ptr->queue_limit[0];
313} 326}