aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_fcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs.c')
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c335
1 files changed, 69 insertions, 266 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index 9cebbe30a678..c94502dfac66 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -15,7 +15,7 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18/** 18/*
19 * bfa_fcs.c BFA FCS main 19 * bfa_fcs.c BFA FCS main
20 */ 20 */
21 21
@@ -25,7 +25,7 @@
25 25
26BFA_TRC_FILE(FCS, FCS); 26BFA_TRC_FILE(FCS, FCS);
27 27
28/** 28/*
29 * FCS sub-modules 29 * FCS sub-modules
30 */ 30 */
31struct bfa_fcs_mod_s { 31struct bfa_fcs_mod_s {
@@ -43,7 +43,7 @@ static struct bfa_fcs_mod_s fcs_modules[] = {
43 bfa_fcs_fabric_modexit }, 43 bfa_fcs_fabric_modexit },
44}; 44};
45 45
46/** 46/*
47 * fcs_api BFA FCS API 47 * fcs_api BFA FCS API
48 */ 48 */
49 49
@@ -58,11 +58,11 @@ bfa_fcs_exit_comp(void *fcs_cbarg)
58 58
59 59
60 60
61/** 61/*
62 * fcs_api BFA FCS API 62 * fcs_api BFA FCS API
63 */ 63 */
64 64
65/** 65/*
66 * fcs attach -- called once to initialize data structures at driver attach time 66 * fcs attach -- called once to initialize data structures at driver attach time
67 */ 67 */
68void 68void
@@ -86,7 +86,7 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
86 } 86 }
87} 87}
88 88
89/** 89/*
90 * fcs initialization, called once after bfa initialization is complete 90 * fcs initialization, called once after bfa initialization is complete
91 */ 91 */
92void 92void
@@ -110,7 +110,7 @@ bfa_fcs_init(struct bfa_fcs_s *fcs)
110 } 110 }
111} 111}
112 112
113/** 113/*
114 * Start FCS operations. 114 * Start FCS operations.
115 */ 115 */
116void 116void
@@ -119,7 +119,7 @@ bfa_fcs_start(struct bfa_fcs_s *fcs)
119 bfa_fcs_fabric_modstart(fcs); 119 bfa_fcs_fabric_modstart(fcs);
120} 120}
121 121
122/** 122/*
123 * brief 123 * brief
124 * FCS driver details initialization. 124 * FCS driver details initialization.
125 * 125 *
@@ -138,7 +138,7 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
138 bfa_fcs_fabric_psymb_init(&fcs->fabric); 138 bfa_fcs_fabric_psymb_init(&fcs->fabric);
139} 139}
140 140
141/** 141/*
142 * brief 142 * brief
143 * FCS FDMI Driver Parameter Initialization 143 * FCS FDMI Driver Parameter Initialization
144 * 144 *
@@ -154,7 +154,7 @@ bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable)
154 fcs->fdmi_enabled = fdmi_enable; 154 fcs->fdmi_enabled = fdmi_enable;
155 155
156} 156}
157/** 157/*
158 * brief 158 * brief
159 * FCS instance cleanup and exit. 159 * FCS instance cleanup and exit.
160 * 160 *
@@ -196,7 +196,7 @@ bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs)
196 bfa_wc_down(&fcs->wc); 196 bfa_wc_down(&fcs->wc);
197} 197}
198 198
199/** 199/*
200 * Fabric module implementation. 200 * Fabric module implementation.
201 */ 201 */
202 202
@@ -232,11 +232,11 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg,
232 u32 rsp_len, 232 u32 rsp_len,
233 u32 resid_len, 233 u32 resid_len,
234 struct fchs_s *rspfchs); 234 struct fchs_s *rspfchs);
235/** 235/*
236 * fcs_fabric_sm fabric state machine functions 236 * fcs_fabric_sm fabric state machine functions
237 */ 237 */
238 238
239/** 239/*
240 * Fabric state machine events 240 * Fabric state machine events
241 */ 241 */
242enum bfa_fcs_fabric_event { 242enum bfa_fcs_fabric_event {
@@ -286,7 +286,7 @@ static void bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric,
286 enum bfa_fcs_fabric_event event); 286 enum bfa_fcs_fabric_event event);
287static void bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric, 287static void bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric,
288 enum bfa_fcs_fabric_event event); 288 enum bfa_fcs_fabric_event event);
289/** 289/*
290 * Beginning state before fabric creation. 290 * Beginning state before fabric creation.
291 */ 291 */
292static void 292static void
@@ -312,7 +312,7 @@ bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
312 } 312 }
313} 313}
314 314
315/** 315/*
316 * Beginning state before fabric creation. 316 * Beginning state before fabric creation.
317 */ 317 */
318static void 318static void
@@ -345,7 +345,7 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
345 } 345 }
346} 346}
347 347
348/** 348/*
349 * Link is down, awaiting LINK UP event from port. This is also the 349 * Link is down, awaiting LINK UP event from port. This is also the
350 * first state at fabric creation. 350 * first state at fabric creation.
351 */ 351 */
@@ -375,7 +375,7 @@ bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric,
375 } 375 }
376} 376}
377 377
378/** 378/*
379 * FLOGI is in progress, awaiting FLOGI reply. 379 * FLOGI is in progress, awaiting FLOGI reply.
380 */ 380 */
381static void 381static void
@@ -468,7 +468,7 @@ bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric,
468 } 468 }
469} 469}
470 470
471/** 471/*
472 * Authentication is in progress, awaiting authentication results. 472 * Authentication is in progress, awaiting authentication results.
473 */ 473 */
474static void 474static void
@@ -508,7 +508,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
508 } 508 }
509} 509}
510 510
511/** 511/*
512 * Authentication failed 512 * Authentication failed
513 */ 513 */
514static void 514static void
@@ -534,7 +534,7 @@ bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
534 } 534 }
535} 535}
536 536
537/** 537/*
538 * Port is in loopback mode. 538 * Port is in loopback mode.
539 */ 539 */
540static void 540static void
@@ -560,7 +560,7 @@ bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
560 } 560 }
561} 561}
562 562
563/** 563/*
564 * There is no attached fabric - private loop or NPort-to-NPort topology. 564 * There is no attached fabric - private loop or NPort-to-NPort topology.
565 */ 565 */
566static void 566static void
@@ -593,7 +593,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
593 } 593 }
594} 594}
595 595
596/** 596/*
597 * Fabric is online - normal operating state. 597 * Fabric is online - normal operating state.
598 */ 598 */
599static void 599static void
@@ -628,7 +628,7 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
628 } 628 }
629} 629}
630 630
631/** 631/*
632 * Exchanging virtual fabric parameters. 632 * Exchanging virtual fabric parameters.
633 */ 633 */
634static void 634static void
@@ -652,7 +652,7 @@ bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric,
652 } 652 }
653} 653}
654 654
655/** 655/*
656 * EVFP exchange complete and VFT tagging is enabled. 656 * EVFP exchange complete and VFT tagging is enabled.
657 */ 657 */
658static void 658static void
@@ -663,7 +663,7 @@ bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric,
663 bfa_trc(fabric->fcs, event); 663 bfa_trc(fabric->fcs, event);
664} 664}
665 665
666/** 666/*
667 * Port is isolated after EVFP exchange due to VF_ID mismatch (N and F). 667 * Port is isolated after EVFP exchange due to VF_ID mismatch (N and F).
668 */ 668 */
669static void 669static void
@@ -684,7 +684,7 @@ bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric,
684 fabric->event_arg.swp_vfid); 684 fabric->event_arg.swp_vfid);
685} 685}
686 686
687/** 687/*
688 * Fabric is being deleted, awaiting vport delete completions. 688 * Fabric is being deleted, awaiting vport delete completions.
689 */ 689 */
690static void 690static void
@@ -714,7 +714,7 @@ bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric,
714 714
715 715
716 716
717/** 717/*
718 * fcs_fabric_private fabric private functions 718 * fcs_fabric_private fabric private functions
719 */ 719 */
720 720
@@ -728,7 +728,7 @@ bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric)
728 port_cfg->pwwn = bfa_ioc_get_pwwn(&fabric->fcs->bfa->ioc); 728 port_cfg->pwwn = bfa_ioc_get_pwwn(&fabric->fcs->bfa->ioc);
729} 729}
730 730
731/** 731/*
732 * Port Symbolic Name Creation for base port. 732 * Port Symbolic Name Creation for base port.
733 */ 733 */
734void 734void
@@ -789,7 +789,7 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
789 port_cfg->sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0; 789 port_cfg->sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0;
790} 790}
791 791
792/** 792/*
793 * bfa lps login completion callback 793 * bfa lps login completion callback
794 */ 794 */
795void 795void
@@ -867,7 +867,7 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
867 bfa_trc(fabric->fcs, fabric->is_npiv); 867 bfa_trc(fabric->fcs, fabric->is_npiv);
868 bfa_trc(fabric->fcs, fabric->is_auth); 868 bfa_trc(fabric->fcs, fabric->is_auth);
869} 869}
870/** 870/*
871 * Allocate and send FLOGI. 871 * Allocate and send FLOGI.
872 */ 872 */
873static void 873static void
@@ -897,7 +897,7 @@ bfa_fcs_fabric_notify_online(struct bfa_fcs_fabric_s *fabric)
897 bfa_fcs_fabric_set_opertype(fabric); 897 bfa_fcs_fabric_set_opertype(fabric);
898 fabric->stats.fabric_onlines++; 898 fabric->stats.fabric_onlines++;
899 899
900 /** 900 /*
901 * notify online event to base and then virtual ports 901 * notify online event to base and then virtual ports
902 */ 902 */
903 bfa_fcs_lport_online(&fabric->bport); 903 bfa_fcs_lport_online(&fabric->bport);
@@ -917,7 +917,7 @@ bfa_fcs_fabric_notify_offline(struct bfa_fcs_fabric_s *fabric)
917 bfa_trc(fabric->fcs, fabric->fabric_name); 917 bfa_trc(fabric->fcs, fabric->fabric_name);
918 fabric->stats.fabric_offlines++; 918 fabric->stats.fabric_offlines++;
919 919
920 /** 920 /*
921 * notify offline event first to vports and then base port. 921 * notify offline event first to vports and then base port.
922 */ 922 */
923 list_for_each_safe(qe, qen, &fabric->vport_q) { 923 list_for_each_safe(qe, qen, &fabric->vport_q) {
@@ -939,7 +939,7 @@ bfa_fcs_fabric_delay(void *cbarg)
939 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELAYED); 939 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELAYED);
940} 940}
941 941
942/** 942/*
943 * Delete all vports and wait for vport delete completions. 943 * Delete all vports and wait for vport delete completions.
944 */ 944 */
945static void 945static void
@@ -965,11 +965,11 @@ bfa_fcs_fabric_delete_comp(void *cbarg)
965 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELCOMP); 965 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELCOMP);
966} 966}
967 967
968/** 968/*
969 * fcs_fabric_public fabric public functions 969 * fcs_fabric_public fabric public functions
970 */ 970 */
971 971
972/** 972/*
973 * Attach time initialization. 973 * Attach time initialization.
974 */ 974 */
975void 975void
@@ -978,9 +978,9 @@ bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs)
978 struct bfa_fcs_fabric_s *fabric; 978 struct bfa_fcs_fabric_s *fabric;
979 979
980 fabric = &fcs->fabric; 980 fabric = &fcs->fabric;
981 bfa_os_memset(fabric, 0, sizeof(struct bfa_fcs_fabric_s)); 981 memset(fabric, 0, sizeof(struct bfa_fcs_fabric_s));
982 982
983 /** 983 /*
984 * Initialize base fabric. 984 * Initialize base fabric.
985 */ 985 */
986 fabric->fcs = fcs; 986 fabric->fcs = fcs;
@@ -989,7 +989,7 @@ bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs)
989 fabric->lps = bfa_lps_alloc(fcs->bfa); 989 fabric->lps = bfa_lps_alloc(fcs->bfa);
990 bfa_assert(fabric->lps); 990 bfa_assert(fabric->lps);
991 991
992 /** 992 /*
993 * Initialize fabric delete completion handler. Fabric deletion is 993 * Initialize fabric delete completion handler. Fabric deletion is
994 * complete when the last vport delete is complete. 994 * complete when the last vport delete is complete.
995 */ 995 */
@@ -1007,7 +1007,7 @@ bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
1007 bfa_trc(fcs, 0); 1007 bfa_trc(fcs, 0);
1008} 1008}
1009 1009
1010/** 1010/*
1011 * Module cleanup 1011 * Module cleanup
1012 */ 1012 */
1013void 1013void
@@ -1017,7 +1017,7 @@ bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs)
1017 1017
1018 bfa_trc(fcs, 0); 1018 bfa_trc(fcs, 0);
1019 1019
1020 /** 1020 /*
1021 * Cleanup base fabric. 1021 * Cleanup base fabric.
1022 */ 1022 */
1023 fabric = &fcs->fabric; 1023 fabric = &fcs->fabric;
@@ -1025,7 +1025,7 @@ bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs)
1025 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELETE); 1025 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELETE);
1026} 1026}
1027 1027
1028/** 1028/*
1029 * Fabric module start -- kick starts FCS actions 1029 * Fabric module start -- kick starts FCS actions
1030 */ 1030 */
1031void 1031void
@@ -1038,7 +1038,7 @@ bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs)
1038 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START); 1038 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START);
1039} 1039}
1040 1040
1041/** 1041/*
1042 * Suspend fabric activity as part of driver suspend. 1042 * Suspend fabric activity as part of driver suspend.
1043 */ 1043 */
1044void 1044void
@@ -1064,7 +1064,7 @@ bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric)
1064 return fabric->oper_type; 1064 return fabric->oper_type;
1065} 1065}
1066 1066
1067/** 1067/*
1068 * Link up notification from BFA physical port module. 1068 * Link up notification from BFA physical port module.
1069 */ 1069 */
1070void 1070void
@@ -1074,7 +1074,7 @@ bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric)
1074 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_UP); 1074 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_UP);
1075} 1075}
1076 1076
1077/** 1077/*
1078 * Link down notification from BFA physical port module. 1078 * Link down notification from BFA physical port module.
1079 */ 1079 */
1080void 1080void
@@ -1084,7 +1084,7 @@ bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric)
1084 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN); 1084 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN);
1085} 1085}
1086 1086
1087/** 1087/*
1088 * A child vport is being created in the fabric. 1088 * A child vport is being created in the fabric.
1089 * 1089 *
1090 * Call from vport module at vport creation. A list of base port and vports 1090 * Call from vport module at vport creation. A list of base port and vports
@@ -1099,7 +1099,7 @@ void
1099bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric, 1099bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
1100 struct bfa_fcs_vport_s *vport) 1100 struct bfa_fcs_vport_s *vport)
1101{ 1101{
1102 /** 1102 /*
1103 * - add vport to fabric's vport_q 1103 * - add vport to fabric's vport_q
1104 */ 1104 */
1105 bfa_trc(fabric->fcs, fabric->vf_id); 1105 bfa_trc(fabric->fcs, fabric->vf_id);
@@ -1109,7 +1109,7 @@ bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
1109 bfa_wc_up(&fabric->wc); 1109 bfa_wc_up(&fabric->wc);
1110} 1110}
1111 1111
1112/** 1112/*
1113 * A child vport is being deleted from fabric. 1113 * A child vport is being deleted from fabric.
1114 * 1114 *
1115 * Vport is being deleted. 1115 * Vport is being deleted.
@@ -1123,7 +1123,7 @@ bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
1123 bfa_wc_down(&fabric->wc); 1123 bfa_wc_down(&fabric->wc);
1124} 1124}
1125 1125
1126/** 1126/*
1127 * Base port is deleted. 1127 * Base port is deleted.
1128 */ 1128 */
1129void 1129void
@@ -1133,7 +1133,7 @@ bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric)
1133} 1133}
1134 1134
1135 1135
1136/** 1136/*
1137 * Check if fabric is online. 1137 * Check if fabric is online.
1138 * 1138 *
1139 * param[in] fabric - Fabric instance. This can be a base fabric or vf. 1139 * param[in] fabric - Fabric instance. This can be a base fabric or vf.
@@ -1146,7 +1146,7 @@ bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric)
1146 return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_online); 1146 return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_online);
1147} 1147}
1148 1148
1149/** 1149/*
1150 * brief 1150 * brief
1151 * 1151 *
1152 */ 1152 */
@@ -1158,7 +1158,7 @@ bfa_fcs_fabric_addvf(struct bfa_fcs_fabric_s *vf, struct bfa_fcs_s *fcs,
1158 return BFA_STATUS_OK; 1158 return BFA_STATUS_OK;
1159} 1159}
1160 1160
1161/** 1161/*
1162 * Lookup for a vport withing a fabric given its pwwn 1162 * Lookup for a vport withing a fabric given its pwwn
1163 */ 1163 */
1164struct bfa_fcs_vport_s * 1164struct bfa_fcs_vport_s *
@@ -1176,7 +1176,7 @@ bfa_fcs_fabric_vport_lookup(struct bfa_fcs_fabric_s *fabric, wwn_t pwwn)
1176 return NULL; 1176 return NULL;
1177} 1177}
1178 1178
1179/** 1179/*
1180 * In a given fabric, return the number of lports. 1180 * In a given fabric, return the number of lports.
1181 * 1181 *
1182 * param[in] fabric - Fabric instance. This can be a base fabric or vf. 1182 * param[in] fabric - Fabric instance. This can be a base fabric or vf.
@@ -1214,7 +1214,7 @@ bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric)
1214 1214
1215 return oui; 1215 return oui;
1216} 1216}
1217/** 1217/*
1218 * Unsolicited frame receive handling. 1218 * Unsolicited frame receive handling.
1219 */ 1219 */
1220void 1220void
@@ -1230,7 +1230,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1230 bfa_trc(fabric->fcs, len); 1230 bfa_trc(fabric->fcs, len);
1231 bfa_trc(fabric->fcs, pid); 1231 bfa_trc(fabric->fcs, pid);
1232 1232
1233 /** 1233 /*
1234 * Look for our own FLOGI frames being looped back. This means an 1234 * Look for our own FLOGI frames being looped back. This means an
1235 * external loopback cable is in place. Our own FLOGI frames are 1235 * external loopback cable is in place. Our own FLOGI frames are
1236 * sometimes looped back when switch port gets temporarily bypassed. 1236 * sometimes looped back when switch port gets temporarily bypassed.
@@ -1242,7 +1242,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1242 return; 1242 return;
1243 } 1243 }
1244 1244
1245 /** 1245 /*
1246 * FLOGI/EVFP exchanges should be consumed by base fabric. 1246 * FLOGI/EVFP exchanges should be consumed by base fabric.
1247 */ 1247 */
1248 if (fchs->d_id == bfa_os_hton3b(FC_FABRIC_PORT)) { 1248 if (fchs->d_id == bfa_os_hton3b(FC_FABRIC_PORT)) {
@@ -1252,7 +1252,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1252 } 1252 }
1253 1253
1254 if (fabric->bport.pid == pid) { 1254 if (fabric->bport.pid == pid) {
1255 /** 1255 /*
1256 * All authentication frames should be routed to auth 1256 * All authentication frames should be routed to auth
1257 */ 1257 */
1258 bfa_trc(fabric->fcs, els_cmd->els_code); 1258 bfa_trc(fabric->fcs, els_cmd->els_code);
@@ -1266,7 +1266,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1266 return; 1266 return;
1267 } 1267 }
1268 1268
1269 /** 1269 /*
1270 * look for a matching local port ID 1270 * look for a matching local port ID
1271 */ 1271 */
1272 list_for_each(qe, &fabric->vport_q) { 1272 list_for_each(qe, &fabric->vport_q) {
@@ -1280,7 +1280,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1280 bfa_fcs_lport_uf_recv(&fabric->bport, fchs, len); 1280 bfa_fcs_lport_uf_recv(&fabric->bport, fchs, len);
1281} 1281}
1282 1282
1283/** 1283/*
1284 * Unsolicited frames to be processed by fabric. 1284 * Unsolicited frames to be processed by fabric.
1285 */ 1285 */
1286static void 1286static void
@@ -1304,7 +1304,7 @@ bfa_fcs_fabric_process_uf(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1304 } 1304 }
1305} 1305}
1306 1306
1307/** 1307/*
1308 * Process incoming FLOGI 1308 * Process incoming FLOGI
1309 */ 1309 */
1310static void 1310static void
@@ -1329,7 +1329,7 @@ bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
1329 return; 1329 return;
1330 } 1330 }
1331 1331
1332 fabric->bb_credit = bfa_os_ntohs(flogi->csp.bbcred); 1332 fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred);
1333 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name; 1333 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name;
1334 bport->port_topo.pn2n.reply_oxid = fchs->ox_id; 1334 bport->port_topo.pn2n.reply_oxid = fchs->ox_id;
1335 1335
@@ -1351,7 +1351,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1351 struct fchs_s fchs; 1351 struct fchs_s fchs;
1352 1352
1353 fcxp = bfa_fcs_fcxp_alloc(fabric->fcs); 1353 fcxp = bfa_fcs_fcxp_alloc(fabric->fcs);
1354 /** 1354 /*
1355 * Do not expect this failure -- expect remote node to retry 1355 * Do not expect this failure -- expect remote node to retry
1356 */ 1356 */
1357 if (!fcxp) 1357 if (!fcxp)
@@ -1370,7 +1370,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1370 FC_MAX_PDUSZ, 0); 1370 FC_MAX_PDUSZ, 0);
1371} 1371}
1372 1372
1373/** 1373/*
1374 * Flogi Acc completion callback. 1374 * Flogi Acc completion callback.
1375 */ 1375 */
1376static void 1376static void
@@ -1417,130 +1417,7 @@ bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
1417 } 1417 }
1418} 1418}
1419 1419
1420/** 1420/*
1421 * fcs_vf_api virtual fabrics API
1422 */
1423
1424/**
1425 * Enable VF mode.
1426 *
1427 * @param[in] fcs fcs module instance
1428 * @param[in] vf_id default vf_id of port, FC_VF_ID_NULL
1429 * to use standard default vf_id of 1.
1430 *
1431 * @retval BFA_STATUS_OK vf mode is enabled
1432 * @retval BFA_STATUS_BUSY Port is active. Port must be disabled
1433 * before VF mode can be enabled.
1434 */
1435bfa_status_t
1436bfa_fcs_vf_mode_enable(struct bfa_fcs_s *fcs, u16 vf_id)
1437{
1438 return BFA_STATUS_OK;
1439}
1440
1441/**
1442 * Disable VF mode.
1443 *
1444 * @param[in] fcs fcs module instance
1445 *
1446 * @retval BFA_STATUS_OK vf mode is disabled
1447 * @retval BFA_STATUS_BUSY VFs are present and being used. All
1448 * VFs must be deleted before disabling
1449 * VF mode.
1450 */
1451bfa_status_t
1452bfa_fcs_vf_mode_disable(struct bfa_fcs_s *fcs)
1453{
1454 return BFA_STATUS_OK;
1455}
1456
1457/**
1458 * Create a new VF instance.
1459 *
1460 * A new VF is created using the given VF configuration. A VF is identified
1461 * by VF id. No duplicate VF creation is allowed with the same VF id. Once
1462 * a VF is created, VF is automatically started after link initialization
1463 * and EVFP exchange is completed.
1464 *
1465 * param[in] vf - FCS vf data structure. Memory is
1466 * allocated by caller (driver)
1467 * param[in] fcs - FCS module
1468 * param[in] vf_cfg - VF configuration
1469 * param[in] vf_drv - Opaque handle back to the driver's
1470 * virtual vf structure
1471 *
1472 * retval BFA_STATUS_OK VF creation is successful
1473 * retval BFA_STATUS_FAILED VF creation failed
1474 * retval BFA_STATUS_EEXIST A VF exists with the given vf_id
1475 */
1476bfa_status_t
1477bfa_fcs_vf_create(bfa_fcs_vf_t *vf, struct bfa_fcs_s *fcs, u16 vf_id,
1478 struct bfa_lport_cfg_s *port_cfg, struct bfad_vf_s *vf_drv)
1479{
1480 bfa_trc(fcs, vf_id);
1481 return BFA_STATUS_OK;
1482}
1483
1484/**
1485 * Use this function to delete a BFA VF object. VF object should
1486 * be stopped before this function call.
1487 *
1488 * param[in] vf - pointer to bfa_vf_t.
1489 *
1490 * retval BFA_STATUS_OK On vf deletion success
1491 * retval BFA_STATUS_BUSY VF is not in a stopped state
1492 * retval BFA_STATUS_INPROGRESS VF deletion in in progress
1493 */
1494bfa_status_t
1495bfa_fcs_vf_delete(bfa_fcs_vf_t *vf)
1496{
1497 bfa_trc(vf->fcs, vf->vf_id);
1498 return BFA_STATUS_OK;
1499}
1500
1501
1502/**
1503 * Returns attributes of the given VF.
1504 *
1505 * param[in] vf pointer to bfa_vf_t.
1506 * param[out] vf_attr vf attributes returned
1507 *
1508 * return None
1509 */
1510void
1511bfa_fcs_vf_get_attr(bfa_fcs_vf_t *vf, struct bfa_vf_attr_s *vf_attr)
1512{
1513 bfa_trc(vf->fcs, vf->vf_id);
1514}
1515
1516/**
1517 * Return statistics associated with the given vf.
1518 *
1519 * param[in] vf pointer to bfa_vf_t.
1520 * param[out] vf_stats vf statistics returned
1521 *
1522 * @return None
1523 */
1524void
1525bfa_fcs_vf_get_stats(bfa_fcs_vf_t *vf, struct bfa_vf_stats_s *vf_stats)
1526{
1527 bfa_os_memcpy(vf_stats, &vf->stats, sizeof(struct bfa_vf_stats_s));
1528}
1529
1530/**
1531 * clear statistics associated with the given vf.
1532 *
1533 * param[in] vf pointer to bfa_vf_t.
1534 *
1535 * @return None
1536 */
1537void
1538bfa_fcs_vf_clear_stats(bfa_fcs_vf_t *vf)
1539{
1540 bfa_os_memset(&vf->stats, 0, sizeof(struct bfa_vf_stats_s));
1541}
1542
1543/**
1544 * Returns FCS vf structure for a given vf_id. 1421 * Returns FCS vf structure for a given vf_id.
1545 * 1422 *
1546 * param[in] vf_id - VF_ID 1423 * param[in] vf_id - VF_ID
@@ -1558,81 +1435,7 @@ bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id)
1558 return NULL; 1435 return NULL;
1559} 1436}
1560 1437
1561/** 1438/*
1562 * Return the list of VFs configured.
1563 *
1564 * param[in] fcs fcs module instance
1565 * param[out] vf_ids returned list of vf_ids
1566 * param[in,out] nvfs in:size of vf_ids array,
1567 * out:total elements present,
1568 * actual elements returned is limited by the size
1569 *
1570 * return Driver VF structure
1571 */
1572void
1573bfa_fcs_vf_list(struct bfa_fcs_s *fcs, u16 *vf_ids, int *nvfs)
1574{
1575 bfa_trc(fcs, *nvfs);
1576}
1577
1578/**
1579 * Return the list of all VFs visible from fabric.
1580 *
1581 * param[in] fcs fcs module instance
1582 * param[out] vf_ids returned list of vf_ids
1583 * param[in,out] nvfs in:size of vf_ids array,
1584 * out:total elements present,
1585 * actual elements returned is limited by the size
1586 *
1587 * return Driver VF structure
1588 */
1589void
1590bfa_fcs_vf_list_all(struct bfa_fcs_s *fcs, u16 *vf_ids, int *nvfs)
1591{
1592 bfa_trc(fcs, *nvfs);
1593}
1594
1595/**
1596 * Return the list of local logical ports present in the given VF.
1597 *
1598 * param[in] vf vf for which logical ports are returned
1599 * param[out] lpwwn returned logical port wwn list
1600 * param[in,out] nlports in:size of lpwwn list;
1601 * out:total elements present,
1602 * actual elements returned is limited by the size
1603 */
1604void
1605bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t lpwwn[], int *nlports)
1606{
1607 struct list_head *qe;
1608 struct bfa_fcs_vport_s *vport;
1609 int i;
1610 struct bfa_fcs_s *fcs;
1611
1612 if (vf == NULL || lpwwn == NULL || *nlports == 0)
1613 return;
1614
1615 fcs = vf->fcs;
1616
1617 bfa_trc(fcs, vf->vf_id);
1618 bfa_trc(fcs, (u32) *nlports);
1619
1620 i = 0;
1621 lpwwn[i++] = vf->bport.port_cfg.pwwn;
1622
1623 list_for_each(qe, &vf->vport_q) {
1624 if (i >= *nlports)
1625 break;
1626
1627 vport = (struct bfa_fcs_vport_s *) qe;
1628 lpwwn[i++] = vport->lport.port_cfg.pwwn;
1629 }
1630
1631 bfa_trc(fcs, i);
1632 *nlports = i;
1633}
1634
1635/**
1636 * BFA FCS PPORT ( physical port) 1439 * BFA FCS PPORT ( physical port)
1637 */ 1440 */
1638static void 1441static void
@@ -1662,11 +1465,11 @@ bfa_fcs_port_attach(struct bfa_fcs_s *fcs)
1662 bfa_fcport_event_register(fcs->bfa, bfa_fcs_port_event_handler, fcs); 1465 bfa_fcport_event_register(fcs->bfa, bfa_fcs_port_event_handler, fcs);
1663} 1466}
1664 1467
1665/** 1468/*
1666 * BFA FCS UF ( Unsolicited Frames) 1469 * BFA FCS UF ( Unsolicited Frames)
1667 */ 1470 */
1668 1471
1669/** 1472/*
1670 * BFA callback for unsolicited frame receive handler. 1473 * BFA callback for unsolicited frame receive handler.
1671 * 1474 *
1672 * @param[in] cbarg callback arg for receive handler 1475 * @param[in] cbarg callback arg for receive handler
@@ -1683,7 +1486,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
1683 struct fc_vft_s *vft; 1486 struct fc_vft_s *vft;
1684 struct bfa_fcs_fabric_s *fabric; 1487 struct bfa_fcs_fabric_s *fabric;
1685 1488
1686 /** 1489 /*
1687 * check for VFT header 1490 * check for VFT header
1688 */ 1491 */
1689 if (fchs->routing == FC_RTG_EXT_HDR && 1492 if (fchs->routing == FC_RTG_EXT_HDR &&
@@ -1695,7 +1498,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
1695 else 1498 else
1696 fabric = bfa_fcs_vf_lookup(fcs, (u16) vft->vf_id); 1499 fabric = bfa_fcs_vf_lookup(fcs, (u16) vft->vf_id);
1697 1500
1698 /** 1501 /*
1699 * drop frame if vfid is unknown 1502 * drop frame if vfid is unknown
1700 */ 1503 */
1701 if (!fabric) { 1504 if (!fabric) {
@@ -1705,7 +1508,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
1705 return; 1508 return;
1706 } 1509 }
1707 1510
1708 /** 1511 /*
1709 * skip vft header 1512 * skip vft header
1710 */ 1513 */
1711 fchs = (struct fchs_s *) (vft + 1); 1514 fchs = (struct fchs_s *) (vft + 1);