Commit 3e98cc01 authored by Jing Huang's avatar Jing Huang Committed by James Bottomley

[SCSI] bfa: add PBC port disable handling

Add PBC port disable handling in BFA and return the appropriate status from
BFA APIs. In bfa_fcs_lport.c, handle OFFLINE event to avoid BFA_ASSERT.
Signed-off-by: default avatarJing Huang <huangj@brocade.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 41188cf5
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <bfa.h> #include <bfa.h>
#include <bfa_svc.h> #include <bfa_svc.h>
#include <bfi/bfi_pport.h> #include <bfi/bfi_pport.h>
#include <bfi/bfi_pbc.h>
#include <cs/bfa_debug.h> #include <cs/bfa_debug.h>
#include <aen/bfa_aen.h> #include <aen/bfa_aen.h>
#include <cs/bfa_plog.h> #include <cs/bfa_plog.h>
...@@ -1380,6 +1381,14 @@ bfa_status_t ...@@ -1380,6 +1381,14 @@ bfa_status_t
bfa_fcport_enable(struct bfa_s *bfa) bfa_fcport_enable(struct bfa_s *bfa)
{ {
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
struct bfa_iocfc_s *iocfc = &bfa->iocfc;
struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
/* if port is PBC disabled, return error */
if (cfgrsp->pbc_cfg.port_enabled == BFI_PBC_PORT_DISABLED) {
bfa_trc(bfa, fcport->pwwn);
return BFA_STATUS_PBC;
}
if (fcport->diag_busy) if (fcport->diag_busy)
return BFA_STATUS_DIAG_BUSY; return BFA_STATUS_DIAG_BUSY;
...@@ -1394,6 +1403,16 @@ bfa_fcport_enable(struct bfa_s *bfa) ...@@ -1394,6 +1403,16 @@ bfa_fcport_enable(struct bfa_s *bfa)
bfa_status_t bfa_status_t
bfa_fcport_disable(struct bfa_s *bfa) bfa_fcport_disable(struct bfa_s *bfa)
{ {
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
struct bfa_iocfc_s *iocfc = &bfa->iocfc;
struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
/* if port is PBC disabled, return error */
if (cfgrsp->pbc_cfg.port_enabled == BFI_PBC_PORT_DISABLED) {
bfa_trc(bfa, fcport->pwwn);
return BFA_STATUS_PBC;
}
bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DISABLE); bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DISABLE);
return BFA_STATUS_OK; return BFA_STATUS_OK;
} }
...@@ -1584,6 +1603,8 @@ void ...@@ -1584,6 +1603,8 @@ void
bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr) bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr)
{ {
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
struct bfa_iocfc_s *iocfc = &bfa->iocfc;
struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s)); bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s));
...@@ -1618,11 +1639,18 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr) ...@@ -1618,11 +1639,18 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr)
attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa);
attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa);
attr->port_state = bfa_sm_to_state(hal_pport_sm_table, fcport->sm);
if (bfa_ioc_is_disabled(&fcport->bfa->ioc)) /* PBC Disabled State */
attr->port_state = BFA_PPORT_ST_IOCDIS; if (cfgrsp->pbc_cfg.port_enabled == BFI_PBC_PORT_DISABLED)
else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc)) attr->port_state = BFA_PPORT_ST_PREBOOT_DISABLED;
attr->port_state = BFA_PPORT_ST_FWMISMATCH; else {
attr->port_state = bfa_sm_to_state(
hal_pport_sm_table, fcport->sm);
if (bfa_ioc_is_disabled(&fcport->bfa->ioc))
attr->port_state = BFA_PPORT_ST_IOCDIS;
else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc))
attr->port_state = BFA_PPORT_ST_FWMISMATCH;
}
} }
#define BFA_FCPORT_STATS_TOV 1000 #define BFA_FCPORT_STATS_TOV 1000
......
...@@ -135,6 +135,9 @@ bfa_fcs_port_sm_init(struct bfa_fcs_port_s *port, enum bfa_fcs_port_event event) ...@@ -135,6 +135,9 @@ bfa_fcs_port_sm_init(struct bfa_fcs_port_s *port, enum bfa_fcs_port_event event)
bfa_fcs_port_deleted(port); bfa_fcs_port_deleted(port);
break; break;
case BFA_FCS_PORT_SM_OFFLINE:
break;
default: default:
bfa_sm_fault(port->fcs, event); bfa_sm_fault(port->fcs, event);
} }
......
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