emlxs_node.c revision fe199829b492e6b3aa36dd76af597360bb4af121
/*
* 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 2009 Emulex. All rights reserved.
* Use is subject to license terms.
*/
#include <emlxs.h>
/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
/* Timeout == -1 will enable the offline timer */
/* Timeout not -1 will apply the timeout */
extern void
{
/* If node is on a channel service queue, then remove it */
/* Return if node destroyed */
return;
}
/* Check offline support */
if (timeout == -1) {
offline = 1;
} else {
timeout = 0;
}
}
/* Clear IP XRI */
}
/* Check if node is already closed */
return;
}
if (offline) {
"node=%p did=%06x channel=%d. offline=%d update.",
} else if (timeout) {
"node=%p did=%06x channel=%d. timeout=%d update.",
} else {
}
return;
}
/* Set the node closed */
if (offline) {
"node=%p did=%06x channel=%d. offline=%d set.",
} else if (timeout) {
"node=%p did=%06x channel=%d. timeout=%d set.",
} else {
"node=%p did=%06x channel=%d.",
}
/*
* ndlp->nlp_next[] and cp->nodeq list have to be updated
* simulaneously
*/
/* Remove node from channel queue */
/* If this is the only node on list */
} else { /* This is a little more difficult */
/* Find the previous node in circular channel queue */
}
}
}
/* Clear node */
}
return;
} /* emlxs_node_close() */
/* Called by emlxs_timer_check_nodes() */
extern void
{
/* If node needs servicing, then add it to the channel queues */
/* Return if node destroyed */
return;
}
/* Open the node if not offline */
return;
}
/* OFFLINE TIMEOUT OCCURRED! */
/* Clear the timer */
/* Flush tx queue for this channel */
/* Flush chip queue for this channel */
return;
} /* emlxs_node_timeout() */
extern void
{
uint32_t i;
int rc;
/* If node needs servicing, then add it to the channel queues */
/* Return if node destroyed */
return;
}
/* Return if node already open */
return;
}
/* Set the node open (not closed) */
/* Clear the timer */
/*
* If the ptx or the tx queue needs servicing and
* the node is not already on the channel queue
*/
/* If so, then add it to the channel queue */
/* If this is not the base node then */
/* add it to the tail */
} else { /* Otherwise, add it to the head */
/* The command node always gets priority */
}
} else {
}
}
/* If link attention needs to be cleared */
/* re Think this code path. For SLI4 channel fcp == els */
"ADD CODE to RESUME RPIs node=%p did=%06x chan=%d",
goto done;
}
/* Scan to see if any FCP2 devices are still closed */
found = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
NLP_CLOSED)) {
found = 1;
break;
}
}
if (found) {
break;
}
}
if (!found) {
/* Clear link attention */
MEM_MBOX, 1))) {
/*
* If state is not FC_LINK_UP, then either the
* link has gone down or a FC_CLEAR_LA has
* already been issued
*/
goto done;
}
hba->discovery_timer = 0;
mbox, MBX_NOWAIT, 0);
}
} else {
/* Close the node and try again */
/* in a few seconds */
return;
}
}
}
done:
/* Wake any sleeping threads */
return;
} /* emlxs_node_open() */
static int
{
return (1);
/*
*/
goto out;
}
return (1);
}
goto out;
}
return (1);
}
}
}
out:
return (0);
} /* End emlxs_node_match_did */
extern NODELIST *
{
uint32_t i;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
/*
* If portname matches mac address,
* return NODELIST entry
*/
FABRIC_DID_MASK)) {
continue;
}
return (nlp);
}
}
}
}
return (NULL);
} /* emlxs_node_find_mac() */
extern NODELIST *
{
/* Check for invalid node ids */
return ((NODELIST *)0);
}
if (did & 0xff000000) {
return ((NODELIST *)0);
}
/* Check for bcast node */
/* Use the base node here */
}
#ifdef MENLO_SUPPORT
/* Check for menlo node */
if (did == EMLXS_MENLO_DID) {
/* Use the base node here */
}
#endif /* MENLO_SUPPORT */
/* Check for host node */
/* Use the base node here */
}
/*
* Convert well known fabric addresses to the FABRIC_DID,
* since we don't login to some of them
*/
did = FABRIC_DID;
}
/* Check for obvious match */
return (nlp);
}
/* Check for detailed match */
return (nlp);
}
}
did);
/* no match found */
return ((NODELIST *)0);
} /* emlxs_node_find_did() */
extern NODELIST *
{
uint32_t i;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
return (nlp);
}
}
}
rpi);
/* no match found */
return ((NODELIST *)0);
} /* emlxs_node_find_rpi() */
extern NODELIST *
{
uint32_t i;
uint32_t j;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
bptr1 += 7;
bptr2 += 7;
for (j = 0; j < 8; j++) {
break;
}
}
if (j == 8) {
return (nlp);
}
}
}
/* no match found */
return ((NODELIST *)0);
} /* emlxs_node_find_wwpn() */
extern NODELIST *
{
uint32_t i;
return (NULL);
}
count = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
/* Skip fabric ports if requested */
if (nports_only &&
continue;
}
return (nlp);
}
count++;
}
}
index);
/* no match found */
return ((NODELIST *)0);
} /* emlxs_node_find_wwpn() */
extern uint32_t
{
uint32_t i;
uint32_t nport_count = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
nport_count++;
}
}
}
return (nport_count);
} /* emlxs_nport_count() */
extern void
{
uint32_t i;
/* Flush and free the nodes */
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
port->node_table[i] = 0;
ndlp->nlp_active = 0;
if (port->node_count) {
port->node_count--;
}
&emlxs_node_destroy_msg, "did=%06x "
"rpi=%x wwpn=%02x%02x%02x%02x%02x%02x%02x%02x "
if (rp) {
}
}
}
}
port->node_count = 0;
/* Clean the base node */
/* Flush the base node */
return;
} /* emlxs_node_destroy_all() */
extern void
{
/*
* Insert node pointer to the head
*/
if (!np) {
} else {
}
port->node_count++;
"node=%p did=%06x rpi=%x wwpn=%02x%02x%02x%02x%02x%02x%02x%02x "
if (rp) {
} else {
"Unable to find RPI! did=%x rpi=%x",
}
}
return;
} /* emlxs_node_add() */
extern void
{
} else {
}
if (port->node_count) {
port->node_count--;
}
&emlxs_node_destroy_msg, "did=%06x "
"rpi=%x wwpn=%02x%02x%02x%02x%02x%02x%02x%02x "
ndlp->nlp_active = 0;
if (rp) {
}
}
break;
}
}
return;
} /* emlxs_node_rm() */