diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-07 02:53:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-07 02:53:30 -0400 |
commit | 4a35ecf8bf1c4b039503fa554100fe85c761de76 (patch) | |
tree | 9b75f5d5636004d9a9aa496924377379be09aa1f /drivers/scsi/bfa/bfa_lps.c | |
parent | b4d562e3c3553ac58c7120555c4e4aefbb090a2a (diff) | |
parent | fb9e2d887243499b8d28efcf80821c4f6a092395 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/bonding/bond_main.c
drivers/net/via-velocity.c
drivers/net/wireless/iwlwifi/iwl-agn.c
Diffstat (limited to 'drivers/scsi/bfa/bfa_lps.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_lps.c | 134 |
1 files changed, 125 insertions, 9 deletions
diff --git a/drivers/scsi/bfa/bfa_lps.c b/drivers/scsi/bfa/bfa_lps.c index 9844b45412b6..ad06f6189092 100644 --- a/drivers/scsi/bfa/bfa_lps.c +++ b/drivers/scsi/bfa/bfa_lps.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <bfa.h> | 18 | #include <bfa.h> |
19 | #include <bfi/bfi_lps.h> | 19 | #include <bfi/bfi_lps.h> |
20 | #include <cs/bfa_debug.h> | 20 | #include <cs/bfa_debug.h> |
21 | #include <defs/bfa_defs_pci.h> | ||
21 | 22 | ||
22 | BFA_TRC_FILE(HAL, LPS); | 23 | BFA_TRC_FILE(HAL, LPS); |
23 | BFA_MODULE(lps); | 24 | BFA_MODULE(lps); |
@@ -25,6 +26,12 @@ BFA_MODULE(lps); | |||
25 | #define BFA_LPS_MIN_LPORTS (1) | 26 | #define BFA_LPS_MIN_LPORTS (1) |
26 | #define BFA_LPS_MAX_LPORTS (256) | 27 | #define BFA_LPS_MAX_LPORTS (256) |
27 | 28 | ||
29 | /* | ||
30 | * Maximum Vports supported per physical port or vf. | ||
31 | */ | ||
32 | #define BFA_LPS_MAX_VPORTS_SUPP_CB 255 | ||
33 | #define BFA_LPS_MAX_VPORTS_SUPP_CT 190 | ||
34 | |||
28 | /** | 35 | /** |
29 | * forward declarations | 36 | * forward declarations |
30 | */ | 37 | */ |
@@ -49,7 +56,7 @@ static void bfa_lps_send_login(struct bfa_lps_s *lps); | |||
49 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); | 56 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); |
50 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); | 57 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); |
51 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); | 58 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); |
52 | 59 | static void bfa_lps_cvl_event(struct bfa_lps_s *lps); | |
53 | 60 | ||
54 | /** | 61 | /** |
55 | * lps_pvt BFA LPS private functions | 62 | * lps_pvt BFA LPS private functions |
@@ -62,6 +69,7 @@ enum bfa_lps_event { | |||
62 | BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ | 69 | BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ |
63 | BFA_LPS_SM_DELETE = 5, /* lps delete from user */ | 70 | BFA_LPS_SM_DELETE = 5, /* lps delete from user */ |
64 | BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ | 71 | BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ |
72 | BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */ | ||
65 | }; | 73 | }; |
66 | 74 | ||
67 | static void bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event); | 75 | static void bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event); |
@@ -91,6 +99,12 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
91 | bfa_sm_set_state(lps, bfa_lps_sm_login); | 99 | bfa_sm_set_state(lps, bfa_lps_sm_login); |
92 | bfa_lps_send_login(lps); | 100 | bfa_lps_send_login(lps); |
93 | } | 101 | } |
102 | if (lps->fdisc) | ||
103 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
104 | BFA_PL_EID_LOGIN, 0, "FDISC Request"); | ||
105 | else | ||
106 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
107 | BFA_PL_EID_LOGIN, 0, "FLOGI Request"); | ||
94 | break; | 108 | break; |
95 | 109 | ||
96 | case BFA_LPS_SM_LOGOUT: | 110 | case BFA_LPS_SM_LOGOUT: |
@@ -101,6 +115,7 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
101 | bfa_lps_free(lps); | 115 | bfa_lps_free(lps); |
102 | break; | 116 | break; |
103 | 117 | ||
118 | case BFA_LPS_SM_RX_CVL: | ||
104 | case BFA_LPS_SM_OFFLINE: | 119 | case BFA_LPS_SM_OFFLINE: |
105 | break; | 120 | break; |
106 | 121 | ||
@@ -112,7 +127,7 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
112 | break; | 127 | break; |
113 | 128 | ||
114 | default: | 129 | default: |
115 | bfa_assert(0); | 130 | bfa_sm_fault(lps->bfa, event); |
116 | } | 131 | } |
117 | } | 132 | } |
118 | 133 | ||
@@ -127,10 +142,25 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
127 | 142 | ||
128 | switch (event) { | 143 | switch (event) { |
129 | case BFA_LPS_SM_FWRSP: | 144 | case BFA_LPS_SM_FWRSP: |
130 | if (lps->status == BFA_STATUS_OK) | 145 | if (lps->status == BFA_STATUS_OK) { |
131 | bfa_sm_set_state(lps, bfa_lps_sm_online); | 146 | bfa_sm_set_state(lps, bfa_lps_sm_online); |
132 | else | 147 | if (lps->fdisc) |
148 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
149 | BFA_PL_EID_LOGIN, 0, "FDISC Accept"); | ||
150 | else | ||
151 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
152 | BFA_PL_EID_LOGIN, 0, "FLOGI Accept"); | ||
153 | } else { | ||
133 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 154 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
155 | if (lps->fdisc) | ||
156 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
157 | BFA_PL_EID_LOGIN, 0, | ||
158 | "FDISC Fail (RJT or timeout)"); | ||
159 | else | ||
160 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
161 | BFA_PL_EID_LOGIN, 0, | ||
162 | "FLOGI Fail (RJT or timeout)"); | ||
163 | } | ||
134 | bfa_lps_login_comp(lps); | 164 | bfa_lps_login_comp(lps); |
135 | break; | 165 | break; |
136 | 166 | ||
@@ -139,7 +169,7 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
139 | break; | 169 | break; |
140 | 170 | ||
141 | default: | 171 | default: |
142 | bfa_assert(0); | 172 | bfa_sm_fault(lps->bfa, event); |
143 | } | 173 | } |
144 | } | 174 | } |
145 | 175 | ||
@@ -162,8 +192,16 @@ bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
162 | bfa_reqq_wcancel(&lps->wqe); | 192 | bfa_reqq_wcancel(&lps->wqe); |
163 | break; | 193 | break; |
164 | 194 | ||
195 | case BFA_LPS_SM_RX_CVL: | ||
196 | /* | ||
197 | * Login was not even sent out; so when getting out | ||
198 | * of this state, it will appear like a login retry | ||
199 | * after Clear virtual link | ||
200 | */ | ||
201 | break; | ||
202 | |||
165 | default: | 203 | default: |
166 | bfa_assert(0); | 204 | bfa_sm_fault(lps->bfa, event); |
167 | } | 205 | } |
168 | } | 206 | } |
169 | 207 | ||
@@ -185,6 +223,17 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
185 | bfa_sm_set_state(lps, bfa_lps_sm_logout); | 223 | bfa_sm_set_state(lps, bfa_lps_sm_logout); |
186 | bfa_lps_send_logout(lps); | 224 | bfa_lps_send_logout(lps); |
187 | } | 225 | } |
226 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
227 | BFA_PL_EID_LOGO, 0, "Logout"); | ||
228 | break; | ||
229 | |||
230 | case BFA_LPS_SM_RX_CVL: | ||
231 | bfa_sm_set_state(lps, bfa_lps_sm_init); | ||
232 | |||
233 | /* Let the vport module know about this event */ | ||
234 | bfa_lps_cvl_event(lps); | ||
235 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
236 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); | ||
188 | break; | 237 | break; |
189 | 238 | ||
190 | case BFA_LPS_SM_OFFLINE: | 239 | case BFA_LPS_SM_OFFLINE: |
@@ -193,7 +242,7 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
193 | break; | 242 | break; |
194 | 243 | ||
195 | default: | 244 | default: |
196 | bfa_assert(0); | 245 | bfa_sm_fault(lps->bfa, event); |
197 | } | 246 | } |
198 | } | 247 | } |
199 | 248 | ||
@@ -217,7 +266,7 @@ bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
217 | break; | 266 | break; |
218 | 267 | ||
219 | default: | 268 | default: |
220 | bfa_assert(0); | 269 | bfa_sm_fault(lps->bfa, event); |
221 | } | 270 | } |
222 | } | 271 | } |
223 | 272 | ||
@@ -242,7 +291,7 @@ bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
242 | break; | 291 | break; |
243 | 292 | ||
244 | default: | 293 | default: |
245 | bfa_assert(0); | 294 | bfa_sm_fault(lps->bfa, event); |
246 | } | 295 | } |
247 | } | 296 | } |
248 | 297 | ||
@@ -396,6 +445,20 @@ bfa_lps_logout_rsp(struct bfa_s *bfa, struct bfi_lps_logout_rsp_s *rsp) | |||
396 | } | 445 | } |
397 | 446 | ||
398 | /** | 447 | /** |
448 | * Firmware received a Clear virtual link request (for FCoE) | ||
449 | */ | ||
450 | static void | ||
451 | bfa_lps_rx_cvl_event(struct bfa_s *bfa, struct bfi_lps_cvl_event_s *cvl) | ||
452 | { | ||
453 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | ||
454 | struct bfa_lps_s *lps; | ||
455 | |||
456 | lps = BFA_LPS_FROM_TAG(mod, cvl->lp_tag); | ||
457 | |||
458 | bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL); | ||
459 | } | ||
460 | |||
461 | /** | ||
399 | * Space is available in request queue, resume queueing request to firmware. | 462 | * Space is available in request queue, resume queueing request to firmware. |
400 | */ | 463 | */ |
401 | static void | 464 | static void |
@@ -531,7 +594,48 @@ bfa_lps_logout_comp(struct bfa_lps_s *lps) | |||
531 | bfa_cb_lps_flogo_comp(lps->bfa->bfad, lps->uarg); | 594 | bfa_cb_lps_flogo_comp(lps->bfa->bfad, lps->uarg); |
532 | } | 595 | } |
533 | 596 | ||
597 | /** | ||
598 | * Clear virtual link completion handler for non-fcs | ||
599 | */ | ||
600 | static void | ||
601 | bfa_lps_cvl_event_cb(void *arg, bfa_boolean_t complete) | ||
602 | { | ||
603 | struct bfa_lps_s *lps = arg; | ||
604 | |||
605 | if (!complete) | ||
606 | return; | ||
607 | |||
608 | /* Clear virtual link to base port will result in link down */ | ||
609 | if (lps->fdisc) | ||
610 | bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg); | ||
611 | } | ||
612 | |||
613 | /** | ||
614 | * Received Clear virtual link event --direct call for fcs, | ||
615 | * queue for others | ||
616 | */ | ||
617 | static void | ||
618 | bfa_lps_cvl_event(struct bfa_lps_s *lps) | ||
619 | { | ||
620 | if (!lps->bfa->fcs) { | ||
621 | bfa_cb_queue(lps->bfa, &lps->hcb_qe, bfa_lps_cvl_event_cb, | ||
622 | lps); | ||
623 | return; | ||
624 | } | ||
625 | |||
626 | /* Clear virtual link to base port will result in link down */ | ||
627 | if (lps->fdisc) | ||
628 | bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg); | ||
629 | } | ||
534 | 630 | ||
631 | u32 | ||
632 | bfa_lps_get_max_vport(struct bfa_s *bfa) | ||
633 | { | ||
634 | if (bfa_ioc_devid(&bfa->ioc) == BFA_PCI_DEVICE_ID_CT) | ||
635 | return BFA_LPS_MAX_VPORTS_SUPP_CT; | ||
636 | else | ||
637 | return BFA_LPS_MAX_VPORTS_SUPP_CB; | ||
638 | } | ||
535 | 639 | ||
536 | /** | 640 | /** |
537 | * lps_public BFA LPS public functions | 641 | * lps_public BFA LPS public functions |
@@ -752,6 +856,14 @@ bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps) | |||
752 | return lps->lsrjt_expl; | 856 | return lps->lsrjt_expl; |
753 | } | 857 | } |
754 | 858 | ||
859 | /** | ||
860 | * Return fpma/spma MAC for lport | ||
861 | */ | ||
862 | struct mac_s | ||
863 | bfa_lps_get_lp_mac(struct bfa_lps_s *lps) | ||
864 | { | ||
865 | return lps->lp_mac; | ||
866 | } | ||
755 | 867 | ||
756 | /** | 868 | /** |
757 | * LPS firmware message class handler. | 869 | * LPS firmware message class handler. |
@@ -773,6 +885,10 @@ bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
773 | bfa_lps_logout_rsp(bfa, msg.logout_rsp); | 885 | bfa_lps_logout_rsp(bfa, msg.logout_rsp); |
774 | break; | 886 | break; |
775 | 887 | ||
888 | case BFI_LPS_H2I_CVL_EVENT: | ||
889 | bfa_lps_rx_cvl_event(bfa, msg.cvl_event); | ||
890 | break; | ||
891 | |||
776 | default: | 892 | default: |
777 | bfa_trc(bfa, m->mhdr.msg_id); | 893 | bfa_trc(bfa, m->mhdr.msg_id); |
778 | bfa_assert(0); | 894 | bfa_assert(0); |