Commit 82794a2e authored by Krishna Gudipati's avatar Krishna Gudipati Committed by James Bottomley

[SCSI] bfa: New interface to handle firmware upgrade scenario

Split bfa_fcs_init() into bfa_fcs_attach() and bfa_fcs_init().

Removed empty function definitions in FCS modules

Modified driver to call bfa_fcs_attach() and bfa_fcs_init() as needed.
Signed-off-by: default avatarKrishna Gudipati <kgudipat@brocade.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 5b098082
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
* FCS sub-modules * FCS sub-modules
*/ */
struct bfa_fcs_mod_s { struct bfa_fcs_mod_s {
void (*attach) (struct bfa_fcs_s *fcs);
void (*modinit) (struct bfa_fcs_s *fcs); void (*modinit) (struct bfa_fcs_s *fcs);
void (*modexit) (struct bfa_fcs_s *fcs); void (*modexit) (struct bfa_fcs_s *fcs);
}; };
...@@ -43,12 +44,10 @@ struct bfa_fcs_mod_s { ...@@ -43,12 +44,10 @@ struct bfa_fcs_mod_s {
#define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit } #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit }
static struct bfa_fcs_mod_s fcs_modules[] = { static struct bfa_fcs_mod_s fcs_modules[] = {
BFA_FCS_MODULE(bfa_fcs_pport), { bfa_fcs_pport_attach, NULL, NULL },
BFA_FCS_MODULE(bfa_fcs_uf), { bfa_fcs_uf_attach, NULL, NULL },
BFA_FCS_MODULE(bfa_fcs_fabric), { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit,
BFA_FCS_MODULE(bfa_fcs_vport), bfa_fcs_fabric_modexit },
BFA_FCS_MODULE(bfa_fcs_rport),
BFA_FCS_MODULE(bfa_fcs_fcpim),
}; };
/** /**
...@@ -71,16 +70,10 @@ bfa_fcs_exit_comp(void *fcs_cbarg) ...@@ -71,16 +70,10 @@ bfa_fcs_exit_comp(void *fcs_cbarg)
*/ */
/** /**
* FCS instance initialization. * fcs attach -- called once to initialize data structures at driver attach time
*
* param[in] fcs FCS instance
* param[in] bfa BFA instance
* param[in] bfad BFA driver instance
*
* return None
*/ */
void void
bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
bfa_boolean_t min_cfg) bfa_boolean_t min_cfg)
{ {
int i; int i;
...@@ -95,6 +88,23 @@ bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, ...@@ -95,6 +88,23 @@ bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
mod = &fcs_modules[i]; mod = &fcs_modules[i];
if (mod->attach)
mod->attach(fcs);
}
}
/**
* fcs initialization, called once after bfa initialization is complete
*/
void
bfa_fcs_init(struct bfa_fcs_s *fcs)
{
int i;
struct bfa_fcs_mod_s *mod;
for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
mod = &fcs_modules[i];
if (mod->modinit)
mod->modinit(fcs); mod->modinit(fcs);
} }
} }
...@@ -160,11 +170,13 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs) ...@@ -160,11 +170,13 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs)
nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]); nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]);
for (i = 0; i < nmods; i++) { for (i = 0; i < nmods; i++) {
bfa_wc_up(&fcs->wc);
mod = &fcs_modules[i]; mod = &fcs_modules[i];
if (mod->modexit) {
bfa_wc_up(&fcs->wc);
mod->modexit(fcs); mod->modexit(fcs);
} }
}
bfa_wc_wait(&fcs->wc); bfa_wc_wait(&fcs->wc);
} }
......
...@@ -55,14 +55,7 @@ bfa_fcs_pport_event_handler(void *cbarg, bfa_pport_event_t event) ...@@ -55,14 +55,7 @@ bfa_fcs_pport_event_handler(void *cbarg, bfa_pport_event_t event)
} }
void void
bfa_fcs_pport_modinit(struct bfa_fcs_s *fcs) bfa_fcs_pport_attach(struct bfa_fcs_s *fcs)
{ {
bfa_pport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, bfa_pport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, fcs);
fcs);
}
void
bfa_fcs_pport_modexit(struct bfa_fcs_s *fcs)
{
bfa_fcs_modexit_comp(fcs);
} }
...@@ -93,13 +93,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf) ...@@ -93,13 +93,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
} }
void void
bfa_fcs_uf_modinit(struct bfa_fcs_s *fcs) bfa_fcs_uf_attach(struct bfa_fcs_s *fcs)
{ {
bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs); bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs);
} }
void
bfa_fcs_uf_modexit(struct bfa_fcs_s *fcs)
{
bfa_fcs_modexit_comp(fcs);
}
...@@ -748,7 +748,8 @@ bfad_drv_init(struct bfad_s *bfad) ...@@ -748,7 +748,8 @@ bfad_drv_init(struct bfad_s *bfad)
bfa_fcs_log_init(&bfad->bfa_fcs, bfad->logmod); bfa_fcs_log_init(&bfad->bfa_fcs, bfad->logmod);
bfa_fcs_trc_init(&bfad->bfa_fcs, bfad->trcmod); bfa_fcs_trc_init(&bfad->bfa_fcs, bfad->trcmod);
bfa_fcs_aen_init(&bfad->bfa_fcs, bfad->aen); bfa_fcs_aen_init(&bfad->bfa_fcs, bfad->aen);
bfa_fcs_init(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE); bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE);
bfa_fcs_init(&bfad->bfa_fcs);
bfa_fcs_driver_info_init(&bfad->bfa_fcs, &driver_info); bfa_fcs_driver_info_init(&bfad->bfa_fcs, &driver_info);
bfa_fcs_set_fdmi_param(&bfad->bfa_fcs, fdmi_enable); bfa_fcs_set_fdmi_param(&bfad->bfa_fcs, fdmi_enable);
spin_unlock_irqrestore(&bfad->bfad_lock, flags); spin_unlock_irqrestore(&bfad->bfad_lock, flags);
......
...@@ -814,10 +814,10 @@ bfa_fcs_fabric_delete_comp(void *cbarg) ...@@ -814,10 +814,10 @@ bfa_fcs_fabric_delete_comp(void *cbarg)
*/ */
/** /**
* Module initialization * Attach time initialization
*/ */
void void
bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs)
{ {
struct bfa_fcs_fabric_s *fabric; struct bfa_fcs_fabric_s *fabric;
...@@ -841,7 +841,12 @@ bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) ...@@ -841,7 +841,12 @@ bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
bfa_wc_up(&fabric->wc); /* For the base port */ bfa_wc_up(&fabric->wc); /* For the base port */
bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CREATE); }
void
bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
{
bfa_sm_send_event(&fcs->fabric, BFA_FCS_FABRIC_SM_CREATE);
bfa_trc(fcs, 0); bfa_trc(fcs, 0);
} }
......
...@@ -822,22 +822,3 @@ void ...@@ -822,22 +822,3 @@ void
bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim) bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim)
{ {
} }
/**
* Module initialization
*/
void
bfa_fcs_fcpim_modinit(struct bfa_fcs_s *fcs)
{
}
/**
* Module cleanup
*/
void
bfa_fcs_fcpim_modexit(struct bfa_fcs_s *fcs)
{
bfa_fcs_modexit_comp(fcs);
}
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
/* /*
* fcs friend functions: only between fcs modules * fcs friend functions: only between fcs modules
*/ */
void bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs);
void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs); void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs);
void bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs); void bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs);
void bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs); void bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs);
......
...@@ -34,11 +34,6 @@ void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim); ...@@ -34,11 +34,6 @@ void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim);
void bfa_fcs_itnim_pause(struct bfa_fcs_itnim_s *itnim); void bfa_fcs_itnim_pause(struct bfa_fcs_itnim_s *itnim);
void bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim); void bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim);
/*
* Modudle init/cleanup routines.
*/
void bfa_fcs_fcpim_modinit(struct bfa_fcs_s *fcs);
void bfa_fcs_fcpim_modexit(struct bfa_fcs_s *fcs);
void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, struct fchs_s *fchs, void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, struct fchs_s *fchs,
u16 len); u16 len);
#endif /* __FCS_FCPIM_H__ */ #endif /* __FCS_FCPIM_H__ */
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
/* /*
* fcs friend functions: only between fcs modules * fcs friend functions: only between fcs modules
*/ */
void bfa_fcs_pport_modinit(struct bfa_fcs_s *fcs); void bfa_fcs_pport_attach(struct bfa_fcs_s *fcs);
void bfa_fcs_pport_modexit(struct bfa_fcs_s *fcs);
#endif /* __FCS_PPORT_H__ */ #endif /* __FCS_PPORT_H__ */
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
#include <fcs/bfa_fcs_rport.h> #include <fcs/bfa_fcs_rport.h>
void bfa_fcs_rport_modinit(struct bfa_fcs_s *fcs);
void bfa_fcs_rport_modexit(struct bfa_fcs_s *fcs);
void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs, void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs,
u16 len); u16 len);
void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport); void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
/* /*
* fcs friend functions: only between fcs modules * fcs friend functions: only between fcs modules
*/ */
void bfa_fcs_uf_modinit(struct bfa_fcs_s *fcs); void bfa_fcs_uf_attach(struct bfa_fcs_s *fcs);
void bfa_fcs_uf_modexit(struct bfa_fcs_s *fcs);
#endif /* __FCS_UF_H__ */ #endif /* __FCS_UF_H__ */
...@@ -22,13 +22,6 @@ ...@@ -22,13 +22,6 @@
#include <fcs/bfa_fcs_vport.h> #include <fcs/bfa_fcs_vport.h>
#include <defs/bfa_defs_pci.h> #include <defs/bfa_defs_pci.h>
/*
* Modudle init/cleanup routines.
*/
void bfa_fcs_vport_modinit(struct bfa_fcs_s *fcs);
void bfa_fcs_vport_modexit(struct bfa_fcs_s *fcs);
void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport); void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport);
void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport); void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport);
void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport); void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport);
......
...@@ -61,8 +61,9 @@ struct bfa_fcs_s { ...@@ -61,8 +61,9 @@ struct bfa_fcs_s {
/* /*
* bfa fcs API functions * bfa fcs API functions
*/ */
void bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
bfa_boolean_t min_cfg); bfa_boolean_t min_cfg);
void bfa_fcs_init(struct bfa_fcs_s *fcs);
void bfa_fcs_driver_info_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); 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_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable);
......
...@@ -2574,23 +2574,6 @@ bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs, ...@@ -2574,23 +2574,6 @@ bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0); FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0);
} }
/**
* Module initialization
*/
void
bfa_fcs_rport_modinit(struct bfa_fcs_s *fcs)
{
}
/**
* Module cleanup
*/
void
bfa_fcs_rport_modexit(struct bfa_fcs_s *fcs)
{
bfa_fcs_modexit_comp(fcs);
}
/** /**
* Return state of rport. * Return state of rport.
*/ */
......
...@@ -616,23 +616,6 @@ bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport) ...@@ -616,23 +616,6 @@ bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport)
bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_DELCOMP); bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_DELCOMP);
} }
/**
* Module initialization
*/
void
bfa_fcs_vport_modinit(struct bfa_fcs_s *fcs)
{
}
/**
* Module cleanup
*/
void
bfa_fcs_vport_modexit(struct bfa_fcs_s *fcs)
{
bfa_fcs_modexit_comp(fcs);
}
u32 u32
bfa_fcs_vport_get_max(struct bfa_fcs_s *fcs) bfa_fcs_vport_get_max(struct bfa_fcs_s *fcs)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment