SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST);
sp->name =
(bsg_job->request->msgcode == FC_BSG_RPT_ELS ?
- "bsg_els_rpt" : "bsg_els_hst");
+ sp_to_str(SPCN_BSG_RPT) : sp_to_str(SPCN_BSG_HST));
sp->u.bsg_job = bsg_job;
sp->free = qla2x00_bsg_sp_free;
sp->done = qla2x00_bsg_job_done;
}
sp->type = SRB_CT_CMD;
- sp->name = "bsg_ct";
+ sp->name = sp_to_str(SPCN_BSG_CT);
sp->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt);
sp->u.bsg_job = bsg_job;
sp->free = qla2x00_bsg_sp_free;
fcport->loop_id = piocb_rqst->dataword;
sp->type = SRB_FXIOCB_BCMD;
- sp->name = "bsg_fx_mgmt";
+ sp->name = sp_to_str(SPCN_BSG_FX_MGMT);
sp->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt);
sp->u.bsg_job = bsg_job;
sp->free = qla2x00_bsg_sp_free;
void (*timeout)(void *);
};
+enum {
+ SPCN_UNKOWN,
+ SPCN_GIDPN,
+ SPCN_GPSC,
+ SPCN_GPNID,
+ SPCN_GPNFT,
+ SPCN_GNNID,
+ SPCN_GFPNID,
+ SPCN_LOGIN,
+ SPCN_LOGOUT,
+ SPCN_ADISC,
+ SPCN_GNLIST,
+ SPCN_GPDB,
+ SPCN_TMF,
+ SPCN_ABORT ,
+ SPCN_NACK,
+ SPCN_BSG_RPT,
+ SPCN_BSG_HST ,
+ SPCN_BSG_CT,
+ SPCN_BSG_FX_MGMT,
+ SPCN_ELS_DCMD,
+ SPCN_FXDISC,
+ SPCN_GIDLIST,
+ SPCN_STATS,
+ SPCN_MB_GPDB,
+};
+struct sp_name {
+ uint16_t cmd;
+ const char *str;
+};
+
/* Values for srb_ctx type */
#define SRB_LOGIN_CMD 1
#define SRB_LOGOUT_CMD 2
int qla24xx_post_gpsc_work(struct scsi_qla_host *, fc_port_t *);
int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);
int qla2x00_mgmt_svr_login(scsi_qla_host_t *);
+const char *sp_to_str(uint16_t);
/*
* Global Function Prototypes in qla_attr.c source file.
static int qla2x00_sns_rft_id(scsi_qla_host_t *);
static int qla2x00_sns_rnn_id(scsi_qla_host_t *);
+struct sp_name sp_str[] = {
+ {SPCN_UNKOWN, "unknown"},
+ {SPCN_GIDPN, "gidpn"},
+ {SPCN_GPSC, "gpsc"},
+ {SPCN_GPNID, "gpnid"},
+ {SPCN_GPNFT, "gpnft"},
+ {SPCN_GNNID, "gnnid"},
+ {SPCN_GFPNID, "gfpnid"},
+ {SPCN_LOGIN, "login"},
+ {SPCN_LOGOUT, "logout"},
+ {SPCN_ADISC, "adisc"},
+ {SPCN_GNLIST, "gnlist"},
+ {SPCN_GPDB, "gpdb"},
+ {SPCN_TMF, "tmf"},
+ {SPCN_ABORT, "abort"},
+ {SPCN_NACK, "nack"},
+ {SPCN_BSG_RPT, "bsg_els_rpt"},
+ {SPCN_BSG_HST, "bsg_els_hst"},
+ {SPCN_BSG_CT, "bsg_ct"},
+ {SPCN_BSG_FX_MGMT, "bsg_fx_mgmt"},
+ {SPCN_ELS_DCMD, "ELS_DCMD"},
+ {SPCN_FXDISC, "fxdisc"},
+};
+const char *sp_to_str(uint16_t cmd)
+{
+ int i;
+ struct sp_name *e;
+
+ for (i = 1; i < ARRAY_SIZE(sp_str); i++) {
+ e = sp_str + i;
+ if (cmd == e->cmd)
+ return e->str;
+ }
+ return sp_str[0].str;
+}
+
+
/**
* qla2x00_prep_ms_iocb() - Prepare common MS/CT IOCB fields for SNS CT query.
* @ha: HA context
goto done;
sp->type = SRB_CT_PTHRU_CMD;
- sp->name = "gidpn";
+ sp->name = sp_to_str(SPCN_GIDPN);
sp->gen1 = fcport->rscn_gen;
sp->gen2 = fcport->login_gen;
goto done;
sp->type = SRB_CT_PTHRU_CMD;
- sp->name = "gpsc";
+ sp->name = sp_to_str(SPCN_GPSC);
sp->gen1 = fcport->rscn_gen;
sp->gen2 = fcport->login_gen;
goto done;
sp->type = SRB_CT_PTHRU_CMD;
- sp->name = "gpnid";
+ sp->name = sp_to_str(SPCN_GPNID);
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
fcport->logout_completed = 0;
sp->type = SRB_LOGIN_CMD;
- sp->name = "login";
+ sp->name = sp_to_str(SPCN_LOGIN);
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
lio = &sp->u.iocb_cmd;
goto done;
sp->type = SRB_LOGOUT_CMD;
- sp->name = "logout";
+ sp->name = sp_to_str(SPCN_LOGOUT);
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
lio = &sp->u.iocb_cmd;
goto done;
sp->type = SRB_ADISC_CMD;
- sp->name = "adisc";
+ sp->name = sp_to_str(SPCN_ADISC);
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
lio = &sp->u.iocb_cmd;
if (!sp)
goto done;
sp->type = SRB_MB_IOCB;
- sp->name = "gnlist";
+ sp->name = sp_to_str(SPCN_GNLIST);
sp->gen1 = fcport->rscn_gen;
sp->gen2 = fcport->login_gen;
memset(pd, 0, max(PORT_DATABASE_SIZE, PORT_DATABASE_24XX_SIZE));
sp->type = SRB_MB_IOCB;
- sp->name = "gpdb";
+ sp->name = sp_to_str(SPCN_GPDB);
sp->gen1 = fcport->rscn_gen;
sp->gen2 = fcport->login_gen;
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
tm_iocb = &sp->u.iocb_cmd;
sp->type = SRB_TM_CMD;
- sp->name = "tmf";
+ sp->name = sp_to_str(SPCN_TMF);
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha));
tm_iocb->u.tmf.flags = flags;
tm_iocb->u.tmf.lun = lun;
abt_iocb = &sp->u.iocb_cmd;
sp->type = SRB_ABT_CMD;
- sp->name = "abort";
+ sp->name = sp_to_str(SPCN_ABORT);
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha));
abt_iocb->u.abt.cmd_hndl = cmd_sp->handle;
sp->done = qla24xx_abort_sp_done;
fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa);
sp->type = SRB_ELS_DCMD;
- sp->name = "ELS_DCMD";
+ sp->name = sp_to_str(SPCN_ELS_DCMD);
sp->fcport = fcport;
qla2x00_init_timer(sp, ELS_DCMD_TIMEOUT);
elsio->timeout = qla2x00_els_dcmd_iocb_timeout;
uint16_t cmd;
const char *str;
} mb_str[] = {
- {MBC_GET_PORT_DATABASE, "GPDB"},
+ {0, "unknown mb"},
+ {MBC_GET_PORT_DATABASE, "GPDB"},
{MBC_GET_ID_LIST, "GIDList"},
{MBC_GET_LINK_PRIV_STATS, "Stats"},
};
int i;
struct mb_cmd_name *e;
- for (i = 0; i < ARRAY_SIZE(mb_str); i++) {
+ for (i = 1; i < ARRAY_SIZE(mb_str); i++) {
e = mb_str + i;
if (cmd == e->cmd)
return e->str;
}
- return "unknown";
+ return "mb_str[0].str";
}
/*
}
sp->type = SRB_FXIOCB_DCMD;
- sp->name = "fxdisc";
+ sp->name = sp_to_str(SPCN_FXDISC);
qla2x00_init_timer(sp, FXDISC_TIMEOUT);
fdisc->timeout = qla2x00_fxdisc_iocb_timeout;
fdisc->u.fxiocb.req_func_type = cpu_to_le16(fx_type);
goto done;
sp->type = type;
- sp->name = "nack";
+ sp->name = sp_to_str(SPCN_NACK);
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha)+2);