lib/iscsi: Replace the "spdk_" prefix by "iscsi_" for internal APIs declared in iscsi.h

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1e5a8b567e87ab5693402d164bf73fe22afa45af
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1891
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-04-16 11:10:57 +09:00 committed by Tomasz Zawadzki
parent 3570494de2
commit f7b7195aa0
9 changed files with 137 additions and 137 deletions

View File

@ -327,7 +327,7 @@ iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
if (pdu->task) {
iscsi_task_put(pdu->task);
}
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
cb_fn(cb_arg);
}
@ -425,7 +425,7 @@ iscsi_conn_free(struct spdk_iscsi_conn *conn)
/* cleanup last connection */
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
"cleanup last conn free sess\n");
spdk_free_sess(sess);
iscsi_free_sess(sess);
}
}
@ -533,7 +533,7 @@ _iscsi_conn_hotremove_lun(void *ctx)
return;
}
spdk_clear_all_transfer_task(conn, lun, NULL);
iscsi_clear_all_transfer_task(conn, lun, NULL);
iscsi_lun->remove_poller = SPDK_POLLER_REGISTER(iscsi_conn_remove_lun, iscsi_lun,
1000);
@ -664,7 +664,7 @@ _iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
{
int rc;
spdk_clear_all_transfer_task(conn, NULL, NULL);
iscsi_clear_all_transfer_task(conn, NULL, NULL);
iscsi_poll_group_remove_conn(conn->pg, conn);
spdk_sock_close(&conn->sock);
@ -734,7 +734,7 @@ iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
break;
}
}
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
conn->pdu_in_progress = NULL;
}
@ -799,7 +799,7 @@ iscsi_send_logout_request(struct spdk_iscsi_conn *conn)
struct spdk_iscsi_pdu *rsp_pdu;
struct iscsi_bhs_async *rsph;
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
assert(rsp_pdu != NULL);
rsph = (struct iscsi_bhs_async *)&rsp_pdu->bhs;
@ -1216,10 +1216,10 @@ process_non_read_task_completion(struct spdk_iscsi_conn *conn,
* ensured that the initiator will send all data requested by R2Ts.
*
* We check it and skip the following if primary is completed. (see
* spdk_clear_all_transfer_task() in iscsi.c.)
* iscsi_clear_all_transfer_task() in iscsi.c.)
*/
if (primary->is_r2t_active) {
spdk_del_transfer_task(conn, primary->tag);
iscsi_del_transfer_task(conn, primary->tag);
if (primary->rsp_scsi_status != SPDK_SCSI_STATUS_GOOD) {
iscsi_task_copy_from_rsp_scsi_status(&primary->scsi, primary);
}
@ -1274,11 +1274,11 @@ iscsi_conn_send_nopin(struct spdk_iscsi_conn *conn)
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "StatSN=%u, ExpCmdSN=%u, MaxCmdSN=%u\n",
conn->StatSN, conn->sess->ExpCmdSN,
conn->sess->MaxCmdSN);
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
rsp = (struct iscsi_bhs_nop_in *) &rsp_pdu->bhs;
rsp_pdu->data = NULL;
/*
* spdk_get_pdu() memset's the PDU for us, so only fill out the needed
* iscsi_get_pdu() memset's the PDU for us, so only fill out the needed
* fields.
*/
rsp->opcode = ISCSI_OP_NOPIN;

View File

@ -261,7 +261,7 @@ iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
data_len += ISCSI_DIGEST_LEN;
}
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
if (rsp_pdu == NULL) {
free(data);
return -ENOMEM;
@ -529,7 +529,7 @@ end:
return iovcnt - sgl.iovcnt;
}
void spdk_free_sess(struct spdk_iscsi_sess *sess)
void iscsi_free_sess(struct spdk_iscsi_sess *sess)
{
if (sess == NULL) {
return;
@ -693,7 +693,7 @@ create_iscsi_sess(struct spdk_iscsi_conn *conn,
return 0;
error_return:
spdk_free_sess(sess);
iscsi_free_sess(sess);
conn->sess = NULL;
return -1;
}
@ -2206,7 +2206,7 @@ iscsi_pdu_hdr_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
}
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
if (rsp_pdu == NULL) {
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -2270,9 +2270,9 @@ iscsi_pdu_hdr_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
int F_bit, C_bit;
struct iscsi_bhs_text_req *reqh;
if (pdu->data_segment_len > spdk_get_max_immediate_data_size()) {
if (pdu->data_segment_len > iscsi_get_max_immediate_data_size()) {
SPDK_ERRLOG("data segment len(=%zu) > immediate data len(=%"PRIu32")\n",
pdu->data_segment_len, spdk_get_max_immediate_data_size());
pdu->data_segment_len, iscsi_get_max_immediate_data_size());
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
}
@ -2429,7 +2429,7 @@ iscsi_pdu_payload_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
SPDK_LOGDUMP(SPDK_LOG_ISCSI, "Negotiated Params", data, data_len);
/* response PDU */
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
if (rsp_pdu == NULL) {
free(data);
return SPDK_ISCSI_CONNECTION_FATAL;
@ -2570,7 +2570,7 @@ iscsi_pdu_hdr_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu
}
/* response PDU */
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
if (rsp_pdu == NULL) {
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -2617,7 +2617,7 @@ iscsi_send_r2t(struct spdk_iscsi_conn *conn,
uint64_t fmt_lun;
/* R2T PDU */
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
if (rsp_pdu == NULL) {
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -2810,7 +2810,7 @@ start_queued_transfer_tasks(struct spdk_iscsi_conn *conn)
}
bool
spdk_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t task_tag)
iscsi_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t task_tag)
{
struct spdk_iscsi_task *task;
int i;
@ -2863,9 +2863,9 @@ del_connection_queued_task(struct spdk_iscsi_conn *conn, void *tailq,
}
}
void spdk_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
struct spdk_scsi_lun *lun,
struct spdk_iscsi_pdu *pdu)
void iscsi_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
struct spdk_scsi_lun *lun,
struct spdk_iscsi_pdu *pdu)
{
int i, j, pending_r2t;
struct spdk_iscsi_task *task;
@ -2944,7 +2944,7 @@ iscsi_send_datain(struct spdk_iscsi_conn *conn,
primary = iscsi_task_get_primary(task);
/* DATA PDU */
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
rsph = (struct iscsi_bhs_data_in *)&rsp_pdu->bhs;
rsp_pdu->data = task->scsi.iovs[0].iov_base + offset;
rsp_pdu->data_buf_len = task->scsi.iovs[0].iov_len - offset;
@ -3179,7 +3179,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
}
/* response PDU */
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
assert(rsp_pdu != NULL);
rsph = (struct iscsi_bhs_scsi_resp *)&rsp_pdu->bhs;
assert(task->scsi.sense_data_len <= sizeof(rsp_pdu->sense.data));
@ -3408,9 +3408,9 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
return 0;
}
if (pdu->data_segment_len > spdk_get_max_immediate_data_size()) {
if (pdu->data_segment_len > iscsi_get_max_immediate_data_size()) {
SPDK_ERRLOG("data segment len(=%zu) > immediate data len(=%"PRIu32")\n",
pdu->data_segment_len, spdk_get_max_immediate_data_size());
pdu->data_segment_len, iscsi_get_max_immediate_data_size());
iscsi_task_put(task);
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
}
@ -3491,16 +3491,16 @@ abort_transfer_task_in_task_mgmt_resp(struct spdk_iscsi_conn *conn,
switch (task->scsi.function) {
/* abort task identified by Reference Task Tag field */
case ISCSI_TASK_FUNC_ABORT_TASK:
spdk_del_transfer_task(conn, task->scsi.abort_id);
iscsi_del_transfer_task(conn, task->scsi.abort_id);
break;
/* abort all tasks issued via this session on the LUN */
case ISCSI_TASK_FUNC_ABORT_TASK_SET:
spdk_clear_all_transfer_task(conn, task->scsi.lun, pdu);
iscsi_clear_all_transfer_task(conn, task->scsi.lun, pdu);
break;
case ISCSI_TASK_FUNC_LOGICAL_UNIT_RESET:
spdk_clear_all_transfer_task(conn, task->scsi.lun, pdu);
iscsi_clear_all_transfer_task(conn, task->scsi.lun, pdu);
break;
}
}
@ -3523,7 +3523,7 @@ spdk_iscsi_task_mgmt_response(struct spdk_iscsi_conn *conn,
reqh = (struct iscsi_bhs_task_req *)&task->pdu->bhs;
/* response PDU */
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
rsph = (struct iscsi_bhs_task_resp *)&rsp_pdu->bhs;
rsph->opcode = ISCSI_OP_TASK_RSP;
rsph->flags |= 0x80; /* bit 0 default to 1 */
@ -3833,7 +3833,7 @@ iscsi_pdu_payload_op_nopout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu
}
/* response PDU */
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
if (rsp_pdu == NULL) {
free(data);
return SPDK_ISCSI_CONNECTION_FATAL;
@ -4501,7 +4501,7 @@ iscsi_pdu_hdr_handle(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
* return response code 0x020b to initiator.
* */
if (!conn->full_feature && conn->state == ISCSI_CONN_STATE_RUNNING) {
rsp_pdu = spdk_get_pdu(conn);
rsp_pdu = iscsi_get_pdu(conn);
if (rsp_pdu == NULL) {
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -4629,7 +4629,7 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn)
case ISCSI_PDU_RECV_STATE_AWAIT_PDU_READY:
assert(conn->pdu_in_progress == NULL);
conn->pdu_in_progress = spdk_get_pdu(conn);
conn->pdu_in_progress = iscsi_get_pdu(conn);
if (conn->pdu_in_progress == NULL) {
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -4710,9 +4710,9 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn)
data_len = pdu->data_segment_len;
if (data_len != 0 && pdu->data_buf == NULL) {
if (data_len <= spdk_get_max_immediate_data_size()) {
if (data_len <= iscsi_get_max_immediate_data_size()) {
pool = g_iscsi.pdu_immediate_data_pool;
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(spdk_get_max_immediate_data_size());
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(iscsi_get_max_immediate_data_size());
} else if (data_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
pool = g_iscsi.pdu_data_out_pool;
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
@ -4790,7 +4790,7 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn)
}
if (rc == 0) {
spdk_trace_record(TRACE_ISCSI_TASK_EXECUTED, 0, 0, (uintptr_t)pdu, 0);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
conn->pdu_in_progress = NULL;
conn->pdu_recv_state = ISCSI_PDU_RECV_STATE_AWAIT_PDU_READY;
return 1;

View File

@ -430,24 +430,24 @@ int spdk_iscsi_handle_incoming_pdus(struct spdk_iscsi_conn *conn);
void spdk_iscsi_task_mgmt_response(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *task);
void spdk_free_sess(struct spdk_iscsi_sess *sess);
void spdk_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
struct spdk_scsi_lun *lun,
struct spdk_iscsi_pdu *pdu);
bool spdk_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t CmdSN);
void iscsi_free_sess(struct spdk_iscsi_sess *sess);
void iscsi_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
struct spdk_scsi_lun *lun,
struct spdk_iscsi_pdu *pdu);
bool iscsi_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t CmdSN);
uint32_t spdk_iscsi_pdu_calc_header_digest(struct spdk_iscsi_pdu *pdu);
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);
void iscsi_put_pdu(struct spdk_iscsi_pdu *pdu);
struct spdk_iscsi_pdu *iscsi_get_pdu(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);
static inline uint32_t
spdk_get_max_immediate_data_size(void)
iscsi_get_max_immediate_data_size(void)
{
/*
* Specify enough extra space in addition to FirstBurstLength to

View File

@ -148,7 +148,7 @@ static int
iscsi_initialize_pdu_pool(void)
{
struct spdk_iscsi_globals *iscsi = &g_iscsi;
int imm_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(spdk_get_max_immediate_data_size()) +
int imm_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(iscsi_get_max_immediate_data_size()) +
sizeof(struct spdk_mobj) + ISCSI_DATA_BUFFER_ALIGNMENT;
int dout_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) +
sizeof(struct spdk_mobj) + ISCSI_DATA_BUFFER_ALIGNMENT;
@ -289,7 +289,7 @@ iscsi_free_pools(void)
spdk_mempool_free(iscsi->task_pool);
}
void spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
void iscsi_put_pdu(struct spdk_iscsi_pdu *pdu)
{
if (!pdu) {
return;
@ -311,7 +311,7 @@ void spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
}
}
struct spdk_iscsi_pdu *spdk_get_pdu(struct spdk_iscsi_conn *conn)
struct spdk_iscsi_pdu *iscsi_get_pdu(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_pdu *pdu;

View File

@ -142,7 +142,7 @@ static inline void
iscsi_task_disassociate_pdu(struct spdk_iscsi_task *task)
{
if (iscsi_task_get_pdu(task)) {
spdk_put_pdu(iscsi_task_get_pdu(task));
iscsi_put_pdu(iscsi_task_get_pdu(task));
iscsi_task_set_pdu(task, NULL);
}
}

View File

@ -160,7 +160,7 @@ spdk_shutdown_iscsi_conns_done(void)
}
void
spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
iscsi_put_pdu(struct spdk_iscsi_pdu *pdu)
{
if (!pdu) {
return;
@ -180,7 +180,7 @@ spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
}
struct spdk_iscsi_pdu *
spdk_get_pdu(struct spdk_iscsi_conn *conn)
iscsi_get_pdu(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_pdu *pdu;
@ -442,7 +442,7 @@ iscsi_fuzz_read_pdu(struct spdk_iscsi_conn *conn)
case ISCSI_PDU_RECV_STATE_AWAIT_PDU_READY:
assert(conn->pdu_in_progress == NULL);
conn->pdu_in_progress = spdk_get_pdu(conn);
conn->pdu_in_progress = iscsi_get_pdu(conn);
if (conn->pdu_in_progress == NULL) {
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -562,7 +562,7 @@ fuzz_iscsi_send_login_request(struct fuzz_iscsi_dev_ctx *dev_ctx, uint8_t sessio
struct iscsi_bhs_login_req *login_req;
struct spdk_iscsi_conn *conn = dev_ctx->conn;
req_pdu = spdk_get_pdu(conn);
req_pdu = iscsi_get_pdu(conn);
req_pdu->writev_offset = 0;
req_pdu->hdigest_valid_bytes = 0;
req_pdu->ahs_valid_bytes = 0;
@ -662,7 +662,7 @@ fuzz_iscsi_send_logout_request(struct fuzz_iscsi_dev_ctx *dev_ctx)
conn->is_logged_out = true;
req_pdu = spdk_get_pdu(conn);
req_pdu = iscsi_get_pdu(conn);
req_pdu->writev_offset = 0;
req_pdu->hdigest_valid_bytes = 0;
req_pdu->ahs_valid_bytes = 0;
@ -767,7 +767,7 @@ dev_submit_requests(struct fuzz_iscsi_dev_ctx *dev_ctx)
return;
}
req_pdu = spdk_get_pdu(dev_ctx->conn);
req_pdu = iscsi_get_pdu(dev_ctx->conn);
req_pdu->writev_offset = 0;
req_pdu->hdigest_valid_bytes = 0;
req_pdu->ahs_valid_bytes = 0;
@ -902,14 +902,14 @@ poll_dev(void *ctx)
TAILQ_FOREACH_SAFE(pdu, &g_get_pdu_list, tailq, tmp) {
TAILQ_REMOVE(&g_get_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
}
spdk_sock_close(&conn->sock);
TAILQ_FOREACH_SAFE(pdu, &conn->write_pdu_list, tailq, tmp) {
TAILQ_REMOVE(&conn->write_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
}
free(conn);

View File

@ -74,7 +74,7 @@ spdk_scsi_task_put(struct spdk_scsi_task *task)
}
void
spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
iscsi_put_pdu(struct spdk_iscsi_pdu *pdu)
{
if (!pdu) {
return;
@ -95,7 +95,7 @@ spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
}
struct spdk_iscsi_pdu *
spdk_get_pdu(struct spdk_iscsi_conn *conn)
iscsi_get_pdu(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_pdu *pdu;

View File

@ -183,13 +183,13 @@ DEFINE_STUB_V(spdk_scsi_task_process_null_lun, (struct spdk_scsi_task *task));
DEFINE_STUB_V(spdk_scsi_task_process_abort, (struct spdk_scsi_task *task));
DEFINE_STUB_V(spdk_put_pdu, (struct spdk_iscsi_pdu *pdu));
DEFINE_STUB_V(iscsi_put_pdu, (struct spdk_iscsi_pdu *pdu));
DEFINE_STUB_V(iscsi_param_free, (struct iscsi_param *params));
DEFINE_STUB(iscsi_conn_params_init, int, (struct iscsi_param **params), 0);
DEFINE_STUB_V(spdk_clear_all_transfer_task,
DEFINE_STUB_V(iscsi_clear_all_transfer_task,
(struct spdk_iscsi_conn *conn, struct spdk_scsi_lun *lun,
struct spdk_iscsi_pdu *pdu));
@ -209,12 +209,12 @@ DEFINE_STUB_V(spdk_iscsi_task_mgmt_response,
DEFINE_STUB_V(spdk_iscsi_send_nopin, (struct spdk_iscsi_conn *conn));
DEFINE_STUB(spdk_del_transfer_task, bool,
DEFINE_STUB(iscsi_del_transfer_task, bool,
(struct spdk_iscsi_conn *conn, uint32_t task_tag), true);
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));
DEFINE_STUB_V(iscsi_free_sess, (struct spdk_iscsi_sess *sess));
DEFINE_STUB(iscsi_tgt_node_cleanup_luns, int,
(struct spdk_iscsi_conn *conn, struct spdk_iscsi_tgt_node *target),

View File

@ -275,8 +275,8 @@ maxburstlength_test(void)
struct spdk_iscsi_pdu *response_pdu;
int rc;
req_pdu = spdk_get_pdu(&conn);
data_out_pdu = spdk_get_pdu(&conn);
req_pdu = iscsi_get_pdu(&conn);
data_out_pdu = iscsi_get_pdu(&conn);
sess.ExpCmdSN = 0;
sess.MaxCmdSN = 64;
@ -342,15 +342,15 @@ maxburstlength_test(void)
SPDK_CU_ASSERT_FATAL(response_pdu->task != NULL);
iscsi_task_disassociate_pdu(response_pdu->task);
iscsi_task_put(response_pdu->task);
spdk_put_pdu(response_pdu);
iscsi_put_pdu(response_pdu);
r2t_pdu = TAILQ_FIRST(&g_write_pdu_list);
CU_ASSERT(r2t_pdu != NULL);
TAILQ_REMOVE(&g_write_pdu_list, r2t_pdu, tailq);
spdk_put_pdu(r2t_pdu);
iscsi_put_pdu(r2t_pdu);
spdk_put_pdu(data_out_pdu);
spdk_put_pdu(req_pdu);
iscsi_put_pdu(data_out_pdu);
iscsi_put_pdu(req_pdu);
}
static void
@ -374,7 +374,7 @@ underflow_for_read_transfer_test(void)
dev.lun[0] = &lun;
conn.dev = &dev;
pdu = spdk_get_pdu(&conn);
pdu = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu != NULL);
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu->bhs;
@ -392,7 +392,7 @@ underflow_for_read_transfer_test(void)
task.scsi.status = SPDK_SCSI_STATUS_GOOD;
spdk_iscsi_task_response(&conn, &task);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
/*
* In this case, a SCSI Data-In PDU should contain the Status
@ -411,7 +411,7 @@ underflow_for_read_transfer_test(void)
CU_ASSERT(datah->res_cnt == residual_count);
TAILQ_REMOVE(&g_write_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
CU_ASSERT(TAILQ_EMPTY(&g_write_pdu_list));
}
@ -437,7 +437,7 @@ underflow_for_zero_read_transfer_test(void)
dev.lun[0] = &lun;
conn.dev = &dev;
pdu = spdk_get_pdu(&conn);
pdu = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu != NULL);
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu->bhs;
@ -453,7 +453,7 @@ underflow_for_zero_read_transfer_test(void)
task.scsi.status = SPDK_SCSI_STATUS_GOOD;
spdk_iscsi_task_response(&conn, &task);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
/*
* In this case, only a SCSI Response PDU is expected and
@ -475,7 +475,7 @@ underflow_for_zero_read_transfer_test(void)
CU_ASSERT(resph->res_cnt == residual_count);
TAILQ_REMOVE(&g_write_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
CU_ASSERT(TAILQ_EMPTY(&g_write_pdu_list));
}
@ -502,7 +502,7 @@ underflow_for_request_sense_test(void)
dev.lun[0] = &lun;
conn.dev = &dev;
pdu1 = spdk_get_pdu(&conn);
pdu1 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu1 != NULL);
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu1->bhs;
@ -522,7 +522,7 @@ underflow_for_request_sense_test(void)
task.scsi.status = SPDK_SCSI_STATUS_GOOD;
spdk_iscsi_task_response(&conn, &task);
spdk_put_pdu(pdu1);
iscsi_put_pdu(pdu1);
/*
* In this case, a SCSI Data-In PDU and a SCSI Response PDU are returned.
@ -548,7 +548,7 @@ underflow_for_request_sense_test(void)
CU_ASSERT(datah->res_cnt == 0);
TAILQ_REMOVE(&g_write_pdu_list, pdu1, tailq);
spdk_put_pdu(pdu1);
iscsi_put_pdu(pdu1);
pdu2 = TAILQ_FIRST(&g_write_pdu_list);
/* inform scan-build (clang 6) that these pointers are not the same */
@ -566,7 +566,7 @@ underflow_for_request_sense_test(void)
CU_ASSERT(resph->res_cnt == residual_count);
TAILQ_REMOVE(&g_write_pdu_list, pdu2, tailq);
spdk_put_pdu(pdu2);
iscsi_put_pdu(pdu2);
CU_ASSERT(TAILQ_EMPTY(&g_write_pdu_list));
}
@ -592,7 +592,7 @@ underflow_for_check_condition_test(void)
dev.lun[0] = &lun;
conn.dev = &dev;
pdu = spdk_get_pdu(&conn);
pdu = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu != NULL);
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu->bhs;
@ -612,7 +612,7 @@ underflow_for_check_condition_test(void)
task.scsi.status = SPDK_SCSI_STATUS_CHECK_CONDITION;
spdk_iscsi_task_response(&conn, &task);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
/*
* In this case, a SCSI Response PDU is returned.
@ -633,7 +633,7 @@ underflow_for_check_condition_test(void)
CU_ASSERT(resph->res_cnt == 0);
TAILQ_REMOVE(&g_write_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
CU_ASSERT(TAILQ_EMPTY(&g_write_pdu_list));
}
@ -656,7 +656,7 @@ add_transfer_task_test(void)
TAILQ_INIT(&conn.queued_r2t_tasks);
TAILQ_INIT(&conn.active_r2t_tasks);
pdu = spdk_get_pdu(&conn);
pdu = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu != NULL);
pdu->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH; /* 64K */
@ -709,13 +709,13 @@ add_transfer_task_test(void)
desired_xfer_len = from_be32(&r2th->desired_xfer_len);
CU_ASSERT(desired_xfer_len == sess.MaxBurstLength);
spdk_put_pdu(tmp);
iscsi_put_pdu(tmp);
count++;
}
CU_ASSERT(count == DEFAULT_MAXR2T);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
}
static void
@ -733,7 +733,7 @@ get_transfer_task_test(void)
conn.sess = &sess;
TAILQ_INIT(&conn.active_r2t_tasks);
pdu1 = spdk_get_pdu(&conn);
pdu1 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu1 != NULL);
pdu1->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -743,7 +743,7 @@ get_transfer_task_test(void)
rc = add_transfer_task(&conn, &task1);
CU_ASSERT(rc == 0);
pdu2 = spdk_get_pdu(&conn);
pdu2 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu2 != NULL);
pdu2->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -767,11 +767,11 @@ get_transfer_task_test(void)
while (!TAILQ_EMPTY(&g_write_pdu_list)) {
pdu = TAILQ_FIRST(&g_write_pdu_list);
TAILQ_REMOVE(&g_write_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
}
spdk_put_pdu(pdu2);
spdk_put_pdu(pdu1);
iscsi_put_pdu(pdu2);
iscsi_put_pdu(pdu1);
}
static void
@ -790,7 +790,7 @@ del_transfer_task_test(void)
TAILQ_INIT(&conn.active_r2t_tasks);
TAILQ_INIT(&conn.queued_r2t_tasks);
pdu1 = spdk_get_pdu(&conn);
pdu1 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu1 != NULL);
pdu1->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -801,7 +801,7 @@ del_transfer_task_test(void)
rc = add_transfer_task(&conn, &task1);
CU_ASSERT(rc == 0);
pdu2 = spdk_get_pdu(&conn);
pdu2 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu2 != NULL);
pdu2->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -812,7 +812,7 @@ del_transfer_task_test(void)
rc = add_transfer_task(&conn, &task2);
CU_ASSERT(rc == 0);
pdu3 = spdk_get_pdu(&conn);
pdu3 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu3 != NULL);
pdu3->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -823,7 +823,7 @@ del_transfer_task_test(void)
rc = add_transfer_task(&conn, &task3);
CU_ASSERT(rc == 0);
pdu4 = spdk_get_pdu(&conn);
pdu4 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu4 != NULL);
pdu4->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -834,7 +834,7 @@ del_transfer_task_test(void)
rc = add_transfer_task(&conn, &task4);
CU_ASSERT(rc == 0);
pdu5 = spdk_get_pdu(&conn);
pdu5 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu5 != NULL);
pdu5->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -847,24 +847,24 @@ del_transfer_task_test(void)
CU_ASSERT(get_transfer_task(&conn, 1) == &task1);
CU_ASSERT(get_transfer_task(&conn, 5) == NULL);
spdk_del_transfer_task(&conn, 11);
iscsi_del_transfer_task(&conn, 11);
CU_ASSERT(get_transfer_task(&conn, 1) == NULL);
CU_ASSERT(get_transfer_task(&conn, 5) == &task5);
CU_ASSERT(get_transfer_task(&conn, 2) == &task2);
spdk_del_transfer_task(&conn, 12);
iscsi_del_transfer_task(&conn, 12);
CU_ASSERT(get_transfer_task(&conn, 2) == NULL);
CU_ASSERT(get_transfer_task(&conn, 3) == &task3);
spdk_del_transfer_task(&conn, 13);
iscsi_del_transfer_task(&conn, 13);
CU_ASSERT(get_transfer_task(&conn, 3) == NULL);
CU_ASSERT(get_transfer_task(&conn, 4) == &task4);
spdk_del_transfer_task(&conn, 14);
iscsi_del_transfer_task(&conn, 14);
CU_ASSERT(get_transfer_task(&conn, 4) == NULL);
CU_ASSERT(get_transfer_task(&conn, 5) == &task5);
spdk_del_transfer_task(&conn, 15);
iscsi_del_transfer_task(&conn, 15);
CU_ASSERT(get_transfer_task(&conn, 5) == NULL);
while (!TAILQ_EMPTY(&conn.active_r2t_tasks)) {
@ -875,14 +875,14 @@ del_transfer_task_test(void)
while (!TAILQ_EMPTY(&g_write_pdu_list)) {
pdu = TAILQ_FIRST(&g_write_pdu_list);
TAILQ_REMOVE(&g_write_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
}
spdk_put_pdu(pdu5);
spdk_put_pdu(pdu4);
spdk_put_pdu(pdu3);
spdk_put_pdu(pdu2);
spdk_put_pdu(pdu1);
iscsi_put_pdu(pdu5);
iscsi_put_pdu(pdu4);
iscsi_put_pdu(pdu3);
iscsi_put_pdu(pdu2);
iscsi_put_pdu(pdu1);
}
static void
@ -908,7 +908,7 @@ clear_all_transfer_tasks_test(void)
task1 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task1 != NULL);
pdu1 = spdk_get_pdu(&conn);
pdu1 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu1 != NULL);
pdu1->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -921,7 +921,7 @@ clear_all_transfer_tasks_test(void)
rc = add_transfer_task(&conn, task1);
CU_ASSERT(rc == 0);
mgmt_pdu1 = spdk_get_pdu(&conn);
mgmt_pdu1 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(mgmt_pdu1 != NULL);
mgmt_pdu1->cmd_sn = alloc_cmd_sn;
@ -929,7 +929,7 @@ clear_all_transfer_tasks_test(void)
task2 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task2 != NULL);
pdu2 = spdk_get_pdu(&conn);
pdu2 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu2 != NULL);
pdu2->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -944,7 +944,7 @@ clear_all_transfer_tasks_test(void)
task3 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task3 != NULL);
pdu3 = spdk_get_pdu(&conn);
pdu3 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu3 != NULL);
pdu3->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -959,7 +959,7 @@ clear_all_transfer_tasks_test(void)
task4 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task4 != NULL);
pdu4 = spdk_get_pdu(&conn);
pdu4 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu4 != NULL);
pdu4->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -974,7 +974,7 @@ clear_all_transfer_tasks_test(void)
task5 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task5 != NULL);
pdu5 = spdk_get_pdu(&conn);
pdu5 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu5 != NULL);
pdu5->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -987,7 +987,7 @@ clear_all_transfer_tasks_test(void)
rc = add_transfer_task(&conn, task5);
CU_ASSERT(rc == 0);
mgmt_pdu2 = spdk_get_pdu(&conn);
mgmt_pdu2 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(mgmt_pdu2 != NULL);
mgmt_pdu2->cmd_sn = alloc_cmd_sn;
@ -995,7 +995,7 @@ clear_all_transfer_tasks_test(void)
task6 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task6 != NULL);
pdu6 = spdk_get_pdu(&conn);
pdu6 = iscsi_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu6 != NULL);
pdu6->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
@ -1016,7 +1016,7 @@ clear_all_transfer_tasks_test(void)
CU_ASSERT(get_transfer_task(&conn, 4) == task4);
CU_ASSERT(get_transfer_task(&conn, 5) == NULL);
spdk_clear_all_transfer_task(&conn, &lun1, mgmt_pdu1);
iscsi_clear_all_transfer_task(&conn, &lun1, mgmt_pdu1);
CU_ASSERT(!TAILQ_EMPTY(&conn.queued_r2t_tasks));
CU_ASSERT(get_transfer_task(&conn, 1) == NULL);
@ -1026,7 +1026,7 @@ clear_all_transfer_tasks_test(void)
CU_ASSERT(get_transfer_task(&conn, 5) == task5);
CU_ASSERT(get_transfer_task(&conn, 6) == NULL);
spdk_clear_all_transfer_task(&conn, &lun1, NULL);
iscsi_clear_all_transfer_task(&conn, &lun1, NULL);
CU_ASSERT(TAILQ_EMPTY(&conn.queued_r2t_tasks));
CU_ASSERT(get_transfer_task(&conn, 1) == NULL);
@ -1036,13 +1036,13 @@ clear_all_transfer_tasks_test(void)
CU_ASSERT(get_transfer_task(&conn, 5) == task5);
CU_ASSERT(get_transfer_task(&conn, 6) == task6);
spdk_clear_all_transfer_task(&conn, &lun2, mgmt_pdu2);
iscsi_clear_all_transfer_task(&conn, &lun2, mgmt_pdu2);
CU_ASSERT(get_transfer_task(&conn, 4) == NULL);
CU_ASSERT(get_transfer_task(&conn, 5) == NULL);
CU_ASSERT(get_transfer_task(&conn, 6) == task6);
spdk_clear_all_transfer_task(&conn, NULL, NULL);
iscsi_clear_all_transfer_task(&conn, NULL, NULL);
CU_ASSERT(get_transfer_task(&conn, 6) == NULL);
@ -1050,17 +1050,17 @@ clear_all_transfer_tasks_test(void)
while (!TAILQ_EMPTY(&g_write_pdu_list)) {
pdu = TAILQ_FIRST(&g_write_pdu_list);
TAILQ_REMOVE(&g_write_pdu_list, pdu, tailq);
spdk_put_pdu(pdu);
iscsi_put_pdu(pdu);
}
spdk_put_pdu(mgmt_pdu2);
spdk_put_pdu(mgmt_pdu1);
spdk_put_pdu(pdu6);
spdk_put_pdu(pdu5);
spdk_put_pdu(pdu4);
spdk_put_pdu(pdu3);
spdk_put_pdu(pdu2);
spdk_put_pdu(pdu1);
iscsi_put_pdu(mgmt_pdu2);
iscsi_put_pdu(mgmt_pdu1);
iscsi_put_pdu(pdu6);
iscsi_put_pdu(pdu5);
iscsi_put_pdu(pdu4);
iscsi_put_pdu(pdu3);
iscsi_put_pdu(pdu2);
iscsi_put_pdu(pdu1);
}
static void
@ -1288,7 +1288,7 @@ check_iscsi_reject(struct spdk_iscsi_pdu *pdu, uint8_t reason)
CU_ASSERT(reject_bhs->reason == reason);
TAILQ_REMOVE(&g_write_pdu_list, rsp_pdu, tailq);
spdk_put_pdu(rsp_pdu);
iscsi_put_pdu(rsp_pdu);
pdu->is_rejected = false;
}
@ -1305,7 +1305,7 @@ check_login_response(uint8_t status_class, uint8_t status_detail)
CU_ASSERT(login_rsph->status_detail == status_detail);
TAILQ_REMOVE(&g_write_pdu_list, rsp_pdu, tailq);
spdk_put_pdu(rsp_pdu);
iscsi_put_pdu(rsp_pdu);
}
static void
@ -1383,7 +1383,7 @@ pdu_hdr_op_login_test(void)
CU_ASSERT(rc == 0);
CU_ASSERT(conn.login_rsp_pdu != NULL);
spdk_put_pdu(conn.login_rsp_pdu);
iscsi_put_pdu(conn.login_rsp_pdu);
}
static void
@ -1402,14 +1402,14 @@ pdu_hdr_op_text_test(void)
/* Case 1 - Data segment length for text request must not be more than
* FirstBurstLength plus extra space to account for digests.
*/
pdu.data_segment_len = spdk_get_max_immediate_data_size() + 1;
pdu.data_segment_len = iscsi_get_max_immediate_data_size() + 1;
rc = iscsi_pdu_hdr_op_text(&conn, &pdu);
CU_ASSERT(rc == 0);
check_iscsi_reject(&pdu, ISCSI_REASON_PROTOCOL_ERROR);
/* Case 2 - A text request with the C bit set to 1 must have the F bit set to 0. */
pdu.data_segment_len = spdk_get_max_immediate_data_size();
pdu.data_segment_len = iscsi_get_max_immediate_data_size();
text_reqh->flags |= ISCSI_FLAG_FINAL;
text_reqh->flags |= ISCSI_TEXT_CONTINUE;
@ -1470,7 +1470,7 @@ check_logout_response(uint8_t response, uint32_t stat_sn, uint32_t exp_cmd_sn,
CU_ASSERT(from_be32(&logout_rsph->max_cmd_sn) == max_cmd_sn);
TAILQ_REMOVE(&g_write_pdu_list, rsp_pdu, tailq);
spdk_put_pdu(rsp_pdu);
iscsi_put_pdu(rsp_pdu);
}
static void
@ -1611,7 +1611,7 @@ pdu_hdr_op_scsi_test(void)
*/
scsi_reqh->read_bit = 0;
scsi_reqh->write_bit = 1;
pdu.data_segment_len = spdk_get_max_immediate_data_size() + 1;
pdu.data_segment_len = iscsi_get_max_immediate_data_size() + 1;
rc = iscsi_pdu_hdr_op_scsi(&conn, &pdu);
CU_ASSERT(rc == 0);
@ -1620,7 +1620,7 @@ pdu_hdr_op_scsi_test(void)
/* Case 7 - For SCSI write command PDU, its data segment length must not be more than
* Expected Data Transfer Length (EDTL).
*/
pdu.data_segment_len = spdk_get_max_immediate_data_size();
pdu.data_segment_len = iscsi_get_max_immediate_data_size();
to_be32(&scsi_reqh->expected_data_xfer_len, pdu.data_segment_len - 1);
rc = iscsi_pdu_hdr_op_scsi(&conn, &pdu);
@ -1683,7 +1683,7 @@ check_iscsi_task_mgmt_response(uint8_t response, uint32_t task_tag, uint32_t sta
CU_ASSERT(from_be32(&rsph->max_cmd_sn) == max_cmd_sn);
TAILQ_REMOVE(&g_write_pdu_list, rsp_pdu, tailq);
spdk_put_pdu(rsp_pdu);
iscsi_put_pdu(rsp_pdu);
}
static void
@ -1835,7 +1835,7 @@ check_iscsi_r2t(struct spdk_iscsi_task *task, uint32_t len)
CU_ASSERT(from_be32(&rsph->desired_xfer_len) == len);
TAILQ_REMOVE(&g_write_pdu_list, rsp_pdu, tailq);
spdk_put_pdu(rsp_pdu);
iscsi_put_pdu(rsp_pdu);
}
static void