iscsi: Properly size the receive buffer
Signed-off-by: Ben Walker <benjamin.walker@intel.com> Change-Id: Id736c8a6d9a2cb8bd23017f61eeeccca8a882c03 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1636 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
0accbe8a37
commit
49826b36cf
@ -40,6 +40,7 @@
|
|||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
#include "spdk/likely.h"
|
#include "spdk/likely.h"
|
||||||
#include "spdk/trace.h"
|
#include "spdk/trace.h"
|
||||||
|
#include "spdk/sock.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
#include "spdk/queue.h"
|
#include "spdk/queue.h"
|
||||||
#include "spdk/net.h"
|
#include "spdk/net.h"
|
||||||
@ -1100,6 +1101,7 @@ static int
|
|||||||
iscsi_conn_params_update(struct spdk_iscsi_conn *conn)
|
iscsi_conn_params_update(struct spdk_iscsi_conn *conn)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
uint32_t recv_buf_size;
|
||||||
|
|
||||||
/* update internal variables */
|
/* update internal variables */
|
||||||
rc = spdk_iscsi_copy_param2var(conn);
|
rc = spdk_iscsi_copy_param2var(conn);
|
||||||
@ -1120,6 +1122,27 @@ iscsi_conn_params_update(struct spdk_iscsi_conn *conn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The socket receive buffer may need to be adjusted based on the new parameters */
|
||||||
|
|
||||||
|
/* Don't allow the recv buffer to be 0 or very large. */
|
||||||
|
recv_buf_size = spdk_max(0x1000, spdk_min(0x2000, conn->sess->FirstBurstLength));
|
||||||
|
|
||||||
|
/* Add in extra space for the PDU */
|
||||||
|
recv_buf_size += ISCSI_BHS_LEN + ISCSI_AHS_LEN;
|
||||||
|
|
||||||
|
if (conn->header_digest) {
|
||||||
|
recv_buf_size += ISCSI_DIGEST_LEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conn->data_digest) {
|
||||||
|
recv_buf_size += ISCSI_DIGEST_LEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set up to buffer up to 4 commands with immediate data at once */
|
||||||
|
if (spdk_sock_set_recvbuf(conn->sock, recv_buf_size * 4) < 0) {
|
||||||
|
/* Not fatal. */
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,8 @@ DEFINE_STUB(spdk_iscsi_chap_get_authinfo, int,
|
|||||||
(struct iscsi_chap_auth *auth, const char *authuser, int ag_tag),
|
(struct iscsi_chap_auth *auth, const char *authuser, int ag_tag),
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
DEFINE_STUB(spdk_sock_set_recvbuf, int, (struct spdk_sock *sock, int sz), 0);
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_scsi_lun_get_id(const struct spdk_scsi_lun *lun)
|
spdk_scsi_lun_get_id(const struct spdk_scsi_lun *lun)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user