nvme/tcp: fix the iov vector count.

Since we use pdu->data_iovcnt to
build the iov in nvme_tcp_build_iovs, so
send out pdu has the maximal iov number
equals to: 2 + pdu->data_iovcnt,
so we change the comparison.

This makes sure that we can handle all the data
owned by one pdu.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I2b9258cc5716d706c0fa38af609726c439708768
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467207
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Ziye Yang 2019-09-03 22:28:13 +08:00 committed by Changpeng Liu
parent 2a65e28e56
commit 24eb7a84b0
2 changed files with 3 additions and 3 deletions

View File

@ -402,7 +402,7 @@ nvme_tcp_qpair_process_send_queue(struct nvme_tcp_qpair *tqpair)
* Build up a list of iovecs for the first few PDUs in the
* tqpair 's send_queue.
*/
while (pdu != NULL && ((array_size - iovcnt) >= 3)) {
while (pdu != NULL && ((array_size - iovcnt) >= (2 + (int)pdu->data_iovcnt))) {
iovcnt += nvme_tcp_build_iovs(&iovs[iovcnt], array_size - iovcnt,
pdu, tqpair->host_hdgst_enable,
tqpair->host_ddgst_enable, &mapped_length);

View File

@ -782,7 +782,7 @@ spdk_nvmf_tcp_qpair_flush_pdus_internal(struct spdk_nvmf_tcp_qpair *tqpair)
int iovcnt = 0;
int bytes = 0;
int total_length = 0;
uint32_t mapped_length;
uint32_t mapped_length = 0;
struct nvme_tcp_pdu *pdu;
int pdu_length;
TAILQ_HEAD(, nvme_tcp_pdu) completed_pdus_list;
@ -797,7 +797,7 @@ spdk_nvmf_tcp_qpair_flush_pdus_internal(struct spdk_nvmf_tcp_qpair *tqpair)
* Build up a list of iovecs for the first few PDUs in the
* tqpair 's send_queue.
*/
while (pdu != NULL && ((array_size - iovcnt) >= 3)) {
while (pdu != NULL && ((array_size - iovcnt) >= (2 + (int)pdu->data_iovcnt))) {
iovcnt += nvme_tcp_build_iovs(&iovs[iovcnt],
array_size - iovcnt,
pdu,