nvme/tcp: add the function nvme_tcp_readv_data
Change-Id: I0a1ad0a4dc265ced10b0ce761d38a679fa06bacf Signed-off-by: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447579 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
626ceb20fe
commit
78a24106d4
@ -283,17 +283,16 @@ end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvme_tcp_read_data(struct spdk_sock *sock, int bytes,
|
nvme_tcp_readv_data(struct spdk_sock *sock, struct iovec *iov, int iovcnt)
|
||||||
void *buf)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
assert(sock != NULL);
|
assert(sock != NULL);
|
||||||
if (bytes == 0) {
|
if (iov == NULL || iovcnt == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = spdk_sock_recv(sock, buf, bytes);
|
ret = spdk_sock_readv(sock, iov, iovcnt);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
return ret;
|
return ret;
|
||||||
@ -306,15 +305,28 @@ nvme_tcp_read_data(struct spdk_sock *sock, int bytes,
|
|||||||
|
|
||||||
/* For connect reset issue, do not output error log */
|
/* For connect reset issue, do not output error log */
|
||||||
if (errno == ECONNRESET) {
|
if (errno == ECONNRESET) {
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_NVME, "spdk_sock_recv() failed, errno %d: %s\n",
|
SPDK_DEBUGLOG(SPDK_LOG_NVME, "spdk_sock_readv() failed, errno %d: %s\n",
|
||||||
errno, spdk_strerror(errno));
|
errno, spdk_strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
SPDK_ERRLOG("spdk_sock_recv() failed, errno %d: %s\n",
|
SPDK_ERRLOG("spdk_sock_readv() failed, errno %d: %s\n",
|
||||||
errno, spdk_strerror(errno));
|
errno, spdk_strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* connection closed */
|
||||||
return NVME_TCP_CONNECTION_FATAL;
|
return NVME_TCP_CONNECTION_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
nvme_tcp_read_data(struct spdk_sock *sock, int bytes,
|
||||||
|
void *buf)
|
||||||
|
{
|
||||||
|
struct iovec iov;
|
||||||
|
|
||||||
|
iov.iov_base = buf;
|
||||||
|
iov.iov_len = bytes;
|
||||||
|
|
||||||
|
return nvme_tcp_readv_data(sock, &iov, 1);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* SPDK_INTERNAL_NVME_TCP_H */
|
#endif /* SPDK_INTERNAL_NVME_TCP_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user