From 8816624222b12e5d7e291e9d1973fc42b994eb6b Mon Sep 17 00:00:00 2001 From: Jing Huang Date: Thu, 9 Dec 2010 17:11:53 -0800 Subject: [SCSI] bfa: rename log_level to bfa_log_level Rename log_level to bfa_log_level to make the global variable more bfa specific and avoid clashes with other drivers which was causing a build failure. Signed-off-by: Jing Huang Signed-off-by: James Bottomley --- drivers/scsi/bfa/bfad_im.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'drivers/scsi/bfa/bfad_im.c') diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 8ca967dee66d..fbad5e9b2402 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -225,7 +225,8 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd) } bfa_trc(bfad, hal_io->iotag); - BFA_LOG(KERN_INFO, bfad, log_level, "scsi%d: abort cmnd %p iotag %x\n", + BFA_LOG(KERN_INFO, bfad, bfa_log_level, + "scsi%d: abort cmnd %p iotag %x\n", im_port->shost->host_no, cmnd, hal_io->iotag); (void) bfa_ioim_abort(hal_io); spin_unlock_irqrestore(&bfad->bfad_lock, flags); @@ -241,7 +242,7 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd) cmnd->scsi_done(cmnd); bfa_trc(bfad, hal_io->iotag); - BFA_LOG(KERN_INFO, bfad, log_level, + BFA_LOG(KERN_INFO, bfad, bfa_log_level, "scsi%d: complete abort 0x%p iotag 0x%x\n", im_port->shost->host_no, cmnd, hal_io->iotag); return SUCCESS; @@ -260,7 +261,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); if (!tskim) { - BFA_LOG(KERN_ERR, bfad, log_level, + BFA_LOG(KERN_ERR, bfad, bfa_log_level, "target reset, fail to allocate tskim\n"); rc = BFA_STATUS_FAILED; goto out; @@ -311,7 +312,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); if (!tskim) { - BFA_LOG(KERN_ERR, bfad, log_level, + BFA_LOG(KERN_ERR, bfad, bfa_log_level, "LUN reset, fail to allocate tskim"); spin_unlock_irqrestore(&bfad->bfad_lock, flags); rc = FAILED; @@ -336,7 +337,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) task_status = cmnd->SCp.Status >> 1; if (task_status != BFI_TSKIM_STS_OK) { - BFA_LOG(KERN_ERR, bfad, log_level, + BFA_LOG(KERN_ERR, bfad, bfa_log_level, "LUN reset failure, status: %d\n", task_status); rc = FAILED; } @@ -380,7 +381,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd) task_status = cmnd->SCp.Status >> 1; if (task_status != BFI_TSKIM_STS_OK) { - BFA_LOG(KERN_ERR, bfad, log_level, + BFA_LOG(KERN_ERR, bfad, bfa_log_level, "target reset failure," " status: %d\n", task_status); err_cnt++; @@ -460,7 +461,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv) fcid = bfa_fcs_itnim_get_fcid(&itnim_drv->fcs_itnim); wwn2str(wwpn_str, wwpn); fcid2str(fcid_str, fcid); - BFA_LOG(KERN_INFO, bfad, log_level, + BFA_LOG(KERN_INFO, bfad, bfa_log_level, "ITNIM FREE scsi%d: FCID: %s WWPN: %s\n", port->im_port->shost->host_no, fcid_str, wwpn_str); @@ -589,7 +590,7 @@ void bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) { bfa_trc(bfad, bfad->inst_no); - BFA_LOG(KERN_INFO, bfad, log_level, "Free scsi%d\n", + BFA_LOG(KERN_INFO, bfad, bfa_log_level, "Free scsi%d\n", im_port->shost->host_no); fc_remove_host(im_port->shost); @@ -1048,7 +1049,7 @@ bfad_im_itnim_work_handler(struct work_struct *work) fcid2str(fcid_str, fcid); list_add_tail(&itnim->list_entry, &im_port->itnim_mapped_list); - BFA_LOG(KERN_INFO, bfad, log_level, + BFA_LOG(KERN_INFO, bfad, bfa_log_level, "ITNIM ONLINE Target: %d:0:%d " "FCID: %s WWPN: %s\n", im_port->shost->host_no, @@ -1081,7 +1082,7 @@ bfad_im_itnim_work_handler(struct work_struct *work) wwn2str(wwpn_str, wwpn); fcid2str(fcid_str, fcid); list_del(&itnim->list_entry); - BFA_LOG(KERN_INFO, bfad, log_level, + BFA_LOG(KERN_INFO, bfad, bfa_log_level, "ITNIM OFFLINE Target: %d:0:%d " "FCID: %s WWPN: %s\n", im_port->shost->host_no, -- cgit v1.2.3 From f7f73812e95077c19a2801bbf4f483fcdab5232f Mon Sep 17 00:00:00 2001 From: Maggie Zhang Date: Thu, 9 Dec 2010 19:08:43 -0800 Subject: [SCSI] bfa: clean up one line functions Cleaned up one line functions. Signed-off-by: Maggie Zhang Signed-off-by: Jing Huang Signed-off-by: James Bottomley --- drivers/scsi/bfa/bfa.h | 17 --- drivers/scsi/bfa/bfa_core.c | 173 ++---------------------- drivers/scsi/bfa/bfa_fcpim.c | 2 +- drivers/scsi/bfa/bfa_fcs.c | 172 ++++-------------------- drivers/scsi/bfa/bfa_fcs.h | 87 +++++++++--- drivers/scsi/bfa/bfa_fcs_fcpim.c | 18 +-- drivers/scsi/bfa/bfa_fcs_lport.c | 65 ++++----- drivers/scsi/bfa/bfa_fcs_rport.c | 97 ++------------ drivers/scsi/bfa/bfa_ioc.c | 280 +++++++-------------------------------- drivers/scsi/bfa/bfa_ioc.h | 19 +-- drivers/scsi/bfa/bfa_ioc_cb.c | 2 +- drivers/scsi/bfa/bfa_ioc_ct.c | 12 +- drivers/scsi/bfa/bfa_plog.h | 1 - drivers/scsi/bfa/bfa_port.c | 2 +- drivers/scsi/bfa/bfa_svc.c | 185 +------------------------- drivers/scsi/bfa/bfa_svc.h | 29 ++-- drivers/scsi/bfa/bfad.c | 22 +-- drivers/scsi/bfa/bfad_debugfs.c | 4 +- drivers/scsi/bfa/bfad_im.c | 2 +- 19 files changed, 259 insertions(+), 930 deletions(-) (limited to 'drivers/scsi/bfa/bfad_im.c') diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h index 7ed13ce6d6aa..6231e5aa55b3 100644 --- a/drivers/scsi/bfa/bfa.h +++ b/drivers/scsi/bfa/bfa.h @@ -296,7 +296,6 @@ void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev); -void bfa_iocfc_detach(struct bfa_s *bfa); void bfa_iocfc_init(struct bfa_s *bfa); void bfa_iocfc_start(struct bfa_s *bfa); void bfa_iocfc_stop(struct bfa_s *bfa); @@ -385,13 +384,7 @@ void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev); -void bfa_init_trc(struct bfa_s *bfa, struct bfa_trc_mod_s *trcmod); -void bfa_init_plog(struct bfa_s *bfa, struct bfa_plog_s *plog); void bfa_detach(struct bfa_s *bfa); -void bfa_init(struct bfa_s *bfa); -void bfa_start(struct bfa_s *bfa); -void bfa_stop(struct bfa_s *bfa); -void bfa_attach_fcs(struct bfa_s *bfa); void bfa_cb_init(void *bfad, bfa_status_t status); void bfa_cb_updateq(void *bfad, bfa_status_t status); @@ -405,7 +398,6 @@ void bfa_comp_free(struct bfa_s *bfa, struct list_head *comp_q); typedef void (*bfa_cb_ioc_t) (void *cbarg, enum bfa_status status); void bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr); -void bfa_get_attr(struct bfa_s *bfa, struct bfa_ioc_attr_s *ioc_attr); bfa_status_t bfa_iocfc_israttr_set(struct bfa_s *bfa, @@ -413,16 +405,7 @@ bfa_status_t bfa_iocfc_israttr_set(struct bfa_s *bfa, void bfa_iocfc_enable(struct bfa_s *bfa); void bfa_iocfc_disable(struct bfa_s *bfa); -void bfa_timer_tick(struct bfa_s *bfa); #define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout) \ bfa_timer_begin(&(_bfa)->timer_mod, _timer, _timercb, _arg, _timeout) -/* - * BFA debug API functions - */ -bfa_status_t bfa_debug_fwtrc(struct bfa_s *bfa, void *trcdata, int *trclen); -bfa_status_t bfa_debug_fwsave(struct bfa_s *bfa, void *trcdata, int *trclen); -bfa_status_t bfa_debug_fwcore(struct bfa_s *bfa, void *buf, - u32 *offset, int *buflen); - #endif /* __BFA_H__ */ diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 90e0f81ae425..002907c694af 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c @@ -66,18 +66,6 @@ static struct bfa_ioc_cbfn_s bfa_iocfc_cbfn; /* * BFA Interrupt handling functions */ -static void -bfa_msix_errint(struct bfa_s *bfa, u32 intr) -{ - bfa_ioc_error_isr(&bfa->ioc); -} - -static void -bfa_msix_lpu(struct bfa_s *bfa) -{ - bfa_ioc_mbox_isr(&bfa->ioc); -} - static void bfa_reqq_resume(struct bfa_s *bfa, int qid) { @@ -267,7 +255,7 @@ bfa_msix_lpu_err(struct bfa_s *bfa, int vec) intr = readl(bfa->iocfc.bfa_regs.intr_status); if (intr & (__HFN_INT_MBOX_LPU0 | __HFN_INT_MBOX_LPU1)) - bfa_msix_lpu(bfa); + bfa_ioc_mbox_isr(&bfa->ioc); intr &= (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | __HFN_INT_ERR_LPU1 | __HFN_INT_ERR_PSS | __HFN_INT_LL_HALT); @@ -298,7 +286,7 @@ bfa_msix_lpu_err(struct bfa_s *bfa, int vec) } writel(intr, bfa->iocfc.bfa_regs.intr_status); - bfa_msix_errint(bfa, intr); + bfa_ioc_error_isr(&bfa->ioc); } } @@ -467,8 +455,8 @@ bfa_iocfc_mem_claim(struct bfa_s *bfa, struct bfa_iocfc_cfg_s *cfg, * First allocate dma memory for IOC. */ bfa_ioc_mem_claim(&bfa->ioc, dm_kva, dm_pa); - dm_kva += bfa_ioc_meminfo(); - dm_pa += bfa_ioc_meminfo(); + dm_kva += BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); + dm_pa += BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); /* * Claim DMA-able memory for the request/response queues and for shadow @@ -531,7 +519,7 @@ bfa_iocfc_mem_claim(struct bfa_s *bfa, struct bfa_iocfc_cfg_s *cfg, bfa_meminfo_dma_virt(meminfo) = dm_kva; bfa_meminfo_dma_phys(meminfo) = dm_pa; - dbgsz = bfa_ioc_debug_trcsz(bfa_auto_recover); + dbgsz = (bfa_auto_recover) ? BFA_DBG_FWTRC_LEN : 0; if (dbgsz > 0) { bfa_ioc_debug_memclaim(&bfa->ioc, bfa_meminfo_kva(meminfo)); bfa_meminfo_kva(meminfo) += dbgsz; @@ -723,11 +711,11 @@ bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, u32 *dm_len) { /* dma memory for IOC */ - *dm_len += bfa_ioc_meminfo(); + *dm_len += BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); bfa_iocfc_fw_cfg_sz(cfg, dm_len); bfa_iocfc_cqs_sz(cfg, dm_len); - *km_len += bfa_ioc_debug_trcsz(bfa_auto_recover); + *km_len += (bfa_auto_recover) ? BFA_DBG_FWTRC_LEN : 0; } /* @@ -759,22 +747,13 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, bfa_iocfc_init_mem(bfa, bfad, cfg, pcidev); bfa_iocfc_mem_claim(bfa, cfg, meminfo); - bfa_timer_init(&bfa->timer_mod); + INIT_LIST_HEAD(&bfa->timer_mod.timer_q); INIT_LIST_HEAD(&bfa->comp_q); for (i = 0; i < BFI_IOC_MAX_CQS; i++) INIT_LIST_HEAD(&bfa->reqq_waitq[i]); } -/* - * Query IOC memory requirement information. - */ -void -bfa_iocfc_detach(struct bfa_s *bfa) -{ - bfa_ioc_detach(&bfa->ioc); -} - /* * Query IOC memory requirement information. */ @@ -1090,79 +1069,7 @@ bfa_detach(struct bfa_s *bfa) for (i = 0; hal_mods[i]; i++) hal_mods[i]->detach(bfa); - - bfa_iocfc_detach(bfa); -} - - -void -bfa_init_trc(struct bfa_s *bfa, struct bfa_trc_mod_s *trcmod) -{ - bfa->trcmod = trcmod; -} - -void -bfa_init_plog(struct bfa_s *bfa, struct bfa_plog_s *plog) -{ - bfa->plog = plog; -} - -/* - * Initialize IOC. - * - * This function will return immediately, when the IOC initialization is - * completed, the bfa_cb_init() will be called. - * - * @param[in] bfa instance - * - * @return void - * - * Special Considerations: - * - * @note - * When this function returns, the driver should register the interrupt service - * routine(s) and enable the device interrupts. If this is not done, - * bfa_cb_init() will never get called - */ -void -bfa_init(struct bfa_s *bfa) -{ - bfa_iocfc_init(bfa); -} - -/* - * Use this function initiate the IOC configuration setup. This function - * will return immediately. - * - * @param[in] bfa instance - * - * @return None - */ -void -bfa_start(struct bfa_s *bfa) -{ - bfa_iocfc_start(bfa); -} - -/* - * Use this function quiese the IOC. This function will return immediately, - * when the IOC is actually stopped, the bfad->comp will be set. - * - * @param[in]bfa - pointer to bfa_t. - * - * @return None - * - * Special Considerations: - * bfad->comp can be set before or after bfa_stop() returns. - * - * @note - * In case of any failure, we could handle it automatically by doing a - * reset and then succeed the bfa_stop() call. - */ -void -bfa_stop(struct bfa_s *bfa) -{ - bfa_iocfc_stop(bfa); + bfa_ioc_detach(&bfa->ioc); } void @@ -1198,20 +1105,6 @@ bfa_comp_free(struct bfa_s *bfa, struct list_head *comp_q) } } -void -bfa_attach_fcs(struct bfa_s *bfa) -{ - bfa->fcs = BFA_TRUE; -} - -/* - * Periodic timer heart beat from driver - */ -void -bfa_timer_tick(struct bfa_s *bfa) -{ - bfa_timer_beat(&bfa->timer_mod); -} /* * Return the list of PCI vendor/device id lists supported by this @@ -1282,51 +1175,3 @@ bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg) cfg->drvcfg.num_rspq_elems = BFA_RSPQ_NELEMS_MIN; cfg->drvcfg.min_cfg = BFA_TRUE; } - -void -bfa_get_attr(struct bfa_s *bfa, struct bfa_ioc_attr_s *ioc_attr) -{ - bfa_ioc_get_attr(&bfa->ioc, ioc_attr); -} - -/* - * Retrieve firmware trace information on IOC failure. - */ -bfa_status_t -bfa_debug_fwsave(struct bfa_s *bfa, void *trcdata, int *trclen) -{ - return bfa_ioc_debug_fwsave(&bfa->ioc, trcdata, trclen); -} - -/* - * Fetch firmware trace data. - * - * @param[in] bfa BFA instance - * @param[out] trcdata Firmware trace buffer - * @param[in,out] trclen Firmware trace buffer len - * - * @retval BFA_STATUS_OK Firmware trace is fetched. - * @retval BFA_STATUS_INPROGRESS Firmware trace fetch is in progress. - */ -bfa_status_t -bfa_debug_fwtrc(struct bfa_s *bfa, void *trcdata, int *trclen) -{ - return bfa_ioc_debug_fwtrc(&bfa->ioc, trcdata, trclen); -} - -/* - * Dump firmware memory. - * - * @param[in] bfa BFA instance - * @param[out] buf buffer for dump - * @param[in,out] offset smem offset to start read - * @param[in,out] buflen length of buffer - * - * @retval BFA_STATUS_OK Firmware memory is dumped. - * @retval BFA_STATUS_INPROGRESS Firmware memory dump is in progress. - */ -bfa_status_t -bfa_debug_fwcore(struct bfa_s *bfa, void *buf, u32 *offset, int *buflen) -{ - return bfa_ioc_debug_fwcore(&bfa->ioc, buf, offset, buflen); -} diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 0e7f3807dba2..d6aea5d4425f 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -2567,7 +2567,7 @@ bfa_ioim_notify_cleanup(struct bfa_ioim_s *ioim) } bfa_itnim_iodone(ioim->itnim); } else - bfa_tskim_iodone(ioim->iosp->tskim); + bfa_wc_down(&ioim->iosp->tskim->wc); } static bfa_boolean_t diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index 5b561bde2264..141215c51635 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c @@ -76,7 +76,7 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, fcs->bfad = bfad; fcs->min_cfg = min_cfg; - bfa_attach_fcs(bfa); + bfa->fcs = BFA_TRUE; fcbuild_init(); for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { @@ -110,14 +110,6 @@ bfa_fcs_init(struct bfa_fcs_s *fcs) } } -/* - * Start FCS operations. - */ -void -bfa_fcs_start(struct bfa_fcs_s *fcs) -{ - bfa_fcs_fabric_modstart(fcs); -} /* * brief @@ -138,22 +130,6 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, bfa_fcs_fabric_psymb_init(&fcs->fabric); } -/* - * brief - * FCS FDMI Driver Parameter Initialization - * - * param[in] fcs FCS instance - * param[in] fdmi_enable TRUE/FALSE - * - * return None - */ -void -bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable) -{ - - fcs->fdmi_enabled = fdmi_enable; - -} /* * brief * FCS instance cleanup and exit. @@ -184,18 +160,6 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs) } -void -bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod) -{ - fcs->trcmod = trcmod; -} - -void -bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs) -{ - bfa_wc_down(&fcs->wc); -} - /* * Fabric module implementation. */ @@ -232,31 +196,6 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg, u32 rsp_len, u32 resid_len, struct fchs_s *rspfchs); -/* - * fcs_fabric_sm fabric state machine functions - */ - -/* - * Fabric state machine events - */ -enum bfa_fcs_fabric_event { - BFA_FCS_FABRIC_SM_CREATE = 1, /* create from driver */ - BFA_FCS_FABRIC_SM_DELETE = 2, /* delete from driver */ - BFA_FCS_FABRIC_SM_LINK_DOWN = 3, /* link down from port */ - BFA_FCS_FABRIC_SM_LINK_UP = 4, /* link up from port */ - BFA_FCS_FABRIC_SM_CONT_OP = 5, /* flogi/auth continue op */ - BFA_FCS_FABRIC_SM_RETRY_OP = 6, /* flogi/auth retry op */ - BFA_FCS_FABRIC_SM_NO_FABRIC = 7, /* from flogi/auth */ - BFA_FCS_FABRIC_SM_PERF_EVFP = 8, /* from flogi/auth */ - BFA_FCS_FABRIC_SM_ISOLATE = 9, /* from EVFP processing */ - BFA_FCS_FABRIC_SM_NO_TAGGING = 10, /* no VFT tagging from EVFP */ - BFA_FCS_FABRIC_SM_DELAYED = 11, /* timeout delay event */ - BFA_FCS_FABRIC_SM_AUTH_FAILED = 12, /* auth failed */ - BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13, /* auth successful */ - BFA_FCS_FABRIC_SM_DELCOMP = 14, /* all vports deleted event */ - BFA_FCS_FABRIC_SM_LOOPBACK = 15, /* Received our own FLOGI */ - BFA_FCS_FABRIC_SM_START = 16, /* from driver */ -}; static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event); @@ -270,14 +209,8 @@ static void bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event); static void bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event); -static void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, - enum bfa_fcs_fabric_event event); -static void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, - enum bfa_fcs_fabric_event event); static void bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event); -static void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, - enum bfa_fcs_fabric_event event); static void bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event); static void bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric, @@ -337,7 +270,7 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric, case BFA_FCS_FABRIC_SM_DELETE: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); - bfa_fcs_modexit_comp(fabric->fcs); + bfa_wc_down(&fabric->fcs->wc); break; default: @@ -410,7 +343,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, case BFA_FCS_FABRIC_SM_LOOPBACK: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_loopback); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); bfa_fcs_fabric_set_opertype(fabric); break; @@ -424,12 +357,12 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, case BFA_FCS_FABRIC_SM_LINK_DOWN: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); break; case BFA_FCS_FABRIC_SM_DELETE: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); bfa_fcs_fabric_delete(fabric); break; @@ -481,7 +414,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, switch (event) { case BFA_FCS_FABRIC_SM_AUTH_FAILED: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); break; case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: @@ -495,7 +428,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, case BFA_FCS_FABRIC_SM_LINK_DOWN: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); break; case BFA_FCS_FABRIC_SM_DELETE: @@ -511,7 +444,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, /* * Authentication failed */ -static void +void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { @@ -537,7 +470,7 @@ bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, /* * Port is in loopback mode. */ -static void +void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { @@ -573,7 +506,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, switch (event) { case BFA_FCS_FABRIC_SM_LINK_DOWN: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); bfa_fcs_fabric_notify_offline(fabric); break; @@ -596,7 +529,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, /* * Fabric is online - normal operating state. */ -static void +void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { @@ -606,7 +539,7 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, switch (event) { case BFA_FCS_FABRIC_SM_LINK_DOWN: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); bfa_fcs_fabric_notify_offline(fabric); break; @@ -617,7 +550,7 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, case BFA_FCS_FABRIC_SM_AUTH_FAILED: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); - bfa_lps_discard(fabric->lps); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); break; case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: @@ -697,7 +630,7 @@ bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric, switch (event) { case BFA_FCS_FABRIC_SM_DELCOMP: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); - bfa_fcs_modexit_comp(fabric->fcs); + bfa_wc_down(&fabric->fcs->wc); break; case BFA_FCS_FABRIC_SM_LINK_UP: @@ -724,8 +657,8 @@ bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric) struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg; port_cfg->roles = BFA_LPORT_ROLE_FCP_IM; - port_cfg->nwwn = bfa_ioc_get_nwwn(&fabric->fcs->bfa->ioc); - port_cfg->pwwn = bfa_ioc_get_pwwn(&fabric->fcs->bfa->ioc); + port_cfg->nwwn = fabric->fcs->bfa->ioc.attr->nwwn; + port_cfg->pwwn = fabric->fcs->bfa->ioc.attr->pwwn; } /* @@ -813,7 +746,7 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status) return; case BFA_STATUS_EPROTOCOL: - switch (bfa_lps_get_extstatus(fabric->lps)) { + switch (fabric->lps->ext_status) { case BFA_EPROTO_BAD_ACCEPT: fabric->stats.flogi_acc_err++; break; @@ -840,26 +773,26 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status) return; } - fabric->bb_credit = bfa_lps_get_peer_bbcredit(fabric->lps); + fabric->bb_credit = fabric->lps->pr_bbcred; bfa_trc(fabric->fcs, fabric->bb_credit); - if (!bfa_lps_is_brcd_fabric(fabric->lps)) - fabric->fabric_name = bfa_lps_get_peer_nwwn(fabric->lps); + if (!(fabric->lps->brcd_switch)) + fabric->fabric_name = fabric->lps->pr_nwwn; /* * Check port type. It should be 1 = F-port. */ - if (bfa_lps_is_fport(fabric->lps)) { - fabric->bport.pid = bfa_lps_get_pid(fabric->lps); - fabric->is_npiv = bfa_lps_is_npiv_en(fabric->lps); - fabric->is_auth = bfa_lps_is_authreq(fabric->lps); + if (fabric->lps->fport) { + fabric->bport.pid = fabric->lps->lp_pid; + fabric->is_npiv = fabric->lps->npiv_en; + fabric->is_auth = fabric->lps->auth_req; bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CONT_OP); } else { /* * Nport-2-Nport direct attached */ fabric->bport.port_topo.pn2n.rem_port_wwn = - bfa_lps_get_peer_pwwn(fabric->lps); + fabric->lps->pr_pwwn; bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC); } @@ -1038,23 +971,6 @@ bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs) bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START); } -bfa_boolean_t -bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric) -{ - return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback); -} - -bfa_boolean_t -bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric) -{ - return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_auth_failed); -} - -enum bfa_port_type -bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric) -{ - return fabric->oper_type; -} /* * Link up notification from BFA physical port module. @@ -1115,28 +1031,6 @@ bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric, bfa_wc_down(&fabric->wc); } -/* - * Base port is deleted. - */ -void -bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric) -{ - bfa_wc_down(&fabric->wc); -} - - -/* - * Check if fabric is online. - * - * param[in] fabric - Fabric instance. This can be a base fabric or vf. - * - * @return TRUE/FALSE - */ -int -bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric) -{ - return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_online); -} /* * Lookup for a vport withing a fabric given its pwwn @@ -1156,18 +1050,6 @@ bfa_fcs_fabric_vport_lookup(struct bfa_fcs_fabric_s *fabric, wwn_t pwwn) return NULL; } -/* - * In a given fabric, return the number of lports. - * - * param[in] fabric - Fabric instance. This can be a base fabric or vf. - * - * @return : 1 or more. - */ -u16 -bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric) -{ - return fabric->num_vports; -} /* * Get OUI of the attached switch. @@ -1187,7 +1069,7 @@ bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric) u8 *tmp; u16 oui; - fab_nwwn = bfa_lps_get_peer_nwwn(fabric->lps); + fab_nwwn = fabric->lps->pr_nwwn; tmp = (u8 *)&fab_nwwn; oui = (tmp[3] << 8) | tmp[4]; @@ -1344,7 +1226,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) bfa_fcport_get_maxfrsize(bfa), bfa_fcport_get_rx_bbcredit(bfa)); - bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), + bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->lp_tag, BFA_FALSE, FC_CLASS_3, reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric, FC_MAX_PDUSZ, 0); diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index fcb54e5ef331..e7977ee32992 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h @@ -26,6 +26,21 @@ #define BFA_FCS_OS_STR_LEN 64 +/* + * lps_pvt BFA LPS private functions + */ + +enum bfa_lps_event { + BFA_LPS_SM_LOGIN = 1, /* login request from user */ + BFA_LPS_SM_LOGOUT = 2, /* logout request from user */ + BFA_LPS_SM_FWRSP = 3, /* f/w response to login/logout */ + BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ + BFA_LPS_SM_DELETE = 5, /* lps delete from user */ + BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ + BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */ +}; + + /* * !!! Only append to the enums defined here to avoid any versioning * !!! needed between trace utility and driver version @@ -41,7 +56,6 @@ enum { struct bfa_fcs_s; #define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg) -void bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs); #define BFA_FCS_BRCD_SWITCH_OUI 0x051e #define N2N_LOCAL_PID 0x010000 @@ -444,9 +458,6 @@ void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport); struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port, u32 pid); -void bfa_fcs_rport_delete(struct bfa_fcs_rport_s *rport); -void bfa_fcs_rport_online(struct bfa_fcs_rport_s *rport); -void bfa_fcs_rport_offline(struct bfa_fcs_rport_s *rport); void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs, struct fc_logi_s *plogi_rsp); void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, @@ -454,10 +465,8 @@ void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, struct fc_logi_s *plogi); void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs, struct fc_logi_s *plogi); -void bfa_fcs_rport_logo_imp(struct bfa_fcs_rport_s *rport); void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id); -void bfa_fcs_rport_itnim_ack(struct bfa_fcs_rport_s *rport); void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport); void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport); int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport); @@ -647,6 +656,57 @@ struct bfa_fcs_s { struct bfa_wc_s wc; /* waiting counter */ }; +/* + * fcs_fabric_sm fabric state machine functions + */ + +/* + * Fabric state machine events + */ +enum bfa_fcs_fabric_event { + BFA_FCS_FABRIC_SM_CREATE = 1, /* create from driver */ + BFA_FCS_FABRIC_SM_DELETE = 2, /* delete from driver */ + BFA_FCS_FABRIC_SM_LINK_DOWN = 3, /* link down from port */ + BFA_FCS_FABRIC_SM_LINK_UP = 4, /* link up from port */ + BFA_FCS_FABRIC_SM_CONT_OP = 5, /* flogi/auth continue op */ + BFA_FCS_FABRIC_SM_RETRY_OP = 6, /* flogi/auth retry op */ + BFA_FCS_FABRIC_SM_NO_FABRIC = 7, /* from flogi/auth */ + BFA_FCS_FABRIC_SM_PERF_EVFP = 8, /* from flogi/auth */ + BFA_FCS_FABRIC_SM_ISOLATE = 9, /* from EVFP processing */ + BFA_FCS_FABRIC_SM_NO_TAGGING = 10, /* no VFT tagging from EVFP */ + BFA_FCS_FABRIC_SM_DELAYED = 11, /* timeout delay event */ + BFA_FCS_FABRIC_SM_AUTH_FAILED = 12, /* auth failed */ + BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13, /* auth successful */ + BFA_FCS_FABRIC_SM_DELCOMP = 14, /* all vports deleted event */ + BFA_FCS_FABRIC_SM_LOOPBACK = 15, /* Received our own FLOGI */ + BFA_FCS_FABRIC_SM_START = 16, /* from driver */ +}; + +/* + * fcs_rport_sm FCS rport state machine events + */ + +enum rport_event { + RPSM_EVENT_PLOGI_SEND = 1, /* new rport; start with PLOGI */ + RPSM_EVENT_PLOGI_RCVD = 2, /* Inbound PLOGI from remote port */ + RPSM_EVENT_PLOGI_COMP = 3, /* PLOGI completed to rport */ + RPSM_EVENT_LOGO_RCVD = 4, /* LOGO from remote device */ + RPSM_EVENT_LOGO_IMP = 5, /* implicit logo for SLER */ + RPSM_EVENT_FCXP_SENT = 6, /* Frame from has been sent */ + RPSM_EVENT_DELETE = 7, /* RPORT delete request */ + RPSM_EVENT_SCN = 8, /* state change notification */ + RPSM_EVENT_ACCEPTED = 9, /* Good response from remote device */ + RPSM_EVENT_FAILED = 10, /* Request to rport failed. */ + RPSM_EVENT_TIMEOUT = 11, /* Rport SM timeout event */ + RPSM_EVENT_HCB_ONLINE = 12, /* BFA rport online callback */ + RPSM_EVENT_HCB_OFFLINE = 13, /* BFA rport offline callback */ + RPSM_EVENT_FC4_OFFLINE = 14, /* FC-4 offline complete */ + RPSM_EVENT_ADDRESS_CHANGE = 15, /* Rport's PID has changed */ + RPSM_EVENT_ADDRESS_DISC = 16, /* Need to Discover rport's PID */ + RPSM_EVENT_PRLO_RCVD = 17, /* PRLO from remote device */ + RPSM_EVENT_PLOGI_RETRY = 18, /* Retry PLOGI continously */ +}; + /* * bfa fcs API functions */ @@ -656,16 +716,12 @@ void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, void bfa_fcs_init(struct bfa_fcs_s *fcs); void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, struct bfa_fcs_driver_info_s *driver_info); -void bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable); void bfa_fcs_exit(struct bfa_fcs_s *fcs); -void bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod); -void bfa_fcs_start(struct bfa_fcs_s *fcs); /* * bfa fcs vf public functions */ bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id); -u16 bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric); /* * fabric protected interface functions @@ -679,22 +735,23 @@ void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric, struct bfa_fcs_vport_s *vport); void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric, struct bfa_fcs_vport_s *vport); -int bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric); struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup( struct bfa_fcs_fabric_s *fabric, wwn_t pwwn); void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs); void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs, u16 len); -bfa_boolean_t bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric); -bfa_boolean_t bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric); -enum bfa_port_type bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric); void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric); -void bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric); void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, wwn_t fabric_name); u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric); void bfa_fcs_uf_attach(struct bfa_fcs_s *fcs); void bfa_fcs_port_attach(struct bfa_fcs_s *fcs); +void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, + enum bfa_fcs_fabric_event event); +void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, + enum bfa_fcs_fabric_event event); +void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, + enum bfa_fcs_fabric_event event); /* * BFA FCS callback interfaces diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c index 413b58eef93a..82ac2798c545 100644 --- a/drivers/scsi/bfa/bfa_fcs_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c @@ -103,7 +103,7 @@ bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim, break; case BFA_FCS_ITNIM_SM_OFFLINE: - bfa_fcs_rport_itnim_ack(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); break; case BFA_FCS_ITNIM_SM_INITIATOR: @@ -140,7 +140,7 @@ bfa_fcs_itnim_sm_prli_send(struct bfa_fcs_itnim_s *itnim, case BFA_FCS_ITNIM_SM_OFFLINE: bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe); - bfa_fcs_rport_itnim_ack(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); break; case BFA_FCS_ITNIM_SM_DELETE: @@ -181,7 +181,7 @@ bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim, case BFA_FCS_ITNIM_SM_OFFLINE: bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); bfa_fcxp_discard(itnim->fcxp); - bfa_fcs_rport_itnim_ack(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); break; case BFA_FCS_ITNIM_SM_INITIATOR: @@ -217,7 +217,7 @@ bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim, } else { /* invoke target offline */ bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); - bfa_fcs_rport_logo_imp(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_LOGO_IMP); } break; @@ -225,7 +225,7 @@ bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim, case BFA_FCS_ITNIM_SM_OFFLINE: bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); bfa_timer_stop(&itnim->timer); - bfa_fcs_rport_itnim_ack(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); break; case BFA_FCS_ITNIM_SM_INITIATOR: @@ -269,7 +269,7 @@ bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim, case BFA_FCS_ITNIM_SM_OFFLINE: bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); bfa_itnim_offline(itnim->bfa_itnim); - bfa_fcs_rport_itnim_ack(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); break; case BFA_FCS_ITNIM_SM_DELETE: @@ -330,7 +330,7 @@ bfa_fcs_itnim_sm_hcb_offline(struct bfa_fcs_itnim_s *itnim, switch (event) { case BFA_FCS_ITNIM_SM_HCB_OFFLINE: bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); - bfa_fcs_rport_itnim_ack(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); break; case BFA_FCS_ITNIM_SM_DELETE: @@ -358,7 +358,7 @@ bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim, switch (event) { case BFA_FCS_ITNIM_SM_OFFLINE: bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); - bfa_fcs_rport_itnim_ack(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); break; case BFA_FCS_ITNIM_SM_RSP_ERROR: @@ -688,7 +688,7 @@ bfa_cb_itnim_sler(void *cb_arg) itnim->stats.sler++; bfa_trc(itnim->fcs, itnim->rport->pwwn); - bfa_fcs_rport_logo_imp(itnim->rport); + bfa_sm_send_event(itnim->rport, RPSM_EVENT_LOGO_IMP); } struct bfa_fcs_itnim_s * diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index bd0c093fca66..6e9151fecb74 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c @@ -159,7 +159,7 @@ bfa_fcs_lport_sm_online( bfa_sm_set_state(port, bfa_fcs_lport_sm_deleting); list_for_each_safe(qe, qen, &port->rport_q) { rport = (struct bfa_fcs_rport_s *) qe; - bfa_fcs_rport_delete(rport); + bfa_sm_send_event(rport, RPSM_EVENT_DELETE); } } break; @@ -197,7 +197,7 @@ bfa_fcs_lport_sm_offline( bfa_sm_set_state(port, bfa_fcs_lport_sm_deleting); list_for_each_safe(qe, qen, &port->rport_q) { rport = (struct bfa_fcs_rport_s *) qe; - bfa_fcs_rport_delete(rport); + bfa_sm_send_event(rport, RPSM_EVENT_DELETE); } } break; @@ -350,7 +350,7 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, * disappeared. Send implicit LOGO to old device. */ bfa_assert(rport->pwwn != plogi->port_name); - bfa_fcs_rport_logo_imp(rport); + bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); /* * Inbound PLOGI from a new device (with old PID). @@ -511,7 +511,8 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port) __port_action[port->fabric->fab_type].offline(port); wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); - if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE) + if (bfa_sm_cmp_state(port->fabric, + bfa_fcs_fabric_sm_online) == BFA_TRUE) BFA_LOG(KERN_ERR, bfad, bfa_log_level, "Logical port lost fabric connectivity: WWN = %s Role = %s\n", lpwwn_buf, "Initiator"); @@ -522,7 +523,7 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port) list_for_each_safe(qe, qen, &port->rport_q) { rport = (struct bfa_fcs_rport_s *) qe; - bfa_fcs_rport_offline(rport); + bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); } } @@ -584,7 +585,7 @@ bfa_fcs_lport_deleted(struct bfa_fcs_lport_s *port) port->vport ? port->vport->vport_drv : NULL); bfa_fcs_vport_delete_comp(port->vport); } else { - bfa_fcs_fabric_port_delete_comp(port->fabric); + bfa_wc_down(&port->fabric->wc); } } @@ -828,8 +829,8 @@ bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs, lport->fcs = fcs; lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id); lport->vport = vport; - lport->lp_tag = (vport) ? bfa_lps_get_tag(vport->lps) : - bfa_lps_get_tag(lport->fabric->lps); + lport->lp_tag = (vport) ? vport->lps->lp_tag : + lport->fabric->lps->lp_tag; INIT_LIST_HEAD(&lport->rport_q); lport->num_rports = 0; @@ -881,10 +882,11 @@ bfa_fcs_lport_get_attr( port_attr->port_cfg = port->port_cfg; if (port->fabric) { - port_attr->port_type = bfa_fcs_fabric_port_type(port->fabric); - port_attr->loopback = bfa_fcs_fabric_is_loopback(port->fabric); + port_attr->port_type = port->fabric->oper_type; + port_attr->loopback = bfa_sm_cmp_state(port->fabric, bfa_fcs_fabric_sm_loopback); port_attr->authfail = - bfa_fcs_fabric_is_auth_failed(port->fabric); + bfa_sm_cmp_state(port->fabric, + bfa_fcs_fabric_sm_auth_failed); port_attr->fabric_name = bfa_fcs_lport_get_fabric_name(port); memcpy(port_attr->fabric_ip_addr, bfa_fcs_lport_get_fabric_ipaddr(port), @@ -893,10 +895,10 @@ bfa_fcs_lport_get_attr( if (port->vport != NULL) { port_attr->port_type = BFA_PORT_TYPE_VPORT; port_attr->fpma_mac = - bfa_lps_get_lp_mac(port->vport->lps); + port->vport->lps->lp_mac; } else { port_attr->fpma_mac = - bfa_lps_get_lp_mac(port->fabric->lps); + port->fabric->lps->lp_mac; } } else { port_attr->port_type = BFA_PORT_TYPE_UNKNOWN; @@ -985,7 +987,7 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) bfa_trc(port->fcs, rport->pid); bfa_trc(port->fcs, rport->pwwn); rport->pid = N2N_REMOTE_PID; - bfa_fcs_rport_online(rport); + bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_SEND); return; } @@ -998,7 +1000,7 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) bfa_assert(rport != NULL); if (rport) { bfa_trc(port->fcs, rport->pwwn); - bfa_fcs_rport_delete(rport); + bfa_sm_send_event(rport, RPSM_EVENT_DELETE); } } bfa_fcs_rport_create(port, N2N_REMOTE_PID); @@ -2540,7 +2542,7 @@ bfa_fcs_lport_ms_send_gmal(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) len = fc_gmal_req_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), bfa_fcs_lport_get_fcid(port), - bfa_lps_get_peer_nwwn(port->fabric->lps)); + port->fabric->lps->pr_nwwn); bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, FC_CLASS_3, len, &fchs, @@ -2740,7 +2742,7 @@ bfa_fcs_lport_ms_send_gfn(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) len = fc_gfn_req_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), bfa_fcs_lport_get_fcid(port), - bfa_lps_get_peer_nwwn(port->fabric->lps)); + port->fabric->lps->pr_nwwn); bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, FC_CLASS_3, len, &fchs, @@ -4332,8 +4334,8 @@ bfa_fcs_lport_scn_send_scr(void *scn_cbarg, struct bfa_fcxp_s *fcxp_alloced) /* Handle VU registrations for Base port only */ if ((!port->vport) && bfa_ioc_get_fcmode(&port->fcs->bfa->ioc)) { len = fc_scr_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), - bfa_lps_is_brcd_fabric(port->fabric->lps), - port->pid, 0); + port->fabric->lps->brcd_switch, + port->pid, 0); } else { len = fc_scr_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), BFA_FALSE, @@ -4833,7 +4835,7 @@ bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, port_info->max_vports_supp = bfa_lps_get_max_vport(port->fcs->bfa); port_info->num_vports_inuse = - bfa_fcs_fabric_vport_count(port->fabric); + port->fabric->num_vports; port_info->max_rports_supp = BFA_FCS_MAX_RPORTS_SUPP; port_info->num_rports_inuse = port->num_rports; } else { @@ -4977,7 +4979,8 @@ bfa_fcs_vport_sm_created(struct bfa_fcs_vport_s *vport, switch (event) { case BFA_FCS_VPORT_SM_START: - if (bfa_fcs_fabric_is_online(__vport_fabric(vport)) + if (bfa_sm_cmp_state(__vport_fabric(vport), + bfa_fcs_fabric_sm_online) && bfa_fcs_fabric_npiv_capable(__vport_fabric(vport))) { bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc); bfa_fcs_vport_do_fdisc(vport); @@ -5060,13 +5063,13 @@ bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport, switch (event) { case BFA_FCS_VPORT_SM_DELETE: bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup); - bfa_lps_discard(vport->lps); + bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); bfa_fcs_lport_delete(&vport->lport); break; case BFA_FCS_VPORT_SM_OFFLINE: bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); - bfa_lps_discard(vport->lps); + bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); break; case BFA_FCS_VPORT_SM_RSP_OK: @@ -5146,7 +5149,7 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport, case BFA_FCS_VPORT_SM_OFFLINE: bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); - bfa_lps_discard(vport->lps); + bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); bfa_fcs_lport_offline(&vport->lport); break; @@ -5246,7 +5249,7 @@ bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, switch (event) { case BFA_FCS_VPORT_SM_OFFLINE: - bfa_lps_discard(vport->lps); + bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); /* * !!! fall through !!! */ @@ -5285,14 +5288,14 @@ bfa_fcs_vport_do_fdisc(struct bfa_fcs_vport_s *vport) static void bfa_fcs_vport_fdisc_rejected(struct bfa_fcs_vport_s *vport) { - u8 lsrjt_rsn = bfa_lps_get_lsrjt_rsn(vport->lps); - u8 lsrjt_expl = bfa_lps_get_lsrjt_expl(vport->lps); + u8 lsrjt_rsn = vport->lps->lsrjt_rsn; + u8 lsrjt_expl = vport->lps->lsrjt_expl; bfa_trc(__vport_fcs(vport), lsrjt_rsn); bfa_trc(__vport_fcs(vport), lsrjt_expl); /* For certain reason codes, we don't want to retry. */ - switch (bfa_lps_get_lsrjt_expl(vport->lps)) { + switch (vport->lps->lsrjt_expl) { case FC_LS_RJT_EXP_INV_PORT_NAME: /* by brocade */ case FC_LS_RJT_EXP_INVALID_NPORT_ID: /* by Cisco */ if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) @@ -5456,7 +5459,7 @@ bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport, struct bfa_fcs_s *fcs, if (bfa_fcs_vport_lookup(fcs, vf_id, vport_cfg->pwwn) != NULL) return BFA_STATUS_VPORT_EXISTS; - if (bfa_fcs_fabric_vport_count(&fcs->fabric) == + if (fcs->fabric.num_vports == bfa_lps_get_max_vport(fcs->bfa)) return BFA_STATUS_VPORT_MAX; @@ -5637,7 +5640,7 @@ bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status) /* * Initialiaze the V-Port fields */ - __vport_fcid(vport) = bfa_lps_get_pid(vport->lps); + __vport_fcid(vport) = vport->lps->lp_pid; vport->vport_stats.fdisc_accepts++; bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_OK); break; @@ -5650,7 +5653,7 @@ bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status) break; case BFA_STATUS_EPROTOCOL: - switch (bfa_lps_get_extstatus(vport->lps)) { + switch (vport->lps->ext_status) { case BFA_EPROTO_BAD_ACCEPT: vport->vport_stats.fdisc_acc_bad++; break; diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index 7928bc8c1ed7..2089d686fa5d 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c @@ -75,30 +75,6 @@ static void bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, static void bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs, u16 len); static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport); -/* - * fcs_rport_sm FCS rport state machine events - */ - -enum rport_event { - RPSM_EVENT_PLOGI_SEND = 1, /* new rport; start with PLOGI */ - RPSM_EVENT_PLOGI_RCVD = 2, /* Inbound PLOGI from remote port */ - RPSM_EVENT_PLOGI_COMP = 3, /* PLOGI completed to rport */ - RPSM_EVENT_LOGO_RCVD = 4, /* LOGO from remote device */ - RPSM_EVENT_LOGO_IMP = 5, /* implicit logo for SLER */ - RPSM_EVENT_FCXP_SENT = 6, /* Frame from has been sent */ - RPSM_EVENT_DELETE = 7, /* RPORT delete request */ - RPSM_EVENT_SCN = 8, /* state change notification */ - RPSM_EVENT_ACCEPTED = 9, /* Good response from remote device */ - RPSM_EVENT_FAILED = 10, /* Request to rport failed. */ - RPSM_EVENT_TIMEOUT = 11, /* Rport SM timeout event */ - RPSM_EVENT_HCB_ONLINE = 12, /* BFA rport online callback */ - RPSM_EVENT_HCB_OFFLINE = 13, /* BFA rport offline callback */ - RPSM_EVENT_FC4_OFFLINE = 14, /* FC-4 offline complete */ - RPSM_EVENT_ADDRESS_CHANGE = 15, /* Rport's PID has changed */ - RPSM_EVENT_ADDRESS_DISC = 16, /* Need to Discover rport's PID */ - RPSM_EVENT_PRLO_RCVD = 17, /* PRLO from remote device */ - RPSM_EVENT_PLOGI_RETRY = 18, /* Retry PLOGI continously */ -}; static void bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, enum rport_event event); @@ -498,24 +474,24 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, case RPSM_EVENT_LOGO_RCVD: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); - bfa_rport_offline(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); break; case RPSM_EVENT_LOGO_IMP: case RPSM_EVENT_ADDRESS_CHANGE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); - bfa_rport_offline(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); break; case RPSM_EVENT_PLOGI_RCVD: bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); - bfa_rport_offline(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); bfa_fcs_rport_send_plogiacc(rport, NULL); break; case RPSM_EVENT_DELETE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); - bfa_rport_offline(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); break; case RPSM_EVENT_SCN: @@ -824,7 +800,7 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport, switch (event) { case RPSM_EVENT_FC4_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); - bfa_rport_offline(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); break; case RPSM_EVENT_DELETE: @@ -856,7 +832,7 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport, switch (event) { case RPSM_EVENT_FC4_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); - bfa_rport_offline(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); break; default: @@ -878,7 +854,7 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, switch (event) { case RPSM_EVENT_FC4_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); - bfa_rport_offline(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); break; case RPSM_EVENT_SCN: @@ -1459,7 +1435,7 @@ bfa_fcs_rport_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, twin->stats.plogi_rcvd += rport->stats.plogi_rcvd; twin->stats.plogi_accs++; - bfa_fcs_rport_delete(rport); + bfa_sm_send_event(rport, RPSM_EVENT_DELETE); bfa_fcs_rport_update(twin, plogi_rsp); twin->pid = rsp_fchs->s_id; @@ -1998,7 +1974,7 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) rport->itnim = bfa_fcs_itnim_create(rport); if (!rport->itnim) { bfa_trc(fcs, rpid); - bfa_rport_delete(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE); kfree(rport_drv); return NULL; } @@ -2032,7 +2008,7 @@ bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport) bfa_fcs_rpf_rport_offline(rport); } - bfa_rport_delete(rport->bfa_rport); + bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE); bfa_fcs_lport_del_rport(port, rport); kfree(rport->rp_drv); } @@ -2307,39 +2283,7 @@ bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs, bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD); } -/* - * Called by bport/vport to delete a remote port instance. - * - * Rport delete is called under the following conditions: - * - vport is deleted - * - vf is deleted - * - explicit request from OS to delete rport - */ -void -bfa_fcs_rport_delete(struct bfa_fcs_rport_s *rport) -{ - bfa_sm_send_event(rport, RPSM_EVENT_DELETE); -} -/* - * Called by bport/vport to when a target goes offline. - * - */ -void -bfa_fcs_rport_offline(struct bfa_fcs_rport_s *rport) -{ - bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); -} - -/* - * Called by bport in n2n when a target (attached port) becomes online. - * - */ -void -bfa_fcs_rport_online(struct bfa_fcs_rport_s *rport) -{ - bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_SEND); -} /* * Called by bport/vport to notify SCN for the remote port */ @@ -2350,15 +2294,6 @@ bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport) bfa_sm_send_event(rport, RPSM_EVENT_SCN); } -/* - * Called by fcpim to notify that the ITN cleanup is done. - */ -void -bfa_fcs_rport_itnim_ack(struct bfa_fcs_rport_s *rport) -{ - bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE); -} - /* * brief @@ -2453,15 +2388,6 @@ bfa_cb_rport_qos_scn_prio(void *cbarg, bfa_trc(rport->fcs, rport->pwwn); } -/* - * Called to process any unsolicted frames from this remote port - */ -void -bfa_fcs_rport_logo_imp(struct bfa_fcs_rport_s *rport) -{ - bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); -} - /* * Called to process any unsolicted frames from this remote port */ @@ -2578,6 +2504,7 @@ bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport) return bfa_sm_to_state(rport_sm_table, rport->sm); } + /* * brief * Called by the Driver to set rport delete/ageout timeout @@ -2703,7 +2630,7 @@ bfa_fcs_rpf_sm_uninit(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) case RPFSM_EVENT_RPORT_ONLINE: /* Send RPSC2 to a Brocade fabric only. */ if ((!BFA_FCS_PID_IS_WKA(rport->pid)) && - ((bfa_lps_is_brcd_fabric(rport->port->fabric->lps)) || + ((rport->port->fabric->lps->brcd_switch) || (bfa_fcs_fabric_get_switch_oui(fabric) == BFA_FCS_BRCD_SWITCH_OUI))) { bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending); diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 3f41d290142d..a8f745420f32 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c @@ -42,11 +42,6 @@ BFA_TRC_FILE(CNA, IOC); bfa_ioc_hb_check, (__ioc), BFA_IOC_HB_TOV) #define bfa_hb_timer_stop(__ioc) bfa_timer_stop(&(__ioc)->hb_timer) -#define BFA_DBG_FWTRC_ENTS (BFI_IOC_TRC_ENTS) -#define BFA_DBG_FWTRC_LEN \ - (BFA_DBG_FWTRC_ENTS * sizeof(struct bfa_trc_s) + \ - (sizeof(struct bfa_trc_mod_s) - \ - BFA_TRC_MAX * sizeof(struct bfa_trc_s))) #define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn)) /* @@ -81,24 +76,18 @@ bfa_boolean_t bfa_auto_recover = BFA_TRUE; * forward declarations */ static void bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc); -static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc_s *ioc); static void bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force); static void bfa_ioc_timeout(void *ioc); static void bfa_ioc_send_enable(struct bfa_ioc_s *ioc); static void bfa_ioc_send_disable(struct bfa_ioc_s *ioc); static void bfa_ioc_send_getattr(struct bfa_ioc_s *ioc); static void bfa_ioc_hb_monitor(struct bfa_ioc_s *ioc); -static void bfa_ioc_hb_stop(struct bfa_ioc_s *ioc); -static void bfa_ioc_reset(struct bfa_ioc_s *ioc, bfa_boolean_t force); static void bfa_ioc_mbox_poll(struct bfa_ioc_s *ioc); static void bfa_ioc_mbox_hbfail(struct bfa_ioc_s *ioc); static void bfa_ioc_recover(struct bfa_ioc_s *ioc); static void bfa_ioc_check_attr_wwns(struct bfa_ioc_s *ioc); static void bfa_ioc_disable_comp(struct bfa_ioc_s *ioc); static void bfa_ioc_lpu_stop(struct bfa_ioc_s *ioc); -static void bfa_ioc_pf_enabled(struct bfa_ioc_s *ioc); -static void bfa_ioc_pf_disabled(struct bfa_ioc_s *ioc); -static void bfa_ioc_pf_failed(struct bfa_ioc_s *ioc); static void bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc); @@ -162,12 +151,6 @@ static struct bfa_sm_table_s ioc_sm_table[] = { /* * Forward declareations for iocpf state machine */ -static void bfa_iocpf_enable(struct bfa_ioc_s *ioc); -static void bfa_iocpf_disable(struct bfa_ioc_s *ioc); -static void bfa_iocpf_fail(struct bfa_ioc_s *ioc); -static void bfa_iocpf_initfail(struct bfa_ioc_s *ioc); -static void bfa_iocpf_getattrfail(struct bfa_ioc_s *ioc); -static void bfa_iocpf_stop(struct bfa_ioc_s *ioc); static void bfa_iocpf_timeout(void *ioc_arg); static void bfa_iocpf_sem_timeout(void *ioc_arg); @@ -298,7 +281,7 @@ bfa_ioc_sm_reset(struct bfa_ioc_s *ioc, enum ioc_event event) static void bfa_ioc_sm_enabling_entry(struct bfa_ioc_s *ioc) { - bfa_iocpf_enable(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_ENABLE); } /* @@ -321,7 +304,7 @@ bfa_ioc_sm_enabling(struct bfa_ioc_s *ioc, enum ioc_event event) case IOC_E_HWERROR: bfa_fsm_set_state(ioc, bfa_ioc_sm_initfail); - bfa_iocpf_initfail(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); break; case IOC_E_DISABLE: @@ -330,7 +313,7 @@ bfa_ioc_sm_enabling(struct bfa_ioc_s *ioc, enum ioc_event event) case IOC_E_DETACH: bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); - bfa_iocpf_stop(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); break; case IOC_E_ENABLE: @@ -375,7 +358,7 @@ bfa_ioc_sm_getattr(struct bfa_ioc_s *ioc, enum ioc_event event) case IOC_E_TIMEOUT: bfa_fsm_set_state(ioc, bfa_ioc_sm_initfail); - bfa_iocpf_getattrfail(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_GETATTRFAIL); break; case IOC_E_DISABLE: @@ -412,22 +395,22 @@ bfa_ioc_sm_op(struct bfa_ioc_s *ioc, enum ioc_event event) break; case IOC_E_DISABLE: - bfa_ioc_hb_stop(ioc); + bfa_hb_timer_stop(ioc); bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); break; case IOC_E_FAILED: - bfa_ioc_hb_stop(ioc); + bfa_hb_timer_stop(ioc); bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); break; case IOC_E_HWERROR: - bfa_ioc_hb_stop(ioc); + bfa_hb_timer_stop(ioc); /* !!! fall through !!! */ case IOC_E_HBFAIL: bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); - bfa_iocpf_fail(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); break; default: @@ -440,7 +423,7 @@ static void bfa_ioc_sm_disabling_entry(struct bfa_ioc_s *ioc) { struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; - bfa_iocpf_disable(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC disabled\n"); } @@ -463,7 +446,7 @@ bfa_ioc_sm_disabling(struct bfa_ioc_s *ioc, enum ioc_event event) * after iocpf sm completes failure processing and * moves to disabled state. */ - bfa_iocpf_fail(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); break; default: @@ -496,7 +479,7 @@ bfa_ioc_sm_disabled(struct bfa_ioc_s *ioc, enum ioc_event event) case IOC_E_DETACH: bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); - bfa_iocpf_stop(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); break; default: @@ -537,7 +520,7 @@ bfa_ioc_sm_initfail(struct bfa_ioc_s *ioc, enum ioc_event event) case IOC_E_DETACH: bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); - bfa_iocpf_stop(ioc); + bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); break; default: @@ -668,19 +651,19 @@ bfa_iocpf_sm_fwcheck(struct bfa_iocpf_s *iocpf, enum iocpf_event event) iocpf->retry_count = 0; bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); } else { - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_mismatch); } break; case IOCPF_E_DISABLE: - bfa_ioc_hw_sem_get_cancel(ioc); + bfa_sem_timer_stop(ioc); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); - bfa_ioc_pf_disabled(ioc); + bfa_fsm_send_event(ioc, IOC_E_DISABLED); break; case IOCPF_E_STOP: - bfa_ioc_hw_sem_get_cancel(ioc); + bfa_sem_timer_stop(ioc); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); break; @@ -723,7 +706,7 @@ bfa_iocpf_sm_mismatch(struct bfa_iocpf_s *iocpf, enum iocpf_event event) case IOCPF_E_DISABLE: bfa_iocpf_timer_stop(ioc); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); - bfa_ioc_pf_disabled(ioc); + bfa_fsm_send_event(ioc, IOC_E_DISABLED); break; case IOCPF_E_STOP: @@ -762,7 +745,7 @@ bfa_iocpf_sm_semwait(struct bfa_iocpf_s *iocpf, enum iocpf_event event) break; case IOCPF_E_DISABLE: - bfa_ioc_hw_sem_get_cancel(ioc); + bfa_sem_timer_stop(ioc); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); break; @@ -776,7 +759,7 @@ static void bfa_iocpf_sm_hwinit_entry(struct bfa_iocpf_s *iocpf) { bfa_iocpf_timer_start(iocpf->ioc); - bfa_ioc_reset(iocpf->ioc, BFA_FALSE); + bfa_ioc_hwinit(iocpf->ioc, BFA_FALSE); } /* @@ -806,19 +789,19 @@ bfa_iocpf_sm_hwinit(struct bfa_iocpf_s *iocpf, enum iocpf_event event) iocpf->retry_count++; if (iocpf->retry_count < BFA_IOC_HWINIT_MAX) { bfa_iocpf_timer_start(ioc); - bfa_ioc_reset(ioc, BFA_TRUE); + bfa_ioc_hwinit(ioc, BFA_TRUE); break; } - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); if (event == IOCPF_E_TIMEOUT) - bfa_ioc_pf_failed(ioc); + bfa_fsm_send_event(ioc, IOC_E_FAILED); break; case IOCPF_E_DISABLE: - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); bfa_iocpf_timer_stop(ioc); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); break; @@ -850,7 +833,7 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) switch (event) { case IOCPF_E_FWRSP_ENABLE: bfa_iocpf_timer_stop(ioc); - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_ready); break; @@ -868,16 +851,16 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) break; } - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); if (event == IOCPF_E_TIMEOUT) - bfa_ioc_pf_failed(ioc); + bfa_fsm_send_event(ioc, IOC_E_FAILED); break; case IOCPF_E_DISABLE: bfa_iocpf_timer_stop(ioc); - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling); break; @@ -895,7 +878,7 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) static void bfa_iocpf_sm_ready_entry(struct bfa_iocpf_s *iocpf) { - bfa_ioc_pf_enabled(iocpf->ioc); + bfa_fsm_send_event(iocpf->ioc, IOC_E_ENABLED); } static void @@ -919,12 +902,12 @@ bfa_iocpf_sm_ready(struct bfa_iocpf_s *iocpf, enum iocpf_event event) break; case IOCPF_E_FWREADY: - if (bfa_ioc_is_operational(ioc)) + if (bfa_fsm_cmp_state(ioc, bfa_ioc_sm_op)) bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail); else bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); - bfa_ioc_pf_failed(ioc); + bfa_fsm_send_event(ioc, IOC_E_FAILED); break; default: @@ -982,7 +965,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) static void bfa_iocpf_sm_disabled_entry(struct bfa_iocpf_s *iocpf) { - bfa_ioc_pf_disabled(iocpf->ioc); + bfa_fsm_send_event(iocpf->ioc, IOC_E_DISABLED); } static void @@ -1140,11 +1123,6 @@ bfa_ioc_sem_get(void __iomem *sem_reg) return BFA_FALSE; } -void -bfa_ioc_sem_release(void __iomem *sem_reg) -{ - writel(1, sem_reg); -} static void bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc) @@ -1164,18 +1142,6 @@ bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc) bfa_sem_timer_start(ioc); } -void -bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc) -{ - writel(1, ioc->ioc_regs.ioc_sem_reg); -} - -static void -bfa_ioc_hw_sem_get_cancel(struct bfa_ioc_s *ioc) -{ - bfa_sem_timer_stop(ioc); -} - /* * Initialize LPU local memory (aka secondary memory / SRAM) */ @@ -1255,8 +1221,8 @@ bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) int i; u32 *fwsig = (u32 *) fwhdr; - pgnum = bfa_ioc_smem_pgnum(ioc, loff); - pgoff = bfa_ioc_smem_pgoff(ioc, loff); + pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); + pgoff = PSS_SMEM_PGOFF(loff); writel(pgnum, ioc->ioc_regs.host_page_num_fn); for (i = 0; i < (sizeof(struct bfi_ioc_image_hdr_s) / sizeof(u32)); @@ -1519,13 +1485,6 @@ bfa_ioc_hb_monitor(struct bfa_ioc_s *ioc) bfa_hb_timer_start(ioc); } -static void -bfa_ioc_hb_stop(struct bfa_ioc_s *ioc) -{ - bfa_hb_timer_stop(ioc); -} - - /* * Initiate a full firmware download. */ @@ -1547,8 +1506,8 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, bfa_trc(ioc, bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(ioc))); fwimg = bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), chunkno); - pgnum = bfa_ioc_smem_pgnum(ioc, loff); - pgoff = bfa_ioc_smem_pgoff(ioc, loff); + pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); + pgoff = PSS_SMEM_PGOFF(loff); writel(pgnum, ioc->ioc_regs.host_page_num_fn); @@ -1578,7 +1537,8 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, } } - writel(bfa_ioc_smem_pgnum(ioc, 0), ioc->ioc_regs.host_page_num_fn); + writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), + ioc->ioc_regs.host_page_num_fn); /* * Set boot type and boot param at the end. @@ -1589,11 +1549,6 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, swab32(boot_env)); } -static void -bfa_ioc_reset(struct bfa_ioc_s *ioc, bfa_boolean_t force) -{ - bfa_ioc_hwinit(ioc, force); -} /* * Update BFA configuration from firmware configuration. @@ -1685,8 +1640,8 @@ bfa_ioc_smem_read(struct bfa_ioc_s *ioc, void *tbuf, u32 soff, u32 sz) int i, len; u32 *buf = tbuf; - pgnum = bfa_ioc_smem_pgnum(ioc, soff); - loff = bfa_ioc_smem_pgoff(ioc, soff); + pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, soff); + loff = PSS_SMEM_PGOFF(soff); bfa_trc(ioc, pgnum); bfa_trc(ioc, loff); bfa_trc(ioc, sz); @@ -1717,11 +1672,12 @@ bfa_ioc_smem_read(struct bfa_ioc_s *ioc, void *tbuf, u32 soff, u32 sz) writel(pgnum, ioc->ioc_regs.host_page_num_fn); } } - writel(bfa_ioc_smem_pgnum(ioc, 0), ioc->ioc_regs.host_page_num_fn); + writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), + ioc->ioc_regs.host_page_num_fn); /* * release semaphore. */ - bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); + writel(1, ioc->ioc_regs.ioc_init_sem_reg); bfa_trc(ioc, pgnum); return BFA_STATUS_OK; @@ -1740,8 +1696,8 @@ bfa_ioc_smem_clr(struct bfa_ioc_s *ioc, u32 soff, u32 sz) int i, len; u32 pgnum, loff; - pgnum = bfa_ioc_smem_pgnum(ioc, soff); - loff = bfa_ioc_smem_pgoff(ioc, soff); + pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, soff); + loff = PSS_SMEM_PGOFF(soff); bfa_trc(ioc, pgnum); bfa_trc(ioc, loff); bfa_trc(ioc, sz); @@ -1771,36 +1727,17 @@ bfa_ioc_smem_clr(struct bfa_ioc_s *ioc, u32 soff, u32 sz) writel(pgnum, ioc->ioc_regs.host_page_num_fn); } } - writel(bfa_ioc_smem_pgnum(ioc, 0), ioc->ioc_regs.host_page_num_fn); + writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), + ioc->ioc_regs.host_page_num_fn); /* * release semaphore. */ - bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); + writel(1, ioc->ioc_regs.ioc_init_sem_reg); bfa_trc(ioc, pgnum); return BFA_STATUS_OK; } -/* - * hal iocpf to ioc interface - */ -static void -bfa_ioc_pf_enabled(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(ioc, IOC_E_ENABLED); -} - -static void -bfa_ioc_pf_disabled(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(ioc, IOC_E_DISABLED); -} - -static void -bfa_ioc_pf_failed(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(ioc, IOC_E_FAILED); -} static void bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc) @@ -1831,7 +1768,7 @@ bfa_ioc_pll_init(struct bfa_ioc_s *ioc) /* * release semaphore. */ - bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); + writel(1, ioc->ioc_regs.ioc_init_sem_reg); return BFA_STATUS_OK; } @@ -2036,15 +1973,6 @@ bfa_ioc_mem_claim(struct bfa_ioc_s *ioc, u8 *dm_kva, u64 dm_pa) ioc->attr = (struct bfi_ioc_attr_s *) dm_kva; } -/* - * Return size of dma memory required. - */ -u32 -bfa_ioc_meminfo(void) -{ - return BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); -} - void bfa_ioc_enable(struct bfa_ioc_s *ioc) { @@ -2061,18 +1989,6 @@ bfa_ioc_disable(struct bfa_ioc_s *ioc) bfa_fsm_send_event(ioc, IOC_E_DISABLE); } -/* - * Returns memory required for saving firmware trace in case of crash. - * Driver must call this interface to allocate memory required for - * automatic saving of firmware trace. Driver should call - * bfa_ioc_debug_memclaim() right after bfa_ioc_attach() to setup this - * trace memory. - */ -int -bfa_ioc_debug_trcsz(bfa_boolean_t auto_recover) -{ - return (auto_recover) ? BFA_DBG_FWTRC_LEN : 0; -} /* * Initialize memory for saving firmware trace. Driver must initialize @@ -2082,19 +1998,7 @@ void bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave) { ioc->dbg_fwsave = dbg_fwsave; - ioc->dbg_fwsave_len = bfa_ioc_debug_trcsz(ioc->iocpf.auto_recover); -} - -u32 -bfa_ioc_smem_pgnum(struct bfa_ioc_s *ioc, u32 fmaddr) -{ - return PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, fmaddr); -} - -u32 -bfa_ioc_smem_pgoff(struct bfa_ioc_s *ioc, u32 fmaddr) -{ - return PSS_SMEM_PGOFF(fmaddr); + ioc->dbg_fwsave_len = (ioc->iocpf.auto_recover) ? BFA_DBG_FWTRC_LEN : 0; } /* @@ -2257,17 +2161,6 @@ bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc) return BFA_TRUE; } -/* - * Add to IOC heartbeat failure notification queue. To be used by common - * modules such as cee, port, diag. - */ -void -bfa_ioc_hbfail_register(struct bfa_ioc_s *ioc, - struct bfa_ioc_hbfail_notify_s *notify) -{ - list_add_tail(¬ify->qe, &ioc->hb_notify_q); -} - #define BFA_MFG_NAME "Brocade" void bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, @@ -2299,7 +2192,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, else ad_attr->prototype = 0; - ad_attr->pwwn = bfa_ioc_get_pwwn(ioc); + ad_attr->pwwn = ioc->attr->pwwn; ad_attr->mac = bfa_ioc_get_mac(ioc); ad_attr->pcie_gen = ioc_attr->pcie_gen; @@ -2448,24 +2341,6 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); } -wwn_t -bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc) -{ - return ioc->attr->pwwn; -} - -wwn_t -bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc) -{ - return ioc->attr->nwwn; -} - -u64 -bfa_ioc_get_adid(struct bfa_ioc_s *ioc) -{ - return ioc->attr->mfg_pwwn; -} - mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc) { @@ -2478,18 +2353,6 @@ bfa_ioc_get_mac(struct bfa_ioc_s *ioc) return ioc->attr->mac; } -wwn_t -bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc) -{ - return ioc->attr->mfg_pwwn; -} - -wwn_t -bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc) -{ - return ioc->attr->mfg_nwwn; -} - mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc) { @@ -2718,43 +2581,6 @@ bfa_ioc_check_attr_wwns(struct bfa_ioc_s *ioc) /* * BFA IOC PF private functions */ - -static void -bfa_iocpf_enable(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_ENABLE); -} - -static void -bfa_iocpf_disable(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); -} - -static void -bfa_iocpf_fail(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); -} - -static void -bfa_iocpf_initfail(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); -} - -static void -bfa_iocpf_getattrfail(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_GETATTRFAIL); -} - -static void -bfa_iocpf_stop(struct bfa_ioc_s *ioc) -{ - bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); -} - static void bfa_iocpf_timeout(void *ioc_arg) { @@ -2775,12 +2601,6 @@ bfa_iocpf_sem_timeout(void *ioc_arg) /* * bfa timer function */ -void -bfa_timer_init(struct bfa_timer_mod_s *mod) -{ - INIT_LIST_HEAD(&mod->timer_q); -} - void bfa_timer_beat(struct bfa_timer_mod_s *mod) { diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index ff012f7f0757..3c5bdd1c0c7f 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h @@ -22,6 +22,11 @@ #include "bfa_cs.h" #include "bfi.h" +#define BFA_DBG_FWTRC_ENTS (BFI_IOC_TRC_ENTS) +#define BFA_DBG_FWTRC_LEN \ + (BFA_DBG_FWTRC_ENTS * sizeof(struct bfa_trc_s) + \ + (sizeof(struct bfa_trc_mod_s) - \ + BFA_TRC_MAX * sizeof(struct bfa_trc_s))) /* * BFA timer declarations */ @@ -47,7 +52,6 @@ struct bfa_timer_mod_s { #define BFA_TIMER_FREQ 200 /* specified in millisecs */ void bfa_timer_beat(struct bfa_timer_mod_s *mod); -void bfa_timer_init(struct bfa_timer_mod_s *mod); void bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer, bfa_timer_cbfn_t timercb, void *arg, unsigned int timeout); @@ -325,7 +329,6 @@ void bfa_ioc_auto_recover(bfa_boolean_t auto_recover); void bfa_ioc_detach(struct bfa_ioc_s *ioc); void bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, enum bfi_mclass mc); -u32 bfa_ioc_meminfo(void); void bfa_ioc_mem_claim(struct bfa_ioc_s *ioc, u8 *dm_kva, u64 dm_pa); void bfa_ioc_enable(struct bfa_ioc_s *ioc); void bfa_ioc_disable(struct bfa_ioc_s *ioc); @@ -353,7 +356,6 @@ enum bfa_ioc_state bfa_ioc_get_state(struct bfa_ioc_s *ioc); void bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr); void bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, struct bfa_adapter_attr_s *ad_attr); -int bfa_ioc_debug_trcsz(bfa_boolean_t auto_recover); void bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave); bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, int *trclen); @@ -361,15 +363,9 @@ bfa_status_t bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, int *trclen); bfa_status_t bfa_ioc_debug_fwcore(struct bfa_ioc_s *ioc, void *buf, u32 *offset, int *buflen); -u32 bfa_ioc_smem_pgnum(struct bfa_ioc_s *ioc, u32 fmaddr); -u32 bfa_ioc_smem_pgoff(struct bfa_ioc_s *ioc, u32 fmaddr); void bfa_ioc_set_fcmode(struct bfa_ioc_s *ioc); bfa_boolean_t bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc); -void bfa_ioc_hbfail_register(struct bfa_ioc_s *ioc, - struct bfa_ioc_hbfail_notify_s *notify); bfa_boolean_t bfa_ioc_sem_get(void __iomem *sem_reg); -void bfa_ioc_sem_release(void __iomem *sem_reg); -void bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc); void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr); bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, @@ -380,13 +376,8 @@ bfa_status_t bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc); /* * bfa mfg wwn API functions */ -wwn_t bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc); -wwn_t bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc); mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc); -wwn_t bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc); -wwn_t bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc); mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc); -u64 bfa_ioc_get_adid(struct bfa_ioc_s *ioc); /* * F/W Image Size & Chunk diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c index 61f03cbe5431..e9c8554e356e 100644 --- a/drivers/scsi/bfa/bfa_ioc_cb.c +++ b/drivers/scsi/bfa/bfa_ioc_cb.c @@ -181,7 +181,7 @@ bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc) * will lock it instead of clearing it. */ readl(ioc->ioc_regs.ioc_sem_reg); - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); } diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 79fb31203636..45d0ddc88c52 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c @@ -83,7 +83,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) */ if (usecnt == 0) { writel(1, ioc->ioc_regs.ioc_usage_reg); - bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); + writel(1, ioc->ioc_regs.ioc_usage_sem_reg); bfa_trc(ioc, usecnt); return BFA_TRUE; } @@ -101,7 +101,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) */ bfa_ioc_fwver_get(ioc, &fwhdr); if (!bfa_ioc_fwver_cmp(ioc, &fwhdr)) { - bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); + writel(1, ioc->ioc_regs.ioc_usage_sem_reg); bfa_trc(ioc, usecnt); return BFA_FALSE; } @@ -111,7 +111,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) */ usecnt++; writel(usecnt, ioc->ioc_regs.ioc_usage_reg); - bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); + writel(1, ioc->ioc_regs.ioc_usage_sem_reg); bfa_trc(ioc, usecnt); return BFA_TRUE; } @@ -145,7 +145,7 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) writel(usecnt, ioc->ioc_regs.ioc_usage_reg); bfa_trc(ioc, usecnt); - bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); + writel(1, ioc->ioc_regs.ioc_usage_sem_reg); } /* @@ -313,7 +313,7 @@ bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc) if (ioc->cna) { bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); writel(0, ioc->ioc_regs.ioc_usage_reg); - bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); + writel(1, ioc->ioc_regs.ioc_usage_sem_reg); } /* @@ -322,7 +322,7 @@ bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc) * will lock it instead of clearing it. */ readl(ioc->ioc_regs.ioc_sem_reg); - bfa_ioc_hw_sem_release(ioc); + writel(1, ioc->ioc_regs.ioc_sem_reg); } diff --git a/drivers/scsi/bfa/bfa_plog.h b/drivers/scsi/bfa/bfa_plog.h index bdcd8ecd4f4a..1c9baa68339b 100644 --- a/drivers/scsi/bfa/bfa_plog.h +++ b/drivers/scsi/bfa/bfa_plog.h @@ -151,6 +151,5 @@ void bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid, void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid, enum bfa_plog_eid event, u16 misc, struct fchs_s *fchdr, u32 pld_w0); -bfa_boolean_t bfa_plog_get_setting(struct bfa_plog_s *plog); #endif /* __BFA_PORTLOG_H__ */ diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c index fa57b128b3d8..76efb9a5c324 100644 --- a/drivers/scsi/bfa/bfa_port.c +++ b/drivers/scsi/bfa/bfa_port.c @@ -447,7 +447,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, bfa_ioc_mbox_regisr(port->ioc, BFI_MC_PORT, bfa_port_isr, port); bfa_ioc_hbfail_init(&port->hbfail, bfa_port_hbfail, port); - bfa_ioc_hbfail_register(port->ioc, &port->hbfail); + list_add_tail(&port->hbfail.qe, &port->ioc->hb_notify_q); /* * initialize time stamp for stats reset diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index 3a2bee4d42dd..c9192869c0fe 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c @@ -41,19 +41,6 @@ BFA_MODULE(uf); #define BFA_LPS_MAX_VPORTS_SUPP_CB 255 #define BFA_LPS_MAX_VPORTS_SUPP_CT 190 -/* - * lps_pvt BFA LPS private functions - */ - -enum bfa_lps_event { - BFA_LPS_SM_LOGIN = 1, /* login request from user */ - BFA_LPS_SM_LOGOUT = 2, /* logout request from user */ - BFA_LPS_SM_FWRSP = 3, /* f/w response to login/logout */ - BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ - BFA_LPS_SM_DELETE = 5, /* lps delete from user */ - BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ - BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */ -}; /* * FC PORT related definitions @@ -113,19 +100,6 @@ enum bfa_fcport_ln_sm_event { } \ } while (0) - -enum bfa_rport_event { - BFA_RPORT_SM_CREATE = 1, /* rport create event */ - BFA_RPORT_SM_DELETE = 2, /* deleting an existing rport */ - BFA_RPORT_SM_ONLINE = 3, /* rport is online */ - BFA_RPORT_SM_OFFLINE = 4, /* rport is offline */ - BFA_RPORT_SM_FWRSP = 5, /* firmware response */ - BFA_RPORT_SM_HWFAIL = 6, /* IOC h/w failure */ - BFA_RPORT_SM_QOS_SCN = 7, /* QoS SCN from firmware */ - BFA_RPORT_SM_SET_SPEED = 8, /* Set Rport Speed */ - BFA_RPORT_SM_QRESUME = 9, /* space in requeue queue */ -}; - /* * forward declarations FCXP related functions */ @@ -438,12 +412,6 @@ bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid, } -bfa_boolean_t -bfa_plog_get_setting(struct bfa_plog_s *plog) -{ - return (bfa_boolean_t)plog->plog_enabled; -} - /* * fcxp_pvt BFA FCXP private functions */ @@ -1846,24 +1814,6 @@ bfa_lps_fdisclogo(struct bfa_lps_s *lps) bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); } -/* - * Discard a pending login request -- should be called only for - * link down handling. - */ -void -bfa_lps_discard(struct bfa_lps_s *lps) -{ - bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE); -} - -/* - * Return lport services tag - */ -u8 -bfa_lps_get_tag(struct bfa_lps_s *lps) -{ - return lps->lp_tag; -} /* * Return lport services tag given the pid @@ -1884,55 +1834,6 @@ bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid) return 0; } -/* - * return if fabric login indicates support for NPIV - */ -bfa_boolean_t -bfa_lps_is_npiv_en(struct bfa_lps_s *lps) -{ - return lps->npiv_en; -} - -/* - * Return TRUE if attached to F-Port, else return FALSE - */ -bfa_boolean_t -bfa_lps_is_fport(struct bfa_lps_s *lps) -{ - return lps->fport; -} - -/* - * Return TRUE if attached to a Brocade Fabric - */ -bfa_boolean_t -bfa_lps_is_brcd_fabric(struct bfa_lps_s *lps) -{ - return lps->brcd_switch; -} -/* - * return TRUE if authentication is required - */ -bfa_boolean_t -bfa_lps_is_authreq(struct bfa_lps_s *lps) -{ - return lps->auth_req; -} - -bfa_eproto_status_t -bfa_lps_get_extstatus(struct bfa_lps_s *lps) -{ - return lps->ext_status; -} - -/* - * return port id assigned to the lport - */ -u32 -bfa_lps_get_pid(struct bfa_lps_s *lps) -{ - return lps->lp_pid; -} /* * return port id assigned to the base lport @@ -1945,60 +1846,6 @@ bfa_lps_get_base_pid(struct bfa_s *bfa) return BFA_LPS_FROM_TAG(mod, 0)->lp_pid; } -/* - * Return bb_credit assigned in FLOGI response - */ -u16 -bfa_lps_get_peer_bbcredit(struct bfa_lps_s *lps) -{ - return lps->pr_bbcred; -} - -/* - * Return peer port name - */ -wwn_t -bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps) -{ - return lps->pr_pwwn; -} - -/* - * Return peer node name - */ -wwn_t -bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps) -{ - return lps->pr_nwwn; -} - -/* - * return reason code if login request is rejected - */ -u8 -bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps) -{ - return lps->lsrjt_rsn; -} - -/* - * return explanation code if login request is rejected - */ -u8 -bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps) -{ - return lps->lsrjt_expl; -} - -/* - * Return fpma/spma MAC for lport - */ -mac_t -bfa_lps_get_lp_mac(struct bfa_lps_s *lps) -{ - return lps->lp_mac; -} - /* * LPS firmware message class handler. */ @@ -3064,8 +2911,8 @@ bfa_fcport_send_disable(struct bfa_fcport_s *fcport) static void bfa_fcport_set_wwns(struct bfa_fcport_s *fcport) { - fcport->pwwn = bfa_ioc_get_pwwn(&fcport->bfa->ioc); - fcport->nwwn = bfa_ioc_get_nwwn(&fcport->bfa->ioc); + fcport->pwwn = fcport->bfa->ioc.attr->pwwn; + fcport->nwwn = fcport->bfa->ioc.attr->nwwn; bfa_trc(fcport->bfa, fcport->pwwn); bfa_trc(fcport->bfa, fcport->nwwn); @@ -3707,8 +3554,8 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr) attr->nwwn = fcport->nwwn; attr->pwwn = fcport->pwwn; - attr->factorypwwn = bfa_ioc_get_mfg_pwwn(&bfa->ioc); - attr->factorynwwn = bfa_ioc_get_mfg_nwwn(&bfa->ioc); + attr->factorypwwn = bfa->ioc.attr->mfg_pwwn; + attr->factorynwwn = bfa->ioc.attr->mfg_nwwn; memcpy(&attr->pport_cfg, &fcport->cfg, sizeof(struct bfa_port_cfg_s)); @@ -3726,7 +3573,7 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr) /* beacon attributes */ attr->beacon = fcport->beacon; attr->link_e2e_beacon = fcport->link_e2e_beacon; - attr->plog_enabled = bfa_plog_get_setting(fcport->bfa->plog); + attr->plog_enabled = (bfa_boolean_t)fcport->bfa->plog->plog_enabled; attr->io_profile = bfa_fcpim_get_io_profile(fcport->bfa); attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); @@ -4584,7 +4431,7 @@ bfa_rport_create(struct bfa_s *bfa, void *rport_drv) rp->bfa = bfa; rp->rport_drv = rport_drv; - bfa_rport_clear_stats(rp); + memset(&rp->stats, 0, sizeof(rp->stats)); bfa_assert(bfa_sm_cmp_state(rp, bfa_rport_sm_uninit)); bfa_sm_send_event(rp, BFA_RPORT_SM_CREATE); @@ -4592,12 +4439,6 @@ bfa_rport_create(struct bfa_s *bfa, void *rport_drv) return rp; } -void -bfa_rport_delete(struct bfa_rport_s *rport) -{ - bfa_sm_send_event(rport, BFA_RPORT_SM_DELETE); -} - void bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info) { @@ -4616,12 +4457,6 @@ bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info) bfa_sm_send_event(rport, BFA_RPORT_SM_ONLINE); } -void -bfa_rport_offline(struct bfa_rport_s *rport) -{ - bfa_sm_send_event(rport, BFA_RPORT_SM_OFFLINE); -} - void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed) { @@ -4632,12 +4467,6 @@ bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed) bfa_sm_send_event(rport, BFA_RPORT_SM_SET_SPEED); } -void -bfa_rport_clear_stats(struct bfa_rport_s *rport) -{ - memset(&rport->stats, 0, sizeof(rport->stats)); -} - /* * SGPG related functions @@ -5101,8 +4930,6 @@ bfa_uf_start(struct bfa_s *bfa) bfa_uf_post_all(BFA_UF_MOD(bfa)); } - - /* * hal_uf_api */ diff --git a/drivers/scsi/bfa/bfa_svc.h b/drivers/scsi/bfa/bfa_svc.h index 0e23c1bfcba0..29b091826e9b 100644 --- a/drivers/scsi/bfa/bfa_svc.h +++ b/drivers/scsi/bfa/bfa_svc.h @@ -220,6 +220,18 @@ void bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); /* * RPORT related defines */ +enum bfa_rport_event { + BFA_RPORT_SM_CREATE = 1, /* rport create event */ + BFA_RPORT_SM_DELETE = 2, /* deleting an existing rport */ + BFA_RPORT_SM_ONLINE = 3, /* rport is online */ + BFA_RPORT_SM_OFFLINE = 4, /* rport is offline */ + BFA_RPORT_SM_FWRSP = 5, /* firmware response */ + BFA_RPORT_SM_HWFAIL = 6, /* IOC h/w failure */ + BFA_RPORT_SM_QOS_SCN = 7, /* QoS SCN from firmware */ + BFA_RPORT_SM_SET_SPEED = 8, /* Set Rport Speed */ + BFA_RPORT_SM_QRESUME = 9, /* space in requeue queue */ +}; + #define BFA_RPORT_MIN 4 struct bfa_rport_mod_s { @@ -516,12 +528,9 @@ bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa); * bfa rport API functions */ struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv); -void bfa_rport_delete(struct bfa_rport_s *rport); void bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info); -void bfa_rport_offline(struct bfa_rport_s *rport); void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed); -void bfa_rport_clear_stats(struct bfa_rport_s *rport); void bfa_cb_rport_online(void *rport); void bfa_cb_rport_offline(void *rport); void bfa_cb_rport_qos_scn_flowid(void *rport, @@ -594,28 +603,14 @@ void bfa_uf_free(struct bfa_uf_s *uf); u32 bfa_lps_get_max_vport(struct bfa_s *bfa); struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa); void bfa_lps_delete(struct bfa_lps_s *lps); -void bfa_lps_discard(struct bfa_lps_s *lps); void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, u16 pdusz, wwn_t pwwn, wwn_t nwwn, bfa_boolean_t auth_en); void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, wwn_t pwwn, wwn_t nwwn); void bfa_lps_fdisclogo(struct bfa_lps_s *lps); -u8 bfa_lps_get_tag(struct bfa_lps_s *lps); -bfa_boolean_t bfa_lps_is_npiv_en(struct bfa_lps_s *lps); -bfa_boolean_t bfa_lps_is_fport(struct bfa_lps_s *lps); -bfa_boolean_t bfa_lps_is_brcd_fabric(struct bfa_lps_s *lps); -bfa_boolean_t bfa_lps_is_authreq(struct bfa_lps_s *lps); -bfa_eproto_status_t bfa_lps_get_extstatus(struct bfa_lps_s *lps); -u32 bfa_lps_get_pid(struct bfa_lps_s *lps); u32 bfa_lps_get_base_pid(struct bfa_s *bfa); u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid); -u16 bfa_lps_get_peer_bbcredit(struct bfa_lps_s *lps); -wwn_t bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps); -wwn_t bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps); -u8 bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps); -u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps); -mac_t bfa_lps_get_lp_mac(struct bfa_lps_s *lps); void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status); void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status); void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg); diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 4239fdf0d2d1..2bc786212521 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -206,7 +206,7 @@ bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event) } spin_lock_irqsave(&bfad->bfad_lock, flags); - bfa_init(&bfad->bfa); + bfa_iocfc_init(&bfad->bfa); spin_unlock_irqrestore(&bfad->bfad_lock, flags); /* Set up interrupt handler for each vectors */ @@ -725,7 +725,7 @@ bfad_bfa_tmo(unsigned long data) spin_lock_irqsave(&bfad->bfad_lock, flags); - bfa_timer_tick(&bfad->bfa); + bfa_timer_beat(&bfad->bfa.timer_mod); bfa_comp_deq(&bfad->bfa, &doneq); spin_unlock_irqrestore(&bfad->bfad_lock, flags); @@ -882,8 +882,8 @@ bfad_drv_init(struct bfad_s *bfad) goto out_hal_mem_alloc_failure; } - bfa_init_trc(&bfad->bfa, bfad->trcmod); - bfa_init_plog(&bfad->bfa, &bfad->plog_buf); + bfad->bfa.trcmod = bfad->trcmod; + bfad->bfa.plog = &bfad->plog_buf; bfa_plog_init(&bfad->plog_buf); bfa_plog_str(&bfad->plog_buf, BFA_PL_MID_DRVR, BFA_PL_EID_DRIVER_START, 0, "Driver Attach"); @@ -893,9 +893,9 @@ bfad_drv_init(struct bfad_s *bfad) /* FCS INIT */ spin_lock_irqsave(&bfad->bfad_lock, flags); - bfa_fcs_trc_init(&bfad->bfa_fcs, bfad->trcmod); + bfad->bfa_fcs.trcmod = bfad->trcmod; bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE); - bfa_fcs_set_fdmi_param(&bfad->bfa_fcs, fdmi_enable); + bfad->bfa_fcs.fdmi_enabled = fdmi_enable; spin_unlock_irqrestore(&bfad->bfad_lock, flags); bfad->bfad_flags |= BFAD_DRV_INIT_DONE; @@ -913,7 +913,7 @@ bfad_drv_uninit(struct bfad_s *bfad) spin_lock_irqsave(&bfad->bfad_lock, flags); init_completion(&bfad->comp); - bfa_stop(&bfad->bfa); + bfa_iocfc_stop(&bfad->bfa); spin_unlock_irqrestore(&bfad->bfad_lock, flags); wait_for_completion(&bfad->comp); @@ -932,8 +932,8 @@ bfad_drv_start(struct bfad_s *bfad) unsigned long flags; spin_lock_irqsave(&bfad->bfad_lock, flags); - bfa_start(&bfad->bfa); - bfa_fcs_start(&bfad->bfa_fcs); + bfa_iocfc_start(&bfad->bfa); + bfa_fcs_fabric_modstart(&bfad->bfa_fcs); bfad->bfad_flags |= BFAD_HAL_START_DONE; spin_unlock_irqrestore(&bfad->bfad_lock, flags); @@ -963,7 +963,7 @@ bfad_stop(struct bfad_s *bfad) spin_lock_irqsave(&bfad->bfad_lock, flags); init_completion(&bfad->comp); - bfa_stop(&bfad->bfa); + bfa_iocfc_stop(&bfad->bfa); bfad->bfad_flags &= ~BFAD_HAL_START_DONE; spin_unlock_irqrestore(&bfad->bfad_lock, flags); wait_for_completion(&bfad->comp); @@ -1524,7 +1524,7 @@ bfad_init(void) if (strcmp(FCPI_NAME, " fcpim") == 0) supported_fc4s |= BFA_LPORT_ROLE_FCP_IM; - bfa_ioc_auto_recover(ioc_auto_recover); + bfa_auto_recover = ioc_auto_recover; bfa_fcs_rport_set_del_timeout(rport_del_timeout); error = pci_register_driver(&bfad_pci_driver); diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index 0fbd620474c7..c66e32eced7b 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c @@ -90,7 +90,7 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file) memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); spin_lock_irqsave(&bfad->bfad_lock, flags); - rc = bfa_debug_fwtrc(&bfad->bfa, + rc = bfa_ioc_debug_fwtrc(&bfad->bfa.ioc, fw_debug->debug_buffer, &fw_debug->buffer_len); spin_unlock_irqrestore(&bfad->bfad_lock, flags); @@ -134,7 +134,7 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file) memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); spin_lock_irqsave(&bfad->bfad_lock, flags); - rc = bfa_debug_fwsave(&bfad->bfa, + rc = bfa_ioc_debug_fwsave(&bfad->bfa.ioc, fw_debug->debug_buffer, &fw_debug->buffer_len); spin_unlock_irqrestore(&bfad->bfad_lock, flags); diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index fbad5e9b2402..bcab8912dd59 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -922,7 +922,7 @@ bfad_im_supported_speeds(struct bfa_s *bfa) if (!ioc_attr) return 0; - bfa_get_attr(bfa, ioc_attr); + bfa_ioc_get_attr(&bfa->ioc, ioc_attr); if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) { if (ioc_attr->adapter_attr.is_mezz) { supported_speed |= FC_PORTSPEED_8GBIT | -- cgit v1.2.3 From f314878ab95d4802ddde066096f7b30087cea7ba Mon Sep 17 00:00:00 2001 From: Maggie Zhang Date: Thu, 9 Dec 2010 19:11:39 -0800 Subject: [SCSI] bfa: remove all SCSI IO callbacks Remove SCSI IO callbacks, and as a result remove bfa_cb_ioim.h. Signed-off-by: Maggie Zhang Signed-off-by: Jing Huang Signed-off-by: James Bottomley --- drivers/scsi/bfa/bfa_cb_ioim.h | 169 ----------------------------------------- drivers/scsi/bfa/bfa_defs.h | 4 +- drivers/scsi/bfa/bfa_fc.h | 5 +- drivers/scsi/bfa/bfa_fcpim.c | 53 ++++++++----- drivers/scsi/bfa/bfa_fcpim.h | 8 +- drivers/scsi/bfa/bfad_im.c | 10 ++- drivers/scsi/bfa/bfi.h | 2 +- drivers/scsi/bfa/bfi_ms.h | 2 +- 8 files changed, 49 insertions(+), 204 deletions(-) delete mode 100644 drivers/scsi/bfa/bfa_cb_ioim.h (limited to 'drivers/scsi/bfa/bfad_im.c') diff --git a/drivers/scsi/bfa/bfa_cb_ioim.h b/drivers/scsi/bfa/bfa_cb_ioim.h deleted file mode 100644 index afb573878e20..000000000000 --- a/drivers/scsi/bfa/bfa_cb_ioim.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. - * All rights reserved - * www.brocade.com - * - * Linux driver for Brocade Fibre Channel Host Bus Adapter. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License (GPL) Version 2 as - * published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - */ - -#ifndef __BFA_HCB_IOIM_H__ -#define __BFA_HCB_IOIM_H__ - -#include "bfa_os_inc.h" -/* - * task attribute values in FCP-2 FCP_CMND IU - */ -#define SIMPLE_Q 0 -#define HEAD_OF_Q 1 -#define ORDERED_Q 2 -#define ACA_Q 4 -#define UNTAGGED 5 - -static inline lun_t -bfad_int_to_lun(u32 luno) -{ - union { - __be16 scsi_lun[4]; - lun_t bfa_lun; - } lun; - - lun.bfa_lun = 0; - lun.scsi_lun[0] = cpu_to_be16(luno); - - return lun.bfa_lun; -} - -/* - * Get LUN for the I/O request - */ -#define bfa_cb_ioim_get_lun(__dio) \ - bfad_int_to_lun(((struct scsi_cmnd *)__dio)->device->lun) - -/* - * Get CDB for the I/O request - */ -static inline u8 * -bfa_cb_ioim_get_cdb(struct bfad_ioim_s *dio) -{ - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; - - return (u8 *) cmnd->cmnd; -} - -/* - * Get I/O direction (read/write) for the I/O request - */ -static inline enum fcp_iodir -bfa_cb_ioim_get_iodir(struct bfad_ioim_s *dio) -{ - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; - enum dma_data_direction dmadir; - - dmadir = cmnd->sc_data_direction; - if (dmadir == DMA_TO_DEVICE) - return FCP_IODIR_WRITE; - else if (dmadir == DMA_FROM_DEVICE) - return FCP_IODIR_READ; - else - return FCP_IODIR_NONE; -} - -/* - * Get IO size in bytes for the I/O request - */ -static inline u32 -bfa_cb_ioim_get_size(struct bfad_ioim_s *dio) -{ - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; - - return scsi_bufflen(cmnd); -} - -/* - * Get timeout for the I/O request - */ -static inline u8 -bfa_cb_ioim_get_timeout(struct bfad_ioim_s *dio) -{ - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; - /* - * TBD: need a timeout for scsi passthru - */ - if (cmnd->device->host == NULL) - return 4; - - return 0; -} - -/* - * Get Command Reference Number for the I/O request. 0 if none. - */ -static inline u8 -bfa_cb_ioim_get_crn(struct bfad_ioim_s *dio) -{ - return 0; -} - -/* - * Get SAM-3 priority for the I/O request. 0 is default. - */ -static inline u8 -bfa_cb_ioim_get_priority(struct bfad_ioim_s *dio) -{ - return 0; -} - -/* - * Get task attributes for the I/O request. Default is FCP_TASK_ATTR_SIMPLE(0). - */ -static inline u8 -bfa_cb_ioim_get_taskattr(struct bfad_ioim_s *dio) -{ - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; - u8 task_attr = UNTAGGED; - - if (cmnd->device->tagged_supported) { - switch (cmnd->tag) { - case HEAD_OF_QUEUE_TAG: - task_attr = HEAD_OF_Q; - break; - case ORDERED_QUEUE_TAG: - task_attr = ORDERED_Q; - break; - default: - task_attr = SIMPLE_Q; - break; - } - } - - return task_attr; -} - -/* - * Get CDB length in bytes for the I/O request. Default is FCP_CMND_CDB_LEN(16). - */ -static inline u8 -bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio) -{ - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; - - return cmnd->cmd_len; -} - -/* - * Assign queue to be used for the I/O request. This value depends on whether - * the driver wants to use the queues via any specific algorithm. Currently, - * this is not supported. - */ -#define bfa_cb_ioim_get_reqq(__dio) BFA_FALSE - -#endif /* __BFA_HCB_IOIM_H__ */ diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h index 4b5b9e35abb9..07b57c4208c1 100644 --- a/drivers/scsi/bfa/bfa_defs.h +++ b/drivers/scsi/bfa/bfa_defs.h @@ -446,8 +446,8 @@ enum bfa_boot_bootopt { * Boot lun information. */ struct bfa_boot_bootlun_s { - wwn_t pwwn; /* port wwn of target */ - lun_t lun; /* 64-bit lun */ + wwn_t pwwn; /* port wwn of target */ + struct scsi_lun lun; /* 64-bit lun */ }; #pragma pack() diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h index ce5274a017fa..104a17f70b55 100644 --- a/drivers/scsi/bfa/bfa_fc.h +++ b/drivers/scsi/bfa/bfa_fc.h @@ -21,7 +21,6 @@ #include "bfa_os_inc.h" typedef u64 wwn_t; -typedef u64 lun_t; #define WWN_NULL (0) #define FC_SYMNAME_MAX 256 /* max name server symbolic name size */ @@ -1176,8 +1175,8 @@ struct fc_srr_s { #define FCP_CMND_LUN_LEN 8 struct fcp_cmnd_s { - lun_t lun; /* 64-bit LU number */ - u8 crn; /* command reference number */ + struct scsi_lun lun; /* 64-bit LU number */ + u8 crn; /* command reference number */ #ifdef __BIGENDIAN u8 resvd:1, priority:4, /* FCP-3: SAM-3 priority */ diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index c07ee42345bc..455c4f4e1d3b 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -16,7 +16,7 @@ */ #include "bfa_modules.h" -#include "bfa_cb_ioim.h" +#include "bfa_os_inc.h" BFA_TRC_FILE(HAL, FCPIM); BFA_MODULE(fcpim); @@ -263,7 +263,7 @@ static void bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, static void __bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete); static void __bfa_cb_tskim_failed(void *cbarg, bfa_boolean_t complete); static bfa_boolean_t bfa_tskim_match_scope(struct bfa_tskim_s *tskim, - lun_t lun); + struct scsi_lun lun); static void bfa_tskim_gather_ios(struct bfa_tskim_s *tskim); static void bfa_tskim_cleanp_comp(void *tskim_cbarg); static void bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim); @@ -2315,7 +2315,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) { struct bfa_itnim_s *itnim = ioim->itnim; struct bfi_ioim_req_s *m; - static struct fcp_cmnd_s cmnd_z0 = { 0 }; + static struct fcp_cmnd_s cmnd_z0 = {{{0}}}; struct bfi_sge_s *sge, *sgpge; u32 pgdlen = 0; u32 fcp_dl; @@ -2324,6 +2324,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) struct bfa_sgpg_s *sgpg; struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; u32 i, sge_id, pgcumsz; + enum dma_data_direction dmadir; /* * check for room in queue to send request now @@ -2341,7 +2342,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) */ m->io_tag = cpu_to_be16(ioim->iotag); m->rport_hdl = ioim->itnim->rport->fw_handle; - m->io_timeout = bfa_cb_ioim_get_timeout(ioim->dio); + m->io_timeout = 0; sge = &m->sges[0]; sgpg = ioim->sgpg; @@ -2412,10 +2413,17 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) * set up I/O command parameters */ m->cmnd = cmnd_z0; - m->cmnd.lun = bfa_cb_ioim_get_lun(ioim->dio); - m->cmnd.iodir = bfa_cb_ioim_get_iodir(ioim->dio); - m->cmnd.cdb = *(scsi_cdb_t *)bfa_cb_ioim_get_cdb(ioim->dio); - fcp_dl = bfa_cb_ioim_get_size(ioim->dio); + int_to_scsilun(cmnd->device->lun, &m->cmnd.lun); + dmadir = cmnd->sc_data_direction; + if (dmadir == DMA_TO_DEVICE) + m->cmnd.iodir = FCP_IODIR_WRITE; + else if (dmadir == DMA_FROM_DEVICE) + m->cmnd.iodir = FCP_IODIR_READ; + else + m->cmnd.iodir = FCP_IODIR_NONE; + + m->cmnd.cdb = *(scsi_cdb_t *) cmnd->cmnd; + fcp_dl = scsi_bufflen(cmnd); m->cmnd.fcp_dl = cpu_to_be32(fcp_dl); /* @@ -2439,7 +2447,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); } if (itnim->seq_rec || - (bfa_cb_ioim_get_size(ioim->dio) & (sizeof(u32) - 1))) + (scsi_bufflen(cmnd) & (sizeof(u32) - 1))) bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); /* @@ -2769,7 +2777,8 @@ bfa_ioim_profile_start(struct bfa_ioim_s *ioim) void bfa_ioim_profile_comp(struct bfa_ioim_s *ioim) { - u32 fcp_dl = bfa_cb_ioim_get_size(ioim->dio); + struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; + u32 fcp_dl = scsi_bufflen(cmnd); u32 index = bfa_ioim_get_index(fcp_dl); u64 end_time = jiffies; struct bfa_itnim_latency_s *io_lat = @@ -2895,8 +2904,7 @@ bfa_ioim_start(struct bfa_ioim_s *ioim) * Obtain the queue over which this request has to be issued */ ioim->reqq = bfa_fcpim_ioredirect_enabled(ioim->bfa) ? - bfa_cb_ioim_get_reqq(ioim->dio) : - bfa_itnim_get_reqq(ioim); + BFA_FALSE : bfa_itnim_get_reqq(ioim); bfa_sm_send_event(ioim, BFA_IOIM_SM_START); } @@ -3186,7 +3194,7 @@ __bfa_cb_tskim_failed(void *cbarg, bfa_boolean_t complete) } static bfa_boolean_t -bfa_tskim_match_scope(struct bfa_tskim_s *tskim, lun_t lun) +bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun) { switch (tskim->tm_cmnd) { case FCP_TM_TARGET_RESET: @@ -3196,7 +3204,7 @@ bfa_tskim_match_scope(struct bfa_tskim_s *tskim, lun_t lun) case FCP_TM_CLEAR_TASK_SET: case FCP_TM_LUN_RESET: case FCP_TM_CLEAR_ACA: - return (tskim->lun == lun); + return (!memcmp(&tskim->lun, &lun, sizeof(lun))); default: bfa_assert(0); @@ -3213,7 +3221,9 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) { struct bfa_itnim_s *itnim = tskim->itnim; struct bfa_ioim_s *ioim; - struct list_head *qe, *qen; + struct list_head *qe, *qen; + struct scsi_cmnd *cmnd; + struct scsi_lun scsilun; INIT_LIST_HEAD(&tskim->io_q); @@ -3222,8 +3232,9 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) */ list_for_each_safe(qe, qen, &itnim->io_q) { ioim = (struct bfa_ioim_s *) qe; - if (bfa_tskim_match_scope - (tskim, bfa_cb_ioim_get_lun(ioim->dio))) { + cmnd = (struct scsi_cmnd *) ioim->dio; + int_to_scsilun(cmnd->device->lun, &scsilun); + if (bfa_tskim_match_scope(tskim, scsilun)) { list_del(&ioim->qe); list_add_tail(&ioim->qe, &tskim->io_q); } @@ -3234,8 +3245,9 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) */ list_for_each_safe(qe, qen, &itnim->pending_q) { ioim = (struct bfa_ioim_s *) qe; - if (bfa_tskim_match_scope - (tskim, bfa_cb_ioim_get_lun(ioim->dio))) { + cmnd = (struct scsi_cmnd *) ioim->dio; + int_to_scsilun(cmnd->device->lun, &scsilun); + if (bfa_tskim_match_scope(tskim, scsilun)) { list_del(&ioim->qe); list_add_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); bfa_ioim_tov(ioim); @@ -3494,7 +3506,8 @@ bfa_tskim_free(struct bfa_tskim_s *tskim) * @return None. */ void -bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, lun_t lun, +bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, + struct scsi_lun lun, enum fcp_tm_cmnd tm_cmnd, u8 tsecs) { tskim->itnim = itnim; diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h index 18bdc44432ac..7d0eababa5df 100644 --- a/drivers/scsi/bfa/bfa_fcpim.h +++ b/drivers/scsi/bfa/bfa_fcpim.h @@ -146,9 +146,9 @@ struct bfa_tskim_s { struct bfa_s *bfa; /* BFA module */ struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ - struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ - bfa_boolean_t notify; /* notify itnim on TM comp */ - lun_t lun; /* lun if applicable */ + struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ + bfa_boolean_t notify; /* notify itnim on TM comp */ + struct scsi_lun lun; /* lun if applicable */ enum fcp_tm_cmnd tm_cmnd; /* task management command */ u16 tsk_tag; /* FWI IO tag */ u8 tsecs; /* timeout in seconds */ @@ -389,7 +389,7 @@ struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa, struct bfad_tskim_s *dtsk); void bfa_tskim_free(struct bfa_tskim_s *tskim); void bfa_tskim_start(struct bfa_tskim_s *tskim, - struct bfa_itnim_s *itnim, lun_t lun, + struct bfa_itnim_s *itnim, struct scsi_lun lun, enum fcp_tm_cmnd tm, u8 t_secs); void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, enum bfi_tskim_status tsk_status); diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index bcab8912dd59..d10adcbf24b3 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -21,7 +21,6 @@ #include "bfad_drv.h" #include "bfad_im.h" -#include "bfa_cb_ioim.h" #include "bfa_fcs.h" BFA_TRC_FILE(LDRV, IM); @@ -258,6 +257,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, struct bfa_tskim_s *tskim; struct bfa_itnim_s *bfa_itnim; bfa_status_t rc = BFA_STATUS_OK; + struct scsi_lun scsilun; tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); if (!tskim) { @@ -274,7 +274,8 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, cmnd->host_scribble = NULL; cmnd->SCp.Status = 0; bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); - bfa_tskim_start(tskim, bfa_itnim, (lun_t)0, + memset(&scsilun, 0, sizeof(scsilun)); + bfa_tskim_start(tskim, bfa_itnim, scsilun, FCP_TM_TARGET_RESET, BFAD_TARGET_RESET_TMO); out: return rc; @@ -301,6 +302,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) int rc = SUCCESS; unsigned long flags; enum bfi_tskim_status task_status; + struct scsi_lun scsilun; spin_lock_irqsave(&bfad->bfad_lock, flags); itnim = itnim_data->itnim; @@ -327,8 +329,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) cmnd->SCp.ptr = (char *)&wq; cmnd->SCp.Status = 0; bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); - bfa_tskim_start(tskim, bfa_itnim, - bfad_int_to_lun(cmnd->device->lun), + int_to_scsilun(cmnd->device->lun, &scsilun); + bfa_tskim_start(tskim, bfa_itnim, scsilun, FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO); spin_unlock_irqrestore(&bfad->bfad_lock, flags); diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index 27b33c765ddc..e19448427042 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h @@ -399,7 +399,7 @@ union bfi_ioc_i2h_msg_u { */ struct bfi_pbc_blun_s { wwn_t tgt_pwwn; - lun_t tgt_lun; + struct scsi_lun tgt_lun; }; /* diff --git a/drivers/scsi/bfa/bfi_ms.h b/drivers/scsi/bfa/bfi_ms.h index 10288764439d..e0e5318ce007 100644 --- a/drivers/scsi/bfa/bfi_ms.h +++ b/drivers/scsi/bfa/bfi_ms.h @@ -725,7 +725,7 @@ struct bfi_tskim_req_s { struct bfi_mhdr_s mh; /* Common msg header */ __be16 tsk_tag; /* task management tag */ u16 itn_fhdl; /* itn firmware handle */ - lun_t lun; /* LU number */ + struct scsi_lun lun; /* LU number */ u8 tm_flags; /* see enum fcp_tm_cmnd */ u8 t_secs; /* Timeout value in seconds */ u8 rsvd[2]; -- cgit v1.2.3 From f16a17507b09e10e0cccc4d675ccbfe030d51ef1 Mon Sep 17 00:00:00 2001 From: Maggie Zhang Date: Thu, 9 Dec 2010 19:12:32 -0800 Subject: [SCSI] bfa: remove all OS wrappers Remove OS wrapper functions/macros, and as a result remove bfa_os_inc.h. Signed-off-by: Maggie Zhang Signed-off-by: Jing Huang Signed-off-by: James Bottomley --- drivers/scsi/bfa/bfa.h | 2 +- drivers/scsi/bfa/bfa_core.c | 2 +- drivers/scsi/bfa/bfa_cs.h | 51 +++++++++++++- drivers/scsi/bfa/bfa_defs.h | 2 +- drivers/scsi/bfa/bfa_fc.h | 24 +++---- drivers/scsi/bfa/bfa_fcbuild.c | 58 ++++++++-------- drivers/scsi/bfa/bfa_fcbuild.h | 2 +- drivers/scsi/bfa/bfa_fcpim.c | 24 +------ drivers/scsi/bfa/bfa_fcs.c | 8 +-- drivers/scsi/bfa/bfa_fcs.h | 2 +- drivers/scsi/bfa/bfa_fcs_fcpim.c | 2 +- drivers/scsi/bfa/bfa_fcs_lport.c | 12 ++-- drivers/scsi/bfa/bfa_fcs_rport.c | 2 +- drivers/scsi/bfa/bfa_hw_cb.c | 1 + drivers/scsi/bfa/bfa_hw_ct.c | 1 + drivers/scsi/bfa/bfa_ioc.c | 6 +- drivers/scsi/bfa/bfa_ioc.h | 8 +-- drivers/scsi/bfa/bfa_ioc_cb.c | 1 + drivers/scsi/bfa/bfa_ioc_ct.c | 1 + drivers/scsi/bfa/bfa_os_inc.h | 143 --------------------------------------- drivers/scsi/bfa/bfa_port.c | 15 ++-- drivers/scsi/bfa/bfa_svc.c | 35 ++++++---- drivers/scsi/bfa/bfad.c | 9 ++- drivers/scsi/bfa/bfad_attr.c | 10 +-- drivers/scsi/bfa/bfad_drv.h | 37 ++++++---- drivers/scsi/bfa/bfad_im.c | 38 +++++------ drivers/scsi/bfa/bfad_im.h | 16 ++--- drivers/scsi/bfa/bfi.h | 2 +- 28 files changed, 210 insertions(+), 304 deletions(-) delete mode 100644 drivers/scsi/bfa/bfa_os_inc.h (limited to 'drivers/scsi/bfa/bfad_im.c') diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h index 8f17186a8dfe..cabc6b92b25d 100644 --- a/drivers/scsi/bfa/bfa.h +++ b/drivers/scsi/bfa/bfa.h @@ -17,7 +17,7 @@ #ifndef __BFA_H__ #define __BFA_H__ -#include "bfa_os_inc.h" +#include "bfad_drv.h" #include "bfa_cs.h" #include "bfa_plog.h" #include "bfa_defs_svc.h" diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index d417864227ce..02a5e04e365f 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c @@ -15,9 +15,9 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_modules.h" #include "bfi_ctreg.h" -#include "bfad_drv.h" BFA_TRC_FILE(HAL, CORE); diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h index 99f242b9aa31..493009d880a8 100644 --- a/drivers/scsi/bfa/bfa_cs.h +++ b/drivers/scsi/bfa/bfa_cs.h @@ -22,7 +22,7 @@ #ifndef __BFA_CS_H__ #define __BFA_CS_H__ -#include "bfa_os_inc.h" +#include "bfad_drv.h" /* * BFA TRC @@ -32,12 +32,20 @@ #define BFA_TRC_MAX (4 * 1024) #endif +#define BFA_TRC_TS(_trcm) \ + ({ \ + struct timeval tv; \ + \ + do_gettimeofday(&tv); \ + (tv.tv_sec*1000000+tv.tv_usec); \ + }) + #ifndef BFA_TRC_TS #define BFA_TRC_TS(_trcm) ((_trcm)->ticks++) #endif struct bfa_trc_s { -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u16 fileno; u16 line; #else @@ -361,4 +369,43 @@ bfa_wc_wait(struct bfa_wc_s *wc) bfa_wc_down(wc); } +static inline void +wwn2str(char *wwn_str, u64 wwn) +{ + union { + u64 wwn; + u8 byte[8]; + } w; + + w.wwn = wwn; + sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0], + w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5], + w.byte[6], w.byte[7]); +} + +static inline void +fcid2str(char *fcid_str, u32 fcid) +{ + union { + u32 fcid; + u8 byte[4]; + } f; + + f.fcid = fcid; + sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]); +} + +#define bfa_swap_3b(_x) \ + ((((_x) & 0xff) << 16) | \ + ((_x) & 0x00ff00) | \ + (((_x) & 0xff0000) >> 16)) + +#ifndef __BIG_ENDIAN +#define bfa_hton3b(_x) bfa_swap_3b(_x) +#else +#define bfa_hton3b(_x) (_x) +#endif + +#define bfa_ntoh3b(_x) bfa_hton3b(_x) + #endif /* __BFA_CS_H__ */ diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h index 07b57c4208c1..d85f93aea465 100644 --- a/drivers/scsi/bfa/bfa_defs.h +++ b/drivers/scsi/bfa/bfa_defs.h @@ -19,7 +19,7 @@ #define __BFA_DEFS_H__ #include "bfa_fc.h" -#include "bfa_os_inc.h" +#include "bfad_drv.h" #define BFA_MFG_SERIALNUM_SIZE 11 #define STRSZ(_n) (((_n) + 4) & ~3) diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h index 104a17f70b55..0d04ba9574f9 100644 --- a/drivers/scsi/bfa/bfa_fc.h +++ b/drivers/scsi/bfa/bfa_fc.h @@ -18,7 +18,7 @@ #ifndef __BFA_FC_H__ #define __BFA_FC_H__ -#include "bfa_os_inc.h" +#include "bfad_drv.h" typedef u64 wwn_t; @@ -62,7 +62,7 @@ struct scsi_cdb_s { * Fibre Channel Header Structure (FCHS) definition */ struct fchs_s { -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 routing:4; /* routing bits */ u32 cat_info:4; /* category info */ #else @@ -317,7 +317,7 @@ struct fc_plogi_csp_s { u8 verlo; /* FC-PH low version */ __be16 bbcred; /* BB_Credit */ -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u8 ciro:1, /* continuously increasing RO */ rro:1, /* random relative offset */ npiv_supp:1, /* NPIV supported */ @@ -367,7 +367,7 @@ struct fc_plogi_csp_s { * FC-PH-x. Figure 78. pg. 318. */ struct fc_plogi_clp_s { -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 class_valid:1; u32 intermix:1; /* class intermix supported if set =1. * valid only for class1. Reserved for @@ -532,7 +532,7 @@ struct fc_rsi_s { */ struct fc_prli_params_s { u32 reserved:16; -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 reserved1:5; u32 rec_support:1; u32 task_retry_id:1; @@ -574,7 +574,7 @@ enum { struct fc_prli_params_page_s { u32 type:8; u32 codext:8; -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 origprocasv:1; u32 rsppav:1; u32 imagepair:1; @@ -610,7 +610,7 @@ struct fc_prli_s { struct fc_prlo_params_page_s { u32 type:8; u32 type_ext:8; -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 opa_valid:1; /* originator process associator * valid */ @@ -646,7 +646,7 @@ struct fc_prlo_acc_params_page_s { u32 type:8; u32 type_ext:8; -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 opa_valid:1; /* originator process associator * valid */ @@ -803,7 +803,7 @@ struct fc_tprlo_params_page_s { u32 type:8; u32 type_ext:8; -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 opa_valid:1; u32 rpa_valid:1; u32 tpo_nport_valid:1; @@ -1177,7 +1177,7 @@ struct fc_srr_s { struct fcp_cmnd_s { struct scsi_lun lun; /* 64-bit LU number */ u8 crn; /* command reference number */ -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u8 resvd:1, priority:4, /* FCP-3: SAM-3 priority */ taskattr:3; /* scsi task attribute */ @@ -1187,7 +1187,7 @@ struct fcp_cmnd_s { resvd:1; #endif u8 tm_flags; /* task management flags */ -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u8 addl_cdb_len:6, /* additional CDB length words */ iodir:2; /* read/write FCP_DATA IUs */ #else @@ -1273,7 +1273,7 @@ struct fcp_rspinfo_s { struct fcp_resp_s { u32 reserved[2]; /* 2 words reserved */ u16 reserved2; -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u8 reserved3:3; u8 fcp_conf_req:1; /* FCP_CONF is requested */ u8 resid_flags:2; /* underflow/overflow */ diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c index 322b11e10d67..1ca5af75dd37 100644 --- a/drivers/scsi/bfa/bfa_fcbuild.c +++ b/drivers/scsi/bfa/bfa_fcbuild.c @@ -18,7 +18,7 @@ * fcbuild.c - FC link service frame building and parsing routines */ -#include "bfa_os_inc.h" +#include "bfad_drv.h" #include "bfa_fcbuild.h" /* @@ -48,7 +48,7 @@ fcbuild_init(void) fc_els_req_tmpl.cat_info = FC_CAT_LD_REQUEST; fc_els_req_tmpl.type = FC_TYPE_ELS; fc_els_req_tmpl.f_ctl = - bfa_os_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | + bfa_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); fc_els_req_tmpl.rx_id = FC_RXID_ANY; @@ -59,7 +59,7 @@ fcbuild_init(void) fc_els_rsp_tmpl.cat_info = FC_CAT_LD_REPLY; fc_els_rsp_tmpl.type = FC_TYPE_ELS; fc_els_rsp_tmpl.f_ctl = - bfa_os_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | + bfa_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); fc_els_rsp_tmpl.rx_id = FC_RXID_ANY; @@ -68,7 +68,7 @@ fcbuild_init(void) */ fc_bls_req_tmpl.routing = FC_RTG_BASIC_LINK; fc_bls_req_tmpl.type = FC_TYPE_BLS; - fc_bls_req_tmpl.f_ctl = bfa_os_hton3b(FCTL_END_SEQ | FCTL_SI_XFER); + fc_bls_req_tmpl.f_ctl = bfa_hton3b(FCTL_END_SEQ | FCTL_SI_XFER); fc_bls_req_tmpl.rx_id = FC_RXID_ANY; /* @@ -78,7 +78,7 @@ fcbuild_init(void) fc_bls_rsp_tmpl.cat_info = FC_CAT_BA_ACC; fc_bls_rsp_tmpl.type = FC_TYPE_BLS; fc_bls_rsp_tmpl.f_ctl = - bfa_os_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | + bfa_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); fc_bls_rsp_tmpl.rx_id = FC_RXID_ANY; @@ -129,7 +129,7 @@ fcbuild_init(void) fcp_fchs_tmpl.cat_info = FC_CAT_UNSOLICIT_CMD; fcp_fchs_tmpl.type = FC_TYPE_FCP; fcp_fchs_tmpl.f_ctl = - bfa_os_hton3b(FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); + bfa_hton3b(FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); fcp_fchs_tmpl.seq_id = 1; fcp_fchs_tmpl.rx_id = FC_RXID_ANY; } @@ -143,7 +143,7 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id) fchs->cat_info = FC_CAT_UNSOLICIT_CTRL; fchs->type = FC_TYPE_SERVICES; fchs->f_ctl = - bfa_os_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | + bfa_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); fchs->rx_id = FC_RXID_ANY; fchs->d_id = (d_id); @@ -232,7 +232,7 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size, u8 set_npiv, u8 set_auth, u16 local_bb_credits) { - u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); + u32 d_id = bfa_hton3b(FC_FABRIC_PORT); __be32 *vvl_info; memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); @@ -289,7 +289,7 @@ u16 fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size) { - u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); + u32 d_id = bfa_hton3b(FC_FABRIC_PORT); memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); @@ -770,10 +770,10 @@ u16 fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id, u32 s_id, u32 *pid_list, u16 npids) { - u32 dctlr_id = FC_DOMAIN_CTRLR(bfa_os_hton3b(d_id)); + u32 dctlr_id = FC_DOMAIN_CTRLR(bfa_hton3b(d_id)); int i = 0; - fc_els_req_build(fchs, bfa_os_hton3b(dctlr_id), s_id, 0); + fc_els_req_build(fchs, bfa_hton3b(dctlr_id), s_id, 0); memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s)); @@ -1045,7 +1045,7 @@ fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_gidpn_req_s *gidpn = (struct fcgs_gidpn_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); fc_gs_cthdr_build(cthdr, s_id, GS_GID_PN); @@ -1061,7 +1061,7 @@ fc_gpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; fcgs_gpnid_req_t *gpnid = (fcgs_gpnid_req_t *) (cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); fc_gs_cthdr_build(cthdr, s_id, GS_GPN_ID); @@ -1077,7 +1077,7 @@ fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; fcgs_gnnid_req_t *gnnid = (fcgs_gnnid_req_t *) (cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID); @@ -1104,7 +1104,7 @@ u16 fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, u8 set_br_reg, u32 s_id, u16 ox_id) { - u32 d_id = bfa_os_hton3b(FC_FABRIC_CONTROLLER); + u32 d_id = bfa_hton3b(FC_FABRIC_CONTROLLER); fc_els_req_build(fchs, d_id, s_id, ox_id); @@ -1121,7 +1121,7 @@ u16 fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, u32 s_id, u16 ox_id) { - u32 d_id = bfa_os_hton3b(FC_FABRIC_CONTROLLER); + u32 d_id = bfa_hton3b(FC_FABRIC_CONTROLLER); u16 payldlen; fc_els_req_build(fchs, d_id, s_id, ox_id); @@ -1143,7 +1143,7 @@ fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); - u32 type_value, d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 type_value, d_id = bfa_hton3b(FC_NAME_SERVER); u8 index; fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); @@ -1167,7 +1167,7 @@ fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID); @@ -1187,7 +1187,7 @@ fc_rffid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rffid_req_s *rffid = (struct fcgs_rffid_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); fc_gs_cthdr_build(cthdr, s_id, GS_RFF_ID); @@ -1209,7 +1209,7 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rspnid_req_s *rspnid = (struct fcgs_rspnid_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); fc_gs_cthdr_build(cthdr, s_id, GS_RSPN_ID); @@ -1229,7 +1229,7 @@ fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id, u8 fc4_type) struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_gidft_req_s *gidft = (struct fcgs_gidft_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); @@ -1249,7 +1249,7 @@ fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rpnid_req_s *rpnid = (struct fcgs_rpnid_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID); @@ -1267,7 +1267,7 @@ fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rnnid_req_s *rnnid = (struct fcgs_rnnid_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_cthdr_build(cthdr, s_id, GS_RNN_ID); @@ -1286,7 +1286,7 @@ fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rcsid_req_s *rcsid = (struct fcgs_rcsid_req_s *) (cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID); @@ -1304,7 +1304,7 @@ fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_rptid_req_s *rptid = (struct fcgs_rptid_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID); @@ -1321,7 +1321,7 @@ fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id) { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; struct fcgs_ganxt_req_s *ganxt = (struct fcgs_ganxt_req_s *)(cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); + u32 d_id = bfa_hton3b(FC_NAME_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT); @@ -1341,7 +1341,7 @@ fc_fdmi_reqhdr_build(struct fchs_s *fchs, void *pyld, u32 s_id, { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; - u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); + u32 d_id = bfa_hton3b(FC_MGMT_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code); @@ -1377,7 +1377,7 @@ fc_gmal_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn) { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; fcgs_gmal_req_t *gmal = (fcgs_gmal_req_t *) (cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); + u32 d_id = bfa_hton3b(FC_MGMT_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GMAL_CMD, @@ -1397,7 +1397,7 @@ fc_gfn_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn) { struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; fcgs_gfn_req_t *gfn = (fcgs_gfn_req_t *) (cthdr + 1); - u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); + u32 d_id = bfa_hton3b(FC_MGMT_SERVER); fc_gs_fchdr_build(fchs, d_id, s_id, 0); fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GFN_CMD, diff --git a/drivers/scsi/bfa/bfa_fcbuild.h b/drivers/scsi/bfa/bfa_fcbuild.h index 1737e08e1c01..ece51ec7620b 100644 --- a/drivers/scsi/bfa/bfa_fcbuild.h +++ b/drivers/scsi/bfa/bfa_fcbuild.h @@ -21,7 +21,7 @@ #ifndef __FCBUILD_H__ #define __FCBUILD_H__ -#include "bfa_os_inc.h" +#include "bfad_drv.h" #include "bfa_fc.h" #include "bfa_defs_fcs.h" diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 455c4f4e1d3b..506f1d326e5b 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -15,8 +15,8 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_modules.h" -#include "bfa_os_inc.h" BFA_TRC_FILE(HAL, FCPIM); BFA_MODULE(fcpim); @@ -1560,24 +1560,6 @@ bfa_itnim_hold_io(struct bfa_itnim_s *itnim) bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable)); } -bfa_status_t -bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim, - struct bfa_itnim_ioprofile_s *ioprofile) -{ - struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(itnim->bfa); - if (!fcpim->io_profile) - return BFA_STATUS_IOPROFILE_OFF; - - itnim->ioprofile.index = BFA_IOBUCKET_MAX; - itnim->ioprofile.io_profile_start_time = - bfa_io_profile_start_time(itnim->bfa); - itnim->ioprofile.clock_res_mul = bfa_io_lat_clock_res_mul; - itnim->ioprofile.clock_res_div = bfa_io_lat_clock_res_div; - *ioprofile = itnim->ioprofile; - - return BFA_STATUS_OK; -} - void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim) { @@ -2352,7 +2334,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) scsi_for_each_sg(cmnd, sg, ioim->nsges, i) { if (i == 0) { /* build inline IO SG element */ - addr = bfa_os_sgaddr(sg_dma_address(sg)); + addr = bfa_sgaddr_le(sg_dma_address(sg)); sge->sga = *(union bfi_addr_u *) &addr; pgdlen = sg_dma_len(sg); sge->sg_len = pgdlen; @@ -2364,7 +2346,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) if (sge_id == 0) sgpge = sgpg->sgpg->sges; - addr = bfa_os_sgaddr(sg_dma_address(sg)); + addr = bfa_sgaddr_le(sg_dma_address(sg)); sgpge->sga = *(union bfi_addr_u *) &addr; sgpge->sg_len = sg_dma_len(sg); pgcumsz += sgpge->sg_len; diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index 141215c51635..e3a41b88a11b 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c @@ -19,9 +19,9 @@ * bfa_fcs.c BFA FCS main */ +#include "bfad_drv.h" #include "bfa_fcs.h" #include "bfa_fcbuild.h" -#include "bfad_drv.h" BFA_TRC_FILE(FCS, FCS); @@ -1097,7 +1097,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs, * external loopback cable is in place. Our own FLOGI frames are * sometimes looped back when switch port gets temporarily bypassed. */ - if ((pid == bfa_os_ntoh3b(FC_FABRIC_PORT)) && + if ((pid == bfa_ntoh3b(FC_FABRIC_PORT)) && (els_cmd->els_code == FC_ELS_FLOGI) && (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) { bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK); @@ -1107,7 +1107,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs, /* * FLOGI/EVFP exchanges should be consumed by base fabric. */ - if (fchs->d_id == bfa_os_hton3b(FC_FABRIC_PORT)) { + if (fchs->d_id == bfa_hton3b(FC_FABRIC_PORT)) { bfa_trc(fabric->fcs, pid); bfa_fcs_fabric_process_uf(fabric, fchs, len); return; @@ -1220,7 +1220,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) return; reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), - bfa_os_hton3b(FC_FABRIC_PORT), + bfa_hton3b(FC_FABRIC_PORT), n2n_port->reply_oxid, pcfg->pwwn, pcfg->nwwn, bfa_fcport_get_maxfrsize(bfa), diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index e7977ee32992..f0e652b50994 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h @@ -61,7 +61,7 @@ struct bfa_fcs_s; #define N2N_LOCAL_PID 0x010000 #define N2N_REMOTE_PID 0x020000 #define BFA_FCS_RETRY_TIMEOUT 2000 -#define BFA_FCS_PID_IS_WKA(pid) ((bfa_os_ntoh3b(pid) > 0xFFF000) ? 1 : 0) +#define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0) diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c index 82ac2798c545..5736ef8c592f 100644 --- a/drivers/scsi/bfa/bfa_fcs_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c @@ -19,9 +19,9 @@ * fcpim.c - FCP initiator mode i-t nexus state machine */ +#include "bfad_drv.h" #include "bfa_fcs.h" #include "bfa_fcbuild.h" -#include "bfad_drv.h" #include "bfad_im.h" BFA_TRC_FILE(FCS, FCPIM); diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 6e9151fecb74..7a2cf7713a95 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c @@ -15,10 +15,10 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_fcs.h" #include "bfa_fcbuild.h" #include "bfa_fc.h" -#include "bfad_drv.h" BFA_TRC_FILE(FCS, PORT); @@ -2818,7 +2818,7 @@ bfa_fcs_lport_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) ms->fcxp = fcxp; len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), - bfa_os_hton3b(FC_MGMT_SERVER), + bfa_hton3b(FC_MGMT_SERVER), bfa_fcs_lport_get_fcid(port), 0, port->port_cfg.pwwn, port->port_cfg.nwwn, bfa_fcport_get_maxfrsize(port->fcs->bfa)); @@ -3575,7 +3575,7 @@ fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); ns->fcxp = fcxp; len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), - bfa_os_hton3b(FC_NAME_SERVER), + bfa_hton3b(FC_NAME_SERVER), bfa_fcs_lport_get_fcid(port), 0, port->port_cfg.pwwn, port->port_cfg.nwwn, bfa_fcport_get_maxfrsize(port->fcs->bfa)); @@ -4654,7 +4654,7 @@ bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, int index, while ((qe != qh) && (i < nrports)) { rport = (struct bfa_fcs_rport_s *) qe; - if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { + if (bfa_ntoh3b(rport->pid) > 0xFFF000) { qe = bfa_q_next(qe); bfa_trc(fcs, (u32) rport->pwwn); bfa_trc(fcs, rport->pid); @@ -4702,7 +4702,7 @@ bfa_fcs_lport_get_rports(struct bfa_fcs_lport_s *port, while ((qe != qh) && (i < *nrports)) { rport = (struct bfa_fcs_rport_s *) qe; - if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { + if (bfa_ntoh3b(rport->pid) > 0xFFF000) { qe = bfa_q_next(qe); bfa_trc(fcs, (u32) rport->pwwn); bfa_trc(fcs, rport->pid); @@ -4753,7 +4753,7 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port) while (qe != qh) { rport = (struct bfa_fcs_rport_s *) qe; - if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) || + if ((bfa_ntoh3b(rport->pid) > 0xFFF000) || (bfa_fcs_rport_get_state(rport) == BFA_RPORT_OFFLINE)) { qe = bfa_q_next(qe); diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index 2089d686fa5d..fbfcac7615b5 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c @@ -19,9 +19,9 @@ * rport.c Remote port implementation. */ +#include "bfad_drv.h" #include "bfa_fcs.h" #include "bfa_fcbuild.h" -#include "bfad_drv.h" BFA_TRC_FILE(FCS, RPORT); diff --git a/drivers/scsi/bfa/bfa_hw_cb.c b/drivers/scsi/bfa/bfa_hw_cb.c index d8464ae60070..1fa15edabcdd 100644 --- a/drivers/scsi/bfa/bfa_hw_cb.c +++ b/drivers/scsi/bfa/bfa_hw_cb.c @@ -15,6 +15,7 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_modules.h" #include "bfi_cbreg.h" diff --git a/drivers/scsi/bfa/bfa_hw_ct.c b/drivers/scsi/bfa/bfa_hw_ct.c index b0efbc713ffe..68077c4c4d55 100644 --- a/drivers/scsi/bfa/bfa_hw_ct.c +++ b/drivers/scsi/bfa/bfa_hw_ct.c @@ -15,6 +15,7 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_modules.h" #include "bfi_ctreg.h" diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index a8f745420f32..cd532444ffd9 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c @@ -15,11 +15,11 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_ioc.h" #include "bfi_ctreg.h" #include "bfa_defs.h" #include "bfa_defs_svc.h" -#include "bfad_drv.h" BFA_TRC_FILE(CNA, IOC); @@ -1428,12 +1428,12 @@ static void bfa_ioc_send_enable(struct bfa_ioc_s *ioc) { struct bfi_ioc_ctrl_req_s enable_req; - struct bfa_timeval_s tv; + struct timeval tv; bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, bfa_ioc_portid(ioc)); enable_req.ioc_class = ioc->ioc_mc; - bfa_os_gettimeofday(&tv); + do_gettimeofday(&tv); enable_req.tv_sec = be32_to_cpu(tv.tv_sec); bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); } diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 3c5bdd1c0c7f..62153f283216 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h @@ -18,7 +18,7 @@ #ifndef __BFA_IOC_H__ #define __BFA_IOC_H__ -#include "bfa_os_inc.h" +#include "bfad_drv.h" #include "bfa_cs.h" #include "bfi.h" @@ -74,7 +74,7 @@ struct bfa_sge_s { #define bfa_swap_words(_x) ( \ ((_x) << 32) | ((_x) >> 32)) -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN #define bfa_sge_to_be(_x) #define bfa_sge_to_le(_x) bfa_sge_word_swap(_x) #define bfa_sgaddr_le(_x) bfa_swap_words(_x) @@ -120,7 +120,7 @@ static inline void __bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa) { dma_addr->a32.addr_lo = (__be32) pa; - dma_addr->a32.addr_hi = (__be32) (bfa_os_u32(pa)); + dma_addr->a32.addr_hi = (__be32) (pa >> 32); } @@ -130,7 +130,7 @@ static inline void __bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa) { dma_addr->a32.addr_lo = cpu_to_be32(pa); - dma_addr->a32.addr_hi = cpu_to_be32(bfa_os_u32(pa)); + dma_addr->a32.addr_hi = cpu_to_be32(pa >> 32); } struct bfa_ioc_regs_s { diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c index e9c8554e356e..a0e05da9df51 100644 --- a/drivers/scsi/bfa/bfa_ioc_cb.c +++ b/drivers/scsi/bfa/bfa_ioc_cb.c @@ -15,6 +15,7 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_ioc.h" #include "bfi_cbreg.h" #include "bfa_defs.h" diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 45d0ddc88c52..25a5d3c339c8 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c @@ -15,6 +15,7 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_ioc.h" #include "bfi_ctreg.h" #include "bfa_defs.h" diff --git a/drivers/scsi/bfa/bfa_os_inc.h b/drivers/scsi/bfa/bfa_os_inc.h deleted file mode 100644 index 65df62ef437f..000000000000 --- a/drivers/scsi/bfa/bfa_os_inc.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. - * All rights reserved - * www.brocade.com - * - * Linux driver for Brocade Fibre Channel Host Bus Adapter. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License (GPL) Version 2 as - * published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - */ - -#ifndef __BFA_OS_INC_H__ -#define __BFA_OS_INC_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __BIG_ENDIAN -#define __BIGENDIAN -#endif - -static inline u64 bfa_os_get_log_time(void) -{ - u64 system_time = 0; - struct timeval tv; - do_gettimeofday(&tv); - - /* We are interested in seconds only. */ - system_time = tv.tv_sec; - return system_time; -} - -#define bfa_io_lat_clock_res_div HZ -#define bfa_io_lat_clock_res_mul 1000 - -#define BFA_LOG(level, bfad, mask, fmt, arg...) \ -do { \ - if (((mask) == 4) || (level[1] <= '4')) \ - dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \ -} while (0) - -#define bfa_swap_3b(_x) \ - ((((_x) & 0xff) << 16) | \ - ((_x) & 0x00ff00) | \ - (((_x) & 0xff0000) >> 16)) - -#define bfa_os_swap_sgaddr(_x) ((u64)( \ - (((u64)(_x) & (u64)0x00000000000000ffull) << 32) | \ - (((u64)(_x) & (u64)0x000000000000ff00ull) << 32) | \ - (((u64)(_x) & (u64)0x0000000000ff0000ull) << 32) | \ - (((u64)(_x) & (u64)0x00000000ff000000ull) << 32) | \ - (((u64)(_x) & (u64)0x000000ff00000000ull) >> 32) | \ - (((u64)(_x) & (u64)0x0000ff0000000000ull) >> 32) | \ - (((u64)(_x) & (u64)0x00ff000000000000ull) >> 32) | \ - (((u64)(_x) & (u64)0xff00000000000000ull) >> 32))) - -#ifndef __BIGENDIAN -#define bfa_os_hton3b(_x) bfa_swap_3b(_x) -#define bfa_os_sgaddr(_x) (_x) -#else -#define bfa_os_hton3b(_x) (_x) -#define bfa_os_sgaddr(_x) bfa_os_swap_sgaddr(_x) -#endif - -#define bfa_os_ntoh3b(_x) bfa_os_hton3b(_x) -#define bfa_os_u32(__pa64) ((__pa64) >> 32) - -#define BFA_TRC_TS(_trcm) \ - ({ \ - struct timeval tv; \ - \ - do_gettimeofday(&tv); \ - (tv.tv_sec*1000000+tv.tv_usec); \ - }) - -#define boolean_t int - -/* - * For current time stamp, OS API will fill-in - */ -struct bfa_timeval_s { - u32 tv_sec; /* seconds */ - u32 tv_usec; /* microseconds */ -}; - -static inline void -bfa_os_gettimeofday(struct bfa_timeval_s *tv) -{ - struct timeval tmp_tv; - - do_gettimeofday(&tmp_tv); - tv->tv_sec = (u32) tmp_tv.tv_sec; - tv->tv_usec = (u32) tmp_tv.tv_usec; -} - -static inline void -wwn2str(char *wwn_str, u64 wwn) -{ - union { - u64 wwn; - u8 byte[8]; - } w; - - w.wwn = wwn; - sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0], - w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5], - w.byte[6], w.byte[7]); -} - -static inline void -fcid2str(char *fcid_str, u32 fcid) -{ - union { - u32 fcid; - u8 byte[4]; - } f; - - f.fcid = fcid; - sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]); -} - -#endif /* __BFA_OS_INC_H__ */ diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c index 76efb9a5c324..45b3486cca9c 100644 --- a/drivers/scsi/bfa/bfa_port.c +++ b/drivers/scsi/bfa/bfa_port.c @@ -15,6 +15,7 @@ * General Public License for more details. */ +#include "bfad_drv.h" #include "bfa_defs_svc.h" #include "bfa_port.h" #include "bfi.h" @@ -36,7 +37,7 @@ bfa_port_stats_swap(struct bfa_port_s *port, union bfa_port_stats_u *stats) i += 2) { t0 = dip[i]; t1 = dip[i + 1]; -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN dip[i] = be32_to_cpu(t0); dip[i + 1] = be32_to_cpu(t1); #else @@ -96,13 +97,13 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) port->stats_busy = BFA_FALSE; if (status == BFA_STATUS_OK) { - struct bfa_timeval_s tv; + struct timeval tv; memcpy(port->stats, port->stats_dma.kva, sizeof(union bfa_port_stats_u)); bfa_port_stats_swap(port, port->stats); - bfa_os_gettimeofday(&tv); + do_gettimeofday(&tv); port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time; } @@ -124,7 +125,7 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) static void bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) { - struct bfa_timeval_s tv; + struct timeval tv; port->stats_status = status; port->stats_busy = BFA_FALSE; @@ -132,7 +133,7 @@ bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) /* * re-initialize time stamp for stats reset */ - bfa_os_gettimeofday(&tv); + do_gettimeofday(&tv); port->stats_reset_time = tv.tv_sec; if (port->stats_cbfn) { @@ -432,7 +433,7 @@ void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, void *dev, struct bfa_trc_mod_s *trcmod) { - struct bfa_timeval_s tv; + struct timeval tv; bfa_assert(port); @@ -452,7 +453,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, /* * initialize time stamp for stats reset */ - bfa_os_gettimeofday(&tv); + do_gettimeofday(&tv); port->stats_reset_time = tv.tv_sec; bfa_trc(port, 0); diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index c9192869c0fe..1d5432b42a90 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c @@ -15,11 +15,10 @@ * General Public License for more details. */ -#include "bfa_os_inc.h" +#include "bfad_drv.h" #include "bfa_plog.h" #include "bfa_cs.h" #include "bfa_modules.h" -#include "bfad_drv.h" BFA_TRC_FILE(HAL, FCXP); BFA_MODULE(fcxp); @@ -286,6 +285,18 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec) return 0; } +static u64 +bfa_get_log_time(void) +{ + u64 system_time = 0; + struct timeval tv; + do_gettimeofday(&tv); + + /* We are interested in seconds only. */ + system_time = tv.tv_sec; + return system_time; +} + static void bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) { @@ -306,7 +317,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s)); - pl_recp->tv = bfa_os_get_log_time(); + pl_recp->tv = bfa_get_log_time(); BFA_PL_LOG_REC_INCR(plog->tail); if (plog->head == plog->tail) @@ -2728,7 +2739,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); struct bfa_port_cfg_s *port_cfg = &fcport->cfg; struct bfa_fcport_ln_s *ln = &fcport->ln; - struct bfa_timeval_s tv; + struct timeval tv; memset(fcport, 0, sizeof(struct bfa_fcport_s)); fcport->bfa = bfa; @@ -2742,7 +2753,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, /* * initialize time stamp for stats reset */ - bfa_os_gettimeofday(&tv); + do_gettimeofday(&tv); fcport->stats_reset_time = tv.tv_sec; /* @@ -2967,7 +2978,7 @@ bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d, for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32)); i = i + 2) { -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN dip[i] = be32_to_cpu(sip[i]); dip[i + 1] = be32_to_cpu(sip[i + 1]); #else @@ -2984,7 +2995,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete) if (complete) { if (fcport->stats_status == BFA_STATUS_OK) { - struct bfa_timeval_s tv; + struct timeval tv; /* Swap FC QoS or FCoE stats */ if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { @@ -2996,7 +3007,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete) &fcport->stats_ret->fcoe, &fcport->stats->fcoe); - bfa_os_gettimeofday(&tv); + do_gettimeofday(&tv); fcport->stats_ret->fcoe.secs_reset = tv.tv_sec - fcport->stats_reset_time; } @@ -3055,12 +3066,12 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete) struct bfa_fcport_s *fcport = cbarg; if (complete) { - struct bfa_timeval_s tv; + struct timeval tv; /* * re-initialize time stamp for stats reset */ - bfa_os_gettimeofday(&tv); + do_gettimeofday(&tv); fcport->stats_reset_time = tv.tv_sec; fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status); @@ -4930,10 +4941,6 @@ bfa_uf_start(struct bfa_s *bfa) bfa_uf_post_all(BFA_UF_MOD(bfa)); } -/* - * hal_uf_api - */ - /* * Register handler for all unsolicted recieve frames. * diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 2bc786212521..c80540e576cd 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -32,7 +32,6 @@ #include "bfad_drv.h" #include "bfad_im.h" #include "bfa_fcs.h" -#include "bfa_os_inc.h" #include "bfa_defs.h" #include "bfa.h" @@ -1102,15 +1101,15 @@ bfad_start_ops(struct bfad_s *bfad) { /* * If bfa_linkup_delay is set to -1 default; try to retrive the - * value using the bfad_os_get_linkup_delay(); else use the + * value using the bfad_get_linkup_delay(); else use the * passed in module param value as the bfa_linkup_delay. */ if (bfa_linkup_delay < 0) { - bfa_linkup_delay = bfad_os_get_linkup_delay(bfad); - bfad_os_rport_online_wait(bfad); + bfa_linkup_delay = bfad_get_linkup_delay(bfad); + bfad_rport_online_wait(bfad); bfa_linkup_delay = -1; } else - bfad_os_rport_online_wait(bfad); + bfad_rport_online_wait(bfad); BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n"); diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index d727f055bd8a..a94ea4235433 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c @@ -40,7 +40,7 @@ bfad_im_get_starget_port_id(struct scsi_target *starget) bfad = im_port->bfad; spin_lock_irqsave(&bfad->bfad_lock, flags); - itnim = bfad_os_get_itnim(im_port, starget->id); + itnim = bfad_get_itnim(im_port, starget->id); if (itnim) fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); @@ -66,7 +66,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget) bfad = im_port->bfad; spin_lock_irqsave(&bfad->bfad_lock, flags); - itnim = bfad_os_get_itnim(im_port, starget->id); + itnim = bfad_get_itnim(im_port, starget->id); if (itnim) node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim); @@ -92,7 +92,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget) bfad = im_port->bfad; spin_lock_irqsave(&bfad->bfad_lock, flags); - itnim = bfad_os_get_itnim(im_port, starget->id); + itnim = bfad_get_itnim(im_port, starget->id); if (itnim) port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); @@ -111,7 +111,7 @@ bfad_im_get_host_port_id(struct Scsi_Host *shost) struct bfad_port_s *port = im_port->port; fc_host_port_id(shost) = - bfa_os_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port)); + bfa_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port)); } /* @@ -487,7 +487,7 @@ bfad_im_vport_delete(struct fc_vport *fc_vport) wait_for_completion(vport->comp_del); free_scsi_host: - bfad_os_scsi_host_free(bfad, im_port); + bfad_scsi_host_free(bfad, im_port); kfree(vport); diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index b9bcb0b99b8a..24b6ab18f89d 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h @@ -26,7 +26,23 @@ #ifndef __BFAD_DRV_H__ #define __BFAD_DRV_H__ -#include "bfa_os_inc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "bfa_modules.h" #include "bfa_fcs.h" @@ -272,19 +288,12 @@ do { \ } while (0) -#define list_remove_head(list, entry, type, member) \ -do { \ - entry = NULL; \ - if (!list_empty(list)) { \ - entry = list_entry((list)->next, type, member); \ - list_del_init(&entry->member); \ - } \ +#define BFA_LOG(level, bfad, mask, fmt, arg...) \ +do { \ + if (((mask) == 4) || (level[1] <= '4')) \ + dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \ } while (0) -#define list_get_first(list, type, member) \ -((list_empty(list)) ? NULL : \ - list_entry((list)->next, type, member)) - bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id, struct bfa_lport_cfg_s *port_cfg, struct device *dev); @@ -316,8 +325,8 @@ void bfad_debugfs_exit(struct bfad_port_s *port); void bfad_pci_remove(struct pci_dev *pdev); int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid); -void bfad_os_rport_online_wait(struct bfad_s *bfad); -int bfad_os_get_linkup_delay(struct bfad_s *bfad); +void bfad_rport_online_wait(struct bfad_s *bfad); +int bfad_get_linkup_delay(struct bfad_s *bfad); int bfad_install_msix_handler(struct bfad_s *bfad); extern struct idr bfad_im_port_index; diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index d10adcbf24b3..7b0f9725bbc9 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -92,10 +92,10 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio, if (!cmnd->result && itnim && (bfa_lun_queue_depth > cmnd->device->queue_depth)) { /* Queue depth adjustment for good status completion */ - bfad_os_ramp_up_qdepth(itnim, cmnd->device); + bfad_ramp_up_qdepth(itnim, cmnd->device); } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { /* qfull handling */ - bfad_os_handle_qfull(itnim, cmnd->device); + bfad_handle_qfull(itnim, cmnd->device); } } @@ -123,7 +123,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio) if (itnim_data) { itnim = itnim_data->itnim; if (itnim) - bfad_os_ramp_up_qdepth(itnim, cmnd->device); + bfad_ramp_up_qdepth(itnim, cmnd->device); } } @@ -366,7 +366,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd) spin_lock_irqsave(&bfad->bfad_lock, flags); for (i = 0; i < MAX_FCP_TARGET; i++) { - itnim = bfad_os_get_itnim(im_port, i); + itnim = bfad_get_itnim(im_port, i); if (itnim) { cmnd->SCp.ptr = (char *)&wq; rc = bfad_im_target_reset_send(bfad, cmnd, itnim); @@ -547,7 +547,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, mutex_unlock(&bfad_mutex); - im_port->shost = bfad_os_scsi_host_alloc(im_port, bfad); + im_port->shost = bfad_scsi_host_alloc(im_port, bfad); if (!im_port->shost) { error = 1; goto out_free_idr; @@ -573,7 +573,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, } /* setup host fixed attribute if the lk supports */ - bfad_os_fc_host_init(im_port); + bfad_fc_host_init(im_port); return 0; @@ -684,7 +684,7 @@ bfad_im_probe(struct bfad_s *bfad) bfad->im = im; im->bfad = bfad; - if (bfad_os_thread_workq(bfad) != BFA_STATUS_OK) { + if (bfad_thread_workq(bfad) != BFA_STATUS_OK) { kfree(im); rc = BFA_STATUS_FAILED; } @@ -697,14 +697,14 @@ void bfad_im_probe_undo(struct bfad_s *bfad) { if (bfad->im) { - bfad_os_destroy_workq(bfad->im); + bfad_destroy_workq(bfad->im); kfree(bfad->im); bfad->im = NULL; } } struct Scsi_Host * -bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) +bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) { struct scsi_host_template *sht; @@ -719,7 +719,7 @@ bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) } void -bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) +bfad_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) { if (!(im_port->flags & BFAD_PORT_DELETE)) flush_workqueue(bfad->im->drv_workq); @@ -729,7 +729,7 @@ bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) } void -bfad_os_destroy_workq(struct bfad_im_s *im) +bfad_destroy_workq(struct bfad_im_s *im) { if (im && im->drv_workq) { flush_workqueue(im->drv_workq); @@ -739,7 +739,7 @@ bfad_os_destroy_workq(struct bfad_im_s *im) } bfa_status_t -bfad_os_thread_workq(struct bfad_s *bfad) +bfad_thread_workq(struct bfad_s *bfad) { struct bfad_im_s *im = bfad->im; @@ -843,7 +843,7 @@ bfad_im_module_exit(void) } void -bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) +bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) { struct scsi_device *tmp_sdev; @@ -871,7 +871,7 @@ bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) } void -bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) +bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) { struct scsi_device *tmp_sdev; @@ -885,7 +885,7 @@ bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) } struct bfad_itnim_s * -bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id) +bfad_get_itnim(struct bfad_im_port_s *im_port, int id) { struct bfad_itnim_s *itnim = NULL; @@ -946,7 +946,7 @@ bfad_im_supported_speeds(struct bfa_s *bfa) } void -bfad_os_fc_host_init(struct bfad_im_port_s *im_port) +bfad_fc_host_init(struct bfad_im_port_s *im_port) { struct Scsi_Host *host = im_port->shost; struct bfad_s *bfad = im_port->bfad; @@ -990,7 +990,7 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim) rport_ids.port_name = cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); rport_ids.port_id = - bfa_os_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); + bfa_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; itnim->fc_rport = fc_rport = @@ -1192,7 +1192,7 @@ out_fail_cmd: static DEF_SCSI_QCMD(bfad_im_queuecommand) void -bfad_os_rport_online_wait(struct bfad_s *bfad) +bfad_rport_online_wait(struct bfad_s *bfad) { int i; int rport_delay = 10; @@ -1220,7 +1220,7 @@ bfad_os_rport_online_wait(struct bfad_s *bfad) } int -bfad_os_get_linkup_delay(struct bfad_s *bfad) +bfad_get_linkup_delay(struct bfad_s *bfad) { u8 nwwns = 0; wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX]; diff --git a/drivers/scsi/bfa/bfad_im.h b/drivers/scsi/bfa/bfad_im.h index b038c0e08921..bfee63b16fa9 100644 --- a/drivers/scsi/bfa/bfad_im.h +++ b/drivers/scsi/bfa/bfad_im.h @@ -117,17 +117,17 @@ struct bfad_im_s { char drv_workq_name[KOBJ_NAME_LEN]; }; -struct Scsi_Host *bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, +struct Scsi_Host *bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *); -bfa_status_t bfad_os_thread_workq(struct bfad_s *bfad); -void bfad_os_destroy_workq(struct bfad_im_s *im); -void bfad_os_fc_host_init(struct bfad_im_port_s *im_port); -void bfad_os_scsi_host_free(struct bfad_s *bfad, +bfa_status_t bfad_thread_workq(struct bfad_s *bfad); +void bfad_destroy_workq(struct bfad_im_s *im); +void bfad_fc_host_init(struct bfad_im_port_s *im_port); +void bfad_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port); -void bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, +void bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev); -void bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev); -struct bfad_itnim_s *bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id); +void bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev); +struct bfad_itnim_s *bfad_get_itnim(struct bfad_im_port_s *im_port, int id); extern struct scsi_host_template bfad_im_scsi_host_template; extern struct scsi_host_template bfad_im_vport_template; diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index e19448427042..72b69a0c3b51 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h @@ -104,7 +104,7 @@ union bfi_addr_u { * Scatter Gather Element */ struct bfi_sge_s { -#ifdef __BIGENDIAN +#ifdef __BIG_ENDIAN u32 flags:2, rsvd:2, sg_len:28; -- cgit v1.2.3 From 15821f05b78dbeb2f897d1d22576449103a4d8d5 Mon Sep 17 00:00:00 2001 From: Krishna Gudipati Date: Mon, 13 Dec 2010 16:23:27 -0800 Subject: [SCSI] bfa: io tag handling and minor bug fix. Fix iotag handling: 1) Update and check io tag for retry case. 2) Clearing upper 3 bits in io tag when an IO completes. The 3 upper bits in io tags are used for counting FCP exchange retry. Un-cleared bits will cause firmware to access invalid memory when the same io tag is used for an IO to a target that doesn't support FCP exchange retry. 3) Only check the effective bits when validating an iotag. Other minor fixes: 1) Added trace to get FC header type with assert of unhandled packet received. Ignore the type FC_TYPE_FC_FSS (FC_XS). 2) Fixed the adapter info display check - to check for fcmode flag even. Signed-off-by: Krishna Gudipati Signed-off-by: James Bottomley --- drivers/scsi/bfa/bfa_fcpim.c | 8 +++++--- drivers/scsi/bfa/bfa_fcpim.h | 22 ++++++++++++---------- drivers/scsi/bfa/bfa_fcs_lport.c | 8 ++++++-- drivers/scsi/bfa/bfad_im.c | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) (limited to 'drivers/scsi/bfa/bfad_im.c') diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 314c93122980..5e697f236ef3 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -1540,8 +1540,8 @@ bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) break; case BFA_IOIM_SM_SQRETRY: - if (bfa_ioim_get_iotag(ioim) != BFA_TRUE) { - /* max retry completed free IO */ + if (bfa_ioim_maxretry_reached(ioim)) { + /* max retry reached, free IO */ bfa_sm_set_state(ioim, bfa_ioim_sm_hcb_free); bfa_ioim_move_to_comp_q(ioim); bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, @@ -1569,6 +1569,7 @@ bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) switch (event) { case BFA_IOIM_SM_FREE: /* abts and rrq done. Now retry the IO with new tag */ + bfa_ioim_update_iotag(ioim); if (!bfa_ioim_send_ioreq(ioim)) { bfa_sm_set_state(ioim, bfa_ioim_sm_qfull); break; @@ -2526,7 +2527,7 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m) iotag = be16_to_cpu(rsp->io_tag); ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); - bfa_assert(ioim->iotag == iotag); + bfa_assert(BFA_IOIM_TAG_2_ID(ioim->iotag) == iotag); bfa_trc_fp(ioim->bfa, ioim->iotag); bfa_ioim_cb_profile_comp(fcpim, ioim); @@ -2629,6 +2630,7 @@ bfa_ioim_free(struct bfa_ioim_s *ioim) bfa_stats(ioim->itnim, io_comps); fcpim->ios_active--; + ioim->iotag &= BFA_IOIM_IOTAG_MASK; list_del(&ioim->qe); list_add_tail(&ioim->qe, &fcpim->ioim_free_q); } diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h index f9334587e02a..1e38dade8423 100644 --- a/drivers/scsi/bfa/bfa_fcpim.h +++ b/drivers/scsi/bfa/bfa_fcpim.h @@ -41,7 +41,7 @@ (__itnim->ioprofile.iocomps[__index]++) #define BFA_IOIM_RETRY_TAG_OFFSET 11 -#define BFA_IOIM_RETRY_TAG_MASK 0x07ff /* 2K IOs */ +#define BFA_IOIM_IOTAG_MASK 0x07ff /* 2K IOs */ #define BFA_IOIM_RETRY_MAX 7 /* Buckets are are 512 bytes to 2MB */ @@ -189,8 +189,9 @@ struct bfa_itnim_s { #define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) #define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) +#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK) #define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ - (&fcpim->ioim_arr[(_iotag & BFA_IOIM_RETRY_TAG_MASK)]) + (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)]) #define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \ (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) @@ -198,20 +199,21 @@ struct bfa_itnim_s { (_bfa->modules.fcpim_mod.io_profile_start_time) #define bfa_fcpim_get_io_profile(_bfa) \ (_bfa->modules.fcpim_mod.io_profile) +#define bfa_ioim_update_iotag(__ioim) do { \ + uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \ + k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ + (__ioim)->iotag |= k << BFA_IOIM_RETRY_TAG_OFFSET; \ +} while (0) static inline bfa_boolean_t -bfa_ioim_get_iotag(struct bfa_ioim_s *ioim) +bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim) { - u16 k = ioim->iotag; - - k >>= BFA_IOIM_RETRY_TAG_OFFSET; k++; - - if (k > BFA_IOIM_RETRY_MAX) + uint16_t k = ioim->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; + if (k < BFA_IOIM_RETRY_MAX) return BFA_FALSE; - ioim->iotag &= BFA_IOIM_RETRY_TAG_MASK; - ioim->iotag |= k<fcs, fchs->type); if (!bfa_fcs_lport_is_online(lport)) { bfa_stats(lport, uf_recv_drops); @@ -663,8 +664,11 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, * Only handles ELS frames for now. */ if (fchs->type != FC_TYPE_ELS) { - bfa_trc(lport->fcs, fchs->type); - bfa_assert(0); + bfa_trc(lport->fcs, fchs->s_id); + bfa_trc(lport->fcs, fchs->d_id); + /* ignore type FC_TYPE_FC_FSS */ + if (fchs->type != FC_TYPE_FC_FSS) + bfa_sm_fault(lport->fcs, fchs->type); return; } diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 7b0f9725bbc9..53cea3d33351 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -182,7 +182,7 @@ bfad_im_info(struct Scsi_Host *shost) bfa_get_adapter_model(bfa, model); memset(bfa_buf, 0, sizeof(bfa_buf)); - if (ioc->ctdev) + if (ioc->ctdev && !ioc->fcmode) snprintf(bfa_buf, sizeof(bfa_buf), "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s", model, bfad->pci_name, BFAD_DRIVER_VERSION); -- cgit v1.2.3 From d4b671c58ebeb56dfc8fe8bcca25e0a06bc9359a Mon Sep 17 00:00:00 2001 From: Jing Huang Date: Sun, 26 Dec 2010 21:46:35 -0800 Subject: [SCSI] bfa: replace bfa_assert with WARN_ON Signed-off-by: Jing Huang Signed-off-by: James Bottomley --- drivers/scsi/bfa/bfa.h | 4 +- drivers/scsi/bfa/bfa_core.c | 12 ++--- drivers/scsi/bfa/bfa_cs.h | 10 ---- drivers/scsi/bfa/bfa_fcpim.c | 42 +++++++-------- drivers/scsi/bfa/bfa_fcs.c | 6 +-- drivers/scsi/bfa/bfa_fcs_fcpim.c | 10 ++-- drivers/scsi/bfa/bfa_fcs_lport.c | 20 +++---- drivers/scsi/bfa/bfa_fcs_rport.c | 4 +- drivers/scsi/bfa/bfa_hw_cb.c | 2 +- drivers/scsi/bfa/bfa_hw_ct.c | 4 +- drivers/scsi/bfa/bfa_ioc.c | 20 +++---- drivers/scsi/bfa/bfa_ioc_ct.c | 4 +- drivers/scsi/bfa/bfa_port.c | 4 +- drivers/scsi/bfa/bfa_svc.c | 110 +++++++++++++++++++-------------------- drivers/scsi/bfa/bfad.c | 2 +- drivers/scsi/bfa/bfad_im.c | 6 +-- 16 files changed, 125 insertions(+), 135 deletions(-) (limited to 'drivers/scsi/bfa/bfad_im.c') diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h index cabc6b92b25d..56a227b023ae 100644 --- a/drivers/scsi/bfa/bfa.h +++ b/drivers/scsi/bfa/bfa.h @@ -120,8 +120,8 @@ bfa_reqq_winit(struct bfa_reqq_wait_s *wqe, void (*qresume) (void *cbarg), \ struct list_head *waitq = bfa_reqq(__bfa, __reqq); \ \ - bfa_assert(((__reqq) < BFI_IOC_MAX_CQS)); \ - bfa_assert((__wqe)->qresume && (__wqe)->cbarg); \ + WARN_ON(((__reqq) >= BFI_IOC_MAX_CQS)); \ + WARN_ON(!((__wqe)->qresume && (__wqe)->cbarg)); \ \ list_add_tail(&(__wqe)->qe, waitq); \ } while (0) diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 3f7f3742e72c..6e13ba249c83 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c @@ -285,7 +285,7 @@ bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m) bfa_trc(bfa, m->mhdr.msg_class); bfa_trc(bfa, m->mhdr.msg_id); bfa_trc(bfa, m->mhdr.mtag.i2htok); - bfa_assert(0); + WARN_ON(1); bfa_trc_stop(bfa->trcmod); } @@ -433,7 +433,7 @@ bfa_iocfc_send_cfg(void *bfa_arg) struct bfa_iocfc_cfg_s *cfg = &iocfc->cfg; int i; - bfa_assert(cfg->fwcfg.num_cqs <= BFI_IOC_MAX_CQS); + WARN_ON(cfg->fwcfg.num_cqs > BFI_IOC_MAX_CQS); bfa_trc(bfa, cfg->fwcfg.num_cqs); bfa_iocfc_reset_queues(bfa); @@ -753,7 +753,7 @@ bfa_iocfc_disable_cbfn(void *bfa_arg) bfa_cb_queue(bfa, &bfa->iocfc.stop_hcb_qe, bfa_iocfc_stop_cb, bfa); else { - bfa_assert(bfa->iocfc.action == BFA_IOCFC_ACT_DISABLE); + WARN_ON(bfa->iocfc.action != BFA_IOCFC_ACT_DISABLE); bfa_cb_queue(bfa, &bfa->iocfc.dis_hcb_qe, bfa_iocfc_disable_cb, bfa); } @@ -894,7 +894,7 @@ bfa_iocfc_isr(void *bfaarg, struct bfi_mbmsg_s *m) iocfc->updateq_cbfn(iocfc->updateq_cbarg, BFA_STATUS_OK); break; default: - bfa_assert(0); + WARN_ON(1); } } @@ -1063,7 +1063,7 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo) int i; u32 km_len = 0, dm_len = 0; - bfa_assert((cfg != NULL) && (meminfo != NULL)); + WARN_ON((cfg == NULL) || (meminfo == NULL)); memset((void *)meminfo, 0, sizeof(struct bfa_meminfo_s)); meminfo->meminfo[BFA_MEM_TYPE_KVA - 1].mem_type = @@ -1117,7 +1117,7 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, bfa->fcs = BFA_FALSE; - bfa_assert((cfg != NULL) && (meminfo != NULL)); + WARN_ON((cfg == NULL) || (meminfo == NULL)); /* * initialize all memory pointers for iterative allocation diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h index 493009d880a8..913057dcb401 100644 --- a/drivers/scsi/bfa/bfa_cs.h +++ b/drivers/scsi/bfa/bfa_cs.h @@ -163,16 +163,6 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) #define bfa_trc_fp(_trcp, _data) #endif -/* - * @ BFA LOG interfaces - */ -#define bfa_assert(__cond) do { \ - if (!(__cond)) { \ - printk(KERN_ERR "assert(%s) failed at %s:%d\\n", \ - #__cond, __FILE__, __LINE__); \ - } \ -} while (0) - #define bfa_sm_fault(__mod, __event) do { \ bfa_trc(__mod, (((u32)0xDEAD << 16) | __event)); \ printk(KERN_ERR "Assertion failure: %s:%d: %d", \ diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 5e697f236ef3..f57c066725da 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -32,12 +32,12 @@ static void bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim); #define bfa_fcpim_additn(__itnim) \ list_add_tail(&(__itnim)->qe, &(__itnim)->fcpim->itnim_q) #define bfa_fcpim_delitn(__itnim) do { \ - bfa_assert(bfa_q_is_on_q(&(__itnim)->fcpim->itnim_q, __itnim)); \ + WARN_ON(!bfa_q_is_on_q(&(__itnim)->fcpim->itnim_q, __itnim)); \ bfa_itnim_update_del_itn_stats(__itnim); \ list_del(&(__itnim)->qe); \ - bfa_assert(list_empty(&(__itnim)->io_q)); \ - bfa_assert(list_empty(&(__itnim)->io_cleanup_q)); \ - bfa_assert(list_empty(&(__itnim)->pending_q)); \ + WARN_ON(!list_empty(&(__itnim)->io_q)); \ + WARN_ON(!list_empty(&(__itnim)->io_cleanup_q)); \ + WARN_ON(!list_empty(&(__itnim)->pending_q)); \ } while (0) #define bfa_itnim_online_cb(__itnim) do { \ @@ -1184,7 +1184,7 @@ bfa_itnim_iotov_start(struct bfa_itnim_s *itnim) if (itnim->fcpim->path_tov > 0) { itnim->iotov_active = BFA_TRUE; - bfa_assert(bfa_itnim_hold_io(itnim)); + WARN_ON(!bfa_itnim_hold_io(itnim)); bfa_timer_start(itnim->bfa, &itnim->timer, bfa_itnim_iotov, itnim, itnim->fcpim->path_tov); } @@ -1262,7 +1262,7 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) case BFI_ITNIM_I2H_CREATE_RSP: itnim = BFA_ITNIM_FROM_TAG(fcpim, msg.create_rsp->bfa_handle); - bfa_assert(msg.create_rsp->status == BFA_STATUS_OK); + WARN_ON(msg.create_rsp->status != BFA_STATUS_OK); bfa_stats(itnim, create_comps); bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP); break; @@ -1270,7 +1270,7 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) case BFI_ITNIM_I2H_DELETE_RSP: itnim = BFA_ITNIM_FROM_TAG(fcpim, msg.delete_rsp->bfa_handle); - bfa_assert(msg.delete_rsp->status == BFA_STATUS_OK); + WARN_ON(msg.delete_rsp->status != BFA_STATUS_OK); bfa_stats(itnim, delete_comps); bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP); break; @@ -1284,7 +1284,7 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) default: bfa_trc(bfa, m->mhdr.msg_id); - bfa_assert(0); + WARN_ON(1); } } @@ -1299,7 +1299,7 @@ bfa_itnim_create(struct bfa_s *bfa, struct bfa_rport_s *rport, void *ditn) struct bfa_itnim_s *itnim; itnim = BFA_ITNIM_FROM_TAG(fcpim, rport->rport_tag); - bfa_assert(itnim->rport == rport); + WARN_ON(itnim->rport != rport); itnim->ditn = ditn; @@ -1416,7 +1416,7 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) * requests immediately. */ bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); - bfa_assert(bfa_q_is_on_q(&ioim->itnim->pending_q, ioim)); + WARN_ON(!bfa_q_is_on_q(&ioim->itnim->pending_q, ioim)); bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, __bfa_cb_ioim_abort, ioim); break; @@ -1649,7 +1649,7 @@ bfa_ioim_sm_abort(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) break; case BFA_IOIM_SM_CLEANUP: - bfa_assert(ioim->iosp->abort_explicit == BFA_TRUE); + WARN_ON(ioim->iosp->abort_explicit != BFA_TRUE); ioim->iosp->abort_explicit = BFA_FALSE; if (bfa_ioim_send_abort(ioim)) @@ -1795,7 +1795,7 @@ bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) break; case BFA_IOIM_SM_CLEANUP: - bfa_assert(ioim->iosp->abort_explicit == BFA_TRUE); + WARN_ON(ioim->iosp->abort_explicit != BFA_TRUE); ioim->iosp->abort_explicit = BFA_FALSE; bfa_sm_set_state(ioim, bfa_ioim_sm_cleanup_qfull); break; @@ -2236,7 +2236,7 @@ bfa_ioim_sgpg_alloc(struct bfa_ioim_s *ioim) { u16 nsgpgs; - bfa_assert(ioim->nsges > BFI_SGE_INLINE); + WARN_ON(ioim->nsges <= BFI_SGE_INLINE); /* * allocate SG pages needed @@ -2444,7 +2444,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) iotag = be16_to_cpu(rsp->io_tag); ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); - bfa_assert(ioim->iotag == iotag); + WARN_ON(ioim->iotag != iotag); bfa_trc(ioim->bfa, ioim->iotag); bfa_trc(ioim->bfa, rsp->io_status); @@ -2475,13 +2475,13 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) case BFI_IOIM_STS_PROTO_ERR: bfa_stats(ioim->itnim, iocom_proto_err); - bfa_assert(rsp->reuse_io_tag); + WARN_ON(!rsp->reuse_io_tag); evt = BFA_IOIM_SM_COMP; break; case BFI_IOIM_STS_SQER_NEEDED: bfa_stats(ioim->itnim, iocom_sqer_needed); - bfa_assert(rsp->reuse_io_tag == 0); + WARN_ON(rsp->reuse_io_tag != 0); evt = BFA_IOIM_SM_SQRETRY; break; @@ -2510,7 +2510,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) break; default: - bfa_assert(0); + WARN_ON(1); } bfa_sm_send_event(ioim, evt); @@ -2527,7 +2527,7 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m) iotag = be16_to_cpu(rsp->io_tag); ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); - bfa_assert(BFA_IOIM_TAG_2_ID(ioim->iotag) == iotag); + WARN_ON(BFA_IOIM_TAG_2_ID(ioim->iotag) != iotag); bfa_trc_fp(ioim->bfa, ioim->iotag); bfa_ioim_cb_profile_comp(fcpim, ioim); @@ -2944,7 +2944,7 @@ bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun) return !memcmp(&tskim->lun, &lun, sizeof(lun)); default: - bfa_assert(0); + WARN_ON(1); } return BFA_FALSE; @@ -3190,7 +3190,7 @@ bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) u16 tsk_tag = be16_to_cpu(rsp->tsk_tag); tskim = BFA_TSKIM_FROM_TAG(fcpim, tsk_tag); - bfa_assert(tskim->tsk_tag == tsk_tag); + WARN_ON(tskim->tsk_tag != tsk_tag); tskim->tsk_status = rsp->tsk_status; @@ -3225,7 +3225,7 @@ bfa_tskim_alloc(struct bfa_s *bfa, struct bfad_tskim_s *dtsk) void bfa_tskim_free(struct bfa_tskim_s *tskim) { - bfa_assert(bfa_q_is_on_q_func(&tskim->itnim->tsk_q, &tskim->qe)); + WARN_ON(!bfa_q_is_on_q_func(&tskim->itnim->tsk_q, &tskim->qe)); list_del(&tskim->qe); list_add_tail(&tskim->qe, &tskim->fcpim->tskim_free_q); } diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index e3a41b88a11b..f674f9318629 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c @@ -920,7 +920,7 @@ bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs) INIT_LIST_HEAD(&fabric->vport_q); INIT_LIST_HEAD(&fabric->vf_q); fabric->lps = bfa_lps_alloc(fcs->bfa); - bfa_assert(fabric->lps); + WARN_ON(!fabric->lps); /* * Initialize fabric delete completion handler. Fabric deletion is @@ -1317,7 +1317,7 @@ bfa_fcs_port_event_handler(void *cbarg, enum bfa_port_linkstate event) break; default: - bfa_assert(0); + WARN_ON(1); } } @@ -1364,7 +1364,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf) * drop frame if vfid is unknown */ if (!fabric) { - bfa_assert(0); + WARN_ON(1); bfa_stats(fcs, uf.vfid_unknown); bfa_uf_free(uf); return; diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c index 5736ef8c592f..e7b49f4cb51f 100644 --- a/drivers/scsi/bfa/bfa_fcs_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c @@ -536,7 +536,7 @@ bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport) if (bfa_itnim == NULL) { bfa_trc(port->fcs, rport->pwwn); bfa_fcb_itnim_free(port->fcs->bfad, itnim_drv); - bfa_assert(0); + WARN_ON(1); return NULL; } @@ -700,7 +700,7 @@ bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port, wwn_t rpwwn) if (!rport) return NULL; - bfa_assert(rport->itnim != NULL); + WARN_ON(rport->itnim == NULL); return rport->itnim; } @@ -729,7 +729,7 @@ bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn, { struct bfa_fcs_itnim_s *itnim = NULL; - bfa_assert(port != NULL); + WARN_ON(port == NULL); itnim = bfa_fcs_itnim_lookup(port, rpwwn); @@ -746,7 +746,7 @@ bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port, wwn_t rpwwn) { struct bfa_fcs_itnim_s *itnim = NULL; - bfa_assert(port != NULL); + WARN_ON(port == NULL); itnim = bfa_fcs_itnim_lookup(port, rpwwn); @@ -778,6 +778,6 @@ bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, break; default: - bfa_assert(0); + WARN_ON(1); } } diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index eb804980cde9..4e2eb92ba028 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c @@ -351,7 +351,7 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, * This is a different device with the same pid. Old device * disappeared. Send implicit LOGO to old device. */ - bfa_assert(rport->pwwn != plogi->port_name); + WARN_ON(rport->pwwn == plogi->port_name); bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); /* @@ -364,7 +364,7 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, /* * PLOGI crossing each other. */ - bfa_assert(rport->pwwn == WWN_NULL); + WARN_ON(rport->pwwn != WWN_NULL); bfa_fcs_rport_plogi(rport, rx_fchs, plogi); } @@ -532,19 +532,19 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port) static void bfa_fcs_lport_unknown_init(struct bfa_fcs_lport_s *port) { - bfa_assert(0); + WARN_ON(1); } static void bfa_fcs_lport_unknown_online(struct bfa_fcs_lport_s *port) { - bfa_assert(0); + WARN_ON(1); } static void bfa_fcs_lport_unknown_offline(struct bfa_fcs_lport_s *port) { - bfa_assert(0); + WARN_ON(1); } static void @@ -777,7 +777,7 @@ bfa_fcs_lport_del_rport( struct bfa_fcs_lport_s *port, struct bfa_fcs_rport_s *rport) { - bfa_assert(bfa_q_is_on_q(&port->rport_q, rport)); + WARN_ON(!bfa_q_is_on_q(&port->rport_q, rport)); list_del(&rport->qe); port->num_rports--; @@ -1005,7 +1005,7 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) */ if (port->num_rports > 0) { rport = bfa_fcs_lport_get_rport_by_pid(port, 0); - bfa_assert(rport != NULL); + WARN_ON(rport == NULL); if (rport) { bfa_trc(port->fcs, rport->pwwn); bfa_sm_send_event(rport, RPSM_EVENT_DELETE); @@ -4153,7 +4153,7 @@ bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port) for (ii = 0 ; ii < nwwns; ++ii) { rport = bfa_fcs_rport_create_by_wwn(port, wwns[ii]); - bfa_assert(rport); + WARN_ON(!rport); } } @@ -4616,7 +4616,7 @@ bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port, default: - bfa_assert(0); + WARN_ON(1); nsquery = BFA_TRUE; } } @@ -4797,7 +4797,7 @@ bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, u16 vf_id, wwn_t lpwwn) struct bfa_fcs_vport_s *vport; bfa_fcs_vf_t *vf; - bfa_assert(fcs != NULL); + WARN_ON(fcs == NULL); vf = bfa_fcs_vf_lookup(fcs, vf_id); if (vf == NULL) { diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index 711f2d992a97..caaee6f06937 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c @@ -1968,7 +1968,7 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) /* * allocate FC-4s */ - bfa_assert(bfa_fcs_lport_is_initiator(port)); + WARN_ON(!bfa_fcs_lport_is_initiator(port)); if (bfa_fcs_lport_is_initiator(port)) { rport->itnim = bfa_fcs_itnim_create(rport); @@ -2897,7 +2897,7 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, num_ents = be16_to_cpu(rpsc2_acc->num_pids); bfa_trc(rport->fcs, num_ents); if (num_ents > 0) { - bfa_assert(rpsc2_acc->port_info[0].pid != rport->pid); + WARN_ON(rpsc2_acc->port_info[0].pid == rport->pid); bfa_trc(rport->fcs, be16_to_cpu(rpsc2_acc->port_info[0].pid)); bfa_trc(rport->fcs, diff --git a/drivers/scsi/bfa/bfa_hw_cb.c b/drivers/scsi/bfa/bfa_hw_cb.c index 1fa15edabcdd..977e681ec803 100644 --- a/drivers/scsi/bfa/bfa_hw_cb.c +++ b/drivers/scsi/bfa/bfa_hw_cb.c @@ -111,7 +111,7 @@ bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs) { int i; - bfa_assert((nvecs == 1) || (nvecs == __HFN_NUMINTS)); + WARN_ON((nvecs != 1) && (nvecs != __HFN_NUMINTS)); bfa->msix.nvecs = nvecs; if (nvecs == 1) { diff --git a/drivers/scsi/bfa/bfa_hw_ct.c b/drivers/scsi/bfa/bfa_hw_ct.c index 68077c4c4d55..21018d98a07b 100644 --- a/drivers/scsi/bfa/bfa_hw_ct.c +++ b/drivers/scsi/bfa/bfa_hw_ct.c @@ -117,7 +117,7 @@ bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap, void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs) { - bfa_assert((nvecs == 1) || (nvecs == BFA_MSIX_CT_MAX)); + WARN_ON((nvecs != 1) && (nvecs != BFA_MSIX_CT_MAX)); bfa_trc(bfa, nvecs); bfa->msix.nvecs = nvecs; @@ -144,7 +144,7 @@ bfa_hwct_msix_install(struct bfa_s *bfa) for (; i <= BFA_MSIX_RME_Q3; i++) bfa->msix.handler[i] = bfa_msix_rspq; - bfa_assert(i == BFA_MSIX_LPU_ERR); + WARN_ON(i != BFA_MSIX_LPU_ERR); bfa->msix.handler[BFA_MSIX_LPU_ERR] = bfa_msix_lpu_err; } diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 05b0ff93284a..431cf72f7426 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c @@ -1219,7 +1219,7 @@ bfa_ioc_sem_get(void __iomem *sem_reg) if (r32 == 0) return BFA_TRUE; - bfa_assert(cnt < BFA_SEM_SPINCNT); + WARN_ON(cnt >= BFA_SEM_SPINCNT); return BFA_FALSE; } @@ -1274,7 +1274,7 @@ bfa_ioc_lmem_init(struct bfa_ioc_s *ioc) * If memory initialization is not successful, IOC timeout will catch * such failures. */ - bfa_assert(pss_ctl & __PSS_LMEM_INIT_DONE); + WARN_ON(!(pss_ctl & __PSS_LMEM_INIT_DONE)); bfa_trc(ioc, pss_ctl); pss_ctl &= ~(__PSS_LMEM_INIT_DONE | __PSS_LMEM_INIT_EN); @@ -1503,7 +1503,7 @@ bfa_ioc_mbox_send(struct bfa_ioc_s *ioc, void *ioc_msg, int len) bfa_trc(ioc, msgp[0]); bfa_trc(ioc, len); - bfa_assert(len <= BFI_IOC_MSGLEN_MAX); + WARN_ON(len > BFI_IOC_MSGLEN_MAX); /* * first write msg to mailbox registers @@ -2010,7 +2010,7 @@ bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *m) default: bfa_trc(ioc, msg->mh.msg_id); - bfa_assert(0); + WARN_ON(1); } } @@ -2345,7 +2345,7 @@ bfa_ioc_get_type(struct bfa_ioc_s *ioc) else if (ioc->ioc_mc == BFI_MC_LL) return BFA_IOC_TYPE_LL; else { - bfa_assert(ioc->ioc_mc == BFI_MC_LL); + WARN_ON(ioc->ioc_mc != BFI_MC_LL); return BFA_IOC_TYPE_LL; } } @@ -2369,7 +2369,7 @@ bfa_ioc_get_adapter_fw_ver(struct bfa_ioc_s *ioc, char *fw_ver) void bfa_ioc_get_pci_chip_rev(struct bfa_ioc_s *ioc, char *chip_rev) { - bfa_assert(chip_rev); + WARN_ON(!chip_rev); memset((void *)chip_rev, 0, BFA_IOC_CHIP_REV_LEN); @@ -2401,7 +2401,7 @@ bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) { struct bfi_ioc_attr_s *ioc_attr; - bfa_assert(model); + WARN_ON(!model); memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); ioc_attr = ioc->attr; @@ -2772,8 +2772,8 @@ bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer, void (*timercb) (void *), void *arg, unsigned int timeout) { - bfa_assert(timercb != NULL); - bfa_assert(!bfa_q_is_on_q(&mod->timer_q, timer)); + WARN_ON(timercb == NULL); + WARN_ON(bfa_q_is_on_q(&mod->timer_q, timer)); timer->timeout = timeout; timer->timercb = timercb; @@ -2788,7 +2788,7 @@ bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer, void bfa_timer_stop(struct bfa_timer_s *timer) { - bfa_assert(!list_empty(&timer->qe)); + WARN_ON(list_empty(&timer->qe)); list_del(&timer->qe); } diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 9da55a836bfb..ccfecfca0745 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c @@ -113,7 +113,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) /* * Use count cannot be non-zero and chip in uninitialized state. */ - bfa_assert(ioc_fwstate != BFI_IOC_UNINIT); + WARN_ON(ioc_fwstate == BFI_IOC_UNINIT); /* * Check if another driver with a different firmware is active @@ -158,7 +158,7 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) */ bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); usecnt = readl(ioc->ioc_regs.ioc_usage_reg); - bfa_assert(usecnt > 0); + WARN_ON(usecnt <= 0); usecnt--; writel(usecnt, ioc->ioc_regs.ioc_usage_reg); diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c index 45b3486cca9c..3f8e9d6066ec 100644 --- a/drivers/scsi/bfa/bfa_port.c +++ b/drivers/scsi/bfa/bfa_port.c @@ -186,7 +186,7 @@ bfa_port_isr(void *cbarg, struct bfi_mbmsg_s *m) break; default: - bfa_assert(0); + WARN_ON(1); } } @@ -435,7 +435,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, { struct timeval tv; - bfa_assert(port); + WARN_ON(!port); port->dev = dev; port->ioc = ioc; diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index b7df5534da85..d33e93a7a672 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c @@ -309,7 +309,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) return; if (plkd_validate_logrec(pl_rec)) { - bfa_assert(0); + WARN_ON(1); return; } @@ -601,15 +601,15 @@ bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, bfa_fcxp_get_sglen_t sglen_cbfn) { - bfa_assert(bfa != NULL); + WARN_ON(bfa == NULL); bfa_trc(bfa, fcxp->fcxp_tag); if (n_sgles == 0) { *use_ibuf = 1; } else { - bfa_assert(*sga_cbfn != NULL); - bfa_assert(*sglen_cbfn != NULL); + WARN_ON(*sga_cbfn == NULL); + WARN_ON(*sglen_cbfn == NULL); *use_ibuf = 0; *r_sga_cbfn = sga_cbfn; @@ -621,7 +621,7 @@ bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, * alloc required sgpgs */ if (n_sgles > BFI_SGE_INLINE) - bfa_assert(0); + WARN_ON(1); } } @@ -635,7 +635,7 @@ bfa_fcxp_init(struct bfa_fcxp_s *fcxp, bfa_fcxp_get_sglen_t rsp_sglen_cbfn) { - bfa_assert(bfa != NULL); + WARN_ON(bfa == NULL); bfa_trc(bfa, fcxp->fcxp_tag); @@ -672,7 +672,7 @@ bfa_fcxp_put(struct bfa_fcxp_s *fcxp) return; } - bfa_assert(bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); + WARN_ON(!bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); list_del(&fcxp->qe); list_add_tail(&fcxp->qe, &mod->fcxp_free_q); } @@ -721,7 +721,7 @@ hal_fcxp_send_comp(struct bfa_s *bfa, struct bfi_fcxp_send_rsp_s *fcxp_rsp) fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); - bfa_assert(fcxp->send_cbfn != NULL); + WARN_ON(fcxp->send_cbfn == NULL); hal_fcxp_rx_plog(mod->bfa, fcxp, fcxp_rsp); @@ -877,13 +877,13 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) BFA_FCXP_REQ_PLD_PA(fcxp)); } else { if (fcxp->nreq_sgles > 0) { - bfa_assert(fcxp->nreq_sgles == 1); + WARN_ON(fcxp->nreq_sgles != 1); hal_fcxp_set_local_sges(send_req->req_sge, reqi->req_tot_len, fcxp->req_sga_cbfn(fcxp->caller, 0)); } else { - bfa_assert(reqi->req_tot_len == 0); + WARN_ON(reqi->req_tot_len != 0); hal_fcxp_set_local_sges(send_req->rsp_sge, 0, 0); } } @@ -892,20 +892,20 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) * setup rsp sgles */ if (fcxp->use_irspbuf == 1) { - bfa_assert(rspi->rsp_maxlen <= BFA_FCXP_MAX_LBUF_SZ); + WARN_ON(rspi->rsp_maxlen > BFA_FCXP_MAX_LBUF_SZ); hal_fcxp_set_local_sges(send_req->rsp_sge, rspi->rsp_maxlen, BFA_FCXP_RSP_PLD_PA(fcxp)); } else { if (fcxp->nrsp_sgles > 0) { - bfa_assert(fcxp->nrsp_sgles == 1); + WARN_ON(fcxp->nrsp_sgles != 1); hal_fcxp_set_local_sges(send_req->rsp_sge, rspi->rsp_maxlen, fcxp->rsp_sga_cbfn(fcxp->caller, 0)); } else { - bfa_assert(rspi->rsp_maxlen == 0); + WARN_ON(rspi->rsp_maxlen != 0); hal_fcxp_set_local_sges(send_req->rsp_sge, 0, 0); } } @@ -950,7 +950,7 @@ bfa_fcxp_alloc(void *caller, struct bfa_s *bfa, int nreq_sgles, { struct bfa_fcxp_s *fcxp = NULL; - bfa_assert(bfa != NULL); + WARN_ON(bfa == NULL); fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa)); if (fcxp == NULL) @@ -977,7 +977,7 @@ bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp) struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; void *reqbuf; - bfa_assert(fcxp->use_ireqbuf == 1); + WARN_ON(fcxp->use_ireqbuf != 1); reqbuf = ((u8 *)mod->req_pld_list_kva) + fcxp->fcxp_tag * mod->req_pld_sz; return reqbuf; @@ -1004,7 +1004,7 @@ bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp) struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; void *rspbuf; - bfa_assert(fcxp->use_irspbuf == 1); + WARN_ON(fcxp->use_irspbuf != 1); rspbuf = ((u8 *)mod->rsp_pld_list_kva) + fcxp->fcxp_tag * mod->rsp_pld_sz; @@ -1023,7 +1023,7 @@ bfa_fcxp_free(struct bfa_fcxp_s *fcxp) { struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; - bfa_assert(fcxp != NULL); + WARN_ON(fcxp == NULL); bfa_trc(mod->bfa, fcxp->fcxp_tag); bfa_fcxp_put(fcxp); } @@ -1102,7 +1102,7 @@ bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) { bfa_trc(fcxp->fcxp_mod->bfa, fcxp->fcxp_tag); - bfa_assert(0); + WARN_ON(1); return BFA_STATUS_OK; } @@ -1117,7 +1117,7 @@ bfa_fcxp_alloc_wait(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe, { struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); - bfa_assert(list_empty(&mod->fcxp_free_q)); + WARN_ON(!list_empty(&mod->fcxp_free_q)); wqe->alloc_cbfn = alloc_cbfn; wqe->alloc_cbarg = alloc_cbarg; @@ -1138,7 +1138,7 @@ bfa_fcxp_walloc_cancel(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe) { struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); - bfa_assert(bfa_q_is_on_q(&mod->wait_q, wqe)); + WARN_ON(!bfa_q_is_on_q(&mod->wait_q, wqe)); list_del(&wqe->qe); } @@ -1169,7 +1169,7 @@ bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) default: bfa_trc(bfa, msg->mhdr.msg_id); - bfa_assert(0); + WARN_ON(1); } } @@ -1555,7 +1555,7 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp) struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); struct bfa_lps_s *lps; - bfa_assert(rsp->lp_tag < mod->num_lps); + WARN_ON(rsp->lp_tag >= mod->num_lps); lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); lps->status = rsp->status; @@ -1603,7 +1603,7 @@ bfa_lps_logout_rsp(struct bfa_s *bfa, struct bfi_lps_logout_rsp_s *rsp) struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); struct bfa_lps_s *lps; - bfa_assert(rsp->lp_tag < mod->num_lps); + WARN_ON(rsp->lp_tag >= mod->num_lps); lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); @@ -1656,7 +1656,7 @@ bfa_lps_send_login(struct bfa_lps_s *lps) struct bfi_lps_login_req_s *m; m = bfa_reqq_next(lps->bfa, lps->reqq); - bfa_assert(m); + WARN_ON(!m); bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ, bfa_lpuid(lps->bfa)); @@ -1681,7 +1681,7 @@ bfa_lps_send_logout(struct bfa_lps_s *lps) struct bfi_lps_logout_req_s *m; m = bfa_reqq_next(lps->bfa, lps->reqq); - bfa_assert(m); + WARN_ON(!m); bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ, bfa_lpuid(lps->bfa)); @@ -1700,7 +1700,7 @@ bfa_lps_send_set_n2n_pid(struct bfa_lps_s *lps) struct bfi_lps_n2n_pid_req_s *m; m = bfa_reqq_next(lps->bfa, lps->reqq); - bfa_assert(m); + WARN_ON(!m); bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ, bfa_lpuid(lps->bfa)); @@ -1969,7 +1969,7 @@ bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *m) default: bfa_trc(bfa, m->mhdr.msg_id); - bfa_assert(0); + WARN_ON(1); } } @@ -2099,7 +2099,7 @@ bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport, bfa_fcport_update_linkinfo(fcport); bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); - bfa_assert(fcport->event_cbfn); + WARN_ON(!fcport->event_cbfn); bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE); break; @@ -2150,7 +2150,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, case BFA_FCPORT_SM_LINKUP: bfa_fcport_update_linkinfo(fcport); bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); - bfa_assert(fcport->event_cbfn); + WARN_ON(!fcport->event_cbfn); bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkup"); if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { @@ -2754,7 +2754,7 @@ bfa_fcport_scn(struct bfa_fcport_s *fcport, enum bfa_port_linkstate event, bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN); break; default: - bfa_assert(0); + WARN_ON(1); } } @@ -3219,8 +3219,8 @@ bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn) int link_bm = 0; bfa_trc(fcport->bfa, fcport->cfg.trunked); - bfa_assert(scn->trunk_state == BFA_TRUNK_ONLINE || - scn->trunk_state == BFA_TRUNK_OFFLINE); + WARN_ON(scn->trunk_state != BFA_TRUNK_ONLINE && + scn->trunk_state != BFA_TRUNK_OFFLINE); bfa_trc(fcport->bfa, trunk->attr.state); bfa_trc(fcport->bfa, scn->trunk_state); @@ -3329,9 +3329,9 @@ bfa_fcport_init(struct bfa_s *bfa) fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc); fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc); - bfa_assert(fcport->cfg.maxfrsize); - bfa_assert(fcport->cfg.rx_bbcredit); - bfa_assert(fcport->speed_sup); + WARN_ON(!fcport->cfg.maxfrsize); + WARN_ON(!fcport->cfg.rx_bbcredit); + WARN_ON(!fcport->speed_sup); } /* @@ -3428,7 +3428,7 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) break; default: - bfa_assert(0); + WARN_ON(1); break; } } @@ -4310,8 +4310,8 @@ bfa_rport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, mod->rps_list = rp; mod->num_rports = cfg->fwcfg.num_rports; - bfa_assert(mod->num_rports && - !(mod->num_rports & (mod->num_rports - 1))); + WARN_ON(!mod->num_rports || + (mod->num_rports & (mod->num_rports - 1))); for (i = 0; i < mod->num_rports; i++, rp++) { memset(rp, 0, sizeof(struct bfa_rport_s)); @@ -4379,7 +4379,7 @@ bfa_rport_free(struct bfa_rport_s *rport) { struct bfa_rport_mod_s *mod = BFA_RPORT_MOD(rport->bfa); - bfa_assert(bfa_q_is_on_q(&mod->rp_active_q, rport)); + WARN_ON(!bfa_q_is_on_q(&mod->rp_active_q, rport)); list_del(&rport->qe); list_add_tail(&rport->qe, &mod->rp_free_q); } @@ -4492,13 +4492,13 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m) rp = BFA_RPORT_FROM_TAG(bfa, msg.create_rsp->bfa_handle); rp->fw_handle = msg.create_rsp->fw_handle; rp->qos_attr = msg.create_rsp->qos_attr; - bfa_assert(msg.create_rsp->status == BFA_STATUS_OK); + WARN_ON(msg.create_rsp->status != BFA_STATUS_OK); bfa_sm_send_event(rp, BFA_RPORT_SM_FWRSP); break; case BFI_RPORT_I2H_DELETE_RSP: rp = BFA_RPORT_FROM_TAG(bfa, msg.delete_rsp->bfa_handle); - bfa_assert(msg.delete_rsp->status == BFA_STATUS_OK); + WARN_ON(msg.delete_rsp->status != BFA_STATUS_OK); bfa_sm_send_event(rp, BFA_RPORT_SM_FWRSP); break; @@ -4510,7 +4510,7 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m) default: bfa_trc(bfa, m->mhdr.msg_id); - bfa_assert(0); + WARN_ON(1); } } @@ -4534,7 +4534,7 @@ bfa_rport_create(struct bfa_s *bfa, void *rport_drv) rp->rport_drv = rport_drv; memset(&rp->stats, 0, sizeof(rp->stats)); - bfa_assert(bfa_sm_cmp_state(rp, bfa_rport_sm_uninit)); + WARN_ON(!bfa_sm_cmp_state(rp, bfa_rport_sm_uninit)); bfa_sm_send_event(rp, BFA_RPORT_SM_CREATE); return rp; @@ -4543,7 +4543,7 @@ bfa_rport_create(struct bfa_s *bfa, void *rport_drv) void bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info) { - bfa_assert(rport_info->max_frmsz != 0); + WARN_ON(rport_info->max_frmsz == 0); /* * Some JBODs are seen to be not setting PDU size correctly in PLOGI @@ -4561,8 +4561,8 @@ bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info) void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed) { - bfa_assert(speed != 0); - bfa_assert(speed != BFA_PORT_SPEED_AUTO); + WARN_ON(speed == 0); + WARN_ON(speed == BFA_PORT_SPEED_AUTO); rport->rport_info.speed = speed; bfa_sm_send_event(rport, BFA_RPORT_SM_SET_SPEED); @@ -4622,7 +4622,7 @@ bfa_sgpg_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, sgpg_pa.pa = mod->sgpg_arr_pa; mod->free_sgpgs = mod->num_sgpgs; - bfa_assert(!(sgpg_pa.pa & (sizeof(struct bfi_sgpg_s) - 1))); + WARN_ON(sgpg_pa.pa & (sizeof(struct bfi_sgpg_s) - 1)); for (i = 0; i < mod->num_sgpgs; i++) { memset(hsgpg, 0, sizeof(*hsgpg)); @@ -4677,7 +4677,7 @@ bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs) for (i = 0; i < nsgpgs; i++) { bfa_q_deq(&mod->sgpg_q, &hsgpg); - bfa_assert(hsgpg); + WARN_ON(!hsgpg); list_add_tail(&hsgpg->qe, sgpg_q); } @@ -4694,7 +4694,7 @@ bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpg) bfa_trc_fp(bfa, nsgpg); mod->free_sgpgs += nsgpg; - bfa_assert(mod->free_sgpgs <= mod->num_sgpgs); + WARN_ON(mod->free_sgpgs > mod->num_sgpgs); list_splice_tail_init(sgpg_q, &mod->sgpg_q); @@ -4724,8 +4724,8 @@ bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpg) { struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); - bfa_assert(nsgpg > 0); - bfa_assert(nsgpg > mod->free_sgpgs); + WARN_ON(nsgpg <= 0); + WARN_ON(nsgpg <= mod->free_sgpgs); wqe->nsgpg_total = wqe->nsgpg = nsgpg; @@ -4736,7 +4736,7 @@ bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpg) /* * no one else is waiting for SGPG */ - bfa_assert(list_empty(&mod->sgpg_wait_q)); + WARN_ON(!list_empty(&mod->sgpg_wait_q)); list_splice_tail_init(&mod->sgpg_q, &wqe->sgpg_q); wqe->nsgpg -= mod->free_sgpgs; mod->free_sgpgs = 0; @@ -4750,7 +4750,7 @@ bfa_sgpg_wcancel(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe) { struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); - bfa_assert(bfa_q_is_on_q(&mod->sgpg_wait_q, wqe)); + WARN_ON(!bfa_q_is_on_q(&mod->sgpg_wait_q, wqe)); list_del(&wqe->qe); if (wqe->nsgpg_total != wqe->nsgpg) @@ -4982,7 +4982,7 @@ uf_recv(struct bfa_s *bfa, struct bfi_uf_frm_rcvd_s *m) uf->data_ptr = buf; uf->data_len = m->xfr_len; - bfa_assert(uf->data_len >= sizeof(struct fchs_s)); + WARN_ON(uf->data_len < sizeof(struct fchs_s)); if (uf->data_len == sizeof(struct fchs_s)) { bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_UF, BFA_PL_EID_RX, @@ -5072,7 +5072,7 @@ bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) default: bfa_trc(bfa, msg->mhdr.msg_id); - bfa_assert(0); + WARN_ON(1); } } diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index c80540e576cd..4e94d28ae328 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -532,7 +532,7 @@ bfad_hal_mem_release(struct bfad_s *bfad) (dma_addr_t) meminfo_elem->dma); break; default: - bfa_assert(0); + WARN_ON(1); break; } } diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 53cea3d33351..f0bcda8f077f 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -449,7 +449,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv) struct bfad_im_s *im = itnim_drv->im; /* online to free state transtion should not happen */ - bfa_assert(itnim_drv->state != ITNIM_STATE_ONLINE); + WARN_ON(itnim_drv->state == ITNIM_STATE_ONLINE); itnim_drv->queue_work = 1; /* offline request is not yet done, use the same request to free */ @@ -664,7 +664,7 @@ bfad_im_port_clean(struct bfad_im_port_s *im_port) } /* the itnim_mapped_list must be empty at this time */ - bfa_assert(list_empty(&im_port->itnim_mapped_list)); + WARN_ON(!list_empty(&im_port->itnim_mapped_list)); spin_unlock_irqrestore(&bfad->bfad_lock, flags); } @@ -1111,7 +1111,7 @@ bfad_im_itnim_work_handler(struct work_struct *work) kfree(itnim); break; default: - bfa_assert(0); + WARN_ON(1); break; } -- cgit v1.2.3 From 2f2f40a45845e52fbbe07bcd3e09ccff44feb01b Mon Sep 17 00:00:00 2001 From: Jing Huang Date: Sun, 26 Dec 2010 21:48:53 -0800 Subject: [SCSI] bfa: remove inactive functions This patch removes some inactive functions and macros. Signed-off-by: Jing Huang Signed-off-by: James Bottomley --- drivers/scsi/bfa/Makefile | 2 -- drivers/scsi/bfa/bfa_core.c | 8 -------- drivers/scsi/bfa/bfa_cs.h | 35 ----------------------------------- drivers/scsi/bfa/bfa_fcpim.c | 23 ----------------------- drivers/scsi/bfa/bfa_svc.c | 4 ---- drivers/scsi/bfa/bfad.c | 1 - drivers/scsi/bfa/bfad_im.c | 1 - 7 files changed, 74 deletions(-) (limited to 'drivers/scsi/bfa/bfad_im.c') diff --git a/drivers/scsi/bfa/Makefile b/drivers/scsi/bfa/Makefile index ed26a6a97a44..4ce6f4942327 100644 --- a/drivers/scsi/bfa/Makefile +++ b/drivers/scsi/bfa/Makefile @@ -4,5 +4,3 @@ bfa-y := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o bfa-y += bfa_ioc.o bfa_ioc_cb.o bfa_ioc_ct.o bfa_hw_cb.o bfa_hw_ct.o bfa-y += bfa_fcs.o bfa_fcs_lport.o bfa_fcs_rport.o bfa_fcs_fcpim.o bfa_fcbuild.o bfa-y += bfa_port.o bfa_fcpim.o bfa_core.o bfa_svc.o - -ccflags-y := -DBFA_PERF_BUILD diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 6e13ba249c83..d6c7e05ae4ce 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c @@ -296,8 +296,6 @@ bfa_msix_rspq(struct bfa_s *bfa, int qid) u32 pi, ci; struct list_head *waitq; - bfa_trc_fp(bfa, qid); - qid &= (BFI_IOC_MAX_CQS - 1); bfa->iocfc.hwif.hw_rspq_ack(bfa, qid); @@ -305,16 +303,10 @@ bfa_msix_rspq(struct bfa_s *bfa, int qid) ci = bfa_rspq_ci(bfa, qid); pi = bfa_rspq_pi(bfa, qid); - bfa_trc_fp(bfa, ci); - bfa_trc_fp(bfa, pi); - if (bfa->rme_process) { while (ci != pi) { m = bfa_rspq_elem(bfa, qid, ci); - bfa_assert_fp(m->mhdr.msg_class < BFI_MC_MAX); - bfa_isrs[m->mhdr.msg_class] (bfa, m); - CQ_INCR(ci, bfa->iocfc.cfg.drvcfg.num_rspq_elems); } } diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h index 913057dcb401..12bfeed268eb 100644 --- a/drivers/scsi/bfa/bfa_cs.h +++ b/drivers/scsi/bfa/bfa_cs.h @@ -107,13 +107,6 @@ bfa_trc_stop(struct bfa_trc_mod_s *trcm) trcm->stopped = 1; } -#ifdef FWTRC -extern void dc_flush(void *data); -#else -#define dc_flush(data) -#endif - - static inline void __bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) { @@ -127,12 +120,10 @@ __bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) trc->line = (u16) line; trc->data.u64 = data; trc->timestamp = BFA_TRC_TS(trcm); - dc_flush(trc); trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); if (trcm->tail == trcm->head) trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); - dc_flush(trcm); } @@ -149,32 +140,18 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) trc->line = (u16) line; trc->data.u32.u32 = data; trc->timestamp = BFA_TRC_TS(trcm); - dc_flush(trc); trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); if (trcm->tail == trcm->head) trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); - dc_flush(trcm); } -#ifndef BFA_PERF_BUILD -#define bfa_trc_fp(_trcp, _data) bfa_trc(_trcp, _data) -#else -#define bfa_trc_fp(_trcp, _data) -#endif - #define bfa_sm_fault(__mod, __event) do { \ bfa_trc(__mod, (((u32)0xDEAD << 16) | __event)); \ printk(KERN_ERR "Assertion failure: %s:%d: %d", \ __FILE__, __LINE__, (__event)); \ } while (0) -#ifndef BFA_PERF_BUILD -#define bfa_assert_fp(__cond) bfa_assert(__cond) -#else -#define bfa_assert_fp(__cond) -#endif - /* BFA queue definitions */ #define bfa_q_first(_q) ((void *)(((struct list_head *) (_q))->next)) #define bfa_q_next(_qe) (((struct list_head *) (_qe))->next) @@ -197,7 +174,6 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) bfa_q_prev(bfa_q_next(*((struct list_head **) _qe))) = \ (struct list_head *) (_q); \ bfa_q_next(_q) = bfa_q_next(*((struct list_head **) _qe));\ - BFA_Q_DBG_INIT(*((struct list_head **) _qe)); \ } else { \ *((struct list_head **) (_qe)) = (struct list_head *) NULL;\ } \ @@ -212,7 +188,6 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) bfa_q_next(bfa_q_prev(*((struct list_head **) _qe))) = \ (struct list_head *) (_q); \ bfa_q_prev(_q) = bfa_q_prev(*(struct list_head **) _qe);\ - BFA_Q_DBG_INIT(*((struct list_head **) _qe)); \ } else { \ *((struct list_head **) (_qe)) = (struct list_head *) NULL;\ } \ @@ -234,16 +209,6 @@ bfa_q_is_on_q_func(struct list_head *q, struct list_head *qe) return 0; } -/* - * #ifdef BFA_DEBUG (Using bfa_assert to check for debug_build is not - * consistent across modules) - */ -#ifndef BFA_PERF_BUILD -#define BFA_Q_DBG_INIT(_qe) bfa_q_qe_init(_qe) -#else -#define BFA_Q_DBG_INIT(_qe) -#endif - #define bfa_q_is_on_q(_q, _qe) \ bfa_q_is_on_q_func(_q, (struct list_head *)(_qe)) diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index f57c066725da..a4989a02e494 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -1367,9 +1367,6 @@ bfa_itnim_clear_stats(struct bfa_itnim_s *itnim) static void bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) { - bfa_trc_fp(ioim->bfa, ioim->iotag); - bfa_trc_fp(ioim->bfa, event); - switch (event) { case BFA_IOIM_SM_START: if (!bfa_itnim_is_online(ioim->itnim)) { @@ -1479,9 +1476,6 @@ bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) static void bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) { - bfa_trc_fp(ioim->bfa, ioim->iotag); - bfa_trc_fp(ioim->bfa, event); - switch (event) { case BFA_IOIM_SM_COMP_GOOD: bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); @@ -1563,9 +1557,6 @@ bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) static void bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) { - bfa_trc_fp(ioim->bfa, ioim->iotag); - bfa_trc_fp(ioim->bfa, event); - switch (event) { case BFA_IOIM_SM_FREE: /* abts and rrq done. Now retry the IO with new tag */ @@ -1886,9 +1877,6 @@ bfa_ioim_sm_cleanup_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) static void bfa_ioim_sm_hcb(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) { - bfa_trc_fp(ioim->bfa, ioim->iotag); - bfa_trc_fp(ioim->bfa, event); - switch (event) { case BFA_IOIM_SM_HCB: bfa_sm_set_state(ioim, bfa_ioim_sm_uninit); @@ -2529,9 +2517,7 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m) ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); WARN_ON(BFA_IOIM_TAG_2_ID(ioim->iotag) != iotag); - bfa_trc_fp(ioim->bfa, ioim->iotag); bfa_ioim_cb_profile_comp(fcpim, ioim); - bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD); } @@ -2608,7 +2594,6 @@ bfa_ioim_alloc(struct bfa_s *bfa, struct bfad_ioim_s *dio, fcpim->ios_active++; list_add_tail(&ioim->qe, &itnim->io_q); - bfa_trc_fp(ioim->bfa, ioim->iotag); return ioim; } @@ -2618,12 +2603,6 @@ bfa_ioim_free(struct bfa_ioim_s *ioim) { struct bfa_fcpim_mod_s *fcpim = ioim->fcpim; - bfa_trc_fp(ioim->bfa, ioim->iotag); - bfa_assert_fp(bfa_sm_cmp_state(ioim, bfa_ioim_sm_uninit)); - - bfa_assert_fp(list_empty(&ioim->sgpg_q) || - (ioim->nsges > BFI_SGE_INLINE)); - if (ioim->nsgpgs > 0) bfa_sgpg_mfree(ioim->bfa, &ioim->sgpg_q, ioim->nsgpgs); @@ -2638,8 +2617,6 @@ bfa_ioim_free(struct bfa_ioim_s *ioim) void bfa_ioim_start(struct bfa_ioim_s *ioim) { - bfa_trc_fp(ioim->bfa, ioim->iotag); - bfa_ioim_cb_profile_start(ioim->fcpim, ioim); /* diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index d33e93a7a672..6577d0d922f6 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c @@ -4670,8 +4670,6 @@ bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs) struct bfa_sgpg_s *hsgpg; int i; - bfa_trc_fp(bfa, nsgpgs); - if (mod->free_sgpgs < nsgpgs) return BFA_STATUS_ENOMEM; @@ -4691,8 +4689,6 @@ bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpg) struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); struct bfa_sgpg_wqe_s *wqe; - bfa_trc_fp(bfa, nsgpg); - mod->free_sgpgs += nsgpg; WARN_ON(mod->free_sgpgs > mod->num_sgpgs); diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 4e94d28ae328..44524cf55d33 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -1166,7 +1166,6 @@ bfad_intx(int irq, void *dev_id) spin_lock_irqsave(&bfad->bfad_lock, flags); bfa_comp_free(&bfad->bfa, &doneq); spin_unlock_irqrestore(&bfad->bfad_lock, flags); - bfa_trc_fp(bfad, irq); } return IRQ_HANDLED; diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index f0bcda8f077f..c2b36179e8e8 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -1174,7 +1174,6 @@ bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd } cmnd->host_scribble = (char *)hal_io; - bfa_trc_fp(bfad, hal_io->iotag); bfa_ioim_start(hal_io); spin_unlock_irqrestore(&bfad->bfad_lock, flags); -- cgit v1.2.3