xref: /freebsd/contrib/ofed/opensm/include/opensm/osm_subnet.h (revision 87181516ef48be852d5e5fee53c6e0dbfc62f21e)
1 /*
2  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3  * Copyright (c) 2002-2015 Mellanox Technologies LTD. All rights reserved.
4  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
6  * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.
7  * Copyright (c) 2009 HNR Consulting. All rights reserved.
8  * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
9  * Copyright (c) 2009-2015 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
10  *
11  * This software is available to you under a choice of one of two
12  * licenses.  You may choose to be licensed under the terms of the GNU
13  * General Public License (GPL) Version 2, available from the file
14  * COPYING in the main directory of this source tree, or the
15  * OpenIB.org BSD license below:
16  *
17  *     Redistribution and use in source and binary forms, with or
18  *     without modification, are permitted provided that the following
19  *     conditions are met:
20  *
21  *      - Redistributions of source code must retain the above
22  *        copyright notice, this list of conditions and the following
23  *        disclaimer.
24  *
25  *      - Redistributions in binary form must reproduce the above
26  *        copyright notice, this list of conditions and the following
27  *        disclaimer in the documentation and/or other materials
28  *        provided with the distribution.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
34  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
35  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37  * SOFTWARE.
38  *
39  */
40 
41 /*
42  * Abstract:
43  *	Declaration of osm_subn_t.
44  *	This object represents an IBA subnet.
45  *	This object is part of the OpenSM family of objects.
46  */
47 
48 #ifndef _OSM_SUBNET_H_
49 #define _OSM_SUBNET_H_
50 
51 #include <iba/ib_types.h>
52 #include <complib/cl_qmap.h>
53 #include <complib/cl_fleximap.h>
54 #include <complib/cl_map.h>
55 #include <complib/cl_ptr_vector.h>
56 #include <complib/cl_list.h>
57 #include <opensm/osm_base.h>
58 #include <opensm/osm_prefix_route.h>
59 #include <opensm/osm_db.h>
60 #include <stdio.h>
61 
62 #ifdef __cplusplus
63 #  define BEGIN_C_DECLS extern "C" {
64 #  define END_C_DECLS   }
65 #else				/* !__cplusplus */
66 #  define BEGIN_C_DECLS
67 #  define END_C_DECLS
68 #endif				/* __cplusplus */
69 
70 BEGIN_C_DECLS
71 #define OSM_SUBNET_VECTOR_MIN_SIZE			0
72 #define OSM_SUBNET_VECTOR_GROW_SIZE			1
73 #define OSM_SUBNET_VECTOR_CAPACITY			256
74 
75 #define OSM_PARTITION_ENFORCE_BOTH			"both"
76 #define OSM_PARTITION_ENFORCE_IN			"in"
77 #define OSM_PARTITION_ENFORCE_OUT			"out"
78 #define OSM_PARTITION_ENFORCE_OFF			"off"
79 
80 typedef enum _osm_partition_enforce_type_enum {
81 	OSM_PARTITION_ENFORCE_TYPE_BOTH,
82 	OSM_PARTITION_ENFORCE_TYPE_IN,
83 	OSM_PARTITION_ENFORCE_TYPE_OUT,
84 	OSM_PARTITION_ENFORCE_TYPE_OFF
85 } osm_partition_enforce_type_enum;
86 
87 /* XXX: not actual max, max we're currently going to support */
88 #define OSM_CCT_ENTRY_MAX        128
89 #define OSM_CCT_ENTRY_MAD_BLOCKS (OSM_CCT_ENTRY_MAX/64)
90 
91 struct osm_opensm;
92 struct osm_qos_policy;
93 
94 /****h* OpenSM/Subnet
95 * NAME
96 *	Subnet
97 *
98 * DESCRIPTION
99 *	The Subnet object encapsulates the information needed by the
100 *	OpenSM to manage a subnet.  The OpenSM allocates one Subnet object
101 *	per IBA subnet.
102 *
103 *	The Subnet object is not thread safe, thus callers must provide
104 *	serialization.
105 *
106 *	This object is essentially a container for the various components
107 *	of a subnet.  Callers may directly access the member variables.
108 *
109 * AUTHOR
110 *	Steve King, Intel
111 *
112 *********/
113 
114 /****s* OpenSM: Subnet/osm_qos_options_t
115 * NAME
116 *	osm_qos_options_t
117 *
118 * DESCRIPTION
119 *	Subnet QoS options structure.  This structure contains the various
120 *	QoS specific configuration parameters for the subnet.
121 *
122 * SYNOPSIS
123 */
124 typedef struct osm_qos_options {
125 	unsigned max_vls;
126 	int high_limit;
127 	char *vlarb_high;
128 	char *vlarb_low;
129 	char *sl2vl;
130 } osm_qos_options_t;
131 /*
132 * FIELDS
133 *
134 *	max_vls
135 *		The number of maximum VLs on the Subnet (0 == use default)
136 *
137 *	high_limit
138 *		The limit of High Priority component of VL Arbitration
139 *		table (IBA 7.6.9) (-1 == use default)
140 *
141 *	vlarb_high
142 *		High priority VL Arbitration table template. (NULL == use default)
143 *
144 *	vlarb_low
145 *		Low priority VL Arbitration table template. (NULL == use default)
146 *
147 *	sl2vl
148 *		SL2VL Mapping table (IBA 7.6.6) template. (NULL == use default)
149 *
150 *********/
151 
152 /****s* OpenSM: Subnet/osm_cct_entry_t
153 * NAME
154 *	osm_cct_entry_t
155 *
156 * DESCRIPTION
157 *	Subnet Congestion Control Table entry.  See A10.2.2.1.1 for format details.
158 *
159 * SYNOPSIS
160 */
161 typedef struct osm_cct_entry {
162 	uint8_t shift; //Alex: shift 2 bits
163 	uint16_t multiplier; //Alex multiplier 14 bits
164 } osm_cct_entry_t;
165 /*
166 * FIELDS
167 *
168 *	shift
169 *		shift field in CCT entry.  See A10.2.2.1.1.
170 *
171 *	multiplier
172 *		multiplier field in CCT entry.  See A10.2.2.1.1.
173 *
174 *********/
175 
176 /****s* OpenSM: Subnet/osm_cacongestion_entry_t
177 * NAME
178 *	osm_cacongestion_entry_t
179 *
180 * DESCRIPTION
181 *	Subnet CA Congestion entry.  See A10.4.3.8.4 for format details.
182 *
183 * SYNOPSIS
184 */
185 typedef struct osm_cacongestion_entry {
186 	ib_net16_t ccti_timer; //Alex: ccti_timer and ccti_increase should be replaced
187 	uint8_t ccti_increase;
188 	uint8_t trigger_threshold;
189 	uint8_t ccti_min;
190 } osm_cacongestion_entry_t;
191 /*
192 * FIELDS
193 *
194 *	ccti_timer
195 *		CCTI Timer
196 *
197 *	ccti_increase
198 *		CCTI Increase
199 *
200 *	trigger_threshold
201 *		CCTI trigger for log message
202 *
203 *	ccti_min
204 *		CCTI Minimum
205 *
206 *********/
207 
208 /****s* OpenSM: Subnet/osm_cct_t
209 * NAME
210 *	osm_cct_t
211 *
212 * DESCRIPTION
213 *	Subnet CongestionControlTable.  See A10.4.3.9 for format details.
214 *
215 * SYNOPSIS
216 */
217 typedef struct osm_cct {
218 	osm_cct_entry_t entries[OSM_CCT_ENTRY_MAX];
219 	unsigned int entries_len;
220 	char *input_str;
221 } osm_cct_t;
222 /*
223 * FIELDS
224 *
225 *	entries
226 *		Entries in CCT
227 *
228 *	entries_len
229 *		Length of entries
230 *
231 *	input_str
232 *		Original str input
233 *
234 *********/
235 
236 
237 /****s* OpenSM: Subnet/osm_subn_opt_t
238 * NAME
239 *	osm_subn_opt_t
240 *
241 * DESCRIPTION
242 *	Subnet options structure.  This structure contains the various
243 *	site specific configuration parameters for the subnet.
244 *
245 * SYNOPSIS
246 */
247 typedef struct osm_subn_opt {
248 	const char *config_file;
249 	ib_net64_t guid;
250 	ib_net64_t m_key;
251 	ib_net64_t sm_key;
252 	ib_net64_t sa_key;
253 	ib_net64_t subnet_prefix;
254 	ib_net16_t m_key_lease_period;
255 	uint8_t m_key_protect_bits;
256 	boolean_t m_key_lookup;
257 	uint32_t sweep_interval;
258 	uint32_t max_wire_smps;
259 	uint32_t max_wire_smps2;
260 	uint32_t max_smps_timeout;
261 	uint32_t transaction_timeout;
262 	uint32_t transaction_retries;
263 	uint8_t sm_priority;
264 	uint8_t lmc;
265 	boolean_t lmc_esp0;
266 	uint8_t max_op_vls;
267 	uint8_t force_link_speed;
268 	uint8_t force_link_speed_ext;
269 	uint8_t fdr10;
270 	boolean_t reassign_lids;
271 	boolean_t ignore_other_sm;
272 	boolean_t single_thread;
273 	boolean_t disable_multicast;
274 	boolean_t force_log_flush;
275 	uint8_t subnet_timeout;
276 	uint8_t packet_life_time;
277 	uint8_t vl_stall_count;
278 	uint8_t leaf_vl_stall_count;
279 	uint8_t head_of_queue_lifetime;
280 	uint8_t leaf_head_of_queue_lifetime;
281 	uint8_t local_phy_errors_threshold;
282 	uint8_t overrun_errors_threshold;
283 	boolean_t use_mfttop;
284 	uint32_t sminfo_polling_timeout;
285 	uint32_t polling_retry_number;
286 	uint32_t max_msg_fifo_timeout;
287 	boolean_t force_heavy_sweep;
288 	uint8_t log_flags;
289 	char *dump_files_dir;
290 	char *log_file;
291 	uint32_t log_max_size;
292 	char *partition_config_file;
293 	boolean_t no_partition_enforcement;
294 	char *part_enforce;
295 	osm_partition_enforce_type_enum part_enforce_enum;
296 	boolean_t allow_both_pkeys;
297 	uint8_t sm_assigned_guid;
298 	boolean_t qos;
299 	char *qos_policy_file;
300 	boolean_t suppress_sl2vl_mad_status_errors;
301 	boolean_t accum_log_file;
302 	char *console;
303 	uint16_t console_port;
304 	char *port_prof_ignore_file;
305 	char *hop_weights_file;
306 	char *port_search_ordering_file;
307 	boolean_t port_profile_switch_nodes;
308 	boolean_t sweep_on_trap;
309 	char *routing_engine_names;
310 	boolean_t use_ucast_cache;
311 	boolean_t connect_roots;
312 	char *lid_matrix_dump_file;
313 	char *lfts_file;
314 	char *root_guid_file;
315 	char *cn_guid_file;
316 	char *io_guid_file;
317 	boolean_t port_shifting;
318 	uint32_t scatter_ports;
319 	uint16_t max_reverse_hops;
320 	char *ids_guid_file;
321 	char *guid_routing_order_file;
322 	boolean_t guid_routing_order_no_scatter;
323 	char *sa_db_file;
324 	boolean_t sa_db_dump;
325 	char *torus_conf_file;
326 	boolean_t do_mesh_analysis;
327 	boolean_t exit_on_fatal;
328 	boolean_t honor_guid2lid_file;
329 	boolean_t daemon;
330 	boolean_t sm_inactive;
331 	boolean_t babbling_port_policy;
332 	boolean_t drop_event_subscriptions;
333 	boolean_t ipoib_mcgroup_creation_validation;
334 	boolean_t mcgroup_join_validation;
335 	boolean_t use_optimized_slvl;
336 	boolean_t fsync_high_avail_files;
337 	osm_qos_options_t qos_options;
338 	osm_qos_options_t qos_ca_options;
339 	osm_qos_options_t qos_sw0_options;
340 	osm_qos_options_t qos_swe_options;
341 	osm_qos_options_t qos_rtr_options;
342 	boolean_t congestion_control;
343 	ib_net64_t cc_key;
344 	uint32_t cc_max_outstanding_mads;
345 	ib_net32_t cc_sw_cong_setting_control_map;
346 	uint8_t cc_sw_cong_setting_victim_mask[IB_CC_PORT_MASK_DATA_SIZE];
347 	uint8_t cc_sw_cong_setting_credit_mask[IB_CC_PORT_MASK_DATA_SIZE];
348 	uint8_t cc_sw_cong_setting_threshold;
349 	uint8_t cc_sw_cong_setting_packet_size;
350 	uint8_t cc_sw_cong_setting_credit_starvation_threshold;
351 	osm_cct_entry_t cc_sw_cong_setting_credit_starvation_return_delay;
352 	ib_net16_t cc_sw_cong_setting_marking_rate;
353 	ib_net16_t cc_ca_cong_setting_port_control;
354 	ib_net16_t cc_ca_cong_setting_control_map;
355 	osm_cacongestion_entry_t cc_ca_cong_entries[IB_CA_CONG_ENTRY_DATA_SIZE];
356 	osm_cct_t cc_cct;
357 	boolean_t enable_quirks;
358 	boolean_t no_clients_rereg;
359 #ifdef ENABLE_OSM_PERF_MGR
360 	boolean_t perfmgr;
361 	boolean_t perfmgr_redir;
362 	uint16_t perfmgr_sweep_time_s;
363 	uint32_t perfmgr_max_outstanding_queries;
364 	boolean_t perfmgr_ignore_cas;
365 	char *event_db_dump_file;
366 	int perfmgr_rm_nodes;
367 	boolean_t perfmgr_log_errors;
368 	boolean_t perfmgr_query_cpi;
369 	boolean_t perfmgr_xmit_wait_log;
370 	uint32_t perfmgr_xmit_wait_threshold;
371 #endif				/* ENABLE_OSM_PERF_MGR */
372 	char *event_plugin_name;
373 	char *event_plugin_options;
374 	char *node_name_map_name;
375 	char *prefix_routes_file;
376 	char *log_prefix;
377 	boolean_t consolidate_ipv6_snm_req;
378 	struct osm_subn_opt *file_opts; /* used for update */
379 	uint8_t lash_start_vl;			/* starting vl to use in lash */
380 	uint8_t sm_sl;			/* which SL to use for SM/SA communication */
381 	char *per_module_logging_file;
382 	boolean_t quasi_ftree_indexing;
383 } osm_subn_opt_t;
384 /*
385 * FIELDS
386 *
387 *	config_file
388 *		The name of the config file.
389 *
390 *	guid
391 *		The port guid that the SM is binding to.
392 *
393 *	m_key
394 *		M_Key value sent to all ports qualifying all Set(PortInfo).
395 *
396 *	sm_key
397 *		SM_Key value of the SM used for SM authentication.
398 *
399 *	sa_key
400 *		SM_Key value to qualify rcv SA queries as "trusted".
401 *
402 *	subnet_prefix
403 *		Subnet prefix used on this subnet.
404 *
405 *	m_key_lease_period
406 *		The lease period used for the M_Key on this subnet.
407 *
408 *	sweep_interval
409 *		The number of seconds between subnet sweeps.  A value of 0
410 *		disables sweeping.
411 *
412 *	max_wire_smps
413 *		The maximum number of SMPs sent in parallel.  Default is 4.
414 *
415 *	max_wire_smps2
416 *		The maximum number of timeout SMPs allowed to be outstanding.
417 *		Default is same as max_wire_smps which disables the timeout
418 *		mechanism.
419 *
420 *	max_smps_timeout
421 *		The wait time in usec for timeout based SMPs.  Default is
422 *		timeout * retries.
423 *
424 *	transaction_timeout
425 *		The maximum time in milliseconds allowed for a transaction
426 *		to complete.  Default is 200.
427 *
428 *	transaction_retries
429 *		The number of retries for a transaction. Default is 3.
430 *
431 *	sm_priority
432 *		The priority of this SM as specified by the user.  This
433 *		value is made available in the SMInfo attribute.
434 *
435 *	lmc
436 *		The LMC value used on this subnet.
437 *
438 *	lmc_esp0
439 *		Whether LMC value used on subnet should be used for
440 *		enhanced switch port 0 or not.  If TRUE, it is used.
441 *		Otherwise (the default), LMC is set to 0 for ESP0.
442 *
443 *	max_op_vls
444 *		Limit the maximal operational VLs. default is 1.
445 *
446 *	reassign_lids
447 *		If TRUE cause all lids to be re-assigend.
448 *		Otherwise (the default),
449 *		OpenSM always tries to preserve as LIDs as much as possible.
450 *
451 *	ignore_other_sm_option
452 *		This flag is TRUE if other SMs on the subnet should be ignored.
453 *
454 *	disable_multicast
455 *		This flag is TRUE if OpenSM should disable multicast support.
456 *
457 *	max_msg_fifo_timeout
458 *		The maximal time a message can stay in the incoming message
459 *		queue. If there is more than one message in the queue and the
460 *		last message stayed in the queue more than this value the SA
461 *		request will be immediately returned with a BUSY status.
462 *
463 *	subnet_timeout
464 *		The subnet_timeout that will be set for all the ports in the
465 *		design SubnSet(PortInfo.vl_stall_life))
466 *
467 *	vl_stall_count
468 *		The number of sequential packets dropped that cause the port
469 *		to enter the VLStalled state.
470 *
471 *	leaf_vl_stall_count
472 *		The number of sequential packets dropped that cause the port
473 *		to enter the VLStalled state. This is for switch ports driving
474 *		a CA or router port.
475 *
476 *	head_of_queue_lifetime
477 *		The maximal time a packet can live at the head of a VL queue
478 *		on any port not driving a CA or router port.
479 *
480 *	leaf_head_of_queue_lifetime
481 *		The maximal time a packet can live at the head of a VL queue
482 *		on switch ports driving a CA or router.
483 *
484 *	local_phy_errors_threshold
485 *		Threshold of local phy errors for sending Trap 129
486 *
487 *	overrun_errors_threshold
488 *		Threshold of credits overrun errors for sending Trap 129
489 *
490 *	sminfo_polling_timeout
491 *		Specifies the polling timeout (in milliseconds) - the timeout
492 *		between one poll to another.
493 *
494 *	packet_life_time
495 *		The maximal time a packet can stay in a switch.
496 *		The value is send to all switches as
497 *		SubnSet(SwitchInfo.life_state)
498 *
499 *	dump_files_dir
500 *		The directory to be used for opensm-subnet.lst, opensm.fdbs,
501 *		opensm.mcfdbs, and default log file (the latter for Windows,
502 *		not Linux).
503 *
504 *	log_file
505 *		Name of the log file (or NULL) for stdout.
506 *
507 *	log_max_size
508 *		This option defines maximal log file size in MB. When
509 *		specified the log file will be truncated upon reaching
510 *		this limit.
511 *
512 *	qos
513 *		Boolean that specifies whether the OpenSM QoS functionality
514 *		should be off or on.
515 *
516 *	qos_policy_file
517 *		Name of the QoS policy file.
518 *
519 *	accum_log_file
520 *		If TRUE (default) - the log file will be accumulated.
521 *		If FALSE - the log file will be erased before starting
522 *		current opensm run.
523 *
524 *	port_prof_ignore_file
525 *		Name of file with port guids to be ignored by port profiling.
526 *
527 *	port_profile_switch_nodes
528 *		If TRUE will count the number of switch nodes routed through
529 *		the link. If FALSE - only CA/RT nodes are counted.
530 *
531 *	sweep_on_trap
532 *		Received traps will initiate a new sweep.
533 *
534 *	routing_engine_names
535 *		Name of routing engine(s) to use.
536 *
537 *	connect_roots
538 *		The option which will enforce root to root connectivity with
539 *		up/down and fat-tree routing engines (even if this violates
540 *		"pure" deadlock free up/down or fat-tree algorithm)
541 *
542 *	use_ucast_cache
543 *		When TRUE enables unicast routing cache.
544 *
545 *	lid_matrix_dump_file
546 *		Name of the lid matrix dump file from where switch
547 *		lid matrices (min hops tables) will be loaded
548 *
549 *	lfts_file
550 *		Name of the unicast LFTs routing file from where switch
551 *		forwarding tables will be loaded
552 *
553 *	root_guid_file
554 *		Name of the file that contains list of root guids that
555 *		will be used by fat-tree or up/dn routing (provided by User)
556 *
557 *	cn_guid_file
558 *		Name of the file that contains list of compute node guids that
559 *		will be used by fat-tree routing (provided by User)
560 *
561 *	io_guid_file
562 *		Name of the file that contains list of I/O node guids that
563 *		will be used by fat-tree routing (provided by User)
564 *
565 *	port_shifting
566 *		This option will turn on port_shifting in routing.
567 *
568 *	ids_guid_file
569 *		Name of the file that contains list of ids which should be
570 *		used by Up/Down algorithm instead of node GUIDs
571 *
572 *	guid_routing_order_file
573 *		Name of the file that contains list of guids for routing order
574 *		that will be used by minhop and up/dn routing (provided by User).
575 *
576 *	sa_db_file
577 *		Name of the SA database file.
578 *
579 *	sa_db_dump
580 *		When TRUE causes OpenSM to dump SA DB at the end of every
581 *		light sweep regardless the current verbosity level.
582 *
583 *	torus_conf_file
584 *		Name of the file with extra configuration info for torus-2QoS
585 *		routing engine.
586 *
587 *	exit_on_fatal
588 *		If TRUE (default) - SM will exit on fatal subnet initialization
589 *		issues.
590 *		If FALSE - SM will not exit.
591 *		Fatal initialization issues:
592 *		a. SM recognizes 2 different nodes with the same guid, or
593 *		   12x link with lane reversal badly configured.
594 *
595 *	honor_guid2lid_file
596 *		Always honor the guid2lid file if it exists and is valid. This
597 *		means that the file will be honored when SM is coming out of
598 *		STANDBY. By default this is FALSE.
599 *
600 *	daemon
601 *		OpenSM will run in daemon mode.
602 *
603 *	sm_inactive
604 *		OpenSM will start with SM in not active state.
605 *
606 *	babbling_port_policy
607 *		OpenSM will enforce its "babbling" port policy.
608 *
609 *	drop_event_subscriptions
610 *		OpenSM will drop event subscriptions if the port goes away.
611 *
612 *	ipoib_mcgroup_creation_validation
613 *		OpenSM will validate IPoIB non-broadcast group parameters
614 *		against IPoIB broadcast group.
615 *
616 *	mcgroup_join_validation
617 *		OpenSM will validate multicast join parameters against
618 *		multicast group parameters when MC group already exists.
619 *
620 *	use_optimized_slvl
621 *		Use optimized SLtoVLMappingTable programming if
622 *		device indicates it supports this.
623 *
624 *	fsync_high_avail_files
625 *		Synchronize high availability in memory files
626 *		with storage.
627 *
628 *	perfmgr
629 *		Enable or disable the performance manager
630 *
631 *	perfmgr_redir
632 *		Enable or disable the saving of redirection by PerfMgr
633 *
634 *	perfmgr_sweep_time_s
635 *		Define the period (in seconds) of PerfMgr sweeps
636 *
637 *       event_db_dump_file
638 *               File to dump the event database to
639 *
640 *       event_plugin_name
641 *               Specify the name(s) of the event plugin(s)
642 *
643 *       event_plugin_options
644 *               Options string that would be passed to the plugin(s)
645 *
646 *	qos_options
647 *		Default set of QoS options
648 *
649 *	qos_ca_options
650 *		QoS options for CA ports
651 *
652 *	qos_sw0_options
653 *		QoS options for switches' port 0
654 *
655 *	qos_swe_options
656 *		QoS options for switches' external ports
657 *
658 *	qos_rtr_options
659 *		QoS options for router ports
660 *
661 *	congestion_control
662 *		Boolean that specifies whether OpenSM congestion control configuration
663 *		should be off or no.
664 *
665 *	cc_key
666 *		CCkey to use when configuring congestion control.
667 *
668 *	cc_max_outstanding_mads
669 *		Max number of outstanding CC mads that can be on the wire.
670 *
671 *	cc_sw_cong_setting_control_map
672 *		Congestion Control Switch Congestion Setting Control Map
673 *		configuration setting.
674 *
675 *	cc_sw_cong_setting_victim_mask
676 *		Congestion Control Switch Congestion Setting Victim Mask
677 *		configuration setting.
678 *
679 *	cc_sw_cong_setting_credit_mask
680 *		Congestion Control Switch Congestion Setting Credit Mask
681 *		configuration setting.
682 *
683 *	cc_sw_cong_setting_threshold
684 *		Congestion Control Switch Congestion Setting Threshold
685 *		configuration setting.
686 *
687 *	cc_sw_cong_setting_packet_size
688 *		Congestion Control Switch Congestion Setting Packet Size
689 *		configuration setting.
690 *
691 *	cc_sw_cong_setting_credit_starvation_threshold
692 *		Congestion Control Switch Congestion Setting Credit Starvation Threshold
693 *		configuration setting.
694 *
695 *	cc_sw_cong_setting_credit_starvation_return_delay
696 *		Congestion Control Switch Congestion Setting Credit Starvation Return Delay
697 *		configuration setting.
698 *
699 *	cc_sw_cong_setting_marking_rate
700 *		Congestion Control Switch Congestion Setting Marking Rate
701 *		configuration setting.
702 *
703 *	cc_ca_cong_setting_port_control
704 *		Congestion Control CA Congestion Setting Port Control
705 *
706 *	cc_ca_cong_setting_control_map
707 *		Congestion Control CA Congestion Setting Control Map
708 
709 *	cc_ca_cong_entries
710 *		Congestion Control CA Congestion Setting Entries
711 *
712 *	cc_cct
713 *		Congestion Control Table array of entries
714 *
715 *	enable_quirks
716 *		Enable high risk new features and not fully qualified
717 *		hardware specific work arounds
718 *
719 *	no_clients_rereg
720 *		When TRUE disables clients reregistration request
721 *
722 *	scatter_ports
723 *		When not zero, randomize best possible ports chosen
724 *		for a route. The value is used as a random key seed.
725 *
726 *	per_module_logging_file
727 *		File name of per module logging configuration.
728 *
729 * SEE ALSO
730 *	Subnet object
731 *********/
732 
733 /****s* OpenSM: Subnet/osm_subn_t
734 * NAME
735 *	osm_subn_t
736 *
737 * DESCRIPTION
738 *	Subnet structure.  Callers may directly access member components,
739 *	after grabbing a lock.
740 *
741 * TO DO
742 *	This structure should probably be volatile.
743 *
744 * SYNOPSIS
745 */
746 typedef struct osm_subn {
747 	struct osm_opensm *p_osm;
748 	cl_qmap_t sw_guid_tbl;
749 	cl_qmap_t node_guid_tbl;
750 	cl_qmap_t port_guid_tbl;
751 	cl_qmap_t alias_port_guid_tbl;
752 	cl_qmap_t assigned_guids_tbl;
753 	cl_qmap_t rtr_guid_tbl;
754 	cl_qlist_t prefix_routes_list;
755 	cl_qmap_t prtn_pkey_tbl;
756 	cl_qmap_t sm_guid_tbl;
757 	cl_qlist_t sa_sr_list;
758 	cl_qlist_t sa_infr_list;
759 	cl_qlist_t alias_guid_list;
760 	cl_ptr_vector_t port_lid_tbl;
761 	ib_net16_t master_sm_base_lid;
762 	ib_net16_t sm_base_lid;
763 	ib_net64_t sm_port_guid;
764 	uint8_t last_sm_port_state;
765 	uint8_t sm_state;
766 	osm_subn_opt_t opt;
767 	struct osm_qos_policy *p_qos_policy;
768 	uint16_t max_ucast_lid_ho;
769 	uint16_t max_mcast_lid_ho;
770 	uint8_t min_ca_mtu;
771 	uint8_t min_ca_rate;
772 	uint8_t min_data_vls;
773 	uint8_t min_sw_data_vls;
774 	boolean_t ignore_existing_lfts;
775 	boolean_t subnet_initialization_error;
776 	boolean_t force_heavy_sweep;
777 	boolean_t force_reroute;
778 	boolean_t in_sweep_hop_0;
779 	boolean_t force_first_time_master_sweep;
780 	boolean_t first_time_master_sweep;
781 	boolean_t coming_out_of_standby;
782 	boolean_t sweeping_enabled;
783 	unsigned need_update;
784 	cl_fmap_t mgrp_mgid_tbl;
785 	osm_db_domain_t *p_g2m;
786 	osm_db_domain_t *p_neighbor;
787 	void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
788 } osm_subn_t;
789 /*
790 * FIELDS
791 *	sw_guid_tbl
792 *		Container of pointers to all Switch objects in the subnet.
793 *		Indexed by node GUID.
794 *
795 *	node_guid_tbl
796 *		Container of pointers to all Node objects in the subnet.
797 *		Indexed by node GUID.
798 *
799 *	port_guid_tbl
800 *		Container of pointers to all Port objects in the subnet.
801 *		Indexed by port GUID.
802 *
803 *	rtr_guid_tbl
804 *		Container of pointers to all Router objects in the subnet.
805 *		Indexed by node GUID.
806 *
807 *	prtn_pkey_tbl
808 *		Container of pointers to all Partition objects in the subnet.
809 *		Indexed by P_KEY.
810 *
811 *	sm_guid_tbl
812 *		Container of pointers to SM objects representing other SMs
813 *		on the subnet.
814 *
815 *	port_lid_tbl
816 *		Container of pointers to all Port objects in the subnet.
817 *		Indexed by port LID.
818 *
819 *	master_sm_base_lid
820 *		The base LID owned by the subnet's master SM.
821 *
822 *	sm_base_lid
823 *		The base LID of the local port where the SM is.
824 *
825 *	sm_port_guid
826 *		This SM's own port GUID.
827 *
828 *	last_sm_port_state
829 *		Last state of this SM's port.
830 *		0 is down and 1 is up.
831 *
832 *	sm_state
833 *		The high-level state of the SM.  This value is made available
834 *		in the SMInfo attribute.
835 *
836 *	opt
837 *		Subnet options structure contains site specific configuration.
838 *
839 *	p_qos_policy
840 *		Subnet QoS policy structure.
841 *
842 *	max_ucast_lid_ho
843 *		The minimal max unicast lid reported by all switches
844 *
845 *	max_mcast_lid_ho
846 *		The minimal max multicast lid reported by all switches
847 *
848 *	min_ca_mtu
849 *		The minimal MTU reported by all CAs ports on the subnet
850 *
851 *	min_ca_rate
852 *		The minimal rate reported by all CA ports on the subnet
853 *
854 *	ignore_existing_lfts
855 *		This flag is a dynamic flag to instruct the LFT assignment to
856 *		ignore existing legal LFT settings.
857 *		The value will be set according to :
858 *		- Any change to the list of switches will set it to high
859 *		- Coming out of STANDBY it will be cleared (other SM worked)
860 *		- Set to FALSE upon end of all lft assignments.
861 *
862 *	subnet_initalization_error
863 *		Similar to the force_heavy_sweep flag. If TRUE - means that
864 *		we had errors during initialization (due to SubnSet requests
865 *		that failed). We want to declare the subnet as unhealthy, and
866 *		force another heavy sweep.
867 *
868 *	force_heavy_sweep
869 *		If TRUE - we want to force a heavy sweep. This can be done
870 *		either due to receiving of trap - meaning there is some change
871 *		on the subnet, or we received a handover from a remote sm.
872 *		In this case we want to sweep and reconfigure the entire
873 *		subnet. This will cause another heavy sweep to occure when
874 *		the current sweep is done.
875 *
876 *	force_reroute
877 *		If TRUE - we want to force switches in the fabric to be
878 *		rerouted.
879 *
880 *	in_sweep_hop_0
881 *		When in_sweep_hop_0 flag is set to TRUE - this means we are
882 *		in sweep_hop_0 - meaning we do not want to continue beyond
883 *		the current node.
884 *		This is relevant for the case of SM on switch, since in the
885 *		switch info we need to signal somehow not to continue
886 *		the sweeping.
887 *
888 *	force_first_time_master_sweep
889 *		This flag is used to avoid race condition when Master SM being
890 *		in the middle of very long configuration stage of the heavy sweep,
891 *		receives HANDOVER from another MASTER SM. When the current heavy sweep
892 *		is finished, new heavy sweep will be started immediately.
893 *		At the beginning of the sweep, opensm will set first_time_master_sweep,
894 *		force_heavy_sweep and coming_out_of_standby flags in order to allow full
895 *		reconfiguration of the fabric. This is required as another MASTER SM could
896 *		change configuration of the fabric before sending HANDOVER to MASTER SM.
897 *
898 *	first_time_master_sweep
899 *		This flag is used for the PortInfo setting. On the first
900 *		sweep as master (meaning after moving from Standby|Discovering
901 *		state), the SM must send a PortInfoSet to all ports. After
902 *		that - we want to minimize the number of PortInfoSet requests
903 *		sent, and to send only requests that change the value from
904 *		what is updated in the port (or send a first request if this
905 *		is a new port). We will set this flag to TRUE when entering
906 *		the master state, and set it back to FALSE at the end of the
907 *		drop manager. This is done since at the end of the drop manager
908 *		we have updated all the ports that are reachable, and from now
909 *		on these are the only ports we have data of. We don't want
910 *		to send extra set requests to these ports anymore.
911 *
912 *	coming_out_of_standby
913 *		TRUE on the first sweep after the SM was in standby.
914 *		Used for nulling any cache of LID and Routing.
915 *		The flag is set true if the SM state was standby and now
916 *		changed to MASTER it is reset at the end of the sweep.
917 *
918 *	sweeping_enabled
919 *		FALSE - sweeping is administratively disabled, all
920 *		sweeping is inhibited, TRUE - sweeping is done
921 *		normally
922 *
923 *	need_update
924 *		This flag should be on during first non-master heavy
925 *		(including pre-master discovery stage)
926 *
927 *	mgrp_mgid_tbl
928 *		Container of pointers to all Multicast group objects in
929 *		the subnet. Indexed by MGID.
930 *
931 *	mboxes
932 *		Array of pointers to all Multicast MLID box objects in the
933 *		subnet. Indexed by MLID offset from base MLID.
934 *
935 * SEE ALSO
936 *	Subnet object
937 *********/
938 
939 /****s* OpenSM: Subnet/osm_assigned_guids_t
940 * NAME
941 *	osm_assigned_guids_t
942 *
943 * DESCRIPTION
944 *	SA assigned GUIDs structure.
945 *
946 * SYNOPSIS
947 */
948 typedef struct osm_assigned_guids {
949 	cl_map_item_t map_item;
950 	ib_net64_t port_guid;
951 	ib_net64_t assigned_guid[1];
952 } osm_assigned_guids_t;
953 /*
954 * FIELDS
955 *	map_item
956 *		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
957 *
958 *	port_guid
959 *		Base port GUID.
960 *
961 *	assigned_guids
962 *		Table of persistent SA assigned GUIDs.
963 *
964 * SEE ALSO
965 *	Subnet object
966 *********/
967 
968 /****f* OpenSM: Subnet/osm_subn_construct
969 * NAME
970 *	osm_subn_construct
971 *
972 * DESCRIPTION
973 *	This function constructs a Subnet object.
974 *
975 * SYNOPSIS
976 */
977 void osm_subn_construct(IN osm_subn_t * p_subn);
978 /*
979 * PARAMETERS
980 *	p_subn
981 *		[in] Pointer to a Subnet object to construct.
982 *
983 * RETURN VALUE
984 *	This function does not return a value.
985 *
986 * NOTES
987 *	Allows calling osm_subn_init, and osm_subn_destroy.
988 *
989 *	Calling osm_subn_construct is a prerequisite to calling any other
990 *	method except osm_subn_init.
991 *
992 * SEE ALSO
993 *	Subnet object, osm_subn_init, osm_subn_destroy
994 *********/
995 
996 /****f* OpenSM: Subnet/osm_subn_destroy
997 * NAME
998 *	osm_subn_destroy
999 *
1000 * DESCRIPTION
1001 *	The osm_subn_destroy function destroys a subnet, releasing
1002 *	all resources.
1003 *
1004 * SYNOPSIS
1005 */
1006 void osm_subn_destroy(IN osm_subn_t * p_subn);
1007 /*
1008 * PARAMETERS
1009 *	p_subn
1010 *		[in] Pointer to a Subnet object to destroy.
1011 *
1012 * RETURN VALUE
1013 *	This function does not return a value.
1014 *
1015 * NOTES
1016 *	Performs any necessary cleanup of the specified Subnet object.
1017 *	Further operations should not be attempted on the destroyed object.
1018 *	This function should only be called after a call to osm_subn_construct
1019 *	or osm_subn_init.
1020 *
1021 * SEE ALSO
1022 *	Subnet object, osm_subn_construct, osm_subn_init
1023 *********/
1024 
1025 /****f* OpenSM: Subnet/osm_subn_init
1026 * NAME
1027 *	osm_subn_init
1028 *
1029 * DESCRIPTION
1030 *	The osm_subn_init function initializes a Subnet object for use.
1031 *
1032 * SYNOPSIS
1033 */
1034 ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn,
1035 			      IN struct osm_opensm *p_osm,
1036 			      IN const osm_subn_opt_t * p_opt);
1037 /*
1038 * PARAMETERS
1039 *	p_subn
1040 *		[in] Pointer to an osm_subn_t object to initialize.
1041 *
1042 *	p_opt
1043 *		[in] Pointer to the subnet options structure.
1044 *
1045 * RETURN VALUES
1046 *	IB_SUCCESS if the Subnet object was initialized successfully.
1047 *
1048 * NOTES
1049 *	Allows calling other Subnet methods.
1050 *
1051 * SEE ALSO
1052 *	Subnet object, osm_subn_construct, osm_subn_destroy
1053 *********/
1054 
1055 /*
1056   Forward references.
1057 */
1058 struct osm_mad_addr;
1059 struct osm_log;
1060 struct osm_switch;
1061 struct osm_physp;
1062 struct osm_port;
1063 struct osm_mgrp;
1064 
1065 /****f* OpenSM: Helper/osm_get_gid_by_mad_addr
1066 * NAME
1067 *	osm_get_gid_by_mad_addr
1068 *
1069 * DESCRIPTION
1070 *	Looks for the requester gid in the mad address.
1071 *
1072 * Note: This code is not thread safe. Need to grab the lock before
1073 * calling it.
1074 *
1075 * SYNOPSIS
1076 */
1077 ib_api_status_t osm_get_gid_by_mad_addr(IN struct osm_log *p_log,
1078 					IN const osm_subn_t * p_subn,
1079 					IN struct osm_mad_addr *p_mad_addr,
1080 					OUT ib_gid_t * p_gid);
1081 /*
1082 * PARAMETERS
1083 *	p_log
1084 *		[in] Pointer to a log object.
1085 *
1086 *	p_subn
1087 *		[in] Pointer to subnet object.
1088 *
1089 *	p_mad_addr
1090 *		[in] Pointer to mad address object.
1091 *
1092 *	p_gid
1093 *		[out] Pointer to the GID structure to fill in.
1094 *
1095 * RETURN VALUES
1096 *     IB_SUCCESS if able to find the GID by address given.
1097 *
1098 * NOTES
1099 *
1100 * SEE ALSO
1101 *********/
1102 
1103 /****f* OpenSM: Helper/osm_get_physp_by_mad_addr
1104 * NAME
1105 *	osm_get_physp_by_mad_addr
1106 *
1107 * DESCRIPTION
1108 *	Looks for the requester physical port in the mad address.
1109 *
1110 * Note: This code is not thread safe. Need to grab the lock before
1111 * calling it.
1112 *
1113 * SYNOPSIS
1114 */
1115 struct osm_physp *osm_get_physp_by_mad_addr(IN struct osm_log *p_log,
1116 					     IN const osm_subn_t * p_subn,
1117 					     IN struct osm_mad_addr
1118 					     *p_mad_addr);
1119 /*
1120 * PARAMETERS
1121 *	p_log
1122 *		[in] Pointer to a log object.
1123 *
1124 *	p_subn
1125 *		[in] Pointer to subnet object.
1126 *
1127 *	p_mad_addr
1128 *		[in] Pointer to mad address object.
1129 *
1130 * RETURN VALUES
1131 *	Pointer to requester physical port object if found. Null otherwise.
1132 *
1133 * NOTES
1134 *
1135 * SEE ALSO
1136 *********/
1137 
1138 /****f* OpenSM: Helper/osm_get_port_by_mad_addr
1139 * NAME
1140 *	osm_get_port_by_mad_addr
1141 *
1142 * DESCRIPTION
1143 *	Looks for the requester port in the mad address.
1144 *
1145 * Note: This code is not thread safe. Need to grab the lock before
1146 * calling it.
1147 *
1148 * SYNOPSIS
1149 */
1150 struct osm_port *osm_get_port_by_mad_addr(IN struct osm_log *p_log,
1151 					   IN const osm_subn_t * p_subn,
1152 					   IN struct osm_mad_addr *p_mad_addr);
1153 /*
1154 * PARAMETERS
1155 *	p_log
1156 *		[in] Pointer to a log object.
1157 *
1158 *	p_subn
1159 *		[in] Pointer to subnet object.
1160 *
1161 *	p_mad_addr
1162 *		[in] Pointer to mad address object.
1163 *
1164 * RETURN VALUES
1165 *	Pointer to requester port object if found. Null otherwise.
1166 *
1167 * NOTES
1168 *
1169 * SEE ALSO
1170 *********/
1171 
1172 /****f* OpenSM: Subnet/osm_get_switch_by_guid
1173 * NAME
1174 *	osm_get_switch_by_guid
1175 *
1176 * DESCRIPTION
1177 *	Looks for the given switch guid in the subnet table of switches by guid.
1178 *  NOTE: this code is not thread safe. Need to grab the lock before
1179 *  calling it.
1180 *
1181 * SYNOPSIS
1182 */
1183 struct osm_switch *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,
1184 					  IN ib_net64_t guid);
1185 /*
1186 * PARAMETERS
1187 *	p_subn
1188 *		[in] Pointer to an osm_subn_t object
1189 *
1190 *	guid
1191 *		[in] The node guid in network byte order
1192 *
1193 * RETURN VALUES
1194 *	The switch structure pointer if found. NULL otherwise.
1195 *
1196 * SEE ALSO
1197 *	Subnet object, osm_subn_construct, osm_subn_destroy,
1198 *	osm_switch_t
1199 *********/
1200 
1201 /****f* OpenSM: Subnet/osm_get_node_by_guid
1202 * NAME
1203 *	osm_get_node_by_guid
1204 *
1205 * DESCRIPTION
1206 *	This looks for the given node guid in the subnet table of nodes by guid.
1207 *  NOTE: this code is not thread safe. Need to grab the lock before
1208 *  calling it.
1209 *
1210 * SYNOPSIS
1211 */
1212 struct osm_node *osm_get_node_by_guid(IN osm_subn_t const *p_subn,
1213 				      IN ib_net64_t guid);
1214 /*
1215 * PARAMETERS
1216 *	p_subn
1217 *		[in] Pointer to an osm_subn_t object
1218 *
1219 *	guid
1220 *		[in] The node guid in network byte order
1221 *
1222 * RETURN VALUES
1223 *	The node structure pointer if found. NULL otherwise.
1224 *
1225 * SEE ALSO
1226 *	Subnet object, osm_subn_construct, osm_subn_destroy,
1227 *	osm_node_t
1228 *********/
1229 
1230 /****f* OpenSM: Subnet/osm_get_port_by_guid
1231 * NAME
1232 *	osm_get_port_by_guid
1233 *
1234 * DESCRIPTION
1235 *	This looks for the given port guid in the subnet table of ports by guid.
1236 *  NOTE: this code is not thread safe. Need to grab the lock before
1237 *  calling it.
1238 *
1239 * SYNOPSIS
1240 */
1241 struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn,
1242 				      IN ib_net64_t guid);
1243 /*
1244 * PARAMETERS
1245 *	p_subn
1246 *		[in] Pointer to an osm_subn_t object
1247 *
1248 *	guid
1249 *		[in] The port guid in network order
1250 *
1251 * RETURN VALUES
1252 *	The port structure pointer if found. NULL otherwise.
1253 *
1254 * SEE ALSO
1255 *	Subnet object, osm_subn_construct, osm_subn_destroy,
1256 *	osm_port_t
1257 *********/
1258 
1259 /****f* OpenSM: Port/osm_get_port_by_lid_ho
1260 * NAME
1261 *	osm_get_port_by_lid_ho
1262 *
1263 * DESCRIPTION
1264 *	Returns a pointer of the port object for given lid value.
1265 *
1266 * SYNOPSIS
1267 */
1268 struct osm_port *osm_get_port_by_lid_ho(const osm_subn_t * subn, uint16_t lid);
1269 /*
1270 * PARAMETERS
1271 *	subn
1272 *		[in] Pointer to the subnet data structure.
1273 *
1274 *	lid
1275 *		[in] LID requested in host byte order.
1276 *
1277 * RETURN VALUES
1278 *	The port structure pointer if found. NULL otherwise.
1279 *
1280 * SEE ALSO
1281 *       Subnet object, osm_port_t
1282 *********/
1283 
1284 /****f* OpenSM: Subnet/osm_get_alias_guid_by_guid
1285 * NAME
1286 *	osm_get_alias_guid_by_guid
1287 *
1288 * DESCRIPTION
1289 *	This looks for the given port guid in the subnet table of ports by
1290 *	alias guid.
1291 *  NOTE: this code is not thread safe. Need to grab the lock before
1292 *  calling it.
1293 *
1294 * SYNOPSIS
1295 */
1296 struct osm_alias_guid *osm_get_alias_guid_by_guid(IN osm_subn_t const *p_subn,
1297 						  IN ib_net64_t guid);
1298 /*
1299 * PARAMETERS
1300 *	p_subn
1301 *		[in] Pointer to an osm_subn_t object
1302 *
1303 *	guid
1304 *		[in] The alias port guid in network order
1305 *
1306 * RETURN VALUES
1307 *	The alias guid structure pointer if found. NULL otherwise.
1308 *
1309 * SEE ALSO
1310 *	Subnet object, osm_subn_construct, osm_subn_destroy,
1311 *	osm_alias_guid_t
1312 *********/
1313 
1314 /****f* OpenSM: Subnet/osm_get_port_by_alias_guid
1315 * NAME
1316 *	osm_get_port_by_alias_guid
1317 *
1318 * DESCRIPTION
1319 *	This looks for the given port guid in the subnet table of ports by
1320 *	alias guid.
1321 *  NOTE: this code is not thread safe. Need to grab the lock before
1322 *  calling it.
1323 *
1324 * SYNOPSIS
1325 */
1326 struct osm_port *osm_get_port_by_alias_guid(IN osm_subn_t const *p_subn,
1327 					    IN ib_net64_t guid);
1328 /*
1329 * PARAMETERS
1330 *	p_subn
1331 *		[in] Pointer to an osm_subn_t object
1332 *
1333 *	guid
1334 *		[in] The alias port guid in network order
1335 *
1336 * RETURN VALUES
1337 *	The port structure pointer if found. NULL otherwise.
1338 *
1339 * SEE ALSO
1340 *	Subnet object, osm_subn_construct, osm_subn_destroy,
1341 *	osm_port_t
1342 *********/
1343 
1344 /****f* OpenSM: Port/osm_assigned_guids_new
1345 * NAME
1346 *	osm_assigned_guids_new
1347 *
1348 * DESCRIPTION
1349 *	This function allocates and initializes an assigned guids object.
1350 *
1351 * SYNOPSIS
1352 */
1353 osm_assigned_guids_t *osm_assigned_guids_new(IN const ib_net64_t port_guid,
1354 					     IN const uint32_t num_guids);
1355 /*
1356 * PARAMETERS
1357 *       port_guid
1358 *               [in] Base port GUID in network order
1359 *
1360 * RETURN VALUE
1361 *       Pointer to the initialized assigned alias guid object.
1362 *
1363 * SEE ALSO
1364 *	Subnet object, osm_assigned_guids_t, osm_assigned_guids_delete,
1365 *	osm_get_assigned_guids_by_guid
1366 *********/
1367 
1368 /****f* OpenSM: Port/osm_assigned_guids_delete
1369 * NAME
1370 *	osm_assigned_guids_delete
1371 *
1372 * DESCRIPTION
1373 *	This function destroys and deallocates an assigned guids object.
1374 *
1375 * SYNOPSIS
1376 */
1377 void osm_assigned_guids_delete(IN OUT osm_assigned_guids_t ** pp_assigned_guids);
1378 /*
1379 * PARAMETERS
1380 *       pp_assigned_guids
1381 *		[in][out] Pointer to a pointer to an assigned guids object to delete.
1382 *		On return, this pointer is NULL.
1383 *
1384 * RETURN VALUE
1385 *	This function does not return a value.
1386 *
1387 * NOTES
1388 *	Performs any necessary cleanup of the specified assigned guids object.
1389 *
1390 * SEE ALSO
1391 *	Subnet object, osm_assigned_guids_new, osm_get_assigned_guids_by_guid
1392 *********/
1393 
1394 /****f* OpenSM: Subnet/osm_get_assigned_guids_by_guid
1395 * NAME
1396 *	osm_get_assigned_guids_by_guid
1397 *
1398 * DESCRIPTION
1399 *	This looks for the given port guid and returns a pointer
1400 *	to the guid table of SA assigned alias guids for that port.
1401 *
1402 * SYNOPSIS
1403 */
1404 osm_assigned_guids_t *osm_get_assigned_guids_by_guid(IN osm_subn_t const *p_subn,
1405 						     IN ib_net64_t port_guid);
1406 /*
1407 * PARAMETERS
1408 *	p_subn
1409 *		[in] Pointer to an osm_subn_t object
1410 *
1411 *	port_guid
1412 *		[in] The base port guid in network order
1413 *
1414 * RETURN VALUES
1415 *	The osm_assigned_guids structure pointer if found. NULL otherwise.
1416 *
1417 * SEE ALSO
1418 *	Subnet object, osm_assigned_guids_new, osm_assigned_guids_delete,
1419 *	osm_assigned_guids_t
1420 *********/
1421 
1422 /****f* OpenSM: Port/osm_get_port_by_lid
1423 * NAME
1424 *	osm_get_port_by_lid
1425 *
1426 * DESCRIPTION
1427 *	Returns a pointer of the port object for given lid value.
1428 *
1429 * SYNOPSIS
1430 */
osm_get_port_by_lid(IN osm_subn_t const * subn,IN ib_net16_t lid)1431 static inline struct osm_port *osm_get_port_by_lid(IN osm_subn_t const * subn,
1432 						   IN ib_net16_t lid)
1433 {
1434 	return osm_get_port_by_lid_ho(subn, cl_ntoh16(lid));
1435 }
1436 /*
1437 * PARAMETERS
1438 *	subn
1439 *		[in] Pointer to the subnet data structure.
1440 *
1441 *	lid
1442 *		[in] LID requested in network byte order.
1443 *
1444 * RETURN VALUES
1445 *	The port structure pointer if found. NULL otherwise.
1446 *
1447 * SEE ALSO
1448 *       Subnet object, osm_port_t
1449 *********/
1450 
1451 /****f* OpenSM: Subnet/osm_get_mgrp_by_mgid
1452 * NAME
1453 *	osm_get_mgrp_by_mgid
1454 *
1455 * DESCRIPTION
1456 *	This looks for the given multicast group in the subnet table by mgid.
1457 *	NOTE: this code is not thread safe. Need to grab the lock before
1458 *	calling it.
1459 *
1460 * SYNOPSIS
1461 */
1462 struct osm_mgrp *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid);
1463 /*
1464 * PARAMETERS
1465 *	subn
1466 *		[in] Pointer to an osm_subn_t object
1467 *
1468 *	mgid
1469 *		[in] The multicast group MGID value
1470 *
1471 * RETURN VALUES
1472 *	The multicast group structure pointer if found. NULL otherwise.
1473 *********/
1474 
1475 /****f* OpenSM: Subnet/osm_get_mbox_by_mlid
1476 * NAME
1477 *	osm_get_mbox_by_mlid
1478 *
1479 * DESCRIPTION
1480 *	This looks for the given multicast group in the subnet table by mlid.
1481 *	NOTE: this code is not thread safe. Need to grab the lock before
1482 *	calling it.
1483 *
1484 * SYNOPSIS
1485 */
osm_get_mbox_by_mlid(osm_subn_t const * p_subn,ib_net16_t mlid)1486 static inline struct osm_mgrp_box *osm_get_mbox_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
1487 {
1488 	return (struct osm_mgrp_box *)p_subn->mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
1489 }
1490 /*
1491 * PARAMETERS
1492 *	p_subn
1493 *		[in] Pointer to an osm_subn_t object
1494 *
1495 *	mlid
1496 *		[in] The multicast group mlid in network order
1497 *
1498 * RETURN VALUES
1499 *	The multicast group structure pointer if found. NULL otherwise.
1500 *********/
1501 
1502 int is_mlnx_ext_port_info_supported(ib_net32_t vendid, ib_net16_t devid);
1503 
1504 /****f* OpenSM: Subnet/osm_subn_set_default_opt
1505 * NAME
1506 *	osm_subn_set_default_opt
1507 *
1508 * DESCRIPTION
1509 *	The osm_subn_set_default_opt function sets the default options.
1510 *
1511 * SYNOPSIS
1512 */
1513 void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt);
1514 /*
1515 * PARAMETERS
1516 *
1517 *	p_opt
1518 *		[in] Pointer to the subnet options structure.
1519 *
1520 * RETURN VALUES
1521 *	None
1522 *
1523 * NOTES
1524 *
1525 * SEE ALSO
1526 *	Subnet object, osm_subn_construct, osm_subn_destroy
1527 *********/
1528 
1529 /****f* OpenSM: Subnet/osm_subn_parse_conf_file
1530 * NAME
1531 *	osm_subn_parse_conf_file
1532 *
1533 * DESCRIPTION
1534 *	The osm_subn_parse_conf_file function parses the configuration file
1535 *	and sets the defaults accordingly.
1536 *
1537 * SYNOPSIS
1538 */
1539 int osm_subn_parse_conf_file(const char *conf_file, osm_subn_opt_t * p_opt);
1540 /*
1541 * PARAMETERS
1542 *
1543 *	p_opt
1544 *		[in] Pointer to the subnet options structure.
1545 *
1546 * RETURN VALUES
1547 *	0 on success, positive value if file doesn't exist,
1548 *	negative value otherwise
1549 *********/
1550 
1551 /****f* OpenSM: Subnet/osm_subn_rescan_conf_files
1552 * NAME
1553 *	osm_subn_rescan_conf_files
1554 *
1555 * DESCRIPTION
1556 *	The osm_subn_rescan_conf_files function parses the configuration
1557 *	files and update selected subnet options
1558 *
1559 * SYNOPSIS
1560 */
1561 int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn);
1562 /*
1563 * PARAMETERS
1564 *
1565 *	p_subn
1566 *		[in] Pointer to the subnet structure.
1567 *
1568 * RETURN VALUES
1569 *	0 on success, positive value if file doesn't exist,
1570 *	negative value otherwise
1571 *
1572 *********/
1573 
1574 /****f* OpenSM: Subnet/osm_subn_output_conf
1575 * NAME
1576 *	osm_subn_output_conf
1577 *
1578 * DESCRIPTION
1579 *	Output configuration info
1580 *
1581 * SYNOPSIS
1582 */
1583 void osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opt);
1584 /*
1585 * PARAMETERS
1586 *
1587 *	out
1588 *		[in] File stream to output to.
1589 *
1590 *	p_opt
1591 *		[in] Pointer to the subnet options structure.
1592 *
1593 * RETURN VALUES
1594 *	This method does not return a value
1595 *********/
1596 
1597 /****f* OpenSM: Subnet/osm_subn_write_conf_file
1598 * NAME
1599 *	osm_subn_write_conf_file
1600 *
1601 * DESCRIPTION
1602 *	Write the configuration file into the cache
1603 *
1604 * SYNOPSIS
1605 */
1606 int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * p_opt);
1607 /*
1608 * PARAMETERS
1609 *
1610 *	p_opt
1611 *		[in] Pointer to the subnet options structure.
1612 *
1613 * RETURN VALUES
1614 *	0 on success, negative value otherwise
1615 *
1616 * NOTES
1617 *	Assumes the conf file is part of the cache dir which defaults to
1618 *	OSM_DEFAULT_CACHE_DIR or OSM_CACHE_DIR the name is opensm.opts
1619 *********/
1620 int osm_subn_verify_config(osm_subn_opt_t * p_opt);
1621 
1622 END_C_DECLS
1623 #endif				/* _OSM_SUBNET_H_ */
1624