aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-01-18 17:23:54 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-18 17:23:54 -0500
commit27a7b0415f6e5c0ffdfb1ba42b9b96ddfbb78b8f (patch)
tree8107ee11c3fe7d3b4be36054af4475326af86d53 /net/tipc/link.c
parentad12583f46bcb6ce93ccd99fa063c0d701146b2e (diff)
parent4323add67792ced172d0d93b8b2e6187023115f1 (diff)
Merge git://tipc.cslab.ericsson.net/pub/git/tipc
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c605
1 files changed, 302 insertions, 303 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 7265f4be4766..511872afa459 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -148,12 +148,12 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
148#define LINK_LOG_BUF_SIZE 0 148#define LINK_LOG_BUF_SIZE 0
149 149
150#define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0) 150#define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0)
151#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) msg_print(&l_ptr->print_buf, msg, txt); } while(0) 151#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) tipc_msg_print(&l_ptr->print_buf, msg, txt); } while(0)
152#define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0) 152#define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0)
153#define dbg_link_dump() do { \ 153#define dbg_link_dump() do { \
154 if (LINK_LOG_BUF_SIZE) { \ 154 if (LINK_LOG_BUF_SIZE) { \
155 tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \ 155 tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \
156 printbuf_move(LOG, &l_ptr->print_buf); \ 156 tipc_printbuf_move(LOG, &l_ptr->print_buf); \
157 } \ 157 } \
158} while (0) 158} while (0)
159 159
@@ -252,14 +252,14 @@ static inline u32 link_last_sent(struct link *l_ptr)
252 * Simple non-inlined link routines (i.e. referenced outside this file) 252 * Simple non-inlined link routines (i.e. referenced outside this file)
253 */ 253 */
254 254
255int link_is_up(struct link *l_ptr) 255int tipc_link_is_up(struct link *l_ptr)
256{ 256{
257 if (!l_ptr) 257 if (!l_ptr)
258 return 0; 258 return 0;
259 return (link_working_working(l_ptr) || link_working_unknown(l_ptr)); 259 return (link_working_working(l_ptr) || link_working_unknown(l_ptr));
260} 260}
261 261
262int link_is_active(struct link *l_ptr) 262int tipc_link_is_active(struct link *l_ptr)
263{ 263{
264 return ((l_ptr->owner->active_links[0] == l_ptr) || 264 return ((l_ptr->owner->active_links[0] == l_ptr) ||
265 (l_ptr->owner->active_links[1] == l_ptr)); 265 (l_ptr->owner->active_links[1] == l_ptr));
@@ -338,15 +338,15 @@ static int link_name_validate(const char *name, struct link_name *name_parts)
338 * link_timeout - handle expiration of link timer 338 * link_timeout - handle expiration of link timer
339 * @l_ptr: pointer to link 339 * @l_ptr: pointer to link
340 * 340 *
341 * This routine must not grab "net_lock" to avoid a potential deadlock conflict 341 * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict
342 * with link_delete(). (There is no risk that the node will be deleted by 342 * with tipc_link_delete(). (There is no risk that the node will be deleted by
343 * another thread because link_delete() always cancels the link timer before 343 * another thread because tipc_link_delete() always cancels the link timer before
344 * node_delete() is called.) 344 * tipc_node_delete() is called.)
345 */ 345 */
346 346
347static void link_timeout(struct link *l_ptr) 347static void link_timeout(struct link *l_ptr)
348{ 348{
349 node_lock(l_ptr->owner); 349 tipc_node_lock(l_ptr->owner);
350 350
351 /* update counters used in statistical profiling of send traffic */ 351 /* update counters used in statistical profiling of send traffic */
352 352
@@ -391,9 +391,9 @@ static void link_timeout(struct link *l_ptr)
391 link_state_event(l_ptr, TIMEOUT_EVT); 391 link_state_event(l_ptr, TIMEOUT_EVT);
392 392
393 if (l_ptr->next_out) 393 if (l_ptr->next_out)
394 link_push_queue(l_ptr); 394 tipc_link_push_queue(l_ptr);
395 395
396 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 inline void link_set_timer(struct link *l_ptr, u32 time)
@@ -402,7 +402,7 @@ static inline void link_set_timer(struct link *l_ptr, u32 time)
402} 402}
403 403
404/** 404/**
405 * link_create - create a new link 405 * tipc_link_create - create a new link
406 * @b_ptr: pointer to associated bearer 406 * @b_ptr: pointer to associated bearer
407 * @peer: network address of node at other end of link 407 * @peer: network address of node at other end of link
408 * @media_addr: media address to use when sending messages over link 408 * @media_addr: media address to use when sending messages over link
@@ -410,8 +410,8 @@ static inline void link_set_timer(struct link *l_ptr, u32 time)
410 * Returns pointer to link. 410 * Returns pointer to link.
411 */ 411 */
412 412
413struct link *link_create(struct bearer *b_ptr, const u32 peer, 413struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
414 const struct tipc_media_addr *media_addr) 414 const struct tipc_media_addr *media_addr)
415{ 415{
416 struct link *l_ptr; 416 struct link *l_ptr;
417 struct tipc_msg *msg; 417 struct tipc_msg *msg;
@@ -449,7 +449,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
449 strcpy((char *)msg_data(msg), if_name); 449 strcpy((char *)msg_data(msg), if_name);
450 450
451 l_ptr->priority = b_ptr->priority; 451 l_ptr->priority = b_ptr->priority;
452 link_set_queue_limits(l_ptr, b_ptr->media->window); 452 tipc_link_set_queue_limits(l_ptr, b_ptr->media->window);
453 453
454 link_init_max_pkt(l_ptr); 454 link_init_max_pkt(l_ptr);
455 455
@@ -458,7 +458,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
458 458
459 link_reset_statistics(l_ptr); 459 link_reset_statistics(l_ptr);
460 460
461 l_ptr->owner = node_attach_link(l_ptr); 461 l_ptr->owner = tipc_node_attach_link(l_ptr);
462 if (!l_ptr->owner) { 462 if (!l_ptr->owner) {
463 kfree(l_ptr); 463 kfree(l_ptr);
464 return NULL; 464 return NULL;
@@ -472,52 +472,52 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
472 warn("Memory squeeze; Failed to create link\n"); 472 warn("Memory squeeze; Failed to create link\n");
473 return NULL; 473 return NULL;
474 } 474 }
475 printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); 475 tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
476 } 476 }
477 477
478 k_signal((Handler)link_start, (unsigned long)l_ptr); 478 tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
479 479
480 dbg("link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", 480 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
481 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); 481 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
482 482
483 return l_ptr; 483 return l_ptr;
484} 484}
485 485
486/** 486/**
487 * link_delete - delete a link 487 * tipc_link_delete - delete a link
488 * @l_ptr: pointer to link 488 * @l_ptr: pointer to link
489 * 489 *
490 * Note: 'net_lock' is write_locked, bearer is locked. 490 * Note: 'tipc_net_lock' is write_locked, bearer is locked.
491 * This routine must not grab the node lock until after link timer cancellation 491 * This routine must not grab the node lock until after link timer cancellation
492 * to avoid a potential deadlock situation. 492 * to avoid a potential deadlock situation.
493 */ 493 */
494 494
495void link_delete(struct link *l_ptr) 495void tipc_link_delete(struct link *l_ptr)
496{ 496{
497 if (!l_ptr) { 497 if (!l_ptr) {
498 err("Attempt to delete non-existent link\n"); 498 err("Attempt to delete non-existent link\n");
499 return; 499 return;
500 } 500 }
501 501
502 dbg("link_delete()\n"); 502 dbg("tipc_link_delete()\n");
503 503
504 k_cancel_timer(&l_ptr->timer); 504 k_cancel_timer(&l_ptr->timer);
505 505
506 node_lock(l_ptr->owner); 506 tipc_node_lock(l_ptr->owner);
507 link_reset(l_ptr); 507 tipc_link_reset(l_ptr);
508 node_detach_link(l_ptr->owner, l_ptr); 508 tipc_node_detach_link(l_ptr->owner, l_ptr);
509 link_stop(l_ptr); 509 tipc_link_stop(l_ptr);
510 list_del_init(&l_ptr->link_list); 510 list_del_init(&l_ptr->link_list);
511 if (LINK_LOG_BUF_SIZE) 511 if (LINK_LOG_BUF_SIZE)
512 kfree(l_ptr->print_buf.buf); 512 kfree(l_ptr->print_buf.buf);
513 node_unlock(l_ptr->owner); 513 tipc_node_unlock(l_ptr->owner);
514 k_term_timer(&l_ptr->timer); 514 k_term_timer(&l_ptr->timer);
515 kfree(l_ptr); 515 kfree(l_ptr);
516} 516}
517 517
518void link_start(struct link *l_ptr) 518void tipc_link_start(struct link *l_ptr)
519{ 519{
520 dbg("link_start %x\n", l_ptr); 520 dbg("tipc_link_start %x\n", l_ptr);
521 link_state_event(l_ptr, STARTING_EVT); 521 link_state_event(l_ptr, STARTING_EVT);
522} 522}
523 523
@@ -535,8 +535,8 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz)
535{ 535{
536 struct port *p_ptr; 536 struct port *p_ptr;
537 537
538 spin_lock_bh(&port_list_lock); 538 spin_lock_bh(&tipc_port_list_lock);
539 p_ptr = port_lock(origport); 539 p_ptr = tipc_port_lock(origport);
540 if (p_ptr) { 540 if (p_ptr) {
541 if (!p_ptr->wakeup) 541 if (!p_ptr->wakeup)
542 goto exit; 542 goto exit;
@@ -548,13 +548,13 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz)
548 list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); 548 list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports);
549 l_ptr->stats.link_congs++; 549 l_ptr->stats.link_congs++;
550exit: 550exit:
551 port_unlock(p_ptr); 551 tipc_port_unlock(p_ptr);
552 } 552 }
553 spin_unlock_bh(&port_list_lock); 553 spin_unlock_bh(&tipc_port_list_lock);
554 return -ELINKCONG; 554 return -ELINKCONG;
555} 555}
556 556
557void link_wakeup_ports(struct link *l_ptr, int all) 557void tipc_link_wakeup_ports(struct link *l_ptr, int all)
558{ 558{
559 struct port *p_ptr; 559 struct port *p_ptr;
560 struct port *temp_p_ptr; 560 struct port *temp_p_ptr;
@@ -564,7 +564,7 @@ void link_wakeup_ports(struct link *l_ptr, int all)
564 win = 100000; 564 win = 100000;
565 if (win <= 0) 565 if (win <= 0)
566 return; 566 return;
567 if (!spin_trylock_bh(&port_list_lock)) 567 if (!spin_trylock_bh(&tipc_port_list_lock))
568 return; 568 return;
569 if (link_congested(l_ptr)) 569 if (link_congested(l_ptr))
570 goto exit; 570 goto exit;
@@ -583,7 +583,7 @@ void link_wakeup_ports(struct link *l_ptr, int all)
583 } 583 }
584 584
585exit: 585exit:
586 spin_unlock_bh(&port_list_lock); 586 spin_unlock_bh(&tipc_port_list_lock);
587} 587}
588 588
589/** 589/**
@@ -606,11 +606,11 @@ static void link_release_outqueue(struct link *l_ptr)
606} 606}
607 607
608/** 608/**
609 * link_reset_fragments - purge link's inbound message fragments queue 609 * tipc_link_reset_fragments - purge link's inbound message fragments queue
610 * @l_ptr: pointer to link 610 * @l_ptr: pointer to link
611 */ 611 */
612 612
613void link_reset_fragments(struct link *l_ptr) 613void tipc_link_reset_fragments(struct link *l_ptr)
614{ 614{
615 struct sk_buff *buf = l_ptr->defragm_buf; 615 struct sk_buff *buf = l_ptr->defragm_buf;
616 struct sk_buff *next; 616 struct sk_buff *next;
@@ -624,11 +624,11 @@ void link_reset_fragments(struct link *l_ptr)
624} 624}
625 625
626/** 626/**
627 * link_stop - purge all inbound and outbound messages associated with link 627 * tipc_link_stop - purge all inbound and outbound messages associated with link
628 * @l_ptr: pointer to link 628 * @l_ptr: pointer to link
629 */ 629 */
630 630
631void link_stop(struct link *l_ptr) 631void tipc_link_stop(struct link *l_ptr)
632{ 632{
633 struct sk_buff *buf; 633 struct sk_buff *buf;
634 struct sk_buff *next; 634 struct sk_buff *next;
@@ -647,7 +647,7 @@ void link_stop(struct link *l_ptr)
647 buf = next; 647 buf = next;
648 } 648 }
649 649
650 link_reset_fragments(l_ptr); 650 tipc_link_reset_fragments(l_ptr);
651 651
652 buf_discard(l_ptr->proto_msg_queue); 652 buf_discard(l_ptr->proto_msg_queue);
653 l_ptr->proto_msg_queue = NULL; 653 l_ptr->proto_msg_queue = NULL;
@@ -677,7 +677,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up),
677 ev->up = up; 677 ev->up = up;
678 ev->fcn = fcn; 678 ev->fcn = fcn;
679 memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME); 679 memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME);
680 k_signal((Handler)link_recv_event, (unsigned long)ev); 680 tipc_k_signal((Handler)link_recv_event, (unsigned long)ev);
681} 681}
682 682
683#else 683#else
@@ -686,7 +686,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up),
686 686
687#endif 687#endif
688 688
689void link_reset(struct link *l_ptr) 689void tipc_link_reset(struct link *l_ptr)
690{ 690{
691 struct sk_buff *buf; 691 struct sk_buff *buf;
692 u32 prev_state = l_ptr->state; 692 u32 prev_state = l_ptr->state;
@@ -706,13 +706,13 @@ void link_reset(struct link *l_ptr)
706 if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET)) 706 if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET))
707 return; 707 return;
708 708
709 node_link_down(l_ptr->owner, l_ptr); 709 tipc_node_link_down(l_ptr->owner, l_ptr);
710 bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); 710 tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr);
711#if 0 711#if 0
712 tipc_printf(CONS, "\nReset link <%s>\n", l_ptr->name); 712 tipc_printf(TIPC_CONS, "\nReset link <%s>\n", l_ptr->name);
713 dbg_link_dump(); 713 dbg_link_dump();
714#endif 714#endif
715 if (node_has_active_links(l_ptr->owner) && 715 if (tipc_node_has_active_links(l_ptr->owner) &&
716 l_ptr->owner->permit_changeover) { 716 l_ptr->owner->permit_changeover) {
717 l_ptr->reset_checkpoint = checkpoint; 717 l_ptr->reset_checkpoint = checkpoint;
718 l_ptr->exp_msg_count = START_CHANGEOVER; 718 l_ptr->exp_msg_count = START_CHANGEOVER;
@@ -730,7 +730,7 @@ void link_reset(struct link *l_ptr)
730 buf = next; 730 buf = next;
731 } 731 }
732 if (!list_empty(&l_ptr->waiting_ports)) 732 if (!list_empty(&l_ptr->waiting_ports))
733 link_wakeup_ports(l_ptr, 1); 733 tipc_link_wakeup_ports(l_ptr, 1);
734 734
735 l_ptr->retransm_queue_head = 0; 735 l_ptr->retransm_queue_head = 0;
736 l_ptr->retransm_queue_size = 0; 736 l_ptr->retransm_queue_size = 0;
@@ -747,20 +747,20 @@ void link_reset(struct link *l_ptr)
747 l_ptr->stale_count = 0; 747 l_ptr->stale_count = 0;
748 link_reset_statistics(l_ptr); 748 link_reset_statistics(l_ptr);
749 749
750 link_send_event(cfg_link_event, l_ptr, 0); 750 link_send_event(tipc_cfg_link_event, l_ptr, 0);
751 if (!in_own_cluster(l_ptr->addr)) 751 if (!in_own_cluster(l_ptr->addr))
752 link_send_event(disc_link_event, l_ptr, 0); 752 link_send_event(tipc_disc_link_event, l_ptr, 0);
753} 753}
754 754
755 755
756static void link_activate(struct link *l_ptr) 756static void link_activate(struct link *l_ptr)
757{ 757{
758 l_ptr->next_in_no = 1; 758 l_ptr->next_in_no = 1;
759 node_link_up(l_ptr->owner, l_ptr); 759 tipc_node_link_up(l_ptr->owner, l_ptr);
760 bearer_add_dest(l_ptr->b_ptr, l_ptr->addr); 760 tipc_bearer_add_dest(l_ptr->b_ptr, l_ptr->addr);
761 link_send_event(cfg_link_event, l_ptr, 1); 761 link_send_event(tipc_cfg_link_event, l_ptr, 1);
762 if (!in_own_cluster(l_ptr->addr)) 762 if (!in_own_cluster(l_ptr->addr))
763 link_send_event(disc_link_event, l_ptr, 1); 763 link_send_event(tipc_disc_link_event, l_ptr, 1);
764} 764}
765 765
766/** 766/**
@@ -799,13 +799,13 @@ static void link_state_event(struct link *l_ptr, unsigned event)
799 dbg_link("TIM "); 799 dbg_link("TIM ");
800 if (l_ptr->next_in_no != l_ptr->checkpoint) { 800 if (l_ptr->next_in_no != l_ptr->checkpoint) {
801 l_ptr->checkpoint = l_ptr->next_in_no; 801 l_ptr->checkpoint = l_ptr->next_in_no;
802 if (bclink_acks_missing(l_ptr->owner)) { 802 if (tipc_bclink_acks_missing(l_ptr->owner)) {
803 link_send_proto_msg(l_ptr, STATE_MSG, 803 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
804 0, 0, 0, 0, 0); 804 0, 0, 0, 0, 0);
805 l_ptr->fsm_msg_cnt++; 805 l_ptr->fsm_msg_cnt++;
806 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { 806 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) {
807 link_send_proto_msg(l_ptr, STATE_MSG, 807 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
808 1, 0, 0, 0, 0); 808 1, 0, 0, 0, 0);
809 l_ptr->fsm_msg_cnt++; 809 l_ptr->fsm_msg_cnt++;
810 } 810 }
811 link_set_timer(l_ptr, cont_intv); 811 link_set_timer(l_ptr, cont_intv);
@@ -814,16 +814,16 @@ static void link_state_event(struct link *l_ptr, unsigned event)
814 dbg_link(" -> WU\n"); 814 dbg_link(" -> WU\n");
815 l_ptr->state = WORKING_UNKNOWN; 815 l_ptr->state = WORKING_UNKNOWN;
816 l_ptr->fsm_msg_cnt = 0; 816 l_ptr->fsm_msg_cnt = 0;
817 link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 817 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
818 l_ptr->fsm_msg_cnt++; 818 l_ptr->fsm_msg_cnt++;
819 link_set_timer(l_ptr, cont_intv / 4); 819 link_set_timer(l_ptr, cont_intv / 4);
820 break; 820 break;
821 case RESET_MSG: 821 case RESET_MSG:
822 dbg_link("RES -> RR\n"); 822 dbg_link("RES -> RR\n");
823 link_reset(l_ptr); 823 tipc_link_reset(l_ptr);
824 l_ptr->state = RESET_RESET; 824 l_ptr->state = RESET_RESET;
825 l_ptr->fsm_msg_cnt = 0; 825 l_ptr->fsm_msg_cnt = 0;
826 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 826 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
827 l_ptr->fsm_msg_cnt++; 827 l_ptr->fsm_msg_cnt++;
828 link_set_timer(l_ptr, cont_intv); 828 link_set_timer(l_ptr, cont_intv);
829 break; 829 break;
@@ -844,10 +844,10 @@ static void link_state_event(struct link *l_ptr, unsigned event)
844 break; 844 break;
845 case RESET_MSG: 845 case RESET_MSG:
846 dbg_link("RES -> RR\n"); 846 dbg_link("RES -> RR\n");
847 link_reset(l_ptr); 847 tipc_link_reset(l_ptr);
848 l_ptr->state = RESET_RESET; 848 l_ptr->state = RESET_RESET;
849 l_ptr->fsm_msg_cnt = 0; 849 l_ptr->fsm_msg_cnt = 0;
850 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 850 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
851 l_ptr->fsm_msg_cnt++; 851 l_ptr->fsm_msg_cnt++;
852 link_set_timer(l_ptr, cont_intv); 852 link_set_timer(l_ptr, cont_intv);
853 break; 853 break;
@@ -858,9 +858,9 @@ static void link_state_event(struct link *l_ptr, unsigned event)
858 l_ptr->state = WORKING_WORKING; 858 l_ptr->state = WORKING_WORKING;
859 l_ptr->fsm_msg_cnt = 0; 859 l_ptr->fsm_msg_cnt = 0;
860 l_ptr->checkpoint = l_ptr->next_in_no; 860 l_ptr->checkpoint = l_ptr->next_in_no;
861 if (bclink_acks_missing(l_ptr->owner)) { 861 if (tipc_bclink_acks_missing(l_ptr->owner)) {
862 link_send_proto_msg(l_ptr, STATE_MSG, 862 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
863 0, 0, 0, 0, 0); 863 0, 0, 0, 0, 0);
864 l_ptr->fsm_msg_cnt++; 864 l_ptr->fsm_msg_cnt++;
865 } 865 }
866 link_set_timer(l_ptr, cont_intv); 866 link_set_timer(l_ptr, cont_intv);
@@ -868,18 +868,18 @@ static void link_state_event(struct link *l_ptr, unsigned event)
868 dbg_link("Probing %u/%u,timer = %u ms)\n", 868 dbg_link("Probing %u/%u,timer = %u ms)\n",
869 l_ptr->fsm_msg_cnt, l_ptr->abort_limit, 869 l_ptr->fsm_msg_cnt, l_ptr->abort_limit,
870 cont_intv / 4); 870 cont_intv / 4);
871 link_send_proto_msg(l_ptr, STATE_MSG, 871 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
872 1, 0, 0, 0, 0); 872 1, 0, 0, 0, 0);
873 l_ptr->fsm_msg_cnt++; 873 l_ptr->fsm_msg_cnt++;
874 link_set_timer(l_ptr, cont_intv / 4); 874 link_set_timer(l_ptr, cont_intv / 4);
875 } else { /* Link has failed */ 875 } else { /* Link has failed */
876 dbg_link("-> RU (%u probes unanswered)\n", 876 dbg_link("-> RU (%u probes unanswered)\n",
877 l_ptr->fsm_msg_cnt); 877 l_ptr->fsm_msg_cnt);
878 link_reset(l_ptr); 878 tipc_link_reset(l_ptr);
879 l_ptr->state = RESET_UNKNOWN; 879 l_ptr->state = RESET_UNKNOWN;
880 l_ptr->fsm_msg_cnt = 0; 880 l_ptr->fsm_msg_cnt = 0;
881 link_send_proto_msg(l_ptr, RESET_MSG, 881 tipc_link_send_proto_msg(l_ptr, RESET_MSG,
882 0, 0, 0, 0, 0); 882 0, 0, 0, 0, 0);
883 l_ptr->fsm_msg_cnt++; 883 l_ptr->fsm_msg_cnt++;
884 link_set_timer(l_ptr, cont_intv); 884 link_set_timer(l_ptr, cont_intv);
885 } 885 }
@@ -904,7 +904,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
904 l_ptr->state = WORKING_WORKING; 904 l_ptr->state = WORKING_WORKING;
905 l_ptr->fsm_msg_cnt = 0; 905 l_ptr->fsm_msg_cnt = 0;
906 link_activate(l_ptr); 906 link_activate(l_ptr);
907 link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 907 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
908 l_ptr->fsm_msg_cnt++; 908 l_ptr->fsm_msg_cnt++;
909 link_set_timer(l_ptr, cont_intv); 909 link_set_timer(l_ptr, cont_intv);
910 break; 910 break;
@@ -913,7 +913,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
913 dbg_link(" -> RR\n"); 913 dbg_link(" -> RR\n");
914 l_ptr->state = RESET_RESET; 914 l_ptr->state = RESET_RESET;
915 l_ptr->fsm_msg_cnt = 0; 915 l_ptr->fsm_msg_cnt = 0;
916 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0); 916 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0);
917 l_ptr->fsm_msg_cnt++; 917 l_ptr->fsm_msg_cnt++;
918 link_set_timer(l_ptr, cont_intv); 918 link_set_timer(l_ptr, cont_intv);
919 break; 919 break;
@@ -923,7 +923,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
923 /* fall through */ 923 /* fall through */
924 case TIMEOUT_EVT: 924 case TIMEOUT_EVT:
925 dbg_link("TIM \n"); 925 dbg_link("TIM \n");
926 link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0); 926 tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0);
927 l_ptr->fsm_msg_cnt++; 927 l_ptr->fsm_msg_cnt++;
928 link_set_timer(l_ptr, cont_intv); 928 link_set_timer(l_ptr, cont_intv);
929 break; 929 break;
@@ -947,7 +947,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
947 l_ptr->state = WORKING_WORKING; 947 l_ptr->state = WORKING_WORKING;
948 l_ptr->fsm_msg_cnt = 0; 948 l_ptr->fsm_msg_cnt = 0;
949 link_activate(l_ptr); 949 link_activate(l_ptr);
950 link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 950 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
951 l_ptr->fsm_msg_cnt++; 951 l_ptr->fsm_msg_cnt++;
952 link_set_timer(l_ptr, cont_intv); 952 link_set_timer(l_ptr, cont_intv);
953 break; 953 break;
@@ -956,7 +956,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
956 break; 956 break;
957 case TIMEOUT_EVT: 957 case TIMEOUT_EVT:
958 dbg_link("TIM\n"); 958 dbg_link("TIM\n");
959 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 959 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
960 l_ptr->fsm_msg_cnt++; 960 l_ptr->fsm_msg_cnt++;
961 link_set_timer(l_ptr, cont_intv); 961 link_set_timer(l_ptr, cont_intv);
962 dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt); 962 dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt);
@@ -1023,12 +1023,12 @@ static inline void link_add_to_outqueue(struct link *l_ptr,
1023} 1023}
1024 1024
1025/* 1025/*
1026 * link_send_buf() is the 'full path' for messages, called from 1026 * tipc_link_send_buf() is the 'full path' for messages, called from
1027 * inside TIPC when the 'fast path' in tipc_send_buf 1027 * inside TIPC when the 'fast path' in tipc_send_buf
1028 * has failed, and from link_send() 1028 * has failed, and from link_send()
1029 */ 1029 */
1030 1030
1031int link_send_buf(struct link *l_ptr, struct sk_buff *buf) 1031int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1032{ 1032{
1033 struct tipc_msg *msg = buf_msg(buf); 1033 struct tipc_msg *msg = buf_msg(buf);
1034 u32 size = msg_size(msg); 1034 u32 size = msg_size(msg);
@@ -1051,7 +1051,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1051 buf_discard(buf); 1051 buf_discard(buf);
1052 if (imp > CONN_MANAGER) { 1052 if (imp > CONN_MANAGER) {
1053 warn("Resetting <%s>, send queue full", l_ptr->name); 1053 warn("Resetting <%s>, send queue full", l_ptr->name);
1054 link_reset(l_ptr); 1054 tipc_link_reset(l_ptr);
1055 } 1055 }
1056 return dsz; 1056 return dsz;
1057 } 1057 }
@@ -1059,21 +1059,21 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1059 /* Fragmentation needed ? */ 1059 /* Fragmentation needed ? */
1060 1060
1061 if (size > max_packet) 1061 if (size > max_packet)
1062 return link_send_long_buf(l_ptr, buf); 1062 return tipc_link_send_long_buf(l_ptr, buf);
1063 1063
1064 /* Packet can be queued or sent: */ 1064 /* Packet can be queued or sent: */
1065 1065
1066 if (queue_size > l_ptr->stats.max_queue_sz) 1066 if (queue_size > l_ptr->stats.max_queue_sz)
1067 l_ptr->stats.max_queue_sz = queue_size; 1067 l_ptr->stats.max_queue_sz = queue_size;
1068 1068
1069 if (likely(!bearer_congested(l_ptr->b_ptr, l_ptr) && 1069 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
1070 !link_congested(l_ptr))) { 1070 !link_congested(l_ptr))) {
1071 link_add_to_outqueue(l_ptr, buf, msg); 1071 link_add_to_outqueue(l_ptr, buf, msg);
1072 1072
1073 if (likely(bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) { 1073 if (likely(tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) {
1074 l_ptr->unacked_window = 0; 1074 l_ptr->unacked_window = 0;
1075 } else { 1075 } else {
1076 bearer_schedule(l_ptr->b_ptr, l_ptr); 1076 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1077 l_ptr->stats.bearer_congs++; 1077 l_ptr->stats.bearer_congs++;
1078 l_ptr->next_out = buf; 1078 l_ptr->next_out = buf;
1079 } 1079 }
@@ -1088,7 +1088,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1088 1088
1089 if (l_ptr->next_out && 1089 if (l_ptr->next_out &&
1090 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { 1090 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
1091 bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); 1091 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
1092 return dsz; 1092 return dsz;
1093 } 1093 }
1094 1094
@@ -1114,38 +1114,38 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1114 if (!l_ptr->next_out) 1114 if (!l_ptr->next_out)
1115 l_ptr->next_out = buf; 1115 l_ptr->next_out = buf;
1116 link_add_to_outqueue(l_ptr, buf, msg); 1116 link_add_to_outqueue(l_ptr, buf, msg);
1117 bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); 1117 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
1118 return dsz; 1118 return dsz;
1119} 1119}
1120 1120
1121/* 1121/*
1122 * link_send(): same as link_send_buf(), but the link to use has 1122 * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has
1123 * not been selected yet, and the the owner node is not locked 1123 * not been selected yet, and the the owner node is not locked
1124 * Called by TIPC internal users, e.g. the name distributor 1124 * Called by TIPC internal users, e.g. the name distributor
1125 */ 1125 */
1126 1126
1127int link_send(struct sk_buff *buf, u32 dest, u32 selector) 1127int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
1128{ 1128{
1129 struct link *l_ptr; 1129 struct link *l_ptr;
1130 struct node *n_ptr; 1130 struct node *n_ptr;
1131 int res = -ELINKCONG; 1131 int res = -ELINKCONG;
1132 1132
1133 read_lock_bh(&net_lock); 1133 read_lock_bh(&tipc_net_lock);
1134 n_ptr = node_select(dest, selector); 1134 n_ptr = tipc_node_select(dest, selector);
1135 if (n_ptr) { 1135 if (n_ptr) {
1136 node_lock(n_ptr); 1136 tipc_node_lock(n_ptr);
1137 l_ptr = n_ptr->active_links[selector & 1]; 1137 l_ptr = n_ptr->active_links[selector & 1];
1138 dbg("link_send: found link %x for dest %x\n", l_ptr, dest); 1138 dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest);
1139 if (l_ptr) { 1139 if (l_ptr) {
1140 res = link_send_buf(l_ptr, buf); 1140 res = tipc_link_send_buf(l_ptr, buf);
1141 } 1141 }
1142 node_unlock(n_ptr); 1142 tipc_node_unlock(n_ptr);
1143 } else { 1143 } else {
1144 dbg("Attempt to send msg to unknown node:\n"); 1144 dbg("Attempt to send msg to unknown node:\n");
1145 msg_dbg(buf_msg(buf),">>>"); 1145 msg_dbg(buf_msg(buf),">>>");
1146 buf_discard(buf); 1146 buf_discard(buf);
1147 } 1147 }
1148 read_unlock_bh(&net_lock); 1148 read_unlock_bh(&tipc_net_lock);
1149 return res; 1149 return res;
1150} 1150}
1151 1151
@@ -1166,14 +1166,14 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
1166 if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) { 1166 if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) {
1167 if (likely(list_empty(&l_ptr->b_ptr->cong_links))) { 1167 if (likely(list_empty(&l_ptr->b_ptr->cong_links))) {
1168 link_add_to_outqueue(l_ptr, buf, msg); 1168 link_add_to_outqueue(l_ptr, buf, msg);
1169 if (likely(bearer_send(l_ptr->b_ptr, buf, 1169 if (likely(tipc_bearer_send(l_ptr->b_ptr, buf,
1170 &l_ptr->media_addr))) { 1170 &l_ptr->media_addr))) {
1171 l_ptr->unacked_window = 0; 1171 l_ptr->unacked_window = 0;
1172 msg_dbg(msg,"SENT_FAST:"); 1172 msg_dbg(msg,"SENT_FAST:");
1173 return res; 1173 return res;
1174 } 1174 }
1175 dbg("failed sent fast...\n"); 1175 dbg("failed sent fast...\n");
1176 bearer_schedule(l_ptr->b_ptr, l_ptr); 1176 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1177 l_ptr->stats.bearer_congs++; 1177 l_ptr->stats.bearer_congs++;
1178 l_ptr->next_out = buf; 1178 l_ptr->next_out = buf;
1179 return res; 1179 return res;
@@ -1182,7 +1182,7 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
1182 else 1182 else
1183 *used_max_pkt = link_max_pkt(l_ptr); 1183 *used_max_pkt = link_max_pkt(l_ptr);
1184 } 1184 }
1185 return link_send_buf(l_ptr, buf); /* All other cases */ 1185 return tipc_link_send_buf(l_ptr, buf); /* All other cases */
1186} 1186}
1187 1187
1188/* 1188/*
@@ -1200,24 +1200,24 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
1200 u32 dummy; 1200 u32 dummy;
1201 1201
1202 if (destnode == tipc_own_addr) 1202 if (destnode == tipc_own_addr)
1203 return port_recv_msg(buf); 1203 return tipc_port_recv_msg(buf);
1204 1204
1205 read_lock_bh(&net_lock); 1205 read_lock_bh(&tipc_net_lock);
1206 n_ptr = node_select(destnode, selector); 1206 n_ptr = tipc_node_select(destnode, selector);
1207 if (likely(n_ptr)) { 1207 if (likely(n_ptr)) {
1208 node_lock(n_ptr); 1208 tipc_node_lock(n_ptr);
1209 l_ptr = n_ptr->active_links[selector]; 1209 l_ptr = n_ptr->active_links[selector];
1210 dbg("send_fast: buf %x selected %x, destnode = %x\n", 1210 dbg("send_fast: buf %x selected %x, destnode = %x\n",
1211 buf, l_ptr, destnode); 1211 buf, l_ptr, destnode);
1212 if (likely(l_ptr)) { 1212 if (likely(l_ptr)) {
1213 res = link_send_buf_fast(l_ptr, buf, &dummy); 1213 res = link_send_buf_fast(l_ptr, buf, &dummy);
1214 node_unlock(n_ptr); 1214 tipc_node_unlock(n_ptr);
1215 read_unlock_bh(&net_lock); 1215 read_unlock_bh(&tipc_net_lock);
1216 return res; 1216 return res;
1217 } 1217 }
1218 node_unlock(n_ptr); 1218 tipc_node_unlock(n_ptr);
1219 } 1219 }
1220 read_unlock_bh(&net_lock); 1220 read_unlock_bh(&tipc_net_lock);
1221 res = msg_data_sz(buf_msg(buf)); 1221 res = msg_data_sz(buf_msg(buf));
1222 tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1222 tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
1223 return res; 1223 return res;
@@ -1225,15 +1225,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
1225 1225
1226 1226
1227/* 1227/*
1228 * link_send_sections_fast: Entry for messages where the 1228 * tipc_link_send_sections_fast: Entry for messages where the
1229 * destination processor is known and the header is complete, 1229 * destination processor is known and the header is complete,
1230 * except for total message length. 1230 * except for total message length.
1231 * Returns user data length or errno. 1231 * Returns user data length or errno.
1232 */ 1232 */
1233int link_send_sections_fast(struct port *sender, 1233int tipc_link_send_sections_fast(struct port *sender,
1234 struct iovec const *msg_sect, 1234 struct iovec const *msg_sect,
1235 const u32 num_sect, 1235 const u32 num_sect,
1236 u32 destaddr) 1236 u32 destaddr)
1237{ 1237{
1238 struct tipc_msg *hdr = &sender->publ.phdr; 1238 struct tipc_msg *hdr = &sender->publ.phdr;
1239 struct link *l_ptr; 1239 struct link *l_ptr;
@@ -1253,10 +1253,10 @@ again:
1253 res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt, 1253 res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt,
1254 !sender->user_port, &buf); 1254 !sender->user_port, &buf);
1255 1255
1256 read_lock_bh(&net_lock); 1256 read_lock_bh(&tipc_net_lock);
1257 node = node_select(destaddr, selector); 1257 node = tipc_node_select(destaddr, selector);
1258 if (likely(node)) { 1258 if (likely(node)) {
1259 node_lock(node); 1259 tipc_node_lock(node);
1260 l_ptr = node->active_links[selector]; 1260 l_ptr = node->active_links[selector];
1261 if (likely(l_ptr)) { 1261 if (likely(l_ptr)) {
1262 if (likely(buf)) { 1262 if (likely(buf)) {
@@ -1265,8 +1265,8 @@ again:
1265 if (unlikely(res < 0)) 1265 if (unlikely(res < 0))
1266 buf_discard(buf); 1266 buf_discard(buf);
1267exit: 1267exit:
1268 node_unlock(node); 1268 tipc_node_unlock(node);
1269 read_unlock_bh(&net_lock); 1269 read_unlock_bh(&tipc_net_lock);
1270 return res; 1270 return res;
1271 } 1271 }
1272 1272
@@ -1290,8 +1290,8 @@ exit:
1290 */ 1290 */
1291 1291
1292 sender->max_pkt = link_max_pkt(l_ptr); 1292 sender->max_pkt = link_max_pkt(l_ptr);
1293 node_unlock(node); 1293 tipc_node_unlock(node);
1294 read_unlock_bh(&net_lock); 1294 read_unlock_bh(&tipc_net_lock);
1295 1295
1296 1296
1297 if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt) 1297 if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt)
@@ -1300,17 +1300,17 @@ exit:
1300 return link_send_sections_long(sender, msg_sect, 1300 return link_send_sections_long(sender, msg_sect,
1301 num_sect, destaddr); 1301 num_sect, destaddr);
1302 } 1302 }
1303 node_unlock(node); 1303 tipc_node_unlock(node);
1304 } 1304 }
1305 read_unlock_bh(&net_lock); 1305 read_unlock_bh(&tipc_net_lock);
1306 1306
1307 /* Couldn't find a link to the destination node */ 1307 /* Couldn't find a link to the destination node */
1308 1308
1309 if (buf) 1309 if (buf)
1310 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1310 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
1311 if (res >= 0) 1311 if (res >= 0)
1312 return port_reject_sections(sender, hdr, msg_sect, num_sect, 1312 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
1313 TIPC_ERR_NO_NODE); 1313 TIPC_ERR_NO_NODE);
1314 return res; 1314 return res;
1315} 1315}
1316 1316
@@ -1444,17 +1444,17 @@ error:
1444 * Now we have a buffer chain. Select a link and check 1444 * Now we have a buffer chain. Select a link and check
1445 * that packet size is still OK 1445 * that packet size is still OK
1446 */ 1446 */
1447 node = node_select(destaddr, sender->publ.ref & 1); 1447 node = tipc_node_select(destaddr, sender->publ.ref & 1);
1448 if (likely(node)) { 1448 if (likely(node)) {
1449 node_lock(node); 1449 tipc_node_lock(node);
1450 l_ptr = node->active_links[sender->publ.ref & 1]; 1450 l_ptr = node->active_links[sender->publ.ref & 1];
1451 if (!l_ptr) { 1451 if (!l_ptr) {
1452 node_unlock(node); 1452 tipc_node_unlock(node);
1453 goto reject; 1453 goto reject;
1454 } 1454 }
1455 if (link_max_pkt(l_ptr) < max_pkt) { 1455 if (link_max_pkt(l_ptr) < max_pkt) {
1456 sender->max_pkt = link_max_pkt(l_ptr); 1456 sender->max_pkt = link_max_pkt(l_ptr);
1457 node_unlock(node); 1457 tipc_node_unlock(node);
1458 for (; buf_chain; buf_chain = buf) { 1458 for (; buf_chain; buf_chain = buf) {
1459 buf = buf_chain->next; 1459 buf = buf_chain->next;
1460 buf_discard(buf_chain); 1460 buf_discard(buf_chain);
@@ -1467,8 +1467,8 @@ reject:
1467 buf = buf_chain->next; 1467 buf = buf_chain->next;
1468 buf_discard(buf_chain); 1468 buf_discard(buf_chain);
1469 } 1469 }
1470 return port_reject_sections(sender, hdr, msg_sect, num_sect, 1470 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
1471 TIPC_ERR_NO_NODE); 1471 TIPC_ERR_NO_NODE);
1472 } 1472 }
1473 1473
1474 /* Append whole chain to send queue: */ 1474 /* Append whole chain to send queue: */
@@ -1491,15 +1491,15 @@ reject:
1491 1491
1492 /* Send it, if possible: */ 1492 /* Send it, if possible: */
1493 1493
1494 link_push_queue(l_ptr); 1494 tipc_link_push_queue(l_ptr);
1495 node_unlock(node); 1495 tipc_node_unlock(node);
1496 return dsz; 1496 return dsz;
1497} 1497}
1498 1498
1499/* 1499/*
1500 * link_push_packet: Push one unsent packet to the media 1500 * tipc_link_push_packet: Push one unsent packet to the media
1501 */ 1501 */
1502u32 link_push_packet(struct link *l_ptr) 1502u32 tipc_link_push_packet(struct link *l_ptr)
1503{ 1503{
1504 struct sk_buff *buf = l_ptr->first_out; 1504 struct sk_buff *buf = l_ptr->first_out;
1505 u32 r_q_size = l_ptr->retransm_queue_size; 1505 u32 r_q_size = l_ptr->retransm_queue_size;
@@ -1526,7 +1526,7 @@ u32 link_push_packet(struct link *l_ptr)
1526 if (r_q_size && buf && !skb_cloned(buf)) { 1526 if (r_q_size && buf && !skb_cloned(buf)) {
1527 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1527 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1528 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); 1528 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
1529 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1529 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1530 msg_dbg(buf_msg(buf), ">DEF-RETR>"); 1530 msg_dbg(buf_msg(buf), ">DEF-RETR>");
1531 l_ptr->retransm_queue_head = mod(++r_q_head); 1531 l_ptr->retransm_queue_head = mod(++r_q_head);
1532 l_ptr->retransm_queue_size = --r_q_size; 1532 l_ptr->retransm_queue_size = --r_q_size;
@@ -1545,7 +1545,7 @@ u32 link_push_packet(struct link *l_ptr)
1545 if (buf) { 1545 if (buf) {
1546 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1546 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1547 msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in); 1547 msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in);
1548 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1548 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
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);
@@ -1569,7 +1569,7 @@ u32 link_push_packet(struct link *l_ptr)
1569 if (mod(next - first) < l_ptr->queue_limit[0]) { 1569 if (mod(next - first) < l_ptr->queue_limit[0]) {
1570 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 1570 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
1571 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1571 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
1572 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1572 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1573 if (msg_user(msg) == MSG_BUNDLER) 1573 if (msg_user(msg) == MSG_BUNDLER)
1574 msg_set_type(msg, CLOSED_MSG); 1574 msg_set_type(msg, CLOSED_MSG);
1575 msg_dbg(msg, ">PUSH-DATA>"); 1575 msg_dbg(msg, ">PUSH-DATA>");
@@ -1589,29 +1589,29 @@ u32 link_push_packet(struct link *l_ptr)
1589 * push_queue(): push out the unsent messages of a link where 1589 * push_queue(): push out the unsent messages of a link where
1590 * congestion has abated. Node is locked 1590 * congestion has abated. Node is locked
1591 */ 1591 */
1592void link_push_queue(struct link *l_ptr) 1592void tipc_link_push_queue(struct link *l_ptr)
1593{ 1593{
1594 u32 res; 1594 u32 res;
1595 1595
1596 if (bearer_congested(l_ptr->b_ptr, l_ptr)) 1596 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr))
1597 return; 1597 return;
1598 1598
1599 do { 1599 do {
1600 res = link_push_packet(l_ptr); 1600 res = tipc_link_push_packet(l_ptr);
1601 } 1601 }
1602 while (res == TIPC_OK); 1602 while (res == TIPC_OK);
1603 if (res == PUSH_FAILED) 1603 if (res == PUSH_FAILED)
1604 bearer_schedule(l_ptr->b_ptr, l_ptr); 1604 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1605} 1605}
1606 1606
1607void link_retransmit(struct link *l_ptr, struct sk_buff *buf, 1607void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1608 u32 retransmits) 1608 u32 retransmits)
1609{ 1609{
1610 struct tipc_msg *msg; 1610 struct tipc_msg *msg;
1611 1611
1612 dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); 1612 dbg("Retransmitting %u in link %x\n", retransmits, l_ptr);
1613 1613
1614 if (bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) { 1614 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) {
1615 msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>"); 1615 msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>");
1616 dbg_print_link(l_ptr, " "); 1616 dbg_print_link(l_ptr, " ");
1617 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); 1617 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
@@ -1622,15 +1622,15 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1622 msg = buf_msg(buf); 1622 msg = buf_msg(buf);
1623 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 1623 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
1624 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1624 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
1625 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1625 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1626 /* Catch if retransmissions fail repeatedly: */ 1626 /* Catch if retransmissions fail repeatedly: */
1627 if (l_ptr->last_retransmitted == msg_seqno(msg)) { 1627 if (l_ptr->last_retransmitted == msg_seqno(msg)) {
1628 if (++l_ptr->stale_count > 100) { 1628 if (++l_ptr->stale_count > 100) {
1629 msg_print(CONS, buf_msg(buf), ">RETR>"); 1629 tipc_msg_print(TIPC_CONS, buf_msg(buf), ">RETR>");
1630 info("...Retransmitted %u times\n", 1630 info("...Retransmitted %u times\n",
1631 l_ptr->stale_count); 1631 l_ptr->stale_count);
1632 link_print(l_ptr, CONS, "Resetting Link\n");; 1632 link_print(l_ptr, TIPC_CONS, "Resetting Link\n");;
1633 link_reset(l_ptr); 1633 tipc_link_reset(l_ptr);
1634 break; 1634 break;
1635 } 1635 }
1636 } else { 1636 } else {
@@ -1643,7 +1643,7 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1643 retransmits--; 1643 retransmits--;
1644 l_ptr->stats.retransmitted++; 1644 l_ptr->stats.retransmitted++;
1645 } else { 1645 } else {
1646 bearer_schedule(l_ptr->b_ptr, l_ptr); 1646 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1647 l_ptr->stats.bearer_congs++; 1647 l_ptr->stats.bearer_congs++;
1648 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); 1648 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
1649 l_ptr->retransm_queue_size = retransmits; 1649 l_ptr->retransm_queue_size = retransmits;
@@ -1663,9 +1663,9 @@ static void link_recv_non_seq(struct sk_buff *buf)
1663 struct tipc_msg *msg = buf_msg(buf); 1663 struct tipc_msg *msg = buf_msg(buf);
1664 1664
1665 if (msg_user(msg) == LINK_CONFIG) 1665 if (msg_user(msg) == LINK_CONFIG)
1666 disc_recv_msg(buf); 1666 tipc_disc_recv_msg(buf);
1667 else 1667 else
1668 bclink_recv_pkt(buf); 1668 tipc_bclink_recv_pkt(buf);
1669} 1669}
1670 1670
1671/** 1671/**
@@ -1692,7 +1692,7 @@ static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr,
1692 1692
1693void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) 1693void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1694{ 1694{
1695 read_lock_bh(&net_lock); 1695 read_lock_bh(&tipc_net_lock);
1696 while (head) { 1696 while (head) {
1697 struct bearer *b_ptr; 1697 struct bearer *b_ptr;
1698 struct node *n_ptr; 1698 struct node *n_ptr;
@@ -1720,22 +1720,22 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1720 link_recv_non_seq(buf); 1720 link_recv_non_seq(buf);
1721 continue; 1721 continue;
1722 } 1722 }
1723 n_ptr = node_find(msg_prevnode(msg)); 1723 n_ptr = tipc_node_find(msg_prevnode(msg));
1724 if (unlikely(!n_ptr)) 1724 if (unlikely(!n_ptr))
1725 goto cont; 1725 goto cont;
1726 1726
1727 node_lock(n_ptr); 1727 tipc_node_lock(n_ptr);
1728 l_ptr = n_ptr->links[b_ptr->identity]; 1728 l_ptr = n_ptr->links[b_ptr->identity];
1729 if (unlikely(!l_ptr)) { 1729 if (unlikely(!l_ptr)) {
1730 node_unlock(n_ptr); 1730 tipc_node_unlock(n_ptr);
1731 goto cont; 1731 goto cont;
1732 } 1732 }
1733 /* 1733 /*
1734 * Release acked messages 1734 * Release acked messages
1735 */ 1735 */
1736 if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { 1736 if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) {
1737 if (node_is_up(n_ptr) && n_ptr->bclink.supported) 1737 if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
1738 bclink_acknowledge(n_ptr, msg_bcast_ack(msg)); 1738 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
1739 } 1739 }
1740 1740
1741 crs = l_ptr->first_out; 1741 crs = l_ptr->first_out;
@@ -1752,12 +1752,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1752 l_ptr->out_queue_size -= released; 1752 l_ptr->out_queue_size -= released;
1753 } 1753 }
1754 if (unlikely(l_ptr->next_out)) 1754 if (unlikely(l_ptr->next_out))
1755 link_push_queue(l_ptr); 1755 tipc_link_push_queue(l_ptr);
1756 if (unlikely(!list_empty(&l_ptr->waiting_ports))) 1756 if (unlikely(!list_empty(&l_ptr->waiting_ports)))
1757 link_wakeup_ports(l_ptr, 0); 1757 tipc_link_wakeup_ports(l_ptr, 0);
1758 if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) { 1758 if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) {
1759 l_ptr->stats.sent_acks++; 1759 l_ptr->stats.sent_acks++;
1760 link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 1760 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
1761 } 1761 }
1762 1762
1763protocol_check: 1763protocol_check:
@@ -1770,8 +1770,8 @@ protocol_check:
1770 if (likely(msg_is_dest(msg, tipc_own_addr))) { 1770 if (likely(msg_is_dest(msg, tipc_own_addr))) {
1771deliver: 1771deliver:
1772 if (likely(msg_isdata(msg))) { 1772 if (likely(msg_isdata(msg))) {
1773 node_unlock(n_ptr); 1773 tipc_node_unlock(n_ptr);
1774 port_recv_msg(buf); 1774 tipc_port_recv_msg(buf);
1775 continue; 1775 continue;
1776 } 1776 }
1777 switch (msg_user(msg)) { 1777 switch (msg_user(msg)) {
@@ -1779,34 +1779,32 @@ deliver:
1779 l_ptr->stats.recv_bundles++; 1779 l_ptr->stats.recv_bundles++;
1780 l_ptr->stats.recv_bundled += 1780 l_ptr->stats.recv_bundled +=
1781 msg_msgcnt(msg); 1781 msg_msgcnt(msg);
1782 node_unlock(n_ptr); 1782 tipc_node_unlock(n_ptr);
1783 link_recv_bundle(buf); 1783 tipc_link_recv_bundle(buf);
1784 continue; 1784 continue;
1785 case ROUTE_DISTRIBUTOR: 1785 case ROUTE_DISTRIBUTOR:
1786 node_unlock(n_ptr); 1786 tipc_node_unlock(n_ptr);
1787 cluster_recv_routing_table(buf); 1787 tipc_cltr_recv_routing_table(buf);
1788 continue; 1788 continue;
1789 case NAME_DISTRIBUTOR: 1789 case NAME_DISTRIBUTOR:
1790 node_unlock(n_ptr); 1790 tipc_node_unlock(n_ptr);
1791 named_recv(buf); 1791 tipc_named_recv(buf);
1792 continue; 1792 continue;
1793 case CONN_MANAGER: 1793 case CONN_MANAGER:
1794 node_unlock(n_ptr); 1794 tipc_node_unlock(n_ptr);
1795 port_recv_proto_msg(buf); 1795 tipc_port_recv_proto_msg(buf);
1796 continue; 1796 continue;
1797 case MSG_FRAGMENTER: 1797 case MSG_FRAGMENTER:
1798 l_ptr->stats.recv_fragments++; 1798 l_ptr->stats.recv_fragments++;
1799 if (link_recv_fragment( 1799 if (tipc_link_recv_fragment(&l_ptr->defragm_buf,
1800 &l_ptr->defragm_buf, 1800 &buf, &msg)) {
1801 &buf, &msg)) {
1802 l_ptr->stats.recv_fragmented++; 1801 l_ptr->stats.recv_fragmented++;
1803 goto deliver; 1802 goto deliver;
1804 } 1803 }
1805 break; 1804 break;
1806 case CHANGEOVER_PROTOCOL: 1805 case CHANGEOVER_PROTOCOL:
1807 type = msg_type(msg); 1806 type = msg_type(msg);
1808 if (link_recv_changeover_msg( 1807 if (link_recv_changeover_msg(&l_ptr, &buf)) {
1809 &l_ptr, &buf)) {
1810 msg = buf_msg(buf); 1808 msg = buf_msg(buf);
1811 seq_no = msg_seqno(msg); 1809 seq_no = msg_seqno(msg);
1812 TIPC_SKB_CB(buf)->handle 1810 TIPC_SKB_CB(buf)->handle
@@ -1818,20 +1816,20 @@ deliver:
1818 break; 1816 break;
1819 } 1817 }
1820 } 1818 }
1821 node_unlock(n_ptr); 1819 tipc_node_unlock(n_ptr);
1822 net_route_msg(buf); 1820 tipc_net_route_msg(buf);
1823 continue; 1821 continue;
1824 } 1822 }
1825 link_handle_out_of_seq_msg(l_ptr, buf); 1823 link_handle_out_of_seq_msg(l_ptr, buf);
1826 head = link_insert_deferred_queue(l_ptr, head); 1824 head = link_insert_deferred_queue(l_ptr, head);
1827 node_unlock(n_ptr); 1825 tipc_node_unlock(n_ptr);
1828 continue; 1826 continue;
1829 } 1827 }
1830 1828
1831 if (msg_user(msg) == LINK_PROTOCOL) { 1829 if (msg_user(msg) == LINK_PROTOCOL) {
1832 link_recv_proto_msg(l_ptr, buf); 1830 link_recv_proto_msg(l_ptr, buf);
1833 head = link_insert_deferred_queue(l_ptr, head); 1831 head = link_insert_deferred_queue(l_ptr, head);
1834 node_unlock(n_ptr); 1832 tipc_node_unlock(n_ptr);
1835 continue; 1833 continue;
1836 } 1834 }
1837 msg_dbg(msg,"NSEQ<REC<"); 1835 msg_dbg(msg,"NSEQ<REC<");
@@ -1842,14 +1840,14 @@ deliver:
1842 msg_dbg(msg,"RECV-REINS:"); 1840 msg_dbg(msg,"RECV-REINS:");
1843 buf->next = head; 1841 buf->next = head;
1844 head = buf; 1842 head = buf;
1845 node_unlock(n_ptr); 1843 tipc_node_unlock(n_ptr);
1846 continue; 1844 continue;
1847 } 1845 }
1848 node_unlock(n_ptr); 1846 tipc_node_unlock(n_ptr);
1849cont: 1847cont:
1850 buf_discard(buf); 1848 buf_discard(buf);
1851 } 1849 }
1852 read_unlock_bh(&net_lock); 1850 read_unlock_bh(&tipc_net_lock);
1853} 1851}
1854 1852
1855/* 1853/*
@@ -1858,9 +1856,9 @@ cont:
1858 * Returns the increase of the queue length,i.e. 0 or 1 1856 * Returns the increase of the queue length,i.e. 0 or 1
1859 */ 1857 */
1860 1858
1861u32 link_defer_pkt(struct sk_buff **head, 1859u32 tipc_link_defer_pkt(struct sk_buff **head,
1862 struct sk_buff **tail, 1860 struct sk_buff **tail,
1863 struct sk_buff *buf) 1861 struct sk_buff *buf)
1864{ 1862{
1865 struct sk_buff *prev = 0; 1863 struct sk_buff *prev = 0;
1866 struct sk_buff *crs = *head; 1864 struct sk_buff *crs = *head;
@@ -1939,12 +1937,12 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
1939 return; 1937 return;
1940 } 1938 }
1941 1939
1942 if (link_defer_pkt(&l_ptr->oldest_deferred_in, 1940 if (tipc_link_defer_pkt(&l_ptr->oldest_deferred_in,
1943 &l_ptr->newest_deferred_in, buf)) { 1941 &l_ptr->newest_deferred_in, buf)) {
1944 l_ptr->deferred_inqueue_sz++; 1942 l_ptr->deferred_inqueue_sz++;
1945 l_ptr->stats.deferred_recv++; 1943 l_ptr->stats.deferred_recv++;
1946 if ((l_ptr->deferred_inqueue_sz % 16) == 1) 1944 if ((l_ptr->deferred_inqueue_sz % 16) == 1)
1947 link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 1945 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
1948 } else 1946 } else
1949 l_ptr->stats.duplicates++; 1947 l_ptr->stats.duplicates++;
1950} 1948}
@@ -1952,8 +1950,8 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
1952/* 1950/*
1953 * Send protocol message to the other endpoint. 1951 * Send protocol message to the other endpoint.
1954 */ 1952 */
1955void 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,
1956 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu) 1954 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
1957{ 1955{
1958 struct sk_buff *buf = 0; 1956 struct sk_buff *buf = 0;
1959 struct tipc_msg *msg = l_ptr->pmsg; 1957 struct tipc_msg *msg = l_ptr->pmsg;
@@ -1964,12 +1962,12 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
1964 msg_set_type(msg, msg_typ); 1962 msg_set_type(msg, msg_typ);
1965 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); 1963 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
1966 msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in)); 1964 msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in));
1967 msg_set_last_bcast(msg, bclink_get_last_sent()); 1965 msg_set_last_bcast(msg, tipc_bclink_get_last_sent());
1968 1966
1969 if (msg_typ == STATE_MSG) { 1967 if (msg_typ == STATE_MSG) {
1970 u32 next_sent = mod(l_ptr->next_out_no); 1968 u32 next_sent = mod(l_ptr->next_out_no);
1971 1969
1972 if (!link_is_up(l_ptr)) 1970 if (!tipc_link_is_up(l_ptr))
1973 return; 1971 return;
1974 if (l_ptr->next_out) 1972 if (l_ptr->next_out)
1975 next_sent = msg_seqno(buf_msg(l_ptr->next_out)); 1973 next_sent = msg_seqno(buf_msg(l_ptr->next_out));
@@ -2013,7 +2011,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2013 msg_set_max_pkt(msg, l_ptr->max_pkt_target); 2011 msg_set_max_pkt(msg, l_ptr->max_pkt_target);
2014 } 2012 }
2015 2013
2016 if (node_has_redundant_links(l_ptr->owner)) { 2014 if (tipc_node_has_redundant_links(l_ptr->owner)) {
2017 msg_set_redundant_link(msg); 2015 msg_set_redundant_link(msg);
2018 } else { 2016 } else {
2019 msg_clear_redundant_link(msg); 2017 msg_clear_redundant_link(msg);
@@ -2026,7 +2024,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2026 2024
2027 /* Congestion? */ 2025 /* Congestion? */
2028 2026
2029 if (bearer_congested(l_ptr->b_ptr, l_ptr)) { 2027 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
2030 if (!l_ptr->proto_msg_queue) { 2028 if (!l_ptr->proto_msg_queue) {
2031 l_ptr->proto_msg_queue = 2029 l_ptr->proto_msg_queue =
2032 buf_acquire(sizeof(l_ptr->proto_msg)); 2030 buf_acquire(sizeof(l_ptr->proto_msg));
@@ -2050,14 +2048,14 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2050 memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); 2048 memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg));
2051 msg_set_size(buf_msg(buf), msg_size); 2049 msg_set_size(buf_msg(buf), msg_size);
2052 2050
2053 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 2051 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
2054 l_ptr->unacked_window = 0; 2052 l_ptr->unacked_window = 0;
2055 buf_discard(buf); 2053 buf_discard(buf);
2056 return; 2054 return;
2057 } 2055 }
2058 2056
2059 /* New congestion */ 2057 /* New congestion */
2060 bearer_schedule(l_ptr->b_ptr, l_ptr); 2058 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
2061 l_ptr->proto_msg_queue = buf; 2059 l_ptr->proto_msg_queue = buf;
2062 l_ptr->stats.bearer_congs++; 2060 l_ptr->stats.bearer_congs++;
2063} 2061}
@@ -2131,7 +2129,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2131 l_ptr->peer_bearer_id = msg_bearer_id(msg); 2129 l_ptr->peer_bearer_id = msg_bearer_id(msg);
2132 2130
2133 /* Synchronize broadcast sequence numbers */ 2131 /* Synchronize broadcast sequence numbers */
2134 if (!node_has_redundant_links(l_ptr->owner)) { 2132 if (!tipc_node_has_redundant_links(l_ptr->owner)) {
2135 l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg)); 2133 l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg));
2136 } 2134 }
2137 break; 2135 break;
@@ -2145,7 +2143,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2145 warn("Changing prio <%s>: %u->%u\n", 2143 warn("Changing prio <%s>: %u->%u\n",
2146 l_ptr->name, l_ptr->priority, msg_linkprio(msg)); 2144 l_ptr->name, l_ptr->priority, msg_linkprio(msg));
2147 l_ptr->priority = msg_linkprio(msg); 2145 l_ptr->priority = msg_linkprio(msg);
2148 link_reset(l_ptr); /* Enforce change to take effect */ 2146 tipc_link_reset(l_ptr); /* Enforce change to take effect */
2149 break; 2147 break;
2150 } 2148 }
2151 link_state_event(l_ptr, TRAFFIC_MSG_EVT); 2149 link_state_event(l_ptr, TRAFFIC_MSG_EVT);
@@ -2176,17 +2174,17 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2176 2174
2177 /* Protocol message before retransmits, reduce loss risk */ 2175 /* Protocol message before retransmits, reduce loss risk */
2178 2176
2179 bclink_check_gap(l_ptr->owner, msg_last_bcast(msg)); 2177 tipc_bclink_check_gap(l_ptr->owner, msg_last_bcast(msg));
2180 2178
2181 if (rec_gap || (msg_probe(msg))) { 2179 if (rec_gap || (msg_probe(msg))) {
2182 link_send_proto_msg(l_ptr, STATE_MSG, 2180 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2183 0, rec_gap, 0, 0, max_pkt_ack); 2181 0, rec_gap, 0, 0, max_pkt_ack);
2184 } 2182 }
2185 if (msg_seq_gap(msg)) { 2183 if (msg_seq_gap(msg)) {
2186 msg_dbg(msg, "With Gap:"); 2184 msg_dbg(msg, "With Gap:");
2187 l_ptr->stats.recv_nacks++; 2185 l_ptr->stats.recv_nacks++;
2188 link_retransmit(l_ptr, l_ptr->first_out, 2186 tipc_link_retransmit(l_ptr, l_ptr->first_out,
2189 msg_seq_gap(msg)); 2187 msg_seq_gap(msg));
2190 } 2188 }
2191 break; 2189 break;
2192 default: 2190 default:
@@ -2198,20 +2196,20 @@ exit:
2198 2196
2199 2197
2200/* 2198/*
2201 * link_tunnel(): Send one message via a link belonging to 2199 * tipc_link_tunnel(): Send one message via a link belonging to
2202 * another bearer. Owner node is locked. 2200 * another bearer. Owner node is locked.
2203 */ 2201 */
2204void link_tunnel(struct link *l_ptr, 2202void tipc_link_tunnel(struct link *l_ptr,
2205 struct tipc_msg *tunnel_hdr, 2203 struct tipc_msg *tunnel_hdr,
2206 struct tipc_msg *msg, 2204 struct tipc_msg *msg,
2207 u32 selector) 2205 u32 selector)
2208{ 2206{
2209 struct link *tunnel; 2207 struct link *tunnel;
2210 struct sk_buff *buf; 2208 struct sk_buff *buf;
2211 u32 length = msg_size(msg); 2209 u32 length = msg_size(msg);
2212 2210
2213 tunnel = l_ptr->owner->active_links[selector & 1]; 2211 tunnel = l_ptr->owner->active_links[selector & 1];
2214 if (!link_is_up(tunnel)) 2212 if (!tipc_link_is_up(tunnel))
2215 return; 2213 return;
2216 msg_set_size(tunnel_hdr, length + INT_H_SIZE); 2214 msg_set_size(tunnel_hdr, length + INT_H_SIZE);
2217 buf = buf_acquire(length + INT_H_SIZE); 2215 buf = buf_acquire(length + INT_H_SIZE);
@@ -2222,7 +2220,7 @@ void link_tunnel(struct link *l_ptr,
2222 dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); 2220 dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane);
2223 msg_dbg(buf_msg(buf), ">SEND>"); 2221 msg_dbg(buf_msg(buf), ">SEND>");
2224 assert(tunnel); 2222 assert(tunnel);
2225 link_send_buf(tunnel, buf); 2223 tipc_link_send_buf(tunnel, buf);
2226} 2224}
2227 2225
2228 2226
@@ -2232,12 +2230,12 @@ void link_tunnel(struct link *l_ptr,
2232 * Owner node is locked. 2230 * Owner node is locked.
2233 */ 2231 */
2234 2232
2235void link_changeover(struct link *l_ptr) 2233void tipc_link_changeover(struct link *l_ptr)
2236{ 2234{
2237 u32 msgcount = l_ptr->out_queue_size; 2235 u32 msgcount = l_ptr->out_queue_size;
2238 struct sk_buff *crs = l_ptr->first_out; 2236 struct sk_buff *crs = l_ptr->first_out;
2239 struct link *tunnel = l_ptr->owner->active_links[0]; 2237 struct link *tunnel = l_ptr->owner->active_links[0];
2240 int split_bundles = node_has_redundant_links(l_ptr->owner); 2238 int split_bundles = tipc_node_has_redundant_links(l_ptr->owner);
2241 struct tipc_msg tunnel_hdr; 2239 struct tipc_msg tunnel_hdr;
2242 2240
2243 if (!tunnel) 2241 if (!tunnel)
@@ -2261,7 +2259,7 @@ void link_changeover(struct link *l_ptr)
2261 dbg("%c->%c:", l_ptr->b_ptr->net_plane, 2259 dbg("%c->%c:", l_ptr->b_ptr->net_plane,
2262 tunnel->b_ptr->net_plane); 2260 tunnel->b_ptr->net_plane);
2263 msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); 2261 msg_dbg(&tunnel_hdr, "EMPTY>SEND>");
2264 link_send_buf(tunnel, buf); 2262 tipc_link_send_buf(tunnel, buf);
2265 } else { 2263 } else {
2266 warn("Memory squeeze; link changeover failed\n"); 2264 warn("Memory squeeze; link changeover failed\n");
2267 } 2265 }
@@ -2277,20 +2275,20 @@ void link_changeover(struct link *l_ptr)
2277 2275
2278 while (msgcount--) { 2276 while (msgcount--) {
2279 msg_set_seqno(m,msg_seqno(msg)); 2277 msg_set_seqno(m,msg_seqno(msg));
2280 link_tunnel(l_ptr, &tunnel_hdr, m, 2278 tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
2281 msg_link_selector(m)); 2279 msg_link_selector(m));
2282 pos += align(msg_size(m)); 2280 pos += align(msg_size(m));
2283 m = (struct tipc_msg *)pos; 2281 m = (struct tipc_msg *)pos;
2284 } 2282 }
2285 } else { 2283 } else {
2286 link_tunnel(l_ptr, &tunnel_hdr, msg, 2284 tipc_link_tunnel(l_ptr, &tunnel_hdr, msg,
2287 msg_link_selector(msg)); 2285 msg_link_selector(msg));
2288 } 2286 }
2289 crs = crs->next; 2287 crs = crs->next;
2290 } 2288 }
2291} 2289}
2292 2290
2293void link_send_duplicate(struct link *l_ptr, struct link *tunnel) 2291void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2294{ 2292{
2295 struct sk_buff *iter; 2293 struct sk_buff *iter;
2296 struct tipc_msg tunnel_hdr; 2294 struct tipc_msg tunnel_hdr;
@@ -2320,8 +2318,8 @@ void link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2320 dbg("%c->%c:", l_ptr->b_ptr->net_plane, 2318 dbg("%c->%c:", l_ptr->b_ptr->net_plane,
2321 tunnel->b_ptr->net_plane); 2319 tunnel->b_ptr->net_plane);
2322 msg_dbg(buf_msg(outbuf), ">SEND>"); 2320 msg_dbg(buf_msg(outbuf), ">SEND>");
2323 link_send_buf(tunnel, outbuf); 2321 tipc_link_send_buf(tunnel, outbuf);
2324 if (!link_is_up(l_ptr)) 2322 if (!tipc_link_is_up(l_ptr))
2325 return; 2323 return;
2326 iter = iter->next; 2324 iter = iter->next;
2327 } 2325 }
@@ -2393,9 +2391,9 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2393 2391
2394 /* First original message ?: */ 2392 /* First original message ?: */
2395 2393
2396 if (link_is_up(dest_link)) { 2394 if (tipc_link_is_up(dest_link)) {
2397 msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); 2395 msg_dbg(tunnel_msg, "UP/FIRST/<REC<");
2398 link_reset(dest_link); 2396 tipc_link_reset(dest_link);
2399 dest_link->exp_msg_count = msg_count; 2397 dest_link->exp_msg_count = msg_count;
2400 if (!msg_count) 2398 if (!msg_count)
2401 goto exit; 2399 goto exit;
@@ -2436,7 +2434,7 @@ exit:
2436/* 2434/*
2437 * Bundler functionality: 2435 * Bundler functionality:
2438 */ 2436 */
2439void link_recv_bundle(struct sk_buff *buf) 2437void tipc_link_recv_bundle(struct sk_buff *buf)
2440{ 2438{
2441 u32 msgcount = msg_msgcnt(buf_msg(buf)); 2439 u32 msgcount = msg_msgcnt(buf_msg(buf));
2442 u32 pos = INT_H_SIZE; 2440 u32 pos = INT_H_SIZE;
@@ -2456,7 +2454,7 @@ void link_recv_bundle(struct sk_buff *buf)
2456 }; 2454 };
2457 pos += align(msg_size(buf_msg(obuf))); 2455 pos += align(msg_size(buf_msg(obuf)));
2458 msg_dbg(buf_msg(obuf), " /"); 2456 msg_dbg(buf_msg(obuf), " /");
2459 net_route_msg(obuf); 2457 tipc_net_route_msg(obuf);
2460 } 2458 }
2461 buf_discard(buf); 2459 buf_discard(buf);
2462} 2460}
@@ -2467,11 +2465,11 @@ void link_recv_bundle(struct sk_buff *buf)
2467 2465
2468 2466
2469/* 2467/*
2470 * link_send_long_buf: Entry for buffers needing fragmentation. 2468 * tipc_link_send_long_buf: Entry for buffers needing fragmentation.
2471 * The buffer is complete, inclusive total message length. 2469 * The buffer is complete, inclusive total message length.
2472 * Returns user data length. 2470 * Returns user data length.
2473 */ 2471 */
2474int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) 2472int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2475{ 2473{
2476 struct tipc_msg *inmsg = buf_msg(buf); 2474 struct tipc_msg *inmsg = buf_msg(buf);
2477 struct tipc_msg fragm_hdr; 2475 struct tipc_msg fragm_hdr;
@@ -2521,8 +2519,8 @@ int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2521 /* Send queued messages first, if any: */ 2519 /* Send queued messages first, if any: */
2522 2520
2523 l_ptr->stats.sent_fragments++; 2521 l_ptr->stats.sent_fragments++;
2524 link_send_buf(l_ptr, fragm); 2522 tipc_link_send_buf(l_ptr, fragm);
2525 if (!link_is_up(l_ptr)) 2523 if (!tipc_link_is_up(l_ptr))
2526 return dsz; 2524 return dsz;
2527 msg_set_fragm_no(&fragm_hdr, ++fragm_no); 2525 msg_set_fragm_no(&fragm_hdr, ++fragm_no);
2528 rest -= fragm_sz; 2526 rest -= fragm_sz;
@@ -2582,11 +2580,11 @@ static inline void incr_timer_cnt(struct sk_buff *buf)
2582} 2580}
2583 2581
2584/* 2582/*
2585 * link_recv_fragment(): Called with node lock on. Returns 2583 * tipc_link_recv_fragment(): Called with node lock on. Returns
2586 * the reassembled buffer if message is complete. 2584 * the reassembled buffer if message is complete.
2587 */ 2585 */
2588int link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, 2586int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2589 struct tipc_msg **m) 2587 struct tipc_msg **m)
2590{ 2588{
2591 struct sk_buff *prev = 0; 2589 struct sk_buff *prev = 0;
2592 struct sk_buff *fbuf = *fb; 2590 struct sk_buff *fbuf = *fb;
@@ -2714,7 +2712,7 @@ static void link_set_supervision_props(struct link *l_ptr, u32 tolerance)
2714} 2712}
2715 2713
2716 2714
2717void link_set_queue_limits(struct link *l_ptr, u32 window) 2715void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
2718{ 2716{
2719 /* Data messages from this node, inclusive FIRST_FRAGM */ 2717 /* Data messages from this node, inclusive FIRST_FRAGM */
2720 l_ptr->queue_limit[DATA_LOW] = window; 2718 l_ptr->queue_limit[DATA_LOW] = window;
@@ -2739,7 +2737,7 @@ void link_set_queue_limits(struct link *l_ptr, u32 window)
2739 * @name - ptr to link name string 2737 * @name - ptr to link name string
2740 * @node - ptr to area to be filled with ptr to associated node 2738 * @node - ptr to area to be filled with ptr to associated node
2741 * 2739 *
2742 * Caller must hold 'net_lock' to ensure node and bearer are not deleted; 2740 * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted;
2743 * this also prevents link deletion. 2741 * this also prevents link deletion.
2744 * 2742 *
2745 * Returns pointer to link (or 0 if invalid link name). 2743 * Returns pointer to link (or 0 if invalid link name).
@@ -2754,11 +2752,11 @@ static struct link *link_find_link(const char *name, struct node **node)
2754 if (!link_name_validate(name, &link_name_parts)) 2752 if (!link_name_validate(name, &link_name_parts))
2755 return 0; 2753 return 0;
2756 2754
2757 b_ptr = bearer_find_interface(link_name_parts.if_local); 2755 b_ptr = tipc_bearer_find_interface(link_name_parts.if_local);
2758 if (!b_ptr) 2756 if (!b_ptr)
2759 return 0; 2757 return 0;
2760 2758
2761 *node = node_find(link_name_parts.addr_peer); 2759 *node = tipc_node_find(link_name_parts.addr_peer);
2762 if (!*node) 2760 if (!*node)
2763 return 0; 2761 return 0;
2764 2762
@@ -2769,8 +2767,8 @@ static struct link *link_find_link(const char *name, struct node **node)
2769 return l_ptr; 2767 return l_ptr;
2770} 2768}
2771 2769
2772struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, 2770struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space,
2773 u16 cmd) 2771 u16 cmd)
2774{ 2772{
2775 struct tipc_link_config *args; 2773 struct tipc_link_config *args;
2776 u32 new_value; 2774 u32 new_value;
@@ -2779,61 +2777,62 @@ struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space,
2779 int res; 2777 int res;
2780 2778
2781 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) 2779 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG))
2782 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2780 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
2783 2781
2784 args = (struct tipc_link_config *)TLV_DATA(req_tlv_area); 2782 args = (struct tipc_link_config *)TLV_DATA(req_tlv_area);
2785 new_value = ntohl(args->value); 2783 new_value = ntohl(args->value);
2786 2784
2787 if (!strcmp(args->name, bc_link_name)) { 2785 if (!strcmp(args->name, tipc_bclink_name)) {
2788 if ((cmd == TIPC_CMD_SET_LINK_WINDOW) && 2786 if ((cmd == TIPC_CMD_SET_LINK_WINDOW) &&
2789 (bclink_set_queue_limits(new_value) == 0)) 2787 (tipc_bclink_set_queue_limits(new_value) == 0))
2790 return cfg_reply_none(); 2788 return tipc_cfg_reply_none();
2791 return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 2789 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
2792 " (cannot change setting on broadcast link)"); 2790 " (cannot change setting on broadcast link)");
2793 } 2791 }
2794 2792
2795 read_lock_bh(&net_lock); 2793 read_lock_bh(&tipc_net_lock);
2796 l_ptr = link_find_link(args->name, &node); 2794 l_ptr = link_find_link(args->name, &node);
2797 if (!l_ptr) { 2795 if (!l_ptr) {
2798 read_unlock_bh(&net_lock); 2796 read_unlock_bh(&tipc_net_lock);
2799 return cfg_reply_error_string("link not found"); 2797 return tipc_cfg_reply_error_string("link not found");
2800 } 2798 }
2801 2799
2802 node_lock(node); 2800 tipc_node_lock(node);
2803 res = -EINVAL; 2801 res = -EINVAL;
2804 switch (cmd) { 2802 switch (cmd) {
2805 case TIPC_CMD_SET_LINK_TOL: 2803 case TIPC_CMD_SET_LINK_TOL:
2806 if ((new_value >= TIPC_MIN_LINK_TOL) && 2804 if ((new_value >= TIPC_MIN_LINK_TOL) &&
2807 (new_value <= TIPC_MAX_LINK_TOL)) { 2805 (new_value <= TIPC_MAX_LINK_TOL)) {
2808 link_set_supervision_props(l_ptr, new_value); 2806 link_set_supervision_props(l_ptr, new_value);
2809 link_send_proto_msg(l_ptr, STATE_MSG, 2807 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2810 0, 0, new_value, 0, 0); 2808 0, 0, new_value, 0, 0);
2811 res = TIPC_OK; 2809 res = TIPC_OK;
2812 } 2810 }
2813 break; 2811 break;
2814 case TIPC_CMD_SET_LINK_PRI: 2812 case TIPC_CMD_SET_LINK_PRI:
2815 if (new_value < TIPC_NUM_LINK_PRI) { 2813 if ((new_value >= TIPC_MIN_LINK_PRI) &&
2814 (new_value <= TIPC_MAX_LINK_PRI)) {
2816 l_ptr->priority = new_value; 2815 l_ptr->priority = new_value;
2817 link_send_proto_msg(l_ptr, STATE_MSG, 2816 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2818 0, 0, 0, new_value, 0); 2817 0, 0, 0, new_value, 0);
2819 res = TIPC_OK; 2818 res = TIPC_OK;
2820 } 2819 }
2821 break; 2820 break;
2822 case TIPC_CMD_SET_LINK_WINDOW: 2821 case TIPC_CMD_SET_LINK_WINDOW:
2823 if ((new_value >= TIPC_MIN_LINK_WIN) && 2822 if ((new_value >= TIPC_MIN_LINK_WIN) &&
2824 (new_value <= TIPC_MAX_LINK_WIN)) { 2823 (new_value <= TIPC_MAX_LINK_WIN)) {
2825 link_set_queue_limits(l_ptr, new_value); 2824 tipc_link_set_queue_limits(l_ptr, new_value);
2826 res = TIPC_OK; 2825 res = TIPC_OK;
2827 } 2826 }
2828 break; 2827 break;
2829 } 2828 }
2830 node_unlock(node); 2829 tipc_node_unlock(node);
2831 2830
2832 read_unlock_bh(&net_lock); 2831 read_unlock_bh(&tipc_net_lock);
2833 if (res) 2832 if (res)
2834 return cfg_reply_error_string("cannot change link setting"); 2833 return tipc_cfg_reply_error_string("cannot change link setting");
2835 2834
2836 return cfg_reply_none(); 2835 return tipc_cfg_reply_none();
2837} 2836}
2838 2837
2839/** 2838/**
@@ -2848,34 +2847,34 @@ static void link_reset_statistics(struct link *l_ptr)
2848 l_ptr->stats.recv_info = l_ptr->next_in_no; 2847 l_ptr->stats.recv_info = l_ptr->next_in_no;
2849} 2848}
2850 2849
2851struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) 2850struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space)
2852{ 2851{
2853 char *link_name; 2852 char *link_name;
2854 struct link *l_ptr; 2853 struct link *l_ptr;
2855 struct node *node; 2854 struct node *node;
2856 2855
2857 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) 2856 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
2858 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2857 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
2859 2858
2860 link_name = (char *)TLV_DATA(req_tlv_area); 2859 link_name = (char *)TLV_DATA(req_tlv_area);
2861 if (!strcmp(link_name, bc_link_name)) { 2860 if (!strcmp(link_name, tipc_bclink_name)) {
2862 if (bclink_reset_stats()) 2861 if (tipc_bclink_reset_stats())
2863 return cfg_reply_error_string("link not found"); 2862 return tipc_cfg_reply_error_string("link not found");
2864 return cfg_reply_none(); 2863 return tipc_cfg_reply_none();
2865 } 2864 }
2866 2865
2867 read_lock_bh(&net_lock); 2866 read_lock_bh(&tipc_net_lock);
2868 l_ptr = link_find_link(link_name, &node); 2867 l_ptr = link_find_link(link_name, &node);
2869 if (!l_ptr) { 2868 if (!l_ptr) {
2870 read_unlock_bh(&net_lock); 2869 read_unlock_bh(&tipc_net_lock);
2871 return cfg_reply_error_string("link not found"); 2870 return tipc_cfg_reply_error_string("link not found");
2872 } 2871 }
2873 2872
2874 node_lock(node); 2873 tipc_node_lock(node);
2875 link_reset_statistics(l_ptr); 2874 link_reset_statistics(l_ptr);
2876 node_unlock(node); 2875 tipc_node_unlock(node);
2877 read_unlock_bh(&net_lock); 2876 read_unlock_bh(&tipc_net_lock);
2878 return cfg_reply_none(); 2877 return tipc_cfg_reply_none();
2879} 2878}
2880 2879
2881/** 2880/**
@@ -2888,7 +2887,7 @@ static u32 percent(u32 count, u32 total)
2888} 2887}
2889 2888
2890/** 2889/**
2891 * link_stats - print link statistics 2890 * tipc_link_stats - print link statistics
2892 * @name: link name 2891 * @name: link name
2893 * @buf: print buffer area 2892 * @buf: print buffer area
2894 * @buf_size: size of print buffer area 2893 * @buf_size: size of print buffer area
@@ -2896,7 +2895,7 @@ static u32 percent(u32 count, u32 total)
2896 * Returns length of print buffer data string (or 0 if error) 2895 * Returns length of print buffer data string (or 0 if error)
2897 */ 2896 */
2898 2897
2899static int link_stats(const char *name, char *buf, const u32 buf_size) 2898static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
2900{ 2899{
2901 struct print_buf pb; 2900 struct print_buf pb;
2902 struct link *l_ptr; 2901 struct link *l_ptr;
@@ -2904,22 +2903,22 @@ static int link_stats(const char *name, char *buf, const u32 buf_size)
2904 char *status; 2903 char *status;
2905 u32 profile_total = 0; 2904 u32 profile_total = 0;
2906 2905
2907 if (!strcmp(name, bc_link_name)) 2906 if (!strcmp(name, tipc_bclink_name))
2908 return bclink_stats(buf, buf_size); 2907 return tipc_bclink_stats(buf, buf_size);
2909 2908
2910 printbuf_init(&pb, buf, buf_size); 2909 tipc_printbuf_init(&pb, buf, buf_size);
2911 2910
2912 read_lock_bh(&net_lock); 2911 read_lock_bh(&tipc_net_lock);
2913 l_ptr = link_find_link(name, &node); 2912 l_ptr = link_find_link(name, &node);
2914 if (!l_ptr) { 2913 if (!l_ptr) {
2915 read_unlock_bh(&net_lock); 2914 read_unlock_bh(&tipc_net_lock);
2916 return 0; 2915 return 0;
2917 } 2916 }
2918 node_lock(node); 2917 tipc_node_lock(node);
2919 2918
2920 if (link_is_active(l_ptr)) 2919 if (tipc_link_is_active(l_ptr))
2921 status = "ACTIVE"; 2920 status = "ACTIVE";
2922 else if (link_is_up(l_ptr)) 2921 else if (tipc_link_is_up(l_ptr))
2923 status = "STANDBY"; 2922 status = "STANDBY";
2924 else 2923 else
2925 status = "DEFUNCT"; 2924 status = "DEFUNCT";
@@ -2975,33 +2974,33 @@ static int link_stats(const char *name, char *buf, const u32 buf_size)
2975 ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts) 2974 ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts)
2976 : 0); 2975 : 0);
2977 2976
2978 node_unlock(node); 2977 tipc_node_unlock(node);
2979 read_unlock_bh(&net_lock); 2978 read_unlock_bh(&tipc_net_lock);
2980 return printbuf_validate(&pb); 2979 return tipc_printbuf_validate(&pb);
2981} 2980}
2982 2981
2983#define MAX_LINK_STATS_INFO 2000 2982#define MAX_LINK_STATS_INFO 2000
2984 2983
2985struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space) 2984struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space)
2986{ 2985{
2987 struct sk_buff *buf; 2986 struct sk_buff *buf;
2988 struct tlv_desc *rep_tlv; 2987 struct tlv_desc *rep_tlv;
2989 int str_len; 2988 int str_len;
2990 2989
2991 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) 2990 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
2992 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2991 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
2993 2992
2994 buf = cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO)); 2993 buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO));
2995 if (!buf) 2994 if (!buf)
2996 return NULL; 2995 return NULL;
2997 2996
2998 rep_tlv = (struct tlv_desc *)buf->data; 2997 rep_tlv = (struct tlv_desc *)buf->data;
2999 2998
3000 str_len = link_stats((char *)TLV_DATA(req_tlv_area), 2999 str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area),
3001 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); 3000 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
3002 if (!str_len) { 3001 if (!str_len) {
3003 buf_discard(buf); 3002 buf_discard(buf);
3004 return cfg_reply_error_string("link not found"); 3003 return tipc_cfg_reply_error_string("link not found");
3005 } 3004 }
3006 3005
3007 skb_put(buf, TLV_SPACE(str_len)); 3006 skb_put(buf, TLV_SPACE(str_len));
@@ -3020,20 +3019,20 @@ int link_control(const char *name, u32 op, u32 val)
3020 u32 a; 3019 u32 a;
3021 3020
3022 a = link_name2addr(name, &bearer_id); 3021 a = link_name2addr(name, &bearer_id);
3023 read_lock_bh(&net_lock); 3022 read_lock_bh(&tipc_net_lock);
3024 node = node_find(a); 3023 node = tipc_node_find(a);
3025 if (node) { 3024 if (node) {
3026 node_lock(node); 3025 tipc_node_lock(node);
3027 l_ptr = node->links[bearer_id]; 3026 l_ptr = node->links[bearer_id];
3028 if (l_ptr) { 3027 if (l_ptr) {
3029 if (op == TIPC_REMOVE_LINK) { 3028 if (op == TIPC_REMOVE_LINK) {
3030 struct bearer *b_ptr = l_ptr->b_ptr; 3029 struct bearer *b_ptr = l_ptr->b_ptr;
3031 spin_lock_bh(&b_ptr->publ.lock); 3030 spin_lock_bh(&b_ptr->publ.lock);
3032 link_delete(l_ptr); 3031 tipc_link_delete(l_ptr);
3033 spin_unlock_bh(&b_ptr->publ.lock); 3032 spin_unlock_bh(&b_ptr->publ.lock);
3034 } 3033 }
3035 if (op == TIPC_CMD_BLOCK_LINK) { 3034 if (op == TIPC_CMD_BLOCK_LINK) {
3036 link_reset(l_ptr); 3035 tipc_link_reset(l_ptr);
3037 l_ptr->blocked = 1; 3036 l_ptr->blocked = 1;
3038 } 3037 }
3039 if (op == TIPC_CMD_UNBLOCK_LINK) { 3038 if (op == TIPC_CMD_UNBLOCK_LINK) {
@@ -3041,22 +3040,22 @@ int link_control(const char *name, u32 op, u32 val)
3041 } 3040 }
3042 res = TIPC_OK; 3041 res = TIPC_OK;
3043 } 3042 }
3044 node_unlock(node); 3043 tipc_node_unlock(node);
3045 } 3044 }
3046 read_unlock_bh(&net_lock); 3045 read_unlock_bh(&tipc_net_lock);
3047 return res; 3046 return res;
3048} 3047}
3049#endif 3048#endif
3050 3049
3051/** 3050/**
3052 * link_get_max_pkt - get maximum packet size to use when sending to destination 3051 * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination
3053 * @dest: network address of destination node 3052 * @dest: network address of destination node
3054 * @selector: used to select from set of active links 3053 * @selector: used to select from set of active links
3055 * 3054 *
3056 * If no active link can be found, uses default maximum packet size. 3055 * If no active link can be found, uses default maximum packet size.
3057 */ 3056 */
3058 3057
3059u32 link_get_max_pkt(u32 dest, u32 selector) 3058u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
3060{ 3059{
3061 struct node *n_ptr; 3060 struct node *n_ptr;
3062 struct link *l_ptr; 3061 struct link *l_ptr;
@@ -3065,16 +3064,16 @@ u32 link_get_max_pkt(u32 dest, u32 selector)
3065 if (dest == tipc_own_addr) 3064 if (dest == tipc_own_addr)
3066 return MAX_MSG_SIZE; 3065 return MAX_MSG_SIZE;
3067 3066
3068 read_lock_bh(&net_lock); 3067 read_lock_bh(&tipc_net_lock);
3069 n_ptr = node_select(dest, selector); 3068 n_ptr = tipc_node_select(dest, selector);
3070 if (n_ptr) { 3069 if (n_ptr) {
3071 node_lock(n_ptr); 3070 tipc_node_lock(n_ptr);
3072 l_ptr = n_ptr->active_links[selector & 1]; 3071 l_ptr = n_ptr->active_links[selector & 1];
3073 if (l_ptr) 3072 if (l_ptr)
3074 res = link_max_pkt(l_ptr); 3073 res = link_max_pkt(l_ptr);
3075 node_unlock(n_ptr); 3074 tipc_node_unlock(n_ptr);
3076 } 3075 }
3077 read_unlock_bh(&net_lock); 3076 read_unlock_bh(&tipc_net_lock);
3078 return res; 3077 return res;
3079} 3078}
3080 3079