* net/tipc/link.c: TIPC link code
*
* Copyright (c) 1996-2006, Ericsson AB
- * Copyright (c) 2004-2005, Wind River Systems
+ * Copyright (c) 2004-2006, Wind River Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#define LINK_LOG_BUF_SIZE 0
#define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0)
-#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) msg_print(&l_ptr->print_buf, msg, txt); } while(0)
+#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) tipc_msg_print(&l_ptr->print_buf, msg, txt); } while(0)
#define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0)
#define dbg_link_dump() do { \
if (LINK_LOG_BUF_SIZE) { \
tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \
- printbuf_move(LOG, &l_ptr->print_buf); \
+ tipc_printbuf_move(LOG, &l_ptr->print_buf); \
} \
} while (0)
-static inline void dbg_print_link(struct link *l_ptr, const char *str)
+static void dbg_print_link(struct link *l_ptr, const char *str)
{
if (DBG_OUTPUT)
link_print(l_ptr, DBG_OUTPUT, str);
}
-static inline void dbg_print_buf_chain(struct sk_buff *root_buf)
+static void dbg_print_buf_chain(struct sk_buff *root_buf)
{
if (DBG_OUTPUT) {
struct sk_buff *buf = root_buf;
}
/*
- * Simple inlined link routines
+ * Simple link routines
*/
-static inline unsigned int align(unsigned int i)
+static unsigned int align(unsigned int i)
{
return (i + 3) & ~3u;
}
-static inline int link_working_working(struct link *l_ptr)
+static int link_working_working(struct link *l_ptr)
{
return (l_ptr->state == WORKING_WORKING);
}
-static inline int link_working_unknown(struct link *l_ptr)
+static int link_working_unknown(struct link *l_ptr)
{
return (l_ptr->state == WORKING_UNKNOWN);
}
-static inline int link_reset_unknown(struct link *l_ptr)
+static int link_reset_unknown(struct link *l_ptr)
{
return (l_ptr->state == RESET_UNKNOWN);
}
-static inline int link_reset_reset(struct link *l_ptr)
+static int link_reset_reset(struct link *l_ptr)
{
return (l_ptr->state == RESET_RESET);
}
-static inline int link_blocked(struct link *l_ptr)
+static int link_blocked(struct link *l_ptr)
{
return (l_ptr->exp_msg_count || l_ptr->blocked);
}
-static inline int link_congested(struct link *l_ptr)
+static int link_congested(struct link *l_ptr)
{
return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]);
}
-static inline u32 link_max_pkt(struct link *l_ptr)
+static u32 link_max_pkt(struct link *l_ptr)
{
return l_ptr->max_pkt;
}
-static inline void link_init_max_pkt(struct link *l_ptr)
+static void link_init_max_pkt(struct link *l_ptr)
{
u32 max_pkt;
l_ptr->max_pkt_probes = 0;
}
-static inline u32 link_next_sent(struct link *l_ptr)
+static u32 link_next_sent(struct link *l_ptr)
{
if (l_ptr->next_out)
return msg_seqno(buf_msg(l_ptr->next_out));
return mod(l_ptr->next_out_no);
}
-static inline u32 link_last_sent(struct link *l_ptr)
+static u32 link_last_sent(struct link *l_ptr)
{
return mod(link_next_sent(l_ptr) - 1);
}
/*
- * Simple non-inlined link routines (i.e. referenced outside this file)
+ * Simple non-static link routines (i.e. referenced outside this file)
*/
-int link_is_up(struct link *l_ptr)
+int tipc_link_is_up(struct link *l_ptr)
{
if (!l_ptr)
return 0;
return (link_working_working(l_ptr) || link_working_unknown(l_ptr));
}
-int link_is_active(struct link *l_ptr)
+int tipc_link_is_active(struct link *l_ptr)
{
return ((l_ptr->owner->active_links[0] == l_ptr) ||
(l_ptr->owner->active_links[1] == l_ptr));
* link_timeout - handle expiration of link timer
* @l_ptr: pointer to link
*
- * This routine must not grab "net_lock" to avoid a potential deadlock conflict
- * with link_delete(). (There is no risk that the node will be deleted by
- * another thread because link_delete() always cancels the link timer before
- * node_delete() is called.)
+ * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict
+ * with tipc_link_delete(). (There is no risk that the node will be deleted by
+ * another thread because tipc_link_delete() always cancels the link timer before
+ * tipc_node_delete() is called.)
*/
static void link_timeout(struct link *l_ptr)
{
- node_lock(l_ptr->owner);
+ tipc_node_lock(l_ptr->owner);
/* update counters used in statistical profiling of send traffic */
link_state_event(l_ptr, TIMEOUT_EVT);
if (l_ptr->next_out)
- link_push_queue(l_ptr);
+ tipc_link_push_queue(l_ptr);
- node_unlock(l_ptr->owner);
+ tipc_node_unlock(l_ptr->owner);
}
-static inline void link_set_timer(struct link *l_ptr, u32 time)
+static void link_set_timer(struct link *l_ptr, u32 time)
{
k_start_timer(&l_ptr->timer, time);
}
/**
- * link_create - create a new link
+ * tipc_link_create - create a new link
* @b_ptr: pointer to associated bearer
* @peer: network address of node at other end of link
* @media_addr: media address to use when sending messages over link
* Returns pointer to link.
*/
-struct link *link_create(struct bearer *b_ptr, const u32 peer,
- const struct tipc_media_addr *media_addr)
+struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
+ const struct tipc_media_addr *media_addr)
{
struct link *l_ptr;
struct tipc_msg *msg;
l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC);
if (!l_ptr) {
- warn("Memory squeeze; Failed to create link\n");
+ warn("Link creation failed, no memory\n");
return NULL;
}
memset(l_ptr, 0, sizeof(*l_ptr));
strcpy((char *)msg_data(msg), if_name);
l_ptr->priority = b_ptr->priority;
- link_set_queue_limits(l_ptr, b_ptr->media->window);
+ tipc_link_set_queue_limits(l_ptr, b_ptr->media->window);
link_init_max_pkt(l_ptr);
link_reset_statistics(l_ptr);
- l_ptr->owner = node_attach_link(l_ptr);
+ l_ptr->owner = tipc_node_attach_link(l_ptr);
if (!l_ptr->owner) {
kfree(l_ptr);
return NULL;
if (!pb) {
kfree(l_ptr);
- warn("Memory squeeze; Failed to create link\n");
+ warn("Link creation failed, no memory for print buffer\n");
return NULL;
}
- printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
+ tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
}
- k_signal((Handler)link_start, (unsigned long)l_ptr);
+ tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
- dbg("link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
+ dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
return l_ptr;
}
/**
- * link_delete - delete a link
+ * tipc_link_delete - delete a link
* @l_ptr: pointer to link
*
- * Note: 'net_lock' is write_locked, bearer is locked.
+ * Note: 'tipc_net_lock' is write_locked, bearer is locked.
* This routine must not grab the node lock until after link timer cancellation
* to avoid a potential deadlock situation.
*/
-void link_delete(struct link *l_ptr)
+void tipc_link_delete(struct link *l_ptr)
{
if (!l_ptr) {
err("Attempt to delete non-existent link\n");
return;
}
- dbg("link_delete()\n");
+ dbg("tipc_link_delete()\n");
k_cancel_timer(&l_ptr->timer);
- node_lock(l_ptr->owner);
- link_reset(l_ptr);
- node_detach_link(l_ptr->owner, l_ptr);
- link_stop(l_ptr);
+ tipc_node_lock(l_ptr->owner);
+ tipc_link_reset(l_ptr);
+ tipc_node_detach_link(l_ptr->owner, l_ptr);
+ tipc_link_stop(l_ptr);
list_del_init(&l_ptr->link_list);
if (LINK_LOG_BUF_SIZE)
kfree(l_ptr->print_buf.buf);
- node_unlock(l_ptr->owner);
+ tipc_node_unlock(l_ptr->owner);
k_term_timer(&l_ptr->timer);
kfree(l_ptr);
}
-void link_start(struct link *l_ptr)
+void tipc_link_start(struct link *l_ptr)
{
- dbg("link_start %x\n", l_ptr);
+ dbg("tipc_link_start %x\n", l_ptr);
link_state_event(l_ptr, STARTING_EVT);
}
{
struct port *p_ptr;
- spin_lock_bh(&port_list_lock);
- p_ptr = port_lock(origport);
+ spin_lock_bh(&tipc_port_list_lock);
+ p_ptr = tipc_port_lock(origport);
if (p_ptr) {
if (!p_ptr->wakeup)
goto exit;
list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports);
l_ptr->stats.link_congs++;
exit:
- port_unlock(p_ptr);
+ tipc_port_unlock(p_ptr);
}
- spin_unlock_bh(&port_list_lock);
+ spin_unlock_bh(&tipc_port_list_lock);
return -ELINKCONG;
}
-void link_wakeup_ports(struct link *l_ptr, int all)
+void tipc_link_wakeup_ports(struct link *l_ptr, int all)
{
struct port *p_ptr;
struct port *temp_p_ptr;
win = 100000;
if (win <= 0)
return;
- if (!spin_trylock_bh(&port_list_lock))
+ if (!spin_trylock_bh(&tipc_port_list_lock))
return;
if (link_congested(l_ptr))
goto exit;
if (win <= 0)
break;
list_del_init(&p_ptr->wait_list);
- p_ptr->congested_link = 0;
- assert(p_ptr->wakeup);
+ p_ptr->congested_link = NULL;
spin_lock_bh(p_ptr->publ.lock);
p_ptr->publ.congested = 0;
p_ptr->wakeup(&p_ptr->publ);
}
exit:
- spin_unlock_bh(&port_list_lock);
+ spin_unlock_bh(&tipc_port_list_lock);
}
/**
}
/**
- * link_reset_fragments - purge link's inbound message fragments queue
+ * tipc_link_reset_fragments - purge link's inbound message fragments queue
* @l_ptr: pointer to link
*/
-void link_reset_fragments(struct link *l_ptr)
+void tipc_link_reset_fragments(struct link *l_ptr)
{
struct sk_buff *buf = l_ptr->defragm_buf;
struct sk_buff *next;
}
/**
- * link_stop - purge all inbound and outbound messages associated with link
+ * tipc_link_stop - purge all inbound and outbound messages associated with link
* @l_ptr: pointer to link
*/
-void link_stop(struct link *l_ptr)
+void tipc_link_stop(struct link *l_ptr)
{
struct sk_buff *buf;
struct sk_buff *next;
buf = next;
}
- link_reset_fragments(l_ptr);
+ tipc_link_reset_fragments(l_ptr);
buf_discard(l_ptr->proto_msg_queue);
l_ptr->proto_msg_queue = NULL;
ev->up = up;
ev->fcn = fcn;
memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME);
- k_signal((Handler)link_recv_event, (unsigned long)ev);
+ tipc_k_signal((Handler)link_recv_event, (unsigned long)ev);
}
#else
#endif
-void link_reset(struct link *l_ptr)
+void tipc_link_reset(struct link *l_ptr)
{
struct sk_buff *buf;
u32 prev_state = l_ptr->state;
u32 checkpoint = l_ptr->next_in_no;
+ int was_active_link = tipc_link_is_active(l_ptr);
msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1);
if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET))
return;
- node_link_down(l_ptr->owner, l_ptr);
- bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr);
+ tipc_node_link_down(l_ptr->owner, l_ptr);
+ tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr);
#if 0
- tipc_printf(CONS, "\nReset link <%s>\n", l_ptr->name);
+ tipc_printf(TIPC_CONS, "\nReset link <%s>\n", l_ptr->name);
dbg_link_dump();
#endif
- if (node_has_active_links(l_ptr->owner) &&
+ if (was_active_link && tipc_node_has_active_links(l_ptr->owner) &&
l_ptr->owner->permit_changeover) {
l_ptr->reset_checkpoint = checkpoint;
l_ptr->exp_msg_count = START_CHANGEOVER;
buf = next;
}
if (!list_empty(&l_ptr->waiting_ports))
- link_wakeup_ports(l_ptr, 1);
+ tipc_link_wakeup_ports(l_ptr, 1);
l_ptr->retransm_queue_head = 0;
l_ptr->retransm_queue_size = 0;
l_ptr->stale_count = 0;
link_reset_statistics(l_ptr);
- link_send_event(cfg_link_event, l_ptr, 0);
+ link_send_event(tipc_cfg_link_event, l_ptr, 0);
if (!in_own_cluster(l_ptr->addr))
- link_send_event(disc_link_event, l_ptr, 0);
+ link_send_event(tipc_disc_link_event, l_ptr, 0);
}
static void link_activate(struct link *l_ptr)
{
- l_ptr->next_in_no = 1;
- node_link_up(l_ptr->owner, l_ptr);
- bearer_add_dest(l_ptr->b_ptr, l_ptr->addr);
- link_send_event(cfg_link_event, l_ptr, 1);
+ l_ptr->next_in_no = l_ptr->stats.recv_info = 1;
+ tipc_node_link_up(l_ptr->owner, l_ptr);
+ tipc_bearer_add_dest(l_ptr->b_ptr, l_ptr->addr);
+ link_send_event(tipc_cfg_link_event, l_ptr, 1);
if (!in_own_cluster(l_ptr->addr))
- link_send_event(disc_link_event, l_ptr, 1);
+ link_send_event(tipc_disc_link_event, l_ptr, 1);
}
/**
dbg_link("TIM ");
if (l_ptr->next_in_no != l_ptr->checkpoint) {
l_ptr->checkpoint = l_ptr->next_in_no;
- if (bclink_acks_missing(l_ptr->owner)) {
- link_send_proto_msg(l_ptr, STATE_MSG,
- 0, 0, 0, 0, 0);
+ if (tipc_bclink_acks_missing(l_ptr->owner)) {
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG,
+ 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
} else if (l_ptr->max_pkt < l_ptr->max_pkt_target) {
- link_send_proto_msg(l_ptr, STATE_MSG,
- 1, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG,
+ 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
}
link_set_timer(l_ptr, cont_intv);
dbg_link(" -> WU\n");
l_ptr->state = WORKING_UNKNOWN;
l_ptr->fsm_msg_cnt = 0;
- link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv / 4);
break;
case RESET_MSG:
dbg_link("RES -> RR\n");
- link_reset(l_ptr);
+ info("Resetting link <%s>, requested by peer\n",
+ l_ptr->name);
+ tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0;
- link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
break;
break;
case RESET_MSG:
dbg_link("RES -> RR\n");
- link_reset(l_ptr);
+ info("Resetting link <%s>, requested by peer "
+ "while probing\n", l_ptr->name);
+ tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0;
- link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
break;
l_ptr->state = WORKING_WORKING;
l_ptr->fsm_msg_cnt = 0;
l_ptr->checkpoint = l_ptr->next_in_no;
- if (bclink_acks_missing(l_ptr->owner)) {
- link_send_proto_msg(l_ptr, STATE_MSG,
- 0, 0, 0, 0, 0);
+ if (tipc_bclink_acks_missing(l_ptr->owner)) {
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG,
+ 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
}
link_set_timer(l_ptr, cont_intv);
dbg_link("Probing %u/%u,timer = %u ms)\n",
l_ptr->fsm_msg_cnt, l_ptr->abort_limit,
cont_intv / 4);
- link_send_proto_msg(l_ptr, STATE_MSG,
- 1, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG,
+ 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv / 4);
} else { /* Link has failed */
dbg_link("-> RU (%u probes unanswered)\n",
l_ptr->fsm_msg_cnt);
- link_reset(l_ptr);
+ warn("Resetting link <%s>, peer not responding\n",
+ l_ptr->name);
+ tipc_link_reset(l_ptr);
l_ptr->state = RESET_UNKNOWN;
l_ptr->fsm_msg_cnt = 0;
- link_send_proto_msg(l_ptr, RESET_MSG,
- 0, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, RESET_MSG,
+ 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
}
l_ptr->state = WORKING_WORKING;
l_ptr->fsm_msg_cnt = 0;
link_activate(l_ptr);
- link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
break;
dbg_link(" -> RR\n");
l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0;
- link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
break;
/* fall through */
case TIMEOUT_EVT:
dbg_link("TIM \n");
- link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
break;
l_ptr->state = WORKING_WORKING;
l_ptr->fsm_msg_cnt = 0;
link_activate(l_ptr);
- link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
break;
break;
case TIMEOUT_EVT:
dbg_link("TIM\n");
- link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv);
dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt);
struct tipc_msg *bundler_msg = buf_msg(bundler);
struct tipc_msg *msg = buf_msg(buf);
u32 size = msg_size(msg);
- u32 to_pos = align(msg_size(bundler_msg));
- u32 rest = link_max_pkt(l_ptr) - to_pos;
+ u32 bundle_size = msg_size(bundler_msg);
+ u32 to_pos = align(bundle_size);
+ u32 pad = to_pos - bundle_size;
if (msg_user(bundler_msg) != MSG_BUNDLER)
return 0;
if (msg_type(bundler_msg) != OPEN_MSG)
return 0;
- if (rest < align(size))
+ if (skb_tailroom(bundler) < (pad + size))
return 0;
- skb_put(bundler, (to_pos - msg_size(bundler_msg)) + size);
+ skb_put(bundler, pad + size);
memcpy(bundler->data + to_pos, buf->data, size);
msg_set_size(bundler_msg, to_pos + size);
msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1);
return 1;
}
-static inline void link_add_to_outqueue(struct link *l_ptr,
- struct sk_buff *buf,
- struct tipc_msg *msg)
+static void link_add_to_outqueue(struct link *l_ptr,
+ struct sk_buff *buf,
+ struct tipc_msg *msg)
{
u32 ack = mod(l_ptr->next_in_no - 1);
u32 seqno = mod(l_ptr->next_out_no++);
}
/*
- * link_send_buf() is the 'full path' for messages, called from
+ * tipc_link_send_buf() is the 'full path' for messages, called from
* inside TIPC when the 'fast path' in tipc_send_buf
* has failed, and from link_send()
*/
-int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
+int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
{
struct tipc_msg *msg = buf_msg(buf);
u32 size = msg_size(msg);
msg_dbg(msg, "TIPC: Congestion, throwing away\n");
buf_discard(buf);
if (imp > CONN_MANAGER) {
- warn("Resetting <%s>, send queue full", l_ptr->name);
- link_reset(l_ptr);
+ warn("Resetting link <%s>, send queue full", l_ptr->name);
+ tipc_link_reset(l_ptr);
}
return dsz;
}
/* Fragmentation needed ? */
if (size > max_packet)
- return link_send_long_buf(l_ptr, buf);
+ return tipc_link_send_long_buf(l_ptr, buf);
/* Packet can be queued or sent: */
if (queue_size > l_ptr->stats.max_queue_sz)
l_ptr->stats.max_queue_sz = queue_size;
- if (likely(!bearer_congested(l_ptr->b_ptr, l_ptr) &&
+ if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
!link_congested(l_ptr))) {
link_add_to_outqueue(l_ptr, buf, msg);
- if (likely(bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) {
+ if (likely(tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) {
l_ptr->unacked_window = 0;
} else {
- bearer_schedule(l_ptr->b_ptr, l_ptr);
+ tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->stats.bearer_congs++;
l_ptr->next_out = buf;
}
if (l_ptr->next_out &&
link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
- bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
+ tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
return dsz;
}
if (!l_ptr->next_out)
l_ptr->next_out = buf;
link_add_to_outqueue(l_ptr, buf, msg);
- bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
+ tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
return dsz;
}
/*
- * link_send(): same as link_send_buf(), but the link to use has
+ * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has
* not been selected yet, and the the owner node is not locked
* Called by TIPC internal users, e.g. the name distributor
*/
-int link_send(struct sk_buff *buf, u32 dest, u32 selector)
+int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
{
struct link *l_ptr;
struct node *n_ptr;
int res = -ELINKCONG;
- read_lock_bh(&net_lock);
- n_ptr = node_select(dest, selector);
+ read_lock_bh(&tipc_net_lock);
+ n_ptr = tipc_node_select(dest, selector);
if (n_ptr) {
- node_lock(n_ptr);
+ tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[selector & 1];
- dbg("link_send: found link %x for dest %x\n", l_ptr, dest);
if (l_ptr) {
- res = link_send_buf(l_ptr, buf);
+ dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest);
+ res = tipc_link_send_buf(l_ptr, buf);
+ } else {
+ dbg("Attempt to send msg to unreachable node:\n");
+ msg_dbg(buf_msg(buf),">>>");
+ buf_discard(buf);
}
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
} else {
dbg("Attempt to send msg to unknown node:\n");
msg_dbg(buf_msg(buf),">>>");
buf_discard(buf);
}
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
return res;
}
* Link is locked. Returns user data length.
*/
-static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
- u32 *used_max_pkt)
+static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
+ u32 *used_max_pkt)
{
struct tipc_msg *msg = buf_msg(buf);
int res = msg_data_sz(msg);
if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) {
if (likely(list_empty(&l_ptr->b_ptr->cong_links))) {
link_add_to_outqueue(l_ptr, buf, msg);
- if (likely(bearer_send(l_ptr->b_ptr, buf,
- &l_ptr->media_addr))) {
+ if (likely(tipc_bearer_send(l_ptr->b_ptr, buf,
+ &l_ptr->media_addr))) {
l_ptr->unacked_window = 0;
msg_dbg(msg,"SENT_FAST:");
return res;
}
dbg("failed sent fast...\n");
- bearer_schedule(l_ptr->b_ptr, l_ptr);
+ tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->stats.bearer_congs++;
l_ptr->next_out = buf;
return res;
else
*used_max_pkt = link_max_pkt(l_ptr);
}
- return link_send_buf(l_ptr, buf); /* All other cases */
+ return tipc_link_send_buf(l_ptr, buf); /* All other cases */
}
/*
u32 dummy;
if (destnode == tipc_own_addr)
- return port_recv_msg(buf);
+ return tipc_port_recv_msg(buf);
- read_lock_bh(&net_lock);
- n_ptr = node_select(destnode, selector);
+ read_lock_bh(&tipc_net_lock);
+ n_ptr = tipc_node_select(destnode, selector);
if (likely(n_ptr)) {
- node_lock(n_ptr);
+ tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[selector];
dbg("send_fast: buf %x selected %x, destnode = %x\n",
buf, l_ptr, destnode);
if (likely(l_ptr)) {
res = link_send_buf_fast(l_ptr, buf, &dummy);
- node_unlock(n_ptr);
- read_unlock_bh(&net_lock);
+ tipc_node_unlock(n_ptr);
+ read_unlock_bh(&tipc_net_lock);
return res;
}
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
}
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
res = msg_data_sz(buf_msg(buf));
tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
return res;
/*
- * link_send_sections_fast: Entry for messages where the
+ * tipc_link_send_sections_fast: Entry for messages where the
* destination processor is known and the header is complete,
* except for total message length.
* Returns user data length or errno.
*/
-int link_send_sections_fast(struct port *sender,
- struct iovec const *msg_sect,
- const u32 num_sect,
- u32 destaddr)
+int tipc_link_send_sections_fast(struct port *sender,
+ struct iovec const *msg_sect,
+ const u32 num_sect,
+ u32 destaddr)
{
struct tipc_msg *hdr = &sender->publ.phdr;
struct link *l_ptr;
int res;
u32 selector = msg_origport(hdr) & 1;
- assert(destaddr != tipc_own_addr);
-
again:
/*
* Try building message using port's max_pkt hint.
res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt,
!sender->user_port, &buf);
- read_lock_bh(&net_lock);
- node = node_select(destaddr, selector);
+ read_lock_bh(&tipc_net_lock);
+ node = tipc_node_select(destaddr, selector);
if (likely(node)) {
- node_lock(node);
+ tipc_node_lock(node);
l_ptr = node->active_links[selector];
if (likely(l_ptr)) {
if (likely(buf)) {
if (unlikely(res < 0))
buf_discard(buf);
exit:
- node_unlock(node);
- read_unlock_bh(&net_lock);
+ tipc_node_unlock(node);
+ read_unlock_bh(&tipc_net_lock);
return res;
}
*/
sender->max_pkt = link_max_pkt(l_ptr);
- node_unlock(node);
- read_unlock_bh(&net_lock);
+ tipc_node_unlock(node);
+ read_unlock_bh(&tipc_net_lock);
if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt)
return link_send_sections_long(sender, msg_sect,
num_sect, destaddr);
}
- node_unlock(node);
+ tipc_node_unlock(node);
}
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
/* Couldn't find a link to the destination node */
if (buf)
return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
if (res >= 0)
- return port_reject_sections(sender, hdr, msg_sect, num_sect,
- TIPC_ERR_NO_NODE);
+ return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
+ TIPC_ERR_NO_NODE);
return res;
}
fragm_crs = 0;
fragm_rest = 0;
sect_rest = 0;
- sect_crs = 0;
+ sect_crs = NULL;
curr_sect = -1;
/* Prepare reusable fragment header: */
* Now we have a buffer chain. Select a link and check
* that packet size is still OK
*/
- node = node_select(destaddr, sender->publ.ref & 1);
+ node = tipc_node_select(destaddr, sender->publ.ref & 1);
if (likely(node)) {
- node_lock(node);
+ tipc_node_lock(node);
l_ptr = node->active_links[sender->publ.ref & 1];
if (!l_ptr) {
- node_unlock(node);
+ tipc_node_unlock(node);
goto reject;
}
if (link_max_pkt(l_ptr) < max_pkt) {
sender->max_pkt = link_max_pkt(l_ptr);
- node_unlock(node);
+ tipc_node_unlock(node);
for (; buf_chain; buf_chain = buf) {
buf = buf_chain->next;
buf_discard(buf_chain);
buf = buf_chain->next;
buf_discard(buf_chain);
}
- return port_reject_sections(sender, hdr, msg_sect, num_sect,
- TIPC_ERR_NO_NODE);
+ return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
+ TIPC_ERR_NO_NODE);
}
/* Append whole chain to send queue: */
/* Send it, if possible: */
- link_push_queue(l_ptr);
- node_unlock(node);
+ tipc_link_push_queue(l_ptr);
+ tipc_node_unlock(node);
return dsz;
}
/*
- * link_push_packet: Push one unsent packet to the media
+ * tipc_link_push_packet: Push one unsent packet to the media
*/
-u32 link_push_packet(struct link *l_ptr)
+u32 tipc_link_push_packet(struct link *l_ptr)
{
struct sk_buff *buf = l_ptr->first_out;
u32 r_q_size = l_ptr->retransm_queue_size;
if (r_q_size && buf && !skb_cloned(buf)) {
msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
- if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
+ if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
msg_dbg(buf_msg(buf), ">DEF-RETR>");
l_ptr->retransm_queue_head = mod(++r_q_head);
l_ptr->retransm_queue_size = --r_q_size;
if (buf) {
msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in);
- if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
+ if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
msg_dbg(buf_msg(buf), ">DEF-PROT>");
l_ptr->unacked_window = 0;
buf_discard(buf);
- l_ptr->proto_msg_queue = 0;
+ l_ptr->proto_msg_queue = NULL;
return TIPC_OK;
} else {
msg_dbg(buf_msg(buf), "|>DEF-PROT>");
if (mod(next - first) < l_ptr->queue_limit[0]) {
msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
- if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
+ if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
if (msg_user(msg) == MSG_BUNDLER)
msg_set_type(msg, CLOSED_MSG);
msg_dbg(msg, ">PUSH-DATA>");
* push_queue(): push out the unsent messages of a link where
* congestion has abated. Node is locked
*/
-void link_push_queue(struct link *l_ptr)
+void tipc_link_push_queue(struct link *l_ptr)
{
u32 res;
- if (bearer_congested(l_ptr->b_ptr, l_ptr))
+ if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr))
return;
do {
- res = link_push_packet(l_ptr);
+ res = tipc_link_push_packet(l_ptr);
}
while (res == TIPC_OK);
if (res == PUSH_FAILED)
- bearer_schedule(l_ptr->b_ptr, l_ptr);
+ tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
+}
+
+static void link_reset_all(unsigned long addr)
+{
+ struct node *n_ptr;
+ char addr_string[16];
+ u32 i;
+
+ read_lock_bh(&tipc_net_lock);
+ n_ptr = tipc_node_find((u32)addr);
+ if (!n_ptr) {
+ read_unlock_bh(&tipc_net_lock);
+ return; /* node no longer exists */
+ }
+
+ tipc_node_lock(n_ptr);
+
+ warn("Resetting all links to %s\n",
+ addr_string_fill(addr_string, n_ptr->addr));
+
+ for (i = 0; i < MAX_BEARERS; i++) {
+ if (n_ptr->links[i]) {
+ link_print(n_ptr->links[i], TIPC_OUTPUT,
+ "Resetting link\n");
+ tipc_link_reset(n_ptr->links[i]);
+ }
+ }
+
+ tipc_node_unlock(n_ptr);
+ read_unlock_bh(&tipc_net_lock);
+}
+
+static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf)
+{
+ struct tipc_msg *msg = buf_msg(buf);
+
+ warn("Retransmission failure on link <%s>\n", l_ptr->name);
+ tipc_msg_print(TIPC_OUTPUT, msg, ">RETR-FAIL>");
+
+ if (l_ptr->addr) {
+
+ /* Handle failure on standard link */
+
+ link_print(l_ptr, TIPC_OUTPUT, "Resetting link\n");
+ tipc_link_reset(l_ptr);
+
+ } else {
+
+ /* Handle failure on broadcast link */
+
+ struct node *n_ptr;
+ char addr_string[16];
+
+ tipc_printf(TIPC_OUTPUT, "Msg seq number: %u, ", msg_seqno(msg));
+ tipc_printf(TIPC_OUTPUT, "Outstanding acks: %u\n", (u32)TIPC_SKB_CB(buf)->handle);
+
+ n_ptr = l_ptr->owner->next;
+ tipc_node_lock(n_ptr);
+
+ addr_string_fill(addr_string, n_ptr->addr);
+ tipc_printf(TIPC_OUTPUT, "Multicast link info for %s\n", addr_string);
+ tipc_printf(TIPC_OUTPUT, "Supported: %d, ", n_ptr->bclink.supported);
+ tipc_printf(TIPC_OUTPUT, "Acked: %u\n", n_ptr->bclink.acked);
+ tipc_printf(TIPC_OUTPUT, "Last in: %u, ", n_ptr->bclink.last_in);
+ tipc_printf(TIPC_OUTPUT, "Gap after: %u, ", n_ptr->bclink.gap_after);
+ tipc_printf(TIPC_OUTPUT, "Gap to: %u\n", n_ptr->bclink.gap_to);
+ tipc_printf(TIPC_OUTPUT, "Nack sync: %u\n\n", n_ptr->bclink.nack_sync);
+
+ tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr);
+
+ tipc_node_unlock(n_ptr);
+
+ l_ptr->stale_count = 0;
+ }
}
-void link_retransmit(struct link *l_ptr, struct sk_buff *buf,
- u32 retransmits)
+void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
+ u32 retransmits)
{
struct tipc_msg *msg;
+ if (!buf)
+ return;
+
+ msg = buf_msg(buf);
+
dbg("Retransmitting %u in link %x\n", retransmits, l_ptr);
- if (bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) {
- msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>");
- dbg_print_link(l_ptr, " ");
- l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
- l_ptr->retransm_queue_size = retransmits;
- return;
+ if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
+ if (!skb_cloned(buf)) {
+ msg_dbg(msg, ">NO_RETR->BCONG>");
+ dbg_print_link(l_ptr, " ");
+ l_ptr->retransm_queue_head = msg_seqno(msg);
+ l_ptr->retransm_queue_size = retransmits;
+ return;
+ } else {
+ /* Don't retransmit if driver already has the buffer */
+ }
+ } else {
+ /* Detect repeated retransmit failures on uncongested bearer */
+
+ if (l_ptr->last_retransmitted == msg_seqno(msg)) {
+ if (++l_ptr->stale_count > 100) {
+ link_retransmit_failure(l_ptr, buf);
+ return;
+ }
+ } else {
+ l_ptr->last_retransmitted = msg_seqno(msg);
+ l_ptr->stale_count = 1;
+ }
}
+
while (retransmits && (buf != l_ptr->next_out) && buf && !skb_cloned(buf)) {
msg = buf_msg(buf);
msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
- if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
- /* Catch if retransmissions fail repeatedly: */
- if (l_ptr->last_retransmitted == msg_seqno(msg)) {
- if (++l_ptr->stale_count > 100) {
- msg_print(CONS, buf_msg(buf), ">RETR>");
- info("...Retransmitted %u times\n",
- l_ptr->stale_count);
- link_print(l_ptr, CONS, "Resetting Link\n");;
- link_reset(l_ptr);
- break;
- }
- } else {
- l_ptr->stale_count = 0;
- }
- l_ptr->last_retransmitted = msg_seqno(msg);
-
+ if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
msg_dbg(buf_msg(buf), ">RETR>");
buf = buf->next;
retransmits--;
l_ptr->stats.retransmitted++;
} else {
- bearer_schedule(l_ptr->b_ptr, l_ptr);
+ tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->stats.bearer_congs++;
l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
l_ptr->retransm_queue_size = retransmits;
return;
}
}
+
l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0;
}
struct tipc_msg *msg = buf_msg(buf);
if (msg_user(msg) == LINK_CONFIG)
- disc_recv_msg(buf);
+ tipc_disc_recv_msg(buf);
else
- bclink_recv_pkt(buf);
+ tipc_bclink_recv_pkt(buf);
}
/**
void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
{
- read_lock_bh(&net_lock);
+ read_lock_bh(&tipc_net_lock);
while (head) {
struct bearer *b_ptr;
struct node *n_ptr;
link_recv_non_seq(buf);
continue;
}
- n_ptr = node_find(msg_prevnode(msg));
+
+ if (unlikely(!msg_short(msg) &&
+ (msg_destnode(msg) != tipc_own_addr)))
+ goto cont;
+
+ n_ptr = tipc_node_find(msg_prevnode(msg));
if (unlikely(!n_ptr))
goto cont;
- node_lock(n_ptr);
+ tipc_node_lock(n_ptr);
l_ptr = n_ptr->links[b_ptr->identity];
if (unlikely(!l_ptr)) {
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
goto cont;
}
/*
* Release acked messages
*/
if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) {
- if (node_is_up(n_ptr) && n_ptr->bclink.supported)
- bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
+ if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
+ tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
}
crs = l_ptr->first_out;
l_ptr->out_queue_size -= released;
}
if (unlikely(l_ptr->next_out))
- link_push_queue(l_ptr);
+ tipc_link_push_queue(l_ptr);
if (unlikely(!list_empty(&l_ptr->waiting_ports)))
- link_wakeup_ports(l_ptr, 0);
+ tipc_link_wakeup_ports(l_ptr, 0);
if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) {
l_ptr->stats.sent_acks++;
- link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
}
protocol_check:
if (likely(msg_is_dest(msg, tipc_own_addr))) {
deliver:
if (likely(msg_isdata(msg))) {
- node_unlock(n_ptr);
- port_recv_msg(buf);
+ tipc_node_unlock(n_ptr);
+ tipc_port_recv_msg(buf);
continue;
}
switch (msg_user(msg)) {
l_ptr->stats.recv_bundles++;
l_ptr->stats.recv_bundled +=
msg_msgcnt(msg);
- node_unlock(n_ptr);
- link_recv_bundle(buf);
+ tipc_node_unlock(n_ptr);
+ tipc_link_recv_bundle(buf);
continue;
case ROUTE_DISTRIBUTOR:
- node_unlock(n_ptr);
- cluster_recv_routing_table(buf);
+ tipc_node_unlock(n_ptr);
+ tipc_cltr_recv_routing_table(buf);
continue;
case NAME_DISTRIBUTOR:
- node_unlock(n_ptr);
- named_recv(buf);
+ tipc_node_unlock(n_ptr);
+ tipc_named_recv(buf);
continue;
case CONN_MANAGER:
- node_unlock(n_ptr);
- port_recv_proto_msg(buf);
+ tipc_node_unlock(n_ptr);
+ tipc_port_recv_proto_msg(buf);
continue;
case MSG_FRAGMENTER:
l_ptr->stats.recv_fragments++;
- if (link_recv_fragment(
- &l_ptr->defragm_buf,
- &buf, &msg)) {
+ if (tipc_link_recv_fragment(&l_ptr->defragm_buf,
+ &buf, &msg)) {
l_ptr->stats.recv_fragmented++;
goto deliver;
}
break;
case CHANGEOVER_PROTOCOL:
type = msg_type(msg);
- if (link_recv_changeover_msg(
- &l_ptr, &buf)) {
+ if (link_recv_changeover_msg(&l_ptr, &buf)) {
msg = buf_msg(buf);
seq_no = msg_seqno(msg);
TIPC_SKB_CB(buf)->handle
break;
}
}
- node_unlock(n_ptr);
- net_route_msg(buf);
+ tipc_node_unlock(n_ptr);
+ tipc_net_route_msg(buf);
continue;
}
link_handle_out_of_seq_msg(l_ptr, buf);
head = link_insert_deferred_queue(l_ptr, head);
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
continue;
}
if (msg_user(msg) == LINK_PROTOCOL) {
link_recv_proto_msg(l_ptr, buf);
head = link_insert_deferred_queue(l_ptr, head);
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
continue;
}
msg_dbg(msg,"NSEQ<REC<");
msg_dbg(msg,"RECV-REINS:");
buf->next = head;
head = buf;
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
continue;
}
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
cont:
buf_discard(buf);
}
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
}
/*
* Returns the increase of the queue length,i.e. 0 or 1
*/
-u32 link_defer_pkt(struct sk_buff **head,
- struct sk_buff **tail,
- struct sk_buff *buf)
+u32 tipc_link_defer_pkt(struct sk_buff **head,
+ struct sk_buff **tail,
+ struct sk_buff *buf)
{
- struct sk_buff *prev = 0;
+ struct sk_buff *prev = NULL;
struct sk_buff *crs = *head;
u32 seq_no = msg_seqno(buf_msg(buf));
return;
}
- if (link_defer_pkt(&l_ptr->oldest_deferred_in,
- &l_ptr->newest_deferred_in, buf)) {
+ if (tipc_link_defer_pkt(&l_ptr->oldest_deferred_in,
+ &l_ptr->newest_deferred_in, buf)) {
l_ptr->deferred_inqueue_sz++;
l_ptr->stats.deferred_recv++;
if ((l_ptr->deferred_inqueue_sz % 16) == 1)
- link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
} else
l_ptr->stats.duplicates++;
}
/*
* Send protocol message to the other endpoint.
*/
-void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
- u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
+void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
+ u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
{
- struct sk_buff *buf = 0;
+ struct sk_buff *buf = NULL;
struct tipc_msg *msg = l_ptr->pmsg;
u32 msg_size = sizeof(l_ptr->proto_msg);
msg_set_type(msg, msg_typ);
msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in));
- msg_set_last_bcast(msg, bclink_get_last_sent());
+ msg_set_last_bcast(msg, tipc_bclink_get_last_sent());
if (msg_typ == STATE_MSG) {
u32 next_sent = mod(l_ptr->next_out_no);
- if (!link_is_up(l_ptr))
+ if (!tipc_link_is_up(l_ptr))
return;
if (l_ptr->next_out)
next_sent = msg_seqno(buf_msg(l_ptr->next_out));
msg_set_max_pkt(msg, l_ptr->max_pkt_target);
}
- if (node_has_redundant_links(l_ptr->owner)) {
+ if (tipc_node_has_redundant_links(l_ptr->owner)) {
msg_set_redundant_link(msg);
} else {
msg_clear_redundant_link(msg);
/* Congestion? */
- if (bearer_congested(l_ptr->b_ptr, l_ptr)) {
+ if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
if (!l_ptr->proto_msg_queue) {
l_ptr->proto_msg_queue =
buf_acquire(sizeof(l_ptr->proto_msg));
memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg));
msg_set_size(buf_msg(buf), msg_size);
- if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
+ if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
l_ptr->unacked_window = 0;
buf_discard(buf);
return;
}
/* New congestion */
- bearer_schedule(l_ptr->b_ptr, l_ptr);
+ tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->proto_msg_queue = buf;
l_ptr->stats.bearer_congs++;
}
l_ptr->peer_bearer_id = msg_bearer_id(msg);
/* Synchronize broadcast sequence numbers */
- if (!node_has_redundant_links(l_ptr->owner)) {
+ if (!tipc_node_has_redundant_links(l_ptr->owner)) {
l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg));
}
break;
if (msg_linkprio(msg) &&
(msg_linkprio(msg) != l_ptr->priority)) {
- warn("Changing prio <%s>: %u->%u\n",
+ warn("Resetting link <%s>, priority change %u->%u\n",
l_ptr->name, l_ptr->priority, msg_linkprio(msg));
l_ptr->priority = msg_linkprio(msg);
- link_reset(l_ptr); /* Enforce change to take effect */
+ tipc_link_reset(l_ptr); /* Enforce change to take effect */
break;
}
link_state_event(l_ptr, TRAFFIC_MSG_EVT);
/* Protocol message before retransmits, reduce loss risk */
- bclink_check_gap(l_ptr->owner, msg_last_bcast(msg));
+ tipc_bclink_check_gap(l_ptr->owner, msg_last_bcast(msg));
if (rec_gap || (msg_probe(msg))) {
- link_send_proto_msg(l_ptr, STATE_MSG,
- 0, rec_gap, 0, 0, max_pkt_ack);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG,
+ 0, rec_gap, 0, 0, max_pkt_ack);
}
if (msg_seq_gap(msg)) {
msg_dbg(msg, "With Gap:");
l_ptr->stats.recv_nacks++;
- link_retransmit(l_ptr, l_ptr->first_out,
- msg_seq_gap(msg));
+ tipc_link_retransmit(l_ptr, l_ptr->first_out,
+ msg_seq_gap(msg));
}
break;
default:
/*
- * link_tunnel(): Send one message via a link belonging to
+ * tipc_link_tunnel(): Send one message via a link belonging to
* another bearer. Owner node is locked.
*/
-void link_tunnel(struct link *l_ptr,
- struct tipc_msg *tunnel_hdr,
- struct tipc_msg *msg,
- u32 selector)
+void tipc_link_tunnel(struct link *l_ptr,
+ struct tipc_msg *tunnel_hdr,
+ struct tipc_msg *msg,
+ u32 selector)
{
struct link *tunnel;
struct sk_buff *buf;
u32 length = msg_size(msg);
tunnel = l_ptr->owner->active_links[selector & 1];
- if (!link_is_up(tunnel))
+ if (!tipc_link_is_up(tunnel)) {
+ warn("Link changeover error, "
+ "tunnel link no longer available\n");
return;
+ }
msg_set_size(tunnel_hdr, length + INT_H_SIZE);
buf = buf_acquire(length + INT_H_SIZE);
- if (!buf)
+ if (!buf) {
+ warn("Link changeover error, "
+ "unable to send tunnel msg\n");
return;
+ }
memcpy(buf->data, (unchar *)tunnel_hdr, INT_H_SIZE);
memcpy(buf->data + INT_H_SIZE, (unchar *)msg, length);
dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane);
msg_dbg(buf_msg(buf), ">SEND>");
- assert(tunnel);
- link_send_buf(tunnel, buf);
+ tipc_link_send_buf(tunnel, buf);
}
* Owner node is locked.
*/
-void link_changeover(struct link *l_ptr)
+void tipc_link_changeover(struct link *l_ptr)
{
u32 msgcount = l_ptr->out_queue_size;
struct sk_buff *crs = l_ptr->first_out;
struct link *tunnel = l_ptr->owner->active_links[0];
- int split_bundles = node_has_redundant_links(l_ptr->owner);
struct tipc_msg tunnel_hdr;
+ int split_bundles;
if (!tunnel)
return;
- if (!l_ptr->owner->permit_changeover)
+ if (!l_ptr->owner->permit_changeover) {
+ warn("Link changeover error, "
+ "peer did not permit changeover\n");
return;
+ }
msg_init(&tunnel_hdr, CHANGEOVER_PROTOCOL,
ORIGINAL_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr);
msg_set_bearer_id(&tunnel_hdr, l_ptr->peer_bearer_id);
msg_set_msgcnt(&tunnel_hdr, msgcount);
+ dbg("Link changeover requires %u tunnel messages\n", msgcount);
+
if (!l_ptr->first_out) {
struct sk_buff *buf;
- assert(!msgcount);
buf = buf_acquire(INT_H_SIZE);
if (buf) {
memcpy(buf->data, (unchar *)&tunnel_hdr, INT_H_SIZE);
dbg("%c->%c:", l_ptr->b_ptr->net_plane,
tunnel->b_ptr->net_plane);
msg_dbg(&tunnel_hdr, "EMPTY>SEND>");
- link_send_buf(tunnel, buf);
+ tipc_link_send_buf(tunnel, buf);
} else {
- warn("Memory squeeze; link changeover failed\n");
+ warn("Link changeover error, "
+ "unable to send changeover msg\n");
}
return;
}
+
+ split_bundles = (l_ptr->owner->active_links[0] !=
+ l_ptr->owner->active_links[1]);
+
while (crs) {
struct tipc_msg *msg = buf_msg(crs);
while (msgcount--) {
msg_set_seqno(m,msg_seqno(msg));
- link_tunnel(l_ptr, &tunnel_hdr, m,
- msg_link_selector(m));
+ tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
+ msg_link_selector(m));
pos += align(msg_size(m));
m = (struct tipc_msg *)pos;
}
} else {
- link_tunnel(l_ptr, &tunnel_hdr, msg,
- msg_link_selector(msg));
+ tipc_link_tunnel(l_ptr, &tunnel_hdr, msg,
+ msg_link_selector(msg));
}
crs = crs->next;
}
}
-void link_send_duplicate(struct link *l_ptr, struct link *tunnel)
+void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
{
struct sk_buff *iter;
struct tipc_msg tunnel_hdr;
msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
outbuf = buf_acquire(length + INT_H_SIZE);
if (outbuf == NULL) {
- warn("Memory squeeze; buffer duplication failed\n");
+ warn("Link changeover error, "
+ "unable to send duplicate msg\n");
return;
}
memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE);
dbg("%c->%c:", l_ptr->b_ptr->net_plane,
tunnel->b_ptr->net_plane);
msg_dbg(buf_msg(outbuf), ">SEND>");
- link_send_buf(tunnel, outbuf);
- if (!link_is_up(l_ptr))
+ tipc_link_send_buf(tunnel, outbuf);
+ if (!tipc_link_is_up(l_ptr))
return;
iter = iter->next;
}
u32 msg_count = msg_msgcnt(tunnel_msg);
dest_link = (*l_ptr)->owner->links[msg_bearer_id(tunnel_msg)];
- assert(dest_link != *l_ptr);
if (!dest_link) {
msg_dbg(tunnel_msg, "NOLINK/<REC<");
goto exit;
}
+ if (dest_link == *l_ptr) {
+ err("Unexpected changeover message on link <%s>\n",
+ (*l_ptr)->name);
+ goto exit;
+ }
dbg("%c<-%c:", dest_link->b_ptr->net_plane,
(*l_ptr)->b_ptr->net_plane);
*l_ptr = dest_link;
}
*buf = buf_extract(tunnel_buf,INT_H_SIZE);
if (*buf == NULL) {
- warn("Memory squeeze; failed to extract msg\n");
+ warn("Link changeover error, duplicate msg dropped\n");
goto exit;
}
msg_dbg(tunnel_msg, "TNL<REC<");
/* First original message ?: */
- if (link_is_up(dest_link)) {
+ if (tipc_link_is_up(dest_link)) {
msg_dbg(tunnel_msg, "UP/FIRST/<REC<");
- link_reset(dest_link);
+ info("Resetting link <%s>, changeover initiated by peer\n",
+ dest_link->name);
+ tipc_link_reset(dest_link);
dest_link->exp_msg_count = msg_count;
+ dbg("Expecting %u tunnelled messages\n", msg_count);
if (!msg_count)
goto exit;
} else if (dest_link->exp_msg_count == START_CHANGEOVER) {
msg_dbg(tunnel_msg, "BLK/FIRST/<REC<");
dest_link->exp_msg_count = msg_count;
+ dbg("Expecting %u tunnelled messages\n", msg_count);
if (!msg_count)
goto exit;
}
/* Receive original message */
if (dest_link->exp_msg_count == 0) {
+ warn("Link switchover error, "
+ "got too many tunnelled messages\n");
msg_dbg(tunnel_msg, "OVERDUE/DROP/<REC<");
dbg_print_link(dest_link, "LINK:");
goto exit;
buf_discard(tunnel_buf);
return 1;
} else {
- warn("Memory squeeze; dropped incoming msg\n");
+ warn("Link changeover error, original msg dropped\n");
}
}
exit:
- *buf = 0;
+ *buf = NULL;
buf_discard(tunnel_buf);
return 0;
}
/*
* Bundler functionality:
*/
-void link_recv_bundle(struct sk_buff *buf)
+void tipc_link_recv_bundle(struct sk_buff *buf)
{
u32 msgcount = msg_msgcnt(buf_msg(buf));
u32 pos = INT_H_SIZE;
while (msgcount--) {
obuf = buf_extract(buf, pos);
if (obuf == NULL) {
- char addr_string[16];
-
- warn("Buffer allocation failure;\n");
- warn(" incoming message(s) from %s lost\n",
- addr_string_fill(addr_string,
- msg_orignode(buf_msg(buf))));
- return;
+ warn("Link unable to unbundle message(s)\n");
+ break;
};
pos += align(msg_size(buf_msg(obuf)));
msg_dbg(buf_msg(obuf), " /");
- net_route_msg(obuf);
+ tipc_net_route_msg(obuf);
}
buf_discard(buf);
}
/*
- * link_send_long_buf: Entry for buffers needing fragmentation.
+ * tipc_link_send_long_buf: Entry for buffers needing fragmentation.
* The buffer is complete, inclusive total message length.
* Returns user data length.
*/
-int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
+int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
{
struct tipc_msg *inmsg = buf_msg(buf);
struct tipc_msg fragm_hdr;
}
fragm = buf_acquire(fragm_sz + INT_H_SIZE);
if (fragm == NULL) {
- warn("Memory squeeze; failed to fragment msg\n");
+ warn("Link unable to fragment message\n");
dsz = -ENOMEM;
goto exit;
}
/* Send queued messages first, if any: */
l_ptr->stats.sent_fragments++;
- link_send_buf(l_ptr, fragm);
- if (!link_is_up(l_ptr))
+ tipc_link_send_buf(l_ptr, fragm);
+ if (!tipc_link_is_up(l_ptr))
return dsz;
msg_set_fragm_no(&fragm_hdr, ++fragm_no);
rest -= fragm_sz;
* pending message. This makes dynamic memory allocation unecessary.
*/
-static inline u32 get_long_msg_seqno(struct sk_buff *buf)
-{
- return msg_seqno(buf_msg(buf));
-}
-
-static inline void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
+static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
{
msg_set_seqno(buf_msg(buf), seqno);
}
-static inline u32 get_fragm_size(struct sk_buff *buf)
+static u32 get_fragm_size(struct sk_buff *buf)
{
return msg_ack(buf_msg(buf));
}
-static inline void set_fragm_size(struct sk_buff *buf, u32 sz)
+static void set_fragm_size(struct sk_buff *buf, u32 sz)
{
msg_set_ack(buf_msg(buf), sz);
}
-static inline u32 get_expected_frags(struct sk_buff *buf)
+static u32 get_expected_frags(struct sk_buff *buf)
{
return msg_bcast_ack(buf_msg(buf));
}
-static inline void set_expected_frags(struct sk_buff *buf, u32 exp)
+static void set_expected_frags(struct sk_buff *buf, u32 exp)
{
msg_set_bcast_ack(buf_msg(buf), exp);
}
-static inline u32 get_timer_cnt(struct sk_buff *buf)
+static u32 get_timer_cnt(struct sk_buff *buf)
{
return msg_reroute_cnt(buf_msg(buf));
}
-static inline void incr_timer_cnt(struct sk_buff *buf)
+static void incr_timer_cnt(struct sk_buff *buf)
{
msg_incr_reroute_cnt(buf_msg(buf));
}
/*
- * link_recv_fragment(): Called with node lock on. Returns
+ * tipc_link_recv_fragment(): Called with node lock on. Returns
* the reassembled buffer if message is complete.
*/
-int link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
- struct tipc_msg **m)
+int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
+ struct tipc_msg **m)
{
- struct sk_buff *prev = 0;
+ struct sk_buff *prev = NULL;
struct sk_buff *fbuf = *fb;
struct tipc_msg *fragm = buf_msg(fbuf);
struct sk_buff *pbuf = *pending;
u32 long_msg_seq_no = msg_long_msgno(fragm);
- *fb = 0;
+ *fb = NULL;
msg_dbg(fragm,"FRG<REC<");
/* Is there an incomplete message waiting for this fragment? */
set_fragm_size(pbuf,fragm_sz);
set_expected_frags(pbuf,exp_fragm_cnt - 1);
} else {
- warn("Memory squeeze; got no defragmenting buffer\n");
+ warn("Link unable to reassemble fragmented message\n");
}
buf_discard(fbuf);
return 0;
static void link_check_defragm_bufs(struct link *l_ptr)
{
- struct sk_buff *prev = 0;
- struct sk_buff *next = 0;
+ struct sk_buff *prev = NULL;
+ struct sk_buff *next = NULL;
struct sk_buff *buf = l_ptr->defragm_buf;
if (!buf)
}
-void link_set_queue_limits(struct link *l_ptr, u32 window)
+void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
{
/* Data messages from this node, inclusive FIRST_FRAGM */
l_ptr->queue_limit[DATA_LOW] = window;
* @name - ptr to link name string
* @node - ptr to area to be filled with ptr to associated node
*
- * Caller must hold 'net_lock' to ensure node and bearer are not deleted;
+ * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted;
* this also prevents link deletion.
*
* Returns pointer to link (or 0 if invalid link name).
struct link *l_ptr;
if (!link_name_validate(name, &link_name_parts))
- return 0;
+ return NULL;
- b_ptr = bearer_find_interface(link_name_parts.if_local);
+ b_ptr = tipc_bearer_find_interface(link_name_parts.if_local);
if (!b_ptr)
- return 0;
+ return NULL;
- *node = node_find(link_name_parts.addr_peer);
+ *node = tipc_node_find(link_name_parts.addr_peer);
if (!*node)
- return 0;
+ return NULL;
l_ptr = (*node)->links[b_ptr->identity];
if (!l_ptr || strcmp(l_ptr->name, name))
- return 0;
+ return NULL;
return l_ptr;
}
-struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space,
- u16 cmd)
+struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space,
+ u16 cmd)
{
struct tipc_link_config *args;
u32 new_value;
int res;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG))
- return cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
+ return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
args = (struct tipc_link_config *)TLV_DATA(req_tlv_area);
new_value = ntohl(args->value);
- if (!strcmp(args->name, bc_link_name)) {
+ if (!strcmp(args->name, tipc_bclink_name)) {
if ((cmd == TIPC_CMD_SET_LINK_WINDOW) &&
- (bclink_set_queue_limits(new_value) == 0))
- return cfg_reply_none();
- return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
- " (cannot change setting on broadcast link)");
+ (tipc_bclink_set_queue_limits(new_value) == 0))
+ return tipc_cfg_reply_none();
+ return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
+ " (cannot change setting on broadcast link)");
}
- read_lock_bh(&net_lock);
+ read_lock_bh(&tipc_net_lock);
l_ptr = link_find_link(args->name, &node);
if (!l_ptr) {
- read_unlock_bh(&net_lock);
- return cfg_reply_error_string("link not found");
+ read_unlock_bh(&tipc_net_lock);
+ return tipc_cfg_reply_error_string("link not found");
}
- node_lock(node);
+ tipc_node_lock(node);
res = -EINVAL;
switch (cmd) {
case TIPC_CMD_SET_LINK_TOL:
if ((new_value >= TIPC_MIN_LINK_TOL) &&
(new_value <= TIPC_MAX_LINK_TOL)) {
link_set_supervision_props(l_ptr, new_value);
- link_send_proto_msg(l_ptr, STATE_MSG,
- 0, 0, new_value, 0, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG,
+ 0, 0, new_value, 0, 0);
res = TIPC_OK;
}
break;
if ((new_value >= TIPC_MIN_LINK_PRI) &&
(new_value <= TIPC_MAX_LINK_PRI)) {
l_ptr->priority = new_value;
- link_send_proto_msg(l_ptr, STATE_MSG,
- 0, 0, 0, new_value, 0);
+ tipc_link_send_proto_msg(l_ptr, STATE_MSG,
+ 0, 0, 0, new_value, 0);
res = TIPC_OK;
}
break;
case TIPC_CMD_SET_LINK_WINDOW:
if ((new_value >= TIPC_MIN_LINK_WIN) &&
(new_value <= TIPC_MAX_LINK_WIN)) {
- link_set_queue_limits(l_ptr, new_value);
+ tipc_link_set_queue_limits(l_ptr, new_value);
res = TIPC_OK;
}
break;
}
- node_unlock(node);
+ tipc_node_unlock(node);
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
if (res)
- return cfg_reply_error_string("cannot change link setting");
+ return tipc_cfg_reply_error_string("cannot change link setting");
- return cfg_reply_none();
+ return tipc_cfg_reply_none();
}
/**
l_ptr->stats.recv_info = l_ptr->next_in_no;
}
-struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space)
+struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space)
{
char *link_name;
struct link *l_ptr;
struct node *node;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
- return cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
+ return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
link_name = (char *)TLV_DATA(req_tlv_area);
- if (!strcmp(link_name, bc_link_name)) {
- if (bclink_reset_stats())
- return cfg_reply_error_string("link not found");
- return cfg_reply_none();
+ if (!strcmp(link_name, tipc_bclink_name)) {
+ if (tipc_bclink_reset_stats())
+ return tipc_cfg_reply_error_string("link not found");
+ return tipc_cfg_reply_none();
}
- read_lock_bh(&net_lock);
+ read_lock_bh(&tipc_net_lock);
l_ptr = link_find_link(link_name, &node);
if (!l_ptr) {
- read_unlock_bh(&net_lock);
- return cfg_reply_error_string("link not found");
+ read_unlock_bh(&tipc_net_lock);
+ return tipc_cfg_reply_error_string("link not found");
}
- node_lock(node);
+ tipc_node_lock(node);
link_reset_statistics(l_ptr);
- node_unlock(node);
- read_unlock_bh(&net_lock);
- return cfg_reply_none();
+ tipc_node_unlock(node);
+ read_unlock_bh(&tipc_net_lock);
+ return tipc_cfg_reply_none();
}
/**
}
/**
- * link_stats - print link statistics
+ * tipc_link_stats - print link statistics
* @name: link name
* @buf: print buffer area
* @buf_size: size of print buffer area
* Returns length of print buffer data string (or 0 if error)
*/
-static int link_stats(const char *name, char *buf, const u32 buf_size)
+static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
{
struct print_buf pb;
struct link *l_ptr;
char *status;
u32 profile_total = 0;
- if (!strcmp(name, bc_link_name))
- return bclink_stats(buf, buf_size);
+ if (!strcmp(name, tipc_bclink_name))
+ return tipc_bclink_stats(buf, buf_size);
- printbuf_init(&pb, buf, buf_size);
+ tipc_printbuf_init(&pb, buf, buf_size);
- read_lock_bh(&net_lock);
+ read_lock_bh(&tipc_net_lock);
l_ptr = link_find_link(name, &node);
if (!l_ptr) {
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
return 0;
}
- node_lock(node);
+ tipc_node_lock(node);
- if (link_is_active(l_ptr))
+ if (tipc_link_is_active(l_ptr))
status = "ACTIVE";
- else if (link_is_up(l_ptr))
+ else if (tipc_link_is_up(l_ptr))
status = "STANDBY";
else
status = "DEFUNCT";
? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts)
: 0);
- node_unlock(node);
- read_unlock_bh(&net_lock);
- return printbuf_validate(&pb);
+ tipc_node_unlock(node);
+ read_unlock_bh(&tipc_net_lock);
+ return tipc_printbuf_validate(&pb);
}
#define MAX_LINK_STATS_INFO 2000
-struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space)
+struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space)
{
struct sk_buff *buf;
struct tlv_desc *rep_tlv;
int str_len;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
- return cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
+ return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
- buf = cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO));
+ buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO));
if (!buf)
return NULL;
rep_tlv = (struct tlv_desc *)buf->data;
- str_len = link_stats((char *)TLV_DATA(req_tlv_area),
- (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
+ str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area),
+ (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
if (!str_len) {
buf_discard(buf);
- return cfg_reply_error_string("link not found");
+ return tipc_cfg_reply_error_string("link not found");
}
skb_put(buf, TLV_SPACE(str_len));
u32 a;
a = link_name2addr(name, &bearer_id);
- read_lock_bh(&net_lock);
- node = node_find(a);
+ read_lock_bh(&tipc_net_lock);
+ node = tipc_node_find(a);
if (node) {
- node_lock(node);
+ tipc_node_lock(node);
l_ptr = node->links[bearer_id];
if (l_ptr) {
if (op == TIPC_REMOVE_LINK) {
struct bearer *b_ptr = l_ptr->b_ptr;
spin_lock_bh(&b_ptr->publ.lock);
- link_delete(l_ptr);
+ tipc_link_delete(l_ptr);
spin_unlock_bh(&b_ptr->publ.lock);
}
if (op == TIPC_CMD_BLOCK_LINK) {
- link_reset(l_ptr);
+ tipc_link_reset(l_ptr);
l_ptr->blocked = 1;
}
if (op == TIPC_CMD_UNBLOCK_LINK) {
}
res = TIPC_OK;
}
- node_unlock(node);
+ tipc_node_unlock(node);
}
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
return res;
}
#endif
/**
- * link_get_max_pkt - get maximum packet size to use when sending to destination
+ * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination
* @dest: network address of destination node
* @selector: used to select from set of active links
*
* If no active link can be found, uses default maximum packet size.
*/
-u32 link_get_max_pkt(u32 dest, u32 selector)
+u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
{
struct node *n_ptr;
struct link *l_ptr;
if (dest == tipc_own_addr)
return MAX_MSG_SIZE;
- read_lock_bh(&net_lock);
- n_ptr = node_select(dest, selector);
+ read_lock_bh(&tipc_net_lock);
+ n_ptr = tipc_node_select(dest, selector);
if (n_ptr) {
- node_lock(n_ptr);
+ tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[selector & 1];
if (l_ptr)
res = link_max_pkt(l_ptr);
- node_unlock(n_ptr);
+ tipc_node_unlock(n_ptr);
}
- read_unlock_bh(&net_lock);
+ read_unlock_bh(&tipc_net_lock);
return res;
}