aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c89
1 files changed, 42 insertions, 47 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 511872afa459..910b37e5083d 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -157,13 +157,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
157 } \ 157 } \
158} while (0) 158} while (0)
159 159
160static inline void dbg_print_link(struct link *l_ptr, const char *str) 160static void dbg_print_link(struct link *l_ptr, const char *str)
161{ 161{
162 if (DBG_OUTPUT) 162 if (DBG_OUTPUT)
163 link_print(l_ptr, DBG_OUTPUT, str); 163 link_print(l_ptr, DBG_OUTPUT, str);
164} 164}
165 165
166static inline void dbg_print_buf_chain(struct sk_buff *root_buf) 166static void dbg_print_buf_chain(struct sk_buff *root_buf)
167{ 167{
168 if (DBG_OUTPUT) { 168 if (DBG_OUTPUT) {
169 struct sk_buff *buf = root_buf; 169 struct sk_buff *buf = root_buf;
@@ -176,50 +176,50 @@ static inline void dbg_print_buf_chain(struct sk_buff *root_buf)
176} 176}
177 177
178/* 178/*
179 * Simple inlined link routines 179 * Simple link routines
180 */ 180 */
181 181
182static inline unsigned int align(unsigned int i) 182static unsigned int align(unsigned int i)
183{ 183{
184 return (i + 3) & ~3u; 184 return (i + 3) & ~3u;
185} 185}
186 186
187static inline int link_working_working(struct link *l_ptr) 187static int link_working_working(struct link *l_ptr)
188{ 188{
189 return (l_ptr->state == WORKING_WORKING); 189 return (l_ptr->state == WORKING_WORKING);
190} 190}
191 191
192static inline int link_working_unknown(struct link *l_ptr) 192static int link_working_unknown(struct link *l_ptr)
193{ 193{
194 return (l_ptr->state == WORKING_UNKNOWN); 194 return (l_ptr->state == WORKING_UNKNOWN);
195} 195}
196 196
197static inline int link_reset_unknown(struct link *l_ptr) 197static int link_reset_unknown(struct link *l_ptr)
198{ 198{
199 return (l_ptr->state == RESET_UNKNOWN); 199 return (l_ptr->state == RESET_UNKNOWN);
200} 200}
201 201
202static inline int link_reset_reset(struct link *l_ptr) 202static int link_reset_reset(struct link *l_ptr)
203{ 203{
204 return (l_ptr->state == RESET_RESET); 204 return (l_ptr->state == RESET_RESET);
205} 205}
206 206
207static inline int link_blocked(struct link *l_ptr) 207static int link_blocked(struct link *l_ptr)
208{ 208{
209 return (l_ptr->exp_msg_count || l_ptr->blocked); 209 return (l_ptr->exp_msg_count || l_ptr->blocked);
210} 210}
211 211
212static inline int link_congested(struct link *l_ptr) 212static int link_congested(struct link *l_ptr)
213{ 213{
214 return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]); 214 return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]);
215} 215}
216 216
217static inline u32 link_max_pkt(struct link *l_ptr) 217static u32 link_max_pkt(struct link *l_ptr)
218{ 218{
219 return l_ptr->max_pkt; 219 return l_ptr->max_pkt;
220} 220}
221 221
222static inline void link_init_max_pkt(struct link *l_ptr) 222static void link_init_max_pkt(struct link *l_ptr)
223{ 223{
224 u32 max_pkt; 224 u32 max_pkt;
225 225
@@ -236,20 +236,20 @@ static inline void link_init_max_pkt(struct link *l_ptr)
236 l_ptr->max_pkt_probes = 0; 236 l_ptr->max_pkt_probes = 0;
237} 237}
238 238
239static inline u32 link_next_sent(struct link *l_ptr) 239static u32 link_next_sent(struct link *l_ptr)
240{ 240{
241 if (l_ptr->next_out) 241 if (l_ptr->next_out)
242 return msg_seqno(buf_msg(l_ptr->next_out)); 242 return msg_seqno(buf_msg(l_ptr->next_out));
243 return mod(l_ptr->next_out_no); 243 return mod(l_ptr->next_out_no);
244} 244}
245 245
246static inline u32 link_last_sent(struct link *l_ptr) 246static u32 link_last_sent(struct link *l_ptr)
247{ 247{
248 return mod(link_next_sent(l_ptr) - 1); 248 return mod(link_next_sent(l_ptr) - 1);
249} 249}
250 250
251/* 251/*
252 * Simple non-inlined link routines (i.e. referenced outside this file) 252 * Simple non-static link routines (i.e. referenced outside this file)
253 */ 253 */
254 254
255int tipc_link_is_up(struct link *l_ptr) 255int tipc_link_is_up(struct link *l_ptr)
@@ -396,7 +396,7 @@ static void link_timeout(struct link *l_ptr)
396 tipc_node_unlock(l_ptr->owner); 396 tipc_node_unlock(l_ptr->owner);
397} 397}
398 398
399static inline void link_set_timer(struct link *l_ptr, u32 time) 399static void link_set_timer(struct link *l_ptr, u32 time)
400{ 400{
401 k_start_timer(&l_ptr->timer, time); 401 k_start_timer(&l_ptr->timer, time);
402} 402}
@@ -573,7 +573,7 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all)
573 if (win <= 0) 573 if (win <= 0)
574 break; 574 break;
575 list_del_init(&p_ptr->wait_list); 575 list_del_init(&p_ptr->wait_list);
576 p_ptr->congested_link = 0; 576 p_ptr->congested_link = NULL;
577 assert(p_ptr->wakeup); 577 assert(p_ptr->wakeup);
578 spin_lock_bh(p_ptr->publ.lock); 578 spin_lock_bh(p_ptr->publ.lock);
579 p_ptr->publ.congested = 0; 579 p_ptr->publ.congested = 0;
@@ -1004,9 +1004,9 @@ static int link_bundle_buf(struct link *l_ptr,
1004 return 1; 1004 return 1;
1005} 1005}
1006 1006
1007static inline void link_add_to_outqueue(struct link *l_ptr, 1007static void link_add_to_outqueue(struct link *l_ptr,
1008 struct sk_buff *buf, 1008 struct sk_buff *buf,
1009 struct tipc_msg *msg) 1009 struct tipc_msg *msg)
1010{ 1010{
1011 u32 ack = mod(l_ptr->next_in_no - 1); 1011 u32 ack = mod(l_ptr->next_in_no - 1);
1012 u32 seqno = mod(l_ptr->next_out_no++); 1012 u32 seqno = mod(l_ptr->next_out_no++);
@@ -1156,8 +1156,8 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
1156 * Link is locked. Returns user data length. 1156 * Link is locked. Returns user data length.
1157 */ 1157 */
1158 1158
1159static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, 1159static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
1160 u32 *used_max_pkt) 1160 u32 *used_max_pkt)
1161{ 1161{
1162 struct tipc_msg *msg = buf_msg(buf); 1162 struct tipc_msg *msg = buf_msg(buf);
1163 int res = msg_data_sz(msg); 1163 int res = msg_data_sz(msg);
@@ -1355,7 +1355,7 @@ again:
1355 fragm_crs = 0; 1355 fragm_crs = 0;
1356 fragm_rest = 0; 1356 fragm_rest = 0;
1357 sect_rest = 0; 1357 sect_rest = 0;
1358 sect_crs = 0; 1358 sect_crs = NULL;
1359 curr_sect = -1; 1359 curr_sect = -1;
1360 1360
1361 /* Prepare reusable fragment header: */ 1361 /* Prepare reusable fragment header: */
@@ -1549,7 +1549,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
1549 msg_dbg(buf_msg(buf), ">DEF-PROT>"); 1549 msg_dbg(buf_msg(buf), ">DEF-PROT>");
1550 l_ptr->unacked_window = 0; 1550 l_ptr->unacked_window = 0;
1551 buf_discard(buf); 1551 buf_discard(buf);
1552 l_ptr->proto_msg_queue = 0; 1552 l_ptr->proto_msg_queue = NULL;
1553 return TIPC_OK; 1553 return TIPC_OK;
1554 } else { 1554 } else {
1555 msg_dbg(buf_msg(buf), "|>DEF-PROT>"); 1555 msg_dbg(buf_msg(buf), "|>DEF-PROT>");
@@ -1860,7 +1860,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
1860 struct sk_buff **tail, 1860 struct sk_buff **tail,
1861 struct sk_buff *buf) 1861 struct sk_buff *buf)
1862{ 1862{
1863 struct sk_buff *prev = 0; 1863 struct sk_buff *prev = NULL;
1864 struct sk_buff *crs = *head; 1864 struct sk_buff *crs = *head;
1865 u32 seq_no = msg_seqno(buf_msg(buf)); 1865 u32 seq_no = msg_seqno(buf_msg(buf));
1866 1866
@@ -1953,7 +1953,7 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
1953void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, 1953void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
1954 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu) 1954 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
1955{ 1955{
1956 struct sk_buff *buf = 0; 1956 struct sk_buff *buf = NULL;
1957 struct tipc_msg *msg = l_ptr->pmsg; 1957 struct tipc_msg *msg = l_ptr->pmsg;
1958 u32 msg_size = sizeof(l_ptr->proto_msg); 1958 u32 msg_size = sizeof(l_ptr->proto_msg);
1959 1959
@@ -2426,7 +2426,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2426 } 2426 }
2427 } 2427 }
2428exit: 2428exit:
2429 *buf = 0; 2429 *buf = NULL;
2430 buf_discard(tunnel_buf); 2430 buf_discard(tunnel_buf);
2431 return 0; 2431 return 0;
2432} 2432}
@@ -2539,42 +2539,37 @@ exit:
2539 * pending message. This makes dynamic memory allocation unecessary. 2539 * pending message. This makes dynamic memory allocation unecessary.
2540 */ 2540 */
2541 2541
2542static inline u32 get_long_msg_seqno(struct sk_buff *buf) 2542static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
2543{
2544 return msg_seqno(buf_msg(buf));
2545}
2546
2547static inline void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
2548{ 2543{
2549 msg_set_seqno(buf_msg(buf), seqno); 2544 msg_set_seqno(buf_msg(buf), seqno);
2550} 2545}
2551 2546
2552static inline u32 get_fragm_size(struct sk_buff *buf) 2547static u32 get_fragm_size(struct sk_buff *buf)
2553{ 2548{
2554 return msg_ack(buf_msg(buf)); 2549 return msg_ack(buf_msg(buf));
2555} 2550}
2556 2551
2557static inline void set_fragm_size(struct sk_buff *buf, u32 sz) 2552static void set_fragm_size(struct sk_buff *buf, u32 sz)
2558{ 2553{
2559 msg_set_ack(buf_msg(buf), sz); 2554 msg_set_ack(buf_msg(buf), sz);
2560} 2555}
2561 2556
2562static inline u32 get_expected_frags(struct sk_buff *buf) 2557static u32 get_expected_frags(struct sk_buff *buf)
2563{ 2558{
2564 return msg_bcast_ack(buf_msg(buf)); 2559 return msg_bcast_ack(buf_msg(buf));
2565} 2560}
2566 2561
2567static inline void set_expected_frags(struct sk_buff *buf, u32 exp) 2562static void set_expected_frags(struct sk_buff *buf, u32 exp)
2568{ 2563{
2569 msg_set_bcast_ack(buf_msg(buf), exp); 2564 msg_set_bcast_ack(buf_msg(buf), exp);
2570} 2565}
2571 2566
2572static inline u32 get_timer_cnt(struct sk_buff *buf) 2567static u32 get_timer_cnt(struct sk_buff *buf)
2573{ 2568{
2574 return msg_reroute_cnt(buf_msg(buf)); 2569 return msg_reroute_cnt(buf_msg(buf));
2575} 2570}
2576 2571
2577static inline void incr_timer_cnt(struct sk_buff *buf) 2572static void incr_timer_cnt(struct sk_buff *buf)
2578{ 2573{
2579 msg_incr_reroute_cnt(buf_msg(buf)); 2574 msg_incr_reroute_cnt(buf_msg(buf));
2580} 2575}
@@ -2586,13 +2581,13 @@ static inline void incr_timer_cnt(struct sk_buff *buf)
2586int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, 2581int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2587 struct tipc_msg **m) 2582 struct tipc_msg **m)
2588{ 2583{
2589 struct sk_buff *prev = 0; 2584 struct sk_buff *prev = NULL;
2590 struct sk_buff *fbuf = *fb; 2585 struct sk_buff *fbuf = *fb;
2591 struct tipc_msg *fragm = buf_msg(fbuf); 2586 struct tipc_msg *fragm = buf_msg(fbuf);
2592 struct sk_buff *pbuf = *pending; 2587 struct sk_buff *pbuf = *pending;
2593 u32 long_msg_seq_no = msg_long_msgno(fragm); 2588 u32 long_msg_seq_no = msg_long_msgno(fragm);
2594 2589
2595 *fb = 0; 2590 *fb = NULL;
2596 msg_dbg(fragm,"FRG<REC<"); 2591 msg_dbg(fragm,"FRG<REC<");
2597 2592
2598 /* Is there an incomplete message waiting for this fragment? */ 2593 /* Is there an incomplete message waiting for this fragment? */
@@ -2670,8 +2665,8 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2670 2665
2671static void link_check_defragm_bufs(struct link *l_ptr) 2666static void link_check_defragm_bufs(struct link *l_ptr)
2672{ 2667{
2673 struct sk_buff *prev = 0; 2668 struct sk_buff *prev = NULL;
2674 struct sk_buff *next = 0; 2669 struct sk_buff *next = NULL;
2675 struct sk_buff *buf = l_ptr->defragm_buf; 2670 struct sk_buff *buf = l_ptr->defragm_buf;
2676 2671
2677 if (!buf) 2672 if (!buf)
@@ -2750,19 +2745,19 @@ static struct link *link_find_link(const char *name, struct node **node)
2750 struct link *l_ptr; 2745 struct link *l_ptr;
2751 2746
2752 if (!link_name_validate(name, &link_name_parts)) 2747 if (!link_name_validate(name, &link_name_parts))
2753 return 0; 2748 return NULL;
2754 2749
2755 b_ptr = tipc_bearer_find_interface(link_name_parts.if_local); 2750 b_ptr = tipc_bearer_find_interface(link_name_parts.if_local);
2756 if (!b_ptr) 2751 if (!b_ptr)
2757 return 0; 2752 return NULL;
2758 2753
2759 *node = tipc_node_find(link_name_parts.addr_peer); 2754 *node = tipc_node_find(link_name_parts.addr_peer);
2760 if (!*node) 2755 if (!*node)
2761 return 0; 2756 return NULL;
2762 2757
2763 l_ptr = (*node)->links[b_ptr->identity]; 2758 l_ptr = (*node)->links[b_ptr->identity];
2764 if (!l_ptr || strcmp(l_ptr->name, name)) 2759 if (!l_ptr || strcmp(l_ptr->name, name))
2765 return 0; 2760 return NULL;
2766 2761
2767 return l_ptr; 2762 return l_ptr;
2768} 2763}