aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_fcs.c
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2012-09-21 20:23:59 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-10-07 06:03:50 -0400
commitbc0e2c2a97c1747ac0ade9b8620b14079e69fe3d (patch)
tree41fa46fba9a056b22f3b1212e076ec33529cab15 /drivers/scsi/bfa/bfa_fcs.c
parent56d92aa5cf7c96c70f81d0350c94faf46a9fb76d (diff)
[SCSI] bfa: Add support for FC Arbitrated Loop topology.
- Add private loop topology support at 2G/4G/8G speeds with following limitations 1. No support for multiple initiators in the loop 2. No public loop support. If attached to a loop with an FL_Port, device continues to work as a private NL_Port in the loop 3. No auto topology detection. User has to manually set the configured topology to loop if attaching to loop. - When loop topology is configured, enabling FC port features QoS/Trunk/TRL are not allowed and vice versa. Signed-off-by: Vijaya Mohan Guvva <vmohan@brocade.com> Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs.c')
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c64
1 files changed, 51 insertions, 13 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index fd3e84d32bd2..d428808fb37e 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -303,16 +303,30 @@ static void
303bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric, 303bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
304 enum bfa_fcs_fabric_event event) 304 enum bfa_fcs_fabric_event event)
305{ 305{
306 struct bfa_s *bfa = fabric->fcs->bfa;
307
306 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); 308 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
307 bfa_trc(fabric->fcs, event); 309 bfa_trc(fabric->fcs, event);
308 310
309 switch (event) { 311 switch (event) {
310 case BFA_FCS_FABRIC_SM_START: 312 case BFA_FCS_FABRIC_SM_START:
311 if (bfa_fcport_is_linkup(fabric->fcs->bfa)) { 313 if (!bfa_fcport_is_linkup(fabric->fcs->bfa)) {
314 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
315 break;
316 }
317 if (bfa_fcport_get_topology(bfa) ==
318 BFA_PORT_TOPOLOGY_LOOP) {
319 fabric->fab_type = BFA_FCS_FABRIC_LOOP;
320 fabric->bport.pid = bfa_fcport_get_myalpa(bfa);
321 fabric->bport.pid = bfa_hton3b(fabric->bport.pid);
322 bfa_sm_set_state(fabric,
323 bfa_fcs_fabric_sm_online);
324 bfa_fcs_fabric_set_opertype(fabric);
325 bfa_fcs_lport_online(&fabric->bport);
326 } else {
312 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); 327 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
313 bfa_fcs_fabric_login(fabric); 328 bfa_fcs_fabric_login(fabric);
314 } else 329 }
315 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
316 break; 330 break;
317 331
318 case BFA_FCS_FABRIC_SM_LINK_UP: 332 case BFA_FCS_FABRIC_SM_LINK_UP:
@@ -337,16 +351,28 @@ static void
337bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric, 351bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric,
338 enum bfa_fcs_fabric_event event) 352 enum bfa_fcs_fabric_event event)
339{ 353{
354 struct bfa_s *bfa = fabric->fcs->bfa;
355
340 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); 356 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
341 bfa_trc(fabric->fcs, event); 357 bfa_trc(fabric->fcs, event);
342 358
343 switch (event) { 359 switch (event) {
344 case BFA_FCS_FABRIC_SM_LINK_UP: 360 case BFA_FCS_FABRIC_SM_LINK_UP:
345 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); 361 if (bfa_fcport_get_topology(bfa) != BFA_PORT_TOPOLOGY_LOOP) {
346 bfa_fcs_fabric_login(fabric); 362 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
363 bfa_fcs_fabric_login(fabric);
364 break;
365 }
366 fabric->fab_type = BFA_FCS_FABRIC_LOOP;
367 fabric->bport.pid = bfa_fcport_get_myalpa(bfa);
368 fabric->bport.pid = bfa_hton3b(fabric->bport.pid);
369 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_online);
370 bfa_fcs_fabric_set_opertype(fabric);
371 bfa_fcs_lport_online(&fabric->bport);
347 break; 372 break;
348 373
349 case BFA_FCS_FABRIC_SM_RETRY_OP: 374 case BFA_FCS_FABRIC_SM_RETRY_OP:
375 case BFA_FCS_FABRIC_SM_LOOPBACK:
350 break; 376 break;
351 377
352 case BFA_FCS_FABRIC_SM_DELETE: 378 case BFA_FCS_FABRIC_SM_DELETE:
@@ -595,14 +621,20 @@ void
595bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, 621bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
596 enum bfa_fcs_fabric_event event) 622 enum bfa_fcs_fabric_event event)
597{ 623{
624 struct bfa_s *bfa = fabric->fcs->bfa;
625
598 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); 626 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
599 bfa_trc(fabric->fcs, event); 627 bfa_trc(fabric->fcs, event);
600 628
601 switch (event) { 629 switch (event) {
602 case BFA_FCS_FABRIC_SM_LINK_DOWN: 630 case BFA_FCS_FABRIC_SM_LINK_DOWN:
603 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); 631 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
604 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); 632 if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) {
605 bfa_fcs_fabric_notify_offline(fabric); 633 bfa_fcs_lport_offline(&fabric->bport);
634 } else {
635 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
636 bfa_fcs_fabric_notify_offline(fabric);
637 }
606 break; 638 break;
607 639
608 case BFA_FCS_FABRIC_SM_DELETE: 640 case BFA_FCS_FABRIC_SM_DELETE:
@@ -719,20 +751,29 @@ static void
719bfa_fcs_fabric_sm_stopping(struct bfa_fcs_fabric_s *fabric, 751bfa_fcs_fabric_sm_stopping(struct bfa_fcs_fabric_s *fabric,
720 enum bfa_fcs_fabric_event event) 752 enum bfa_fcs_fabric_event event)
721{ 753{
754 struct bfa_s *bfa = fabric->fcs->bfa;
755
722 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); 756 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
723 bfa_trc(fabric->fcs, event); 757 bfa_trc(fabric->fcs, event);
724 758
725 switch (event) { 759 switch (event) {
726 case BFA_FCS_FABRIC_SM_STOPCOMP: 760 case BFA_FCS_FABRIC_SM_STOPCOMP:
727 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); 761 if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) {
728 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_LOGOUT); 762 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created);
763 } else {
764 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup);
765 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_LOGOUT);
766 }
729 break; 767 break;
730 768
731 case BFA_FCS_FABRIC_SM_LINK_UP: 769 case BFA_FCS_FABRIC_SM_LINK_UP:
732 break; 770 break;
733 771
734 case BFA_FCS_FABRIC_SM_LINK_DOWN: 772 case BFA_FCS_FABRIC_SM_LINK_DOWN:
735 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); 773 if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP)
774 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created);
775 else
776 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup);
736 break; 777 break;
737 778
738 default: 779 default:
@@ -975,9 +1016,6 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric)
975 struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg; 1016 struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg;
976 u8 alpa = 0, bb_scn = 0; 1017 u8 alpa = 0, bb_scn = 0;
977 1018
978 if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP)
979 alpa = bfa_fcport_get_myalpa(bfa);
980
981 if (bfa_fcs_fabric_is_bbscn_enabled(fabric) && 1019 if (bfa_fcs_fabric_is_bbscn_enabled(fabric) &&
982 (!fabric->fcs->bbscn_flogi_rjt)) 1020 (!fabric->fcs->bbscn_flogi_rjt))
983 bb_scn = BFA_FCS_PORT_DEF_BB_SCN; 1021 bb_scn = BFA_FCS_PORT_DEF_BB_SCN;