emlxs_clock.c revision 728bdc9be5faf84b5dca42f545967bd4910d608e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Emulex. All rights reserved.
* Use is subject to License terms.
*/
#include "emlxs.h"
/* Timer period in seconds */
#ifdef DFC_SUPPORT
#endif /* DFC_SUPPORT */
#ifdef DHCHAP_SUPPORT
#endif /* DHCHAP_SUPPORT */
static void emlxs_timer(void *arg);
#ifdef TX_WATCHDOG
#endif /* TX_WATCHDOG */
extern clock_t
{
/* Set thread timeout */
} else {
time = -1;
}
return (time);
} /* emlxs_timeout() */
static void
emlxs_timer(void *arg)
{
uint32_t i;
return;
}
/* Only one timer thread is allowed */
return;
}
/* Check if a kill request has been made */
return;
}
/* Exit if we are still initializing */
goto done;
}
/* Check for mailbox timeout */
/* Check heartbeat timer */
#ifdef IDLE_TIMER
#endif /* IDLE_TIMER */
#ifdef DFC_SUPPORT
/* Check for loopback timeouts */
#endif /* DFC_SUPPORT */
/* Check for packet timeouts */
if (rc) {
/* Link or adapter is being reset */
goto done;
}
/* Check for linkup timeout */
/* Check the ports */
for (i = 0; i < MAX_VPORTS; i++) {
continue;
}
/* Check for node gate timeouts */
/* Check for tape discovery timeout */
/* Check for UB timeouts */
#ifdef DHCHAP_SUPPORT
/* Check for DHCHAP authentication timeouts */
#endif /* DHCHAP_SUPPORT */
}
/* Check for ring service timeouts */
/* Always do this last */
done:
/* Restart the timer */
/* If timer is still enabled, restart it */
} else {
}
return;
} /* emlxs_timer() */
extern void
{
return;
}
/* Restart the timer */
hba->timer_flags = 0;
drv_usectohz(1000000));
}
} /* emlxs_timer_start() */
extern void
{
return;
}
}
return;
} /* emlxs_timer_stop() */
static uint32_t
{
/* emlxs_port_t *vport; */
Q tmo;
Q abort;
return (0);
}
return (0);
}
/*
* We must hold the locks here because we never know when an iocb
* will be removed out from under us
*/
/* Scan the tx queues for each active node on the ring */
/* Get the first node */
while (nlp) {
/* Scan the node's priority tx queue */
while (iocbq) {
/* Check if iocb has timed out */
/* iocb timed out, now deque it */
}
} else {
}
/*
* Add this iocb to our local timout
* Q
*/
/*
* This way we don't hold the RINGTX
* lock too long
*/
} else {
}
} else {
}
} /* while (iocbq) */
/* Scan the node's tx queue */
while (iocbq) {
/* Check if iocb has timed out */
/* iocb timed out, now deque it */
}
} else {
}
/*
* Add this iocb to our local timout
* Q
*/
/*
* This way we don't hold the RINGTX
* lock too long
*/
/*
* EMLXS_MSGF(EMLXS_CONTEXT,
* &emlxs_pkt_timeout_msg, "TXQ
* abort: Removing iotag=%x qcnt=%d
* pqcnt=%d", sbp->iotag,
* nlp->nlp_tx[ringno].q_cnt,
* nlp->nlp_ptx[ringno].q_cnt);
*/
} else {
}
} else {
}
} /* while (iocbq) */
} else {
}
} /* while(nlp) */
} /* end of for */
/* Now cleanup the iocb's */
while (iocbq) {
/* Free the IoTag and the bmp */
}
}
} /* end of while */
/* Now complete the transmit timeouts outside the locks */
while (iocbq) {
/* Save the next iocbq for now */
/* Unlink this iocbq */
/* Get the pkt */
if (sbp) {
/*
* Warning: Some FCT sbp's don't have fc_packet
* objects
*/
"TXQ abort: sbp=%p iotag=%x tmo=%d", sbp,
IOERR_ABORT_TIMEOUT, 1);
} else {
IOERR_LINK_DOWN, 1);
}
}
} /* end of while */
/* Now check the chip */
/* Check the rings */
rc = 0;
if (rc) {
break;
}
}
}
if (rc) {
break;
}
}
/* Now put the iocb's on the tx queue */
while (iocbq) {
/* Save the next iocbq for now */
/* Unlink this iocbq */
/* Send this iocbq */
}
if (rc == 1) {
/* Spawn a thread to reset the link */
} else if (rc == 2) {
/* Spawn a thread to reset the adapter */
}
return (rc);
} /* emlxs_timer_check_pkts() */
static void
{
return;
}
/* Check for ring timeout now */
/* Check if there is still work to do on the ring and */
/* the link is still up */
logit = 1;
}
} else {
}
}
if (logit) {
"%s host=%d port=%d cnt=%d,%d",
}
/*
* If ring flag is set, request iocb servicing here to send
* any iocb's that may still be queued
*/
}
}
return;
} /* emlxs_timer_check_rings() */
static void
{
uint32_t i;
for (;;) {
/* Check node gate flag for expiration */
found = 0;
/*
* We need to lock, scan, and unlock because we can't hold
* the lock while we call node_open
*/
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
for (ringno = 0;
ringno++) {
/*
* Check if the node timer is active
* and if timer has expired
*/
NLP_TIMER) &&
(hba->timer_tics >=
/*
* If so, set the flag and
* break out
*/
found = 1;
break;
}
}
if (found) {
break;
}
}
if (found) {
break;
}
}
if (!found) {
break;
}
}
} /* emlxs_timer_check_nodes() */
#ifdef DFC_SUPPORT
static void
{
return;
}
/* Check the loopback timer for expiration */
if (!hba->loopback_tics ||
return;
}
hba->loopback_tics = 0;
reset = 1;
}
if (reset) {
"LOOPBACK_MODE: Expired. Resetting...");
}
return;
} /* emlxs_timer_check_loopback() */
#endif /* DFC_SUPPORT */
static void
{
/* Check the linkup timer for expiration */
linkup = 0;
hba->linkup_timer = 0;
/* Make sure link is still ready */
linkup = 1;
}
}
/* Make the linkup callback */
if (linkup) {
}
return;
} /* emlxs_timer_check_linkup() */
static void
{
return;
}
return;
}
/* Return if adapter interrupts have occurred */
if (hba->heartbeat_flag) {
hba->heartbeat_flag = 0;
return;
}
/* No adapter interrupts have occured for 5 seconds now */
/* Return if mailbox is busy */
/* This means the mailbox timer routine is watching for problems */
if (hba->mbox_timer) {
return;
}
/* Return if heartbeat is still outstanding */
if (hba->heartbeat_active) {
return;
}
"Unable to allocate heartbeat mailbox.");
return;
}
}
return;
} /* emlxs_timer_check_heartbeat() */
static void
{
return;
}
/* Return if timer hasn't expired */
return;
}
hba->mbox_timer = 0;
/* Mailbox timed out, first check for error attention */
return;
}
if (hba->mbox_queue_flag) {
/* Get first word of mailbox */
} else {
}
/* Check if mailbox has actually completed */
/*
* Read host attention register to determine
* interrupt source
*/
"Mailbox attention missed: %s."
"Forcing event. hc = %x ha = %x",
(void) emlxs_handle_mb_event(hba);
return;
}
}
}
switch (hba->mbox_queue_flag) {
case MBX_NOWAIT:
"Mailbox Timeout: %s: Nowait.",
break;
case MBX_SLEEP:
"Mailbox Timeout: %s: mb=%p Sleep.",
break;
case MBX_POLL:
"Mailbox Timeout: %s: mb=%p Polled.",
break;
default:
"Mailbox Timeout.");
break;
}
/* Perform mailbox cleanup */
/* This will wake any sleeping or polling threads */
/* Trigger adapter shutdown */
return;
} /* emlxs_timer_check_mbox() */
static void
{
uint32_t i;
return;
}
/* Check the discovery timer for expiration */
send_clear_la = 0;
while (hba->discovery_timer &&
send_clear_la = 1;
/* Perform a flush on fcp2 nodes that are still closed */
found = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
NLP_CLOSED)) {
found = 1;
break;
}
}
if (found) {
break;
}
}
if (!found) {
break;
}
"FCP2 device (did=%06x) missing. Flushing...",
}
/* Try to send clear link attention, if needed */
if ((send_clear_la == 1) &&
/*
* If state is not FC_LINK_UP, then either the link has gone
* down or a FC_CLEAR_LA has already been issued
*/
} else {
/* Change state and clear discovery timer */
hba->discovery_timer = 0;
/* Prepare and send the CLEAR_LA command */
MBX_NOWAIT, 0) != MBX_BUSY) {
}
}
}
return;
} /* emlxs_timer_check_discovery() */
static void
{
uint32_t i;
return;
}
/* Check the unsolicited buffers */
while (ulistp) {
/* Check buffers in this pool */
for (i = 0; i < ulistp->pool_nentries; i++) {
continue;
}
/*
* If buffer has timed out, print message and
* increase timeout
*/
hba->timer_tics) {
"Stale UB buffer detected (%d mins): "
"buffer = %p (%x,%x,%x,%x)",
/* Increase timeout period */
/*
* If timeout was 5 mins or less, increase it
* to 10 mins
*/
}
/*
* If timeout was 10 mins or less, increase
* it to 30 mins
*/
}
/* Otherwise double it. */
else {
}
}
}
}
return;
} /* emlxs_timer_check_ub() */
/* EMLXS_FCTAB_LOCK must be held to call this */
static uint32_t
{
/* Warning: Some FCT sbp's don't have fc_packet objects */
switch (sbp->abort_attempts) {
case 0:
/* Create the abort IOCB */
"chipQ: 1:Aborting. sbp=%p iotag=%x tmo=%d",
/*
* The adapter will make 2 attempts to send ABTS with
* 2*ratov timeout each time
*/
} else {
"chipQ: 1:Closing. sbp=%p iotag=%x tmo=%d",
}
/* set the flags */
rc = 0;
break;
case 1:
"chipQ: 2:Closing. sbp=%p iotag=%x",
rc = 0;
break;
case 2:
"chipQ: 3:Resetting link. sbp=%p iotag=%x",
rc = 1;
break;
default:
"chipQ: %d:Resetting adapter. sbp=%p iotag=%x",
rc = 2;
break;
}
sbp->abort_attempts++;
if (iocbq) {
} else {
}
}
return (rc);
} /* emlxs_pkt_chip_timeout() */
#ifdef TX_WATCHDOG
static void
{
Q abort;
} else {
}
/* Find a matching entry */
found = 0;
while (iocbq) {
found = 1;
break;
}
}
if (!found) {
} else {
} else {
((IOCBQ *)
}
}
} else {
}
}
}
}
}
while (iocbq) {
if (pkt) {
}
emlxs_tx_put(iocbq, 0);
} /* end of while */
return;
} /* emlxs_tx_watchdog() */
#endif /* TX_WATCHDOG */
#ifdef DHCHAP_SUPPORT
static void
{
uint32_t i;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
if (!ndlp) {
continue;
}
/* Check authentication response timeout */
/* Trigger authresp timeout handler */
}
/* Check reauthentication timeout */
/* Trigger reauth timeout handler */
}
}
return;
} /* emlxs_timer_check_dhchap */
#endif /* DHCHAP_SUPPORT */