]> Pileus Git - ~andy/linux/commitdiff
[SCSI] bfa: Add pbc port disable check and fix LPS message name
authorKrishna Gudipati <kgudipat@brocade.com>
Mon, 13 Jun 2011 22:46:21 +0000 (15:46 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Wed, 29 Jun 2011 20:27:46 +0000 (15:27 -0500)
- Add PBC port Disabled condition check.
- Rename incorrectly named LPS I2H messages.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/bfa/bfa_port.c
drivers/scsi/bfa/bfa_port.h
drivers/scsi/bfa/bfa_svc.c
drivers/scsi/bfa/bfa_svc.h
drivers/scsi/bfa/bfi.h
drivers/scsi/bfa/bfi_ms.h

index 5ebdb6297b4c12ca239ba916ca83d0c9b3295a78..6b759364ac90f3caba69ab684c910a7311404514 100644 (file)
@@ -236,6 +236,12 @@ bfa_port_enable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn,
 {
        struct bfi_port_generic_req_s *m;
 
+       /* If port is PBC disabled, return error */
+       if (port->pbc_disabled) {
+               bfa_trc(port, BFA_STATUS_PBC);
+               return BFA_STATUS_PBC;
+       }
+
        if (bfa_ioc_is_disabled(port->ioc)) {
                bfa_trc(port, BFA_STATUS_IOC_DISABLED);
                return BFA_STATUS_IOC_DISABLED;
@@ -280,6 +286,12 @@ bfa_port_disable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn,
 {
        struct bfi_port_generic_req_s *m;
 
+       /* If port is PBC disabled, return error */
+       if (port->pbc_disabled) {
+               bfa_trc(port, BFA_STATUS_PBC);
+               return BFA_STATUS_PBC;
+       }
+
        if (bfa_ioc_is_disabled(port->ioc)) {
                bfa_trc(port, BFA_STATUS_IOC_DISABLED);
                return BFA_STATUS_IOC_DISABLED;
@@ -456,6 +468,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
        port->endis_pending = BFA_FALSE;
        port->stats_cbfn = NULL;
        port->endis_cbfn = NULL;
+       port->pbc_disabled = BFA_FALSE;
 
        bfa_ioc_mbox_regisr(port->ioc, BFI_MC_PORT, bfa_port_isr, port);
        bfa_ioc_notify_init(&port->ioc_notify, bfa_port_notify, port);
index 8b5617447dcdb7e593c86cde5999379dab20b22a..1587a6f08b26224247ed76b7c6199f9570037f52 100644 (file)
@@ -44,6 +44,7 @@ struct bfa_port_s {
        void                            *endis_cbarg;
        bfa_status_t                    endis_status;
        struct bfa_ioc_notify_s         ioc_notify;
+       bfa_boolean_t                   pbc_disabled;
 };
 
 void        bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
index d1674c6058ed34ac72baafe2a576af70a5de700e..46e8cdd31db9ba93cf94a632184b421254d735de 100644 (file)
@@ -1934,15 +1934,15 @@ bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
        msg.msg = m;
 
        switch (m->mhdr.msg_id) {
-       case BFI_LPS_H2I_LOGIN_RSP:
+       case BFI_LPS_I2H_LOGIN_RSP:
                bfa_lps_login_rsp(bfa, msg.login_rsp);
                break;
 
-       case BFI_LPS_H2I_LOGOUT_RSP:
+       case BFI_LPS_I2H_LOGOUT_RSP:
                bfa_lps_logout_rsp(bfa, msg.logout_rsp);
                break;
 
-       case BFI_LPS_H2I_CVL_EVENT:
+       case BFI_LPS_I2H_CVL_EVENT:
                bfa_lps_rx_cvl_event(bfa, msg.cvl_event);
                break;
 
@@ -3308,6 +3308,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);
 
+       if (bfa_fcport_is_pbcdisabled(bfa))
+               bfa->modules.port.pbc_disabled = BFA_TRUE;
+
        WARN_ON(!fcport->cfg.maxfrsize);
        WARN_ON(!fcport->cfg.rx_bbcredit);
        WARN_ON(!fcport->speed_sup);
@@ -3432,6 +3435,9 @@ bfa_fcport_enable(struct bfa_s *bfa)
 {
        struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
 
+       if (bfa_fcport_is_pbcdisabled(bfa))
+               return BFA_STATUS_PBC;
+
        if (bfa_ioc_is_disabled(&bfa->ioc))
                return BFA_STATUS_IOC_DISABLED;
 
@@ -3445,6 +3451,8 @@ bfa_fcport_enable(struct bfa_s *bfa)
 bfa_status_t
 bfa_fcport_disable(struct bfa_s *bfa)
 {
+       if (bfa_fcport_is_pbcdisabled(bfa))
+               return BFA_STATUS_PBC;
 
        if (bfa_ioc_is_disabled(&bfa->ioc))
                return BFA_STATUS_IOC_DISABLED;
@@ -3453,6 +3461,21 @@ bfa_fcport_disable(struct bfa_s *bfa)
        return BFA_STATUS_OK;
 }
 
+/* If PBC is disabled on port, return error */
+bfa_status_t
+bfa_fcport_is_pbcdisabled(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 (cfgrsp->pbc_cfg.port_enabled == BFI_PBC_PORT_DISABLED) {
+               bfa_trc(bfa, fcport->pwwn);
+               return BFA_STATUS_PBC;
+       }
+       return BFA_STATUS_OK;
+}
+
 /*
  * Configure port speed.
  */
@@ -3660,10 +3683,16 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr)
        attr->pport_cfg.path_tov  = bfa_fcpim_path_tov_get(bfa);
        attr->pport_cfg.q_depth  = bfa_fcpim_qdepth_get(bfa);
        attr->port_state = bfa_sm_to_state(hal_port_sm_table, fcport->sm);
-       if (bfa_ioc_is_disabled(&fcport->bfa->ioc))
-               attr->port_state = BFA_PORT_ST_IOCDIS;
-       else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc))
-               attr->port_state = BFA_PORT_ST_FWMISMATCH;
+
+       /* PBC Disabled State */
+       if (bfa_fcport_is_pbcdisabled(bfa))
+               attr->port_state = BFA_PORT_ST_PREBOOT_DISABLED;
+       else {
+               if (bfa_ioc_is_disabled(&fcport->bfa->ioc))
+                       attr->port_state = BFA_PORT_ST_IOCDIS;
+               else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc))
+                       attr->port_state = BFA_PORT_ST_FWMISMATCH;
+       }
 
        /* FCoE vlan */
        attr->fcoe_vlan = fcport->fcoe_vlan;
index 5902a45c080fe8fc6fac75a2fa6b8122b460e5d3..c5927a5cbac9631b84a46f614a3e6dae70740159 100644 (file)
@@ -524,6 +524,7 @@ bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa,
 bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn,
                                    void *cbarg);
 bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa);
+bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa);
 
 /*
  * bfa rport API functions
index d57522dd949b03256a3433f1ee1bbe6241f1b4eb..5b69d07af99c88af85ae974d92d4ccdbb5c94b3b 100644 (file)
@@ -50,7 +50,7 @@ struct bfi_mhdr_s {
        } mtag;
 };
 
-#define bfi_mhdr_2_qid(_mh)    (_mh)->mtag.h2i.qid
+#define bfi_mhdr_2_qid(_mh)    ((_mh)->mtag.h2i.qid)
 
 #define bfi_h2i_set(_mh, _mc, _op, _lpuid) do {                \
        (_mh).msg_class         = (_mc);      \
@@ -411,6 +411,7 @@ union bfi_ioc_i2h_msg_u {
 
 #define BFI_PBC_MAX_BLUNS      8
 #define BFI_PBC_MAX_VPORTS     16
+#define BFI_PBC_PORT_DISABLED  2
 
 /*
  * PBC boot lun configuration
index a29d905fe8c0db501332b2edf00a317934858195..dd2aad9ac6fe043d255469d3d381af5167d79aa6 100644 (file)
@@ -346,9 +346,9 @@ enum bfi_lps_h2i_msgs {
 };
 
 enum bfi_lps_i2h_msgs {
-       BFI_LPS_H2I_LOGIN_RSP   = BFA_I2HM(1),
-       BFI_LPS_H2I_LOGOUT_RSP  = BFA_I2HM(2),
-       BFI_LPS_H2I_CVL_EVENT   = BFA_I2HM(3),
+       BFI_LPS_I2H_LOGIN_RSP   = BFA_I2HM(1),
+       BFI_LPS_I2H_LOGOUT_RSP  = BFA_I2HM(2),
+       BFI_LPS_I2H_CVL_EVENT   = BFA_I2HM(3),
 };
 
 struct bfi_lps_login_req_s {