lib/iscsi: Use rsp_pdu->data_buf_len in iscsi_op_login_rsp_handle()

Use rsp_pdu->data_buf_len in iscsi_op_login_rsp_handle() and its
calling functions.

This makes the code a little clearer.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I89aa7155e97c1b770b333f7f12e84e13811af953
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471470
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-10-16 17:19:10 +09:00 committed by Jim Harris
parent 49f0d6192a
commit 7015e6b5d5

View File

@ -1927,7 +1927,7 @@ iscsi_op_login_store_incoming_params(struct spdk_iscsi_conn *conn,
static int static int
iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn, iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_pdu *rsp_pdu, struct spdk_iscsi_pdu *rsp_pdu,
struct iscsi_param *params, int alloc_len) struct iscsi_param *params)
{ {
const char *auth_method; const char *auth_method;
int rc; int rc;
@ -1949,7 +1949,7 @@ iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn,
conn->authenticated = true; conn->authenticated = true;
} else { } else {
rc = iscsi_auth_params(conn, params, auth_method, rc = iscsi_auth_params(conn, params, auth_method,
rsp_pdu->data, alloc_len, rsp_pdu->data, rsp_pdu->data_buf_len,
rsp_pdu->data_segment_len); rsp_pdu->data_segment_len);
if (rc < 0) { if (rc < 0) {
SPDK_ERRLOG("iscsi_auth_params() failed\n"); SPDK_ERRLOG("iscsi_auth_params() failed\n");
@ -2120,15 +2120,15 @@ iscsi_op_login_rsp_handle_t_bit(struct spdk_iscsi_conn *conn,
*/ */
static int static int
iscsi_op_login_rsp_handle(struct spdk_iscsi_conn *conn, iscsi_op_login_rsp_handle(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param **params, struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param **params)
int alloc_len)
{ {
int rc; int rc;
struct iscsi_bhs_login_rsp *rsph; struct iscsi_bhs_login_rsp *rsph;
rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs; rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs;
/* negotiate parameters */ /* negotiate parameters */
rc = spdk_iscsi_negotiate_params(conn, params, rsp_pdu->data, alloc_len, rc = spdk_iscsi_negotiate_params(conn, params, rsp_pdu->data,
rsp_pdu->data_buf_len,
rsp_pdu->data_segment_len); rsp_pdu->data_segment_len);
if (rc < 0) { if (rc < 0) {
/* /*
@ -2145,8 +2145,7 @@ iscsi_op_login_rsp_handle(struct spdk_iscsi_conn *conn,
SPDK_LOGDUMP(SPDK_LOG_ISCSI, "Negotiated Params", rsp_pdu->data, rc); SPDK_LOGDUMP(SPDK_LOG_ISCSI, "Negotiated Params", rsp_pdu->data, rc);
/* handle the CSG bit case */ /* handle the CSG bit case */
rc = iscsi_op_login_rsp_handle_csg_bit(conn, rsp_pdu, *params, rc = iscsi_op_login_rsp_handle_csg_bit(conn, rsp_pdu, *params);
alloc_len);
if (rc < 0) { if (rc < 0) {
return rc; return rc;
} }
@ -2207,7 +2206,7 @@ iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
} }
} }
rc = iscsi_op_login_rsp_handle(conn, rsp_pdu, &params, rsp_pdu->data_buf_len); rc = iscsi_op_login_rsp_handle(conn, rsp_pdu, &params);
if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE) { if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE) {
iscsi_op_login_response(conn, rsp_pdu, params); iscsi_op_login_response(conn, rsp_pdu, params);
return rc; return rc;