mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-19 06:22:22 +00:00
- get_transport_version() function changed to get target on entry
- transport versions propageted to user space handlers git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2061 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -312,6 +312,8 @@ struct scst_user_sess
|
||||
uint64_t lun;
|
||||
uint16_t threads_num;
|
||||
uint8_t rd_only;
|
||||
uint16_t scsi_transport_version;
|
||||
uint16_t phys_transport_version;
|
||||
char initiator_name[SCST_MAX_NAME];
|
||||
char target_name[SCST_MAX_NAME];
|
||||
},
|
||||
@@ -327,6 +329,12 @@ where:
|
||||
|
||||
- rd_only - if true, this device is read only in this session
|
||||
|
||||
- scsi_transport_version - version descriptor value for SCSI transport
|
||||
of this session
|
||||
|
||||
- phys_transport_version - version descriptor value for physical transport
|
||||
of this session
|
||||
|
||||
- initiator_name - name of the remote initiator, which initiated this
|
||||
session
|
||||
|
||||
|
||||
@@ -3746,7 +3746,7 @@ static struct scst_trace_log iscsi_local_trace_tbl[] = {
|
||||
#define ISCSI_TRACE_TBL_HELP ", d_write, conn, conn_dbg, iov, pdu, net_page"
|
||||
#endif
|
||||
|
||||
static uint16_t iscsi_get_scsi_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t iscsi_get_scsi_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
return 0x0960; /* iSCSI */
|
||||
}
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ static void mvst_host_action(struct mvs_info *mvi,
|
||||
enum mvst_tgt_host_action_t action, u8 phyid);
|
||||
static int mvst_start_sas_target(struct mvs_info *mvi, u8 id);
|
||||
static int mvst_restart_free_list(struct mvs_info *mvi, u8 slot_id);
|
||||
static uint16_t mvst_get_scsi_transport_version(struct scst_cmd *scst_cmd);
|
||||
static uint16_t mvst_get_scsi_transport_version(struct scst_tgt *scst_tgt);
|
||||
|
||||
struct kmem_cache *mvst_cmd_cachep;
|
||||
struct mvst_msg_queue tgt_msg_queue;
|
||||
@@ -96,7 +96,7 @@ struct scst_tgt_template tgt_template = {
|
||||
* Functions
|
||||
*/
|
||||
|
||||
static uint16_t mvst_get_scsi_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t mvst_get_scsi_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
return 0x0BE0; /* SAS */
|
||||
}
|
||||
|
||||
@@ -96,8 +96,8 @@ static int q2t_cut_cmd_data_head(struct q2t_cmd *cmd, unsigned int offset);
|
||||
static void q2t_clear_tgt_db(struct q2t_tgt *tgt, bool local_only);
|
||||
static void q2t_on_hw_pending_cmd_timeout(struct scst_cmd *scst_cmd);
|
||||
static int q2t_unreg_sess(struct q2t_sess *sess);
|
||||
static uint16_t q2t_get_scsi_transport_version(struct scst_cmd *scst_cmd);
|
||||
static uint16_t q2t_get_phys_transport_version(struct scst_cmd *scst_cmd);
|
||||
static uint16_t q2t_get_scsi_transport_version(struct scst_tgt *scst_tgt);
|
||||
static uint16_t q2t_get_phys_transport_version(struct scst_tgt *scst_tgt);
|
||||
|
||||
#ifndef CONFIG_SCST_PROC
|
||||
|
||||
@@ -5507,13 +5507,13 @@ static void q2t_proc_log_entry_clean(struct scst_tgt_template *templ)
|
||||
|
||||
#endif /* CONFIG_SCST_PROC */
|
||||
|
||||
static uint16_t q2t_get_scsi_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t q2t_get_scsi_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
/* FCP-2 (speculative, there's no info what FW supports) */
|
||||
return 0x0900;
|
||||
}
|
||||
|
||||
static uint16_t q2t_get_phys_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t q2t_get_phys_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
return 0x0DA0; /* FC-FS */
|
||||
}
|
||||
|
||||
@@ -1581,7 +1581,7 @@ out:
|
||||
return (res);
|
||||
}
|
||||
|
||||
static uint16_t isp_get_scsi_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t isp_get_scsi_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
return 0x0900; /* FCP-2 */
|
||||
}
|
||||
|
||||
+2
-8
@@ -890,7 +890,7 @@ struct scst_tgt_template {
|
||||
*
|
||||
* OPTIONAL
|
||||
*/
|
||||
uint16_t (*get_phys_transport_version) (struct scst_cmd *cmd);
|
||||
uint16_t (*get_phys_transport_version) (struct scst_tgt *tgt);
|
||||
|
||||
/*
|
||||
* Should return SCSI transport version. Used in the corresponding
|
||||
@@ -898,7 +898,7 @@ struct scst_tgt_template {
|
||||
*
|
||||
* OPTIONAL
|
||||
*/
|
||||
uint16_t (*get_scsi_transport_version) (struct scst_cmd *cmd);
|
||||
uint16_t (*get_scsi_transport_version) (struct scst_tgt *tgt);
|
||||
|
||||
/*
|
||||
* Name of the template. Must be unique to identify
|
||||
@@ -2763,12 +2763,6 @@ static inline void scst_cmd_set_ext_cdb(struct scst_cmd *cmd,
|
||||
cmd->ext_cdb_len = ext_cdb_len;
|
||||
}
|
||||
|
||||
/* Returns cmd's target */
|
||||
static inline struct scst_tgt *scst_cmd_get_tgt(struct scst_cmd *cmd)
|
||||
{
|
||||
return cmd->tgt;
|
||||
}
|
||||
|
||||
/* Returns cmd's session */
|
||||
static inline struct scst_session *scst_cmd_get_session(struct scst_cmd *cmd)
|
||||
{
|
||||
|
||||
@@ -107,6 +107,8 @@ struct scst_user_sess {
|
||||
aligned_u64 lun;
|
||||
uint16_t threads_num;
|
||||
uint8_t rd_only;
|
||||
uint16_t scsi_transport_version;
|
||||
uint16_t phys_transport_version;
|
||||
char initiator_name[SCST_MAX_EXTERNAL_NAME];
|
||||
char target_name[SCST_MAX_EXTERNAL_NAME];
|
||||
};
|
||||
|
||||
@@ -2589,6 +2589,8 @@ static int dev_user_attach_tgt(struct scst_tgt_dev *tgt_dev)
|
||||
int res = 0, rc;
|
||||
struct scst_user_cmd *ucmd;
|
||||
DECLARE_COMPLETION_ONSTACK(cmpl);
|
||||
struct scst_tgt_template *tgtt = tgt_dev->sess->tgt->tgtt;
|
||||
struct scst_tgt *tgt = tgt_dev->sess->tgt;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
@@ -2618,6 +2620,12 @@ static int dev_user_attach_tgt(struct scst_tgt_dev *tgt_dev)
|
||||
ucmd->user_cmd.sess.lun = (uint64_t)tgt_dev->lun;
|
||||
ucmd->user_cmd.sess.threads_num = tgt_dev->sess->tgt->tgtt->threads_num;
|
||||
ucmd->user_cmd.sess.rd_only = tgt_dev->acg_dev->rd_only;
|
||||
if (tgtt->get_phys_transport_version != NULL)
|
||||
ucmd->user_cmd.sess.phys_transport_version =
|
||||
tgtt->get_phys_transport_version(tgt);
|
||||
if (tgtt->get_scsi_transport_version != NULL)
|
||||
ucmd->user_cmd.sess.scsi_transport_version =
|
||||
tgtt->get_scsi_transport_version(tgt);
|
||||
strlcpy(ucmd->user_cmd.sess.initiator_name,
|
||||
tgt_dev->sess->initiator_name,
|
||||
sizeof(ucmd->user_cmd.sess.initiator_name)-1);
|
||||
|
||||
@@ -1447,7 +1447,7 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
|
||||
|
||||
/* Physical transport */
|
||||
if (cmd->tgtt->get_phys_transport_version != NULL) {
|
||||
uint16_t v = cmd->tgtt->get_phys_transport_version(cmd);
|
||||
uint16_t v = cmd->tgtt->get_phys_transport_version(cmd->tgt);
|
||||
if (v != 0) {
|
||||
*((uint16_t *)&buf[58 + num]) = cpu_to_be16(v);
|
||||
num += 2;
|
||||
@@ -1457,7 +1457,7 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
|
||||
/* SCSI transport */
|
||||
if (cmd->tgtt->get_scsi_transport_version != NULL) {
|
||||
*((uint16_t *)&buf[58 + num]) =
|
||||
cpu_to_be16(cmd->tgtt->get_scsi_transport_version(cmd));
|
||||
cpu_to_be16(cmd->tgtt->get_scsi_transport_version(cmd->tgt));
|
||||
num += 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -1674,12 +1674,11 @@ static const struct attribute *scst_local_sess_attrs[] = {
|
||||
|
||||
#endif /* CONFIG_SCST_PROC */
|
||||
|
||||
static uint16_t scst_local_get_scsi_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t scst_local_get_scsi_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
struct scst_local_host_info *host;
|
||||
|
||||
host = (struct scst_local_host_info *)scst_tgt_get_tgt_priv(
|
||||
scst_cmd_get_tgt(scst_cmd));
|
||||
host = (struct scst_local_host_info *)scst_tgt_get_tgt_priv(scst_tgt);
|
||||
|
||||
if (host->scsi_transport_version == 0)
|
||||
return 0x0BE0; /* SAS */
|
||||
@@ -1687,12 +1686,11 @@ static uint16_t scst_local_get_scsi_transport_version(struct scst_cmd *scst_cmd)
|
||||
return host->scsi_transport_version;
|
||||
}
|
||||
|
||||
static uint16_t scst_local_get_phys_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t scst_local_get_phys_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
struct scst_local_host_info *host;
|
||||
|
||||
host = (struct scst_local_host_info *)scst_tgt_get_tgt_priv(
|
||||
scst_cmd_get_tgt(scst_cmd));
|
||||
host = (struct scst_local_host_info *)scst_tgt_get_tgt_priv(scst_tgt);
|
||||
|
||||
return host->phys_transport_version;
|
||||
}
|
||||
|
||||
+1
-1
@@ -3495,7 +3495,7 @@ static int srpt_release(struct scst_tgt *scst_tgt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint16_t srpt_get_scsi_transport_version(struct scst_cmd *scst_cmd)
|
||||
static uint16_t srpt_get_scsi_transport_version(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
return 0x0940; /* SRP */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user