rdsib_sc.c revision 8257fab973a69800a3a3309e8af21fc1876d2df9
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* RDS Path MAP
*
* N - Node record, P - Path record
*
* rds_path_map -
* |
* v
* --------- --------- ---------
* | N |------>| N |------>| N |------> NULL
* NULL <-------| |<------| |<------| |
* --------- --------- ---------
* | | |
* | | |
* v v v
* -------- --------- ---------
* | P | | P | | P |
* -------- --------- ---------
* | ^ | ^ | ^
* | | | | | |
* v | v | v |
* -------- -------- ---------
* | P | | P | | P |
* -------- -------- ---------
* o o o
* o o o
* o o o
*/
typedef struct rds_path_record_s {
struct rds_path_record_s *up;
struct rds_path_record_s *downp;
char lifname[MAXNAMELEN];
char rifname[MAXNAMELEN];
typedef struct rds_node_record_s {
struct rds_node_record_s *nextp;
struct rds_path_record_s *downp;
struct rds_node_record_s *prevp;
#define RDS_VALIDATE_PATH(p) \
return
/*
* Called by SC to register the Sun Cluster device name
*/
void
rds_clif_name(char *name)
{
int i;
/* extract the device name from the interface name */
if (i >= 0) {
}
}
/*
* Called by SC on discovering a new path
*/
void
{
/* ignore if the end points are not of type DL_IB */
p = rds_pathmap;
p = p->nextp;
}
if (p == NULL) {
KM_SLEEP);
sizeof (rds_path_record_t), KM_SLEEP);
if (rds_pathmap == NULL) {
rds_pathmap = p;
} else {
/* insert this node at the head */
rds_pathmap->prevp = p;
p->nextp = rds_pathmap;
rds_pathmap = p;
}
} else {
/* we found a match */
sizeof (rds_path_record_t), KM_SLEEP);
}
}
/*
* Called by SC to delete a path
*/
void
{
/* ignore if the end points are not of type DL_IB */
p = rds_pathmap;
p = p->nextp;
}
if (p == NULL) {
/* no match */
return;
}
}
/* no match */
return;
}
/* we found the record, remove it */
if (p1up) {
} else {
/* this is the first path record */
}
if (p1downp) {
}
/* remove the node record if there are no path records */
if (p->prevp) {
} else {
/* this is the first node record */
ASSERT(p == rds_pathmap);
rds_pathmap = p->nextp;
}
if (p->nextp) {
}
kmem_free(p, sizeof (rds_node_record_t));
}
}
int
{
p = rds_pathmap;
p = p->nextp;
}
if (p == NULL) {
/* no match */
return (0);
}
/* found a path */
/*
* But next time, we want to use a different path record so move this
* path record to the end.
*/
/* walk down to the last path record */
}
/* Attach the first path record to the end */
}
return (1);
}
rds_if_lookup_by_name(char *devname)
{
/*
* Sun Cluster always names its interconnect virtual network interface
* as clprivnetx, so return TRUE if there is atleast one node record
* and the interface name is clprivnet something.
*/
/* clprivnet address */
return (B_TRUE);
}
return (B_FALSE);
}
{
p = rds_pathmap;
}
/* we found a match */
break;
/* go to the next node record */
p = p->nextp;
}
if (p == NULL) {
/* no match */
RDS_DPRINTF2("rds_if_lookup_by_addr",
"Addr: 0x%x not found", addr);
return (B_FALSE);
}
/* Found a matching node record */
return (B_TRUE);
}