diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2015-02-05 06:37:59 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2015-02-05 06:37:59 +0000 |
commit | 82babffba9f999c625bb9108c2ad005e14198700 (patch) | |
tree | 20fba2173fa09918784fa0c8342c8e206d67f763 /sys/dev/iscsi | |
parent | 35eeacca92b331c619f16187c0020c84491d8300 (diff) | |
download | src-82babffba9f999c625bb9108c2ad005e14198700.tar.gz src-82babffba9f999c625bb9108c2ad005e14198700.zip |
Notes
Diffstat (limited to 'sys/dev/iscsi')
-rw-r--r-- | sys/dev/iscsi/icl.h | 1 | ||||
-rw-r--r-- | sys/dev/iscsi/icl_soft.c | 1 | ||||
-rw-r--r-- | sys/dev/iscsi/iscsi.c | 19 | ||||
-rw-r--r-- | sys/dev/iscsi/iscsi_ioctl.h | 24 |
4 files changed, 37 insertions, 8 deletions
diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index f667ad66a899..86dfb9ac460e 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -113,6 +113,7 @@ struct icl_conn { bool ic_disconnecting; bool ic_iser; const char *ic_name; + const char *ic_offload; void (*ic_receive)(struct icl_pdu *); void (*ic_error)(struct icl_conn *); diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index b0c2d40861e9..c6107749c14a 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -1185,6 +1185,7 @@ icl_soft_new_conn(const char *name, struct mtx *lock) #endif ic->ic_max_data_segment_length = ICL_MAX_DATA_SEGMENT_LENGTH; ic->ic_name = name; + ic->ic_offload = "none"; return (ic); } diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 8f07620a697d..242d033452ed 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1306,6 +1306,16 @@ iscsi_ioctl_daemon_wait(struct iscsi_softc *sc, request->idr_tsih = 0; /* New or reinstated session. */ memcpy(&request->idr_conf, &is->is_conf, sizeof(request->idr_conf)); + + error = icl_limits(is->is_conf.isc_offload, + &request->idr_limits.isl_max_data_segment_length); + if (error != 0) { + ISCSI_SESSION_WARN(is, "icl_limits for offload \"%s\" " + "failed with error %d", is->is_conf.isc_offload, + error); + sx_sunlock(&sc->sc_lock); + return (error); + } sx_sunlock(&sc->sc_lock); return (0); @@ -1731,7 +1741,13 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa) return (EBUSY); } - is->is_conn = icl_new_conn(NULL, "iscsi", &is->is_lock); + is->is_conn = icl_new_conn(is->is_conf.isc_offload, + "iscsi", &is->is_lock); + if (is->is_conn == NULL) { + sx_xunlock(&sc->sc_lock); + free(is, M_ISCSI); + return (EINVAL); + } is->is_conn->ic_receive = iscsi_receive_callback; is->is_conn->ic_error = iscsi_error_callback; is->is_conn->ic_prv0 = is; @@ -1836,6 +1852,7 @@ iscsi_ioctl_session_list(struct iscsi_softc *sc, struct iscsi_session_list *isl) iss.iss_id = is->is_id; strlcpy(iss.iss_target_alias, is->is_target_alias, sizeof(iss.iss_target_alias)); strlcpy(iss.iss_reason, is->is_reason, sizeof(iss.iss_reason)); + strlcpy(iss.iss_offload, is->is_conn->ic_offload, sizeof(iss.iss_offload)); if (is->is_conn->ic_header_crc32c) iss.iss_header_digest = ISCSI_DIGEST_CRC32C; diff --git a/sys/dev/iscsi/iscsi_ioctl.h b/sys/dev/iscsi/iscsi_ioctl.h index b7cb47d4f975..1dd7b0a2d6b2 100644 --- a/sys/dev/iscsi/iscsi_ioctl.h +++ b/sys/dev/iscsi/iscsi_ioctl.h @@ -43,6 +43,7 @@ #define ISCSI_ADDR_LEN 47 /* INET6_ADDRSTRLEN + '\0' */ #define ISCSI_ALIAS_LEN 256 /* XXX: Where did it come from? */ #define ISCSI_SECRET_LEN 17 /* 16 + '\0' */ +#define ISCSI_OFFLOAD_LEN 8 #define ISCSI_REASON_LEN 64 #define ISCSI_DIGEST_NONE 0 @@ -65,7 +66,16 @@ struct iscsi_session_conf { int isc_header_digest; int isc_data_digest; int isc_iser; - int isc_spare[4]; + char isc_offload[ISCSI_OFFLOAD_LEN]; + int isc_spare[2]; +}; + +/* + * Additional constraints imposed by chosen ICL offload module; + * iscsid(8) must obey those when negotiating operational parameters. + */ +struct iscsi_session_limits { + size_t isl_max_data_segment_length; }; /* @@ -81,20 +91,21 @@ struct iscsi_session_state { int iss_immediate_data; int iss_connected; char iss_reason[ISCSI_REASON_LEN]; - int iss_spare[4]; + char iss_offload[ISCSI_OFFLOAD_LEN]; + int iss_spare[2]; }; /* - * For use with iscsid(8). + * The following ioctls are used by iscsid(8). */ - struct iscsi_daemon_request { unsigned int idr_session_id; struct iscsi_session_conf idr_conf; uint8_t idr_isid[6]; uint16_t idr_tsih; uint16_t idr_spare_cid; - int idr_spare[4]; + struct iscsi_session_limits idr_limits; + int idr_spare[2]; }; struct iscsi_daemon_handoff { @@ -182,9 +193,8 @@ struct iscsi_daemon_receive { #endif /* ICL_KERNEL_PROXY */ /* - * For use with iscsictl(8). + * The following ioctls are used by iscsictl(8). */ - struct iscsi_session_add { struct iscsi_session_conf isa_conf; int isa_spare[4]; |