emlxs_node.c revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* 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"
/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
extern void
{
/* If node is on a ring service queue, then remove it */
/* Return if node destroyed */
return;
}
if (ringno == FC_IP_RING) {
/* Clear IP XRI */
}
/* Check if node is already closed */
/* If so, check to see if the timer needs to be updated */
if (tics) {
"node=%p did=%06x %s. timeout=%d updated.",
}
}
return;
}
/* Set the node closed */
if (tics) {
"node=%p did=%06x %s. timeout=%d set.",
} else {
}
/* Remove node from ring queue */
/* If this is the only node on list */
(void *) ndlp) {
} else { /* This is a little more difficult */
/* Find the previous node in the circular ring queue */
}
}
}
/* Clear node */
}
return;
} /* emlxs_node_close() */
extern void
{
uint32_t i;
/* If node needs servicing, then add it to the ring queues */
/* Return if node destroyed */
return;
}
/* Return if node already open */
return;
}
/* Set the node open (not closed) */
} else {
}
/* Clear the timer */
/*
* If the ptx or the tx queue needs servicing and the node is not
* already on the ring queue
*/
/* If so, then add it to the ring 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 */
(ringno == FC_FCP_RING)) {
/* Scan to see if any FCP2 devices are still closed */
found = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
found = 1;
break;
}
}
if (found) {
break;
}
}
if (!found) {
/* Clear link attention */
/*
* 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;
MBX_NOWAIT, 0) != MBX_BUSY) {
}
} 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);
}
}
}
}
"find: MAC=%02x%02x%02x%02x%02x%02x",
return (NULL);
} /* emlxs_node_find_mac() */
extern NODELIST *
{
/* Check for invalid node ids */
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);
}
}
"find: did=%x", 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);
}
}
}
"find: rpi=%x", 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);
}
}
}
"find: wwpn=%02x%02x%02x%02x%02x%02x%02x%02x",
/* 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 */
0xFFF000) {
continue;
}
return (nlp);
}
count++;
}
}
"find: index=%d", 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--;
}
"did=%06x rpi=%x "
"wwpn=%02x%02x%02x%02x%02x%02x%02x%02x count=%d",
}
}
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 count=%d",
return;
} /* emlxs_node_add() */
extern void
{
} else {
}
if (port->node_count) {
port->node_count--;
}
"did=%06x rpi=%x "
"wwpn=%02x%02x%02x%02x%02x%02x%02x%02x count=%d",
ndlp->nlp_active = 0;
break;
}
}
return;
} /* emlxs_node_rm() */