Skip to content

Commit a423994

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
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: 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>
1 parent 1429f04 commit a423994

File tree

9 files changed

+1103
-121
lines changed

9 files changed

+1103
-121
lines changed

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,6 +2170,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
21702170
dma_free_coherent(&ha->pdev->dev, vha->gnl.size, vha->gnl.l,
21712171
vha->gnl.ldma);
21722172

2173+
vfree(vha->scan.l);
2174+
21732175
if (vha->qpair && vha->qpair->vp_idx == vha->vp_idx) {
21742176
if (qla2xxx_delete_qpair(vha, vha->qpair) != QLA_SUCCESS)
21752177
ql_log(ql_log_warn, vha, 0x7087,

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,11 +2270,13 @@ struct ct_sns_desc {
22702270

22712271
enum discovery_state {
22722272
DSC_DELETED,
2273+
DSC_GNN_ID,
22732274
DSC_GID_PN,
22742275
DSC_GNL,
22752276
DSC_LOGIN_PEND,
22762277
DSC_LOGIN_FAILED,
22772278
DSC_GPDB,
2279+
DSC_GFPN_ID,
22782280
DSC_GPSC,
22792281
DSC_UPD_FCPORT,
22802282
DSC_LOGIN_COMPLETE,
@@ -2304,8 +2306,9 @@ enum fcport_mgt_event {
23042306
FCME_GPDB_DONE,
23052307
FCME_GPNID_DONE,
23062308
FCME_GFFID_DONE,
2307-
FCME_DELETE_DONE,
23082309
FCME_ADISC_DONE,
2310+
FCME_GNNID_DONE,
2311+
FCME_GFPNID_DONE,
23092312
};
23102313

23112314
enum rscn_addr_format {
@@ -2338,6 +2341,7 @@ typedef struct fc_port {
23382341
unsigned int login_pause:1;
23392342
unsigned int login_succ:1;
23402343
unsigned int query:1;
2344+
unsigned int id_changed:1;
23412345

23422346
struct work_struct nvme_del_work;
23432347
struct completion nvme_del_done;
@@ -2485,6 +2489,11 @@ static const char * const port_state_str[] = {
24852489
#define GA_NXT_REQ_SIZE (16 + 4)
24862490
#define GA_NXT_RSP_SIZE (16 + 620)
24872491

2492+
#define GPN_FT_CMD 0x172
2493+
#define GPN_FT_REQ_SIZE (16 + 4)
2494+
#define GNN_FT_CMD 0x173
2495+
#define GNN_FT_REQ_SIZE (16 + 4)
2496+
24882497
#define GID_PT_CMD 0x1A1
24892498
#define GID_PT_REQ_SIZE (16 + 4)
24902499

@@ -2739,6 +2748,13 @@ struct ct_sns_req {
27392748
uint8_t port_id[3];
27402749
} port_id;
27412750

2751+
struct {
2752+
uint8_t reserved;
2753+
uint8_t domain;
2754+
uint8_t area;
2755+
uint8_t port_type;
2756+
} gpn_ft;
2757+
27422758
struct {
27432759
uint8_t port_type;
27442760
uint8_t domain;
@@ -2852,6 +2868,27 @@ struct ct_sns_gid_pt_data {
28522868
uint8_t port_id[3];
28532869
};
28542870

2871+
/* It's the same for both GPN_FT and GNN_FT */
2872+
struct ct_sns_gpnft_rsp {
2873+
struct {
2874+
struct ct_cmd_hdr header;
2875+
uint16_t response;
2876+
uint16_t residual;
2877+
uint8_t fragment_id;
2878+
uint8_t reason_code;
2879+
uint8_t explanation_code;
2880+
uint8_t vendor_unique;
2881+
};
2882+
/* Assume the largest number of targets for the union */
2883+
struct ct_sns_gpn_ft_data {
2884+
u8 control_byte;
2885+
u8 port_id[3];
2886+
u32 reserved;
2887+
u8 port_name[8];
2888+
} entries[1];
2889+
};
2890+
2891+
/* CT command response */
28552892
struct ct_sns_rsp {
28562893
struct ct_rsp_hdr header;
28572894

@@ -2927,6 +2964,24 @@ struct ct_sns_pkt {
29272964
} p;
29282965
};
29292966

2967+
struct ct_sns_gpnft_pkt {
2968+
union {
2969+
struct ct_sns_req req;
2970+
struct ct_sns_gpnft_rsp rsp;
2971+
} p;
2972+
};
2973+
2974+
struct fab_scan_rp {
2975+
port_id_t id;
2976+
u8 port_name[8];
2977+
u8 node_name[8];
2978+
};
2979+
2980+
struct fab_scan {
2981+
struct fab_scan_rp *l;
2982+
u32 size;
2983+
};
2984+
29302985
/*
29312986
* SNS command structures -- for 2200 compatibility.
29322987
*/
@@ -3143,6 +3198,11 @@ enum qla_work_type {
31433198
QLA_EVT_RELOGIN,
31443199
QLA_EVT_ASYNC_PRLO,
31453200
QLA_EVT_ASYNC_PRLO_DONE,
3201+
QLA_EVT_GPNFT,
3202+
QLA_EVT_GPNFT_DONE,
3203+
QLA_EVT_GNNFT_DONE,
3204+
QLA_EVT_GNNID,
3205+
QLA_EVT_GFPNID,
31463206
};
31473207

31483208

@@ -3184,7 +3244,9 @@ struct qla_work_evt {
31843244
struct {
31853245
port_id_t id;
31863246
u8 port_name[8];
3247+
u8 node_name[8];
31873248
void *pla;
3249+
u8 fc4_type;
31883250
} new_sess;
31893251
struct { /*Get PDB, Get Speed, update fcport, gnl, gidpn */
31903252
fc_port_t *fcport;
@@ -3195,6 +3257,9 @@ struct qla_work_evt {
31953257
u8 iocb[IOCB_SIZE];
31963258
int type;
31973259
} nack;
3260+
struct {
3261+
u8 fc4_type;
3262+
} gpnft;
31983263
} u;
31993264
};
32003265

@@ -3729,6 +3794,8 @@ struct qla_hw_data {
37293794
(IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha))
37303795
#define IS_EXLOGIN_OFFLD_CAPABLE(ha) \
37313796
(IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha))
3797+
#define USE_ASYNC_SCAN(ha) (IS_QLA25XX(ha) || IS_QLA81XX(ha) ||\
3798+
IS_QLA83XX(ha) || IS_QLA27XX(ha))
37323799

37333800
/* HBA serial number */
37343801
uint8_t serial0;
@@ -3811,7 +3878,7 @@ struct qla_hw_data {
38113878
int exchoffld_size;
38123879
int exchoffld_count;
38133880

3814-
void *swl;
3881+
void *swl;
38153882

38163883
/* These are used by mailbox operations. */
38173884
uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
@@ -4271,6 +4338,7 @@ typedef struct scsi_qla_host {
42714338
uint8_t n2n_port_name[WWN_SIZE];
42724339
uint16_t n2n_id;
42734340
struct list_head gpnid_list;
4341+
struct fab_scan scan;
42744342
} scsi_qla_host_t;
42754343

42764344
struct qla27xx_image_status {

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ int qla24xx_async_gpdb(struct scsi_qla_host *, fc_port_t *, u8);
105105
int qla24xx_async_prli(struct scsi_qla_host *, fc_port_t *);
106106
int qla24xx_async_notify_ack(scsi_qla_host_t *, fc_port_t *,
107107
struct imm_ntfy_from_isp *, int);
108-
int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *,
109-
void *);
108+
int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *, u8*,
109+
void *, u8);
110110
int qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *);
111111
int qla24xx_detect_sfp(scsi_qla_host_t *vha);
112112
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 *);
655655

656656
int qla24xx_post_gpsc_work(struct scsi_qla_host *, fc_port_t *);
657657
int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);
658+
void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *);
658659
int qla2x00_mgmt_svr_login(scsi_qla_host_t *);
659660
void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea);
660661
int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport);
662+
int qla24xx_async_gpnft(scsi_qla_host_t *, u8);
663+
void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *);
664+
void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *);
665+
int qla24xx_async_gnnid(scsi_qla_host_t *, fc_port_t *);
666+
void qla24xx_handle_gnnid_event(scsi_qla_host_t *, struct event_arg *);
667+
int qla24xx_post_gnnid_work(struct scsi_qla_host *, fc_port_t *);
668+
int qla24xx_post_gfpnid_work(struct scsi_qla_host *, fc_port_t *);
669+
int qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *);
670+
void qla24xx_handle_gfpnid_event(scsi_qla_host_t *, struct event_arg *);
671+
661672
/*
662673
* Global Function Prototypes in qla_attr.c source file.
663674
*/

0 commit comments

Comments
 (0)