aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend_iscsi.c
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2016-08-25 05:22:53 +0000
committerNavdeep Parhar <np@FreeBSD.org>2016-08-25 05:22:53 +0000
commit97b84d344d4a7bb9e34703948e31be5247318a71 (patch)
tree956a2021fa5a85180b18e0c435a8cdcba6356718 /sys/cam/ctl/ctl_frontend_iscsi.c
parent02d99265593c8c13ae08eaa7a962531bcd9889a0 (diff)
downloadsrc-97b84d344d4a7bb9e34703948e31be5247318a71.tar.gz
src-97b84d344d4a7bb9e34703948e31be5247318a71.zip
Make the iSCSI parameter negotiation more flexible.
Decouple the send and receive limits on the amount of data in a single iSCSI PDU. MaxRecvDataSegmentLength is declarative, not negotiated, and is direction-specific so there is no reason for both ends to limit themselves to the same min(initiator, target) value in both directions. Allow iSCSI drivers to report their send, receive, first burst, and max burst limits explicitly instead of using hardcoded values or trying to derive all of them from the receive limit (which was the only limit reported by the drivers prior to this change). Display the send and receive limits separately in the userspace iSCSI utilities. Reviewed by: jpaetzel@ (earlier version), trasz@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7279
Notes
Notes: svn path=/head/; revision=304787
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_iscsi.c')
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 70de5fa79b0f..98e33faa62c0 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -1512,7 +1512,8 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci)
*/
cs->cs_cmdsn = cihp->cmdsn;
cs->cs_statsn = cihp->statsn;
- cs->cs_max_data_segment_length = cihp->max_recv_data_segment_length;
+ cs->cs_max_recv_data_segment_length = cihp->max_recv_data_segment_length;
+ cs->cs_max_send_data_segment_length = cihp->max_send_data_segment_length;
cs->cs_max_burst_length = cihp->max_burst_length;
cs->cs_first_burst_length = cihp->first_burst_length;
cs->cs_immediate_data = !!cihp->immediate_data;
@@ -1652,9 +1653,10 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci)
"<target_portal_group_tag>%u</target_portal_group_tag>"
"<header_digest>%s</header_digest>"
"<data_digest>%s</data_digest>"
- "<max_data_segment_length>%zd</max_data_segment_length>"
- "<max_burst_length>%zd</max_burst_length>"
- "<first_burst_length>%zd</first_burst_length>"
+ "<max_recv_data_segment_length>%d</max_recv_data_segment_length>"
+ "<max_send_data_segment_length>%d</max_send_data_segment_length>"
+ "<max_burst_length>%d</max_burst_length>"
+ "<first_burst_length>%d</first_burst_length>"
"<immediate_data>%d</immediate_data>"
"<iser>%d</iser>"
"<offload>%s</offload>"
@@ -1665,7 +1667,8 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci)
cs->cs_target->ct_tag,
cs->cs_conn->ic_header_crc32c ? "CRC32C" : "None",
cs->cs_conn->ic_data_crc32c ? "CRC32C" : "None",
- cs->cs_max_data_segment_length,
+ cs->cs_max_recv_data_segment_length,
+ cs->cs_max_send_data_segment_length,
cs->cs_max_burst_length,
cs->cs_first_burst_length,
cs->cs_immediate_data,
@@ -1794,12 +1797,12 @@ static void
cfiscsi_ioctl_limits(struct ctl_iscsi *ci)
{
struct ctl_iscsi_limits_params *cilp;
+ struct icl_drv_limits idl;
int error;
cilp = (struct ctl_iscsi_limits_params *)&(ci->data);
- error = icl_limits(cilp->offload, false,
- &cilp->data_segment_limit);
+ error = icl_limits(cilp->offload, false, &idl);
if (error != 0) {
ci->status = CTL_ISCSI_ERROR;
snprintf(ci->error_str, sizeof(ci->error_str),
@@ -1808,6 +1811,13 @@ cfiscsi_ioctl_limits(struct ctl_iscsi *ci)
return;
}
+ cilp->max_recv_data_segment_length =
+ idl.idl_max_recv_data_segment_length;
+ cilp->max_send_data_segment_length =
+ idl.idl_max_send_data_segment_length;
+ cilp->max_burst_length = idl.idl_max_burst_length;
+ cilp->first_burst_length = idl.idl_first_burst_length;
+
ci->status = CTL_ISCSI_OK;
}
@@ -2466,12 +2476,12 @@ cfiscsi_datamove_in(union ctl_io *io)
/*
* Truncate to maximum data segment length.
*/
- KASSERT(response->ip_data_len < cs->cs_max_data_segment_length,
- ("ip_data_len %zd >= max_data_segment_length %zd",
- response->ip_data_len, cs->cs_max_data_segment_length));
+ KASSERT(response->ip_data_len < cs->cs_max_send_data_segment_length,
+ ("ip_data_len %zd >= max_send_data_segment_length %d",
+ response->ip_data_len, cs->cs_max_send_data_segment_length));
if (response->ip_data_len + len >
- cs->cs_max_data_segment_length) {
- len = cs->cs_max_data_segment_length -
+ cs->cs_max_send_data_segment_length) {
+ len = cs->cs_max_send_data_segment_length -
response->ip_data_len;
KASSERT(len <= sg_len, ("len %zd > sg_len %zd",
len, sg_len));
@@ -2529,7 +2539,7 @@ cfiscsi_datamove_in(union ctl_io *io)
i++;
}
- if (response->ip_data_len == cs->cs_max_data_segment_length) {
+ if (response->ip_data_len == cs->cs_max_send_data_segment_length) {
/*
* Can't stuff more data into the current PDU;
* queue it. Note that's not enough to check