b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * CDDL HEADER START
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * The contents of this file are subject to the terms of the
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * Common Development and Distribution License (the "License").
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * You may not use this file except in compliance with the License.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * See the License for the specific language governing permissions
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * and limitations under the License.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * When distributing Covered Code, include this CDDL HEADER in each
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * If applicable, add the following below this CDDL HEADER, with the
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * fields enclosed by brackets "[]" replaced with your own identifying
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * information: Portions Copyright [yyyy] [name of copyright owner]
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * CDDL HEADER END
c1f8b08e52d9b30bd55daeac694e3a7f50d3cd21agiri * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * Use is subject to license terms.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri#pragma ident "%Z%%M% %I% %E% SMI"
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * RDS Path MAP
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * N - Node record, P - Path record
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * rds_path_map -
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * --------- --------- ---------
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * | N |------>| N |------>| N |------> NULL
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * NULL <-------| |<------| |<------| |
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * --------- --------- ---------
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * -------- --------- ---------
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * | P | | P | | P |
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * -------- --------- ---------
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * | ^ | ^ | ^
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * | | | | | |
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * v | v | v |
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * -------- -------- ---------
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * | P | | P | | P |
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * -------- -------- ---------
8257fab973a69800a3a3309e8af21fc1876d2df9agiri if ((p->local.iftype != DL_IB) || (p->remote.iftype != DL_IB)) \
8257fab973a69800a3a3309e8af21fc1876d2df9agiri * Called by SC to register the Sun Cluster device name
8257fab973a69800a3a3309e8af21fc1876d2df9agiri /* extract the device name from the interface name */
8257fab973a69800a3a3309e8af21fc1876d2df9agiri if (i >= 0) {
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * Called by SC on discovering a new path
8257fab973a69800a3a3309e8af21fc1876d2df9agiri /* ignore if the end points are not of type DL_IB */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri while ((p) && ((p->lnode_ip != path->local.node_ipaddr) ||
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri if (p == NULL) {
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri p = (rds_node_record_t *)kmem_alloc(sizeof (rds_node_record_t),
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* insert this node at the head */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* we found a match */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * Called by SC to delete a path
8257fab973a69800a3a3309e8af21fc1876d2df9agiri /* ignore if the end points are not of type DL_IB */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri while ((p) && ((p->lnode_ip != path->local.node_ipaddr) ||
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri if (p == NULL) {
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* no match */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri RDS_DPRINTF2("rds_path_down", "Node record not found "
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri while ((p1) && ((p1->libd_ip != path->local.ipaddr) ||
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* no match */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri RDS_DPRINTF2("rds_path_down", "Path record not found "
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri "(0x%x <-> 0x%x)", path->local.ipaddr, path->remote.ipaddr);
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* we found the record, remove it */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* this is the first path record */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* remove the node record if there are no path records */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* this is the first node record */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri while ((p) && ((p->lnode_ip != *localip) || (p->rnode_ip != *remip))) {
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri if (p == NULL) {
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* no match */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri RDS_DPRINTF2("rds_sc_path_lookup", "Node record not found "
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri return (0);
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* found a path */
8257fab973a69800a3a3309e8af21fc1876d2df9agiri * But next time, we want to use a different path record so move this
8257fab973a69800a3a3309e8af21fc1876d2df9agiri * path record to the end.
8257fab973a69800a3a3309e8af21fc1876d2df9agiri /* walk down to the last path record */
8257fab973a69800a3a3309e8af21fc1876d2df9agiri /* Attach the first path record to the end */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri return (1);
c1f8b08e52d9b30bd55daeac694e3a7f50d3cd21agiri * Sun Cluster always names its interconnect virtual network interface
c1f8b08e52d9b30bd55daeac694e3a7f50d3cd21agiri * as clprivnetx, so return TRUE if there is atleast one node record
c1f8b08e52d9b30bd55daeac694e3a7f50d3cd21agiri * and the interface name is clprivnet something.
c1f8b08e52d9b30bd55daeac694e3a7f50d3cd21agiri /* clprivnet address */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* we found a match */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* go to the next node record */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri if (p == NULL) {
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* no match */
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri /* Found a matching node record */