Commit 01fee256 authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller

tipc: Relocate trivial link status functions to header file

Rather than live in link.c where they can only be used in that file alone,
these helper routines are better served by being in link.h

Relocated are the following:

	link_working_working
	link_working_unknown
	link_reset_unknown
	link_reset_reset
	link_blocked
	link_congested
Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 15e979da
...@@ -224,7 +224,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr) ...@@ -224,7 +224,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr)
memcpy(addr, &media_addr, sizeof(*addr)); memcpy(addr, &media_addr, sizeof(*addr));
tipc_link_reset(link); tipc_link_reset(link);
} }
link_fully_up = (link->state == WORKING_WORKING); link_fully_up = link_working_working(link);
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
if ((type == DSC_RESP_MSG) || link_fully_up) if ((type == DSC_RESP_MSG) || link_fully_up)
return; return;
......
...@@ -202,36 +202,6 @@ static unsigned int align(unsigned int i) ...@@ -202,36 +202,6 @@ static unsigned int align(unsigned int i)
return (i + 3) & ~3u; return (i + 3) & ~3u;
} }
static int link_working_working(struct link *l_ptr)
{
return (l_ptr->state == WORKING_WORKING);
}
static int link_working_unknown(struct link *l_ptr)
{
return (l_ptr->state == WORKING_UNKNOWN);
}
static int link_reset_unknown(struct link *l_ptr)
{
return (l_ptr->state == RESET_UNKNOWN);
}
static int link_reset_reset(struct link *l_ptr)
{
return (l_ptr->state == RESET_RESET);
}
static int link_blocked(struct link *l_ptr)
{
return (l_ptr->exp_msg_count || l_ptr->blocked);
}
static int link_congested(struct link *l_ptr)
{
return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]);
}
static void link_init_max_pkt(struct link *l_ptr) static void link_init_max_pkt(struct link *l_ptr)
{ {
u32 max_pkt; u32 max_pkt;
......
...@@ -292,4 +292,39 @@ static inline u32 lesser(u32 left, u32 right) ...@@ -292,4 +292,39 @@ static inline u32 lesser(u32 left, u32 right)
return less_eq(left, right) ? left : right; return less_eq(left, right) ? left : right;
} }
/*
* Link status checking routines
*/
static inline int link_working_working(struct link *l_ptr)
{
return (l_ptr->state == WORKING_WORKING);
}
static inline int link_working_unknown(struct link *l_ptr)
{
return (l_ptr->state == WORKING_UNKNOWN);
}
static inline int link_reset_unknown(struct link *l_ptr)
{
return (l_ptr->state == RESET_UNKNOWN);
}
static inline int link_reset_reset(struct link *l_ptr)
{
return (l_ptr->state == RESET_RESET);
}
static inline 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)
{
return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]);
}
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment