Skip to content

Commit

Permalink
scsi: qla2xxx: Add switch command to simplify fabric discovery
Browse files Browse the repository at this point in the history
- 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: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Quinn Tran authored and Martin K. Petersen committed Jan 4, 2018
1 parent 1429f04 commit a423994
Show file tree
Hide file tree
Showing 9 changed files with 1,103 additions and 121 deletions.
2 changes: 2 additions & 0 deletions drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2170,6 +2170,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
dma_free_coherent(&ha->pdev->dev, vha->gnl.size, vha->gnl.l,
vha->gnl.ldma);

vfree(vha->scan.l);

if (vha->qpair && vha->qpair->vp_idx == vha->vp_idx) {
if (qla2xxx_delete_qpair(vha, vha->qpair) != QLA_SUCCESS)
ql_log(ql_log_warn, vha, 0x7087,
Expand Down
72 changes: 70 additions & 2 deletions drivers/scsi/qla2xxx/qla_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -2270,11 +2270,13 @@ struct ct_sns_desc {

enum discovery_state {
DSC_DELETED,
DSC_GNN_ID,
DSC_GID_PN,
DSC_GNL,
DSC_LOGIN_PEND,
DSC_LOGIN_FAILED,
DSC_GPDB,
DSC_GFPN_ID,
DSC_GPSC,
DSC_UPD_FCPORT,
DSC_LOGIN_COMPLETE,
Expand Down Expand Up @@ -2304,8 +2306,9 @@ enum fcport_mgt_event {
FCME_GPDB_DONE,
FCME_GPNID_DONE,
FCME_GFFID_DONE,
FCME_DELETE_DONE,
FCME_ADISC_DONE,
FCME_GNNID_DONE,
FCME_GFPNID_DONE,
};

enum rscn_addr_format {
Expand Down Expand Up @@ -2338,6 +2341,7 @@ typedef struct fc_port {
unsigned int login_pause:1;
unsigned int login_succ:1;
unsigned int query:1;
unsigned int id_changed:1;

struct work_struct nvme_del_work;
struct completion nvme_del_done;
Expand Down Expand Up @@ -2485,6 +2489,11 @@ static const char * const port_state_str[] = {
#define GA_NXT_REQ_SIZE (16 + 4)
#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_REQ_SIZE (16 + 4)

Expand Down Expand Up @@ -2739,6 +2748,13 @@ struct ct_sns_req {
uint8_t port_id[3];
} port_id;

struct {
uint8_t reserved;
uint8_t domain;
uint8_t area;
uint8_t port_type;
} gpn_ft;

struct {
uint8_t port_type;
uint8_t domain;
Expand Down Expand Up @@ -2852,6 +2868,27 @@ struct ct_sns_gid_pt_data {
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_rsp_hdr header;

Expand Down Expand Up @@ -2927,6 +2964,24 @@ struct ct_sns_pkt {
} 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.
*/
Expand Down Expand Up @@ -3143,6 +3198,11 @@ enum qla_work_type {
QLA_EVT_RELOGIN,
QLA_EVT_ASYNC_PRLO,
QLA_EVT_ASYNC_PRLO_DONE,
QLA_EVT_GPNFT,
QLA_EVT_GPNFT_DONE,
QLA_EVT_GNNFT_DONE,
QLA_EVT_GNNID,
QLA_EVT_GFPNID,
};


Expand Down Expand Up @@ -3184,7 +3244,9 @@ struct qla_work_evt {
struct {
port_id_t id;
u8 port_name[8];
u8 node_name[8];
void *pla;
u8 fc4_type;
} new_sess;
struct { /*Get PDB, Get Speed, update fcport, gnl, gidpn */
fc_port_t *fcport;
Expand All @@ -3195,6 +3257,9 @@ struct qla_work_evt {
u8 iocb[IOCB_SIZE];
int type;
} nack;
struct {
u8 fc4_type;
} gpnft;
} u;
};

Expand Down Expand Up @@ -3729,6 +3794,8 @@ struct qla_hw_data {
(IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha))
#define IS_EXLOGIN_OFFLD_CAPABLE(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 */
uint8_t serial0;
Expand Down Expand Up @@ -3811,7 +3878,7 @@ struct qla_hw_data {
int exchoffld_size;
int exchoffld_count;

void *swl;
void *swl;

/* These are used by mailbox operations. */
uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
Expand Down Expand Up @@ -4271,6 +4338,7 @@ typedef struct scsi_qla_host {
uint8_t n2n_port_name[WWN_SIZE];
uint16_t n2n_id;
struct list_head gpnid_list;
struct fab_scan scan;
} scsi_qla_host_t;

struct qla27xx_image_status {
Expand Down
15 changes: 13 additions & 2 deletions drivers/scsi/qla2xxx/qla_gbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_notify_ack(scsi_qla_host_t *, fc_port_t *,
struct imm_ntfy_from_isp *, int);
int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *,
void *);
int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *, u8*,
void *, u8);
int qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *);
int qla24xx_detect_sfp(scsi_qla_host_t *vha);
int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8);
Expand Down Expand Up @@ -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_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 *);
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_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.
*/
Expand Down
Loading

0 comments on commit a423994

Please sign in to comment.