aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/fcbuild.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/fcbuild.c')
-rw-r--r--drivers/scsi/bfa/fcbuild.c190
1 files changed, 95 insertions, 95 deletions
diff --git a/drivers/scsi/bfa/fcbuild.c b/drivers/scsi/bfa/fcbuild.c
index d174706b9caa..fee5456451cb 100644
--- a/drivers/scsi/bfa/fcbuild.c
+++ b/drivers/scsi/bfa/fcbuild.c
@@ -188,14 +188,14 @@ fc_els_rsp_parse(struct fchs_s *fchs, int len)
188 switch (els_cmd->els_code) { 188 switch (els_cmd->els_code) {
189 case FC_ELS_LS_RJT: 189 case FC_ELS_LS_RJT:
190 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY) 190 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY)
191 return (FC_PARSE_BUSY); 191 return FC_PARSE_BUSY;
192 else 192 else
193 return (FC_PARSE_FAILURE); 193 return FC_PARSE_FAILURE;
194 194
195 case FC_ELS_ACC: 195 case FC_ELS_ACC:
196 return (FC_PARSE_OK); 196 return FC_PARSE_OK;
197 } 197 }
198 return (FC_PARSE_OK); 198 return FC_PARSE_OK;
199} 199}
200 200
201static void 201static void
@@ -228,7 +228,7 @@ fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
228 bfa_os_memcpy(&plogi->port_name, &port_name, sizeof(wwn_t)); 228 bfa_os_memcpy(&plogi->port_name, &port_name, sizeof(wwn_t));
229 bfa_os_memcpy(&plogi->node_name, &node_name, sizeof(wwn_t)); 229 bfa_os_memcpy(&plogi->node_name, &node_name, sizeof(wwn_t));
230 230
231 return (sizeof(struct fc_logi_s)); 231 return sizeof(struct fc_logi_s);
232} 232}
233 233
234u16 234u16
@@ -267,7 +267,7 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
267 flogi->csp.npiv_supp = 1; /* @todo. field name is not correct */ 267 flogi->csp.npiv_supp = 1; /* @todo. field name is not correct */
268 vvl_info[0] = bfa_os_htonl(FLOGI_VVL_BRCD); 268 vvl_info[0] = bfa_os_htonl(FLOGI_VVL_BRCD);
269 269
270 return (sizeof(struct fc_logi_s)); 270 return sizeof(struct fc_logi_s);
271} 271}
272 272
273u16 273u16
@@ -287,7 +287,7 @@ fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
287 287
288 flogi->csp.bbcred = bfa_os_htons(local_bb_credits); 288 flogi->csp.bbcred = bfa_os_htons(local_bb_credits);
289 289
290 return (sizeof(struct fc_logi_s)); 290 return sizeof(struct fc_logi_s);
291} 291}
292 292
293u16 293u16
@@ -306,7 +306,7 @@ fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
306 flogi->port_name = port_name; 306 flogi->port_name = port_name;
307 flogi->node_name = node_name; 307 flogi->node_name = node_name;
308 308
309 return (sizeof(struct fc_logi_s)); 309 return sizeof(struct fc_logi_s);
310} 310}
311 311
312u16 312u16
@@ -338,26 +338,26 @@ fc_plogi_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name)
338 case FC_ELS_LS_RJT: 338 case FC_ELS_LS_RJT:
339 ls_rjt = (struct fc_ls_rjt_s *) (fchs + 1); 339 ls_rjt = (struct fc_ls_rjt_s *) (fchs + 1);
340 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY) 340 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY)
341 return (FC_PARSE_BUSY); 341 return FC_PARSE_BUSY;
342 else 342 else
343 return (FC_PARSE_FAILURE); 343 return FC_PARSE_FAILURE;
344 case FC_ELS_ACC: 344 case FC_ELS_ACC:
345 plogi = (struct fc_logi_s *) (fchs + 1); 345 plogi = (struct fc_logi_s *) (fchs + 1);
346 if (len < sizeof(struct fc_logi_s)) 346 if (len < sizeof(struct fc_logi_s))
347 return (FC_PARSE_FAILURE); 347 return FC_PARSE_FAILURE;
348 348
349 if (!wwn_is_equal(plogi->port_name, port_name)) 349 if (!wwn_is_equal(plogi->port_name, port_name))
350 return (FC_PARSE_FAILURE); 350 return FC_PARSE_FAILURE;
351 351
352 if (!plogi->class3.class_valid) 352 if (!plogi->class3.class_valid)
353 return (FC_PARSE_FAILURE); 353 return FC_PARSE_FAILURE;
354 354
355 if (bfa_os_ntohs(plogi->class3.rxsz) < (FC_MIN_PDUSZ)) 355 if (bfa_os_ntohs(plogi->class3.rxsz) < (FC_MIN_PDUSZ))
356 return (FC_PARSE_FAILURE); 356 return FC_PARSE_FAILURE;
357 357
358 return (FC_PARSE_OK); 358 return FC_PARSE_OK;
359 default: 359 default:
360 return (FC_PARSE_FAILURE); 360 return FC_PARSE_FAILURE;
361 } 361 }
362} 362}
363 363
@@ -372,7 +372,7 @@ fc_plogi_parse(struct fchs_s *fchs)
372 if ((bfa_os_ntohs(plogi->class3.rxsz) < FC_MIN_PDUSZ) 372 if ((bfa_os_ntohs(plogi->class3.rxsz) < FC_MIN_PDUSZ)
373 || (bfa_os_ntohs(plogi->class3.rxsz) > FC_MAX_PDUSZ) 373 || (bfa_os_ntohs(plogi->class3.rxsz) > FC_MAX_PDUSZ)
374 || (plogi->class3.rxsz == 0)) 374 || (plogi->class3.rxsz == 0))
375 return (FC_PARSE_FAILURE); 375 return FC_PARSE_FAILURE;
376 376
377 return FC_PARSE_OK; 377 return FC_PARSE_OK;
378} 378}
@@ -393,7 +393,7 @@ fc_prli_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
393 prli->parampage.servparams.task_retry_id = 0; 393 prli->parampage.servparams.task_retry_id = 0;
394 prli->parampage.servparams.confirm = 1; 394 prli->parampage.servparams.confirm = 1;
395 395
396 return (sizeof(struct fc_prli_s)); 396 return sizeof(struct fc_prli_s);
397} 397}
398 398
399u16 399u16
@@ -414,41 +414,41 @@ fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
414 414
415 prli->parampage.rspcode = FC_PRLI_ACC_XQTD; 415 prli->parampage.rspcode = FC_PRLI_ACC_XQTD;
416 416
417 return (sizeof(struct fc_prli_s)); 417 return sizeof(struct fc_prli_s);
418} 418}
419 419
420enum fc_parse_status 420enum fc_parse_status
421fc_prli_rsp_parse(struct fc_prli_s *prli, int len) 421fc_prli_rsp_parse(struct fc_prli_s *prli, int len)
422{ 422{
423 if (len < sizeof(struct fc_prli_s)) 423 if (len < sizeof(struct fc_prli_s))
424 return (FC_PARSE_FAILURE); 424 return FC_PARSE_FAILURE;
425 425
426 if (prli->command != FC_ELS_ACC) 426 if (prli->command != FC_ELS_ACC)
427 return (FC_PARSE_FAILURE); 427 return FC_PARSE_FAILURE;
428 428
429 if ((prli->parampage.rspcode != FC_PRLI_ACC_XQTD) 429 if ((prli->parampage.rspcode != FC_PRLI_ACC_XQTD)
430 && (prli->parampage.rspcode != FC_PRLI_ACC_PREDEF_IMG)) 430 && (prli->parampage.rspcode != FC_PRLI_ACC_PREDEF_IMG))
431 return (FC_PARSE_FAILURE); 431 return FC_PARSE_FAILURE;
432 432
433 if (prli->parampage.servparams.target != 1) 433 if (prli->parampage.servparams.target != 1)
434 return (FC_PARSE_FAILURE); 434 return FC_PARSE_FAILURE;
435 435
436 return (FC_PARSE_OK); 436 return FC_PARSE_OK;
437} 437}
438 438
439enum fc_parse_status 439enum fc_parse_status
440fc_prli_parse(struct fc_prli_s *prli) 440fc_prli_parse(struct fc_prli_s *prli)
441{ 441{
442 if (prli->parampage.type != FC_TYPE_FCP) 442 if (prli->parampage.type != FC_TYPE_FCP)
443 return (FC_PARSE_FAILURE); 443 return FC_PARSE_FAILURE;
444 444
445 if (!prli->parampage.imagepair) 445 if (!prli->parampage.imagepair)
446 return (FC_PARSE_FAILURE); 446 return FC_PARSE_FAILURE;
447 447
448 if (!prli->parampage.servparams.initiator) 448 if (!prli->parampage.servparams.initiator)
449 return (FC_PARSE_FAILURE); 449 return FC_PARSE_FAILURE;
450 450
451 return (FC_PARSE_OK); 451 return FC_PARSE_OK;
452} 452}
453 453
454u16 454u16
@@ -462,7 +462,7 @@ fc_logo_build(struct fchs_s *fchs, struct fc_logo_s *logo, u32 d_id,
462 logo->nport_id = (s_id); 462 logo->nport_id = (s_id);
463 logo->orig_port_name = port_name; 463 logo->orig_port_name = port_name;
464 464
465 return (sizeof(struct fc_logo_s)); 465 return sizeof(struct fc_logo_s);
466} 466}
467 467
468static u16 468static u16
@@ -484,7 +484,7 @@ fc_adisc_x_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id,
484 adisc->orig_node_name = node_name; 484 adisc->orig_node_name = node_name;
485 adisc->nport_id = (s_id); 485 adisc->nport_id = (s_id);
486 486
487 return (sizeof(struct fc_adisc_s)); 487 return sizeof(struct fc_adisc_s);
488} 488}
489 489
490u16 490u16
@@ -511,15 +511,15 @@ fc_adisc_rsp_parse(struct fc_adisc_s *adisc, int len, wwn_t port_name,
511{ 511{
512 512
513 if (len < sizeof(struct fc_adisc_s)) 513 if (len < sizeof(struct fc_adisc_s))
514 return (FC_PARSE_FAILURE); 514 return FC_PARSE_FAILURE;
515 515
516 if (adisc->els_cmd.els_code != FC_ELS_ACC) 516 if (adisc->els_cmd.els_code != FC_ELS_ACC)
517 return (FC_PARSE_FAILURE); 517 return FC_PARSE_FAILURE;
518 518
519 if (!wwn_is_equal(adisc->orig_port_name, port_name)) 519 if (!wwn_is_equal(adisc->orig_port_name, port_name))
520 return (FC_PARSE_FAILURE); 520 return FC_PARSE_FAILURE;
521 521
522 return (FC_PARSE_OK); 522 return FC_PARSE_OK;
523} 523}
524 524
525enum fc_parse_status 525enum fc_parse_status
@@ -529,14 +529,14 @@ fc_adisc_parse(struct fchs_s *fchs, void *pld, u32 host_dap,
529 struct fc_adisc_s *adisc = (struct fc_adisc_s *) pld; 529 struct fc_adisc_s *adisc = (struct fc_adisc_s *) pld;
530 530
531 if (adisc->els_cmd.els_code != FC_ELS_ACC) 531 if (adisc->els_cmd.els_code != FC_ELS_ACC)
532 return (FC_PARSE_FAILURE); 532 return FC_PARSE_FAILURE;
533 533
534 if ((adisc->nport_id == (host_dap)) 534 if ((adisc->nport_id == (host_dap))
535 && wwn_is_equal(adisc->orig_port_name, port_name) 535 && wwn_is_equal(adisc->orig_port_name, port_name)
536 && wwn_is_equal(adisc->orig_node_name, node_name)) 536 && wwn_is_equal(adisc->orig_node_name, node_name))
537 return (FC_PARSE_OK); 537 return FC_PARSE_OK;
538 538
539 return (FC_PARSE_FAILURE); 539 return FC_PARSE_FAILURE;
540} 540}
541 541
542enum fc_parse_status 542enum fc_parse_status
@@ -550,13 +550,13 @@ fc_pdisc_parse(struct fchs_s *fchs, wwn_t node_name, wwn_t port_name)
550 if ((bfa_os_ntohs(pdisc->class3.rxsz) < 550 if ((bfa_os_ntohs(pdisc->class3.rxsz) <
551 (FC_MIN_PDUSZ - sizeof(struct fchs_s))) 551 (FC_MIN_PDUSZ - sizeof(struct fchs_s)))
552 || (pdisc->class3.rxsz == 0)) 552 || (pdisc->class3.rxsz == 0))
553 return (FC_PARSE_FAILURE); 553 return FC_PARSE_FAILURE;
554 554
555 if (!wwn_is_equal(pdisc->port_name, port_name)) 555 if (!wwn_is_equal(pdisc->port_name, port_name))
556 return (FC_PARSE_FAILURE); 556 return FC_PARSE_FAILURE;
557 557
558 if (!wwn_is_equal(pdisc->node_name, node_name)) 558 if (!wwn_is_equal(pdisc->node_name, node_name))
559 return (FC_PARSE_FAILURE); 559 return FC_PARSE_FAILURE;
560 560
561 return FC_PARSE_OK; 561 return FC_PARSE_OK;
562} 562}
@@ -570,7 +570,7 @@ fc_abts_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
570 fchs->s_id = (s_id); 570 fchs->s_id = (s_id);
571 fchs->ox_id = bfa_os_htons(ox_id); 571 fchs->ox_id = bfa_os_htons(ox_id);
572 572
573 return (sizeof(struct fchs_s)); 573 return sizeof(struct fchs_s);
574} 574}
575 575
576enum fc_parse_status 576enum fc_parse_status
@@ -578,9 +578,9 @@ fc_abts_rsp_parse(struct fchs_s *fchs, int len)
578{ 578{
579 if ((fchs->cat_info == FC_CAT_BA_ACC) 579 if ((fchs->cat_info == FC_CAT_BA_ACC)
580 || (fchs->cat_info == FC_CAT_BA_RJT)) 580 || (fchs->cat_info == FC_CAT_BA_RJT))
581 return (FC_PARSE_OK); 581 return FC_PARSE_OK;
582 582
583 return (FC_PARSE_FAILURE); 583 return FC_PARSE_FAILURE;
584} 584}
585 585
586u16 586u16
@@ -597,7 +597,7 @@ fc_rrq_build(struct fchs_s *fchs, struct fc_rrq_s *rrq, u32 d_id,
597 rrq->ox_id = bfa_os_htons(rrq_oxid); 597 rrq->ox_id = bfa_os_htons(rrq_oxid);
598 rrq->rx_id = FC_RXID_ANY; 598 rrq->rx_id = FC_RXID_ANY;
599 599
600 return (sizeof(struct fc_rrq_s)); 600 return sizeof(struct fc_rrq_s);
601} 601}
602 602
603u16 603u16
@@ -611,7 +611,7 @@ fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
611 memset(acc, 0, sizeof(struct fc_els_cmd_s)); 611 memset(acc, 0, sizeof(struct fc_els_cmd_s));
612 acc->els_code = FC_ELS_ACC; 612 acc->els_code = FC_ELS_ACC;
613 613
614 return (sizeof(struct fc_els_cmd_s)); 614 return sizeof(struct fc_els_cmd_s);
615} 615}
616 616
617u16 617u16
@@ -627,7 +627,7 @@ fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, u32 d_id,
627 ls_rjt->reason_code_expl = reason_code_expl; 627 ls_rjt->reason_code_expl = reason_code_expl;
628 ls_rjt->vendor_unique = 0x00; 628 ls_rjt->vendor_unique = 0x00;
629 629
630 return (sizeof(struct fc_ls_rjt_s)); 630 return sizeof(struct fc_ls_rjt_s);
631} 631}
632 632
633u16 633u16
@@ -643,7 +643,7 @@ fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id,
643 ba_acc->ox_id = fchs->ox_id; 643 ba_acc->ox_id = fchs->ox_id;
644 ba_acc->rx_id = fchs->rx_id; 644 ba_acc->rx_id = fchs->rx_id;
645 645
646 return (sizeof(struct fc_ba_acc_s)); 646 return sizeof(struct fc_ba_acc_s);
647} 647}
648 648
649u16 649u16
@@ -654,7 +654,7 @@ fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd,
654 memset(els_cmd, 0, sizeof(struct fc_els_cmd_s)); 654 memset(els_cmd, 0, sizeof(struct fc_els_cmd_s));
655 els_cmd->els_code = FC_ELS_ACC; 655 els_cmd->els_code = FC_ELS_ACC;
656 656
657 return (sizeof(struct fc_els_cmd_s)); 657 return sizeof(struct fc_els_cmd_s);
658} 658}
659 659
660int 660int
@@ -696,7 +696,7 @@ fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc,
696 tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0; 696 tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0;
697 tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0; 697 tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0;
698 } 698 }
699 return (bfa_os_ntohs(tprlo_acc->payload_len)); 699 return bfa_os_ntohs(tprlo_acc->payload_len);
700} 700}
701 701
702u16 702u16
@@ -721,7 +721,7 @@ fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc,
721 prlo_acc->prlo_acc_params[page].resp_process_assc = 0; 721 prlo_acc->prlo_acc_params[page].resp_process_assc = 0;
722 } 722 }
723 723
724 return (bfa_os_ntohs(prlo_acc->payload_len)); 724 return bfa_os_ntohs(prlo_acc->payload_len);
725} 725}
726 726
727u16 727u16
@@ -735,7 +735,7 @@ fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, u32 d_id,
735 rnid->els_cmd.els_code = FC_ELS_RNID; 735 rnid->els_cmd.els_code = FC_ELS_RNID;
736 rnid->node_id_data_format = data_format; 736 rnid->node_id_data_format = data_format;
737 737
738 return (sizeof(struct fc_rnid_cmd_s)); 738 return sizeof(struct fc_rnid_cmd_s);
739} 739}
740 740
741u16 741u16
@@ -759,10 +759,10 @@ fc_rnid_acc_build(struct fchs_s *fchs, struct fc_rnid_acc_s *rnid_acc,
759 rnid_acc->specific_id_data_length = 759 rnid_acc->specific_id_data_length =
760 sizeof(struct fc_rnid_general_topology_data_s); 760 sizeof(struct fc_rnid_general_topology_data_s);
761 bfa_os_assign(rnid_acc->gen_topology_data, *gen_topo_data); 761 bfa_os_assign(rnid_acc->gen_topology_data, *gen_topo_data);
762 return (sizeof(struct fc_rnid_acc_s)); 762 return sizeof(struct fc_rnid_acc_s);
763 } else { 763 } else {
764 return (sizeof(struct fc_rnid_acc_s) - 764 return sizeof(struct fc_rnid_acc_s) -
765 sizeof(struct fc_rnid_general_topology_data_s)); 765 sizeof(struct fc_rnid_general_topology_data_s);
766 } 766 }
767 767
768} 768}
@@ -776,7 +776,7 @@ fc_rpsc_build(struct fchs_s *fchs, struct fc_rpsc_cmd_s *rpsc, u32 d_id,
776 memset(rpsc, 0, sizeof(struct fc_rpsc_cmd_s)); 776 memset(rpsc, 0, sizeof(struct fc_rpsc_cmd_s));
777 777
778 rpsc->els_cmd.els_code = FC_ELS_RPSC; 778 rpsc->els_cmd.els_code = FC_ELS_RPSC;
779 return (sizeof(struct fc_rpsc_cmd_s)); 779 return sizeof(struct fc_rpsc_cmd_s);
780} 780}
781 781
782u16 782u16
@@ -797,8 +797,8 @@ fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2,
797 for (i = 0; i < npids; i++) 797 for (i = 0; i < npids; i++)
798 rpsc2->pid_list[i].pid = pid_list[i]; 798 rpsc2->pid_list[i].pid = pid_list[i];
799 799
800 return (sizeof(struct fc_rpsc2_cmd_s) + ((npids - 1) * 800 return sizeof(struct fc_rpsc2_cmd_s) + ((npids - 1) *
801 (sizeof(u32)))); 801 (sizeof(u32)));
802} 802}
803 803
804u16 804u16
@@ -819,7 +819,7 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc,
819 rpsc_acc->speed_info[0].port_op_speed = 819 rpsc_acc->speed_info[0].port_op_speed =
820 bfa_os_htons(oper_speed->port_op_speed); 820 bfa_os_htons(oper_speed->port_op_speed);
821 821
822 return (sizeof(struct fc_rpsc_acc_s)); 822 return sizeof(struct fc_rpsc_acc_s);
823 823
824} 824}
825 825
@@ -856,7 +856,7 @@ fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
856 pdisc->port_name = port_name; 856 pdisc->port_name = port_name;
857 pdisc->node_name = node_name; 857 pdisc->node_name = node_name;
858 858
859 return (sizeof(struct fc_logi_s)); 859 return sizeof(struct fc_logi_s);
860} 860}
861 861
862u16 862u16
@@ -865,21 +865,21 @@ fc_pdisc_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name)
865 struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1); 865 struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1);
866 866
867 if (len < sizeof(struct fc_logi_s)) 867 if (len < sizeof(struct fc_logi_s))
868 return (FC_PARSE_LEN_INVAL); 868 return FC_PARSE_LEN_INVAL;
869 869
870 if (pdisc->els_cmd.els_code != FC_ELS_ACC) 870 if (pdisc->els_cmd.els_code != FC_ELS_ACC)
871 return (FC_PARSE_ACC_INVAL); 871 return FC_PARSE_ACC_INVAL;
872 872
873 if (!wwn_is_equal(pdisc->port_name, port_name)) 873 if (!wwn_is_equal(pdisc->port_name, port_name))
874 return (FC_PARSE_PWWN_NOT_EQUAL); 874 return FC_PARSE_PWWN_NOT_EQUAL;
875 875
876 if (!pdisc->class3.class_valid) 876 if (!pdisc->class3.class_valid)
877 return (FC_PARSE_NWWN_NOT_EQUAL); 877 return FC_PARSE_NWWN_NOT_EQUAL;
878 878
879 if (bfa_os_ntohs(pdisc->class3.rxsz) < (FC_MIN_PDUSZ)) 879 if (bfa_os_ntohs(pdisc->class3.rxsz) < (FC_MIN_PDUSZ))
880 return (FC_PARSE_RXSZ_INVAL); 880 return FC_PARSE_RXSZ_INVAL;
881 881
882 return (FC_PARSE_OK); 882 return FC_PARSE_OK;
883} 883}
884 884
885u16 885u16
@@ -903,7 +903,7 @@ fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
903 prlo->prlo_params[page].resp_process_assc = 0; 903 prlo->prlo_params[page].resp_process_assc = 0;
904 } 904 }
905 905
906 return (bfa_os_ntohs(prlo->payload_len)); 906 return bfa_os_ntohs(prlo->payload_len);
907} 907}
908 908
909u16 909u16
@@ -916,7 +916,7 @@ fc_prlo_rsp_parse(struct fchs_s *fchs, int len)
916 len = len; 916 len = len;
917 917
918 if (prlo->command != FC_ELS_ACC) 918 if (prlo->command != FC_ELS_ACC)
919 return (FC_PARSE_FAILURE); 919 return FC_PARSE_FAILURE;
920 920
921 num_pages = ((bfa_os_ntohs(prlo->payload_len)) - 4) / 16; 921 num_pages = ((bfa_os_ntohs(prlo->payload_len)) - 4) / 16;
922 922
@@ -936,7 +936,7 @@ fc_prlo_rsp_parse(struct fchs_s *fchs, int len)
936 if (prlo->prlo_acc_params[page].resp_process_assc != 0) 936 if (prlo->prlo_acc_params[page].resp_process_assc != 0)
937 return FC_PARSE_FAILURE; 937 return FC_PARSE_FAILURE;
938 } 938 }
939 return (FC_PARSE_OK); 939 return FC_PARSE_OK;
940 940
941} 941}
942 942
@@ -968,7 +968,7 @@ fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
968 } 968 }
969 } 969 }
970 970
971 return (bfa_os_ntohs(tprlo->payload_len)); 971 return bfa_os_ntohs(tprlo->payload_len);
972} 972}
973 973
974u16 974u16
@@ -981,23 +981,23 @@ fc_tprlo_rsp_parse(struct fchs_s *fchs, int len)
981 len = len; 981 len = len;
982 982
983 if (tprlo->command != FC_ELS_ACC) 983 if (tprlo->command != FC_ELS_ACC)
984 return (FC_PARSE_ACC_INVAL); 984 return FC_PARSE_ACC_INVAL;
985 985
986 num_pages = (bfa_os_ntohs(tprlo->payload_len) - 4) / 16; 986 num_pages = (bfa_os_ntohs(tprlo->payload_len) - 4) / 16;
987 987
988 for (page = 0; page < num_pages; page++) { 988 for (page = 0; page < num_pages; page++) {
989 if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP) 989 if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP)
990 return (FC_PARSE_NOT_FCP); 990 return FC_PARSE_NOT_FCP;
991 if (tprlo->tprlo_acc_params[page].opa_valid != 0) 991 if (tprlo->tprlo_acc_params[page].opa_valid != 0)
992 return (FC_PARSE_OPAFLAG_INVAL); 992 return FC_PARSE_OPAFLAG_INVAL;
993 if (tprlo->tprlo_acc_params[page].rpa_valid != 0) 993 if (tprlo->tprlo_acc_params[page].rpa_valid != 0)
994 return (FC_PARSE_RPAFLAG_INVAL); 994 return FC_PARSE_RPAFLAG_INVAL;
995 if (tprlo->tprlo_acc_params[page].orig_process_assc != 0) 995 if (tprlo->tprlo_acc_params[page].orig_process_assc != 0)
996 return (FC_PARSE_OPA_INVAL); 996 return FC_PARSE_OPA_INVAL;
997 if (tprlo->tprlo_acc_params[page].resp_process_assc != 0) 997 if (tprlo->tprlo_acc_params[page].resp_process_assc != 0)
998 return (FC_PARSE_RPA_INVAL); 998 return FC_PARSE_RPA_INVAL;
999 } 999 }
1000 return (FC_PARSE_OK); 1000 return FC_PARSE_OK;
1001} 1001}
1002 1002
1003enum fc_parse_status 1003enum fc_parse_status
@@ -1024,7 +1024,7 @@ fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
1024 fchs->cat_info = FC_CAT_BA_RJT; 1024 fchs->cat_info = FC_CAT_BA_RJT;
1025 ba_rjt->reason_code = reason_code; 1025 ba_rjt->reason_code = reason_code;
1026 ba_rjt->reason_expl = reason_expl; 1026 ba_rjt->reason_expl = reason_expl;
1027 return (sizeof(struct fc_ba_rjt_s)); 1027 return sizeof(struct fc_ba_rjt_s);
1028} 1028}
1029 1029
1030static void 1030static void
@@ -1073,7 +1073,7 @@ fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1073 1073
1074 bfa_os_memset(gidpn, 0, sizeof(struct fcgs_gidpn_req_s)); 1074 bfa_os_memset(gidpn, 0, sizeof(struct fcgs_gidpn_req_s));
1075 gidpn->port_name = port_name; 1075 gidpn->port_name = port_name;
1076 return (sizeof(struct fcgs_gidpn_req_s) + sizeof(struct ct_hdr_s)); 1076 return sizeof(struct fcgs_gidpn_req_s) + sizeof(struct ct_hdr_s);
1077} 1077}
1078 1078
1079u16 1079u16
@@ -1090,7 +1090,7 @@ fc_gpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1090 1090
1091 bfa_os_memset(gpnid, 0, sizeof(fcgs_gpnid_req_t)); 1091 bfa_os_memset(gpnid, 0, sizeof(fcgs_gpnid_req_t));
1092 gpnid->dap = port_id; 1092 gpnid->dap = port_id;
1093 return (sizeof(fcgs_gpnid_req_t) + sizeof(struct ct_hdr_s)); 1093 return sizeof(fcgs_gpnid_req_t) + sizeof(struct ct_hdr_s);
1094} 1094}
1095 1095
1096u16 1096u16
@@ -1107,7 +1107,7 @@ fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1107 1107
1108 bfa_os_memset(gnnid, 0, sizeof(fcgs_gnnid_req_t)); 1108 bfa_os_memset(gnnid, 0, sizeof(fcgs_gnnid_req_t));
1109 gnnid->dap = port_id; 1109 gnnid->dap = port_id;
1110 return (sizeof(fcgs_gnnid_req_t) + sizeof(struct ct_hdr_s)); 1110 return sizeof(fcgs_gnnid_req_t) + sizeof(struct ct_hdr_s);
1111} 1111}
1112 1112
1113u16 1113u16
@@ -1137,7 +1137,7 @@ fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, u8 set_br_reg,
1137 if (set_br_reg) 1137 if (set_br_reg)
1138 scr->vu_reg_func = FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE; 1138 scr->vu_reg_func = FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE;
1139 1139
1140 return (sizeof(struct fc_scr_s)); 1140 return sizeof(struct fc_scr_s);
1141} 1141}
1142 1142
1143u16 1143u16
@@ -1157,7 +1157,7 @@ fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, u32 s_id,
1157 rscn->event[0].format = FC_RSCN_FORMAT_PORTID; 1157 rscn->event[0].format = FC_RSCN_FORMAT_PORTID;
1158 rscn->event[0].portid = s_id; 1158 rscn->event[0].portid = s_id;
1159 1159
1160 return (sizeof(struct fc_rscn_pl_s)); 1160 return sizeof(struct fc_rscn_pl_s);
1161} 1161}
1162 1162
1163u16 1163u16
@@ -1188,7 +1188,7 @@ fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1188 rftid->fc4_type[index] |= bfa_os_htonl(type_value); 1188 rftid->fc4_type[index] |= bfa_os_htonl(type_value);
1189 } 1189 }
1190 1190
1191 return (sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s)); 1191 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s);
1192} 1192}
1193 1193
1194u16 1194u16
@@ -1210,7 +1210,7 @@ fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id,
1210 bfa_os_memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap, 1210 bfa_os_memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap,
1211 (bitmap_size < 32 ? bitmap_size : 32)); 1211 (bitmap_size < 32 ? bitmap_size : 32));
1212 1212
1213 return (sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s)); 1213 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s);
1214} 1214}
1215 1215
1216u16 1216u16
@@ -1231,7 +1231,7 @@ fc_rffid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1231 rffid->fc4ftr_bits = fc4_ftrs; 1231 rffid->fc4ftr_bits = fc4_ftrs;
1232 rffid->fc4_type = fc4_type; 1232 rffid->fc4_type = fc4_type;
1233 1233
1234 return (sizeof(struct fcgs_rffid_req_s) + sizeof(struct ct_hdr_s)); 1234 return sizeof(struct fcgs_rffid_req_s) + sizeof(struct ct_hdr_s);
1235} 1235}
1236 1236
1237u16 1237u16
@@ -1253,7 +1253,7 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1253 rspnid->spn_len = (u8) strlen((char *)name); 1253 rspnid->spn_len = (u8) strlen((char *)name);
1254 strncpy((char *)rspnid->spn, (char *)name, rspnid->spn_len); 1254 strncpy((char *)rspnid->spn, (char *)name, rspnid->spn_len);
1255 1255
1256 return (sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s)); 1256 return sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s);
1257} 1257}
1258 1258
1259u16 1259u16
@@ -1275,7 +1275,7 @@ fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id,
1275 gidft->domain_id = 0; 1275 gidft->domain_id = 0;
1276 gidft->area_id = 0; 1276 gidft->area_id = 0;
1277 1277
1278 return (sizeof(struct fcgs_gidft_req_s) + sizeof(struct ct_hdr_s)); 1278 return sizeof(struct fcgs_gidft_req_s) + sizeof(struct ct_hdr_s);
1279} 1279}
1280 1280
1281u16 1281u16
@@ -1294,7 +1294,7 @@ fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1294 rpnid->port_id = port_id; 1294 rpnid->port_id = port_id;
1295 rpnid->port_name = port_name; 1295 rpnid->port_name = port_name;
1296 1296
1297 return (sizeof(struct fcgs_rpnid_req_s) + sizeof(struct ct_hdr_s)); 1297 return sizeof(struct fcgs_rpnid_req_s) + sizeof(struct ct_hdr_s);
1298} 1298}
1299 1299
1300u16 1300u16
@@ -1313,7 +1313,7 @@ fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1313 rnnid->port_id = port_id; 1313 rnnid->port_id = port_id;
1314 rnnid->node_name = node_name; 1314 rnnid->node_name = node_name;
1315 1315
1316 return (sizeof(struct fcgs_rnnid_req_s) + sizeof(struct ct_hdr_s)); 1316 return sizeof(struct fcgs_rnnid_req_s) + sizeof(struct ct_hdr_s);
1317} 1317}
1318 1318
1319u16 1319u16
@@ -1332,7 +1332,7 @@ fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1332 rcsid->port_id = port_id; 1332 rcsid->port_id = port_id;
1333 rcsid->cos = cos; 1333 rcsid->cos = cos;
1334 1334
1335 return (sizeof(struct fcgs_rcsid_req_s) + sizeof(struct ct_hdr_s)); 1335 return sizeof(struct fcgs_rcsid_req_s) + sizeof(struct ct_hdr_s);
1336} 1336}
1337 1337
1338u16 1338u16
@@ -1351,7 +1351,7 @@ fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1351 rptid->port_id = port_id; 1351 rptid->port_id = port_id;
1352 rptid->port_type = port_type; 1352 rptid->port_type = port_type;
1353 1353
1354 return (sizeof(struct fcgs_rptid_req_s) + sizeof(struct ct_hdr_s)); 1354 return sizeof(struct fcgs_rptid_req_s) + sizeof(struct ct_hdr_s);
1355} 1355}
1356 1356
1357u16 1357u16
@@ -1368,7 +1368,7 @@ fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id)
1368 bfa_os_memset(ganxt, 0, sizeof(struct fcgs_ganxt_req_s)); 1368 bfa_os_memset(ganxt, 0, sizeof(struct fcgs_ganxt_req_s));
1369 ganxt->port_id = port_id; 1369 ganxt->port_id = port_id;
1370 1370
1371 return (sizeof(struct ct_hdr_s) + sizeof(struct fcgs_ganxt_req_s)); 1371 return sizeof(struct ct_hdr_s) + sizeof(struct fcgs_ganxt_req_s);
1372} 1372}
1373 1373
1374/* 1374/*
@@ -1385,7 +1385,7 @@ fc_fdmi_reqhdr_build(struct fchs_s *fchs, void *pyld, u32 s_id,
1385 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1385 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1386 fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code); 1386 fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code);
1387 1387
1388 return (sizeof(struct ct_hdr_s)); 1388 return sizeof(struct ct_hdr_s);
1389} 1389}
1390 1390
1391/* 1391/*
@@ -1425,7 +1425,7 @@ fc_gmal_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1425 bfa_os_memset(gmal, 0, sizeof(fcgs_gmal_req_t)); 1425 bfa_os_memset(gmal, 0, sizeof(fcgs_gmal_req_t));
1426 gmal->wwn = wwn; 1426 gmal->wwn = wwn;
1427 1427
1428 return (sizeof(struct ct_hdr_s) + sizeof(fcgs_gmal_req_t)); 1428 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gmal_req_t);
1429} 1429}
1430 1430
1431/* 1431/*
@@ -1445,5 +1445,5 @@ fc_gfn_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1445 bfa_os_memset(gfn, 0, sizeof(fcgs_gfn_req_t)); 1445 bfa_os_memset(gfn, 0, sizeof(fcgs_gfn_req_t));
1446 gfn->wwn = wwn; 1446 gfn->wwn = wwn;
1447 1447
1448 return (sizeof(struct ct_hdr_s) + sizeof(fcgs_gfn_req_t)); 1448 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gfn_req_t);
1449} 1449}