net/smc: add new link state and related helpers
Before a link can be reused it must have been cleared. Lowest current link state is INACTIVE, which does not mean that the link is already cleared. Add a new state UNUSED that is set when the link is cleared and can be reused. Add helper smc_llc_usable_link() to find an active link in a link group, and smc_link_usable() to determine if a link is usable. Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Reviewed-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e07d31dc16
commit
d854fcbfae
@@ -32,6 +32,7 @@ enum smc_lgr_role { /* possible roles of a link group */
|
||||
};
|
||||
|
||||
enum smc_link_state { /* possible states of a link */
|
||||
SMC_LNK_UNUSED, /* link is unused */
|
||||
SMC_LNK_INACTIVE, /* link is inactive */
|
||||
SMC_LNK_ACTIVATING, /* link is being activated */
|
||||
SMC_LNK_ACTIVE, /* link is active */
|
||||
@@ -295,6 +296,14 @@ static inline struct smc_connection *smc_lgr_find_conn(
|
||||
return res;
|
||||
}
|
||||
|
||||
/* returns true if the specified link is usable */
|
||||
static inline bool smc_link_usable(struct smc_link *lnk)
|
||||
{
|
||||
if (lnk->state == SMC_LNK_UNUSED || lnk->state == SMC_LNK_INACTIVE)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
struct smc_sock;
|
||||
struct smc_clc_msg_accept_confirm;
|
||||
struct smc_clc_msg_local;
|
||||
|
||||
Reference in New Issue
Block a user