Deleted Added
full compact
isp.c (321869) isp.c (321870)
1/*-
1/*-
2 * Copyright (c) 2009-2017 Alexander Motin <mav@FreeBSD.org>
2 * Copyright (c) 1997-2009 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

42 */
43#ifdef __NetBSD__
44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD$");
46#include <dev/ic/isp_netbsd.h>
47#endif
48#ifdef __FreeBSD__
49#include <sys/cdefs.h>
3 * Copyright (c) 1997-2009 by Matthew Jacob
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

43 */
44#ifdef __NetBSD__
45#include <sys/cdefs.h>
46__KERNEL_RCSID(0, "$NetBSD$");
47#include <dev/ic/isp_netbsd.h>
48#endif
49#ifdef __FreeBSD__
50#include <sys/cdefs.h>
50__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp.c 321869 2017-08-01 13:00:13Z mav $");
51__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp.c 321870 2017-08-01 13:03:06Z mav $");
51#include <dev/isp/isp_freebsd.h>
52#endif
53#ifdef __OpenBSD__
54#include <dev/ic/isp_openbsd.h>
55#endif
56#ifdef __linux__
57#include "isp_linux.h"
58#endif

--- 53 unchanged lines hidden (view full) ---

112static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t);
113static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *);
114static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int);
115static void isp_dump_chip_portdb(ispsoftc_t *, int);
116static uint64_t isp_get_wwn(ispsoftc_t *, int, int, int);
117static int isp_fclink_test(ispsoftc_t *, int, int);
118static int isp_pdb_sync(ispsoftc_t *, int);
119static int isp_scan_loop(ispsoftc_t *, int);
52#include <dev/isp/isp_freebsd.h>
53#endif
54#ifdef __OpenBSD__
55#include <dev/ic/isp_openbsd.h>
56#endif
57#ifdef __linux__
58#include "isp_linux.h"
59#endif

--- 53 unchanged lines hidden (view full) ---

113static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t);
114static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *);
115static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int);
116static void isp_dump_chip_portdb(ispsoftc_t *, int);
117static uint64_t isp_get_wwn(ispsoftc_t *, int, int, int);
118static int isp_fclink_test(ispsoftc_t *, int, int);
119static int isp_pdb_sync(ispsoftc_t *, int);
120static int isp_scan_loop(ispsoftc_t *, int);
120static int isp_gid_ft(ispsoftc_t *, int);
121static int isp_gid_pt(ispsoftc_t *, int);
121static int isp_scan_fabric(ispsoftc_t *, int);
122static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *);
123static int isp_send_change_request(ispsoftc_t *, int);
124static int isp_register_fc4_type(ispsoftc_t *, int);
125static int isp_register_fc4_features_24xx(ispsoftc_t *, int);
126static int isp_register_port_name_24xx(ispsoftc_t *, int);
127static int isp_register_node_name_24xx(ispsoftc_t *, int);
128static uint16_t isp_next_handle(ispsoftc_t *, uint16_t *);

--- 3362 unchanged lines hidden (view full) ---

3491 return (-1);
3492 }
3493 if (isp->isp_dblev & ISP_LOGDEBUG1)
3494 isp_print_bytes(isp, "CT IOCB response", QENTRY_LEN, resp);
3495
3496 isp_get_ct_pt(isp, (isp_ct_pt_t *)resp, &pt);
3497 if (pt.ctp_status && pt.ctp_status != RQCS_DATA_UNDERRUN) {
3498 isp_prt(isp, ISP_LOGWARN,
122static int isp_scan_fabric(ispsoftc_t *, int);
123static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *);
124static int isp_send_change_request(ispsoftc_t *, int);
125static int isp_register_fc4_type(ispsoftc_t *, int);
126static int isp_register_fc4_features_24xx(ispsoftc_t *, int);
127static int isp_register_port_name_24xx(ispsoftc_t *, int);
128static int isp_register_node_name_24xx(ispsoftc_t *, int);
129static uint16_t isp_next_handle(ispsoftc_t *, uint16_t *);

--- 3362 unchanged lines hidden (view full) ---

3492 return (-1);
3493 }
3494 if (isp->isp_dblev & ISP_LOGDEBUG1)
3495 isp_print_bytes(isp, "CT IOCB response", QENTRY_LEN, resp);
3496
3497 isp_get_ct_pt(isp, (isp_ct_pt_t *)resp, &pt);
3498 if (pt.ctp_status && pt.ctp_status != RQCS_DATA_UNDERRUN) {
3499 isp_prt(isp, ISP_LOGWARN,
3499 "Chan %d GID_FT CT Passthrough returned 0x%x",
3500 "Chan %d CT pass-through returned 0x%x",
3500 chan, pt.ctp_status);
3501 return (-1);
3502 }
3503
3504 if (isp->isp_dblev & ISP_LOGDEBUG1)
3505 isp_print_bytes(isp, "CT response", rsp_bcnt, fcp->isp_scratch);
3506
3507 return (0);
3508}
3509
3510/*
3511 * Scan the fabric for devices and add them to our port database.
3512 *
3501 chan, pt.ctp_status);
3502 return (-1);
3503 }
3504
3505 if (isp->isp_dblev & ISP_LOGDEBUG1)
3506 isp_print_bytes(isp, "CT response", rsp_bcnt, fcp->isp_scratch);
3507
3508 return (0);
3509}
3510
3511/*
3512 * Scan the fabric for devices and add them to our port database.
3513 *
3513 * Use the GID_FT command to get all Port IDs for FC4 SCSI devices it knows.
3514 * Use the GID_PT command to get list of all Nx_Port IDs SNS knows.
3515 * Use GFF_ID and GFT_ID to check port type (FCP) and features (target).
3514 *
3515 * For 2100-23XX cards, we use the SNS mailbox command to pass simple name
3516 * server commands to the switch management server via the QLogic f/w.
3517 *
3518 * For the 24XX and above card, we use CT Pass-through IOCB.
3519 */
3520#define GIDLEN ISP_FC_SCRLEN
3521#define NGENT ((GIDLEN - 16) >> 2)
3522
3523static int
3516 *
3517 * For 2100-23XX cards, we use the SNS mailbox command to pass simple name
3518 * server commands to the switch management server via the QLogic f/w.
3519 *
3520 * For the 24XX and above card, we use CT Pass-through IOCB.
3521 */
3522#define GIDLEN ISP_FC_SCRLEN
3523#define NGENT ((GIDLEN - 16) >> 2)
3524
3525static int
3524isp_gid_ft(ispsoftc_t *isp, int chan)
3526isp_gid_pt(ispsoftc_t *isp, int chan)
3525{
3526 fcparam *fcp = FCPARAM(isp, chan);
3527 ct_hdr_t ct;
3527{
3528 fcparam *fcp = FCPARAM(isp, chan);
3529 ct_hdr_t ct;
3528 sns_gid_ft_req_t rq;
3529 uint32_t *rp;
3530 sns_gid_pt_req_t rq;
3530 uint8_t *scp = fcp->isp_scratch;
3531
3531 uint8_t *scp = fcp->isp_scratch;
3532
3532 isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT", chan);
3533 isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_PT", chan);
3533 if (FC_SCRATCH_ACQUIRE(isp, chan)) {
3534 isp_prt(isp, ISP_LOGERR, sacq);
3535 return (-1);
3536 }
3537
3538 if (IS_24XX(isp)) {
3539 /* Build the CT command and execute via pass-through. */
3540 ISP_MEMZERO(&ct, sizeof (ct));
3541 ct.ct_revision = CT_REVISION;
3542 ct.ct_fcs_type = CT_FC_TYPE_FC;
3543 ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
3534 if (FC_SCRATCH_ACQUIRE(isp, chan)) {
3535 isp_prt(isp, ISP_LOGERR, sacq);
3536 return (-1);
3537 }
3538
3539 if (IS_24XX(isp)) {
3540 /* Build the CT command and execute via pass-through. */
3541 ISP_MEMZERO(&ct, sizeof (ct));
3542 ct.ct_revision = CT_REVISION;
3543 ct.ct_fcs_type = CT_FC_TYPE_FC;
3544 ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
3544 ct.ct_cmd_resp = SNS_GID_FT;
3545 ct.ct_cmd_resp = SNS_GID_PT;
3545 ct.ct_bcnt_resid = (GIDLEN - 16) >> 2;
3546 isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
3546 ct.ct_bcnt_resid = (GIDLEN - 16) >> 2;
3547 isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
3547 rp = (uint32_t *) &scp[sizeof(ct)];
3548 ISP_IOZPUT_32(isp, FC4_SCSI, rp);
3548 scp[sizeof(ct)] = 0x7f; /* Port Type = Nx_Port */
3549 scp[sizeof(ct)+1] = 0; /* Domain_ID = any */
3550 scp[sizeof(ct)+2] = 0; /* Area_ID = any */
3551 scp[sizeof(ct)+3] = 0; /* Flags = no Area_ID */
3549
3550 if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) {
3551 FC_SCRATCH_RELEASE(isp, chan);
3552 return (-1);
3553 }
3554 } else {
3555 /* Build the SNS request and execute via firmware. */
3552
3553 if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) {
3554 FC_SCRATCH_RELEASE(isp, chan);
3555 return (-1);
3556 }
3557 } else {
3558 /* Build the SNS request and execute via firmware. */
3556 ISP_MEMZERO(&rq, SNS_GID_FT_REQ_SIZE);
3559 ISP_MEMZERO(&rq, SNS_GID_PT_REQ_SIZE);
3557 rq.snscb_rblen = GIDLEN >> 1;
3558 rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma);
3559 rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma);
3560 rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma);
3561 rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma);
3562 rq.snscb_sblen = 6;
3560 rq.snscb_rblen = GIDLEN >> 1;
3561 rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma);
3562 rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma);
3563 rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma);
3564 rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma);
3565 rq.snscb_sblen = 6;
3563 rq.snscb_cmd = SNS_GID_FT;
3566 rq.snscb_cmd = SNS_GID_PT;
3564 rq.snscb_mword_div_2 = NGENT;
3567 rq.snscb_mword_div_2 = NGENT;
3565 rq.snscb_fc4_type = FC4_SCSI;
3566 isp_put_gid_ft_request(isp, &rq, (sns_gid_ft_req_t *)scp);
3568 rq.snscb_port_type = 0x7f; /* Port Type = Nx_Port */
3569 rq.snscb_domain = 0; /* Domain_ID = any */
3570 rq.snscb_area = 0; /* Area_ID = any */
3571 rq.snscb_flags = 0; /* Flags = no Area_ID */
3572 isp_put_gid_pt_request(isp, &rq, (sns_gid_pt_req_t *)scp);
3567
3568 if (isp_ct_sns(isp, chan, sizeof(rq), NGENT)) {
3569 FC_SCRATCH_RELEASE(isp, chan);
3570 return (-1);
3571 }
3572 }
3573
3573
3574 if (isp_ct_sns(isp, chan, sizeof(rq), NGENT)) {
3575 FC_SCRATCH_RELEASE(isp, chan);
3576 return (-1);
3577 }
3578 }
3579
3574 isp_get_gid_ft_response(isp, (sns_gid_ft_rsp_t *)scp,
3575 (sns_gid_ft_rsp_t *)fcp->isp_scanscratch, NGENT);
3580 isp_get_gid_xx_response(isp, (sns_gid_xx_rsp_t *)scp,
3581 (sns_gid_xx_rsp_t *)fcp->isp_scanscratch, NGENT);
3576 FC_SCRATCH_RELEASE(isp, chan);
3577 return (0);
3578}
3579
3580static int
3582 FC_SCRATCH_RELEASE(isp, chan);
3583 return (0);
3584}
3585
3586static int
3587isp_gff_id(ispsoftc_t *isp, int chan, uint32_t portid)
3588{
3589 fcparam *fcp = FCPARAM(isp, chan);
3590 ct_hdr_t ct;
3591 uint32_t *rp;
3592 uint8_t *scp = fcp->isp_scratch;
3593 sns_gff_id_rsp_t rsp;
3594 int i, res = -1;
3595
3596 if (!fcp->isp_use_gff_id) /* User may block GFF_ID use. */
3597 return (res);
3598
3599 if (!IS_24XX(isp)) /* Old chips can't request GFF_ID. */
3600 return (res);
3601
3602 isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GFF_ID", chan);
3603 if (FC_SCRATCH_ACQUIRE(isp, chan)) {
3604 isp_prt(isp, ISP_LOGERR, sacq);
3605 return (res);
3606 }
3607
3608 /* Build the CT command and execute via pass-through. */
3609 ISP_MEMZERO(&ct, sizeof (ct));
3610 ct.ct_revision = CT_REVISION;
3611 ct.ct_fcs_type = CT_FC_TYPE_FC;
3612 ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
3613 ct.ct_cmd_resp = SNS_GFF_ID;
3614 ct.ct_bcnt_resid = (SNS_GFF_ID_RESP_SIZE - sizeof(ct)) / 4;
3615 isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
3616 rp = (uint32_t *) &scp[sizeof(ct)];
3617 ISP_IOZPUT_32(isp, portid, rp);
3618
3619 if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t),
3620 SNS_GFF_ID_RESP_SIZE)) {
3621 FC_SCRATCH_RELEASE(isp, chan);
3622 return (res);
3623 }
3624
3625 isp_get_gff_id_response(isp, (sns_gff_id_rsp_t *)scp, &rsp);
3626 if (rsp.snscb_cthdr.ct_cmd_resp == LS_ACC) {
3627 for (i = 0; i < 32; i++) {
3628 if (rsp.snscb_fc4_features[i] != 0) {
3629 res = 0;
3630 break;
3631 }
3632 }
3633 if (((rsp.snscb_fc4_features[FC4_SCSI / 8] >>
3634 ((FC4_SCSI % 8) * 4)) & 0x01) != 0)
3635 res = 1;
3636 /* Workaround for broken Brocade firmware. */
3637 if (((ISP_SWAP32(isp, rsp.snscb_fc4_features[FC4_SCSI / 8]) >>
3638 ((FC4_SCSI % 8) * 4)) & 0x01) != 0)
3639 res = 1;
3640 }
3641 FC_SCRATCH_RELEASE(isp, chan);
3642 isp_prt(isp, ISP_LOGDEBUG0, "Chan %d GFF_ID result is %d", chan, res);
3643 return (res);
3644}
3645
3646static int
3647isp_gft_id(ispsoftc_t *isp, int chan, uint32_t portid)
3648{
3649 fcparam *fcp = FCPARAM(isp, chan);
3650 ct_hdr_t ct;
3651 sns_gxx_id_req_t rq;
3652 uint32_t *rp;
3653 uint8_t *scp = fcp->isp_scratch;
3654 sns_gft_id_rsp_t rsp;
3655 int i, res = -1;
3656
3657 if (!fcp->isp_use_gft_id) /* User may block GFT_ID use. */
3658 return (res);
3659
3660 isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GFT_ID", chan);
3661 if (FC_SCRATCH_ACQUIRE(isp, chan)) {
3662 isp_prt(isp, ISP_LOGERR, sacq);
3663 return (res);
3664 }
3665
3666 if (IS_24XX(isp)) {
3667 /* Build the CT command and execute via pass-through. */
3668 ISP_MEMZERO(&ct, sizeof (ct));
3669 ct.ct_revision = CT_REVISION;
3670 ct.ct_fcs_type = CT_FC_TYPE_FC;
3671 ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS;
3672 ct.ct_cmd_resp = SNS_GFT_ID;
3673 ct.ct_bcnt_resid = (SNS_GFT_ID_RESP_SIZE - sizeof(ct)) / 4;
3674 isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp);
3675 rp = (uint32_t *) &scp[sizeof(ct)];
3676 ISP_IOZPUT_32(isp, portid, rp);
3677
3678 if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t),
3679 SNS_GFT_ID_RESP_SIZE)) {
3680 FC_SCRATCH_RELEASE(isp, chan);
3681 return (res);
3682 }
3683 } else {
3684 /* Build the SNS request and execute via firmware. */
3685 ISP_MEMZERO(&rq, SNS_GXX_ID_REQ_SIZE);
3686 rq.snscb_rblen = SNS_GFT_ID_RESP_SIZE >> 1;
3687 rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma);
3688 rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma);
3689 rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma);
3690 rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma);
3691 rq.snscb_sblen = 6;
3692 rq.snscb_cmd = SNS_GFT_ID;
3693 rq.snscb_mword_div_2 = (SNS_GFT_ID_RESP_SIZE - sizeof(ct)) / 4;
3694 rq.snscb_portid = portid;
3695 isp_put_gxx_id_request(isp, &rq, (sns_gxx_id_req_t *)scp);
3696
3697 if (isp_ct_sns(isp, chan, sizeof(rq), SNS_GFT_ID_RESP_SIZE)) {
3698 FC_SCRATCH_RELEASE(isp, chan);
3699 return (res);
3700 }
3701 }
3702
3703 isp_get_gft_id_response(isp, (sns_gft_id_rsp_t *)scp, &rsp);
3704 if (rsp.snscb_cthdr.ct_cmd_resp == LS_ACC) {
3705 for (i = 0; i < 8; i++) {
3706 if (rsp.snscb_fc4_types[i] != 0) {
3707 res = 0;
3708 break;
3709 }
3710 }
3711 if (((rsp.snscb_fc4_types[FC4_SCSI / 32] >>
3712 (FC4_SCSI % 32)) & 0x01) != 0)
3713 res = 1;
3714 }
3715 FC_SCRATCH_RELEASE(isp, chan);
3716 isp_prt(isp, ISP_LOGDEBUG0, "Chan %d GFT_ID result is %d", chan, res);
3717 return (res);
3718}
3719
3720static int
3581isp_scan_fabric(ispsoftc_t *isp, int chan)
3582{
3583 fcparam *fcp = FCPARAM(isp, chan);
3584 fcportdb_t *lp;
3585 uint32_t portid;
3586 uint16_t nphdl;
3587 isp_pdb_t pdb;
3588 int portidx, portlim, r;
3721isp_scan_fabric(ispsoftc_t *isp, int chan)
3722{
3723 fcparam *fcp = FCPARAM(isp, chan);
3724 fcportdb_t *lp;
3725 uint32_t portid;
3726 uint16_t nphdl;
3727 isp_pdb_t pdb;
3728 int portidx, portlim, r;
3589 sns_gid_ft_rsp_t *rs;
3729 sns_gid_xx_rsp_t *rs;
3590
3591 if (fcp->isp_loopstate < LOOP_LSCAN_DONE)
3592 return (-1);
3593 if (fcp->isp_loopstate >= LOOP_FSCAN_DONE)
3594 return (0);
3595
3596 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC fabric scan", chan);
3597 fcp->isp_loopstate = LOOP_SCANNING_FABRIC;

--- 24 unchanged lines hidden (view full) ---

3622 fcp->isp_loopstate = LOOP_LTEST_DONE;
3623fail:
3624 isp_prt(isp, ISP_LOG_SANCFG,
3625 "Chan %d FC fabric scan done (bad)", chan);
3626 return (-1);
3627 }
3628
3629 /* Get list of port IDs from SNS. */
3730
3731 if (fcp->isp_loopstate < LOOP_LSCAN_DONE)
3732 return (-1);
3733 if (fcp->isp_loopstate >= LOOP_FSCAN_DONE)
3734 return (0);
3735
3736 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC fabric scan", chan);
3737 fcp->isp_loopstate = LOOP_SCANNING_FABRIC;

--- 24 unchanged lines hidden (view full) ---

3762 fcp->isp_loopstate = LOOP_LTEST_DONE;
3763fail:
3764 isp_prt(isp, ISP_LOG_SANCFG,
3765 "Chan %d FC fabric scan done (bad)", chan);
3766 return (-1);
3767 }
3768
3769 /* Get list of port IDs from SNS. */
3630 r = isp_gid_ft(isp, chan);
3770 r = isp_gid_pt(isp, chan);
3631 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3632 goto abort;
3633 if (r > 0) {
3634 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3635 return (-1);
3636 } else if (r < 0) {
3637 fcp->isp_loopstate = LOOP_LTEST_DONE; /* try again */
3638 return (-1);
3639 }
3640
3771 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3772 goto abort;
3773 if (r > 0) {
3774 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3775 return (-1);
3776 } else if (r < 0) {
3777 fcp->isp_loopstate = LOOP_LTEST_DONE; /* try again */
3778 return (-1);
3779 }
3780
3641 rs = (sns_gid_ft_rsp_t *) fcp->isp_scanscratch;
3781 rs = (sns_gid_xx_rsp_t *) fcp->isp_scanscratch;
3642 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3643 goto abort;
3644 if (rs->snscb_cthdr.ct_cmd_resp != LS_ACC) {
3645 int level;
3782 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3783 goto abort;
3784 if (rs->snscb_cthdr.ct_cmd_resp != LS_ACC) {
3785 int level;
3646 if (rs->snscb_cthdr.ct_reason == 9 && rs->snscb_cthdr.ct_explanation == 7) {
3786 /* FC-4 Type and Port Type not registered are not errors. */
3787 if (rs->snscb_cthdr.ct_reason == 9 &&
3788 (rs->snscb_cthdr.ct_explanation == 0x07 ||
3789 rs->snscb_cthdr.ct_explanation == 0x0a)) {
3647 level = ISP_LOG_SANCFG;
3648 } else {
3649 level = ISP_LOGWARN;
3650 }
3790 level = ISP_LOG_SANCFG;
3791 } else {
3792 level = ISP_LOGWARN;
3793 }
3651 isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_FT"
3794 isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_PT"
3652 " (Reason=0x%x Expl=0x%x)", chan,
3653 rs->snscb_cthdr.ct_reason,
3654 rs->snscb_cthdr.ct_explanation);
3655 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3656 return (-1);
3657 }
3658
3659 /* Check our buffer was big enough to get the full list. */

--- 115 unchanged lines hidden (view full) ---

3775
3776relogin:
3777 if ((fcp->role & ISP_ROLE_INITIATOR) == 0) {
3778 isp_prt(isp, ISP_LOG_SANCFG,
3779 "Chan %d Port 0x%06x is not logged in", chan, portid);
3780 continue;
3781 }
3782
3795 " (Reason=0x%x Expl=0x%x)", chan,
3796 rs->snscb_cthdr.ct_reason,
3797 rs->snscb_cthdr.ct_explanation);
3798 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3799 return (-1);
3800 }
3801
3802 /* Check our buffer was big enough to get the full list. */

--- 115 unchanged lines hidden (view full) ---

3918
3919relogin:
3920 if ((fcp->role & ISP_ROLE_INITIATOR) == 0) {
3921 isp_prt(isp, ISP_LOG_SANCFG,
3922 "Chan %d Port 0x%06x is not logged in", chan, portid);
3923 continue;
3924 }
3925
3926 r = isp_gff_id(isp, chan, portid);
3927 if (r == 0) {
3928 isp_prt(isp, ISP_LOG_SANCFG,
3929 "Chan %d Port 0x%06x is not an FCP target", chan, portid);
3930 continue;
3931 }
3932 if (r < 0)
3933 r = isp_gft_id(isp, chan, portid);
3934 if (r == 0) {
3935 isp_prt(isp, ISP_LOG_SANCFG,
3936 "Chan %d Port 0x%06x is not FCP", chan, portid);
3937 continue;
3938 }
3939
3783 if (isp_login_device(isp, chan, portid, &pdb,
3784 &FCPARAM(isp, 0)->isp_lasthdl)) {
3785 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3786 goto abort;
3787 continue;
3788 }
3789
3790 isp_pdb_add_update(isp, chan, &pdb);

--- 4211 unchanged lines hidden ---
3940 if (isp_login_device(isp, chan, portid, &pdb,
3941 &FCPARAM(isp, 0)->isp_lasthdl)) {
3942 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3943 goto abort;
3944 continue;
3945 }
3946
3947 isp_pdb_add_update(isp, chan, &pdb);

--- 4211 unchanged lines hidden ---