fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * You can obtain a copy of the license at
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * http://www.opensource.org/licenses/cddl1.txt.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * Copyright (c) 2004-2012 Emulex. All rights reserved.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Timer period in seconds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void emlxs_timer_check_loopback(emlxs_hba_t *hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void emlxs_timer_check_dhchap(emlxs_port_t *port);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* DHCHAP_SUPPORT */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeldstatic void emlxs_timer_check_pools(emlxs_hba_t *hba);
6a573d82e26abdedeb701fcdd5b5461b2fa0da40Sukumar Swaminathanstatic void emlxs_timer_check_fw_update(emlxs_hba_t *hba);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic void emlxs_timer_check_heartbeat(emlxs_hba_t *hba);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic uint32_t emlxs_timer_check_pkts(emlxs_hba_t *hba, uint8_t *flag);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic void emlxs_timer_check_nodes(emlxs_port_t *port, uint8_t *flag);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic void emlxs_timer_check_linkup(emlxs_hba_t *hba);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic void emlxs_timer_check_discovery(emlxs_port_t *port);
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeldstatic void emlxs_timer_check_clean_address(emlxs_port_t *port);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic void emlxs_timer_check_ub(emlxs_port_t *port);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanstatic void emlxs_timer_check_channels(emlxs_hba_t *hba, uint8_t *flag);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic uint32_t emlxs_pkt_chip_timeout(emlxs_port_t *port, emlxs_buf_t *sbp,
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanstatic void emlxs_tx_watchdog(emlxs_hba_t *hba);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* TX_WATCHDOG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set thread timeout */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timeout() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Only one timer thread is allowed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check if a kill request has been made */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hba->timer_flags |= (EMLXS_TIMER_BUSY | EMLXS_TIMER_STARTED);
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Check io_active count (Safety net) */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_debug_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "Timer: io_active=0x%x. Reset to zero.", hba->io_active);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* Perform standard checks */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* Restart the timer */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* If timer is still enabled, restart it */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan if (!(hba->timer_flags & EMLXS_TIMER_KILL)) {
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (EMLXS_TIMER_PERIOD * drv_usectohz(1000000)));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Exit if we are still initializing */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check SLI level timeouts */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check event queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check heartbeat timer */
6a573d82e26abdedeb701fcdd5b5461b2fa0da40Sukumar Swaminathan /* Check fw update timer */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* IDLE_TIMER */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for loopback timeouts */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for packet timeouts */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Link or adapter is being reset */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for linkup timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check the ports */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < MAX_VPORTS; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for node gate timeouts */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Check for clean address bit delay timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for tape discovery timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for UB timeouts */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for DHCHAP authentication timeouts */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* DHCHAP_SUPPORT */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Check memory pools */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check for IO channel service timeouts */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Always do this last */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_checks() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Restart the timer */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan timeout(emlxs_timer, (void *)hba, drv_usectohz(1000000));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_start() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_stop() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteemlxs_timer_check_pkts(emlxs_hba_t *hba, uint8_t *flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hba->pkt_timer = hba->timer_tics + EMLXS_PKT_PERIOD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We must hold the locks here because we never know when an iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * will be removed out from under us
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (channelno = 0; channelno < hba->chan_count; channelno++) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Scan the tx queues for each active node on the channel */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the first node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Scan the node's priority tx queue */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan iocbq = (IOCBQ *)nlp->nlp_ptx[channelno].q_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check if iocb has timed out */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* iocb timed out, now deque it */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* Add this iocb to our local */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* timout queue */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * This way we don't hold the TX_CHANNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lock too long
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* while (iocbq) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Scan the node's tx queue */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan iocbq = (IOCBQ *)nlp->nlp_tx[channelno].q_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check if iocb has timed out */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* iocb timed out, now deque it */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* Add this iocb to our local */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* timout queue */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * This way we don't hold the TX_CHANNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lock too long
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* while (iocbq) */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (nlp == (NODELIST *)cp->nodeq.q_last) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan } /* while (nlp) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end of for */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now cleanup the iocb's */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Free the IoTag and the bmp */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan channelno = ((CHANNEL *)iocbq->channel)->channelno;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld emlxs_sli4_free_xri(port, sbp, sbp->xrip, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end of while */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now complete the transmit timeouts outside the locks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Save the next iocbq for now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Unlink this iocbq */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the pkt */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* Warning: Some FCT sbp's don't have */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* fc_packet objects */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end of while */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now check the chip */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check the HBA for outstanding IOs */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (iotag = 1; iotag < hba->max_iotag; iotag++) {
a9800beb32c1006bb21c8da39e0180ea440b7badGarrett D'Amore /* Check if IO is valid */
a9800beb32c1006bb21c8da39e0180ea440b7badGarrett D'Amore EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_debug_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "timer_check_pkts: Invalid IO found. iotag=%d",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = emlxs_pkt_chip_timeout(sbp->iocbq.port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now put the iocb's on the tx queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Save the next iocbq for now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Unlink this iocbq */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Send this iocbq */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Now trigger IO channel service to send these abort iocbq */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (channelno = 0; channelno < hba->chan_count; channelno++) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* If a link reset or port reset is already requested, exit */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld if (!(hba->reset_request & (FC_LINK_RESET | FC_PORT_RESET))) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Spawn a thread to reset the link */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld emlxs_thread_spawn(hba, emlxs_reset_link_thread, NULL,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* If a port reset is already requested, exit */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Spawn a thread to reset the adapter */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld emlxs_thread_spawn(hba, emlxs_restart_thread, NULL,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_pkts() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_timer_check_channels(emlxs_hba_t *hba, uint8_t *flag)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (channelno = 0; channelno < hba->chan_count; channelno++) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check for channel timeout now */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (cp->timeout && (hba->timer_tics >= cp->timeout)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check if there is work to do on channel and */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the link is still up */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "IO Channel %d cnt=%d,%d",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * If IO channel flag is set, request iocb servicing
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * here to send any iocb's that may still be queued
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_channels() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteemlxs_timer_check_nodes(emlxs_port_t *port, uint8_t *flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check node gate flag for expiration */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * We need to lock, scan, and unlock because we can't hold the
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * lock while we call node_open
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Check io_active count (Safety net) */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "timer_check_nodes: did=%06x "
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "io_active=0x%x. Reset to zero.",
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld#endif /* NODE_THROTTLE_SUPPORT */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* Check if the node timer is active */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* and if timer has expired */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* If so, set the flag and */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* break out */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (hba->timer_tics >= nlp->nlp_force_rscn)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Generate an RSCN to
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_timeout(port, nlp, channelno);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_nodes() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check the loopback timer for expiration */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan if (!hba->loopback_tics || (hba->timer_tics < hba->loopback_tics)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "LOOPBACK_MODE: Expired. Resetting...");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_loopback() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check if all mbox commands from previous activity are processed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->model_info.sli_mask & EMLXS_SLI4_MASK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check the linkup timer for expiration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hba->linkup_timer && (hba->timer_tics >= hba->linkup_timer)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure link is still ready */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make the linkup callback */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_linkup() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return if adapter interrupts have occurred */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* No adapter interrupts have occured for 5 seconds now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return if mailbox is busy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This means the mailbox timer routine is watching for problems */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return if heartbeat is still outstanding */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld if ((mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Unable to allocate heartbeat mailbox.");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_heartbeat() */
6a573d82e26abdedeb701fcdd5b5461b2fa0da40Sukumar Swaminathanemlxs_timer_check_fw_update(emlxs_hba_t *hba)
6a573d82e26abdedeb701fcdd5b5461b2fa0da40Sukumar Swaminathan if (!(hba->fw_flag & FW_UPDATE_NEEDED)) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "To trigger an update, a manual HBA or link reset "
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "using emlxadm is required.",
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "To trigger an update, a manual HBA or link reset "
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "using luxadm, fcadm, or emlxadm is required.",
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_update_msg, msgbuf);
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Force message to console */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "^%s%d: Firmware update required.\n\t(%s)\n",
6a573d82e26abdedeb701fcdd5b5461b2fa0da40Sukumar Swaminathan /* Set timer for 24 hours */
6a573d82e26abdedeb701fcdd5b5461b2fa0da40Sukumar Swaminathan hba->fw_timer = hba->timer_tics + (60 * 60 * 24);
6a573d82e26abdedeb701fcdd5b5461b2fa0da40Sukumar Swaminathan} /* emlxs_timer_check_fw_update() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check the discovery timer for expiration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Perform a flush on fcp2 nodes that are still closed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_missing_msg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "FCP2 device (did=%06x) missing. Flushing...",
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld (void) EMLXS_SLI_UNREG_NODE(port, nlp, NULL, NULL, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Try to send clear link attention, if needed */
fe199829b492e6b3aa36dd76af597360bb4af121Sukumar Swaminathan if ((hba->sli_mode < EMLXS_HBA_SLI4_MODE) && (send_clear_la == 1) &&
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld (mbox = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If state is not FC_LINK_UP, then either the link has gone
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * down or a FC_CLEAR_LA has already been issued
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Change state and clear discovery timer */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_STATE_CHANGE_LOCKED(hba, FC_CLEAR_LA);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Prepare and send the CLEAR_LA command */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbox, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_discovery() */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeldemlxs_timer_check_clean_address(emlxs_port_t *port)
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld (hba->timer_tics < port->clean_address_timer)) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_els_completion_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "Clean Address timeout: sid=%x prev=%x RATOV %d",
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld if (EMLXS_SLI_REG_DID(port, FABRIC_DID, &port->fabric_sparam,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Deferred completion of this pkt until */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* login is complete */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld} /* emlxs_timer_check_clean_address() */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeldemlxs_timer_cancel_clean_address(emlxs_port_t *port)
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_els_completion_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "Clean Address cancel: sid=%x prev=%x RATOV %d",
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld} /* emlxs_timer_cancel_clean_address() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port->ub_timer = hba->timer_tics + EMLXS_UB_PERIOD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check the unsolicited buffers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check buffers in this pool */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* If buffer has timed out, print message and */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* increase timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Stale UB buffer detected (%d mins): "
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan "buffer=%p (%x,%x,%x,%x)",
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan ubp->ub_frame.ox_id, ubp->ub_frame.rx_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Increase timeout period */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* If timeout was 5 mins or less, */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* increase it to 10 mins */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* If timeout was 10 mins or less, */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* increase it to 30 mins */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Otherwise double it. */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_ub() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* EMLXS_FCTAB_LOCK must be held to call this */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathanemlxs_pkt_chip_timeout(emlxs_port_t *port, emlxs_buf_t *sbp, Q *abortq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Warning: Some FCT sbp's don't have fc_packet objects */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Create the abort IOCB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "chipQ: 1:Aborting. sbp=%p iotag=%d tmo=%d "
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (pkt) ? pkt->pkt_timeout : 0, sbp->pkt_flags);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan emlxs_create_abort_xri_cn(port, sbp->node,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sbp->iotag, cp, sbp->class, ABORT_TYPE_ABTS);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* The adapter will make 2 attempts to send ABTS */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* with 2*ratov timeout each time */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan hba->timer_tics + (4 * hba->fc_ratov) + 10;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "chipQ: 1:Closing. sbp=%p iotag=%d tmo=%d "
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (pkt) ? pkt->pkt_timeout : 0, sbp->pkt_flags);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan emlxs_create_close_xri_cn(port, sbp->node,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set the flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sbp->pkt_flags |= (PACKET_IN_TIMEOUT | PACKET_XRI_CLOSED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "chipQ: 2:Closing. sbp=%p iotag=%d", sbp, sbp->iotag);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan emlxs_create_close_xri_cn(port, sbp->node, sbp->iotag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "chipQ: 3:Resetting link. sbp=%p iotag=%d", sbp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_pkt_timeout_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "chipQ: %d:Resetting adapter. sbp=%p iotag=%d",
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan ((IOCBQ *)abortq->q_last)->next = iocbq;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_pkt_chip_timeout() */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld hba->mem_timer = hba->timer_tics + cfg[CFG_MEM_DYNAMIC].current;
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld for (i = 0; i < MAX_VPORTS; i++) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld for (j = 0; j < port->fct_memseg_cnt; j++, seg++) {
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld#endif /* SFCT_SUPPORT */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld} /* emlxs_timer_check_pools() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (iotag = 1; iotag < hba->max_iotag; iotag++) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan channelno = (CHANNEL *)(sbp->channel)->channelno;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Find a matching entry */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan did = LE_SWAP24_LO(pkt->pkt_cmd_fhdr.d_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end of while */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_tx_watchdog() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* TX_WATCHDOG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check authentication response timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (hba->timer_tics >= ndlp->node_dhc.nlp_authrsp_tmo)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Trigger authresp timeout handler */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_dhc_authrsp_timeout(port, ndlp, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check reauthentication timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (hba->timer_tics >= ndlp->node_dhc.nlp_reauth_tmo)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Trigger reauth timeout handler */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_timer_check_dhchap */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* DHCHAP_SUPPORT */