lib/iscsi: Move spdk_iscsi_execute() from iscsi_conn_handle_incoming_pdus() to spdk_iscsi_read_pdu()
Move spdk_iscsi_execute() from iscsi_conn_handle_incoming_pdus() to spdk_iscsi_read_pdu() and then strip the prefix spdk_ from spdk_iscsi_execute() and make it private. This is to introduce state machine into receive incoming PDU processing. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I5d5b3e55ece0994532e924d3c75d898cb373875c Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470287 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>
This commit is contained in:
parent
349b772415
commit
52e2b86b33
@ -1396,27 +1396,17 @@ spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
|
|||||||
static int
|
static int
|
||||||
iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn)
|
iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_pdu *pdu;
|
|
||||||
int i, rc;
|
int i, rc;
|
||||||
|
|
||||||
/* Read new PDUs from network */
|
/* Read new PDUs from network */
|
||||||
for (i = 0; i < GET_PDU_LOOP_COUNT; i++) {
|
for (i = 0; i < GET_PDU_LOOP_COUNT; i++) {
|
||||||
rc = spdk_iscsi_read_pdu(conn, &pdu);
|
rc = spdk_iscsi_read_pdu(conn);
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
break;
|
break;
|
||||||
} else if (rc < 0) {
|
} else if (rc < 0) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_iscsi_execute(conn, pdu);
|
|
||||||
if (rc == 0) {
|
|
||||||
spdk_trace_record(TRACE_ISCSI_TASK_EXECUTED, 0, 0, (uintptr_t)pdu, 0);
|
|
||||||
}
|
|
||||||
spdk_put_pdu(pdu);
|
|
||||||
if (rc < 0) {
|
|
||||||
return SPDK_ISCSI_CONNECTION_FATAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->is_stopped) {
|
if (conn->is_stopped) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4446,8 +4446,8 @@ remove_acked_pdu(struct spdk_iscsi_conn *conn, uint32_t ExpStatSN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||||
{
|
{
|
||||||
int opcode;
|
int opcode;
|
||||||
int rc;
|
int rc;
|
||||||
@ -4587,7 +4587,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_pdu *pdu;
|
struct spdk_iscsi_pdu *pdu;
|
||||||
struct spdk_mempool *pool;
|
struct spdk_mempool *pool;
|
||||||
@ -4738,7 +4738,15 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
|||||||
return SPDK_ISCSI_CONNECTION_FATAL;
|
return SPDK_ISCSI_CONNECTION_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*_pdu = pdu;
|
rc = iscsi_execute(conn, pdu);
|
||||||
|
if (rc == 0) {
|
||||||
|
spdk_trace_record(TRACE_ISCSI_TASK_EXECUTED, 0, 0, (uintptr_t)pdu, 0);
|
||||||
|
}
|
||||||
|
spdk_put_pdu(pdu);
|
||||||
|
if (rc < 0) {
|
||||||
|
return SPDK_ISCSI_CONNECTION_FATAL;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -410,10 +410,9 @@ void spdk_iscsi_auth_groups_info_json(struct spdk_json_write_ctx *w);
|
|||||||
void spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn);
|
void spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn);
|
||||||
void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
|
void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
|
||||||
struct spdk_iscsi_task *task);
|
struct spdk_iscsi_task *task);
|
||||||
int spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu);
|
|
||||||
int spdk_iscsi_build_iovs(struct spdk_iscsi_conn *conn, struct iovec *iovs, int iovcnt,
|
int spdk_iscsi_build_iovs(struct spdk_iscsi_conn *conn, struct iovec *iovs, int iovcnt,
|
||||||
struct spdk_iscsi_pdu *pdu, uint32_t *mapped_length);
|
struct spdk_iscsi_pdu *pdu, uint32_t *mapped_length);
|
||||||
int spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu);
|
int spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn);
|
||||||
bool spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
|
bool spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
|
||||||
struct spdk_dif_ctx *dif_ctx);
|
struct spdk_dif_ctx *dif_ctx);
|
||||||
void spdk_iscsi_task_mgmt_response(struct spdk_iscsi_conn *conn,
|
void spdk_iscsi_task_mgmt_response(struct spdk_iscsi_conn *conn,
|
||||||
|
@ -142,17 +142,13 @@ DEFINE_STUB_V(spdk_iscsi_task_mgmt_response,
|
|||||||
|
|
||||||
DEFINE_STUB_V(spdk_iscsi_send_nopin, (struct spdk_iscsi_conn *conn));
|
DEFINE_STUB_V(spdk_iscsi_send_nopin, (struct spdk_iscsi_conn *conn));
|
||||||
|
|
||||||
DEFINE_STUB(spdk_iscsi_execute, int,
|
|
||||||
(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu), 0);
|
|
||||||
|
|
||||||
DEFINE_STUB_V(spdk_del_transfer_task,
|
DEFINE_STUB_V(spdk_del_transfer_task,
|
||||||
(struct spdk_iscsi_conn *conn, uint32_t task_tag));
|
(struct spdk_iscsi_conn *conn, uint32_t task_tag));
|
||||||
|
|
||||||
DEFINE_STUB(spdk_iscsi_conn_handle_queued_datain_tasks, int,
|
DEFINE_STUB(spdk_iscsi_conn_handle_queued_datain_tasks, int,
|
||||||
(struct spdk_iscsi_conn *conn), 0);
|
(struct spdk_iscsi_conn *conn), 0);
|
||||||
|
|
||||||
DEFINE_STUB(spdk_iscsi_read_pdu, int,
|
DEFINE_STUB(spdk_iscsi_read_pdu, int, (struct spdk_iscsi_conn *conn), 0);
|
||||||
(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu), 0);
|
|
||||||
|
|
||||||
DEFINE_STUB_V(spdk_free_sess, (struct spdk_iscsi_sess *sess));
|
DEFINE_STUB_V(spdk_free_sess, (struct spdk_iscsi_sess *sess));
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ maxburstlength_test(void)
|
|||||||
req->write_bit = 1;
|
req->write_bit = 1;
|
||||||
req->final_bit = 1;
|
req->final_bit = 1;
|
||||||
|
|
||||||
rc = spdk_iscsi_execute(&conn, req_pdu);
|
rc = iscsi_execute(&conn, req_pdu);
|
||||||
CU_ASSERT(rc == 0);
|
CU_ASSERT(rc == 0);
|
||||||
|
|
||||||
response_pdu = TAILQ_FIRST(&g_write_pdu_list);
|
response_pdu = TAILQ_FIRST(&g_write_pdu_list);
|
||||||
@ -320,7 +320,7 @@ maxburstlength_test(void)
|
|||||||
data_out->ttt = r2t->ttt;
|
data_out->ttt = r2t->ttt;
|
||||||
DSET24(data_out->data_segment_len, 1028);
|
DSET24(data_out->data_segment_len, 1028);
|
||||||
|
|
||||||
rc = spdk_iscsi_execute(&conn, data_out_pdu);
|
rc = iscsi_execute(&conn, data_out_pdu);
|
||||||
CU_ASSERT(rc == SPDK_ISCSI_CONNECTION_FATAL);
|
CU_ASSERT(rc == SPDK_ISCSI_CONNECTION_FATAL);
|
||||||
|
|
||||||
SPDK_CU_ASSERT_FATAL(response_pdu->task != NULL);
|
SPDK_CU_ASSERT_FATAL(response_pdu->task != NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user