Commit 3570494d authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/iscsi: Remove the "spdk_" prefix from internal APIs declared in conn.h



As other small change, function iscsi_conn_pdu_generic_complete()
had been declared in conn.h but defined in iscsi.c. Move the
definition of it to iscsi.c.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1bd796288036f78a7cba8a1c0af93bd6bc19e9cf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1890


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 71e29ada
Loading
Loading
Loading
Loading
+54 −49
Original line number Diff line number Diff line
@@ -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,7 +207,7 @@ iscsi_conn_start(void *ctx)
}

int
spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal,
iscsi_conn_construct(struct spdk_iscsi_portal *portal,
		     struct spdk_sock *sock)
{
	struct spdk_iscsi_poll_group *pg;
@@ -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,
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,7 +1002,7 @@ _iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn,
}

int
spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn,
iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn,
				    uint32_t ref_task_tag)
{
	struct spdk_iscsi_task *task;
@@ -1017,7 +1017,7 @@ 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,
iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn,
				     struct spdk_scsi_lun *lun,
				     struct spdk_iscsi_pdu *pdu)
{
@@ -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,7 +1340,7 @@ 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,
iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
		     void *buf)
{
	int ret;
@@ -1376,7 +1376,7 @@ spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
}

int
spdk_iscsi_conn_readv_data(struct spdk_iscsi_conn *conn,
iscsi_conn_readv_data(struct spdk_iscsi_conn *conn,
		      struct iovec *iov, int iovcnt)
{
	int ret;
@@ -1386,7 +1386,7 @@ spdk_iscsi_conn_readv_data(struct spdk_iscsi_conn *conn,
	}

	if (iovcnt == 1) {
		return spdk_iscsi_conn_read_data(conn, iov[0].iov_len,
		return iscsi_conn_read_data(conn, iov[0].iov_len,
					    iov[0].iov_base);
	}

@@ -1481,12 +1481,17 @@ _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_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)
{
@@ -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;

+28 −28
Original line number Diff line number Diff line
@@ -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);

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 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,
void iscsi_task_cpl(struct spdk_scsi_task *scsi_task);
void iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task);

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 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 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,
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 spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn,
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,
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 spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
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 */
+47 −52
Original line number Diff line number Diff line
@@ -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,7 +354,7 @@ 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,
		return iscsi_conn_read_data(conn,
					    segment_len - pdu->data_valid_bytes,
					    pdu->data_buf + pdu->data_valid_bytes);
	} else {
@@ -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,7 +4637,7 @@ 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,
				rc = iscsi_conn_read_data(conn,
							  ISCSI_BHS_LEN - pdu->bhs_valid_bytes,
							  (uint8_t *)&pdu->bhs + pdu->bhs_valid_bytes);
				if (rc < 0) {
@@ -4661,7 +4656,7 @@ 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,
				rc = iscsi_conn_read_data(conn,
							  ahs_len - pdu->ahs_valid_bytes,
							  pdu->ahs + pdu->ahs_valid_bytes);
				if (rc < 0) {
@@ -4678,7 +4673,7 @@ 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,
				rc = iscsi_conn_read_data(conn,
							  ISCSI_DIGEST_LEN - pdu->hdigest_valid_bytes,
							  pdu->header_digest + pdu->hdigest_valid_bytes);
				if (rc < 0) {
@@ -4753,7 +4748,7 @@ 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,
				rc = iscsi_conn_read_data(conn,
							  ISCSI_DIGEST_LEN - pdu->ddigest_valid_bytes,
							  pdu->data_digest + pdu->ddigest_valid_bytes);
				if (rc < 0) {
+0 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading