emlxs_clock.c (a9800beb) | emlxs_clock.c (8f23e9fa) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. | 8 * You can obtain a copy of the license at 9 * http://www.opensource.org/licenses/cddl1.txt. |
10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* | 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* |
23 * Copyright 2011 Emulex. All rights reserved. | 23 * Copyright (c) 2004-2012 Emulex. All rights reserved. |
24 * Use is subject to license terms. 25 */ 26 | 24 * Use is subject to license terms. 25 */ 26 |
27 | |
28#include <emlxs.h> 29 30/* Timer period in seconds */ 31#define EMLXS_TIMER_PERIOD 1 /* secs */ 32#define EMLXS_PKT_PERIOD 5 /* secs */ 33#define EMLXS_UB_PERIOD 60 /* secs */ 34 35EMLXS_MSG_DEF(EMLXS_CLOCK_C); 36 37 38static void emlxs_timer_check_loopback(emlxs_hba_t *hba); 39 40#ifdef DHCHAP_SUPPORT 41static void emlxs_timer_check_dhchap(emlxs_port_t *port); 42#endif /* DHCHAP_SUPPORT */ 43 | 27#include <emlxs.h> 28 29/* Timer period in seconds */ 30#define EMLXS_TIMER_PERIOD 1 /* secs */ 31#define EMLXS_PKT_PERIOD 5 /* secs */ 32#define EMLXS_UB_PERIOD 60 /* secs */ 33 34EMLXS_MSG_DEF(EMLXS_CLOCK_C); 35 36 37static void emlxs_timer_check_loopback(emlxs_hba_t *hba); 38 39#ifdef DHCHAP_SUPPORT 40static void emlxs_timer_check_dhchap(emlxs_port_t *port); 41#endif /* DHCHAP_SUPPORT */ 42 |
43static void emlxs_timer_check_pools(emlxs_hba_t *hba); |
|
44static void emlxs_timer(void *arg); 45static void emlxs_timer_check_fw_update(emlxs_hba_t *hba); 46static void emlxs_timer_check_heartbeat(emlxs_hba_t *hba); 47static uint32_t emlxs_timer_check_pkts(emlxs_hba_t *hba, uint8_t *flag); 48static void emlxs_timer_check_nodes(emlxs_port_t *port, uint8_t *flag); 49static void emlxs_timer_check_linkup(emlxs_hba_t *hba); 50static void emlxs_timer_check_discovery(emlxs_port_t *port); | 44static void emlxs_timer(void *arg); 45static void emlxs_timer_check_fw_update(emlxs_hba_t *hba); 46static void emlxs_timer_check_heartbeat(emlxs_hba_t *hba); 47static uint32_t emlxs_timer_check_pkts(emlxs_hba_t *hba, uint8_t *flag); 48static void emlxs_timer_check_nodes(emlxs_port_t *port, uint8_t *flag); 49static void emlxs_timer_check_linkup(emlxs_hba_t *hba); 50static void emlxs_timer_check_discovery(emlxs_port_t *port); |
51static void emlxs_timer_check_clean_address(emlxs_port_t *port); |
|
51static void emlxs_timer_check_ub(emlxs_port_t *port); 52static void emlxs_timer_check_channels(emlxs_hba_t *hba, uint8_t *flag); 53static uint32_t emlxs_pkt_chip_timeout(emlxs_port_t *port, emlxs_buf_t *sbp, 54 Q *abortq, uint8_t *flag); 55 56#ifdef TX_WATCHDOG 57static void emlxs_tx_watchdog(emlxs_hba_t *hba); 58#endif /* TX_WATCHDOG */ --- 16 unchanged lines hidden (view full) --- 75 76} /* emlxs_timeout() */ 77 78 79static void 80emlxs_timer(void *arg) 81{ 82 emlxs_hba_t *hba = (emlxs_hba_t *)arg; | 52static void emlxs_timer_check_ub(emlxs_port_t *port); 53static void emlxs_timer_check_channels(emlxs_hba_t *hba, uint8_t *flag); 54static uint32_t emlxs_pkt_chip_timeout(emlxs_port_t *port, emlxs_buf_t *sbp, 55 Q *abortq, uint8_t *flag); 56 57#ifdef TX_WATCHDOG 58static void emlxs_tx_watchdog(emlxs_hba_t *hba); 59#endif /* TX_WATCHDOG */ --- 16 unchanged lines hidden (view full) --- 76 77} /* emlxs_timeout() */ 78 79 80static void 81emlxs_timer(void *arg) 82{ 83 emlxs_hba_t *hba = (emlxs_hba_t *)arg; |
84 emlxs_port_t *port = &PPORT; |
|
83 84 if (!hba->timer_id) { 85 return; 86 } 87 88 mutex_enter(&EMLXS_TIMER_LOCK); 89 90 /* Only one timer thread is allowed */ 91 if (hba->timer_flags & EMLXS_TIMER_BUSY) { 92 mutex_exit(&EMLXS_TIMER_LOCK); 93 return; 94 } 95 96 /* Check if a kill request has been made */ 97 if (hba->timer_flags & EMLXS_TIMER_KILL) { 98 hba->timer_id = 0; | 85 86 if (!hba->timer_id) { 87 return; 88 } 89 90 mutex_enter(&EMLXS_TIMER_LOCK); 91 92 /* Only one timer thread is allowed */ 93 if (hba->timer_flags & EMLXS_TIMER_BUSY) { 94 mutex_exit(&EMLXS_TIMER_LOCK); 95 return; 96 } 97 98 /* Check if a kill request has been made */ 99 if (hba->timer_flags & EMLXS_TIMER_KILL) { 100 hba->timer_id = 0; |
101 hba->timer_tics = 0; |
|
99 hba->timer_flags |= EMLXS_TIMER_ENDED; 100 101 mutex_exit(&EMLXS_TIMER_LOCK); 102 return; 103 } 104 105 hba->timer_flags |= (EMLXS_TIMER_BUSY | EMLXS_TIMER_STARTED); 106 hba->timer_tics = DRV_TIME; 107 | 102 hba->timer_flags |= EMLXS_TIMER_ENDED; 103 104 mutex_exit(&EMLXS_TIMER_LOCK); 105 return; 106 } 107 108 hba->timer_flags |= (EMLXS_TIMER_BUSY | EMLXS_TIMER_STARTED); 109 hba->timer_tics = DRV_TIME; 110 |
111 /* Check io_active count (Safety net) */ 112 if (hba->io_active & 0x80000000) { 113 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_debug_msg, 114 "Timer: io_active=0x%x. Reset to zero.", hba->io_active); 115 hba->io_active = 0; 116 } 117 |
|
108 mutex_exit(&EMLXS_TIMER_LOCK); 109 110 EMLXS_SLI_POLL_ERRATT(hba); 111 112 /* Perform standard checks */ 113 emlxs_timer_checks(hba); 114 115 /* Restart the timer */ --- 69 unchanged lines hidden (view full) --- 185 186 if (!(port->flag & EMLXS_PORT_BOUND)) { 187 continue; 188 } 189 190 /* Check for node gate timeouts */ 191 emlxs_timer_check_nodes(port, flag); 192 | 118 mutex_exit(&EMLXS_TIMER_LOCK); 119 120 EMLXS_SLI_POLL_ERRATT(hba); 121 122 /* Perform standard checks */ 123 emlxs_timer_checks(hba); 124 125 /* Restart the timer */ --- 69 unchanged lines hidden (view full) --- 195 196 if (!(port->flag & EMLXS_PORT_BOUND)) { 197 continue; 198 } 199 200 /* Check for node gate timeouts */ 201 emlxs_timer_check_nodes(port, flag); 202 |
203 /* Check for clean address bit delay timeout */ 204 emlxs_timer_check_clean_address(port); 205 |
|
193 /* Check for tape discovery timeout */ 194 emlxs_timer_check_discovery(port); 195 196 /* Check for UB timeouts */ 197 emlxs_timer_check_ub(port); 198 199#ifdef DHCHAP_SUPPORT 200 /* Check for DHCHAP authentication timeouts */ 201 emlxs_timer_check_dhchap(port); 202#endif /* DHCHAP_SUPPORT */ 203 204 } 205 | 206 /* Check for tape discovery timeout */ 207 emlxs_timer_check_discovery(port); 208 209 /* Check for UB timeouts */ 210 emlxs_timer_check_ub(port); 211 212#ifdef DHCHAP_SUPPORT 213 /* Check for DHCHAP authentication timeouts */ 214 emlxs_timer_check_dhchap(port); 215#endif /* DHCHAP_SUPPORT */ 216 217 } 218 |
219 /* Check memory pools */ 220 emlxs_timer_check_pools(hba); 221 |
|
206 /* Check for IO channel service timeouts */ 207 /* Always do this last */ 208 emlxs_timer_check_channels(hba, flag); 209 210 return; 211 212} /* emlxs_timer_checks() */ 213 --- 218 unchanged lines hidden (view full) --- 432 iocbq = (IOCBQ *)tmo.q_first; 433 while (iocbq) { 434 /* Free the IoTag and the bmp */ 435 iocb = &iocbq->iocb; 436 channelno = ((CHANNEL *)iocbq->channel)->channelno; 437 sbp = iocbq->sbp; 438 if (sbp && (sbp != STALE_PACKET)) { 439 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { | 222 /* Check for IO channel service timeouts */ 223 /* Always do this last */ 224 emlxs_timer_check_channels(hba, flag); 225 226 return; 227 228} /* emlxs_timer_checks() */ 229 --- 218 unchanged lines hidden (view full) --- 448 iocbq = (IOCBQ *)tmo.q_first; 449 while (iocbq) { 450 /* Free the IoTag and the bmp */ 451 iocb = &iocbq->iocb; 452 channelno = ((CHANNEL *)iocbq->channel)->channelno; 453 sbp = iocbq->sbp; 454 if (sbp && (sbp != STALE_PACKET)) { 455 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { |
440 emlxs_sli4_free_xri(hba, sbp, sbp->xrip, 1); | 456 emlxs_sli4_free_xri(port, sbp, sbp->xrip, 1); |
441 } else { 442 (void) emlxs_unregister_pkt( 443 (CHANNEL *)iocbq->channel, 444 iocb->ULPIOTAG, 0); 445 } 446 447 mutex_enter(&sbp->mtx); 448 sbp->pkt_flags |= PACKET_IN_TIMEOUT; --- 19 unchanged lines hidden (view full) --- 468 sbp = (emlxs_buf_t *)iocbq->sbp; 469 470 if (sbp) { 471 /* Warning: Some FCT sbp's don't have */ 472 /* fc_packet objects */ 473 pkt = PRIV2PKT(sbp); 474 475 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, | 457 } else { 458 (void) emlxs_unregister_pkt( 459 (CHANNEL *)iocbq->channel, 460 iocb->ULPIOTAG, 0); 461 } 462 463 mutex_enter(&sbp->mtx); 464 sbp->pkt_flags |= PACKET_IN_TIMEOUT; --- 19 unchanged lines hidden (view full) --- 484 sbp = (emlxs_buf_t *)iocbq->sbp; 485 486 if (sbp) { 487 /* Warning: Some FCT sbp's don't have */ 488 /* fc_packet objects */ 489 pkt = PRIV2PKT(sbp); 490 491 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, |
476 "TXQ abort: sbp=%p iotag=%x tmo=%d", sbp, | 492 "TXQ abort: sbp=%p iotag=%d tmo=%d", sbp, |
477 sbp->iotag, (pkt) ? pkt->pkt_timeout : 0); 478 479 if (hba->state >= FC_LINK_UP) { 480 emlxs_pkt_complete(sbp, IOSTAT_LOCAL_REJECT, 481 IOERR_ABORT_TIMEOUT, 1); 482 } else { 483 emlxs_pkt_complete(sbp, IOSTAT_LOCAL_REJECT, 484 IOERR_LINK_DOWN, 1); --- 11 unchanged lines hidden (view full) --- 496 bzero((void *)&abort, sizeof (Q)); 497 498 /* Check the HBA for outstanding IOs */ 499 rc = 0; 500 mutex_enter(&EMLXS_FCTAB_LOCK); 501 for (iotag = 1; iotag < hba->max_iotag; iotag++) { 502 sbp = hba->fc_table[iotag]; 503 | 493 sbp->iotag, (pkt) ? pkt->pkt_timeout : 0); 494 495 if (hba->state >= FC_LINK_UP) { 496 emlxs_pkt_complete(sbp, IOSTAT_LOCAL_REJECT, 497 IOERR_ABORT_TIMEOUT, 1); 498 } else { 499 emlxs_pkt_complete(sbp, IOSTAT_LOCAL_REJECT, 500 IOERR_LINK_DOWN, 1); --- 11 unchanged lines hidden (view full) --- 512 bzero((void *)&abort, sizeof (Q)); 513 514 /* Check the HBA for outstanding IOs */ 515 rc = 0; 516 mutex_enter(&EMLXS_FCTAB_LOCK); 517 for (iotag = 1; iotag < hba->max_iotag; iotag++) { 518 sbp = hba->fc_table[iotag]; 519 |
504 if (!sbp || (sbp == STALE_PACKET)) { | 520 if (!sbp || sbp == STALE_PACKET) { |
505 continue; 506 } 507 508 /* Check if IO is valid */ 509 if (!(sbp->pkt_flags & PACKET_VALID) || 510 (sbp->pkt_flags & (PACKET_ULP_OWNED| 511 PACKET_COMPLETED|PACKET_IN_COMPLETION))) { 512 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_debug_msg, | 521 continue; 522 } 523 524 /* Check if IO is valid */ 525 if (!(sbp->pkt_flags & PACKET_VALID) || 526 (sbp->pkt_flags & (PACKET_ULP_OWNED| 527 PACKET_COMPLETED|PACKET_IN_COMPLETION))) { 528 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_debug_msg, |
513 "timer_check_pkts: Invalid IO found. iotag=%x", | 529 "timer_check_pkts: Invalid IO found. iotag=%d", |
514 iotag); 515 516 hba->fc_table[iotag] = STALE_PACKET; 517 hba->io_count--; 518 continue; 519 } 520 521 if ((sbp->pkt_flags & PACKET_IN_CHIPQ) && --- 29 unchanged lines hidden (view full) --- 551 continue; 552 } 553 cp = &hba->chan[channelno]; 554 555 EMLXS_SLI_ISSUE_IOCB_CMD(hba, cp, 0); 556 } 557 558 if (rc == 1) { | 530 iotag); 531 532 hba->fc_table[iotag] = STALE_PACKET; 533 hba->io_count--; 534 continue; 535 } 536 537 if ((sbp->pkt_flags & PACKET_IN_CHIPQ) && --- 29 unchanged lines hidden (view full) --- 567 continue; 568 } 569 cp = &hba->chan[channelno]; 570 571 EMLXS_SLI_ISSUE_IOCB_CMD(hba, cp, 0); 572 } 573 574 if (rc == 1) { |
559 /* Spawn a thread to reset the link */ 560 emlxs_thread_spawn(hba, emlxs_reset_link_thread, NULL, NULL); | 575 mutex_enter(&EMLXS_PORT_LOCK); 576 /* If a link reset or port reset is already requested, exit */ 577 if (!(hba->reset_request & (FC_LINK_RESET | FC_PORT_RESET))) { 578 hba->reset_request |= FC_LINK_RESET; 579 mutex_exit(&EMLXS_PORT_LOCK); 580 /* Spawn a thread to reset the link */ 581 emlxs_thread_spawn(hba, emlxs_reset_link_thread, NULL, 582 NULL); 583 goto exit; 584 } 585 mutex_exit(&EMLXS_PORT_LOCK); |
561 } else if (rc == 2) { | 586 } else if (rc == 2) { |
562 /* Spawn a thread to reset the adapter */ 563 emlxs_thread_spawn(hba, emlxs_restart_thread, NULL, NULL); | 587 mutex_enter(&EMLXS_PORT_LOCK); 588 /* If a port reset is already requested, exit */ 589 if (!(hba->reset_request & FC_PORT_RESET)) { 590 hba->reset_request |= FC_PORT_RESET; 591 mutex_exit(&EMLXS_PORT_LOCK); 592 /* Spawn a thread to reset the adapter */ 593 emlxs_thread_spawn(hba, emlxs_restart_thread, NULL, 594 NULL); 595 goto exit; 596 } 597 mutex_exit(&EMLXS_PORT_LOCK); |
564 } 565 | 598 } 599 |
600exit: |
|
566 return (rc); 567 568} /* emlxs_timer_check_pkts() */ 569 570 571static void 572emlxs_timer_check_channels(emlxs_hba_t *hba, uint8_t *flag) 573{ --- 69 unchanged lines hidden (view full) --- 643 /* 644 * We need to lock, scan, and unlock because we can't hold the 645 * lock while we call node_open 646 */ 647 rw_enter(&port->node_rwlock, RW_READER); 648 for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) { 649 nlp = port->node_table[i]; 650 while (nlp != NULL) { | 601 return (rc); 602 603} /* emlxs_timer_check_pkts() */ 604 605 606static void 607emlxs_timer_check_channels(emlxs_hba_t *hba, uint8_t *flag) 608{ --- 69 unchanged lines hidden (view full) --- 678 /* 679 * We need to lock, scan, and unlock because we can't hold the 680 * lock while we call node_open 681 */ 682 rw_enter(&port->node_rwlock, RW_READER); 683 for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) { 684 nlp = port->node_table[i]; 685 while (nlp != NULL) { |
686#ifdef NODE_THROTTLE_SUPPORT 687 /* Check io_active count (Safety net) */ 688 if (nlp->io_active & 0x80000000) { 689 EMLXS_MSGF(EMLXS_CONTEXT, 690 &emlxs_sli_debug_msg, 691 "timer_check_nodes: did=%06x " 692 "io_active=0x%x. Reset to zero.", 693 nlp->nlp_DID, nlp->io_active); 694 695 nlp->io_active = 0; 696 } 697#endif /* NODE_THROTTLE_SUPPORT */ 698 |
|
651 for (channelno = 0; 652 channelno < hba->chan_count; 653 channelno++) { 654 /* Check if the node timer is active */ 655 /* and if timer has expired */ 656 if (nlp->nlp_tics[channelno] && 657 (hba->timer_tics >= 658 nlp->nlp_tics[channelno])) { --- 147 unchanged lines hidden (view full) --- 806 return; 807 } 808 809 /* Return if heartbeat is still outstanding */ 810 if (hba->heartbeat_active) { 811 return; 812 } 813 | 699 for (channelno = 0; 700 channelno < hba->chan_count; 701 channelno++) { 702 /* Check if the node timer is active */ 703 /* and if timer has expired */ 704 if (nlp->nlp_tics[channelno] && 705 (hba->timer_tics >= 706 nlp->nlp_tics[channelno])) { --- 147 unchanged lines hidden (view full) --- 854 return; 855 } 856 857 /* Return if heartbeat is still outstanding */ 858 if (hba->heartbeat_active) { 859 return; 860 } 861 |
814 if ((mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1)) == 0) { | 862 if ((mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX)) == 0) { |
815 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg, 816 "Unable to allocate heartbeat mailbox."); 817 return; 818 } 819 820 emlxs_mb_heartbeat(hba, mbq); 821 hba->heartbeat_active = 1; 822 --- 6 unchanged lines hidden (view full) --- 829 830} /* emlxs_timer_check_heartbeat() */ 831 832 833static void 834emlxs_timer_check_fw_update(emlxs_hba_t *hba) 835{ 836 emlxs_port_t *port = &PPORT; | 863 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg, 864 "Unable to allocate heartbeat mailbox."); 865 return; 866 } 867 868 emlxs_mb_heartbeat(hba, mbq); 869 hba->heartbeat_active = 1; 870 --- 6 unchanged lines hidden (view full) --- 877 878} /* emlxs_timer_check_heartbeat() */ 879 880 881static void 882emlxs_timer_check_fw_update(emlxs_hba_t *hba) 883{ 884 emlxs_port_t *port = &PPORT; |
885 char msgbuf[128]; |
|
837 838 if (!(hba->fw_flag & FW_UPDATE_NEEDED)) { 839 hba->fw_timer = 0; 840 return; 841 } 842 843 if (hba->timer_tics < hba->fw_timer) { 844 return; 845 } 846 | 886 887 if (!(hba->fw_flag & FW_UPDATE_NEEDED)) { 888 hba->fw_timer = 0; 889 return; 890 } 891 892 if (hba->timer_tics < hba->fw_timer) { 893 return; 894 } 895 |
847 if (hba->tgt_mode) { 848 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_update_msg, 849 "A manual HBA reset or link reset (using emlxadm) " 850 "is required."); | 896 if (port->mode == MODE_TARGET) { 897 (void) strncpy(msgbuf, 898 "To trigger an update, a manual HBA or link reset " 899 "using emlxadm is required.", 900 (sizeof (msgbuf)-1)); |
851 } else { | 901 } else { |
852 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_update_msg, 853 "A manual HBA reset or link reset (using luxadm or fcadm) " 854 "is required."); | 902 (void) strncpy(msgbuf, 903 "To trigger an update, a manual HBA or link reset " 904 "using luxadm, fcadm, or emlxadm is required.", 905 (sizeof (msgbuf)-1)); |
855 } 856 | 906 } 907 |
908 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_update_msg, msgbuf); 909 910 /* Force message to console */ 911 cmn_err(CE_WARN, 912 "^%s%d: Firmware update required.\n\t(%s)\n", 913 DRIVER_NAME, hba->ddiinst, msgbuf); 914 |
|
857 /* Set timer for 24 hours */ 858 hba->fw_timer = hba->timer_tics + (60 * 60 * 24); 859 860 return; 861 862} /* emlxs_timer_check_fw_update() */ 863 864 --- 48 unchanged lines hidden (view full) --- 913 } 914 915 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_missing_msg, 916 "FCP2 device (did=%06x) missing. Flushing...", 917 nlp->nlp_DID); 918 919 mutex_exit(&EMLXS_PORT_LOCK); 920 | 915 /* Set timer for 24 hours */ 916 hba->fw_timer = hba->timer_tics + (60 * 60 * 24); 917 918 return; 919 920} /* emlxs_timer_check_fw_update() */ 921 922 --- 48 unchanged lines hidden (view full) --- 971 } 972 973 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_missing_msg, 974 "FCP2 device (did=%06x) missing. Flushing...", 975 nlp->nlp_DID); 976 977 mutex_exit(&EMLXS_PORT_LOCK); 978 |
921 (void) emlxs_mb_unreg_node(port, nlp, NULL, NULL, NULL); | 979 (void) EMLXS_SLI_UNREG_NODE(port, nlp, NULL, NULL, NULL); |
922 923 mutex_enter(&EMLXS_PORT_LOCK); 924 925 } 926 mutex_exit(&EMLXS_PORT_LOCK); 927 928 /* Try to send clear link attention, if needed */ 929 if ((hba->sli_mode < EMLXS_HBA_SLI4_MODE) && (send_clear_la == 1) && | 980 981 mutex_enter(&EMLXS_PORT_LOCK); 982 983 } 984 mutex_exit(&EMLXS_PORT_LOCK); 985 986 /* Try to send clear link attention, if needed */ 987 if ((hba->sli_mode < EMLXS_HBA_SLI4_MODE) && (send_clear_la == 1) && |
930 (mbox = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) { | 988 (mbox = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) { |
931 mutex_enter(&EMLXS_PORT_LOCK); 932 933 /* 934 * If state is not FC_LINK_UP, then either the link has gone 935 * down or a FC_CLEAR_LA has already been issued 936 */ 937 if (hba->state != FC_LINK_UP) { 938 mutex_exit(&EMLXS_PORT_LOCK); --- 17 unchanged lines hidden (view full) --- 956 } 957 958 return; 959 960} /* emlxs_timer_check_discovery() */ 961 962 963static void | 989 mutex_enter(&EMLXS_PORT_LOCK); 990 991 /* 992 * If state is not FC_LINK_UP, then either the link has gone 993 * down or a FC_CLEAR_LA has already been issued 994 */ 995 if (hba->state != FC_LINK_UP) { 996 mutex_exit(&EMLXS_PORT_LOCK); --- 17 unchanged lines hidden (view full) --- 1014 } 1015 1016 return; 1017 1018} /* emlxs_timer_check_discovery() */ 1019 1020 1021static void |
1022emlxs_timer_check_clean_address(emlxs_port_t *port) 1023{ 1024 emlxs_hba_t *hba = HBA; 1025 emlxs_buf_t *sbp; 1026 1027 if (port->clean_address_timer && 1028 (hba->timer_tics < port->clean_address_timer)) { 1029 return; 1030 } 1031 port->clean_address_timer = 0; 1032 1033 sbp = port->clean_address_sbp; 1034 if (!sbp) { 1035 return; 1036 } 1037 port->clean_address_sbp = 0; 1038 1039 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_els_completion_msg, 1040 "Clean Address timeout: sid=%x prev=%x RATOV %d", 1041 port->did, port->prev_did, hba->fc_ratov); 1042 1043 if (EMLXS_SLI_REG_DID(port, FABRIC_DID, &port->fabric_sparam, 1044 sbp, NULL, NULL) == 0) { 1045 /* Deferred completion of this pkt until */ 1046 /* login is complete */ 1047 return; 1048 } 1049 1050 emlxs_pkt_complete(sbp, IOSTAT_LOCAL_REJECT, 1051 IOERR_NO_RESOURCES, 1); 1052 1053 return; 1054 1055} /* emlxs_timer_check_clean_address() */ 1056 1057extern void 1058emlxs_timer_cancel_clean_address(emlxs_port_t *port) 1059{ 1060 emlxs_hba_t *hba = HBA; 1061 emlxs_buf_t *sbp; 1062 1063 port->clean_address_timer = 0; 1064 sbp = port->clean_address_sbp; 1065 if (!sbp) { 1066 return; 1067 } 1068 port->clean_address_sbp = 0; 1069 1070 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_els_completion_msg, 1071 "Clean Address cancel: sid=%x prev=%x RATOV %d", 1072 port->did, port->prev_did, hba->fc_ratov); 1073 1074 emlxs_pkt_complete(sbp, IOSTAT_LOCAL_REJECT, 1075 IOERR_LINK_DOWN, 1); 1076 1077} /* emlxs_timer_cancel_clean_address() */ 1078 1079static void |
|
964emlxs_timer_check_ub(emlxs_port_t *port) 965{ 966 emlxs_hba_t *hba = HBA; 967 emlxs_unsol_buf_t *ulistp; 968 fc_unsol_buf_t *ubp; 969 emlxs_ub_priv_t *ub_priv; 970 uint32_t i; 971 --- 77 unchanged lines hidden (view full) --- 1049 pkt = PRIV2PKT(sbp); 1050 1051 switch (sbp->abort_attempts) { 1052 case 0: 1053 1054 /* Create the abort IOCB */ 1055 if (hba->state >= FC_LINK_UP) { 1056 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, | 1080emlxs_timer_check_ub(emlxs_port_t *port) 1081{ 1082 emlxs_hba_t *hba = HBA; 1083 emlxs_unsol_buf_t *ulistp; 1084 fc_unsol_buf_t *ubp; 1085 emlxs_ub_priv_t *ub_priv; 1086 uint32_t i; 1087 --- 77 unchanged lines hidden (view full) --- 1165 pkt = PRIV2PKT(sbp); 1166 1167 switch (sbp->abort_attempts) { 1168 case 0: 1169 1170 /* Create the abort IOCB */ 1171 if (hba->state >= FC_LINK_UP) { 1172 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, |
1057 "chipQ: 1:Aborting. sbp=%p iotag=%x tmo=%d " | 1173 "chipQ: 1:Aborting. sbp=%p iotag=%d tmo=%d " |
1058 "flags=%x", 1059 sbp, sbp->iotag, 1060 (pkt) ? pkt->pkt_timeout : 0, sbp->pkt_flags); 1061 1062 iocbq = 1063 emlxs_create_abort_xri_cn(port, sbp->node, 1064 sbp->iotag, cp, sbp->class, ABORT_TYPE_ABTS); 1065 1066 /* The adapter will make 2 attempts to send ABTS */ 1067 /* with 2*ratov timeout each time */ 1068 sbp->ticks = 1069 hba->timer_tics + (4 * hba->fc_ratov) + 10; 1070 } else { 1071 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, | 1174 "flags=%x", 1175 sbp, sbp->iotag, 1176 (pkt) ? pkt->pkt_timeout : 0, sbp->pkt_flags); 1177 1178 iocbq = 1179 emlxs_create_abort_xri_cn(port, sbp->node, 1180 sbp->iotag, cp, sbp->class, ABORT_TYPE_ABTS); 1181 1182 /* The adapter will make 2 attempts to send ABTS */ 1183 /* with 2*ratov timeout each time */ 1184 sbp->ticks = 1185 hba->timer_tics + (4 * hba->fc_ratov) + 10; 1186 } else { 1187 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, |
1072 "chipQ: 1:Closing. sbp=%p iotag=%x tmo=%d " | 1188 "chipQ: 1:Closing. sbp=%p iotag=%d tmo=%d " |
1073 "flags=%x", 1074 sbp, sbp->iotag, 1075 (pkt) ? pkt->pkt_timeout : 0, sbp->pkt_flags); 1076 1077 iocbq = 1078 emlxs_create_close_xri_cn(port, sbp->node, 1079 sbp->iotag, cp); 1080 --- 6 unchanged lines hidden (view full) --- 1087 flag[cp->channelno] = 1; 1088 rc = 0; 1089 1090 break; 1091 1092 case 1: 1093 1094 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, | 1189 "flags=%x", 1190 sbp, sbp->iotag, 1191 (pkt) ? pkt->pkt_timeout : 0, sbp->pkt_flags); 1192 1193 iocbq = 1194 emlxs_create_close_xri_cn(port, sbp->node, 1195 sbp->iotag, cp); 1196 --- 6 unchanged lines hidden (view full) --- 1203 flag[cp->channelno] = 1; 1204 rc = 0; 1205 1206 break; 1207 1208 case 1: 1209 1210 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, |
1095 "chipQ: 2:Closing. sbp=%p iotag=%x", sbp, sbp->iotag); | 1211 "chipQ: 2:Closing. sbp=%p iotag=%d", sbp, sbp->iotag); |
1096 1097 iocbq = 1098 emlxs_create_close_xri_cn(port, sbp->node, sbp->iotag, 1099 cp); 1100 1101 sbp->ticks = hba->timer_tics + 30; 1102 1103 flag[cp->channelno] = 1; 1104 rc = 0; 1105 1106 break; 1107 1108 case 2: 1109 1110 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, | 1212 1213 iocbq = 1214 emlxs_create_close_xri_cn(port, sbp->node, sbp->iotag, 1215 cp); 1216 1217 sbp->ticks = hba->timer_tics + 30; 1218 1219 flag[cp->channelno] = 1; 1220 rc = 0; 1221 1222 break; 1223 1224 case 2: 1225 1226 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, |
1111 "chipQ: 3:Resetting link. sbp=%p iotag=%x", sbp, | 1227 "chipQ: 3:Resetting link. sbp=%p iotag=%d", sbp, |
1112 sbp->iotag); 1113 1114 sbp->ticks = hba->timer_tics + 60; 1115 rc = 1; 1116 1117 break; 1118 1119 default: 1120 1121 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, | 1228 sbp->iotag); 1229 1230 sbp->ticks = hba->timer_tics + 60; 1231 rc = 1; 1232 1233 break; 1234 1235 default: 1236 1237 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg, |
1122 "chipQ: %d:Resetting adapter. sbp=%p iotag=%x", | 1238 "chipQ: %d:Resetting adapter. sbp=%p iotag=%d", |
1123 sbp->abort_attempts, sbp, sbp->iotag); 1124 1125 sbp->ticks = hba->timer_tics + 60; 1126 rc = 2; 1127 1128 break; 1129 } 1130 --- 13 unchanged lines hidden (view full) --- 1144 iocbq->next = NULL; 1145 } 1146 1147 return (rc); 1148 1149} /* emlxs_pkt_chip_timeout() */ 1150 1151 | 1239 sbp->abort_attempts, sbp, sbp->iotag); 1240 1241 sbp->ticks = hba->timer_tics + 60; 1242 rc = 2; 1243 1244 break; 1245 } 1246 --- 13 unchanged lines hidden (view full) --- 1260 iocbq->next = NULL; 1261 } 1262 1263 return (rc); 1264 1265} /* emlxs_pkt_chip_timeout() */ 1266 1267 |
1268static void 1269emlxs_timer_check_pools(emlxs_hba_t *hba) 1270{ 1271 uint32_t i; 1272 MEMSEG *seg; 1273 emlxs_config_t *cfg = &CFG; 1274 1275 if (cfg[CFG_MEM_DYNAMIC].current == 0) { 1276 return; 1277 } 1278 1279 if (hba->mem_timer > hba->timer_tics) { 1280 return; 1281 } 1282 1283 hba->mem_timer = hba->timer_tics + cfg[CFG_MEM_DYNAMIC].current; 1284 1285 seg = hba->memseg; 1286 for (i = 0; i < FC_MAX_SEG; i++, seg++) { 1287 if (seg->fc_memflag & FC_MEMSEG_DYNAMIC) { 1288 emlxs_mem_pool_clean(hba, seg); 1289 } 1290 } 1291 1292#ifdef SFCT_SUPPORT 1293{ 1294 uint32_t j; 1295 emlxs_port_t *port; 1296 1297 for (i = 0; i < MAX_VPORTS; i++) { 1298 port = &VPORT(i); 1299 1300 if (!(port->flag & EMLXS_PORT_BOUND) || 1301 !(port->flag & EMLXS_TGT_ENABLED) || 1302 !port->fct_memseg) { 1303 continue; 1304 } 1305 1306 seg = port->fct_memseg; 1307 for (j = 0; j < port->fct_memseg_cnt; j++, seg++) { 1308 if (seg->fc_memflag & FC_MEMSEG_DYNAMIC) { 1309 emlxs_mem_pool_clean(hba, seg); 1310 } 1311 } 1312 } 1313} 1314#endif /* SFCT_SUPPORT */ 1315 1316 return; 1317 1318} /* emlxs_timer_check_pools() */ 1319 1320 |
|
1152#ifdef TX_WATCHDOG 1153 1154static void 1155emlxs_tx_watchdog(emlxs_hba_t *hba) 1156{ 1157 emlxs_port_t *port = &PPORT; 1158 NODELIST *nlp; 1159 uint32_t channelno; --- 143 unchanged lines hidden --- | 1321#ifdef TX_WATCHDOG 1322 1323static void 1324emlxs_tx_watchdog(emlxs_hba_t *hba) 1325{ 1326 emlxs_port_t *port = &PPORT; 1327 NODELIST *nlp; 1328 uint32_t channelno; --- 143 unchanged lines hidden --- |