diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 7de0e5042..a3c0361ee 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -128,7 +128,7 @@ _iscsi_conns_cleanup(void) } } -int spdk_initialize_iscsi_conns(void) +int initialize_iscsi_conns(void) { size_t conns_size = sizeof(struct spdk_iscsi_conn) * MAX_ISCSI_CONNECTIONS; uint32_t i; @@ -207,8 +207,8 @@ iscsi_conn_start(void *ctx) } int -spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, - struct spdk_sock *sock) +iscsi_conn_construct(struct spdk_iscsi_portal *portal, + struct spdk_sock *sock) { struct spdk_iscsi_poll_group *pg; struct spdk_iscsi_conn *conn; @@ -313,7 +313,7 @@ error_return: } void -spdk_iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { iscsi_conn_xfer_complete_cb cb_fn; void *cb_arg; @@ -340,7 +340,7 @@ iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn) TAILQ_FOREACH_SAFE(pdu, &conn->snack_pdu_list, tailq, tmp_pdu) { TAILQ_REMOVE(&conn->snack_pdu_list, pdu, tailq); - spdk_iscsi_conn_free_pdu(conn, pdu); + iscsi_conn_free_pdu(conn, pdu); } TAILQ_FOREACH_SAFE(iscsi_task, &conn->queued_datain_tasks, link, tmp_iscsi_task) { @@ -350,15 +350,15 @@ iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn) } } - /* We have to parse conn->write_pdu_list in the end. In spdk_iscsi_conn_free_pdu(), - * spdk_iscsi_conn_handle_queued_datain_tasks() may be called, and - * spdk_iscsi_conn_handle_queued_datain_tasks() will parse conn->queued_datain_tasks + /* We have to parse conn->write_pdu_list in the end. In iscsi_conn_free_pdu(), + * iscsi_conn_handle_queued_datain_tasks() may be called, and + * iscsi_conn_handle_queued_datain_tasks() will parse conn->queued_datain_tasks * and may stack some PDUs to conn->write_pdu_list. Hence when we come here, we * have to ensure there is no associated task in conn->queued_datain_tasks. */ TAILQ_FOREACH_SAFE(pdu, &conn->write_pdu_list, tailq, tmp_pdu) { TAILQ_REMOVE(&conn->write_pdu_list, pdu, tailq); - spdk_iscsi_conn_free_pdu(conn, pdu); + iscsi_conn_free_pdu(conn, pdu); } if (conn->pending_task_cnt) { @@ -481,7 +481,7 @@ iscsi_conn_check_tasks_for_lun(struct spdk_iscsi_conn *conn, TAILQ_FOREACH_SAFE(pdu, &conn->snack_pdu_list, tailq, tmp_pdu) { if (lun == pdu->task->scsi.lun) { TAILQ_REMOVE(&conn->snack_pdu_list, pdu, tailq); - spdk_iscsi_conn_free_pdu(conn, pdu); + iscsi_conn_free_pdu(conn, pdu); } } @@ -699,7 +699,7 @@ _iscsi_conn_check_pending_tasks(void *arg) } void -spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) +iscsi_conn_destruct(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_pdu *pdu; struct spdk_iscsi_task *task; @@ -726,7 +726,7 @@ spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) case ISCSI_OP_SCSI: case ISCSI_OP_SCSI_DATAOUT: spdk_scsi_task_process_abort(&task->scsi); - spdk_iscsi_task_cpl(&task->scsi); + iscsi_task_cpl(&task->scsi); break; default: SPDK_ERRLOG("unexpected opcode %x\n", opcode); @@ -751,7 +751,7 @@ spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) } int -spdk_iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target) +iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_conn *conn; int num = 0; @@ -782,7 +782,7 @@ iscsi_conn_check_shutdown_cb(void *arg1) static int iscsi_conn_check_shutdown(void *arg) { - if (spdk_iscsi_get_active_conns(NULL) != 0) { + if (iscsi_get_active_conns(NULL) != 0) { return 1; } @@ -814,7 +814,7 @@ iscsi_send_logout_request(struct spdk_iscsi_conn *conn) to_be32(&rsph->exp_cmd_sn, conn->sess->ExpCmdSN); to_be32(&rsph->max_cmd_sn, conn->sess->MaxCmdSN); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); } static int @@ -864,7 +864,7 @@ iscsi_conn_request_logout(struct spdk_iscsi_conn *conn) } void -spdk_iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target) +iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_conn *conn; int i; @@ -888,22 +888,22 @@ spdk_iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target) } void -spdk_shutdown_iscsi_conns(void) +shutdown_iscsi_conns(void) { - spdk_iscsi_conns_request_logout(NULL); + iscsi_conns_request_logout(NULL); g_shutdown_timer = SPDK_POLLER_REGISTER(iscsi_conn_check_shutdown, NULL, 1000); } int -spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn, const char *conn_match, - int drop_all) +iscsi_drop_conns(struct spdk_iscsi_conn *conn, const char *conn_match, + int drop_all) { struct spdk_iscsi_conn *xconn; const char *xconn_match; int i, num; - SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_drop_conns\n"); + SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "iscsi_drop_conns\n"); num = 0; pthread_mutex_lock(&g_conns_mutex); @@ -981,7 +981,7 @@ _iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, /* Stop split and abort read I/O for remaining data. */ if (task->current_datain_offset < task->scsi.transfer_len) { remaining_size = task->scsi.transfer_len - task->current_datain_offset; - subtask = iscsi_task_get(conn, task, spdk_iscsi_task_cpl); + subtask = iscsi_task_get(conn, task, iscsi_task_cpl); assert(subtask != NULL); subtask->scsi.offset = task->current_datain_offset; subtask->scsi.length = remaining_size; @@ -990,7 +990,7 @@ _iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, subtask->scsi.transfer_len = subtask->scsi.length; spdk_scsi_task_process_abort(&subtask->scsi); - spdk_iscsi_task_cpl(&subtask->scsi); + iscsi_task_cpl(&subtask->scsi); } /* Remove the primary task from the list because all subtasks are submitted @@ -1002,8 +1002,8 @@ _iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, } int -spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, - uint32_t ref_task_tag) +iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, + uint32_t ref_task_tag) { struct spdk_iscsi_task *task; @@ -1017,9 +1017,9 @@ spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, } int -spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, - struct spdk_scsi_lun *lun, - struct spdk_iscsi_pdu *pdu) +iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, + struct spdk_scsi_lun *lun, + struct spdk_iscsi_pdu *pdu) { struct spdk_iscsi_task *task, *task_tmp; struct spdk_iscsi_pdu *pdu_tmp; @@ -1040,7 +1040,7 @@ spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, } int -spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) +iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_task *task; @@ -1053,7 +1053,7 @@ spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) uint32_t remaining_size = 0; remaining_size = task->scsi.transfer_len - task->current_datain_offset; - subtask = iscsi_task_get(conn, task, spdk_iscsi_task_cpl); + subtask = iscsi_task_get(conn, task, iscsi_task_cpl); assert(subtask != NULL); subtask->scsi.offset = task->current_datain_offset; spdk_scsi_task_set_data(&subtask->scsi, NULL, 0); @@ -1065,7 +1065,7 @@ spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) assert(task->current_datain_offset == task->scsi.transfer_len); subtask->scsi.transfer_len = remaining_size; spdk_scsi_task_process_null_lun(&subtask->scsi); - spdk_iscsi_task_cpl(&subtask->scsi); + iscsi_task_cpl(&subtask->scsi); return 0; } @@ -1081,7 +1081,7 @@ spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) } void -spdk_iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task) +iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task) { struct spdk_iscsi_task *task = iscsi_task_from_scsi_task(scsi_task); @@ -1236,7 +1236,7 @@ process_non_read_task_completion(struct spdk_iscsi_conn *conn, } void -spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task) +iscsi_task_cpl(struct spdk_scsi_task *scsi_task) { struct spdk_iscsi_task *primary; struct spdk_iscsi_task *task = iscsi_task_from_scsi_task(scsi_task); @@ -1292,13 +1292,13 @@ iscsi_conn_send_nopin(struct spdk_iscsi_conn *conn) to_be32(&rsp->stat_sn, conn->StatSN); to_be32(&rsp->exp_cmd_sn, conn->sess->ExpCmdSN); to_be32(&rsp->max_cmd_sn, conn->sess->MaxCmdSN); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); conn->last_nopin = spdk_get_ticks(); conn->nop_outstanding = true; } void -spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn) +iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn) { uint64_t tsc; @@ -1340,8 +1340,8 @@ spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn) * Otherwise returns the number of bytes successfully read. */ int -spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes, - void *buf) +iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes, + void *buf) { int ret; @@ -1376,8 +1376,8 @@ spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes, } int -spdk_iscsi_conn_readv_data(struct spdk_iscsi_conn *conn, - struct iovec *iov, int iovcnt) +iscsi_conn_readv_data(struct spdk_iscsi_conn *conn, + struct iovec *iov, int iovcnt) { int ret; @@ -1386,8 +1386,8 @@ spdk_iscsi_conn_readv_data(struct spdk_iscsi_conn *conn, } if (iovcnt == 1) { - return spdk_iscsi_conn_read_data(conn, iov[0].iov_len, - iov[0].iov_base); + return iscsi_conn_read_data(conn, iov[0].iov_len, + iov[0].iov_base); } ret = spdk_sock_readv(conn->sock, iov, iovcnt); @@ -1481,14 +1481,19 @@ _iscsi_conn_pdu_write_done(void *cb_arg, int err) TAILQ_INSERT_TAIL(&conn->snack_pdu_list, pdu, tailq); } else { - spdk_iscsi_conn_free_pdu(conn, pdu); + iscsi_conn_free_pdu(conn, pdu); } } void -spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, - iscsi_conn_xfer_complete_cb cb_fn, - void *cb_arg) +iscsi_conn_pdu_generic_complete(void *cb_arg) +{ +} + +void +iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, + iscsi_conn_xfer_complete_cb cb_fn, + void *cb_arg) { uint32_t crc32c; ssize_t rc; @@ -1496,7 +1501,7 @@ spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p if (spdk_unlikely(pdu->dif_insert_or_strip)) { rc = iscsi_dif_verify(pdu, &pdu->dif_ctx); if (rc != 0) { - spdk_iscsi_conn_free_pdu(conn, pdu); + iscsi_conn_free_pdu(conn, pdu); conn->state = ISCSI_CONN_STATE_EXITING; return; } @@ -1569,7 +1574,7 @@ iscsi_conn_full_feature_migrate(void *arg) static struct spdk_iscsi_poll_group *g_next_pg = NULL; void -spdk_iscsi_conn_schedule(struct spdk_iscsi_conn *conn) +iscsi_conn_schedule(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_poll_group *pg; struct spdk_iscsi_tgt_node *target; @@ -1635,7 +1640,7 @@ logout_timeout(void *arg) } void -spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn) +iscsi_conn_logout(struct spdk_iscsi_conn *conn) { conn->is_logged_out = true; conn->logout_timer = SPDK_POLLER_REGISTER(logout_timeout, conn, ISCSI_LOGOUT_TIMEOUT * 1000000); @@ -1664,7 +1669,7 @@ SPDK_TRACE_REGISTER_FN(iscsi_conn_trace, "iscsi_conn", TRACE_GROUP_ISCSI) } void -spdk_iscsi_conn_info_json(struct spdk_json_write_ctx *w, struct spdk_iscsi_conn *conn) +iscsi_conn_info_json(struct spdk_json_write_ctx *w, struct spdk_iscsi_conn *conn) { uint16_t tsih; diff --git a/lib/iscsi/conn.h b/lib/iscsi/conn.h index 857568e2d..dd18bd4b3 100644 --- a/lib/iscsi/conn.h +++ b/lib/iscsi/conn.h @@ -200,37 +200,37 @@ struct spdk_iscsi_conn { extern struct spdk_iscsi_conn *g_conns_array; -void spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task); -void spdk_iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task); +void iscsi_task_cpl(struct spdk_scsi_task *scsi_task); +void iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task); -int spdk_initialize_iscsi_conns(void); -void spdk_shutdown_iscsi_conns(void); -void spdk_iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target); -int spdk_iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target); +int initialize_iscsi_conns(void); +void shutdown_iscsi_conns(void); +void iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target); +int iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target); -int spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, struct spdk_sock *sock); -void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn); -void spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn); -void spdk_iscsi_conn_schedule(struct spdk_iscsi_conn *conn); -void spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn); -int spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn, - const char *conn_match, int drop_all); -int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn); -int spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, - uint32_t ref_task_tag); -int spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, +int iscsi_conn_construct(struct spdk_iscsi_portal *portal, struct spdk_sock *sock); +void iscsi_conn_destruct(struct spdk_iscsi_conn *conn); +void iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn); +void iscsi_conn_schedule(struct spdk_iscsi_conn *conn); +void iscsi_conn_logout(struct spdk_iscsi_conn *conn); +int iscsi_drop_conns(struct spdk_iscsi_conn *conn, + const char *conn_match, int drop_all); +int iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn); +int iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, + uint32_t ref_task_tag); +int iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, struct spdk_scsi_lun *lun, struct spdk_iscsi_pdu *pdu); -int spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int len, void *buf); -int spdk_iscsi_conn_readv_data(struct spdk_iscsi_conn *conn, - struct iovec *iov, int iovcnt); -void spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, - iscsi_conn_xfer_complete_cb cb_fn, - void *cb_arg); +int iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int len, void *buf); +int iscsi_conn_readv_data(struct spdk_iscsi_conn *conn, + struct iovec *iov, int iovcnt); +void iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, + iscsi_conn_xfer_complete_cb cb_fn, + void *cb_arg); -void spdk_iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu); +void iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu); -void spdk_iscsi_conn_info_json(struct spdk_json_write_ctx *w, struct spdk_iscsi_conn *conn); -void spdk_iscsi_conn_pdu_generic_complete(void *cb_arg); +void iscsi_conn_info_json(struct spdk_json_write_ctx *w, struct spdk_iscsi_conn *conn); +void iscsi_conn_pdu_generic_complete(void *cb_arg); #endif /* SPDK_ISCSI_CONN_H */ diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index b512f9121..2b9558459 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -209,11 +209,6 @@ hex2bin(uint8_t *data, size_t data_len, const char *str) return total; } -void -spdk_iscsi_conn_pdu_generic_complete(void *cb_arg) -{ -} - static int iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, int reason) @@ -293,7 +288,7 @@ iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, SPDK_LOGDUMP(SPDK_LOG_ISCSI, "PDU", (void *)&rsp_pdu->bhs, ISCSI_BHS_LEN); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); return 0; } @@ -359,9 +354,9 @@ iscsi_conn_read_data_segment(struct spdk_iscsi_conn *conn, int rc, _rc; if (spdk_likely(!pdu->dif_insert_or_strip)) { - return spdk_iscsi_conn_read_data(conn, - segment_len - pdu->data_valid_bytes, - pdu->data_buf + pdu->data_valid_bytes); + return iscsi_conn_read_data(conn, + segment_len - pdu->data_valid_bytes, + pdu->data_buf + pdu->data_valid_bytes); } else { buf_iov.iov_base = pdu->data_buf; buf_iov.iov_len = pdu->data_buf_len; @@ -370,7 +365,7 @@ iscsi_conn_read_data_segment(struct spdk_iscsi_conn *conn, segment_len - pdu->data_valid_bytes, NULL, &pdu->dif_ctx); if (rc > 0) { - rc = spdk_iscsi_conn_readv_data(conn, iovs, rc); + rc = iscsi_conn_readv_data(conn, iovs, rc); if (rc > 0) { _rc = spdk_dif_generate_stream(&buf_iov, 1, pdu->data_valid_bytes, rc, @@ -1173,7 +1168,7 @@ iscsi_conn_login_pdu_success_complete(void *arg) } conn->state = ISCSI_CONN_STATE_RUNNING; if (conn->full_feature != 0) { - spdk_iscsi_conn_schedule(conn); + iscsi_conn_schedule(conn); } } @@ -1213,7 +1208,7 @@ iscsi_op_login_response(struct spdk_iscsi_conn *conn, rsph->flags &= ~ISCSI_LOGIN_NEXT_STAGE_MASK; } iscsi_param_free(params); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, cb_fn, conn); + iscsi_conn_write_pdu(conn, rsp_pdu, cb_fn, conn); } /* @@ -1516,7 +1511,7 @@ iscsi_op_login_check_session(struct spdk_iscsi_conn *conn, } } else if (!g_iscsi.AllowDuplicateIsid) { /* new session, drop old sess by the initiator */ - spdk_iscsi_drop_conns(conn, initiator_port_name, 0 /* drop old */); + iscsi_drop_conns(conn, initiator_port_name, 0 /* drop old */); } return rc; @@ -2473,7 +2468,7 @@ iscsi_pdu_payload_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p to_be32(&rsph->exp_cmd_sn, conn->sess->ExpCmdSN); to_be32(&rsph->max_cmd_sn, conn->sess->MaxCmdSN); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_text_pdu_complete, conn); + iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_text_pdu_complete, conn); return 0; } @@ -2569,7 +2564,7 @@ iscsi_pdu_hdr_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu if (conn->id == cid) { /* connection or session closed successfully */ response = 0; - spdk_iscsi_conn_logout(conn); + iscsi_conn_logout(conn); } else { response = 1; } @@ -2607,7 +2602,7 @@ iscsi_pdu_hdr_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu rsph->time_2_wait = 0; rsph->time_2_retain = 0; - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_logout_pdu_complete, conn); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_logout_pdu_complete, conn); return 0; } @@ -2653,7 +2648,7 @@ iscsi_send_r2t(struct spdk_iscsi_conn *conn, rsp_pdu->task = task; task->scsi.ref++; - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); return 0; } @@ -2706,7 +2701,7 @@ iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, */ if (!send_new_r2tsn) { to_be32(&pdu->bhs.stat_sn, conn->StatSN); - spdk_iscsi_conn_write_pdu(conn, pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, pdu, iscsi_conn_pdu_generic_complete, NULL); } else { rsph = (struct iscsi_bhs_r2t *)&pdu->bhs; transfer_len = from_be32(&rsph->desired_xfer_len); @@ -2717,7 +2712,7 @@ iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, (transfer_len - task->next_expected_r2t_offset)); /* remove the old_r2t_pdu */ - spdk_iscsi_conn_free_pdu(conn, pdu); + iscsi_conn_free_pdu(conn, pdu); /* re-send a new r2t pdu */ rc = iscsi_send_r2t(conn, task, task->next_expected_r2t_offset, @@ -2930,7 +2925,7 @@ spdk_iscsi_conn_datain_pdu_complete(void *arg) { struct spdk_iscsi_conn *conn = arg; - spdk_iscsi_conn_handle_queued_datain_tasks(conn); + iscsi_conn_handle_queued_datain_tasks(conn); } static int @@ -3035,7 +3030,7 @@ iscsi_send_datain(struct spdk_iscsi_conn *conn, } } - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_datain_pdu_complete, conn); + iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_datain_pdu_complete, conn); return DataSN; } @@ -3231,7 +3226,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn, to_be32(&rsph->bi_read_res_cnt, 0); to_be32(&rsph->res_cnt, residual_len); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); } /* @@ -3284,7 +3279,7 @@ iscsi_pdu_payload_op_scsi_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_t task->current_datain_offset = 0; TAILQ_INSERT_TAIL(&conn->queued_datain_tasks, task, link); - return spdk_iscsi_conn_handle_queued_datain_tasks(conn); + return iscsi_conn_handle_queued_datain_tasks(conn); } } @@ -3368,7 +3363,7 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) SPDK_LOGDUMP(SPDK_LOG_ISCSI, "CDB", cdb, 16); - task = iscsi_task_get(conn, NULL, spdk_iscsi_task_cpl); + task = iscsi_task_get(conn, NULL, iscsi_task_cpl); if (!task) { SPDK_ERRLOG("Unable to acquire task\n"); return SPDK_ISCSI_CONNECTION_FATAL; @@ -3396,7 +3391,7 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if (task->scsi.lun == NULL) { spdk_scsi_task_process_null_lun(&task->scsi); - spdk_iscsi_task_cpl(&task->scsi); + iscsi_task_cpl(&task->scsi); return 0; } @@ -3464,7 +3459,7 @@ iscsi_pdu_payload_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p if (spdk_scsi_dev_get_lun(conn->dev, task->lun_id) == NULL) { spdk_scsi_task_process_null_lun(&task->scsi); - spdk_iscsi_task_cpl(&task->scsi); + iscsi_task_cpl(&task->scsi); return 0; } @@ -3566,7 +3561,7 @@ spdk_iscsi_task_mgmt_response(struct spdk_iscsi_conn *conn, to_be32(&rsph->exp_cmd_sn, conn->sess->ExpCmdSN); to_be32(&rsph->max_cmd_sn, conn->sess->MaxCmdSN); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); } static void @@ -3591,7 +3586,7 @@ _iscsi_op_abort_task(void *arg) struct spdk_iscsi_task *task = arg; int rc; - rc = spdk_iscsi_conn_abort_queued_datain_task(task->conn, task->scsi.abort_id); + rc = iscsi_conn_abort_queued_datain_task(task->conn, task->scsi.abort_id); if (rc != 0) { return 1; } @@ -3615,7 +3610,7 @@ _iscsi_op_abort_task_set(void *arg) struct spdk_iscsi_task *task = arg; int rc; - rc = spdk_iscsi_conn_abort_queued_datain_tasks(task->conn, task->scsi.lun, + rc = iscsi_conn_abort_queued_datain_tasks(task->conn, task->scsi.lun, task->pdu); if (rc != 0) { return 1; @@ -3665,7 +3660,7 @@ iscsi_pdu_hdr_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) lun_i = spdk_scsi_lun_id_fmt_to_int(lun); dev = conn->dev; - task = iscsi_task_get(conn, NULL, spdk_iscsi_task_mgmt_cpl); + task = iscsi_task_get(conn, NULL, iscsi_task_mgmt_cpl); if (!task) { SPDK_ERRLOG("Unable to acquire task\n"); return SPDK_ISCSI_CONNECTION_FATAL; @@ -3862,7 +3857,7 @@ iscsi_pdu_payload_op_nopout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu to_be32(&rsph->exp_cmd_sn, conn->sess->ExpCmdSN); to_be32(&rsph->max_cmd_sn, conn->sess->MaxCmdSN); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); conn->last_nopin = spdk_get_ticks(); return 0; @@ -3999,7 +3994,7 @@ iscsi_handle_recovery_datain(struct spdk_iscsi_conn *conn, if (from_be32(&datain_header->itt) == task_tag && from_be32(&datain_header->data_sn) == i) { TAILQ_REMOVE(&conn->snack_pdu_list, old_pdu, tailq); - spdk_iscsi_conn_write_pdu(conn, old_pdu, old_pdu->cb_fn, old_pdu->cb_arg); + iscsi_conn_write_pdu(conn, old_pdu, old_pdu->cb_fn, old_pdu->cb_arg); break; } } @@ -4056,7 +4051,7 @@ iscsi_handle_status_snack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p beg_run); } else { TAILQ_REMOVE(&conn->snack_pdu_list, old_pdu, tailq); - spdk_iscsi_conn_write_pdu(conn, old_pdu, old_pdu->cb_fn, old_pdu->cb_arg); + iscsi_conn_write_pdu(conn, old_pdu, old_pdu->cb_fn, old_pdu->cb_arg); } } @@ -4112,7 +4107,7 @@ iscsi_handle_data_ack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if ((from_be32(&datain_header->ttt) == transfer_tag) && (old_datasn == beg_run - 1)) { TAILQ_REMOVE(&conn->snack_pdu_list, old_pdu, tailq); - spdk_iscsi_conn_free_pdu(conn, old_pdu); + iscsi_conn_free_pdu(conn, old_pdu); break; } } @@ -4285,7 +4280,7 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) task->current_r2t_length = 0; } - subtask = iscsi_task_get(conn, task, spdk_iscsi_task_cpl); + subtask = iscsi_task_get(conn, task, iscsi_task_cpl); if (subtask == NULL) { SPDK_ERRLOG("Unable to acquire subtask\n"); return SPDK_ISCSI_CONNECTION_FATAL; @@ -4313,7 +4308,7 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) task->lun_id); subtask->scsi.transfer_len = subtask->scsi.length; spdk_scsi_task_process_null_lun(&subtask->scsi); - spdk_iscsi_task_cpl(&subtask->scsi); + iscsi_task_cpl(&subtask->scsi); return 0; } @@ -4354,7 +4349,7 @@ iscsi_pdu_payload_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p SPDK_ERRLOG("Not found for transfer_tag=%x\n", transfer_tag); subtask->scsi.transfer_len = subtask->scsi.length; spdk_scsi_task_process_abort(&subtask->scsi); - spdk_iscsi_task_cpl(&subtask->scsi); + iscsi_task_cpl(&subtask->scsi); return 0; } @@ -4369,7 +4364,7 @@ iscsi_pdu_payload_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p subtask->lun_id); subtask->scsi.transfer_len = subtask->scsi.length; spdk_scsi_task_process_null_lun(&subtask->scsi); - spdk_iscsi_task_cpl(&subtask->scsi); + iscsi_task_cpl(&subtask->scsi); return 0; } @@ -4410,7 +4405,7 @@ remove_acked_pdu(struct spdk_iscsi_conn *conn, uint32_t ExpStatSN) stat_sn = from_be32(&pdu->bhs.stat_sn); if (spdk_sn32_lt(stat_sn, conn->exp_statsn)) { TAILQ_REMOVE(&conn->snack_pdu_list, pdu, tailq); - spdk_iscsi_conn_free_pdu(conn, pdu); + iscsi_conn_free_pdu(conn, pdu); } } } @@ -4511,7 +4506,7 @@ iscsi_pdu_hdr_handle(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) return SPDK_ISCSI_CONNECTION_FATAL; } init_login_reject_response(pdu, rsp_pdu); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_pdu_generic_complete, NULL); SPDK_ERRLOG("Received opcode %d in login phase\n", opcode); return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; } else if (conn->state == ISCSI_CONN_STATE_INVALID) { @@ -4642,9 +4637,9 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn) break; case ISCSI_PDU_RECV_STATE_AWAIT_PDU_HDR: if (pdu->bhs_valid_bytes < ISCSI_BHS_LEN) { - rc = spdk_iscsi_conn_read_data(conn, - ISCSI_BHS_LEN - pdu->bhs_valid_bytes, - (uint8_t *)&pdu->bhs + pdu->bhs_valid_bytes); + rc = iscsi_conn_read_data(conn, + ISCSI_BHS_LEN - pdu->bhs_valid_bytes, + (uint8_t *)&pdu->bhs + pdu->bhs_valid_bytes); if (rc < 0) { conn->pdu_recv_state = ISCSI_PDU_RECV_STATE_ERROR; break; @@ -4661,9 +4656,9 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn) ahs_len = pdu->bhs.total_ahs_len * 4; assert(ahs_len <= ISCSI_AHS_LEN); if (pdu->ahs_valid_bytes < ahs_len) { - rc = spdk_iscsi_conn_read_data(conn, - ahs_len - pdu->ahs_valid_bytes, - pdu->ahs + pdu->ahs_valid_bytes); + rc = iscsi_conn_read_data(conn, + ahs_len - pdu->ahs_valid_bytes, + pdu->ahs + pdu->ahs_valid_bytes); if (rc < 0) { conn->pdu_recv_state = ISCSI_PDU_RECV_STATE_ERROR; break; @@ -4678,9 +4673,9 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn) /* Header Digest */ if (conn->header_digest && pdu->hdigest_valid_bytes < ISCSI_DIGEST_LEN) { - rc = spdk_iscsi_conn_read_data(conn, - ISCSI_DIGEST_LEN - pdu->hdigest_valid_bytes, - pdu->header_digest + pdu->hdigest_valid_bytes); + rc = iscsi_conn_read_data(conn, + ISCSI_DIGEST_LEN - pdu->hdigest_valid_bytes, + pdu->header_digest + pdu->hdigest_valid_bytes); if (rc < 0) { conn->pdu_recv_state = ISCSI_PDU_RECV_STATE_ERROR; break; @@ -4753,9 +4748,9 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn) /* copy out the data digest */ if (conn->data_digest && data_len != 0 && pdu->ddigest_valid_bytes < ISCSI_DIGEST_LEN) { - rc = spdk_iscsi_conn_read_data(conn, - ISCSI_DIGEST_LEN - pdu->ddigest_valid_bytes, - pdu->data_digest + pdu->ddigest_valid_bytes); + rc = iscsi_conn_read_data(conn, + ISCSI_DIGEST_LEN - pdu->ddigest_valid_bytes, + pdu->data_digest + pdu->ddigest_valid_bytes); if (rc < 0) { conn->pdu_recv_state = ISCSI_PDU_RECV_STATE_ERROR; break; diff --git a/lib/iscsi/iscsi.h b/lib/iscsi/iscsi.h index c3d75972c..d55276c72 100644 --- a/lib/iscsi/iscsi.h +++ b/lib/iscsi/iscsi.h @@ -442,7 +442,6 @@ uint32_t spdk_iscsi_pdu_calc_data_digest(struct spdk_iscsi_pdu *pdu); /* Memory management */ void spdk_put_pdu(struct spdk_iscsi_pdu *pdu); struct spdk_iscsi_pdu *spdk_get_pdu(struct spdk_iscsi_conn *conn); -int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn); void spdk_iscsi_op_abort_task_set(struct spdk_iscsi_task *task, uint8_t function); void spdk_iscsi_queue_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task); diff --git a/lib/iscsi/iscsi_rpc.c b/lib/iscsi/iscsi_rpc.c index fe2eec4a3..4cf2082c0 100644 --- a/lib/iscsi/iscsi_rpc.c +++ b/lib/iscsi/iscsi_rpc.c @@ -979,7 +979,7 @@ rpc_iscsi_get_connections(struct spdk_io_channel_iter *i) struct spdk_iscsi_conn *conn; STAILQ_FOREACH(conn, &pg->connections, link) { - spdk_iscsi_conn_info_json(ctx->w, conn); + iscsi_conn_info_json(ctx->w, conn); } spdk_for_each_channel_continue(i, 0); diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index b1a2227eb..9e7a6fcba 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -1199,7 +1199,7 @@ iscsi_poll_group_poll(void *ctx) STAILQ_FOREACH_SAFE(conn, &group->connections, link, tmp) { if (conn->state == ISCSI_CONN_STATE_EXITING) { - spdk_iscsi_conn_destruct(conn); + iscsi_conn_destruct(conn); } } @@ -1213,7 +1213,7 @@ iscsi_poll_group_handle_nop(void *ctx) struct spdk_iscsi_conn *conn, *tmp; STAILQ_FOREACH_SAFE(conn, &group->connections, link, tmp) { - spdk_iscsi_conn_handle_nop(conn); + iscsi_conn_handle_nop(conn); } return -1; @@ -1344,7 +1344,7 @@ iscsi_parse_globals(void) return -1; } - rc = spdk_initialize_iscsi_conns(); + rc = initialize_iscsi_conns(); if (rc < 0) { SPDK_ERRLOG("spdk_initialize_iscsi_conns() failed\n"); free(g_iscsi.session); @@ -1385,7 +1385,7 @@ spdk_iscsi_fini(spdk_iscsi_fini_cb cb_fn, void *cb_arg) g_fini_cb_arg = cb_arg; iscsi_portal_grp_close_all(); - spdk_shutdown_iscsi_conns(); + shutdown_iscsi_conns(); } static void diff --git a/lib/iscsi/portal_grp.c b/lib/iscsi/portal_grp.c index 75e278a9c..490a5e089 100644 --- a/lib/iscsi/portal_grp.c +++ b/lib/iscsi/portal_grp.c @@ -64,7 +64,7 @@ iscsi_portal_accept(void *arg) while (1) { sock = spdk_sock_accept(portal->sock); if (sock != NULL) { - rc = spdk_iscsi_conn_construct(portal, sock); + rc = iscsi_conn_construct(portal, sock); if (rc < 0) { spdk_sock_close(&sock); SPDK_ERRLOG("spdk_iscsi_connection_construct() failed\n"); diff --git a/lib/iscsi/tgt_node.c b/lib/iscsi/tgt_node.c index a8a6a23b2..544487de1 100644 --- a/lib/iscsi/tgt_node.c +++ b/lib/iscsi/tgt_node.c @@ -655,7 +655,7 @@ iscsi_tgt_node_check_active_conns(void *arg) { struct spdk_iscsi_tgt_node *target = arg; - if (spdk_iscsi_get_active_conns(target) != 0) { + if (iscsi_get_active_conns(target) != 0) { return 1; } @@ -689,9 +689,9 @@ iscsi_tgt_node_destruct(struct spdk_iscsi_tgt_node *target, target->destruct_cb_fn = cb_fn; target->destruct_cb_arg = cb_arg; - spdk_iscsi_conns_request_logout(target); + iscsi_conns_request_logout(target); - if (spdk_iscsi_get_active_conns(target) != 0) { + if (iscsi_get_active_conns(target) != 0) { target->destruct_poller = SPDK_POLLER_REGISTER(iscsi_tgt_node_check_active_conns, target, 10); } else { @@ -1337,7 +1337,7 @@ iscsi_tgt_node_cleanup_luns(struct spdk_iscsi_conn *conn, } /* we create a fake management task per LUN to cleanup */ - task = iscsi_task_get(conn, NULL, spdk_iscsi_task_mgmt_cpl); + task = iscsi_task_get(conn, NULL, iscsi_task_mgmt_cpl); if (!task) { SPDK_ERRLOG("Unable to acquire task\n"); return -1; diff --git a/test/app/fuzz/iscsi_fuzz/iscsi_fuzz.c b/test/app/fuzz/iscsi_fuzz/iscsi_fuzz.c index 18a7157a4..afa63996e 100644 --- a/test/app/fuzz/iscsi_fuzz/iscsi_fuzz.c +++ b/test/app/fuzz/iscsi_fuzz/iscsi_fuzz.c @@ -451,9 +451,9 @@ iscsi_fuzz_read_pdu(struct spdk_iscsi_conn *conn) break; case ISCSI_PDU_RECV_STATE_AWAIT_PDU_HDR: if (pdu->bhs_valid_bytes < ISCSI_BHS_LEN) { - rc = spdk_iscsi_conn_read_data(conn, - ISCSI_BHS_LEN - pdu->bhs_valid_bytes, - (uint8_t *)&pdu->bhs + pdu->bhs_valid_bytes); + rc = iscsi_conn_read_data(conn, + ISCSI_BHS_LEN - pdu->bhs_valid_bytes, + (uint8_t *)&pdu->bhs + pdu->bhs_valid_bytes); if (rc < 0) { conn->pdu_recv_state = ISCSI_PDU_RECV_STATE_ERROR; break; @@ -649,7 +649,7 @@ fuzz_iscsi_send_login_request(struct fuzz_iscsi_dev_ctx *dev_ctx, uint8_t sessio } DSET24(req_pdu->bhs.data_segment_len, req_pdu->data_segment_len); - spdk_iscsi_conn_write_pdu(conn, req_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(conn, req_pdu, iscsi_conn_pdu_generic_complete, NULL); } static void @@ -680,7 +680,7 @@ fuzz_iscsi_send_logout_request(struct fuzz_iscsi_dev_ctx *dev_ctx) req_pdu->bhs.flags = 0; DSET24(req_pdu->bhs.data_segment_len, 0); - spdk_iscsi_conn_write_pdu(conn, req_pdu, spdk_iscsi_conn_pdu_generic_complete, conn); + iscsi_conn_write_pdu(conn, req_pdu, iscsi_conn_pdu_generic_complete, conn); } static void @@ -877,8 +877,8 @@ dev_submit_requests(struct fuzz_iscsi_dev_ctx *dev_ctx) check_successful_op(dev_ctx, io_ctx); dev_ctx->num_sent_pdus++; - spdk_iscsi_conn_write_pdu(dev_ctx->conn, req_pdu, - spdk_iscsi_conn_pdu_generic_complete, NULL); + iscsi_conn_write_pdu(dev_ctx->conn, req_pdu, + iscsi_conn_pdu_generic_complete, NULL); } /* submit requests end */ diff --git a/test/unit/lib/iscsi/common.c b/test/unit/lib/iscsi/common.c index 8ad4494d7..ee7502ed1 100644 --- a/test/unit/lib/iscsi/common.c +++ b/test/unit/lib/iscsi/common.c @@ -152,21 +152,21 @@ DEFINE_STUB_V(spdk_scsi_dev_destruct, DEFINE_STUB(spdk_scsi_dev_add_port, int, (struct spdk_scsi_dev *dev, uint64_t id, const char *name), 0); -DEFINE_STUB(spdk_iscsi_drop_conns, int, +DEFINE_STUB(iscsi_drop_conns, int, (struct spdk_iscsi_conn *conn, const char *conn_match, int drop_all), 0); DEFINE_STUB(spdk_scsi_dev_delete_port, int, (struct spdk_scsi_dev *dev, uint64_t id), 0); -DEFINE_STUB_V(spdk_shutdown_iscsi_conns, (void)); +DEFINE_STUB_V(shutdown_iscsi_conns, (void)); -DEFINE_STUB_V(spdk_iscsi_conns_request_logout, (struct spdk_iscsi_tgt_node *target)); +DEFINE_STUB_V(iscsi_conns_request_logout, (struct spdk_iscsi_tgt_node *target)); -DEFINE_STUB(spdk_iscsi_get_active_conns, int, (struct spdk_iscsi_tgt_node *target), 0); +DEFINE_STUB(iscsi_get_active_conns, int, (struct spdk_iscsi_tgt_node *target), 0); void -spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task) +iscsi_task_cpl(struct spdk_scsi_task *scsi_task) { struct spdk_iscsi_task *iscsi_task; @@ -181,22 +181,22 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task) } } -DEFINE_STUB_V(spdk_iscsi_task_mgmt_cpl, (struct spdk_scsi_task *scsi_task)); +DEFINE_STUB_V(iscsi_task_mgmt_cpl, (struct spdk_scsi_task *scsi_task)); -DEFINE_STUB(spdk_iscsi_conn_read_data, int, +DEFINE_STUB(iscsi_conn_read_data, int, (struct spdk_iscsi_conn *conn, int bytes, void *buf), 0); -DEFINE_STUB(spdk_iscsi_conn_readv_data, int, +DEFINE_STUB(iscsi_conn_readv_data, int, (struct spdk_iscsi_conn *conn, struct iovec *iov, int iovcnt), 0); void -spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, - iscsi_conn_xfer_complete_cb cb_fn, void *cb_arg) +iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, + iscsi_conn_xfer_complete_cb cb_fn, void *cb_arg) { TAILQ_INSERT_TAIL(&g_write_pdu_list, pdu, tailq); } -DEFINE_STUB_V(spdk_iscsi_conn_logout, (struct spdk_iscsi_conn *conn)); +DEFINE_STUB_V(iscsi_conn_logout, (struct spdk_iscsi_conn *conn)); DEFINE_STUB_V(spdk_scsi_task_set_status, (struct spdk_scsi_task *task, int sc, int sk, int asc, int ascq)); diff --git a/test/unit/lib/iscsi/conn.c/conn_ut.c b/test/unit/lib/iscsi/conn.c/conn_ut.c index 47fba3034..56482a2c8 100644 --- a/test/unit/lib/iscsi/conn.c/conn_ut.c +++ b/test/unit/lib/iscsi/conn.c/conn_ut.c @@ -856,7 +856,7 @@ abort_queued_datain_tasks_test(void) iscsi_task_set_pdu(&task6, &pdu6); TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, &task6, link); - rc = spdk_iscsi_conn_abort_queued_datain_tasks(&conn, &lun1, &mgmt_pdu1); + rc = iscsi_conn_abort_queued_datain_tasks(&conn, &lun1, &mgmt_pdu1); CU_ASSERT(rc == 0); CU_ASSERT(!datain_task_is_queued(&conn, &task1)); CU_ASSERT(datain_task_is_queued(&conn, &task2)); @@ -865,7 +865,7 @@ abort_queued_datain_tasks_test(void) CU_ASSERT(datain_task_is_queued(&conn, &task5)); CU_ASSERT(datain_task_is_queued(&conn, &task6)); - rc = spdk_iscsi_conn_abort_queued_datain_tasks(&conn, &lun2, &mgmt_pdu2); + rc = iscsi_conn_abort_queued_datain_tasks(&conn, &lun2, &mgmt_pdu2); CU_ASSERT(rc == 0); CU_ASSERT(!datain_task_is_queued(&conn, &task2)); CU_ASSERT(datain_task_is_queued(&conn, &task3)); diff --git a/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c index 1d2cc5608..267e91149 100644 --- a/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c +++ b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c @@ -89,18 +89,20 @@ DEFINE_STUB(iscsi_tgt_node_is_destructed, bool, DEFINE_STUB_V(iscsi_portal_grp_close_all, (void)); -DEFINE_STUB_V(spdk_iscsi_conn_schedule, (struct spdk_iscsi_conn *conn)); +DEFINE_STUB_V(iscsi_conn_schedule, (struct spdk_iscsi_conn *conn)); -DEFINE_STUB_V(spdk_iscsi_conn_free_pdu, +DEFINE_STUB_V(iscsi_conn_free_pdu, (struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)); -DEFINE_STUB(spdk_iscsi_conn_handle_queued_datain_tasks, int, +DEFINE_STUB_V(iscsi_conn_pdu_generic_complete, (void *cb_arg)); + +DEFINE_STUB(iscsi_conn_handle_queued_datain_tasks, int, (struct spdk_iscsi_conn *conn), 0); -DEFINE_STUB(spdk_iscsi_conn_abort_queued_datain_task, int, +DEFINE_STUB(iscsi_conn_abort_queued_datain_task, int, (struct spdk_iscsi_conn *conn, uint32_t ref_task_tag), 0); -DEFINE_STUB(spdk_iscsi_conn_abort_queued_datain_tasks, int, +DEFINE_STUB(iscsi_conn_abort_queued_datain_tasks, int, (struct spdk_iscsi_conn *conn, struct spdk_scsi_lun *lun, struct spdk_iscsi_pdu *pdu), 0); diff --git a/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c b/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c index 01da435d6..9e6a967d1 100644 --- a/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c +++ b/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c @@ -45,7 +45,7 @@ #include "spdk_internal/thread.h" -DEFINE_STUB(spdk_iscsi_conn_construct, int, +DEFINE_STUB(iscsi_conn_construct, int, (struct spdk_iscsi_portal *portal, struct spdk_sock *sock), 0);