summaryrefslogtreecommitdiffstats
path: root/include/target/iscsi
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2015-01-26 12:49:05 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-02-04 10:55:33 -0800
commitc1e34b64044318dde74a4cec24a91ff6415f1c48 (patch)
treedfe7ec5ff63a5abdb800bb90e6fee41b9dbacaad /include/target/iscsi
parent631af550621071d56abe2edbb63d9afd4f4dafcf (diff)
downloadlinux-c1e34b64044318dde74a4cec24a91ff6415f1c48.tar.bz2
iscsi-target: Introduce session_get_next_ttt
Reduce code duplication. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target/iscsi')
-rw-r--r--include/target/iscsi/iscsi_target_core.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
index 09a522bae222..5f41a17bdafd 100644
--- a/include/target/iscsi/iscsi_target_core.h
+++ b/include/target/iscsi/iscsi_target_core.h
@@ -880,4 +880,17 @@ struct iscsit_global {
struct iscsi_portal_group *discovery_tpg;
};
+static inline u32 session_get_next_ttt(struct iscsi_session *session)
+{
+ u32 ttt;
+
+ spin_lock_bh(&session->ttt_lock);
+ ttt = session->targ_xfer_tag++;
+ if (ttt == 0xFFFFFFFF)
+ ttt = session->targ_xfer_tag++;
+ spin_unlock_bh(&session->ttt_lock);
+
+ return ttt;
+}
+
#endif /* ISCSI_TARGET_CORE_H */