lib/iscsi: Move PDU receive repetition into the same file as PDU receive state machine
To make the code clearer, - make the spdk_iscsi_read_pdu() private in iscsi.c and named iscsi_read_pdu(), and - make the iscsi_conn_handle_incoming_pdus() public and named spdk_iscsi_handle_incoming_pdus(). Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I967681b8e9b86681a906b18719e91e1d387450d7 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469969 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> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
4b741fe65e
commit
5b963d40fd
@ -1393,30 +1393,6 @@ spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
|
||||
iscsi_conn_flush_pdus(conn);
|
||||
}
|
||||
|
||||
#define GET_PDU_LOOP_COUNT 16
|
||||
|
||||
static int
|
||||
iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn)
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
/* Read new PDUs from network */
|
||||
for (i = 0; i < GET_PDU_LOOP_COUNT; i++) {
|
||||
rc = spdk_iscsi_read_pdu(conn);
|
||||
if (rc == 0) {
|
||||
break;
|
||||
} else if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (conn->is_stopped) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static void
|
||||
iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_sock *sock)
|
||||
{
|
||||
@ -1431,7 +1407,7 @@ iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_sock *s
|
||||
}
|
||||
|
||||
/* Handle incoming PDUs */
|
||||
rc = iscsi_conn_handle_incoming_pdus(conn);
|
||||
rc = spdk_iscsi_handle_incoming_pdus(conn);
|
||||
if (rc < 0) {
|
||||
conn->state = ISCSI_CONN_STATE_EXITING;
|
||||
}
|
||||
|
@ -4586,8 +4586,8 @@ iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn)
|
||||
static int
|
||||
iscsi_read_pdu(struct spdk_iscsi_conn *conn)
|
||||
{
|
||||
enum iscsi_pdu_recv_state prev_state;
|
||||
struct spdk_iscsi_pdu *pdu;
|
||||
@ -4780,6 +4780,30 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define GET_PDU_LOOP_COUNT 16
|
||||
|
||||
int
|
||||
spdk_iscsi_handle_incoming_pdus(struct spdk_iscsi_conn *conn)
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
/* Read new PDUs from network */
|
||||
for (i = 0; i < GET_PDU_LOOP_COUNT; i++) {
|
||||
rc = iscsi_read_pdu(conn);
|
||||
if (rc == 0) {
|
||||
break;
|
||||
} else if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (conn->is_stopped) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
bool
|
||||
spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
|
||||
struct spdk_dif_ctx *dif_ctx)
|
||||
|
@ -412,7 +412,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
|
||||
struct spdk_iscsi_task *task);
|
||||
int spdk_iscsi_build_iovs(struct spdk_iscsi_conn *conn, struct iovec *iovs, int iovcnt,
|
||||
struct spdk_iscsi_pdu *pdu, uint32_t *mapped_length);
|
||||
int spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn);
|
||||
int spdk_iscsi_handle_incoming_pdus(struct spdk_iscsi_conn *conn);
|
||||
bool spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
|
||||
struct spdk_dif_ctx *dif_ctx);
|
||||
void spdk_iscsi_task_mgmt_response(struct spdk_iscsi_conn *conn,
|
||||
|
@ -148,7 +148,7 @@ DEFINE_STUB_V(spdk_del_transfer_task,
|
||||
DEFINE_STUB(spdk_iscsi_conn_handle_queued_datain_tasks, int,
|
||||
(struct spdk_iscsi_conn *conn), 0);
|
||||
|
||||
DEFINE_STUB(spdk_iscsi_read_pdu, int, (struct spdk_iscsi_conn *conn), 0);
|
||||
DEFINE_STUB(spdk_iscsi_handle_incoming_pdus, int, (struct spdk_iscsi_conn *conn), 0);
|
||||
|
||||
DEFINE_STUB_V(spdk_free_sess, (struct spdk_iscsi_sess *sess));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user