1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004-2007 Voltaire Inc.  All rights reserved.
3219820Sjeff * Copyright (c) 2007 Xsigo Systems Inc.  All rights reserved.
4219820Sjeff *
5219820Sjeff * This software is available to you under a choice of one of two
6219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
7219820Sjeff * General Public License (GPL) Version 2, available from the file
8219820Sjeff * COPYING in the main directory of this source tree, or the
9219820Sjeff * OpenIB.org BSD license below:
10219820Sjeff *
11219820Sjeff *     Redistribution and use in source and binary forms, with or
12219820Sjeff *     without modification, are permitted provided that the following
13219820Sjeff *     conditions are met:
14219820Sjeff *
15219820Sjeff *      - Redistributions of source code must retain the above
16219820Sjeff *        copyright notice, this list of conditions and the following
17219820Sjeff *        disclaimer.
18219820Sjeff *
19219820Sjeff *      - Redistributions in binary form must reproduce the above
20219820Sjeff *        copyright notice, this list of conditions and the following
21219820Sjeff *        disclaimer in the documentation and/or other materials
22219820Sjeff *        provided with the distribution.
23219820Sjeff *
24219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31219820Sjeff * SOFTWARE.
32219820Sjeff *
33219820Sjeff */
34219820Sjeff
35219820Sjeff#ifndef _IBNETDISCOVER_H_
36219820Sjeff#define _IBNETDISCOVER_H_
37219820Sjeff
38219820Sjeff#define MAXHOPS		63
39219820Sjeff
40219820Sjeff#define CA_NODE		1
41219820Sjeff#define SWITCH_NODE	2
42219820Sjeff#define ROUTER_NODE	3
43219820Sjeff
44219820Sjeff#define LIST_CA_NODE	 (1 << CA_NODE)
45219820Sjeff#define LIST_SWITCH_NODE (1 << SWITCH_NODE)
46219820Sjeff#define LIST_ROUTER_NODE (1 << ROUTER_NODE)
47219820Sjeff
48219820Sjeff/* Vendor IDs (for chassis based systems) */
49219820Sjeff#define VTR_VENDOR_ID			0x8f1	/* Voltaire */
50219820Sjeff#define TS_VENDOR_ID			0x5ad	/* Cisco */
51219820Sjeff#define SS_VENDOR_ID			0x66a	/* InfiniCon */
52219820Sjeff#define XS_VENDOR_ID			0x1397	/* Xsigo */
53219820Sjeff
54219820Sjeff
55219820Sjefftypedef struct Port Port;
56219820Sjefftypedef struct Node Node;
57219820Sjefftypedef struct ChassisRecord ChassisRecord;
58219820Sjeff
59219820Sjeffstruct ChassisRecord {
60219820Sjeff	ChassisRecord *next;
61219820Sjeff
62219820Sjeff	unsigned char chassisnum;
63219820Sjeff	unsigned char anafanum;
64219820Sjeff	unsigned char slotnum;
65219820Sjeff	unsigned char chassistype;
66219820Sjeff	unsigned char chassisslot;
67219820Sjeff};
68219820Sjeff
69219820Sjeffstruct Port {
70219820Sjeff	Port *next;
71219820Sjeff	uint64_t portguid;
72219820Sjeff	int portnum;
73219820Sjeff	int lid;
74219820Sjeff	int lmc;
75219820Sjeff	int state;
76219820Sjeff	int physstate;
77219820Sjeff	int linkwidth;
78219820Sjeff	int linkspeed;
79219820Sjeff
80219820Sjeff	Node *node;
81219820Sjeff	Port *remoteport;		/* null if SMA */
82219820Sjeff};
83219820Sjeff
84219820Sjeffstruct Node {
85219820Sjeff	Node *htnext;
86219820Sjeff	Node *dnext;
87219820Sjeff	Port *ports;
88219820Sjeff	ib_portid_t path;
89219820Sjeff	int type;
90219820Sjeff	int dist;
91219820Sjeff	int numports;
92219820Sjeff	int localport;
93219820Sjeff	int smalid;
94219820Sjeff	int smalmc;
95219820Sjeff	int smaenhsp0;
96219820Sjeff	uint32_t devid;
97219820Sjeff	uint32_t vendid;
98219820Sjeff	uint64_t sysimgguid;
99219820Sjeff	uint64_t nodeguid;
100219820Sjeff	uint64_t portguid;
101219820Sjeff	char nodedesc[64];
102219820Sjeff	uint8_t nodeinfo[64];
103219820Sjeff
104219820Sjeff	ChassisRecord *chrecord;
105219820Sjeff};
106219820Sjeff
107219820Sjeff#endif	/* _IBNETDISCOVER_H_ */
108