Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ctl/ctl_frontend_iscsi.c
Show First 20 Lines • Show All 1,506 Lines • ▼ Show 20 Lines | #endif | ||||
/* | /* | ||||
* First PDU of Full Feature phase has the same CmdSN as the last | * First PDU of Full Feature phase has the same CmdSN as the last | ||||
* PDU from the Login Phase received from the initiator. Thus, | * PDU from the Login Phase received from the initiator. Thus, | ||||
* the -1 below. | * the -1 below. | ||||
*/ | */ | ||||
cs->cs_cmdsn = cihp->cmdsn; | cs->cs_cmdsn = cihp->cmdsn; | ||||
cs->cs_statsn = cihp->statsn; | 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_max_burst_length = cihp->max_burst_length; | ||||
cs->cs_first_burst_length = cihp->first_burst_length; | cs->cs_first_burst_length = cihp->first_burst_length; | ||||
cs->cs_immediate_data = !!cihp->immediate_data; | cs->cs_immediate_data = !!cihp->immediate_data; | ||||
if (cihp->header_digest == CTL_ISCSI_DIGEST_CRC32C) | if (cihp->header_digest == CTL_ISCSI_DIGEST_CRC32C) | ||||
cs->cs_conn->ic_header_crc32c = true; | cs->cs_conn->ic_header_crc32c = true; | ||||
if (cihp->data_digest == CTL_ISCSI_DIGEST_CRC32C) | if (cihp->data_digest == CTL_ISCSI_DIGEST_CRC32C) | ||||
cs->cs_conn->ic_data_crc32c = true; | cs->cs_conn->ic_data_crc32c = true; | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | error = sbuf_printf(sb, "<connection id=\"%d\">" | ||||
"<initiator>%s</initiator>" | "<initiator>%s</initiator>" | ||||
"<initiator_addr>%s</initiator_addr>" | "<initiator_addr>%s</initiator_addr>" | ||||
"<initiator_alias>%s</initiator_alias>" | "<initiator_alias>%s</initiator_alias>" | ||||
"<target>%s</target>" | "<target>%s</target>" | ||||
"<target_alias>%s</target_alias>" | "<target_alias>%s</target_alias>" | ||||
"<target_portal_group_tag>%u</target_portal_group_tag>" | "<target_portal_group_tag>%u</target_portal_group_tag>" | ||||
"<header_digest>%s</header_digest>" | "<header_digest>%s</header_digest>" | ||||
"<data_digest>%s</data_digest>" | "<data_digest>%s</data_digest>" | ||||
"<max_data_segment_length>%zd</max_data_segment_length>" | "<max_recv_data_segment_length>%d</max_recv_data_segment_length>" | ||||
"<max_burst_length>%zd</max_burst_length>" | "<max_send_data_segment_length>%d</max_send_data_segment_length>" | ||||
"<first_burst_length>%zd</first_burst_length>" | "<max_burst_length>%d</max_burst_length>" | ||||
"<first_burst_length>%d</first_burst_length>" | |||||
"<immediate_data>%d</immediate_data>" | "<immediate_data>%d</immediate_data>" | ||||
"<iser>%d</iser>" | "<iser>%d</iser>" | ||||
"<offload>%s</offload>" | "<offload>%s</offload>" | ||||
"</connection>\n", | "</connection>\n", | ||||
cs->cs_id, | cs->cs_id, | ||||
cs->cs_initiator_name, cs->cs_initiator_addr, cs->cs_initiator_alias, | cs->cs_initiator_name, cs->cs_initiator_addr, cs->cs_initiator_alias, | ||||
cs->cs_target->ct_name, cs->cs_target->ct_alias, | cs->cs_target->ct_name, cs->cs_target->ct_alias, | ||||
cs->cs_target->ct_tag, | cs->cs_target->ct_tag, | ||||
cs->cs_conn->ic_header_crc32c ? "CRC32C" : "None", | cs->cs_conn->ic_header_crc32c ? "CRC32C" : "None", | ||||
cs->cs_conn->ic_data_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_max_burst_length, | ||||
cs->cs_first_burst_length, | cs->cs_first_burst_length, | ||||
cs->cs_immediate_data, | cs->cs_immediate_data, | ||||
cs->cs_conn->ic_iser, | cs->cs_conn->ic_iser, | ||||
cs->cs_conn->ic_offload); | cs->cs_conn->ic_offload); | ||||
if (error != 0) | if (error != 0) | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | cfiscsi_ioctl_terminate(struct ctl_iscsi *ci) | ||||
ci->status = CTL_ISCSI_OK; | ci->status = CTL_ISCSI_OK; | ||||
} | } | ||||
static void | static void | ||||
cfiscsi_ioctl_limits(struct ctl_iscsi *ci) | cfiscsi_ioctl_limits(struct ctl_iscsi *ci) | ||||
{ | { | ||||
struct ctl_iscsi_limits_params *cilp; | struct ctl_iscsi_limits_params *cilp; | ||||
struct icl_drv_limits idl; | |||||
int error; | int error; | ||||
cilp = (struct ctl_iscsi_limits_params *)&(ci->data); | cilp = (struct ctl_iscsi_limits_params *)&(ci->data); | ||||
error = icl_limits(cilp->offload, false, | error = icl_limits(cilp->offload, false, &idl); | ||||
&cilp->data_segment_limit); | |||||
if (error != 0) { | if (error != 0) { | ||||
ci->status = CTL_ISCSI_ERROR; | ci->status = CTL_ISCSI_ERROR; | ||||
snprintf(ci->error_str, sizeof(ci->error_str), | snprintf(ci->error_str, sizeof(ci->error_str), | ||||
"%s: icl_limits failed with error %d", | "%s: icl_limits failed with error %d", | ||||
__func__, error); | __func__, error); | ||||
return; | 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; | ci->status = CTL_ISCSI_OK; | ||||
} | } | ||||
#ifdef ICL_KERNEL_PROXY | #ifdef ICL_KERNEL_PROXY | ||||
static void | static void | ||||
cfiscsi_ioctl_listen(struct ctl_iscsi *ci) | cfiscsi_ioctl_listen(struct ctl_iscsi *ci) | ||||
{ | { | ||||
struct ctl_iscsi_listen_params *cilp; | struct ctl_iscsi_listen_params *cilp; | ||||
▲ Show 20 Lines • Show All 642 Lines • ▼ Show 20 Lines | if (sg_len == 0) { | ||||
KASSERT(sg_len > 0, ("sg_len <= 0")); | KASSERT(sg_len > 0, ("sg_len <= 0")); | ||||
} | } | ||||
len = sg_len; | len = sg_len; | ||||
/* | /* | ||||
* Truncate to maximum data segment length. | * Truncate to maximum data segment length. | ||||
*/ | */ | ||||
KASSERT(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_data_segment_length %zd", | ("ip_data_len %zd >= max_send_data_segment_length %d", | ||||
response->ip_data_len, cs->cs_max_data_segment_length)); | response->ip_data_len, cs->cs_max_send_data_segment_length)); | ||||
if (response->ip_data_len + len > | if (response->ip_data_len + len > | ||||
cs->cs_max_data_segment_length) { | cs->cs_max_send_data_segment_length) { | ||||
len = cs->cs_max_data_segment_length - | len = cs->cs_max_send_data_segment_length - | ||||
response->ip_data_len; | response->ip_data_len; | ||||
KASSERT(len <= sg_len, ("len %zd > sg_len %zd", | KASSERT(len <= sg_len, ("len %zd > sg_len %zd", | ||||
len, sg_len)); | len, sg_len)); | ||||
} | } | ||||
/* | /* | ||||
* Truncate to expected data transfer length. | * Truncate to expected data transfer length. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | if (sg_len == 0) { | ||||
/* | /* | ||||
* ... unless this was the last one. | * ... unless this was the last one. | ||||
*/ | */ | ||||
break; | break; | ||||
} | } | ||||
i++; | 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; | * Can't stuff more data into the current PDU; | ||||
* queue it. Note that's not enough to check | * queue it. Note that's not enough to check | ||||
* for kern_data_resid == 0 instead; there | * for kern_data_resid == 0 instead; there | ||||
* may be several Data-In PDUs for the final | * may be several Data-In PDUs for the final | ||||
* call to cfiscsi_datamove(), and we want | * call to cfiscsi_datamove(), and we want | ||||
* to set the F flag only on the last of them. | * to set the F flag only on the last of them. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 429 Lines • Show Last 20 Lines |