Commit c5797fda authored by Martin K. Petersen's avatar Martin K. Petersen
Browse files

Merge patch series "add virtual remote fabric"

Dmitry Bogdanov <d.bogdanov@yadro.com> says:

The patchset is based on 6.4/scsi-staging branch.

The first 11 patches are just a refactoring to reduce code duplication
in fabric drivers.  They make several callouts be optional in fabric
ops.  Make a default implementation of the optional ops and remove
such implementations in the fabric drivers.

The last patch is a new virtual remote fabric driver.  It has a
valueble sence with patchset "scsi: target: make RTPI an TPG
identifier" to configure RPTI on remote/tpgt_x same as on tpgt_y on
other nodes in a storage cluster. That allows to report the same ports
in RTPG from each node and to have a clusterwide tpg/acl/lun view in
kernel.

Link: https://lore.kernel.org/r/20230313181110.20566-1-d.bogdanov@yadro.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents e943e97c 075a5d35
Loading
Loading
Loading
Loading
+0 −33
Original line number Original line Diff line number Diff line
@@ -3300,11 +3300,6 @@ static int srpt_check_true(struct se_portal_group *se_tpg)
	return 1;
	return 1;
}
}


static int srpt_check_false(struct se_portal_group *se_tpg)
{
	return 0;
}

static struct srpt_port *srpt_tpg_to_sport(struct se_portal_group *tpg)
static struct srpt_port *srpt_tpg_to_sport(struct se_portal_group *tpg)
{
{
	return tpg->se_tpg_wwn->priv;
	return tpg->se_tpg_wwn->priv;
@@ -3334,11 +3329,6 @@ static u16 srpt_get_tag(struct se_portal_group *tpg)
	return 1;
	return 1;
}
}


static u32 srpt_tpg_get_inst_index(struct se_portal_group *se_tpg)
{
	return 1;
}

static void srpt_release_cmd(struct se_cmd *se_cmd)
static void srpt_release_cmd(struct se_cmd *se_cmd)
{
{
	struct srpt_send_ioctx *ioctx = container_of(se_cmd,
	struct srpt_send_ioctx *ioctx = container_of(se_cmd,
@@ -3378,24 +3368,6 @@ static void srpt_close_session(struct se_session *se_sess)
	srpt_disconnect_ch_sync(ch);
	srpt_disconnect_ch_sync(ch);
}
}


/**
 * srpt_sess_get_index - return the value of scsiAttIntrPortIndex (SCSI-MIB)
 * @se_sess: SCSI target session.
 *
 * A quote from RFC 4455 (SCSI-MIB) about this MIB object:
 * This object represents an arbitrary integer used to uniquely identify a
 * particular attached remote initiator port to a particular SCSI target port
 * within a particular SCSI target device within a particular SCSI instance.
 */
static u32 srpt_sess_get_index(struct se_session *se_sess)
{
	return 0;
}

static void srpt_set_default_node_attrs(struct se_node_acl *nacl)
{
}

/* Note: only used from inside debug printk's by the TCM core. */
/* Note: only used from inside debug printk's by the TCM core. */
static int srpt_get_tcm_cmd_state(struct se_cmd *se_cmd)
static int srpt_get_tcm_cmd_state(struct se_cmd *se_cmd)
{
{
@@ -3866,18 +3838,13 @@ static const struct target_core_fabric_ops srpt_template = {
	.fabric_name			= "srpt",
	.fabric_name			= "srpt",
	.tpg_get_wwn			= srpt_get_fabric_wwn,
	.tpg_get_wwn			= srpt_get_fabric_wwn,
	.tpg_get_tag			= srpt_get_tag,
	.tpg_get_tag			= srpt_get_tag,
	.tpg_check_demo_mode		= srpt_check_false,
	.tpg_check_demo_mode_cache	= srpt_check_true,
	.tpg_check_demo_mode_cache	= srpt_check_true,
	.tpg_check_demo_mode_write_protect = srpt_check_true,
	.tpg_check_demo_mode_write_protect = srpt_check_true,
	.tpg_check_prod_mode_write_protect = srpt_check_false,
	.tpg_get_inst_index		= srpt_tpg_get_inst_index,
	.release_cmd			= srpt_release_cmd,
	.release_cmd			= srpt_release_cmd,
	.check_stop_free		= srpt_check_stop_free,
	.check_stop_free		= srpt_check_stop_free,
	.close_session			= srpt_close_session,
	.close_session			= srpt_close_session,
	.sess_get_index			= srpt_sess_get_index,
	.sess_get_initiator_sid		= NULL,
	.sess_get_initiator_sid		= NULL,
	.write_pending			= srpt_write_pending,
	.write_pending			= srpt_write_pending,
	.set_default_node_attributes	= srpt_set_default_node_attrs,
	.get_cmd_state			= srpt_get_tcm_cmd_state,
	.get_cmd_state			= srpt_get_tcm_cmd_state,
	.queue_data_in			= srpt_queue_data_in,
	.queue_data_in			= srpt_queue_data_in,
	.queue_status			= srpt_queue_status,
	.queue_status			= srpt_queue_status,
+0 −20
Original line number Original line Diff line number Diff line
@@ -285,11 +285,6 @@ efct_lio_npiv_check_prod_write_protect(struct se_portal_group *se_tpg)
	return tpg->tpg_attrib.prod_mode_write_protect;
	return tpg->tpg_attrib.prod_mode_write_protect;
}
}


static u32 efct_lio_tpg_get_inst_index(struct se_portal_group *se_tpg)
{
	return 1;
}

static int efct_lio_check_stop_free(struct se_cmd *se_cmd)
static int efct_lio_check_stop_free(struct se_cmd *se_cmd)
{
{
	struct efct_scsi_tgt_io *ocp =
	struct efct_scsi_tgt_io *ocp =
@@ -355,15 +350,6 @@ static void efct_lio_close_session(struct se_session *se_sess)
	efc_node_post_shutdown(node, NULL);
	efc_node_post_shutdown(node, NULL);
}
}


static u32 efct_lio_sess_get_index(struct se_session *se_sess)
{
	return 0;
}

static void efct_lio_set_default_node_attrs(struct se_node_acl *nacl)
{
}

static int efct_lio_get_cmd_state(struct se_cmd *cmd)
static int efct_lio_get_cmd_state(struct se_cmd *cmd)
{
{
	struct efct_scsi_tgt_io *ocp =
	struct efct_scsi_tgt_io *ocp =
@@ -1607,14 +1593,11 @@ static const struct target_core_fabric_ops efct_lio_ops = {
	.tpg_check_demo_mode_cache      = efct_lio_check_demo_mode_cache,
	.tpg_check_demo_mode_cache      = efct_lio_check_demo_mode_cache,
	.tpg_check_demo_mode_write_protect = efct_lio_check_demo_write_protect,
	.tpg_check_demo_mode_write_protect = efct_lio_check_demo_write_protect,
	.tpg_check_prod_mode_write_protect = efct_lio_check_prod_write_protect,
	.tpg_check_prod_mode_write_protect = efct_lio_check_prod_write_protect,
	.tpg_get_inst_index		= efct_lio_tpg_get_inst_index,
	.check_stop_free		= efct_lio_check_stop_free,
	.check_stop_free		= efct_lio_check_stop_free,
	.aborted_task			= efct_lio_aborted_task,
	.aborted_task			= efct_lio_aborted_task,
	.release_cmd			= efct_lio_release_cmd,
	.release_cmd			= efct_lio_release_cmd,
	.close_session			= efct_lio_close_session,
	.close_session			= efct_lio_close_session,
	.sess_get_index			= efct_lio_sess_get_index,
	.write_pending			= efct_lio_write_pending,
	.write_pending			= efct_lio_write_pending,
	.set_default_node_attributes	= efct_lio_set_default_node_attrs,
	.get_cmd_state			= efct_lio_get_cmd_state,
	.get_cmd_state			= efct_lio_get_cmd_state,
	.queue_data_in			= efct_lio_queue_data_in,
	.queue_data_in			= efct_lio_queue_data_in,
	.queue_status			= efct_lio_queue_status,
	.queue_status			= efct_lio_queue_status,
@@ -1644,14 +1627,11 @@ static const struct target_core_fabric_ops efct_lio_npiv_ops = {
					efct_lio_npiv_check_demo_write_protect,
					efct_lio_npiv_check_demo_write_protect,
	.tpg_check_prod_mode_write_protect =
	.tpg_check_prod_mode_write_protect =
					efct_lio_npiv_check_prod_write_protect,
					efct_lio_npiv_check_prod_write_protect,
	.tpg_get_inst_index		= efct_lio_tpg_get_inst_index,
	.check_stop_free		= efct_lio_check_stop_free,
	.check_stop_free		= efct_lio_check_stop_free,
	.aborted_task			= efct_lio_aborted_task,
	.aborted_task			= efct_lio_aborted_task,
	.release_cmd			= efct_lio_release_cmd,
	.release_cmd			= efct_lio_release_cmd,
	.close_session			= efct_lio_close_session,
	.close_session			= efct_lio_close_session,
	.sess_get_index			= efct_lio_sess_get_index,
	.write_pending			= efct_lio_write_pending,
	.write_pending			= efct_lio_write_pending,
	.set_default_node_attributes	= efct_lio_set_default_node_attrs,
	.get_cmd_state			= efct_lio_get_cmd_state,
	.get_cmd_state			= efct_lio_get_cmd_state,
	.queue_data_in			= efct_lio_queue_data_in,
	.queue_data_in			= efct_lio_queue_data_in,
	.queue_status			= efct_lio_queue_status,
	.queue_status			= efct_lio_queue_status,
+0 −30
Original line number Original line Diff line number Diff line
@@ -3698,16 +3698,6 @@ static int ibmvscsis_check_true(struct se_portal_group *se_tpg)
	return 1;
	return 1;
}
}


static int ibmvscsis_check_false(struct se_portal_group *se_tpg)
{
	return 0;
}

static u32 ibmvscsis_tpg_get_inst_index(struct se_portal_group *se_tpg)
{
	return 1;
}

static int ibmvscsis_check_stop_free(struct se_cmd *se_cmd)
static int ibmvscsis_check_stop_free(struct se_cmd *se_cmd)
{
{
	return target_put_sess_cmd(se_cmd);
	return target_put_sess_cmd(se_cmd);
@@ -3726,11 +3716,6 @@ static void ibmvscsis_release_cmd(struct se_cmd *se_cmd)
	spin_unlock_bh(&vscsi->intr_lock);
	spin_unlock_bh(&vscsi->intr_lock);
}
}


static u32 ibmvscsis_sess_get_index(struct se_session *se_sess)
{
	return 0;
}

static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
{
{
	struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd,
	struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd,
@@ -3765,15 +3750,6 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
	return 0;
	return 0;
}
}


static void ibmvscsis_set_default_node_attrs(struct se_node_acl *nacl)
{
}

static int ibmvscsis_get_cmd_state(struct se_cmd *se_cmd)
{
	return 0;
}

static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd)
static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd)
{
{
	struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd,
	struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd,
@@ -3982,15 +3958,9 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
	.tpg_get_default_depth		= ibmvscsis_get_default_depth,
	.tpg_get_default_depth		= ibmvscsis_get_default_depth,
	.tpg_check_demo_mode		= ibmvscsis_check_true,
	.tpg_check_demo_mode		= ibmvscsis_check_true,
	.tpg_check_demo_mode_cache	= ibmvscsis_check_true,
	.tpg_check_demo_mode_cache	= ibmvscsis_check_true,
	.tpg_check_demo_mode_write_protect = ibmvscsis_check_false,
	.tpg_check_prod_mode_write_protect = ibmvscsis_check_false,
	.tpg_get_inst_index		= ibmvscsis_tpg_get_inst_index,
	.check_stop_free		= ibmvscsis_check_stop_free,
	.check_stop_free		= ibmvscsis_check_stop_free,
	.release_cmd			= ibmvscsis_release_cmd,
	.release_cmd			= ibmvscsis_release_cmd,
	.sess_get_index			= ibmvscsis_sess_get_index,
	.write_pending			= ibmvscsis_write_pending,
	.write_pending			= ibmvscsis_write_pending,
	.set_default_node_attributes	= ibmvscsis_set_default_node_attrs,
	.get_cmd_state			= ibmvscsis_get_cmd_state,
	.queue_data_in			= ibmvscsis_queue_data_in,
	.queue_data_in			= ibmvscsis_queue_data_in,
	.queue_status			= ibmvscsis_queue_status,
	.queue_status			= ibmvscsis_queue_status,
	.queue_tm_rsp			= ibmvscsis_queue_tm_rsp,
	.queue_tm_rsp			= ibmvscsis_queue_tm_rsp,
+0 −14
Original line number Original line Diff line number Diff line
@@ -377,11 +377,6 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess)
	tcm_qla2xxx_put_sess(sess);
	tcm_qla2xxx_put_sess(sess);
}
}


static u32 tcm_qla2xxx_sess_get_index(struct se_session *se_sess)
{
	return 0;
}

static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
{
{
	struct qla_tgt_cmd *cmd = container_of(se_cmd,
	struct qla_tgt_cmd *cmd = container_of(se_cmd,
@@ -421,11 +416,6 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
	return qlt_rdy_to_xfer(cmd);
	return qlt_rdy_to_xfer(cmd);
}
}


static void tcm_qla2xxx_set_default_node_attrs(struct se_node_acl *nacl)
{
	return;
}

static int tcm_qla2xxx_get_cmd_state(struct se_cmd *se_cmd)
static int tcm_qla2xxx_get_cmd_state(struct se_cmd *se_cmd)
{
{
	if (!(se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) {
	if (!(se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) {
@@ -1811,10 +1801,8 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
	.check_stop_free		= tcm_qla2xxx_check_stop_free,
	.check_stop_free		= tcm_qla2xxx_check_stop_free,
	.release_cmd			= tcm_qla2xxx_release_cmd,
	.release_cmd			= tcm_qla2xxx_release_cmd,
	.close_session			= tcm_qla2xxx_close_session,
	.close_session			= tcm_qla2xxx_close_session,
	.sess_get_index			= tcm_qla2xxx_sess_get_index,
	.sess_get_initiator_sid		= NULL,
	.sess_get_initiator_sid		= NULL,
	.write_pending			= tcm_qla2xxx_write_pending,
	.write_pending			= tcm_qla2xxx_write_pending,
	.set_default_node_attributes	= tcm_qla2xxx_set_default_node_attrs,
	.get_cmd_state			= tcm_qla2xxx_get_cmd_state,
	.get_cmd_state			= tcm_qla2xxx_get_cmd_state,
	.queue_data_in			= tcm_qla2xxx_queue_data_in,
	.queue_data_in			= tcm_qla2xxx_queue_data_in,
	.queue_status			= tcm_qla2xxx_queue_status,
	.queue_status			= tcm_qla2xxx_queue_status,
@@ -1852,10 +1840,8 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
	.check_stop_free                = tcm_qla2xxx_check_stop_free,
	.check_stop_free                = tcm_qla2xxx_check_stop_free,
	.release_cmd			= tcm_qla2xxx_release_cmd,
	.release_cmd			= tcm_qla2xxx_release_cmd,
	.close_session			= tcm_qla2xxx_close_session,
	.close_session			= tcm_qla2xxx_close_session,
	.sess_get_index			= tcm_qla2xxx_sess_get_index,
	.sess_get_initiator_sid		= NULL,
	.sess_get_initiator_sid		= NULL,
	.write_pending			= tcm_qla2xxx_write_pending,
	.write_pending			= tcm_qla2xxx_write_pending,
	.set_default_node_attributes	= tcm_qla2xxx_set_default_node_attrs,
	.get_cmd_state			= tcm_qla2xxx_get_cmd_state,
	.get_cmd_state			= tcm_qla2xxx_get_cmd_state,
	.queue_data_in			= tcm_qla2xxx_queue_data_in,
	.queue_data_in			= tcm_qla2xxx_queue_data_in,
	.queue_status			= tcm_qla2xxx_queue_status,
	.queue_status			= tcm_qla2xxx_queue_status,
+1 −0
Original line number Original line Diff line number Diff line
@@ -47,5 +47,6 @@ source "drivers/target/loopback/Kconfig"
source "drivers/target/tcm_fc/Kconfig"
source "drivers/target/tcm_fc/Kconfig"
source "drivers/target/iscsi/Kconfig"
source "drivers/target/iscsi/Kconfig"
source "drivers/target/sbp/Kconfig"
source "drivers/target/sbp/Kconfig"
source "drivers/target/tcm_remote/Kconfig"


endif
endif
Loading