提交 5d964837 编写于 作者: Q Quinn Tran 提交者: Nicholas Bellinger

qla2xxx: Track I-T nexus as single fc_port struct

Current code merges qla_tgt_sess and fc_port structure
into single fc_port structure representing same I-T nexus.
Signed-off-by: NQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: NHimanshu Madhani <himanshu.madhani@cavium.com>
[ bvanassche: fixed spelling of patch description ]
Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 37cacc0a
...@@ -1976,6 +1976,84 @@ struct mbx_entry { ...@@ -1976,6 +1976,84 @@ struct mbx_entry {
uint8_t port_name[WWN_SIZE]; uint8_t port_name[WWN_SIZE];
}; };
#ifndef IMMED_NOTIFY_TYPE
#define IMMED_NOTIFY_TYPE 0x0D /* Immediate notify entry. */
/*
* ISP queue - immediate notify entry structure definition.
* This is sent by the ISP to the Target driver.
* This IOCB would have report of events sent by the
* initiator, that needs to be handled by the target
* driver immediately.
*/
struct imm_ntfy_from_isp {
uint8_t entry_type; /* Entry type. */
uint8_t entry_count; /* Entry count. */
uint8_t sys_define; /* System defined. */
uint8_t entry_status; /* Entry Status. */
union {
struct {
uint32_t sys_define_2; /* System defined. */
target_id_t target;
uint16_t lun;
uint8_t target_id;
uint8_t reserved_1;
uint16_t status_modifier;
uint16_t status;
uint16_t task_flags;
uint16_t seq_id;
uint16_t srr_rx_id;
uint32_t srr_rel_offs;
uint16_t srr_ui;
#define SRR_IU_DATA_IN 0x1
#define SRR_IU_DATA_OUT 0x5
#define SRR_IU_STATUS 0x7
uint16_t srr_ox_id;
uint8_t reserved_2[28];
} isp2x;
struct {
uint32_t reserved;
uint16_t nport_handle;
uint16_t reserved_2;
uint16_t flags;
#define NOTIFY24XX_FLAGS_GLOBAL_TPRLO BIT_1
#define NOTIFY24XX_FLAGS_PUREX_IOCB BIT_0
uint16_t srr_rx_id;
uint16_t status;
uint8_t status_subcode;
uint8_t fw_handle;
uint32_t exchange_address;
uint32_t srr_rel_offs;
uint16_t srr_ui;
uint16_t srr_ox_id;
union {
struct {
uint8_t node_name[8];
} plogi; /* PLOGI/ADISC/PDISC */
struct {
/* PRLI word 3 bit 0-15 */
uint16_t wd3_lo;
uint8_t resv0[6];
} prli;
struct {
uint8_t port_id[3];
uint8_t resv1;
uint16_t nport_handle;
uint16_t resv2;
} req_els;
} u;
uint8_t port_name[8];
uint8_t resv3[3];
uint8_t vp_index;
uint32_t reserved_5;
uint8_t port_id[3];
uint8_t reserved_6;
} isp24;
} u;
uint16_t reserved_7;
uint16_t ox_id;
} __packed;
#endif
/* /*
* ISP request and response queue entry sizes * ISP request and response queue entry sizes
*/ */
...@@ -2026,7 +2104,7 @@ typedef struct { ...@@ -2026,7 +2104,7 @@ typedef struct {
/* /*
* Fibre channel port type. * Fibre channel port type.
*/ */
typedef enum { typedef enum {
FCT_UNKNOWN, FCT_UNKNOWN,
FCT_RSCN, FCT_RSCN,
FCT_SWITCH, FCT_SWITCH,
...@@ -2035,6 +2113,19 @@ typedef struct { ...@@ -2035,6 +2113,19 @@ typedef struct {
FCT_TARGET FCT_TARGET
} fc_port_type_t; } fc_port_type_t;
enum qlt_plogi_link_t {
QLT_PLOGI_LINK_SAME_WWN,
QLT_PLOGI_LINK_CONFLICT,
QLT_PLOGI_LINK_MAX
};
struct qlt_plogi_ack_t {
struct list_head list;
struct imm_ntfy_from_isp iocb;
port_id_t id;
int ref_count;
};
/* /*
* Fibre channel port structure. * Fibre channel port structure.
*/ */
...@@ -2048,6 +2139,25 @@ typedef struct fc_port { ...@@ -2048,6 +2139,25 @@ typedef struct fc_port {
uint16_t loop_id; uint16_t loop_id;
uint16_t old_loop_id; uint16_t old_loop_id;
unsigned int conf_compl_supported:1;
unsigned int deleted:2;
unsigned int local:1;
unsigned int logout_on_delete:1;
unsigned int keep_nport_handle:1;
unsigned int send_els_logo:1;
unsigned char logout_completed;
int generation;
struct se_session *se_sess;
struct kref sess_kref;
struct qla_tgt *tgt;
unsigned long expires;
struct list_head del_list_entry;
struct work_struct free_work;
struct qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX];
uint16_t tgt_id; uint16_t tgt_id;
uint16_t old_tgt_id; uint16_t old_tgt_id;
......
...@@ -18,7 +18,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused) ...@@ -18,7 +18,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
scsi_qla_host_t *vha = s->private; scsi_qla_host_t *vha = s->private;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
unsigned long flags; unsigned long flags;
struct qla_tgt_sess *sess = NULL; struct fc_port *sess = NULL;
struct qla_tgt *tgt= vha->vha_tgt.qla_tgt; struct qla_tgt *tgt= vha->vha_tgt.qla_tgt;
seq_printf(s, "%s\n",vha->host_str); seq_printf(s, "%s\n",vha->host_str);
...@@ -26,7 +26,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused) ...@@ -26,7 +26,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
seq_printf(s, "Port ID Port Name Handle\n"); seq_printf(s, "Port ID Port Name Handle\n");
spin_lock_irqsave(&ha->tgt.sess_lock, flags); spin_lock_irqsave(&ha->tgt.sess_lock, flags);
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) list_for_each_entry(sess, &vha->vp_fcports, list)
seq_printf(s, "%02x:%02x:%02x %8phC %d\n", seq_printf(s, "%02x:%02x:%02x %8phC %d\n",
sess->d_id.b.domain, sess->d_id.b.area, sess->d_id.b.domain, sess->d_id.b.area,
sess->d_id.b.al_pa, sess->port_name, sess->d_id.b.al_pa, sess->port_name,
......
...@@ -3352,12 +3352,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport) ...@@ -3352,12 +3352,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
"Unable to allocate fc remote port.\n"); "Unable to allocate fc remote port.\n");
return; return;
} }
/*
* Create target mode FC NEXUS in qla_target.c if target mode is
* enabled..
*/
qlt_fc_port_added(vha, fcport);
spin_lock_irqsave(fcport->vha->host->host_lock, flags); spin_lock_irqsave(fcport->vha->host->host_lock, flags);
*((fc_port_t **)rport->dd_data) = fcport; *((fc_port_t **)rport->dd_data) = fcport;
...@@ -3407,12 +3401,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) ...@@ -3407,12 +3401,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
reg_port: reg_port:
if (qla_ini_mode_enabled(vha)) if (qla_ini_mode_enabled(vha))
qla2x00_reg_remote_port(vha, fcport); qla2x00_reg_remote_port(vha, fcport);
else {
/*
* Create target mode FC NEXUS in qla_target.c
*/
qlt_fc_port_added(vha, fcport);
}
} }
/* /*
......
...@@ -2248,7 +2248,7 @@ qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio) ...@@ -2248,7 +2248,7 @@ qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio)
logio->control_flags = logio->control_flags =
cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO); cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO);
if (!sp->fcport->tgt_session || if (!sp->fcport->tgt_session ||
!sp->fcport->tgt_session->keep_nport_handle) !sp->fcport->keep_nport_handle)
logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT); logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT);
logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); logio->nport_handle = cpu_to_le16(sp->fcport->loop_id);
logio->port_id[0] = sp->fcport->d_id.b.al_pa; logio->port_id[0] = sp->fcport->d_id.b.al_pa;
......
此差异已折叠。
...@@ -118,84 +118,6 @@ ...@@ -118,84 +118,6 @@
? le16_to_cpu((iocb)->u.isp2x.target.extended) \ ? le16_to_cpu((iocb)->u.isp2x.target.extended) \
: (uint16_t)(iocb)->u.isp2x.target.id.standard) : (uint16_t)(iocb)->u.isp2x.target.id.standard)
#ifndef IMMED_NOTIFY_TYPE
#define IMMED_NOTIFY_TYPE 0x0D /* Immediate notify entry. */
/*
* ISP queue - immediate notify entry structure definition.
* This is sent by the ISP to the Target driver.
* This IOCB would have report of events sent by the
* initiator, that needs to be handled by the target
* driver immediately.
*/
struct imm_ntfy_from_isp {
uint8_t entry_type; /* Entry type. */
uint8_t entry_count; /* Entry count. */
uint8_t sys_define; /* System defined. */
uint8_t entry_status; /* Entry Status. */
union {
struct {
uint32_t sys_define_2; /* System defined. */
target_id_t target;
uint16_t lun;
uint8_t target_id;
uint8_t reserved_1;
uint16_t status_modifier;
uint16_t status;
uint16_t task_flags;
uint16_t seq_id;
uint16_t srr_rx_id;
uint32_t srr_rel_offs;
uint16_t srr_ui;
#define SRR_IU_DATA_IN 0x1
#define SRR_IU_DATA_OUT 0x5
#define SRR_IU_STATUS 0x7
uint16_t srr_ox_id;
uint8_t reserved_2[28];
} isp2x;
struct {
uint32_t reserved;
uint16_t nport_handle;
uint16_t reserved_2;
uint16_t flags;
#define NOTIFY24XX_FLAGS_GLOBAL_TPRLO BIT_1
#define NOTIFY24XX_FLAGS_PUREX_IOCB BIT_0
uint16_t srr_rx_id;
uint16_t status;
uint8_t status_subcode;
uint8_t fw_handle;
uint32_t exchange_address;
uint32_t srr_rel_offs;
uint16_t srr_ui;
uint16_t srr_ox_id;
union {
struct {
uint8_t node_name[8];
} plogi; /* PLOGI/ADISC/PDISC */
struct {
/* PRLI word 3 bit 0-15 */
uint16_t wd3_lo;
uint8_t resv0[6];
} prli;
struct {
uint8_t port_id[3];
uint8_t resv1;
uint16_t nport_handle;
uint16_t resv2;
} req_els;
} u;
uint8_t port_name[8];
uint8_t resv3[3];
uint8_t vp_index;
uint32_t reserved_5;
uint8_t port_id[3];
uint8_t reserved_6;
} isp24;
} u;
uint16_t reserved_7;
uint16_t ox_id;
} __packed;
#endif
#ifndef NOTIFY_ACK_TYPE #ifndef NOTIFY_ACK_TYPE
#define NOTIFY_ACK_TYPE 0x0E /* Notify acknowledge entry. */ #define NOTIFY_ACK_TYPE 0x0E /* Notify acknowledge entry. */
/* /*
...@@ -731,7 +653,7 @@ struct abts_resp_from_24xx_fw { ...@@ -731,7 +653,7 @@ struct abts_resp_from_24xx_fw {
\********************************************************************/ \********************************************************************/
struct qla_tgt_mgmt_cmd; struct qla_tgt_mgmt_cmd;
struct qla_tgt_sess; struct fc_port;
/* /*
* This structure provides a template of function calls that the * This structure provides a template of function calls that the
...@@ -748,17 +670,18 @@ struct qla_tgt_func_tmpl { ...@@ -748,17 +670,18 @@ struct qla_tgt_func_tmpl {
uint32_t); uint32_t);
void (*free_cmd)(struct qla_tgt_cmd *); void (*free_cmd)(struct qla_tgt_cmd *);
void (*free_mcmd)(struct qla_tgt_mgmt_cmd *); void (*free_mcmd)(struct qla_tgt_mgmt_cmd *);
void (*free_session)(struct qla_tgt_sess *); void (*free_session)(struct fc_port *);
int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *,
struct qla_tgt_sess *); struct fc_port *);
void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool); void (*update_sess)(struct fc_port *, port_id_t, uint16_t, bool);
struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, struct fc_port *(*find_sess_by_loop_id)(struct scsi_qla_host *,
const uint16_t); const uint16_t);
struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, struct fc_port *(*find_sess_by_s_id)(struct scsi_qla_host *,
const uint8_t *); const uint8_t *);
void (*clear_nacl_from_fcport_map)(struct qla_tgt_sess *); void (*clear_nacl_from_fcport_map)(struct fc_port *);
void (*shutdown_sess)(struct qla_tgt_sess *); void (*put_sess)(struct fc_port *);
void (*shutdown_sess)(struct fc_port *);
}; };
int qla2x00_wait_for_hba_online(struct scsi_qla_host *); int qla2x00_wait_for_hba_online(struct scsi_qla_host *);
...@@ -874,9 +797,6 @@ struct qla_tgt { ...@@ -874,9 +797,6 @@ struct qla_tgt {
/* Count of sessions refering qla_tgt. Protected by hardware_lock. */ /* Count of sessions refering qla_tgt. Protected by hardware_lock. */
int sess_count; int sess_count;
/* Protected by hardware_lock. Addition also protected by tgt_mutex. */
struct list_head sess_list;
/* Protected by hardware_lock */ /* Protected by hardware_lock */
struct list_head del_sess_list; struct list_head del_sess_list;
struct delayed_work sess_del_work; struct delayed_work sess_del_work;
...@@ -910,52 +830,6 @@ enum qla_sess_deletion { ...@@ -910,52 +830,6 @@ enum qla_sess_deletion {
QLA_SESS_DELETION_IN_PROGRESS = 2, QLA_SESS_DELETION_IN_PROGRESS = 2,
}; };
typedef enum {
QLT_PLOGI_LINK_SAME_WWN,
QLT_PLOGI_LINK_CONFLICT,
QLT_PLOGI_LINK_MAX
} qlt_plogi_link_t;
typedef struct {
struct list_head list;
struct imm_ntfy_from_isp iocb;
port_id_t id;
int ref_count;
} qlt_plogi_ack_t;
/*
* Equivilant to IT Nexus (Initiator-Target)
*/
struct qla_tgt_sess {
uint16_t loop_id;
port_id_t d_id;
unsigned int conf_compl_supported:1;
unsigned int deleted:2;
unsigned int local:1;
unsigned int logout_on_delete:1;
unsigned int keep_nport_handle:1;
unsigned int send_els_logo:1;
unsigned char logout_completed;
int generation;
struct se_session *se_sess;
struct kref sess_kref;
struct scsi_qla_host *vha;
struct qla_tgt *tgt;
struct list_head sess_list_entry;
unsigned long expires;
struct list_head del_list_entry;
uint8_t port_name[WWN_SIZE];
struct work_struct free_work;
qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX];
};
enum trace_flags { enum trace_flags {
TRC_NEW_CMD = BIT_0, TRC_NEW_CMD = BIT_0,
TRC_DO_WORK = BIT_1, TRC_DO_WORK = BIT_1,
...@@ -981,7 +855,7 @@ enum trace_flags { ...@@ -981,7 +855,7 @@ enum trace_flags {
struct qla_tgt_cmd { struct qla_tgt_cmd {
struct se_cmd se_cmd; struct se_cmd se_cmd;
struct qla_tgt_sess *sess; struct fc_port *sess;
int state; int state;
struct work_struct free_work; struct work_struct free_work;
struct work_struct work; struct work_struct work;
...@@ -1046,7 +920,7 @@ struct qla_tgt_sess_work_param { ...@@ -1046,7 +920,7 @@ struct qla_tgt_sess_work_param {
struct qla_tgt_mgmt_cmd { struct qla_tgt_mgmt_cmd {
uint16_t tmr_func; uint16_t tmr_func;
uint8_t fc_tm_rsp; uint8_t fc_tm_rsp;
struct qla_tgt_sess *sess; struct fc_port *sess;
struct se_cmd se_cmd; struct se_cmd se_cmd;
struct work_struct free_work; struct work_struct free_work;
unsigned int flags; unsigned int flags;
...@@ -1097,7 +971,7 @@ extern int qlt_remove_target(struct qla_hw_data *, struct scsi_qla_host *); ...@@ -1097,7 +971,7 @@ extern int qlt_remove_target(struct qla_hw_data *, struct scsi_qla_host *);
extern int qlt_lport_register(void *, u64, u64, u64, extern int qlt_lport_register(void *, u64, u64, u64,
int (*callback)(struct scsi_qla_host *, void *, u64, u64)); int (*callback)(struct scsi_qla_host *, void *, u64, u64));
extern void qlt_lport_deregister(struct scsi_qla_host *); extern void qlt_lport_deregister(struct scsi_qla_host *);
void qlt_put_sess(struct qla_tgt_sess *sess); extern void qlt_unreg_sess(struct fc_port *);
extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *); extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *);
extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *, int); extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *, int);
extern int __init qlt_init(void); extern int __init qlt_init(void);
......
...@@ -339,9 +339,26 @@ static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd) ...@@ -339,9 +339,26 @@ static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd)
qlt_free_cmd(cmd); qlt_free_cmd(cmd);
} }
static void tcm_qla2xxx_release_session(struct kref *kref)
{
struct fc_port *sess = container_of(kref,
struct fc_port, sess_kref);
qlt_unreg_sess(sess);
}
static void tcm_qla2xxx_put_sess(struct fc_port *sess)
{
if (!sess)
return;
assert_spin_locked(&sess->vha->hw->tgt.sess_lock);
kref_put(&sess->sess_kref, tcm_qla2xxx_release_session);
}
static void tcm_qla2xxx_close_session(struct se_session *se_sess) static void tcm_qla2xxx_close_session(struct se_session *se_sess)
{ {
struct qla_tgt_sess *sess = se_sess->fabric_sess_ptr; struct fc_port *sess = se_sess->fabric_sess_ptr;
struct scsi_qla_host *vha; struct scsi_qla_host *vha;
unsigned long flags; unsigned long flags;
...@@ -350,7 +367,7 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess) ...@@ -350,7 +367,7 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess)
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
target_sess_cmd_list_set_waiting(se_sess); target_sess_cmd_list_set_waiting(se_sess);
qlt_put_sess(sess); tcm_qla2xxx_put_sess(sess);
spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
} }
...@@ -441,7 +458,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, ...@@ -441,7 +458,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,
{ {
struct se_cmd *se_cmd = &cmd->se_cmd; struct se_cmd *se_cmd = &cmd->se_cmd;
struct se_session *se_sess; struct se_session *se_sess;
struct qla_tgt_sess *sess; struct fc_port *sess;
#ifdef CONFIG_TCM_QLA2XXX_DEBUG #ifdef CONFIG_TCM_QLA2XXX_DEBUG
struct se_portal_group *se_tpg; struct se_portal_group *se_tpg;
struct tcm_qla2xxx_tpg *tpg; struct tcm_qla2xxx_tpg *tpg;
...@@ -456,7 +473,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, ...@@ -456,7 +473,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,
sess = cmd->sess; sess = cmd->sess;
if (!sess) { if (!sess) {
pr_err("Unable to locate struct qla_tgt_sess from qla_tgt_cmd\n"); pr_err("Unable to locate struct fc_port from qla_tgt_cmd\n");
return -EINVAL; return -EINVAL;
} }
...@@ -565,7 +582,7 @@ static void tcm_qla2xxx_handle_dif_err(struct qla_tgt_cmd *cmd) ...@@ -565,7 +582,7 @@ static void tcm_qla2xxx_handle_dif_err(struct qla_tgt_cmd *cmd)
static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun, static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun,
uint16_t tmr_func, uint32_t tag) uint16_t tmr_func, uint32_t tag)
{ {
struct qla_tgt_sess *sess = mcmd->sess; struct fc_port *sess = mcmd->sess;
struct se_cmd *se_cmd = &mcmd->se_cmd; struct se_cmd *se_cmd = &mcmd->se_cmd;
int transl_tmr_func = 0; int transl_tmr_func = 0;
...@@ -746,11 +763,11 @@ static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) ...@@ -746,11 +763,11 @@ static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd)
} }
static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *, static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *,
struct tcm_qla2xxx_nacl *, struct qla_tgt_sess *); struct tcm_qla2xxx_nacl *, struct fc_port *);
/* /*
* Expected to be called with struct qla_hw_data->tgt.sess_lock held * Expected to be called with struct qla_hw_data->tgt.sess_lock held
*/ */
static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess) static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct fc_port *sess)
{ {
struct se_node_acl *se_nacl = sess->se_sess->se_node_acl; struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
struct se_portal_group *se_tpg = se_nacl->se_tpg; struct se_portal_group *se_tpg = se_nacl->se_tpg;
...@@ -789,7 +806,7 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess) ...@@ -789,7 +806,7 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess)
tcm_qla2xxx_clear_sess_lookup(lport, nacl, sess); tcm_qla2xxx_clear_sess_lookup(lport, nacl, sess);
} }
static void tcm_qla2xxx_shutdown_sess(struct qla_tgt_sess *sess) static void tcm_qla2xxx_shutdown_sess(struct fc_port *sess)
{ {
assert_spin_locked(&sess->vha->hw->tgt.sess_lock); assert_spin_locked(&sess->vha->hw->tgt.sess_lock);
target_sess_cmd_list_set_waiting(sess->se_sess); target_sess_cmd_list_set_waiting(sess->se_sess);
...@@ -1174,7 +1191,7 @@ static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg( ...@@ -1174,7 +1191,7 @@ static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg(
/* /*
* Expected to be called with struct qla_hw_data->tgt.sess_lock held * Expected to be called with struct qla_hw_data->tgt.sess_lock held
*/ */
static struct qla_tgt_sess *tcm_qla2xxx_find_sess_by_s_id( static struct fc_port *tcm_qla2xxx_find_sess_by_s_id(
scsi_qla_host_t *vha, scsi_qla_host_t *vha,
const uint8_t *s_id) const uint8_t *s_id)
{ {
...@@ -1202,12 +1219,12 @@ static struct qla_tgt_sess *tcm_qla2xxx_find_sess_by_s_id( ...@@ -1202,12 +1219,12 @@ static struct qla_tgt_sess *tcm_qla2xxx_find_sess_by_s_id(
se_nacl, se_nacl->initiatorname); se_nacl, se_nacl->initiatorname);
nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl); nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl);
if (!nacl->qla_tgt_sess) { if (!nacl->fc_port) {
pr_err("Unable to locate struct qla_tgt_sess\n"); pr_err("Unable to locate struct fc_port\n");
return NULL; return NULL;
} }
return nacl->qla_tgt_sess; return nacl->fc_port;
} }
/* /*
...@@ -1218,7 +1235,7 @@ static void tcm_qla2xxx_set_sess_by_s_id( ...@@ -1218,7 +1235,7 @@ static void tcm_qla2xxx_set_sess_by_s_id(
struct se_node_acl *new_se_nacl, struct se_node_acl *new_se_nacl,
struct tcm_qla2xxx_nacl *nacl, struct tcm_qla2xxx_nacl *nacl,
struct se_session *se_sess, struct se_session *se_sess,
struct qla_tgt_sess *qla_tgt_sess, struct fc_port *fc_port,
uint8_t *s_id) uint8_t *s_id)
{ {
u32 key; u32 key;
...@@ -1242,22 +1259,22 @@ static void tcm_qla2xxx_set_sess_by_s_id( ...@@ -1242,22 +1259,22 @@ static void tcm_qla2xxx_set_sess_by_s_id(
pr_debug("Wiping nonexisting fc_port entry\n"); pr_debug("Wiping nonexisting fc_port entry\n");
} }
qla_tgt_sess->se_sess = se_sess; fc_port->se_sess = se_sess;
nacl->qla_tgt_sess = qla_tgt_sess; nacl->fc_port = fc_port;
return; return;
} }
if (nacl->qla_tgt_sess) { if (nacl->fc_port) {
if (new_se_nacl == NULL) { if (new_se_nacl == NULL) {
pr_debug("Clearing existing nacl->qla_tgt_sess and fc_port entry\n"); pr_debug("Clearing existing nacl->fc_port and fc_port entry\n");
btree_remove32(&lport->lport_fcport_map, key); btree_remove32(&lport->lport_fcport_map, key);
nacl->qla_tgt_sess = NULL; nacl->fc_port = NULL;
return; return;
} }
pr_debug("Replacing existing nacl->qla_tgt_sess and fc_port entry\n"); pr_debug("Replacing existing nacl->fc_port and fc_port entry\n");
btree_update32(&lport->lport_fcport_map, key, new_se_nacl); btree_update32(&lport->lport_fcport_map, key, new_se_nacl);
qla_tgt_sess->se_sess = se_sess; fc_port->se_sess = se_sess;
nacl->qla_tgt_sess = qla_tgt_sess; nacl->fc_port = fc_port;
return; return;
} }
...@@ -1267,19 +1284,19 @@ static void tcm_qla2xxx_set_sess_by_s_id( ...@@ -1267,19 +1284,19 @@ static void tcm_qla2xxx_set_sess_by_s_id(
return; return;
} }
pr_debug("Replacing existing fc_port entry w/o active nacl->qla_tgt_sess\n"); pr_debug("Replacing existing fc_port entry w/o active nacl->fc_port\n");
btree_update32(&lport->lport_fcport_map, key, new_se_nacl); btree_update32(&lport->lport_fcport_map, key, new_se_nacl);
qla_tgt_sess->se_sess = se_sess; fc_port->se_sess = se_sess;
nacl->qla_tgt_sess = qla_tgt_sess; nacl->fc_port = fc_port;
pr_debug("Setup nacl->qla_tgt_sess %p by s_id for se_nacl: %p, initiatorname: %s\n", pr_debug("Setup nacl->fc_port %p by s_id for se_nacl: %p, initiatorname: %s\n",
nacl->qla_tgt_sess, new_se_nacl, new_se_nacl->initiatorname); nacl->fc_port, new_se_nacl, new_se_nacl->initiatorname);
} }
/* /*
* Expected to be called with struct qla_hw_data->tgt.sess_lock held * Expected to be called with struct qla_hw_data->tgt.sess_lock held
*/ */
static struct qla_tgt_sess *tcm_qla2xxx_find_sess_by_loop_id( static struct fc_port *tcm_qla2xxx_find_sess_by_loop_id(
scsi_qla_host_t *vha, scsi_qla_host_t *vha,
const uint16_t loop_id) const uint16_t loop_id)
{ {
...@@ -1307,12 +1324,12 @@ static struct qla_tgt_sess *tcm_qla2xxx_find_sess_by_loop_id( ...@@ -1307,12 +1324,12 @@ static struct qla_tgt_sess *tcm_qla2xxx_find_sess_by_loop_id(
nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl); nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl);
if (!nacl->qla_tgt_sess) { if (!nacl->fc_port) {
pr_err("Unable to locate struct qla_tgt_sess\n"); pr_err("Unable to locate struct fc_port\n");
return NULL; return NULL;
} }
return nacl->qla_tgt_sess; return nacl->fc_port;
} }
/* /*
...@@ -1323,7 +1340,7 @@ static void tcm_qla2xxx_set_sess_by_loop_id( ...@@ -1323,7 +1340,7 @@ static void tcm_qla2xxx_set_sess_by_loop_id(
struct se_node_acl *new_se_nacl, struct se_node_acl *new_se_nacl,
struct tcm_qla2xxx_nacl *nacl, struct tcm_qla2xxx_nacl *nacl,
struct se_session *se_sess, struct se_session *se_sess,
struct qla_tgt_sess *qla_tgt_sess, struct fc_port *fc_port,
uint16_t loop_id) uint16_t loop_id)
{ {
struct se_node_acl *saved_nacl; struct se_node_acl *saved_nacl;
...@@ -1338,27 +1355,27 @@ static void tcm_qla2xxx_set_sess_by_loop_id( ...@@ -1338,27 +1355,27 @@ static void tcm_qla2xxx_set_sess_by_loop_id(
if (!saved_nacl) { if (!saved_nacl) {
pr_debug("Setting up new fc_loopid->se_nacl to new_se_nacl\n"); pr_debug("Setting up new fc_loopid->se_nacl to new_se_nacl\n");
fc_loopid->se_nacl = new_se_nacl; fc_loopid->se_nacl = new_se_nacl;
if (qla_tgt_sess->se_sess != se_sess) if (fc_port->se_sess != se_sess)
qla_tgt_sess->se_sess = se_sess; fc_port->se_sess = se_sess;
if (nacl->qla_tgt_sess != qla_tgt_sess) if (nacl->fc_port != fc_port)
nacl->qla_tgt_sess = qla_tgt_sess; nacl->fc_port = fc_port;
return; return;
} }
if (nacl->qla_tgt_sess) { if (nacl->fc_port) {
if (new_se_nacl == NULL) { if (new_se_nacl == NULL) {
pr_debug("Clearing nacl->qla_tgt_sess and fc_loopid->se_nacl\n"); pr_debug("Clearing nacl->fc_port and fc_loopid->se_nacl\n");
fc_loopid->se_nacl = NULL; fc_loopid->se_nacl = NULL;
nacl->qla_tgt_sess = NULL; nacl->fc_port = NULL;
return; return;
} }
pr_debug("Replacing existing nacl->qla_tgt_sess and fc_loopid->se_nacl\n"); pr_debug("Replacing existing nacl->fc_port and fc_loopid->se_nacl\n");
fc_loopid->se_nacl = new_se_nacl; fc_loopid->se_nacl = new_se_nacl;
if (qla_tgt_sess->se_sess != se_sess) if (fc_port->se_sess != se_sess)
qla_tgt_sess->se_sess = se_sess; fc_port->se_sess = se_sess;
if (nacl->qla_tgt_sess != qla_tgt_sess) if (nacl->fc_port != fc_port)
nacl->qla_tgt_sess = qla_tgt_sess; nacl->fc_port = fc_port;
return; return;
} }
...@@ -1368,22 +1385,22 @@ static void tcm_qla2xxx_set_sess_by_loop_id( ...@@ -1368,22 +1385,22 @@ static void tcm_qla2xxx_set_sess_by_loop_id(
return; return;
} }
pr_debug("Replacing existing fc_loopid->se_nacl w/o active nacl->qla_tgt_sess\n"); pr_debug("Replacing existing fc_loopid->se_nacl w/o active nacl->fc_port\n");
fc_loopid->se_nacl = new_se_nacl; fc_loopid->se_nacl = new_se_nacl;
if (qla_tgt_sess->se_sess != se_sess) if (fc_port->se_sess != se_sess)
qla_tgt_sess->se_sess = se_sess; fc_port->se_sess = se_sess;
if (nacl->qla_tgt_sess != qla_tgt_sess) if (nacl->fc_port != fc_port)
nacl->qla_tgt_sess = qla_tgt_sess; nacl->fc_port = fc_port;
pr_debug("Setup nacl->qla_tgt_sess %p by loop_id for se_nacl: %p, initiatorname: %s\n", pr_debug("Setup nacl->fc_port %p by loop_id for se_nacl: %p, initiatorname: %s\n",
nacl->qla_tgt_sess, new_se_nacl, new_se_nacl->initiatorname); nacl->fc_port, new_se_nacl, new_se_nacl->initiatorname);
} }
/* /*
* Should always be called with qla_hw_data->tgt.sess_lock held. * Should always be called with qla_hw_data->tgt.sess_lock held.
*/ */
static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *lport, static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *lport,
struct tcm_qla2xxx_nacl *nacl, struct qla_tgt_sess *sess) struct tcm_qla2xxx_nacl *nacl, struct fc_port *sess)
{ {
struct se_session *se_sess = sess->se_sess; struct se_session *se_sess = sess->se_sess;
unsigned char be_sid[3]; unsigned char be_sid[3];
...@@ -1398,7 +1415,7 @@ static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *lport, ...@@ -1398,7 +1415,7 @@ static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *lport,
sess, sess->loop_id); sess, sess->loop_id);
} }
static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess) static void tcm_qla2xxx_free_session(struct fc_port *sess)
{ {
struct qla_tgt *tgt = sess->tgt; struct qla_tgt *tgt = sess->tgt;
struct qla_hw_data *ha = tgt->ha; struct qla_hw_data *ha = tgt->ha;
...@@ -1410,7 +1427,7 @@ static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess) ...@@ -1410,7 +1427,7 @@ static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess)
se_sess = sess->se_sess; se_sess = sess->se_sess;
if (!se_sess) { if (!se_sess) {
pr_err("struct qla_tgt_sess->se_sess is NULL\n"); pr_err("struct fc_port->se_sess is NULL\n");
dump_stack(); dump_stack();
return; return;
} }
...@@ -1437,7 +1454,7 @@ static int tcm_qla2xxx_session_cb(struct se_portal_group *se_tpg, ...@@ -1437,7 +1454,7 @@ static int tcm_qla2xxx_session_cb(struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl = se_sess->se_node_acl; struct se_node_acl *se_nacl = se_sess->se_node_acl;
struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
struct tcm_qla2xxx_nacl, se_node_acl); struct tcm_qla2xxx_nacl, se_node_acl);
struct qla_tgt_sess *qlat_sess = p; struct fc_port *qlat_sess = p;
uint16_t loop_id = qlat_sess->loop_id; uint16_t loop_id = qlat_sess->loop_id;
unsigned long flags; unsigned long flags;
unsigned char be_sid[3]; unsigned char be_sid[3];
...@@ -1467,7 +1484,7 @@ static int tcm_qla2xxx_session_cb(struct se_portal_group *se_tpg, ...@@ -1467,7 +1484,7 @@ static int tcm_qla2xxx_session_cb(struct se_portal_group *se_tpg,
static int tcm_qla2xxx_check_initiator_node_acl( static int tcm_qla2xxx_check_initiator_node_acl(
scsi_qla_host_t *vha, scsi_qla_host_t *vha,
unsigned char *fc_wwpn, unsigned char *fc_wwpn,
struct qla_tgt_sess *qlat_sess) struct fc_port *qlat_sess)
{ {
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct tcm_qla2xxx_lport *lport; struct tcm_qla2xxx_lport *lport;
...@@ -1511,7 +1528,7 @@ static int tcm_qla2xxx_check_initiator_node_acl( ...@@ -1511,7 +1528,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(
return 0; return 0;
} }
static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id, static void tcm_qla2xxx_update_sess(struct fc_port *sess, port_id_t s_id,
uint16_t loop_id, bool conf_compl_supported) uint16_t loop_id, bool conf_compl_supported)
{ {
struct qla_tgt *tgt = sess->tgt; struct qla_tgt *tgt = sess->tgt;
...@@ -1603,6 +1620,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = { ...@@ -1603,6 +1620,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = {
.find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id,
.find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id,
.clear_nacl_from_fcport_map = tcm_qla2xxx_clear_nacl_from_fcport_map, .clear_nacl_from_fcport_map = tcm_qla2xxx_clear_nacl_from_fcport_map,
.put_sess = tcm_qla2xxx_put_sess,
.shutdown_sess = tcm_qla2xxx_shutdown_sess, .shutdown_sess = tcm_qla2xxx_shutdown_sess,
}; };
......
...@@ -20,8 +20,8 @@ struct tcm_qla2xxx_nacl { ...@@ -20,8 +20,8 @@ struct tcm_qla2xxx_nacl {
u64 nport_wwnn; u64 nport_wwnn;
/* ASCII formatted WWPN for FC Initiator Nport */ /* ASCII formatted WWPN for FC Initiator Nport */
char nport_name[TCM_QLA2XXX_NAMELEN]; char nport_name[TCM_QLA2XXX_NAMELEN];
/* Pointer to qla_tgt_sess */ /* Pointer to fc_port */
struct qla_tgt_sess *qla_tgt_sess; struct fc_port *fc_port;
/* Pointer to TCM FC nexus */ /* Pointer to TCM FC nexus */
struct se_session *nport_nexus; struct se_session *nport_nexus;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册