1 /*
2  * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
3  * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.
4  *
5  * This software is available to you under a choice of one of two
6  * licenses.  You may choose to be licensed under the terms of the GNU
7  * General Public License (GPL) Version 2, available from the file
8  * COPYING in the main directory of this source tree, or the
9  * OpenIB.org BSD license below:
10  *
11  *     Redistribution and use in source and binary forms, with or
12  *     without modification, are permitted provided that the following
13  *     conditions are met:
14  *
15  *      - Redistributions of source code must retain the above
16  *        copyright notice, this list of conditions and the following
17  *        disclaimer.
18  *
19  *      - Redistributions in binary form must reproduce the above
20  *        copyright notice, this list of conditions and the following
21  *        disclaimer in the documentation and/or other materials
22  *        provided with the distribution.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31  * SOFTWARE.
32  *
33  */
34 
35 /*
36  * Abstract:
37  *      Declarations for mesh analysis
38  */
39 
40 #ifndef OSM_MESH_H
41 #define OSM_MESH_H
42 
43 struct _lash;
44 struct _switch;
45 
46 /*
47  * per switch to switch link info
48  */
49 typedef struct _link {
50 	int switch_id;
51 	int link_id;
52 	int next_port;
53 	int num_ports;
54 	int ports[0];
55 } link_t;
56 
57 /*
58  * per switch node mesh info
59  */
60 typedef struct _mesh_node {
61 	int *axes;			/* used to hold and reorder assigned axes */
62 	int *coord;			/* mesh coordinates of switch */
63 	int **matrix;			/* distances between adjacant switches */
64 	int *poly;			/* characteristic polynomial of matrix */
65 					/* used as an invariant classification */
66 	int dimension;			/* apparent dimension of mesh around node */
67 	int temp;			/* temporary holder for distance info */
68 	int type;			/* index of node type in mesh_info array */
69 	unsigned int num_links;		/* number of 'links' to adjacent switches */
70 	link_t *links[0];		/* per link information */
71 } mesh_node_t;
72 
73 void osm_mesh_node_delete(struct _lash *p_lash, struct _switch *sw);
74 int osm_mesh_node_create(struct _lash *p_lash, struct _switch *sw);
75 int osm_do_mesh_analysis(struct _lash *p_lash);
76 
77 #endif
78