iscsi: Fix the case that incoming data is split into multiple packets
We had not considered a case that incoming data to the second data buffer was split into multiple TCP packets when merging incoming data up to 64KB. We do not change the unit test because we already have data check and it is very hard to include partial read into the data check. However, it is very usual that incoming data is split into multple TCP packets. The feature to merge incoming data up to 64KB will be actually enabled in the following patches. So we rely on the I/O test to verify this fix. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I50d702d6c118bc16f0767845136e14414ccdf813 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9736 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
1d269b072e
commit
e536464357
@ -4644,24 +4644,26 @@ iscsi_pdu_payload_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
pdu->data = mobj->buf;
|
||||
pdu->data_from_mempool = true;
|
||||
} else if (mobj->data_len == SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
|
||||
/* The first data buffer ran out. Allocate the second data buffer and
|
||||
* continue reading the data segment.
|
||||
*/
|
||||
assert(pdu->mobj[1] == NULL);
|
||||
assert(pdu->data_from_mempool == true);
|
||||
assert(!pdu->dif_insert_or_strip);
|
||||
|
||||
if (conn->data_digest) {
|
||||
iscsi_pdu_calc_partial_data_digest(pdu);
|
||||
}
|
||||
mobj = iscsi_datapool_get(g_iscsi.pdu_data_out_pool);
|
||||
mobj = pdu->mobj[1];
|
||||
if (mobj == NULL) {
|
||||
return 1;
|
||||
/* The first data buffer just ran out. Allocate the second data buffer and
|
||||
* continue reading the data segment.
|
||||
*/
|
||||
assert(pdu->data_from_mempool == true);
|
||||
assert(!pdu->dif_insert_or_strip);
|
||||
|
||||
if (conn->data_digest) {
|
||||
iscsi_pdu_calc_partial_data_digest(pdu);
|
||||
}
|
||||
mobj = iscsi_datapool_get(g_iscsi.pdu_data_out_pool);
|
||||
if (mobj == NULL) {
|
||||
return 1;
|
||||
}
|
||||
pdu->mobj[1] = mobj;
|
||||
pdu->data = mobj->buf;
|
||||
pdu->data_offset = pdu->data_valid_bytes;
|
||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||
}
|
||||
pdu->mobj[1] = mobj;
|
||||
pdu->data = mobj->buf;
|
||||
pdu->data_offset = pdu->data_valid_bytes;
|
||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||
}
|
||||
|
||||
/* copy the actual data into local buffer */
|
||||
|
Loading…
Reference in New Issue
Block a user