summaryrefslogtreecommitdiff
path: root/net/smc/smc_llc.h
diff options
context:
space:
mode:
authorKarsten Graul <kgraul@linux.ibm.com>2020-04-29 17:10:43 +0200
committerDavid S. Miller <davem@davemloft.net>2020-04-29 12:26:32 -0700
commitd854fcbfaeda9748c85de296fbe07b7763a1939c (patch)
treec056b8e27021556cc3b69dae521c3b1ef5ccfc63 /net/smc/smc_llc.h
parente07d31dc16b0d77ff6b3f71cafe3a825fb80bed4 (diff)
downloadlinux-d854fcbfaeda9748c85de296fbe07b7763a1939c.tar.gz
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>
Diffstat (limited to 'net/smc/smc_llc.h')
-rw-r--r--net/smc/smc_llc.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/smc/smc_llc.h b/net/smc/smc_llc.h
index 461c0c3ef76e..08171131110c 100644
--- a/net/smc/smc_llc.h
+++ b/net/smc/smc_llc.h
@@ -35,6 +35,17 @@ enum smc_llc_msg_type {
SMC_LLC_DELETE_RKEY = 0x09,
};
+/* returns a usable link of the link group, or NULL */
+static inline struct smc_link *smc_llc_usable_link(struct smc_link_group *lgr)
+{
+ int i;
+
+ for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++)
+ if (smc_link_usable(&lgr->lnk[i]))
+ return &lgr->lnk[i];
+ return NULL;
+}
+
/* transmit */
int smc_llc_send_confirm_link(struct smc_link *lnk,
enum smc_llc_reqresp reqresp);