From 82c853344888c2d541d6445a08ab31cbcf1c140f Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 11 Sep 2013 17:31:39 -0700 Subject: iscsi tools: sync iscsi_if.h with kernel space This patches syncs iscsi_if.h with upstream commit commit ae542edb11c79706cd74d7bd54ebd7702965a7f3 Author: Adheer Chandravanshi Date: Mon Jul 1 05:54:11 2013 -0400 [SCSI] scsi_transport_iscsi: Exporting new attrs for iscsi session and conne --- usr/initiator_common.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'usr/initiator_common.c') diff --git a/usr/initiator_common.c b/usr/initiator_common.c index eb72795..0fb7edc 100644 --- a/usr/initiator_common.c +++ b/usr/initiator_common.c @@ -324,12 +324,32 @@ int iscsi_host_set_params(struct iscsi_session *session) return 0; } +static inline void iscsi_session_clear_param(struct iscsi_session *session, + int param) +{ + session->param_mask &= ~(1ULL << param); +} + +void iscsi_session_init_params(struct iscsi_session *session) +{ + session->param_mask = ~0ULL; + if (!(session->t->caps & CAP_MULTI_R2T)) + iscsi_session_clear_param(session, ISCSI_PARAM_MAX_R2T); + if (!(session->t->caps & CAP_HDRDGST)) + iscsi_session_clear_param(session, ISCSI_PARAM_HDRDGST_EN); + if (!(session->t->caps & CAP_DATADGST)) + iscsi_session_clear_param(session, ISCSI_PARAM_DATADGST_EN); + if (!(session->t->caps & CAP_MARKERS)) { + iscsi_session_clear_param(session, ISCSI_PARAM_IFMARKER_EN); + iscsi_session_clear_param(session, ISCSI_PARAM_OFMARKER_EN); + } +} + #define MAX_SESSION_PARAMS 32 int iscsi_session_set_params(struct iscsi_conn *conn) { struct iscsi_session *session = conn->session; - struct iscsi_transport *t = session->t; int i, rc; uint32_t one = 1, zero = 0; struct connparam { @@ -499,22 +519,12 @@ int iscsi_session_set_params(struct iscsi_conn *conn) }, }; - session->param_mask = ~0ULL; - if (!(t->caps & CAP_MULTI_R2T)) - session->param_mask &= ~ISCSI_MAX_R2T; - if (!(t->caps & CAP_HDRDGST)) - session->param_mask &= ~ISCSI_HDRDGST_EN; - if (!(t->caps & CAP_DATADGST)) - session->param_mask &= ~ISCSI_DATADGST_EN; - if (!(t->caps & CAP_MARKERS)) { - session->param_mask &= ~ISCSI_IFMARKER_EN; - session->param_mask &= ~ISCSI_OFMARKER_EN; - } + iscsi_session_init_params(session); /* some llds will send nops internally */ if (!iscsi_sysfs_session_supports_nop(session->id)) { - session->param_mask &= ~ISCSI_PING_TMO; - session->param_mask &= ~ISCSI_RECV_TMO; + iscsi_session_clear_param(session, ISCSI_PARAM_PING_TMO); + iscsi_session_clear_param(session, ISCSI_PARAM_RECV_TMO); } /* Entered full-feature phase! */ -- cgit v1.2.1