Commit a4239945 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen

scsi: qla2xxx: Add switch command to simplify fabric discovery

- add "async" gpn_ft, gnn_ft, gfpn_id, gnn_id switch commands.
- For 8G and newer adapters, use async commands when it comes to
fabric scan to reduce bottle neck.
Signed-off-by: default avatarQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 1429f044
...@@ -2170,6 +2170,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) ...@@ -2170,6 +2170,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
dma_free_coherent(&ha->pdev->dev, vha->gnl.size, vha->gnl.l, dma_free_coherent(&ha->pdev->dev, vha->gnl.size, vha->gnl.l,
vha->gnl.ldma); vha->gnl.ldma);
vfree(vha->scan.l);
if (vha->qpair && vha->qpair->vp_idx == vha->vp_idx) { if (vha->qpair && vha->qpair->vp_idx == vha->vp_idx) {
if (qla2xxx_delete_qpair(vha, vha->qpair) != QLA_SUCCESS) if (qla2xxx_delete_qpair(vha, vha->qpair) != QLA_SUCCESS)
ql_log(ql_log_warn, vha, 0x7087, ql_log(ql_log_warn, vha, 0x7087,
......
...@@ -2270,11 +2270,13 @@ struct ct_sns_desc { ...@@ -2270,11 +2270,13 @@ struct ct_sns_desc {
enum discovery_state { enum discovery_state {
DSC_DELETED, DSC_DELETED,
DSC_GNN_ID,
DSC_GID_PN, DSC_GID_PN,
DSC_GNL, DSC_GNL,
DSC_LOGIN_PEND, DSC_LOGIN_PEND,
DSC_LOGIN_FAILED, DSC_LOGIN_FAILED,
DSC_GPDB, DSC_GPDB,
DSC_GFPN_ID,
DSC_GPSC, DSC_GPSC,
DSC_UPD_FCPORT, DSC_UPD_FCPORT,
DSC_LOGIN_COMPLETE, DSC_LOGIN_COMPLETE,
...@@ -2304,8 +2306,9 @@ enum fcport_mgt_event { ...@@ -2304,8 +2306,9 @@ enum fcport_mgt_event {
FCME_GPDB_DONE, FCME_GPDB_DONE,
FCME_GPNID_DONE, FCME_GPNID_DONE,
FCME_GFFID_DONE, FCME_GFFID_DONE,
FCME_DELETE_DONE,
FCME_ADISC_DONE, FCME_ADISC_DONE,
FCME_GNNID_DONE,
FCME_GFPNID_DONE,
}; };
enum rscn_addr_format { enum rscn_addr_format {
...@@ -2338,6 +2341,7 @@ typedef struct fc_port { ...@@ -2338,6 +2341,7 @@ typedef struct fc_port {
unsigned int login_pause:1; unsigned int login_pause:1;
unsigned int login_succ:1; unsigned int login_succ:1;
unsigned int query:1; unsigned int query:1;
unsigned int id_changed:1;
struct work_struct nvme_del_work; struct work_struct nvme_del_work;
struct completion nvme_del_done; struct completion nvme_del_done;
...@@ -2485,6 +2489,11 @@ static const char * const port_state_str[] = { ...@@ -2485,6 +2489,11 @@ static const char * const port_state_str[] = {
#define GA_NXT_REQ_SIZE (16 + 4) #define GA_NXT_REQ_SIZE (16 + 4)
#define GA_NXT_RSP_SIZE (16 + 620) #define GA_NXT_RSP_SIZE (16 + 620)
#define GPN_FT_CMD 0x172
#define GPN_FT_REQ_SIZE (16 + 4)
#define GNN_FT_CMD 0x173
#define GNN_FT_REQ_SIZE (16 + 4)
#define GID_PT_CMD 0x1A1 #define GID_PT_CMD 0x1A1
#define GID_PT_REQ_SIZE (16 + 4) #define GID_PT_REQ_SIZE (16 + 4)
...@@ -2739,6 +2748,13 @@ struct ct_sns_req { ...@@ -2739,6 +2748,13 @@ struct ct_sns_req {
uint8_t port_id[3]; uint8_t port_id[3];
} port_id; } port_id;
struct {
uint8_t reserved;
uint8_t domain;
uint8_t area;
uint8_t port_type;
} gpn_ft;
struct { struct {
uint8_t port_type; uint8_t port_type;
uint8_t domain; uint8_t domain;
...@@ -2852,6 +2868,27 @@ struct ct_sns_gid_pt_data { ...@@ -2852,6 +2868,27 @@ struct ct_sns_gid_pt_data {
uint8_t port_id[3]; uint8_t port_id[3];
}; };
/* It's the same for both GPN_FT and GNN_FT */
struct ct_sns_gpnft_rsp {
struct {
struct ct_cmd_hdr header;
uint16_t response;
uint16_t residual;
uint8_t fragment_id;
uint8_t reason_code;
uint8_t explanation_code;
uint8_t vendor_unique;
};
/* Assume the largest number of targets for the union */
struct ct_sns_gpn_ft_data {
u8 control_byte;
u8 port_id[3];
u32 reserved;
u8 port_name[8];
} entries[1];
};
/* CT command response */
struct ct_sns_rsp { struct ct_sns_rsp {
struct ct_rsp_hdr header; struct ct_rsp_hdr header;
...@@ -2927,6 +2964,24 @@ struct ct_sns_pkt { ...@@ -2927,6 +2964,24 @@ struct ct_sns_pkt {
} p; } p;
}; };
struct ct_sns_gpnft_pkt {
union {
struct ct_sns_req req;
struct ct_sns_gpnft_rsp rsp;
} p;
};
struct fab_scan_rp {
port_id_t id;
u8 port_name[8];
u8 node_name[8];
};
struct fab_scan {
struct fab_scan_rp *l;
u32 size;
};
/* /*
* SNS command structures -- for 2200 compatibility. * SNS command structures -- for 2200 compatibility.
*/ */
...@@ -3143,6 +3198,11 @@ enum qla_work_type { ...@@ -3143,6 +3198,11 @@ enum qla_work_type {
QLA_EVT_RELOGIN, QLA_EVT_RELOGIN,
QLA_EVT_ASYNC_PRLO, QLA_EVT_ASYNC_PRLO,
QLA_EVT_ASYNC_PRLO_DONE, QLA_EVT_ASYNC_PRLO_DONE,
QLA_EVT_GPNFT,
QLA_EVT_GPNFT_DONE,
QLA_EVT_GNNFT_DONE,
QLA_EVT_GNNID,
QLA_EVT_GFPNID,
}; };
...@@ -3184,7 +3244,9 @@ struct qla_work_evt { ...@@ -3184,7 +3244,9 @@ struct qla_work_evt {
struct { struct {
port_id_t id; port_id_t id;
u8 port_name[8]; u8 port_name[8];
u8 node_name[8];
void *pla; void *pla;
u8 fc4_type;
} new_sess; } new_sess;
struct { /*Get PDB, Get Speed, update fcport, gnl, gidpn */ struct { /*Get PDB, Get Speed, update fcport, gnl, gidpn */
fc_port_t *fcport; fc_port_t *fcport;
...@@ -3195,6 +3257,9 @@ struct qla_work_evt { ...@@ -3195,6 +3257,9 @@ struct qla_work_evt {
u8 iocb[IOCB_SIZE]; u8 iocb[IOCB_SIZE];
int type; int type;
} nack; } nack;
struct {
u8 fc4_type;
} gpnft;
} u; } u;
}; };
...@@ -3729,6 +3794,8 @@ struct qla_hw_data { ...@@ -3729,6 +3794,8 @@ struct qla_hw_data {
(IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha))
#define IS_EXLOGIN_OFFLD_CAPABLE(ha) \ #define IS_EXLOGIN_OFFLD_CAPABLE(ha) \
(IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) (IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha))
#define USE_ASYNC_SCAN(ha) (IS_QLA25XX(ha) || IS_QLA81XX(ha) ||\
IS_QLA83XX(ha) || IS_QLA27XX(ha))
/* HBA serial number */ /* HBA serial number */
uint8_t serial0; uint8_t serial0;
...@@ -3811,7 +3878,7 @@ struct qla_hw_data { ...@@ -3811,7 +3878,7 @@ struct qla_hw_data {
int exchoffld_size; int exchoffld_size;
int exchoffld_count; int exchoffld_count;
void *swl; void *swl;
/* These are used by mailbox operations. */ /* These are used by mailbox operations. */
uint16_t mailbox_out[MAILBOX_REGISTER_COUNT]; uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
...@@ -4271,6 +4338,7 @@ typedef struct scsi_qla_host { ...@@ -4271,6 +4338,7 @@ typedef struct scsi_qla_host {
uint8_t n2n_port_name[WWN_SIZE]; uint8_t n2n_port_name[WWN_SIZE];
uint16_t n2n_id; uint16_t n2n_id;
struct list_head gpnid_list; struct list_head gpnid_list;
struct fab_scan scan;
} scsi_qla_host_t; } scsi_qla_host_t;
struct qla27xx_image_status { struct qla27xx_image_status {
......
...@@ -105,8 +105,8 @@ int qla24xx_async_gpdb(struct scsi_qla_host *, fc_port_t *, u8); ...@@ -105,8 +105,8 @@ int qla24xx_async_gpdb(struct scsi_qla_host *, fc_port_t *, u8);
int qla24xx_async_prli(struct scsi_qla_host *, fc_port_t *); int qla24xx_async_prli(struct scsi_qla_host *, fc_port_t *);
int qla24xx_async_notify_ack(scsi_qla_host_t *, fc_port_t *, int qla24xx_async_notify_ack(scsi_qla_host_t *, fc_port_t *,
struct imm_ntfy_from_isp *, int); struct imm_ntfy_from_isp *, int);
int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *, int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *, u8*,
void *); void *, u8);
int qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *); int qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *);
int qla24xx_detect_sfp(scsi_qla_host_t *vha); int qla24xx_detect_sfp(scsi_qla_host_t *vha);
int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8); int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8);
...@@ -655,9 +655,20 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *, struct event_arg *); ...@@ -655,9 +655,20 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *, struct event_arg *);
int qla24xx_post_gpsc_work(struct scsi_qla_host *, fc_port_t *); int qla24xx_post_gpsc_work(struct scsi_qla_host *, fc_port_t *);
int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *); int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);
void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *);
int qla2x00_mgmt_svr_login(scsi_qla_host_t *); int qla2x00_mgmt_svr_login(scsi_qla_host_t *);
void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea); void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea);
int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport); int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport);
int qla24xx_async_gpnft(scsi_qla_host_t *, u8);
void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *);
void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *);
int qla24xx_async_gnnid(scsi_qla_host_t *, fc_port_t *);
void qla24xx_handle_gnnid_event(scsi_qla_host_t *, struct event_arg *);
int qla24xx_post_gnnid_work(struct scsi_qla_host *, fc_port_t *);
int qla24xx_post_gfpnid_work(struct scsi_qla_host *, fc_port_t *);
int qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *);
void qla24xx_handle_gfpnid_event(scsi_qla_host_t *, struct event_arg *);
/* /*
* Global Function Prototypes in qla_attr.c source file. * Global Function Prototypes in qla_attr.c source file.
*/ */
......
This diff is collapsed.
This diff is collapsed.
...@@ -3904,7 +3904,10 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, ...@@ -3904,7 +3904,10 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
id.b.area = rptid_entry->u.f2.remote_nport_id[1]; id.b.area = rptid_entry->u.f2.remote_nport_id[1];
id.b.domain = rptid_entry->u.f2.remote_nport_id[2]; id.b.domain = rptid_entry->u.f2.remote_nport_id[2];
qla24xx_post_newsess_work(vha, &id, qla24xx_post_newsess_work(vha, &id,
rptid_entry->u.f2.port_name, NULL); rptid_entry->u.f2.port_name,
rptid_entry->u.f2.node_name,
NULL,
FC4_TYPE_UNKNOWN);
} }
} }
} }
......
...@@ -3639,6 +3639,8 @@ qla2x00_remove_one(struct pci_dev *pdev) ...@@ -3639,6 +3639,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
dma_free_coherent(&ha->pdev->dev, dma_free_coherent(&ha->pdev->dev,
base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma);
vfree(base_vha->scan.l);
if (IS_QLAFX00(ha)) if (IS_QLAFX00(ha))
qlafx00_driver_shutdown(base_vha, 20); qlafx00_driver_shutdown(base_vha, 20);
...@@ -4587,6 +4589,18 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, ...@@ -4587,6 +4589,18 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
return NULL; return NULL;
} }
/* todo: what about ext login? */
vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp);
vha->scan.l = vmalloc(vha->scan.size);
if (!vha->scan.l) {
ql_log(ql_log_fatal, vha, 0xd04a,
"Alloc failed for scan database.\n");
dma_free_coherent(&ha->pdev->dev, vha->gnl.size,
vha->gnl.l, vha->gnl.ldma);
scsi_remove_host(vha->host);
return NULL;
}
sprintf(vha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, vha->host_no); sprintf(vha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, vha->host_no);
ql_dbg(ql_dbg_init, vha, 0x0041, ql_dbg(ql_dbg_init, vha, 0x0041,
"Allocated the host=%p hw=%p vha=%p dev_name=%s", "Allocated the host=%p hw=%p vha=%p dev_name=%s",
...@@ -4760,6 +4774,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) ...@@ -4760,6 +4774,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
struct qlt_plogi_ack_t *pla = struct qlt_plogi_ack_t *pla =
(struct qlt_plogi_ack_t *)e->u.new_sess.pla; (struct qlt_plogi_ack_t *)e->u.new_sess.pla;
uint8_t free_fcport = 0; uint8_t free_fcport = 0;
u64 wwn;
ql_dbg(ql_dbg_disc, vha, 0xffff, ql_dbg(ql_dbg_disc, vha, 0xffff,
"%s %d %8phC enter\n", "%s %d %8phC enter\n",
...@@ -4785,9 +4800,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) ...@@ -4785,9 +4800,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL); fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
if (fcport) { if (fcport) {
fcport->d_id = e->u.new_sess.id; fcport->d_id = e->u.new_sess.id;
fcport->scan_state = QLA_FCPORT_FOUND;
fcport->flags |= FCF_FABRIC_DEVICE; fcport->flags |= FCF_FABRIC_DEVICE;
fcport->fw_login_state = DSC_LS_PLOGI_PEND; fcport->fw_login_state = DSC_LS_PLOGI_PEND;
if (e->u.new_sess.fc4_type == FC4_TYPE_FCP_SCSI)
fcport->fc4_type = FC4_TYPE_FCP_SCSI;
memcpy(fcport->port_name, e->u.new_sess.port_name, memcpy(fcport->port_name, e->u.new_sess.port_name,
WWN_SIZE); WWN_SIZE);
...@@ -4802,7 +4818,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) ...@@ -4802,7 +4818,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
} }
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
/* search again to make sure one else got ahead */ /* search again to make sure no one else got ahead */
tfcp = qla2x00_find_fcport_by_wwpn(vha, tfcp = qla2x00_find_fcport_by_wwpn(vha,
e->u.new_sess.port_name, 1); e->u.new_sess.port_name, 1);
if (tfcp) { if (tfcp) {
...@@ -4829,6 +4845,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) ...@@ -4829,6 +4845,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
if (N2N_TOPO(vha->hw)) if (N2N_TOPO(vha->hw))
fcport->flags &= ~FCF_FABRIC_DEVICE; fcport->flags &= ~FCF_FABRIC_DEVICE;
fcport->id_changed = 1;
fcport->scan_state = QLA_FCPORT_FOUND;
memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE);
if (pla) { if (pla) {
if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) {
u16 wd3_lo; u16 wd3_lo;
...@@ -4881,7 +4901,13 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) ...@@ -4881,7 +4901,13 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
} }
} }
spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
qla24xx_async_gnl(vha, fcport);
wwn = wwn_to_u64(fcport->node_name);
if (!wwn)
qla24xx_async_gnnid(vha, fcport);
else
qla24xx_async_gnl(vha, fcport);
} }
} }
...@@ -4980,6 +5006,21 @@ qla2x00_do_work(struct scsi_qla_host *vha) ...@@ -4980,6 +5006,21 @@ qla2x00_do_work(struct scsi_qla_host *vha)
qla2x00_async_prlo_done(vha, e->u.logio.fcport, qla2x00_async_prlo_done(vha, e->u.logio.fcport,
e->u.logio.data); e->u.logio.data);
break; break;
case QLA_EVT_GPNFT:
qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type);
break;
case QLA_EVT_GPNFT_DONE:
qla24xx_async_gpnft_done(vha, e->u.iosb.sp);
break;
case QLA_EVT_GNNFT_DONE:
qla24xx_async_gnnft_done(vha, e->u.iosb.sp);
break;
case QLA_EVT_GNNID:
qla24xx_async_gnnid(vha, e->u.fcport.fcport);
break;
case QLA_EVT_GFPNID:
qla24xx_async_gfpnid(vha, e->u.fcport.fcport);
break;
} }
if (e->flags & QLA_EVT_FLAG_FREE) if (e->flags & QLA_EVT_FLAG_FREE)
kfree(e); kfree(e);
......
...@@ -969,7 +969,6 @@ static void qlt_free_session_done(struct work_struct *work) ...@@ -969,7 +969,6 @@ static void qlt_free_session_done(struct work_struct *work)
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
unsigned long flags; unsigned long flags;
bool logout_started = false; bool logout_started = false;
struct event_arg ea;
scsi_qla_host_t *base_vha; scsi_qla_host_t *base_vha;
struct qlt_plogi_ack_t *own = struct qlt_plogi_ack_t *own =
sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN]; sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN];
...@@ -1121,11 +1120,18 @@ static void qlt_free_session_done(struct work_struct *work) ...@@ -1121,11 +1120,18 @@ static void qlt_free_session_done(struct work_struct *work)
if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags)) if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags))
return; return;
if (!tgt || !tgt->tgt_stop) { if ((!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) {
memset(&ea, 0, sizeof(ea)); switch (vha->host->active_mode) {
ea.event = FCME_DELETE_DONE; case MODE_INITIATOR:
ea.fcport = sess; case MODE_DUAL:
qla2x00_fcport_event_handler(vha, &ea); set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
qla2xxx_wake_dpc(vha);
break;
case MODE_TARGET:
default:
/* no-op */
break;
}
} }
} }
...@@ -4318,6 +4324,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, ...@@ -4318,6 +4324,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
struct fc_port *sess; struct fc_port *sess;
struct qla_tgt_cmd *cmd; struct qla_tgt_cmd *cmd;
unsigned long flags; unsigned long flags;
port_id_t id;
if (unlikely(tgt->tgt_stop)) { if (unlikely(tgt->tgt_stop)) {
ql_dbg(ql_dbg_io, vha, 0x3061, ql_dbg(ql_dbg_io, vha, 0x3061,
...@@ -4325,6 +4332,12 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, ...@@ -4325,6 +4332,12 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
return -EFAULT; return -EFAULT;
} }
id.b.al_pa = atio->u.isp24.fcp_hdr.s_id[2];
id.b.area = atio->u.isp24.fcp_hdr.s_id[1];
id.b.domain = atio->u.isp24.fcp_hdr.s_id[0];
if (IS_SW_RESV_ADDR(id))
return -EBUSY;
sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, atio->u.isp24.fcp_hdr.s_id); sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, atio->u.isp24.fcp_hdr.s_id);
if (unlikely(!sess)) { if (unlikely(!sess)) {
struct qla_tgt_sess_op *op = kzalloc(sizeof(struct qla_tgt_sess_op), struct qla_tgt_sess_op *op = kzalloc(sizeof(struct qla_tgt_sess_op),
...@@ -4739,8 +4752,16 @@ static int qlt_handle_login(struct scsi_qla_host *vha, ...@@ -4739,8 +4752,16 @@ static int qlt_handle_login(struct scsi_qla_host *vha,
ql_dbg(ql_dbg_disc, vha, 0xffff, ql_dbg(ql_dbg_disc, vha, 0xffff,
"%s %d %8phC post new sess\n", "%s %d %8phC post new sess\n",
__func__, __LINE__, iocb->u.isp24.port_name); __func__, __LINE__, iocb->u.isp24.port_name);
qla24xx_post_newsess_work(vha, &port_id, if (iocb->u.isp24.status_subcode == ELS_PLOGI)
iocb->u.isp24.port_name, pla); qla24xx_post_newsess_work(vha, &port_id,
iocb->u.isp24.port_name,
iocb->u.isp24.u.plogi.node_name,
pla, FC4_TYPE_UNKNOWN);
else
qla24xx_post_newsess_work(vha, &port_id,
iocb->u.isp24.port_name, NULL,
pla, FC4_TYPE_UNKNOWN);
goto out; goto out;
} }
...@@ -4869,6 +4890,11 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, ...@@ -4869,6 +4890,11 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha,
break; break;
} }
if (IS_SW_RESV_ADDR(port_id)) {
res = 1;
break;
}
wd3_lo = le16_to_cpu(iocb->u.isp24.u.prli.wd3_lo); wd3_lo = le16_to_cpu(iocb->u.isp24.u.prli.wd3_lo);
if (wwn) { if (wwn) {
...@@ -4896,12 +4922,32 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, ...@@ -4896,12 +4922,32 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha,
} }
if (sess != NULL) { if (sess != NULL) {
bool delete = false;
spin_lock_irqsave(&tgt->ha->tgt.sess_lock, flags); spin_lock_irqsave(&tgt->ha->tgt.sess_lock, flags);
switch (sess->fw_login_state) { switch (sess->fw_login_state) {
case DSC_LS_PLOGI_PEND:
case DSC_LS_PLOGI_COMP: case DSC_LS_PLOGI_COMP:
case DSC_LS_PRLI_COMP: case DSC_LS_PRLI_COMP:
break; break;
default: default:
delete = true;
break;
}
switch (sess->disc_state) {
case DSC_LOGIN_PEND:
case DSC_GPDB:
case DSC_GPSC:
case DSC_UPD_FCPORT:
case DSC_LOGIN_COMPLETE:
case DSC_ADISC:
delete = false;
break;
default:
break;
}
if (delete) {
spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock, spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock,
flags); flags);
/* /*
......
...@@ -993,7 +993,7 @@ struct qla_tgt_prm { ...@@ -993,7 +993,7 @@ struct qla_tgt_prm {
/* Check for Switch reserved address */ /* Check for Switch reserved address */
#define IS_SW_RESV_ADDR(_s_id) \ #define IS_SW_RESV_ADDR(_s_id) \
((_s_id.b.domain == 0xff) && (_s_id.b.area == 0xfc)) ((_s_id.b.domain == 0xff) && ((_s_id.b.area & 0xf0) == 0xf0))
#define QLA_TGT_XMIT_DATA 1 #define QLA_TGT_XMIT_DATA 1
#define QLA_TGT_XMIT_STATUS 2 #define QLA_TGT_XMIT_STATUS 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment