diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-31 20:43:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-31 20:43:12 -0400 |
commit | ce9d8d9f7214c7b74a5dd7be8221545269a31155 (patch) | |
tree | f6d529ea1d0b1c801af4a938b30de94b00ef9ca3 /drivers/scsi/bfa/bfa_fcs_lport.c | |
parent | 82279e6bd7643da1b3fbda42555c3238c7b00d38 (diff) | |
parent | 592488a32b87daf27b92d2c1c5cdc440d1a1beae (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (70 commits)
[SCSI] pmcraid: add support for set timestamp command and other fixes
[SCSI] pmcraid: remove duplicate struct member
[SCSI] qla4xxx: Fix cmd check in qla4xxx_cmd_wait
[SCSI] megaraid_sas: Version and documentation update
[SCSI] megaraid_sas: Add three times Online controller reset
[SCSI] megaraid_sas: Add input parameter for max_sectors
[SCSI] megaraid_sas: support devices update flag
[SCSI] libosd: write/read_sg_kern API
[SCSI] libosd: Support for scatter gather write/read commands
[SCSI] libosd: Free resources in reverse order of allocation
[SCSI] libosd: Fix bug in attr_page handling
[SCSI] lpfc 8.3.18: Update lpfc driver version to 8.3.18
[SCSI] lpfc 8.3.18: Add new WQE support
[SCSI] lpfc 8.3.18: Fix critical errors
[SCSI] lpfc 8.3.18: Adapter Shutdown and Unregistration cleanup
[SCSI] lpfc 8.3.18: Add logic to detect last devloss timeout
[SCSI] lpfc 8.3.18: Add support of received ELS commands
[SCSI] lpfc 8.3.18: FC/FCoE Discovery fixes
[SCSI] ipr: add definitions for a new adapter
[SCSI] bfa: fix comments for c files
...
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs_lport.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_lport.c | 468 |
1 files changed, 204 insertions, 264 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index b522bf30247a..377cbfff6f2e 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -15,10 +15,6 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | /** | ||
19 | * bfa_fcs_lport.c BFA FCS port | ||
20 | */ | ||
21 | |||
22 | #include "bfa_fcs.h" | 18 | #include "bfa_fcs.h" |
23 | #include "bfa_fcbuild.h" | 19 | #include "bfa_fcbuild.h" |
24 | #include "bfa_fc.h" | 20 | #include "bfa_fc.h" |
@@ -26,10 +22,6 @@ | |||
26 | 22 | ||
27 | BFA_TRC_FILE(FCS, PORT); | 23 | BFA_TRC_FILE(FCS, PORT); |
28 | 24 | ||
29 | /** | ||
30 | * Forward declarations | ||
31 | */ | ||
32 | |||
33 | static void bfa_fcs_lport_send_ls_rjt(struct bfa_fcs_lport_s *port, | 25 | static void bfa_fcs_lport_send_ls_rjt(struct bfa_fcs_lport_s *port, |
34 | struct fchs_s *rx_fchs, u8 reason_code, | 26 | struct fchs_s *rx_fchs, u8 reason_code, |
35 | u8 reason_code_expl); | 27 | u8 reason_code_expl); |
@@ -72,7 +64,7 @@ static struct { | |||
72 | bfa_fcs_lport_n2n_offline}, | 64 | bfa_fcs_lport_n2n_offline}, |
73 | }; | 65 | }; |
74 | 66 | ||
75 | /** | 67 | /* |
76 | * fcs_port_sm FCS logical port state machine | 68 | * fcs_port_sm FCS logical port state machine |
77 | */ | 69 | */ |
78 | 70 | ||
@@ -240,7 +232,7 @@ bfa_fcs_lport_sm_deleting( | |||
240 | } | 232 | } |
241 | } | 233 | } |
242 | 234 | ||
243 | /** | 235 | /* |
244 | * fcs_port_pvt | 236 | * fcs_port_pvt |
245 | */ | 237 | */ |
246 | 238 | ||
@@ -272,7 +264,7 @@ bfa_fcs_lport_send_ls_rjt(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs, | |||
272 | FC_MAX_PDUSZ, 0); | 264 | FC_MAX_PDUSZ, 0); |
273 | } | 265 | } |
274 | 266 | ||
275 | /** | 267 | /* |
276 | * Process incoming plogi from a remote port. | 268 | * Process incoming plogi from a remote port. |
277 | */ | 269 | */ |
278 | static void | 270 | static void |
@@ -303,7 +295,7 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, | |||
303 | return; | 295 | return; |
304 | } | 296 | } |
305 | 297 | ||
306 | /** | 298 | /* |
307 | * Direct Attach P2P mode : verify address assigned by the r-port. | 299 | * Direct Attach P2P mode : verify address assigned by the r-port. |
308 | */ | 300 | */ |
309 | if ((!bfa_fcs_fabric_is_switched(port->fabric)) && | 301 | if ((!bfa_fcs_fabric_is_switched(port->fabric)) && |
@@ -319,12 +311,12 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, | |||
319 | port->pid = rx_fchs->d_id; | 311 | port->pid = rx_fchs->d_id; |
320 | } | 312 | } |
321 | 313 | ||
322 | /** | 314 | /* |
323 | * First, check if we know the device by pwwn. | 315 | * First, check if we know the device by pwwn. |
324 | */ | 316 | */ |
325 | rport = bfa_fcs_lport_get_rport_by_pwwn(port, plogi->port_name); | 317 | rport = bfa_fcs_lport_get_rport_by_pwwn(port, plogi->port_name); |
326 | if (rport) { | 318 | if (rport) { |
327 | /** | 319 | /* |
328 | * Direct Attach P2P mode : handle address assigned by r-port. | 320 | * Direct Attach P2P mode : handle address assigned by r-port. |
329 | */ | 321 | */ |
330 | if ((!bfa_fcs_fabric_is_switched(port->fabric)) && | 322 | if ((!bfa_fcs_fabric_is_switched(port->fabric)) && |
@@ -337,37 +329,37 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, | |||
337 | return; | 329 | return; |
338 | } | 330 | } |
339 | 331 | ||
340 | /** | 332 | /* |
341 | * Next, lookup rport by PID. | 333 | * Next, lookup rport by PID. |
342 | */ | 334 | */ |
343 | rport = bfa_fcs_lport_get_rport_by_pid(port, rx_fchs->s_id); | 335 | rport = bfa_fcs_lport_get_rport_by_pid(port, rx_fchs->s_id); |
344 | if (!rport) { | 336 | if (!rport) { |
345 | /** | 337 | /* |
346 | * Inbound PLOGI from a new device. | 338 | * Inbound PLOGI from a new device. |
347 | */ | 339 | */ |
348 | bfa_fcs_rport_plogi_create(port, rx_fchs, plogi); | 340 | bfa_fcs_rport_plogi_create(port, rx_fchs, plogi); |
349 | return; | 341 | return; |
350 | } | 342 | } |
351 | 343 | ||
352 | /** | 344 | /* |
353 | * Rport is known only by PID. | 345 | * Rport is known only by PID. |
354 | */ | 346 | */ |
355 | if (rport->pwwn) { | 347 | if (rport->pwwn) { |
356 | /** | 348 | /* |
357 | * This is a different device with the same pid. Old device | 349 | * This is a different device with the same pid. Old device |
358 | * disappeared. Send implicit LOGO to old device. | 350 | * disappeared. Send implicit LOGO to old device. |
359 | */ | 351 | */ |
360 | bfa_assert(rport->pwwn != plogi->port_name); | 352 | bfa_assert(rport->pwwn != plogi->port_name); |
361 | bfa_fcs_rport_logo_imp(rport); | 353 | bfa_fcs_rport_logo_imp(rport); |
362 | 354 | ||
363 | /** | 355 | /* |
364 | * Inbound PLOGI from a new device (with old PID). | 356 | * Inbound PLOGI from a new device (with old PID). |
365 | */ | 357 | */ |
366 | bfa_fcs_rport_plogi_create(port, rx_fchs, plogi); | 358 | bfa_fcs_rport_plogi_create(port, rx_fchs, plogi); |
367 | return; | 359 | return; |
368 | } | 360 | } |
369 | 361 | ||
370 | /** | 362 | /* |
371 | * PLOGI crossing each other. | 363 | * PLOGI crossing each other. |
372 | */ | 364 | */ |
373 | bfa_assert(rport->pwwn == WWN_NULL); | 365 | bfa_assert(rport->pwwn == WWN_NULL); |
@@ -479,12 +471,12 @@ static void | |||
479 | bfa_fs_port_get_gen_topo_data(struct bfa_fcs_lport_s *port, | 471 | bfa_fs_port_get_gen_topo_data(struct bfa_fcs_lport_s *port, |
480 | struct fc_rnid_general_topology_data_s *gen_topo_data) | 472 | struct fc_rnid_general_topology_data_s *gen_topo_data) |
481 | { | 473 | { |
482 | bfa_os_memset(gen_topo_data, 0, | 474 | memset(gen_topo_data, 0, |
483 | sizeof(struct fc_rnid_general_topology_data_s)); | 475 | sizeof(struct fc_rnid_general_topology_data_s)); |
484 | 476 | ||
485 | gen_topo_data->asso_type = bfa_os_htonl(RNID_ASSOCIATED_TYPE_HOST); | 477 | gen_topo_data->asso_type = cpu_to_be32(RNID_ASSOCIATED_TYPE_HOST); |
486 | gen_topo_data->phy_port_num = 0; /* @todo */ | 478 | gen_topo_data->phy_port_num = 0; /* @todo */ |
487 | gen_topo_data->num_attached_nodes = bfa_os_htonl(1); | 479 | gen_topo_data->num_attached_nodes = cpu_to_be32(1); |
488 | } | 480 | } |
489 | 481 | ||
490 | static void | 482 | static void |
@@ -598,10 +590,10 @@ bfa_fcs_lport_deleted(struct bfa_fcs_lport_s *port) | |||
598 | 590 | ||
599 | 591 | ||
600 | 592 | ||
601 | /** | 593 | /* |
602 | * fcs_lport_api BFA FCS port API | 594 | * fcs_lport_api BFA FCS port API |
603 | */ | 595 | */ |
604 | /** | 596 | /* |
605 | * Module initialization | 597 | * Module initialization |
606 | */ | 598 | */ |
607 | void | 599 | void |
@@ -610,7 +602,7 @@ bfa_fcs_lport_modinit(struct bfa_fcs_s *fcs) | |||
610 | 602 | ||
611 | } | 603 | } |
612 | 604 | ||
613 | /** | 605 | /* |
614 | * Module cleanup | 606 | * Module cleanup |
615 | */ | 607 | */ |
616 | void | 608 | void |
@@ -619,7 +611,7 @@ bfa_fcs_lport_modexit(struct bfa_fcs_s *fcs) | |||
619 | bfa_fcs_modexit_comp(fcs); | 611 | bfa_fcs_modexit_comp(fcs); |
620 | } | 612 | } |
621 | 613 | ||
622 | /** | 614 | /* |
623 | * Unsolicited frame receive handling. | 615 | * Unsolicited frame receive handling. |
624 | */ | 616 | */ |
625 | void | 617 | void |
@@ -637,7 +629,7 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, | |||
637 | return; | 629 | return; |
638 | } | 630 | } |
639 | 631 | ||
640 | /** | 632 | /* |
641 | * First, handle ELSs that donot require a login. | 633 | * First, handle ELSs that donot require a login. |
642 | */ | 634 | */ |
643 | /* | 635 | /* |
@@ -673,7 +665,7 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, | |||
673 | bfa_fcs_lport_abts_acc(lport, fchs); | 665 | bfa_fcs_lport_abts_acc(lport, fchs); |
674 | return; | 666 | return; |
675 | } | 667 | } |
676 | /** | 668 | /* |
677 | * look for a matching remote port ID | 669 | * look for a matching remote port ID |
678 | */ | 670 | */ |
679 | rport = bfa_fcs_lport_get_rport_by_pid(lport, pid); | 671 | rport = bfa_fcs_lport_get_rport_by_pid(lport, pid); |
@@ -686,7 +678,7 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, | |||
686 | return; | 678 | return; |
687 | } | 679 | } |
688 | 680 | ||
689 | /** | 681 | /* |
690 | * Only handles ELS frames for now. | 682 | * Only handles ELS frames for now. |
691 | */ | 683 | */ |
692 | if (fchs->type != FC_TYPE_ELS) { | 684 | if (fchs->type != FC_TYPE_ELS) { |
@@ -702,20 +694,20 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, | |||
702 | } | 694 | } |
703 | 695 | ||
704 | if (els_cmd->els_code == FC_ELS_LOGO) { | 696 | if (els_cmd->els_code == FC_ELS_LOGO) { |
705 | /** | 697 | /* |
706 | * @todo Handle LOGO frames received. | 698 | * @todo Handle LOGO frames received. |
707 | */ | 699 | */ |
708 | return; | 700 | return; |
709 | } | 701 | } |
710 | 702 | ||
711 | if (els_cmd->els_code == FC_ELS_PRLI) { | 703 | if (els_cmd->els_code == FC_ELS_PRLI) { |
712 | /** | 704 | /* |
713 | * @todo Handle PRLI frames received. | 705 | * @todo Handle PRLI frames received. |
714 | */ | 706 | */ |
715 | return; | 707 | return; |
716 | } | 708 | } |
717 | 709 | ||
718 | /** | 710 | /* |
719 | * Unhandled ELS frames. Send a LS_RJT. | 711 | * Unhandled ELS frames. Send a LS_RJT. |
720 | */ | 712 | */ |
721 | bfa_fcs_lport_send_ls_rjt(lport, fchs, FC_LS_RJT_RSN_CMD_NOT_SUPP, | 713 | bfa_fcs_lport_send_ls_rjt(lport, fchs, FC_LS_RJT_RSN_CMD_NOT_SUPP, |
@@ -723,7 +715,7 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, | |||
723 | 715 | ||
724 | } | 716 | } |
725 | 717 | ||
726 | /** | 718 | /* |
727 | * PID based Lookup for a R-Port in the Port R-Port Queue | 719 | * PID based Lookup for a R-Port in the Port R-Port Queue |
728 | */ | 720 | */ |
729 | struct bfa_fcs_rport_s * | 721 | struct bfa_fcs_rport_s * |
@@ -742,7 +734,7 @@ bfa_fcs_lport_get_rport_by_pid(struct bfa_fcs_lport_s *port, u32 pid) | |||
742 | return NULL; | 734 | return NULL; |
743 | } | 735 | } |
744 | 736 | ||
745 | /** | 737 | /* |
746 | * PWWN based Lookup for a R-Port in the Port R-Port Queue | 738 | * PWWN based Lookup for a R-Port in the Port R-Port Queue |
747 | */ | 739 | */ |
748 | struct bfa_fcs_rport_s * | 740 | struct bfa_fcs_rport_s * |
@@ -761,7 +753,7 @@ bfa_fcs_lport_get_rport_by_pwwn(struct bfa_fcs_lport_s *port, wwn_t pwwn) | |||
761 | return NULL; | 753 | return NULL; |
762 | } | 754 | } |
763 | 755 | ||
764 | /** | 756 | /* |
765 | * NWWN based Lookup for a R-Port in the Port R-Port Queue | 757 | * NWWN based Lookup for a R-Port in the Port R-Port Queue |
766 | */ | 758 | */ |
767 | struct bfa_fcs_rport_s * | 759 | struct bfa_fcs_rport_s * |
@@ -780,7 +772,7 @@ bfa_fcs_lport_get_rport_by_nwwn(struct bfa_fcs_lport_s *port, wwn_t nwwn) | |||
780 | return NULL; | 772 | return NULL; |
781 | } | 773 | } |
782 | 774 | ||
783 | /** | 775 | /* |
784 | * Called by rport module when new rports are discovered. | 776 | * Called by rport module when new rports are discovered. |
785 | */ | 777 | */ |
786 | void | 778 | void |
@@ -792,7 +784,7 @@ bfa_fcs_lport_add_rport( | |||
792 | port->num_rports++; | 784 | port->num_rports++; |
793 | } | 785 | } |
794 | 786 | ||
795 | /** | 787 | /* |
796 | * Called by rport module to when rports are deleted. | 788 | * Called by rport module to when rports are deleted. |
797 | */ | 789 | */ |
798 | void | 790 | void |
@@ -807,7 +799,7 @@ bfa_fcs_lport_del_rport( | |||
807 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_DELRPORT); | 799 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_DELRPORT); |
808 | } | 800 | } |
809 | 801 | ||
810 | /** | 802 | /* |
811 | * Called by fabric for base port when fabric login is complete. | 803 | * Called by fabric for base port when fabric login is complete. |
812 | * Called by vport for virtual ports when FDISC is complete. | 804 | * Called by vport for virtual ports when FDISC is complete. |
813 | */ | 805 | */ |
@@ -817,7 +809,7 @@ bfa_fcs_lport_online(struct bfa_fcs_lport_s *port) | |||
817 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_ONLINE); | 809 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_ONLINE); |
818 | } | 810 | } |
819 | 811 | ||
820 | /** | 812 | /* |
821 | * Called by fabric for base port when fabric goes offline. | 813 | * Called by fabric for base port when fabric goes offline. |
822 | * Called by vport for virtual ports when virtual port becomes offline. | 814 | * Called by vport for virtual ports when virtual port becomes offline. |
823 | */ | 815 | */ |
@@ -827,7 +819,7 @@ bfa_fcs_lport_offline(struct bfa_fcs_lport_s *port) | |||
827 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_OFFLINE); | 819 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_OFFLINE); |
828 | } | 820 | } |
829 | 821 | ||
830 | /** | 822 | /* |
831 | * Called by fabric to delete base lport and associated resources. | 823 | * Called by fabric to delete base lport and associated resources. |
832 | * | 824 | * |
833 | * Called by vport to delete lport and associated resources. Should call | 825 | * Called by vport to delete lport and associated resources. Should call |
@@ -839,7 +831,7 @@ bfa_fcs_lport_delete(struct bfa_fcs_lport_s *port) | |||
839 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_DELETE); | 831 | bfa_sm_send_event(port, BFA_FCS_PORT_SM_DELETE); |
840 | } | 832 | } |
841 | 833 | ||
842 | /** | 834 | /* |
843 | * Return TRUE if port is online, else return FALSE | 835 | * Return TRUE if port is online, else return FALSE |
844 | */ | 836 | */ |
845 | bfa_boolean_t | 837 | bfa_boolean_t |
@@ -848,7 +840,7 @@ bfa_fcs_lport_is_online(struct bfa_fcs_lport_s *port) | |||
848 | return bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online); | 840 | return bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online); |
849 | } | 841 | } |
850 | 842 | ||
851 | /** | 843 | /* |
852 | * Attach time initialization of logical ports. | 844 | * Attach time initialization of logical ports. |
853 | */ | 845 | */ |
854 | void | 846 | void |
@@ -865,7 +857,7 @@ bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs, | |||
865 | lport->num_rports = 0; | 857 | lport->num_rports = 0; |
866 | } | 858 | } |
867 | 859 | ||
868 | /** | 860 | /* |
869 | * Logical port initialization of base or virtual port. | 861 | * Logical port initialization of base or virtual port. |
870 | * Called by fabric for base port or by vport for virtual ports. | 862 | * Called by fabric for base port or by vport for virtual ports. |
871 | */ | 863 | */ |
@@ -878,7 +870,7 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, | |||
878 | struct bfad_s *bfad = (struct bfad_s *)lport->fcs->bfad; | 870 | struct bfad_s *bfad = (struct bfad_s *)lport->fcs->bfad; |
879 | char lpwwn_buf[BFA_STRING_32]; | 871 | char lpwwn_buf[BFA_STRING_32]; |
880 | 872 | ||
881 | bfa_os_assign(lport->port_cfg, *port_cfg); | 873 | lport->port_cfg = *port_cfg; |
882 | 874 | ||
883 | lport->bfad_port = bfa_fcb_lport_new(lport->fcs->bfad, lport, | 875 | lport->bfad_port = bfa_fcb_lport_new(lport->fcs->bfad, lport, |
884 | lport->port_cfg.roles, | 876 | lport->port_cfg.roles, |
@@ -894,7 +886,7 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, | |||
894 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); | 886 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); |
895 | } | 887 | } |
896 | 888 | ||
897 | /** | 889 | /* |
898 | * fcs_lport_api | 890 | * fcs_lport_api |
899 | */ | 891 | */ |
900 | 892 | ||
@@ -934,11 +926,11 @@ bfa_fcs_lport_get_attr( | |||
934 | } | 926 | } |
935 | } | 927 | } |
936 | 928 | ||
937 | /** | 929 | /* |
938 | * bfa_fcs_lport_fab port fab functions | 930 | * bfa_fcs_lport_fab port fab functions |
939 | */ | 931 | */ |
940 | 932 | ||
941 | /** | 933 | /* |
942 | * Called by port to initialize fabric services of the base port. | 934 | * Called by port to initialize fabric services of the base port. |
943 | */ | 935 | */ |
944 | static void | 936 | static void |
@@ -949,7 +941,7 @@ bfa_fcs_lport_fab_init(struct bfa_fcs_lport_s *port) | |||
949 | bfa_fcs_lport_ms_init(port); | 941 | bfa_fcs_lport_ms_init(port); |
950 | } | 942 | } |
951 | 943 | ||
952 | /** | 944 | /* |
953 | * Called by port to notify transition to online state. | 945 | * Called by port to notify transition to online state. |
954 | */ | 946 | */ |
955 | static void | 947 | static void |
@@ -959,7 +951,7 @@ bfa_fcs_lport_fab_online(struct bfa_fcs_lport_s *port) | |||
959 | bfa_fcs_lport_scn_online(port); | 951 | bfa_fcs_lport_scn_online(port); |
960 | } | 952 | } |
961 | 953 | ||
962 | /** | 954 | /* |
963 | * Called by port to notify transition to offline state. | 955 | * Called by port to notify transition to offline state. |
964 | */ | 956 | */ |
965 | static void | 957 | static void |
@@ -970,11 +962,11 @@ bfa_fcs_lport_fab_offline(struct bfa_fcs_lport_s *port) | |||
970 | bfa_fcs_lport_ms_offline(port); | 962 | bfa_fcs_lport_ms_offline(port); |
971 | } | 963 | } |
972 | 964 | ||
973 | /** | 965 | /* |
974 | * bfa_fcs_lport_n2n functions | 966 | * bfa_fcs_lport_n2n functions |
975 | */ | 967 | */ |
976 | 968 | ||
977 | /** | 969 | /* |
978 | * Called by fcs/port to initialize N2N topology. | 970 | * Called by fcs/port to initialize N2N topology. |
979 | */ | 971 | */ |
980 | static void | 972 | static void |
@@ -982,7 +974,7 @@ bfa_fcs_lport_n2n_init(struct bfa_fcs_lport_s *port) | |||
982 | { | 974 | { |
983 | } | 975 | } |
984 | 976 | ||
985 | /** | 977 | /* |
986 | * Called by fcs/port to notify transition to online state. | 978 | * Called by fcs/port to notify transition to online state. |
987 | */ | 979 | */ |
988 | static void | 980 | static void |
@@ -1006,7 +998,7 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) | |||
1006 | ((void *)&pcfg->pwwn, (void *)&n2n_port->rem_port_wwn, | 998 | ((void *)&pcfg->pwwn, (void *)&n2n_port->rem_port_wwn, |
1007 | sizeof(wwn_t)) > 0) { | 999 | sizeof(wwn_t)) > 0) { |
1008 | port->pid = N2N_LOCAL_PID; | 1000 | port->pid = N2N_LOCAL_PID; |
1009 | /** | 1001 | /* |
1010 | * First, check if we know the device by pwwn. | 1002 | * First, check if we know the device by pwwn. |
1011 | */ | 1003 | */ |
1012 | rport = bfa_fcs_lport_get_rport_by_pwwn(port, | 1004 | rport = bfa_fcs_lport_get_rport_by_pwwn(port, |
@@ -1035,7 +1027,7 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) | |||
1035 | } | 1027 | } |
1036 | } | 1028 | } |
1037 | 1029 | ||
1038 | /** | 1030 | /* |
1039 | * Called by fcs/port to notify transition to offline state. | 1031 | * Called by fcs/port to notify transition to offline state. |
1040 | */ | 1032 | */ |
1041 | static void | 1033 | static void |
@@ -1094,11 +1086,11 @@ static void bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1094 | struct bfa_fcs_fdmi_hba_attr_s *hba_attr); | 1086 | struct bfa_fcs_fdmi_hba_attr_s *hba_attr); |
1095 | static void bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, | 1087 | static void bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, |
1096 | struct bfa_fcs_fdmi_port_attr_s *port_attr); | 1088 | struct bfa_fcs_fdmi_port_attr_s *port_attr); |
1097 | /** | 1089 | /* |
1098 | * fcs_fdmi_sm FCS FDMI state machine | 1090 | * fcs_fdmi_sm FCS FDMI state machine |
1099 | */ | 1091 | */ |
1100 | 1092 | ||
1101 | /** | 1093 | /* |
1102 | * FDMI State Machine events | 1094 | * FDMI State Machine events |
1103 | */ | 1095 | */ |
1104 | enum port_fdmi_event { | 1096 | enum port_fdmi_event { |
@@ -1143,7 +1135,7 @@ static void bfa_fcs_lport_fdmi_sm_online(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1143 | static void bfa_fcs_lport_fdmi_sm_disabled( | 1135 | static void bfa_fcs_lport_fdmi_sm_disabled( |
1144 | struct bfa_fcs_lport_fdmi_s *fdmi, | 1136 | struct bfa_fcs_lport_fdmi_s *fdmi, |
1145 | enum port_fdmi_event event); | 1137 | enum port_fdmi_event event); |
1146 | /** | 1138 | /* |
1147 | * Start in offline state - awaiting MS to send start. | 1139 | * Start in offline state - awaiting MS to send start. |
1148 | */ | 1140 | */ |
1149 | static void | 1141 | static void |
@@ -1510,7 +1502,7 @@ bfa_fcs_lport_fdmi_sm_online(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1510 | bfa_sm_fault(port->fcs, event); | 1502 | bfa_sm_fault(port->fcs, event); |
1511 | } | 1503 | } |
1512 | } | 1504 | } |
1513 | /** | 1505 | /* |
1514 | * FDMI is disabled state. | 1506 | * FDMI is disabled state. |
1515 | */ | 1507 | */ |
1516 | static void | 1508 | static void |
@@ -1525,7 +1517,7 @@ bfa_fcs_lport_fdmi_sm_disabled(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1525 | /* No op State. It can only be enabled at Driver Init. */ | 1517 | /* No op State. It can only be enabled at Driver Init. */ |
1526 | } | 1518 | } |
1527 | 1519 | ||
1528 | /** | 1520 | /* |
1529 | * RHBA : Register HBA Attributes. | 1521 | * RHBA : Register HBA Attributes. |
1530 | */ | 1522 | */ |
1531 | static void | 1523 | static void |
@@ -1549,7 +1541,7 @@ bfa_fcs_lport_fdmi_send_rhba(void *fdmi_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1549 | fdmi->fcxp = fcxp; | 1541 | fdmi->fcxp = fcxp; |
1550 | 1542 | ||
1551 | pyld = bfa_fcxp_get_reqbuf(fcxp); | 1543 | pyld = bfa_fcxp_get_reqbuf(fcxp); |
1552 | bfa_os_memset(pyld, 0, FC_MAX_PDUSZ); | 1544 | memset(pyld, 0, FC_MAX_PDUSZ); |
1553 | 1545 | ||
1554 | len = fc_fdmi_reqhdr_build(&fchs, pyld, bfa_fcs_lport_get_fcid(port), | 1546 | len = fc_fdmi_reqhdr_build(&fchs, pyld, bfa_fcs_lport_get_fcid(port), |
1555 | FDMI_RHBA); | 1547 | FDMI_RHBA); |
@@ -1584,7 +1576,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1584 | bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr); | 1576 | bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr); |
1585 | 1577 | ||
1586 | rhba->hba_id = bfa_fcs_lport_get_pwwn(port); | 1578 | rhba->hba_id = bfa_fcs_lport_get_pwwn(port); |
1587 | rhba->port_list.num_ports = bfa_os_htonl(1); | 1579 | rhba->port_list.num_ports = cpu_to_be32(1); |
1588 | rhba->port_list.port_entry = bfa_fcs_lport_get_pwwn(port); | 1580 | rhba->port_list.port_entry = bfa_fcs_lport_get_pwwn(port); |
1589 | 1581 | ||
1590 | len = sizeof(rhba->hba_id) + sizeof(rhba->port_list); | 1582 | len = sizeof(rhba->hba_id) + sizeof(rhba->port_list); |
@@ -1601,86 +1593,69 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1601 | * Node Name | 1593 | * Node Name |
1602 | */ | 1594 | */ |
1603 | attr = (struct fdmi_attr_s *) curr_ptr; | 1595 | attr = (struct fdmi_attr_s *) curr_ptr; |
1604 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_NODENAME); | 1596 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODENAME); |
1605 | attr->len = sizeof(wwn_t); | 1597 | attr->len = sizeof(wwn_t); |
1606 | memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), attr->len); | 1598 | memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), attr->len); |
1607 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1599 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1608 | len += attr->len; | 1600 | len += attr->len; |
1609 | count++; | 1601 | count++; |
1610 | attr->len = | 1602 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1611 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1612 | sizeof(attr->len)); | 1603 | sizeof(attr->len)); |
1613 | 1604 | ||
1614 | /* | 1605 | /* |
1615 | * Manufacturer | 1606 | * Manufacturer |
1616 | */ | 1607 | */ |
1617 | attr = (struct fdmi_attr_s *) curr_ptr; | 1608 | attr = (struct fdmi_attr_s *) curr_ptr; |
1618 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MANUFACTURER); | 1609 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MANUFACTURER); |
1619 | attr->len = (u16) strlen(fcs_hba_attr->manufacturer); | 1610 | attr->len = (u16) strlen(fcs_hba_attr->manufacturer); |
1620 | memcpy(attr->value, fcs_hba_attr->manufacturer, attr->len); | 1611 | memcpy(attr->value, fcs_hba_attr->manufacturer, attr->len); |
1621 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1612 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1622 | *fields need | ||
1623 | *to be 4 byte | ||
1624 | *aligned */ | ||
1625 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1613 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1626 | len += attr->len; | 1614 | len += attr->len; |
1627 | count++; | 1615 | count++; |
1628 | attr->len = | 1616 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1629 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1630 | sizeof(attr->len)); | 1617 | sizeof(attr->len)); |
1631 | 1618 | ||
1632 | /* | 1619 | /* |
1633 | * Serial Number | 1620 | * Serial Number |
1634 | */ | 1621 | */ |
1635 | attr = (struct fdmi_attr_s *) curr_ptr; | 1622 | attr = (struct fdmi_attr_s *) curr_ptr; |
1636 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_SERIALNUM); | 1623 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_SERIALNUM); |
1637 | attr->len = (u16) strlen(fcs_hba_attr->serial_num); | 1624 | attr->len = (u16) strlen(fcs_hba_attr->serial_num); |
1638 | memcpy(attr->value, fcs_hba_attr->serial_num, attr->len); | 1625 | memcpy(attr->value, fcs_hba_attr->serial_num, attr->len); |
1639 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1626 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1640 | *fields need | ||
1641 | *to be 4 byte | ||
1642 | *aligned */ | ||
1643 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1627 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1644 | len += attr->len; | 1628 | len += attr->len; |
1645 | count++; | 1629 | count++; |
1646 | attr->len = | 1630 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1647 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1648 | sizeof(attr->len)); | 1631 | sizeof(attr->len)); |
1649 | 1632 | ||
1650 | /* | 1633 | /* |
1651 | * Model | 1634 | * Model |
1652 | */ | 1635 | */ |
1653 | attr = (struct fdmi_attr_s *) curr_ptr; | 1636 | attr = (struct fdmi_attr_s *) curr_ptr; |
1654 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MODEL); | 1637 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL); |
1655 | attr->len = (u16) strlen(fcs_hba_attr->model); | 1638 | attr->len = (u16) strlen(fcs_hba_attr->model); |
1656 | memcpy(attr->value, fcs_hba_attr->model, attr->len); | 1639 | memcpy(attr->value, fcs_hba_attr->model, attr->len); |
1657 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1640 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1658 | *fields need | ||
1659 | *to be 4 byte | ||
1660 | *aligned */ | ||
1661 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1641 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1662 | len += attr->len; | 1642 | len += attr->len; |
1663 | count++; | 1643 | count++; |
1664 | attr->len = | 1644 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1665 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1666 | sizeof(attr->len)); | 1645 | sizeof(attr->len)); |
1667 | 1646 | ||
1668 | /* | 1647 | /* |
1669 | * Model Desc | 1648 | * Model Desc |
1670 | */ | 1649 | */ |
1671 | attr = (struct fdmi_attr_s *) curr_ptr; | 1650 | attr = (struct fdmi_attr_s *) curr_ptr; |
1672 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MODEL_DESC); | 1651 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL_DESC); |
1673 | attr->len = (u16) strlen(fcs_hba_attr->model_desc); | 1652 | attr->len = (u16) strlen(fcs_hba_attr->model_desc); |
1674 | memcpy(attr->value, fcs_hba_attr->model_desc, attr->len); | 1653 | memcpy(attr->value, fcs_hba_attr->model_desc, attr->len); |
1675 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1654 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1676 | *fields need | ||
1677 | *to be 4 byte | ||
1678 | *aligned */ | ||
1679 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1655 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1680 | len += attr->len; | 1656 | len += attr->len; |
1681 | count++; | 1657 | count++; |
1682 | attr->len = | 1658 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1683 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1684 | sizeof(attr->len)); | 1659 | sizeof(attr->len)); |
1685 | 1660 | ||
1686 | /* | 1661 | /* |
@@ -1688,18 +1663,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1688 | */ | 1663 | */ |
1689 | if (fcs_hba_attr->hw_version[0] != '\0') { | 1664 | if (fcs_hba_attr->hw_version[0] != '\0') { |
1690 | attr = (struct fdmi_attr_s *) curr_ptr; | 1665 | attr = (struct fdmi_attr_s *) curr_ptr; |
1691 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_HW_VERSION); | 1666 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_HW_VERSION); |
1692 | attr->len = (u16) strlen(fcs_hba_attr->hw_version); | 1667 | attr->len = (u16) strlen(fcs_hba_attr->hw_version); |
1693 | memcpy(attr->value, fcs_hba_attr->hw_version, attr->len); | 1668 | memcpy(attr->value, fcs_hba_attr->hw_version, attr->len); |
1694 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1669 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1695 | *fields need | ||
1696 | *to be 4 byte | ||
1697 | *aligned */ | ||
1698 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1670 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1699 | len += attr->len; | 1671 | len += attr->len; |
1700 | count++; | 1672 | count++; |
1701 | attr->len = | 1673 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1702 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1703 | sizeof(attr->len)); | 1674 | sizeof(attr->len)); |
1704 | } | 1675 | } |
1705 | 1676 | ||
@@ -1707,18 +1678,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1707 | * Driver Version | 1678 | * Driver Version |
1708 | */ | 1679 | */ |
1709 | attr = (struct fdmi_attr_s *) curr_ptr; | 1680 | attr = (struct fdmi_attr_s *) curr_ptr; |
1710 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_DRIVER_VERSION); | 1681 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_DRIVER_VERSION); |
1711 | attr->len = (u16) strlen(fcs_hba_attr->driver_version); | 1682 | attr->len = (u16) strlen(fcs_hba_attr->driver_version); |
1712 | memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); | 1683 | memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); |
1713 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1684 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1714 | *fields need | ||
1715 | *to be 4 byte | ||
1716 | *aligned */ | ||
1717 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1685 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1718 | len += attr->len;; | 1686 | len += attr->len;; |
1719 | count++; | 1687 | count++; |
1720 | attr->len = | 1688 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1721 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1722 | sizeof(attr->len)); | 1689 | sizeof(attr->len)); |
1723 | 1690 | ||
1724 | /* | 1691 | /* |
@@ -1726,18 +1693,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1726 | */ | 1693 | */ |
1727 | if (fcs_hba_attr->option_rom_ver[0] != '\0') { | 1694 | if (fcs_hba_attr->option_rom_ver[0] != '\0') { |
1728 | attr = (struct fdmi_attr_s *) curr_ptr; | 1695 | attr = (struct fdmi_attr_s *) curr_ptr; |
1729 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_ROM_VERSION); | 1696 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_ROM_VERSION); |
1730 | attr->len = (u16) strlen(fcs_hba_attr->option_rom_ver); | 1697 | attr->len = (u16) strlen(fcs_hba_attr->option_rom_ver); |
1731 | memcpy(attr->value, fcs_hba_attr->option_rom_ver, attr->len); | 1698 | memcpy(attr->value, fcs_hba_attr->option_rom_ver, attr->len); |
1732 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1699 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1733 | *fields need | ||
1734 | *to be 4 byte | ||
1735 | *aligned */ | ||
1736 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1700 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1737 | len += attr->len; | 1701 | len += attr->len; |
1738 | count++; | 1702 | count++; |
1739 | attr->len = | 1703 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1740 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1741 | sizeof(attr->len)); | 1704 | sizeof(attr->len)); |
1742 | } | 1705 | } |
1743 | 1706 | ||
@@ -1745,18 +1708,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1745 | * f/w Version = driver version | 1708 | * f/w Version = driver version |
1746 | */ | 1709 | */ |
1747 | attr = (struct fdmi_attr_s *) curr_ptr; | 1710 | attr = (struct fdmi_attr_s *) curr_ptr; |
1748 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_FW_VERSION); | 1711 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FW_VERSION); |
1749 | attr->len = (u16) strlen(fcs_hba_attr->driver_version); | 1712 | attr->len = (u16) strlen(fcs_hba_attr->driver_version); |
1750 | memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); | 1713 | memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); |
1751 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1714 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1752 | *fields need | ||
1753 | *to be 4 byte | ||
1754 | *aligned */ | ||
1755 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1715 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1756 | len += attr->len; | 1716 | len += attr->len; |
1757 | count++; | 1717 | count++; |
1758 | attr->len = | 1718 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1759 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1760 | sizeof(attr->len)); | 1719 | sizeof(attr->len)); |
1761 | 1720 | ||
1762 | /* | 1721 | /* |
@@ -1764,18 +1723,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1764 | */ | 1723 | */ |
1765 | if (fcs_hba_attr->os_name[0] != '\0') { | 1724 | if (fcs_hba_attr->os_name[0] != '\0') { |
1766 | attr = (struct fdmi_attr_s *) curr_ptr; | 1725 | attr = (struct fdmi_attr_s *) curr_ptr; |
1767 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_OS_NAME); | 1726 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_OS_NAME); |
1768 | attr->len = (u16) strlen(fcs_hba_attr->os_name); | 1727 | attr->len = (u16) strlen(fcs_hba_attr->os_name); |
1769 | memcpy(attr->value, fcs_hba_attr->os_name, attr->len); | 1728 | memcpy(attr->value, fcs_hba_attr->os_name, attr->len); |
1770 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1729 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1771 | *fields need | ||
1772 | *to be 4 byte | ||
1773 | *aligned */ | ||
1774 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1730 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1775 | len += attr->len; | 1731 | len += attr->len; |
1776 | count++; | 1732 | count++; |
1777 | attr->len = | 1733 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1778 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1779 | sizeof(attr->len)); | 1734 | sizeof(attr->len)); |
1780 | } | 1735 | } |
1781 | 1736 | ||
@@ -1783,22 +1738,20 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1783 | * MAX_CT_PAYLOAD | 1738 | * MAX_CT_PAYLOAD |
1784 | */ | 1739 | */ |
1785 | attr = (struct fdmi_attr_s *) curr_ptr; | 1740 | attr = (struct fdmi_attr_s *) curr_ptr; |
1786 | attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MAX_CT); | 1741 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT); |
1787 | attr->len = sizeof(fcs_hba_attr->max_ct_pyld); | 1742 | attr->len = sizeof(fcs_hba_attr->max_ct_pyld); |
1788 | memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, attr->len); | 1743 | memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, attr->len); |
1789 | len += attr->len; | 1744 | len += attr->len; |
1790 | count++; | 1745 | count++; |
1791 | attr->len = | 1746 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1792 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1793 | sizeof(attr->len)); | 1747 | sizeof(attr->len)); |
1794 | 1748 | ||
1795 | /* | 1749 | /* |
1796 | * Update size of payload | 1750 | * Update size of payload |
1797 | */ | 1751 | */ |
1798 | len += ((sizeof(attr->type) + | 1752 | len += ((sizeof(attr->type) + sizeof(attr->len)) * count); |
1799 | sizeof(attr->len)) * count); | ||
1800 | 1753 | ||
1801 | rhba->hba_attr_blk.attr_count = bfa_os_htonl(count); | 1754 | rhba->hba_attr_blk.attr_count = cpu_to_be32(count); |
1802 | return len; | 1755 | return len; |
1803 | } | 1756 | } |
1804 | 1757 | ||
@@ -1825,7 +1778,7 @@ bfa_fcs_lport_fdmi_rhba_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
1825 | } | 1778 | } |
1826 | 1779 | ||
1827 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 1780 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
1828 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 1781 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
1829 | 1782 | ||
1830 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 1783 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
1831 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); | 1784 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); |
@@ -1837,7 +1790,7 @@ bfa_fcs_lport_fdmi_rhba_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
1837 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_ERROR); | 1790 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_ERROR); |
1838 | } | 1791 | } |
1839 | 1792 | ||
1840 | /** | 1793 | /* |
1841 | * RPRT : Register Port | 1794 | * RPRT : Register Port |
1842 | */ | 1795 | */ |
1843 | static void | 1796 | static void |
@@ -1861,7 +1814,7 @@ bfa_fcs_lport_fdmi_send_rprt(void *fdmi_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1861 | fdmi->fcxp = fcxp; | 1814 | fdmi->fcxp = fcxp; |
1862 | 1815 | ||
1863 | pyld = bfa_fcxp_get_reqbuf(fcxp); | 1816 | pyld = bfa_fcxp_get_reqbuf(fcxp); |
1864 | bfa_os_memset(pyld, 0, FC_MAX_PDUSZ); | 1817 | memset(pyld, 0, FC_MAX_PDUSZ); |
1865 | 1818 | ||
1866 | len = fc_fdmi_reqhdr_build(&fchs, pyld, bfa_fcs_lport_get_fcid(port), | 1819 | len = fc_fdmi_reqhdr_build(&fchs, pyld, bfa_fcs_lport_get_fcid(port), |
1867 | FDMI_RPRT); | 1820 | FDMI_RPRT); |
@@ -1879,7 +1832,7 @@ bfa_fcs_lport_fdmi_send_rprt(void *fdmi_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1879 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RPRT_SENT); | 1832 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RPRT_SENT); |
1880 | } | 1833 | } |
1881 | 1834 | ||
1882 | /** | 1835 | /* |
1883 | * This routine builds Port Attribute Block that used in RPA, RPRT commands. | 1836 | * This routine builds Port Attribute Block that used in RPA, RPRT commands. |
1884 | */ | 1837 | */ |
1885 | static u16 | 1838 | static u16 |
@@ -1909,56 +1862,54 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1909 | * FC4 Types | 1862 | * FC4 Types |
1910 | */ | 1863 | */ |
1911 | attr = (struct fdmi_attr_s *) curr_ptr; | 1864 | attr = (struct fdmi_attr_s *) curr_ptr; |
1912 | attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_FC4_TYPES); | 1865 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FC4_TYPES); |
1913 | attr->len = sizeof(fcs_port_attr.supp_fc4_types); | 1866 | attr->len = sizeof(fcs_port_attr.supp_fc4_types); |
1914 | memcpy(attr->value, fcs_port_attr.supp_fc4_types, attr->len); | 1867 | memcpy(attr->value, fcs_port_attr.supp_fc4_types, attr->len); |
1915 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1868 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1916 | len += attr->len; | 1869 | len += attr->len; |
1917 | ++count; | 1870 | ++count; |
1918 | attr->len = | 1871 | attr->len = |
1919 | bfa_os_htons(attr->len + sizeof(attr->type) + | 1872 | cpu_to_be16(attr->len + sizeof(attr->type) + |
1920 | sizeof(attr->len)); | 1873 | sizeof(attr->len)); |
1921 | 1874 | ||
1922 | /* | 1875 | /* |
1923 | * Supported Speed | 1876 | * Supported Speed |
1924 | */ | 1877 | */ |
1925 | attr = (struct fdmi_attr_s *) curr_ptr; | 1878 | attr = (struct fdmi_attr_s *) curr_ptr; |
1926 | attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_SUPP_SPEED); | 1879 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_SUPP_SPEED); |
1927 | attr->len = sizeof(fcs_port_attr.supp_speed); | 1880 | attr->len = sizeof(fcs_port_attr.supp_speed); |
1928 | memcpy(attr->value, &fcs_port_attr.supp_speed, attr->len); | 1881 | memcpy(attr->value, &fcs_port_attr.supp_speed, attr->len); |
1929 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1882 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1930 | len += attr->len; | 1883 | len += attr->len; |
1931 | ++count; | 1884 | ++count; |
1932 | attr->len = | 1885 | attr->len = |
1933 | bfa_os_htons(attr->len + sizeof(attr->type) + | 1886 | cpu_to_be16(attr->len + sizeof(attr->type) + |
1934 | sizeof(attr->len)); | 1887 | sizeof(attr->len)); |
1935 | 1888 | ||
1936 | /* | 1889 | /* |
1937 | * current Port Speed | 1890 | * current Port Speed |
1938 | */ | 1891 | */ |
1939 | attr = (struct fdmi_attr_s *) curr_ptr; | 1892 | attr = (struct fdmi_attr_s *) curr_ptr; |
1940 | attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_PORT_SPEED); | 1893 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_SPEED); |
1941 | attr->len = sizeof(fcs_port_attr.curr_speed); | 1894 | attr->len = sizeof(fcs_port_attr.curr_speed); |
1942 | memcpy(attr->value, &fcs_port_attr.curr_speed, attr->len); | 1895 | memcpy(attr->value, &fcs_port_attr.curr_speed, attr->len); |
1943 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1896 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1944 | len += attr->len; | 1897 | len += attr->len; |
1945 | ++count; | 1898 | ++count; |
1946 | attr->len = | 1899 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1947 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1948 | sizeof(attr->len)); | 1900 | sizeof(attr->len)); |
1949 | 1901 | ||
1950 | /* | 1902 | /* |
1951 | * max frame size | 1903 | * max frame size |
1952 | */ | 1904 | */ |
1953 | attr = (struct fdmi_attr_s *) curr_ptr; | 1905 | attr = (struct fdmi_attr_s *) curr_ptr; |
1954 | attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_FRAME_SIZE); | 1906 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FRAME_SIZE); |
1955 | attr->len = sizeof(fcs_port_attr.max_frm_size); | 1907 | attr->len = sizeof(fcs_port_attr.max_frm_size); |
1956 | memcpy(attr->value, &fcs_port_attr.max_frm_size, attr->len); | 1908 | memcpy(attr->value, &fcs_port_attr.max_frm_size, attr->len); |
1957 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1909 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1958 | len += attr->len; | 1910 | len += attr->len; |
1959 | ++count; | 1911 | ++count; |
1960 | attr->len = | 1912 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1961 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1962 | sizeof(attr->len)); | 1913 | sizeof(attr->len)); |
1963 | 1914 | ||
1964 | /* | 1915 | /* |
@@ -1966,18 +1917,14 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1966 | */ | 1917 | */ |
1967 | if (fcs_port_attr.os_device_name[0] != '\0') { | 1918 | if (fcs_port_attr.os_device_name[0] != '\0') { |
1968 | attr = (struct fdmi_attr_s *) curr_ptr; | 1919 | attr = (struct fdmi_attr_s *) curr_ptr; |
1969 | attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_DEV_NAME); | 1920 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_DEV_NAME); |
1970 | attr->len = (u16) strlen(fcs_port_attr.os_device_name); | 1921 | attr->len = (u16) strlen(fcs_port_attr.os_device_name); |
1971 | memcpy(attr->value, fcs_port_attr.os_device_name, attr->len); | 1922 | memcpy(attr->value, fcs_port_attr.os_device_name, attr->len); |
1972 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1923 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1973 | *fields need | ||
1974 | *to be 4 byte | ||
1975 | *aligned */ | ||
1976 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1924 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1977 | len += attr->len; | 1925 | len += attr->len; |
1978 | ++count; | 1926 | ++count; |
1979 | attr->len = | 1927 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1980 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
1981 | sizeof(attr->len)); | 1928 | sizeof(attr->len)); |
1982 | } | 1929 | } |
1983 | /* | 1930 | /* |
@@ -1985,27 +1932,22 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1985 | */ | 1932 | */ |
1986 | if (fcs_port_attr.host_name[0] != '\0') { | 1933 | if (fcs_port_attr.host_name[0] != '\0') { |
1987 | attr = (struct fdmi_attr_s *) curr_ptr; | 1934 | attr = (struct fdmi_attr_s *) curr_ptr; |
1988 | attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_HOST_NAME); | 1935 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_HOST_NAME); |
1989 | attr->len = (u16) strlen(fcs_port_attr.host_name); | 1936 | attr->len = (u16) strlen(fcs_port_attr.host_name); |
1990 | memcpy(attr->value, fcs_port_attr.host_name, attr->len); | 1937 | memcpy(attr->value, fcs_port_attr.host_name, attr->len); |
1991 | attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable | 1938 | attr->len = fc_roundup(attr->len, sizeof(u32)); |
1992 | *fields need | ||
1993 | *to be 4 byte | ||
1994 | *aligned */ | ||
1995 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1939 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; |
1996 | len += attr->len; | 1940 | len += attr->len; |
1997 | ++count; | 1941 | ++count; |
1998 | attr->len = | 1942 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + |
1999 | bfa_os_htons(attr->len + sizeof(attr->type) + | ||
2000 | sizeof(attr->len)); | 1943 | sizeof(attr->len)); |
2001 | } | 1944 | } |
2002 | 1945 | ||
2003 | /* | 1946 | /* |
2004 | * Update size of payload | 1947 | * Update size of payload |
2005 | */ | 1948 | */ |
2006 | port_attrib->attr_count = bfa_os_htonl(count); | 1949 | port_attrib->attr_count = cpu_to_be32(count); |
2007 | len += ((sizeof(attr->type) + | 1950 | len += ((sizeof(attr->type) + sizeof(attr->len)) * count); |
2008 | sizeof(attr->len)) * count); | ||
2009 | return len; | 1951 | return len; |
2010 | } | 1952 | } |
2011 | 1953 | ||
@@ -2050,7 +1992,7 @@ bfa_fcs_lport_fdmi_rprt_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
2050 | } | 1992 | } |
2051 | 1993 | ||
2052 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 1994 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
2053 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 1995 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
2054 | 1996 | ||
2055 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 1997 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
2056 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); | 1998 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); |
@@ -2062,7 +2004,7 @@ bfa_fcs_lport_fdmi_rprt_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
2062 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_ERROR); | 2004 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_ERROR); |
2063 | } | 2005 | } |
2064 | 2006 | ||
2065 | /** | 2007 | /* |
2066 | * RPA : Register Port Attributes. | 2008 | * RPA : Register Port Attributes. |
2067 | */ | 2009 | */ |
2068 | static void | 2010 | static void |
@@ -2086,15 +2028,13 @@ bfa_fcs_lport_fdmi_send_rpa(void *fdmi_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
2086 | fdmi->fcxp = fcxp; | 2028 | fdmi->fcxp = fcxp; |
2087 | 2029 | ||
2088 | pyld = bfa_fcxp_get_reqbuf(fcxp); | 2030 | pyld = bfa_fcxp_get_reqbuf(fcxp); |
2089 | bfa_os_memset(pyld, 0, FC_MAX_PDUSZ); | 2031 | memset(pyld, 0, FC_MAX_PDUSZ); |
2090 | 2032 | ||
2091 | len = fc_fdmi_reqhdr_build(&fchs, pyld, bfa_fcs_lport_get_fcid(port), | 2033 | len = fc_fdmi_reqhdr_build(&fchs, pyld, bfa_fcs_lport_get_fcid(port), |
2092 | FDMI_RPA); | 2034 | FDMI_RPA); |
2093 | 2035 | ||
2094 | attr_len = | 2036 | attr_len = bfa_fcs_lport_fdmi_build_rpa_pyld(fdmi, |
2095 | bfa_fcs_lport_fdmi_build_rpa_pyld(fdmi, | 2037 | (u8 *) ((struct ct_hdr_s *) pyld + 1)); |
2096 | (u8 *) ((struct ct_hdr_s *) pyld | ||
2097 | + 1)); | ||
2098 | 2038 | ||
2099 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 2039 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
2100 | FC_CLASS_3, len + attr_len, &fchs, | 2040 | FC_CLASS_3, len + attr_len, &fchs, |
@@ -2143,7 +2083,7 @@ bfa_fcs_lport_fdmi_rpa_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
2143 | } | 2083 | } |
2144 | 2084 | ||
2145 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 2085 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
2146 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 2086 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
2147 | 2087 | ||
2148 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 2088 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
2149 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); | 2089 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); |
@@ -2170,7 +2110,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2170 | struct bfa_fcs_lport_s *port = fdmi->ms->port; | 2110 | struct bfa_fcs_lport_s *port = fdmi->ms->port; |
2171 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; | 2111 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; |
2172 | 2112 | ||
2173 | bfa_os_memset(hba_attr, 0, sizeof(struct bfa_fcs_fdmi_hba_attr_s)); | 2113 | memset(hba_attr, 0, sizeof(struct bfa_fcs_fdmi_hba_attr_s)); |
2174 | 2114 | ||
2175 | bfa_ioc_get_adapter_manufacturer(&port->fcs->bfa->ioc, | 2115 | bfa_ioc_get_adapter_manufacturer(&port->fcs->bfa->ioc, |
2176 | hba_attr->manufacturer); | 2116 | hba_attr->manufacturer); |
@@ -2204,7 +2144,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2204 | sizeof(driver_info->host_os_patch)); | 2144 | sizeof(driver_info->host_os_patch)); |
2205 | } | 2145 | } |
2206 | 2146 | ||
2207 | hba_attr->max_ct_pyld = bfa_os_htonl(FC_MAX_PDUSZ); | 2147 | hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ); |
2208 | } | 2148 | } |
2209 | 2149 | ||
2210 | void | 2150 | void |
@@ -2215,7 +2155,7 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2215 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; | 2155 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; |
2216 | struct bfa_port_attr_s pport_attr; | 2156 | struct bfa_port_attr_s pport_attr; |
2217 | 2157 | ||
2218 | bfa_os_memset(port_attr, 0, sizeof(struct bfa_fcs_fdmi_port_attr_s)); | 2158 | memset(port_attr, 0, sizeof(struct bfa_fcs_fdmi_port_attr_s)); |
2219 | 2159 | ||
2220 | /* | 2160 | /* |
2221 | * get pport attributes from hal | 2161 | * get pport attributes from hal |
@@ -2230,17 +2170,17 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2230 | /* | 2170 | /* |
2231 | * Supported Speeds | 2171 | * Supported Speeds |
2232 | */ | 2172 | */ |
2233 | port_attr->supp_speed = bfa_os_htonl(BFA_FCS_FDMI_SUPORTED_SPEEDS); | 2173 | port_attr->supp_speed = cpu_to_be32(BFA_FCS_FDMI_SUPORTED_SPEEDS); |
2234 | 2174 | ||
2235 | /* | 2175 | /* |
2236 | * Current Speed | 2176 | * Current Speed |
2237 | */ | 2177 | */ |
2238 | port_attr->curr_speed = bfa_os_htonl(pport_attr.speed); | 2178 | port_attr->curr_speed = cpu_to_be32(pport_attr.speed); |
2239 | 2179 | ||
2240 | /* | 2180 | /* |
2241 | * Max PDU Size. | 2181 | * Max PDU Size. |
2242 | */ | 2182 | */ |
2243 | port_attr->max_frm_size = bfa_os_htonl(FC_MAX_PDUSZ); | 2183 | port_attr->max_frm_size = cpu_to_be32(FC_MAX_PDUSZ); |
2244 | 2184 | ||
2245 | /* | 2185 | /* |
2246 | * OS device Name | 2186 | * OS device Name |
@@ -2321,11 +2261,11 @@ static void bfa_fcs_lport_ms_gfn_response(void *fcsarg, | |||
2321 | u32 rsp_len, | 2261 | u32 rsp_len, |
2322 | u32 resid_len, | 2262 | u32 resid_len, |
2323 | struct fchs_s *rsp_fchs); | 2263 | struct fchs_s *rsp_fchs); |
2324 | /** | 2264 | /* |
2325 | * fcs_ms_sm FCS MS state machine | 2265 | * fcs_ms_sm FCS MS state machine |
2326 | */ | 2266 | */ |
2327 | 2267 | ||
2328 | /** | 2268 | /* |
2329 | * MS State Machine events | 2269 | * MS State Machine events |
2330 | */ | 2270 | */ |
2331 | enum port_ms_event { | 2271 | enum port_ms_event { |
@@ -2360,7 +2300,7 @@ static void bfa_fcs_lport_ms_sm_gfn_retry(struct bfa_fcs_lport_ms_s *ms, | |||
2360 | enum port_ms_event event); | 2300 | enum port_ms_event event); |
2361 | static void bfa_fcs_lport_ms_sm_online(struct bfa_fcs_lport_ms_s *ms, | 2301 | static void bfa_fcs_lport_ms_sm_online(struct bfa_fcs_lport_ms_s *ms, |
2362 | enum port_ms_event event); | 2302 | enum port_ms_event event); |
2363 | /** | 2303 | /* |
2364 | * Start in offline state - awaiting NS to send start. | 2304 | * Start in offline state - awaiting NS to send start. |
2365 | */ | 2305 | */ |
2366 | static void | 2306 | static void |
@@ -2432,7 +2372,7 @@ bfa_fcs_lport_ms_sm_plogi(struct bfa_fcs_lport_ms_s *ms, | |||
2432 | */ | 2372 | */ |
2433 | bfa_fcs_lport_fdmi_online(ms); | 2373 | bfa_fcs_lport_fdmi_online(ms); |
2434 | 2374 | ||
2435 | /** | 2375 | /* |
2436 | * if this is a Vport, go to online state. | 2376 | * if this is a Vport, go to online state. |
2437 | */ | 2377 | */ |
2438 | if (ms->port->vport) { | 2378 | if (ms->port->vport) { |
@@ -2595,7 +2535,7 @@ bfa_fcs_lport_ms_sm_gmal_retry(struct bfa_fcs_lport_ms_s *ms, | |||
2595 | bfa_sm_fault(ms->port->fcs, event); | 2535 | bfa_sm_fault(ms->port->fcs, event); |
2596 | } | 2536 | } |
2597 | } | 2537 | } |
2598 | /** | 2538 | /* |
2599 | * ms_pvt MS local functions | 2539 | * ms_pvt MS local functions |
2600 | */ | 2540 | */ |
2601 | 2541 | ||
@@ -2657,12 +2597,12 @@ bfa_fcs_lport_ms_gmal_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
2657 | } | 2597 | } |
2658 | 2598 | ||
2659 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 2599 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
2660 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 2600 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
2661 | 2601 | ||
2662 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 2602 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
2663 | gmal_resp = (struct fcgs_gmal_resp_s *)(cthdr + 1); | 2603 | gmal_resp = (struct fcgs_gmal_resp_s *)(cthdr + 1); |
2664 | 2604 | ||
2665 | num_entries = bfa_os_ntohl(gmal_resp->ms_len); | 2605 | num_entries = be32_to_cpu(gmal_resp->ms_len); |
2666 | if (num_entries == 0) { | 2606 | if (num_entries == 0) { |
2667 | bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR); | 2607 | bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR); |
2668 | return; | 2608 | return; |
@@ -2795,7 +2735,7 @@ bfa_fcs_lport_ms_sm_gfn_retry(struct bfa_fcs_lport_ms_s *ms, | |||
2795 | bfa_sm_fault(ms->port->fcs, event); | 2735 | bfa_sm_fault(ms->port->fcs, event); |
2796 | } | 2736 | } |
2797 | } | 2737 | } |
2798 | /** | 2738 | /* |
2799 | * ms_pvt MS local functions | 2739 | * ms_pvt MS local functions |
2800 | */ | 2740 | */ |
2801 | 2741 | ||
@@ -2853,7 +2793,7 @@ bfa_fcs_lport_ms_gfn_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
2853 | } | 2793 | } |
2854 | 2794 | ||
2855 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 2795 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
2856 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 2796 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
2857 | 2797 | ||
2858 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 2798 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
2859 | gfn_resp = (wwn_t *)(cthdr + 1); | 2799 | gfn_resp = (wwn_t *)(cthdr + 1); |
@@ -2871,7 +2811,7 @@ bfa_fcs_lport_ms_gfn_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
2871 | bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR); | 2811 | bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR); |
2872 | } | 2812 | } |
2873 | 2813 | ||
2874 | /** | 2814 | /* |
2875 | * ms_pvt MS local functions | 2815 | * ms_pvt MS local functions |
2876 | */ | 2816 | */ |
2877 | 2817 | ||
@@ -3017,7 +2957,7 @@ bfa_fcs_lport_ms_fabric_rscn(struct bfa_fcs_lport_s *port) | |||
3017 | bfa_sm_send_event(ms, MSSM_EVENT_PORT_FABRIC_RSCN); | 2957 | bfa_sm_send_event(ms, MSSM_EVENT_PORT_FABRIC_RSCN); |
3018 | } | 2958 | } |
3019 | 2959 | ||
3020 | /** | 2960 | /* |
3021 | * @page ns_sm_info VPORT NS State Machine | 2961 | * @page ns_sm_info VPORT NS State Machine |
3022 | * | 2962 | * |
3023 | * @section ns_sm_interactions VPORT NS State Machine Interactions | 2963 | * @section ns_sm_interactions VPORT NS State Machine Interactions |
@@ -3080,11 +3020,11 @@ static void bfa_fcs_lport_ns_process_gidft_pids( | |||
3080 | u32 *pid_buf, u32 n_pids); | 3020 | u32 *pid_buf, u32 n_pids); |
3081 | 3021 | ||
3082 | static void bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port); | 3022 | static void bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port); |
3083 | /** | 3023 | /* |
3084 | * fcs_ns_sm FCS nameserver interface state machine | 3024 | * fcs_ns_sm FCS nameserver interface state machine |
3085 | */ | 3025 | */ |
3086 | 3026 | ||
3087 | /** | 3027 | /* |
3088 | * VPort NS State Machine events | 3028 | * VPort NS State Machine events |
3089 | */ | 3029 | */ |
3090 | enum vport_ns_event { | 3030 | enum vport_ns_event { |
@@ -3139,7 +3079,7 @@ static void bfa_fcs_lport_ns_sm_gid_ft_retry(struct bfa_fcs_lport_ns_s *ns, | |||
3139 | enum vport_ns_event event); | 3079 | enum vport_ns_event event); |
3140 | static void bfa_fcs_lport_ns_sm_online(struct bfa_fcs_lport_ns_s *ns, | 3080 | static void bfa_fcs_lport_ns_sm_online(struct bfa_fcs_lport_ns_s *ns, |
3141 | enum vport_ns_event event); | 3081 | enum vport_ns_event event); |
3142 | /** | 3082 | /* |
3143 | * Start in offline state - awaiting linkup | 3083 | * Start in offline state - awaiting linkup |
3144 | */ | 3084 | */ |
3145 | static void | 3085 | static void |
@@ -3628,7 +3568,7 @@ bfa_fcs_lport_ns_sm_online(struct bfa_fcs_lport_ns_s *ns, | |||
3628 | 3568 | ||
3629 | 3569 | ||
3630 | 3570 | ||
3631 | /** | 3571 | /* |
3632 | * ns_pvt Nameserver local functions | 3572 | * ns_pvt Nameserver local functions |
3633 | */ | 3573 | */ |
3634 | 3574 | ||
@@ -3724,7 +3664,7 @@ bfa_fcs_lport_ns_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
3724 | } | 3664 | } |
3725 | } | 3665 | } |
3726 | 3666 | ||
3727 | /** | 3667 | /* |
3728 | * Register the symbolic port name. | 3668 | * Register the symbolic port name. |
3729 | */ | 3669 | */ |
3730 | static void | 3670 | static void |
@@ -3738,7 +3678,7 @@ bfa_fcs_lport_ns_send_rspn_id(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
3738 | u8 symbl[256]; | 3678 | u8 symbl[256]; |
3739 | u8 *psymbl = &symbl[0]; | 3679 | u8 *psymbl = &symbl[0]; |
3740 | 3680 | ||
3741 | bfa_os_memset(symbl, 0, sizeof(symbl)); | 3681 | memset(symbl, 0, sizeof(symbl)); |
3742 | 3682 | ||
3743 | bfa_trc(port->fcs, port->port_cfg.pwwn); | 3683 | bfa_trc(port->fcs, port->port_cfg.pwwn); |
3744 | 3684 | ||
@@ -3755,7 +3695,7 @@ bfa_fcs_lport_ns_send_rspn_id(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
3755 | * for V-Port, form a Port Symbolic Name | 3695 | * for V-Port, form a Port Symbolic Name |
3756 | */ | 3696 | */ |
3757 | if (port->vport) { | 3697 | if (port->vport) { |
3758 | /** | 3698 | /* |
3759 | * For Vports, we append the vport's port symbolic name | 3699 | * For Vports, we append the vport's port symbolic name |
3760 | * to that of the base port. | 3700 | * to that of the base port. |
3761 | */ | 3701 | */ |
@@ -3815,7 +3755,7 @@ bfa_fcs_lport_ns_rspn_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
3815 | } | 3755 | } |
3816 | 3756 | ||
3817 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 3757 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
3818 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 3758 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
3819 | 3759 | ||
3820 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 3760 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
3821 | port->stats.ns_rspnid_accepts++; | 3761 | port->stats.ns_rspnid_accepts++; |
@@ -3829,7 +3769,7 @@ bfa_fcs_lport_ns_rspn_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
3829 | bfa_sm_send_event(ns, NSSM_EVENT_RSP_ERROR); | 3769 | bfa_sm_send_event(ns, NSSM_EVENT_RSP_ERROR); |
3830 | } | 3770 | } |
3831 | 3771 | ||
3832 | /** | 3772 | /* |
3833 | * Register FC4-Types | 3773 | * Register FC4-Types |
3834 | */ | 3774 | */ |
3835 | static void | 3775 | static void |
@@ -3887,7 +3827,7 @@ bfa_fcs_lport_ns_rft_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
3887 | } | 3827 | } |
3888 | 3828 | ||
3889 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 3829 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
3890 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 3830 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
3891 | 3831 | ||
3892 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 3832 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
3893 | port->stats.ns_rftid_accepts++; | 3833 | port->stats.ns_rftid_accepts++; |
@@ -3901,7 +3841,7 @@ bfa_fcs_lport_ns_rft_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
3901 | bfa_sm_send_event(ns, NSSM_EVENT_RSP_ERROR); | 3841 | bfa_sm_send_event(ns, NSSM_EVENT_RSP_ERROR); |
3902 | } | 3842 | } |
3903 | 3843 | ||
3904 | /** | 3844 | /* |
3905 | * Register FC4-Features : Should be done after RFT_ID | 3845 | * Register FC4-Features : Should be done after RFT_ID |
3906 | */ | 3846 | */ |
3907 | static void | 3847 | static void |
@@ -3964,7 +3904,7 @@ bfa_fcs_lport_ns_rff_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
3964 | } | 3904 | } |
3965 | 3905 | ||
3966 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 3906 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
3967 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 3907 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
3968 | 3908 | ||
3969 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { | 3909 | if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { |
3970 | port->stats.ns_rffid_accepts++; | 3910 | port->stats.ns_rffid_accepts++; |
@@ -3982,7 +3922,7 @@ bfa_fcs_lport_ns_rff_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
3982 | } else | 3922 | } else |
3983 | bfa_sm_send_event(ns, NSSM_EVENT_RSP_ERROR); | 3923 | bfa_sm_send_event(ns, NSSM_EVENT_RSP_ERROR); |
3984 | } | 3924 | } |
3985 | /** | 3925 | /* |
3986 | * Query Fabric for FC4-Types Devices. | 3926 | * Query Fabric for FC4-Types Devices. |
3987 | * | 3927 | * |
3988 | * TBD : Need to use a local (FCS private) response buffer, since the response | 3928 | * TBD : Need to use a local (FCS private) response buffer, since the response |
@@ -4058,7 +3998,7 @@ bfa_fcs_lport_ns_gid_ft_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
4058 | } | 3998 | } |
4059 | 3999 | ||
4060 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); | 4000 | cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); |
4061 | cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); | 4001 | cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code); |
4062 | 4002 | ||
4063 | switch (cthdr->cmd_rsp_code) { | 4003 | switch (cthdr->cmd_rsp_code) { |
4064 | 4004 | ||
@@ -4102,7 +4042,7 @@ bfa_fcs_lport_ns_gid_ft_response(void *fcsarg, struct bfa_fcxp_s *fcxp, | |||
4102 | } | 4042 | } |
4103 | } | 4043 | } |
4104 | 4044 | ||
4105 | /** | 4045 | /* |
4106 | * This routine will be called by bfa_timer on timer timeouts. | 4046 | * This routine will be called by bfa_timer on timer timeouts. |
4107 | * | 4047 | * |
4108 | * param[in] port - pointer to bfa_fcs_lport_t. | 4048 | * param[in] port - pointer to bfa_fcs_lport_t. |
@@ -4166,7 +4106,7 @@ bfa_fcs_lport_ns_process_gidft_pids(struct bfa_fcs_lport_s *port, u32 *pid_buf, | |||
4166 | } | 4106 | } |
4167 | } | 4107 | } |
4168 | 4108 | ||
4169 | /** | 4109 | /* |
4170 | * fcs_ns_public FCS nameserver public interfaces | 4110 | * fcs_ns_public FCS nameserver public interfaces |
4171 | */ | 4111 | */ |
4172 | 4112 | ||
@@ -4227,7 +4167,7 @@ bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port) | |||
4227 | } | 4167 | } |
4228 | } | 4168 | } |
4229 | 4169 | ||
4230 | /** | 4170 | /* |
4231 | * FCS SCN | 4171 | * FCS SCN |
4232 | */ | 4172 | */ |
4233 | 4173 | ||
@@ -4250,11 +4190,11 @@ static void bfa_fcs_lport_scn_send_ls_acc(struct bfa_fcs_lport_s *port, | |||
4250 | struct fchs_s *rx_fchs); | 4190 | struct fchs_s *rx_fchs); |
4251 | static void bfa_fcs_lport_scn_timeout(void *arg); | 4191 | static void bfa_fcs_lport_scn_timeout(void *arg); |
4252 | 4192 | ||
4253 | /** | 4193 | /* |
4254 | * fcs_scm_sm FCS SCN state machine | 4194 | * fcs_scm_sm FCS SCN state machine |
4255 | */ | 4195 | */ |
4256 | 4196 | ||
4257 | /** | 4197 | /* |
4258 | * VPort SCN State Machine events | 4198 | * VPort SCN State Machine events |
4259 | */ | 4199 | */ |
4260 | enum port_scn_event { | 4200 | enum port_scn_event { |
@@ -4278,7 +4218,7 @@ static void bfa_fcs_lport_scn_sm_scr_retry(struct bfa_fcs_lport_scn_s *scn, | |||
4278 | static void bfa_fcs_lport_scn_sm_online(struct bfa_fcs_lport_scn_s *scn, | 4218 | static void bfa_fcs_lport_scn_sm_online(struct bfa_fcs_lport_scn_s *scn, |
4279 | enum port_scn_event event); | 4219 | enum port_scn_event event); |
4280 | 4220 | ||
4281 | /** | 4221 | /* |
4282 | * Starting state - awaiting link up. | 4222 | * Starting state - awaiting link up. |
4283 | */ | 4223 | */ |
4284 | static void | 4224 | static void |
@@ -4382,11 +4322,11 @@ bfa_fcs_lport_scn_sm_online(struct bfa_fcs_lport_scn_s *scn, | |||
4382 | 4322 | ||
4383 | 4323 | ||
4384 | 4324 | ||
4385 | /** | 4325 | /* |
4386 | * fcs_scn_private FCS SCN private functions | 4326 | * fcs_scn_private FCS SCN private functions |
4387 | */ | 4327 | */ |
4388 | 4328 | ||
4389 | /** | 4329 | /* |
4390 | * This routine will be called to send a SCR command. | 4330 | * This routine will be called to send a SCR command. |
4391 | */ | 4331 | */ |
4392 | static void | 4332 | static void |
@@ -4499,7 +4439,7 @@ bfa_fcs_lport_scn_send_ls_acc(struct bfa_fcs_lport_s *port, | |||
4499 | FC_MAX_PDUSZ, 0); | 4439 | FC_MAX_PDUSZ, 0); |
4500 | } | 4440 | } |
4501 | 4441 | ||
4502 | /** | 4442 | /* |
4503 | * This routine will be called by bfa_timer on timer timeouts. | 4443 | * This routine will be called by bfa_timer on timer timeouts. |
4504 | * | 4444 | * |
4505 | * param[in] vport - pointer to bfa_fcs_lport_t. | 4445 | * param[in] vport - pointer to bfa_fcs_lport_t. |
@@ -4522,7 +4462,7 @@ bfa_fcs_lport_scn_timeout(void *arg) | |||
4522 | 4462 | ||
4523 | 4463 | ||
4524 | 4464 | ||
4525 | /** | 4465 | /* |
4526 | * fcs_scn_public FCS state change notification public interfaces | 4466 | * fcs_scn_public FCS state change notification public interfaces |
4527 | */ | 4467 | */ |
4528 | 4468 | ||
@@ -4563,7 +4503,7 @@ bfa_fcs_lport_scn_portid_rscn(struct bfa_fcs_lport_s *port, u32 rpid) | |||
4563 | 4503 | ||
4564 | bfa_trc(port->fcs, rpid); | 4504 | bfa_trc(port->fcs, rpid); |
4565 | 4505 | ||
4566 | /** | 4506 | /* |
4567 | * If this is an unknown device, then it just came online. | 4507 | * If this is an unknown device, then it just came online. |
4568 | * Otherwise let rport handle the RSCN event. | 4508 | * Otherwise let rport handle the RSCN event. |
4569 | */ | 4509 | */ |
@@ -4579,7 +4519,7 @@ bfa_fcs_lport_scn_portid_rscn(struct bfa_fcs_lport_s *port, u32 rpid) | |||
4579 | bfa_fcs_rport_scn(rport); | 4519 | bfa_fcs_rport_scn(rport); |
4580 | } | 4520 | } |
4581 | 4521 | ||
4582 | /** | 4522 | /* |
4583 | * rscn format based PID comparison | 4523 | * rscn format based PID comparison |
4584 | */ | 4524 | */ |
4585 | #define __fc_pid_match(__c0, __c1, __fmt) \ | 4525 | #define __fc_pid_match(__c0, __c1, __fmt) \ |
@@ -4624,7 +4564,7 @@ bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port, | |||
4624 | int i = 0, j; | 4564 | int i = 0, j; |
4625 | 4565 | ||
4626 | num_entries = | 4566 | num_entries = |
4627 | (bfa_os_ntohs(rscn->payldlen) - | 4567 | (be16_to_cpu(rscn->payldlen) - |
4628 | sizeof(u32)) / sizeof(rscn->event[0]); | 4568 | sizeof(u32)) / sizeof(rscn->event[0]); |
4629 | 4569 | ||
4630 | bfa_trc(port->fcs, num_entries); | 4570 | bfa_trc(port->fcs, num_entries); |
@@ -4691,18 +4631,18 @@ bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port, | |||
4691 | } | 4631 | } |
4692 | } | 4632 | } |
4693 | 4633 | ||
4694 | /** | 4634 | /* |
4695 | * If any of area, domain or fabric RSCN is received, do a fresh discovery | 4635 | * If any of area, domain or fabric RSCN is received, do a fresh |
4696 | * to find new devices. | 4636 | * discovery to find new devices. |
4697 | */ | 4637 | */ |
4698 | if (nsquery) | 4638 | if (nsquery) |
4699 | bfa_fcs_lport_ns_query(port); | 4639 | bfa_fcs_lport_ns_query(port); |
4700 | } | 4640 | } |
4701 | 4641 | ||
4702 | /** | 4642 | /* |
4703 | * BFA FCS port | 4643 | * BFA FCS port |
4704 | */ | 4644 | */ |
4705 | /** | 4645 | /* |
4706 | * fcs_port_api BFA FCS port API | 4646 | * fcs_port_api BFA FCS port API |
4707 | */ | 4647 | */ |
4708 | struct bfa_fcs_lport_s * | 4648 | struct bfa_fcs_lport_s * |
@@ -4943,10 +4883,10 @@ bfa_fcs_lport_get_stats(struct bfa_fcs_lport_s *fcs_port, | |||
4943 | void | 4883 | void |
4944 | bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port) | 4884 | bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port) |
4945 | { | 4885 | { |
4946 | bfa_os_memset(&fcs_port->stats, 0, sizeof(struct bfa_lport_stats_s)); | 4886 | memset(&fcs_port->stats, 0, sizeof(struct bfa_lport_stats_s)); |
4947 | } | 4887 | } |
4948 | 4888 | ||
4949 | /** | 4889 | /* |
4950 | * FCS virtual port state machine | 4890 | * FCS virtual port state machine |
4951 | */ | 4891 | */ |
4952 | 4892 | ||
@@ -4967,11 +4907,11 @@ static void bfa_fcs_vport_timeout(void *vport_arg); | |||
4967 | static void bfa_fcs_vport_do_logo(struct bfa_fcs_vport_s *vport); | 4907 | static void bfa_fcs_vport_do_logo(struct bfa_fcs_vport_s *vport); |
4968 | static void bfa_fcs_vport_free(struct bfa_fcs_vport_s *vport); | 4908 | static void bfa_fcs_vport_free(struct bfa_fcs_vport_s *vport); |
4969 | 4909 | ||
4970 | /** | 4910 | /* |
4971 | * fcs_vport_sm FCS virtual port state machine | 4911 | * fcs_vport_sm FCS virtual port state machine |
4972 | */ | 4912 | */ |
4973 | 4913 | ||
4974 | /** | 4914 | /* |
4975 | * VPort State Machine events | 4915 | * VPort State Machine events |
4976 | */ | 4916 | */ |
4977 | enum bfa_fcs_vport_event { | 4917 | enum bfa_fcs_vport_event { |
@@ -5024,7 +4964,7 @@ static struct bfa_sm_table_s vport_sm_table[] = { | |||
5024 | {BFA_SM(bfa_fcs_vport_sm_error), BFA_FCS_VPORT_ERROR} | 4964 | {BFA_SM(bfa_fcs_vport_sm_error), BFA_FCS_VPORT_ERROR} |
5025 | }; | 4965 | }; |
5026 | 4966 | ||
5027 | /** | 4967 | /* |
5028 | * Beginning state. | 4968 | * Beginning state. |
5029 | */ | 4969 | */ |
5030 | static void | 4970 | static void |
@@ -5045,7 +4985,7 @@ bfa_fcs_vport_sm_uninit(struct bfa_fcs_vport_s *vport, | |||
5045 | } | 4985 | } |
5046 | } | 4986 | } |
5047 | 4987 | ||
5048 | /** | 4988 | /* |
5049 | * Created state - a start event is required to start up the state machine. | 4989 | * Created state - a start event is required to start up the state machine. |
5050 | */ | 4990 | */ |
5051 | static void | 4991 | static void |
@@ -5062,7 +5002,7 @@ bfa_fcs_vport_sm_created(struct bfa_fcs_vport_s *vport, | |||
5062 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc); | 5002 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc); |
5063 | bfa_fcs_vport_do_fdisc(vport); | 5003 | bfa_fcs_vport_do_fdisc(vport); |
5064 | } else { | 5004 | } else { |
5065 | /** | 5005 | /* |
5066 | * Fabric is offline or not NPIV capable, stay in | 5006 | * Fabric is offline or not NPIV capable, stay in |
5067 | * offline state. | 5007 | * offline state. |
5068 | */ | 5008 | */ |
@@ -5078,7 +5018,7 @@ bfa_fcs_vport_sm_created(struct bfa_fcs_vport_s *vport, | |||
5078 | 5018 | ||
5079 | case BFA_FCS_VPORT_SM_ONLINE: | 5019 | case BFA_FCS_VPORT_SM_ONLINE: |
5080 | case BFA_FCS_VPORT_SM_OFFLINE: | 5020 | case BFA_FCS_VPORT_SM_OFFLINE: |
5081 | /** | 5021 | /* |
5082 | * Ignore ONLINE/OFFLINE events from fabric | 5022 | * Ignore ONLINE/OFFLINE events from fabric |
5083 | * till vport is started. | 5023 | * till vport is started. |
5084 | */ | 5024 | */ |
@@ -5089,7 +5029,7 @@ bfa_fcs_vport_sm_created(struct bfa_fcs_vport_s *vport, | |||
5089 | } | 5029 | } |
5090 | } | 5030 | } |
5091 | 5031 | ||
5092 | /** | 5032 | /* |
5093 | * Offline state - awaiting ONLINE event from fabric SM. | 5033 | * Offline state - awaiting ONLINE event from fabric SM. |
5094 | */ | 5034 | */ |
5095 | static void | 5035 | static void |
@@ -5127,7 +5067,7 @@ bfa_fcs_vport_sm_offline(struct bfa_fcs_vport_s *vport, | |||
5127 | } | 5067 | } |
5128 | 5068 | ||
5129 | 5069 | ||
5130 | /** | 5070 | /* |
5131 | * FDISC is sent and awaiting reply from fabric. | 5071 | * FDISC is sent and awaiting reply from fabric. |
5132 | */ | 5072 | */ |
5133 | static void | 5073 | static void |
@@ -5174,7 +5114,7 @@ bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport, | |||
5174 | } | 5114 | } |
5175 | } | 5115 | } |
5176 | 5116 | ||
5177 | /** | 5117 | /* |
5178 | * FDISC attempt failed - a timer is active to retry FDISC. | 5118 | * FDISC attempt failed - a timer is active to retry FDISC. |
5179 | */ | 5119 | */ |
5180 | static void | 5120 | static void |
@@ -5208,7 +5148,7 @@ bfa_fcs_vport_sm_fdisc_retry(struct bfa_fcs_vport_s *vport, | |||
5208 | } | 5148 | } |
5209 | } | 5149 | } |
5210 | 5150 | ||
5211 | /** | 5151 | /* |
5212 | * Vport is online (FDISC is complete). | 5152 | * Vport is online (FDISC is complete). |
5213 | */ | 5153 | */ |
5214 | static void | 5154 | static void |
@@ -5235,7 +5175,7 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport, | |||
5235 | } | 5175 | } |
5236 | } | 5176 | } |
5237 | 5177 | ||
5238 | /** | 5178 | /* |
5239 | * Vport is being deleted - awaiting lport delete completion to send | 5179 | * Vport is being deleted - awaiting lport delete completion to send |
5240 | * LOGO to fabric. | 5180 | * LOGO to fabric. |
5241 | */ | 5181 | */ |
@@ -5264,7 +5204,7 @@ bfa_fcs_vport_sm_deleting(struct bfa_fcs_vport_s *vport, | |||
5264 | } | 5204 | } |
5265 | } | 5205 | } |
5266 | 5206 | ||
5267 | /** | 5207 | /* |
5268 | * Error State. | 5208 | * Error State. |
5269 | * This state will be set when the Vport Creation fails due | 5209 | * This state will be set when the Vport Creation fails due |
5270 | * to errors like Dup WWN. In this state only operation allowed | 5210 | * to errors like Dup WWN. In this state only operation allowed |
@@ -5288,7 +5228,7 @@ bfa_fcs_vport_sm_error(struct bfa_fcs_vport_s *vport, | |||
5288 | } | 5228 | } |
5289 | } | 5229 | } |
5290 | 5230 | ||
5291 | /** | 5231 | /* |
5292 | * Lport cleanup is in progress since vport is being deleted. Fabric is | 5232 | * Lport cleanup is in progress since vport is being deleted. Fabric is |
5293 | * offline, so no LOGO is needed to complete vport deletion. | 5233 | * offline, so no LOGO is needed to complete vport deletion. |
5294 | */ | 5234 | */ |
@@ -5313,7 +5253,7 @@ bfa_fcs_vport_sm_cleanup(struct bfa_fcs_vport_s *vport, | |||
5313 | } | 5253 | } |
5314 | } | 5254 | } |
5315 | 5255 | ||
5316 | /** | 5256 | /* |
5317 | * LOGO is sent to fabric. Vport delete is in progress. Lport delete cleanup | 5257 | * LOGO is sent to fabric. Vport delete is in progress. Lport delete cleanup |
5318 | * is done. | 5258 | * is done. |
5319 | */ | 5259 | */ |
@@ -5347,10 +5287,10 @@ bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, | |||
5347 | 5287 | ||
5348 | 5288 | ||
5349 | 5289 | ||
5350 | /** | 5290 | /* |
5351 | * fcs_vport_private FCS virtual port private functions | 5291 | * fcs_vport_private FCS virtual port private functions |
5352 | */ | 5292 | */ |
5353 | /** | 5293 | /* |
5354 | * This routine will be called to send a FDISC command. | 5294 | * This routine will be called to send a FDISC command. |
5355 | */ | 5295 | */ |
5356 | static void | 5296 | static void |
@@ -5397,7 +5337,7 @@ bfa_fcs_vport_fdisc_rejected(struct bfa_fcs_vport_s *vport) | |||
5397 | } | 5337 | } |
5398 | } | 5338 | } |
5399 | 5339 | ||
5400 | /** | 5340 | /* |
5401 | * Called to send a logout to the fabric. Used when a V-Port is | 5341 | * Called to send a logout to the fabric. Used when a V-Port is |
5402 | * deleted/stopped. | 5342 | * deleted/stopped. |
5403 | */ | 5343 | */ |
@@ -5411,7 +5351,7 @@ bfa_fcs_vport_do_logo(struct bfa_fcs_vport_s *vport) | |||
5411 | } | 5351 | } |
5412 | 5352 | ||
5413 | 5353 | ||
5414 | /** | 5354 | /* |
5415 | * This routine will be called by bfa_timer on timer timeouts. | 5355 | * This routine will be called by bfa_timer on timer timeouts. |
5416 | * | 5356 | * |
5417 | * param[in] vport - pointer to bfa_fcs_vport_t. | 5357 | * param[in] vport - pointer to bfa_fcs_vport_t. |
@@ -5449,11 +5389,11 @@ bfa_fcs_vport_free(struct bfa_fcs_vport_s *vport) | |||
5449 | 5389 | ||
5450 | 5390 | ||
5451 | 5391 | ||
5452 | /** | 5392 | /* |
5453 | * fcs_vport_public FCS virtual port public interfaces | 5393 | * fcs_vport_public FCS virtual port public interfaces |
5454 | */ | 5394 | */ |
5455 | 5395 | ||
5456 | /** | 5396 | /* |
5457 | * Online notification from fabric SM. | 5397 | * Online notification from fabric SM. |
5458 | */ | 5398 | */ |
5459 | void | 5399 | void |
@@ -5463,7 +5403,7 @@ bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport) | |||
5463 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_ONLINE); | 5403 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_ONLINE); |
5464 | } | 5404 | } |
5465 | 5405 | ||
5466 | /** | 5406 | /* |
5467 | * Offline notification from fabric SM. | 5407 | * Offline notification from fabric SM. |
5468 | */ | 5408 | */ |
5469 | void | 5409 | void |
@@ -5473,7 +5413,7 @@ bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport) | |||
5473 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_OFFLINE); | 5413 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_OFFLINE); |
5474 | } | 5414 | } |
5475 | 5415 | ||
5476 | /** | 5416 | /* |
5477 | * Cleanup notification from fabric SM on link timer expiry. | 5417 | * Cleanup notification from fabric SM on link timer expiry. |
5478 | */ | 5418 | */ |
5479 | void | 5419 | void |
@@ -5481,7 +5421,7 @@ bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport) | |||
5481 | { | 5421 | { |
5482 | vport->vport_stats.fab_cleanup++; | 5422 | vport->vport_stats.fab_cleanup++; |
5483 | } | 5423 | } |
5484 | /** | 5424 | /* |
5485 | * delete notification from fabric SM. To be invoked from within FCS. | 5425 | * delete notification from fabric SM. To be invoked from within FCS. |
5486 | */ | 5426 | */ |
5487 | void | 5427 | void |
@@ -5490,7 +5430,7 @@ bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport) | |||
5490 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_DELETE); | 5430 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_DELETE); |
5491 | } | 5431 | } |
5492 | 5432 | ||
5493 | /** | 5433 | /* |
5494 | * Delete completion callback from associated lport | 5434 | * Delete completion callback from associated lport |
5495 | */ | 5435 | */ |
5496 | void | 5436 | void |
@@ -5501,11 +5441,11 @@ bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport) | |||
5501 | 5441 | ||
5502 | 5442 | ||
5503 | 5443 | ||
5504 | /** | 5444 | /* |
5505 | * fcs_vport_api Virtual port API | 5445 | * fcs_vport_api Virtual port API |
5506 | */ | 5446 | */ |
5507 | 5447 | ||
5508 | /** | 5448 | /* |
5509 | * Use this function to instantiate a new FCS vport object. This | 5449 | * Use this function to instantiate a new FCS vport object. This |
5510 | * function will not trigger any HW initialization process (which will be | 5450 | * function will not trigger any HW initialization process (which will be |
5511 | * done in vport_start() call) | 5451 | * done in vport_start() call) |
@@ -5555,7 +5495,7 @@ bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport, struct bfa_fcs_s *fcs, | |||
5555 | return BFA_STATUS_OK; | 5495 | return BFA_STATUS_OK; |
5556 | } | 5496 | } |
5557 | 5497 | ||
5558 | /** | 5498 | /* |
5559 | * Use this function to instantiate a new FCS PBC vport object. This | 5499 | * Use this function to instantiate a new FCS PBC vport object. This |
5560 | * function will not trigger any HW initialization process (which will be | 5500 | * function will not trigger any HW initialization process (which will be |
5561 | * done in vport_start() call) | 5501 | * done in vport_start() call) |
@@ -5585,7 +5525,7 @@ bfa_fcs_pbc_vport_create(struct bfa_fcs_vport_s *vport, struct bfa_fcs_s *fcs, | |||
5585 | return rc; | 5525 | return rc; |
5586 | } | 5526 | } |
5587 | 5527 | ||
5588 | /** | 5528 | /* |
5589 | * Use this function to findout if this is a pbc vport or not. | 5529 | * Use this function to findout if this is a pbc vport or not. |
5590 | * | 5530 | * |
5591 | * @param[in] vport - pointer to bfa_fcs_vport_t. | 5531 | * @param[in] vport - pointer to bfa_fcs_vport_t. |
@@ -5603,7 +5543,7 @@ bfa_fcs_is_pbc_vport(struct bfa_fcs_vport_s *vport) | |||
5603 | 5543 | ||
5604 | } | 5544 | } |
5605 | 5545 | ||
5606 | /** | 5546 | /* |
5607 | * Use this function initialize the vport. | 5547 | * Use this function initialize the vport. |
5608 | * | 5548 | * |
5609 | * @param[in] vport - pointer to bfa_fcs_vport_t. | 5549 | * @param[in] vport - pointer to bfa_fcs_vport_t. |
@@ -5618,7 +5558,7 @@ bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport) | |||
5618 | return BFA_STATUS_OK; | 5558 | return BFA_STATUS_OK; |
5619 | } | 5559 | } |
5620 | 5560 | ||
5621 | /** | 5561 | /* |
5622 | * Use this function quiese the vport object. This function will return | 5562 | * Use this function quiese the vport object. This function will return |
5623 | * immediately, when the vport is actually stopped, the | 5563 | * immediately, when the vport is actually stopped, the |
5624 | * bfa_drv_vport_stop_cb() will be called. | 5564 | * bfa_drv_vport_stop_cb() will be called. |
@@ -5635,7 +5575,7 @@ bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport) | |||
5635 | return BFA_STATUS_OK; | 5575 | return BFA_STATUS_OK; |
5636 | } | 5576 | } |
5637 | 5577 | ||
5638 | /** | 5578 | /* |
5639 | * Use this function to delete a vport object. Fabric object should | 5579 | * Use this function to delete a vport object. Fabric object should |
5640 | * be stopped before this function call. | 5580 | * be stopped before this function call. |
5641 | * | 5581 | * |
@@ -5657,7 +5597,7 @@ bfa_fcs_vport_delete(struct bfa_fcs_vport_s *vport) | |||
5657 | return BFA_STATUS_OK; | 5597 | return BFA_STATUS_OK; |
5658 | } | 5598 | } |
5659 | 5599 | ||
5660 | /** | 5600 | /* |
5661 | * Use this function to get vport's current status info. | 5601 | * Use this function to get vport's current status info. |
5662 | * | 5602 | * |
5663 | * param[in] vport pointer to bfa_fcs_vport_t. | 5603 | * param[in] vport pointer to bfa_fcs_vport_t. |
@@ -5672,13 +5612,13 @@ bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport, | |||
5672 | if (vport == NULL || attr == NULL) | 5612 | if (vport == NULL || attr == NULL) |
5673 | return; | 5613 | return; |
5674 | 5614 | ||
5675 | bfa_os_memset(attr, 0, sizeof(struct bfa_vport_attr_s)); | 5615 | memset(attr, 0, sizeof(struct bfa_vport_attr_s)); |
5676 | 5616 | ||
5677 | bfa_fcs_lport_get_attr(&vport->lport, &attr->port_attr); | 5617 | bfa_fcs_lport_get_attr(&vport->lport, &attr->port_attr); |
5678 | attr->vport_state = bfa_sm_to_state(vport_sm_table, vport->sm); | 5618 | attr->vport_state = bfa_sm_to_state(vport_sm_table, vport->sm); |
5679 | } | 5619 | } |
5680 | 5620 | ||
5681 | /** | 5621 | /* |
5682 | * Use this function to get vport's statistics. | 5622 | * Use this function to get vport's statistics. |
5683 | * | 5623 | * |
5684 | * param[in] vport pointer to bfa_fcs_vport_t. | 5624 | * param[in] vport pointer to bfa_fcs_vport_t. |
@@ -5693,7 +5633,7 @@ bfa_fcs_vport_get_stats(struct bfa_fcs_vport_s *vport, | |||
5693 | *stats = vport->vport_stats; | 5633 | *stats = vport->vport_stats; |
5694 | } | 5634 | } |
5695 | 5635 | ||
5696 | /** | 5636 | /* |
5697 | * Use this function to clear vport's statistics. | 5637 | * Use this function to clear vport's statistics. |
5698 | * | 5638 | * |
5699 | * param[in] vport pointer to bfa_fcs_vport_t. | 5639 | * param[in] vport pointer to bfa_fcs_vport_t. |
@@ -5703,10 +5643,10 @@ bfa_fcs_vport_get_stats(struct bfa_fcs_vport_s *vport, | |||
5703 | void | 5643 | void |
5704 | bfa_fcs_vport_clr_stats(struct bfa_fcs_vport_s *vport) | 5644 | bfa_fcs_vport_clr_stats(struct bfa_fcs_vport_s *vport) |
5705 | { | 5645 | { |
5706 | bfa_os_memset(&vport->vport_stats, 0, sizeof(struct bfa_vport_stats_s)); | 5646 | memset(&vport->vport_stats, 0, sizeof(struct bfa_vport_stats_s)); |
5707 | } | 5647 | } |
5708 | 5648 | ||
5709 | /** | 5649 | /* |
5710 | * Lookup a virtual port. Excludes base port from lookup. | 5650 | * Lookup a virtual port. Excludes base port from lookup. |
5711 | */ | 5651 | */ |
5712 | struct bfa_fcs_vport_s * | 5652 | struct bfa_fcs_vport_s * |
@@ -5728,7 +5668,7 @@ bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs, u16 vf_id, wwn_t vpwwn) | |||
5728 | return vport; | 5668 | return vport; |
5729 | } | 5669 | } |
5730 | 5670 | ||
5731 | /** | 5671 | /* |
5732 | * FDISC Response | 5672 | * FDISC Response |
5733 | */ | 5673 | */ |
5734 | void | 5674 | void |
@@ -5784,7 +5724,7 @@ bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status) | |||
5784 | } | 5724 | } |
5785 | } | 5725 | } |
5786 | 5726 | ||
5787 | /** | 5727 | /* |
5788 | * LOGO response | 5728 | * LOGO response |
5789 | */ | 5729 | */ |
5790 | void | 5730 | void |
@@ -5794,7 +5734,7 @@ bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg) | |||
5794 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_OK); | 5734 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_OK); |
5795 | } | 5735 | } |
5796 | 5736 | ||
5797 | /** | 5737 | /* |
5798 | * Received clear virtual link | 5738 | * Received clear virtual link |
5799 | */ | 5739 | */ |
5800 | void | 5740 | void |