xref: /NextBSD/contrib/ofed/management/opensm/include/opensm/osm_port.h (revision eb1a5f8de9f7ea602c373a710f531abbf81141c4)
1 /*
2  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
3  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5  *
6  * This software is available to you under a choice of one of two
7  * licenses.  You may choose to be licensed under the terms of the GNU
8  * General Public License (GPL) Version 2, available from the file
9  * COPYING in the main directory of this source tree, or the
10  * OpenIB.org BSD license below:
11  *
12  *     Redistribution and use in source and binary forms, with or
13  *     without modification, are permitted provided that the following
14  *     conditions are met:
15  *
16  *      - Redistributions of source code must retain the above
17  *        copyright notice, this list of conditions and the following
18  *        disclaimer.
19  *
20  *      - Redistributions in binary form must reproduce the above
21  *        copyright notice, this list of conditions and the following
22  *        disclaimer in the documentation and/or other materials
23  *        provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  *
34  */
35 
36 /*
37  * Abstract:
38  * 	Declaration of port related objects.
39  *	These objects comprise an IBA port.
40  *	These objects are part of the OpenSM family of objects.
41  */
42 
43 #ifndef _OSM_PORT_H_
44 #define _OSM_PORT_H_
45 
46 #include <complib/cl_qmap.h>
47 #include <iba/ib_types.h>
48 #include <opensm/osm_base.h>
49 #include <opensm/osm_subnet.h>
50 #include <opensm/osm_madw.h>
51 #include <opensm/osm_path.h>
52 #include <opensm/osm_pkey.h>
53 
54 #ifdef __cplusplus
55 #  define BEGIN_C_DECLS extern "C" {
56 #  define END_C_DECLS   }
57 #else				/* !__cplusplus */
58 #  define BEGIN_C_DECLS
59 #  define END_C_DECLS
60 #endif				/* __cplusplus */
61 
62 BEGIN_C_DECLS
63 /*
64 	Forward references.
65 */
66 struct osm_port;
67 struct osm_node;
68 
69 /****h* OpenSM/Physical Port
70 * NAME
71 *	Physical Port
72 *
73 * DESCRIPTION
74 *	The Physical Port object encapsulates the information needed by the
75 *	OpenSM to manage physical ports.  The OpenSM allocates one Physical Port
76 *	per physical port in the IBA subnet.
77 *
78 *	In a switch, one multiple Physical Port objects share the same port GUID.
79 *	In an end-point, Physical Ports do not share GUID values.
80 *
81 *	The Physical Port is not thread safe, thus callers must provide
82 *	serialization.
83 *
84 *	These objects should be treated as opaque and should be
85 *	manipulated only through the provided functions.
86 *
87 * AUTHOR
88 *	Steve King, Intel
89 *
90 *********/
91 
92 /****s* OpenSM: Physical Port/osm_physp_t
93 * NAME
94 *	osm_physp_t
95 *
96 * DESCRIPTION
97 *	This object represents a physical port on a switch, router or end-point.
98 *
99 *	The osm_physp_t object should be treated as opaque and should
100 *	be manipulated only through the provided functions.
101 *
102 * SYNOPSIS
103 */
104 typedef struct osm_physp {
105 	ib_port_info_t port_info;
106 	ib_net64_t port_guid;
107 	uint8_t port_num;
108 	struct osm_node *p_node;
109 	struct osm_physp *p_remote_physp;
110 	boolean_t healthy;
111 	uint8_t vl_high_limit;
112 	unsigned need_update;
113 	unsigned is_prof_ignored;
114 	osm_dr_path_t dr_path;
115 	osm_pkey_tbl_t pkeys;
116 	ib_vl_arb_table_t vl_arb[4];
117 	cl_ptr_vector_t slvl_by_port;
118 } osm_physp_t;
119 /*
120 * FIELDS
121 *	port_info
122 *		The IBA defined PortInfo data for this port.
123 *
124 *	port_guid
125 *		Port GUID value of this port.  For switches,
126 *		all ports share the same GUID value.
127 *
128 *	port_num
129 *		The port number of this port.  The PortInfo also
130 *		contains a port_number, but that number is not
131 *		the port number of this port, but rather the number
132 *		of the port that received the SMP during discovery.
133 *		Therefore, we must keep a separate record for this
134 *		port's port number.
135 *
136 *	p_node
137 *		Pointer to the parent Node object of this Physical Port.
138 *
139 *	p_remote_physp
140 *		Pointer to the Physical Port on the other side of the wire.
141 *		If this pointer is NULL no link exists at this port.
142 *
143 *	healthy
144 *		Tracks the health of the port. Normally should be TRUE but
145 *		might change as a result of incoming traps indicating the port
146 *		healthy is questionable.
147 *
148 *	vl_high_limit
149 *		PortInfo:VLHighLimit value which installed by QoS manager
150 *		and should be uploaded to port's PortInfo
151 *
152 *	need_update
153 *		When set indicates that port was probably reset and port
154 *		related tables (PKey, SL2VL, VLArb) require refreshing.
155 *
156 *	is_prof_ignored
157 *		When set indicates that switch port will be ignored by
158 *		the link load equalization algorithm.
159 *
160 *	dr_path
161 *		The directed route path to this port.
162 *
163 *	pkeys
164 *		osm_pkey_tbl_t object holding the port PKeys.
165 *
166 *	vl_arb[]
167 *		Each Physical Port has 4 sections of VL Arbitration table.
168 *
169 *	slvl_by_port
170 *		A vector of pointers to the sl2vl tables (ordered by input port).
171 *		Switches have an entry for every other input port (inc SMA=0).
172 *		On CAs only one per port.
173 *
174 * SEE ALSO
175 *	Port
176 *********/
177 
178 /****f* OpenSM: Physical Port/osm_physp_construct
179 * NAME
180 *	osm_physp_construct
181 *
182 * DESCRIPTION
183 *	Constructs a Physical Port.
184 *
185 * SYNOPSIS
186 */
187 void osm_physp_construct(IN osm_physp_t * const p_physp);
188 /*
189 * PARAMETERS
190 *	p_physp
191 *		[in] Pointer to an osm_physp_t object to initialize.
192 *
193 * RETURN VALUES
194 *	This function does not return a value.
195 *
196 * NOTES
197 *
198 * SEE ALSO
199 *	Port, Physical Port
200 *********/
201 
202 /****f* OpenSM: Physical Port/osm_physp_init
203 * NAME
204 *	osm_physp_init
205 *
206 * DESCRIPTION
207 *	Initializes a Physical Port for use.
208 *
209 * SYNOPSIS
210 */
211 void
212 osm_physp_init(IN osm_physp_t * const p_physp,
213 	       IN const ib_net64_t port_guid,
214 	       IN const uint8_t port_num,
215 	       IN const struct osm_node *const p_node,
216 	       IN const osm_bind_handle_t h_bind,
217 	       IN const uint8_t hop_count,
218 	       IN const uint8_t * const p_initial_path);
219 /*
220 * PARAMETERS
221 *	p_physp
222 *		[in] Pointer to an osm_physp_t object to initialize.
223 *
224 *	port_guid
225 *		[in] GUID value of this port.  Switch ports all share
226 *		the same value.
227 *		Caller should use 0 if the guid is unknown.
228 *
229 *	port_num
230 *		[in] The port number of this port.
231 *
232 *	p_node
233 *		[in] Pointer to the parent Node object of this Physical Port.
234 *
235 *	h_bind
236 *		[in] Bind handle on which this port is accessed.
237 *		Caller should use OSM_INVALID_BIND_HANDLE if the bind
238 *		handle to this port is unknown.
239 *
240 *	hop_count
241 *		[in] Directed route hop count to reach this port.
242 *		Caller should use 0 if the hop count is unknown.
243 *
244 *	p_initial_path
245 *		[in] Pointer to the directed route path to reach this node.
246 *		Caller should use NULL if the path is unknown.
247 *
248 * RETURN VALUES
249 *	This function does not return a value.
250 *
251 * NOTES
252 *
253 * SEE ALSO
254 *	Port, Physical Port
255 *********/
256 
257 /****f* OpenSM: Port/void osm_physp_destroy
258 * NAME
259 *	osm_physp_destroy
260 *
261 * DESCRIPTION
262 *	This function destroys a Port object.
263 *
264 * SYNOPSIS
265 */
266 void osm_physp_destroy(IN osm_physp_t * const p_physp);
267 /*
268 * PARAMETERS
269 *	p_port
270 *		[in] Pointer to a PhysPort object to destroy.
271 *
272 * RETURN VALUE
273 *	This function does not return a value.
274 *
275 * NOTES
276 *	Performs any necessary cleanup of the specified PhysPort object.
277 *	Further operations should not be attempted on the destroyed object.
278 *	This function should only be called after a call to osm_physp_construct or
279 *	osm_physp_init.
280 *
281 * SEE ALSO
282 *	Port
283 *********/
284 
285 /****f* OpenSM: Physical Port/osm_physp_is_valid
286 * NAME
287 *	osm_physp_is_valid
288 *
289 * DESCRIPTION
290 *	Returns TRUE if the Physical Port has been successfully initialized.
291 *	FALSE otherwise.
292 *
293 * SYNOPSIS
294 */
osm_physp_is_valid(IN const osm_physp_t * const p_physp)295 static inline boolean_t osm_physp_is_valid(IN const osm_physp_t * const p_physp)
296 {
297 	CL_ASSERT(p_physp);
298 	return (p_physp->port_guid != 0);
299 }
300 
301 /*
302 * PARAMETERS
303 *	p_physp
304 *		[in] Pointer to an osm_physp_t object.
305 *
306 * RETURN VALUES
307 *	Returns TRUE if the Physical Port has been successfully initialized.
308 *	FALSE otherwise.
309 *
310 * NOTES
311 *
312 * SEE ALSO
313 *	Port, Physical Port
314 *********/
315 
316 /****f* OpenSM: Physical Port/osm_physp_is_healthy
317 * NAME
318 *	osm_physp_is_healthy
319 *
320 * DESCRIPTION
321 *	Returns TRUE if the Physical Port has been maked as healthy
322 *	FALSE otherwise.
323 *
324 * SYNOPSIS
325 */
326 static inline boolean_t
osm_physp_is_healthy(IN const osm_physp_t * const p_physp)327 osm_physp_is_healthy(IN const osm_physp_t * const p_physp)
328 {
329 	CL_ASSERT(p_physp);
330 	return (p_physp->healthy);
331 }
332 
333 /*
334 * PARAMETERS
335 *	p_physp
336 *		[in] Pointer to an osm_physp_t object.
337 *
338 * RETURN VALUES
339 *	Returns TRUE if the Physical Port has been maked as healthy
340 *	FALSE otherwise.
341 *  All physical ports are initialized as "healthy" but may be marked
342 *  otherwise if a received trap claims otherwise.
343 *
344 * NOTES
345 *
346 * SEE ALSO
347 *	Port, Physical Port
348 *********/
349 
350 /****f* OpenSM: Physical Port/osm_link_is_healthy
351 * NAME
352 *	osm_link_is_healthy
353 *
354 * DESCRIPTION
355 *	Returns TRUE if the link given by the physical port is health,
356 *  and FALSE otherwise. Link is healthy if both its physical ports are
357 *  healthy
358 *
359 * SYNOPSIS
360 */
361 boolean_t osm_link_is_healthy(IN const osm_physp_t * const p_physp);
362 /*
363 * PARAMETERS
364 *	p_physp
365 *		[in] Pointer to an osm_physp_t object.
366 *
367 * RETURN VALUES
368 *	TRUE if both physical ports on the link are healthy, and FALSE otherwise.
369 *  All physical ports are initialized as "healthy" but may be marked
370 *  otherwise if a received trap claiming otherwise.
371 *
372 * NOTES
373 *
374 * SEE ALSO
375 *	Port, Physical Port
376 *********/
377 
378 /****f* OpenSM: Physical Port/osm_physp_set_health
379 * NAME
380 *	osm_physp_set_health
381 *
382 * DESCRIPTION
383 *	Sets the port health flag. TRUE means the port is healthy and
384 *  should be used for packet routing. FALSE means it should be avoided.
385 *
386 * SYNOPSIS
387 */
388 static inline void
osm_physp_set_health(IN osm_physp_t * const p_physp,IN boolean_t is_healthy)389 osm_physp_set_health(IN osm_physp_t * const p_physp, IN boolean_t is_healthy)
390 {
391 	CL_ASSERT(p_physp);
392 	p_physp->healthy = is_healthy;
393 }
394 
395 /*
396 * PARAMETERS
397 *	p_physp
398 *		[in] Pointer to an osm_physp_t object.
399 *
400 *	is_healthy
401 *		[in] The health value to be assigned to the port.
402 *		     TRUE if the Physical Port should been maked as healthy
403 *		     FALSE otherwise.
404 *
405 * RETURN VALUES
406 *  NONE
407 *
408 * NOTES
409 *
410 * SEE ALSO
411 *	Port, Physical Port
412 *********/
413 
414 /****f* OpenSM: Physical Port/osm_physp_set_port_info
415 * NAME
416 *	osm_physp_set_port_info
417 *
418 * DESCRIPTION
419 *	Copies the PortInfo attribute into the Physical Port object
420 *	based on the PortState.
421 *
422 * SYNOPSIS
423 */
424 static inline void
osm_physp_set_port_info(IN osm_physp_t * const p_physp,IN const ib_port_info_t * const p_pi)425 osm_physp_set_port_info(IN osm_physp_t * const p_physp,
426 			IN const ib_port_info_t * const p_pi)
427 {
428 	CL_ASSERT(p_pi);
429 	CL_ASSERT(osm_physp_is_valid(p_physp));
430 
431 	if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN) {
432 		/* If PortState is down, only copy PortState */
433 		/* and PortPhysicalState per C14-24-2.1 */
434 		ib_port_info_set_port_state(&p_physp->port_info, IB_LINK_DOWN);
435 		ib_port_info_set_port_phys_state
436 		    (ib_port_info_get_port_phys_state(p_pi),
437 		     &p_physp->port_info);
438 	} else {
439 		p_physp->port_info = *p_pi;
440 	}
441 }
442 
443 /*
444 * PARAMETERS
445 *	p_physp
446 *		[in] Pointer to an osm_physp_t object.
447 *
448 *	p_pi
449 *		[in] Pointer to the IBA defined PortInfo at this port number.
450 *
451 * RETURN VALUES
452 *	This function does not return a value.
453 *
454 * NOTES
455 *
456 * SEE ALSO
457 *	Port, Physical Port
458 *********/
459 
460 /****f* OpenSM: Physical Port/osm_physp_set_pkey_tbl
461 * NAME
462 *  osm_physp_set_pkey_tbl
463 *
464 * DESCRIPTION
465 *  Copies the P_Key table into the Physical Port object.
466 *
467 * SYNOPSIS
468 */
469 void
470 osm_physp_set_pkey_tbl(IN osm_log_t * p_log,
471 		       IN const osm_subn_t * p_subn,
472 		       IN osm_physp_t * const p_physp,
473 		       IN ib_pkey_table_t * p_pkey_tbl, IN uint16_t block_num);
474 /*
475 * PARAMETERS
476 *	p_log
477 *		[in] Pointer to a log object.
478 *
479 *	p_subn
480 *		[in] Pointer to the subnet data structure.
481 *
482 *	p_physp
483 *		[in] Pointer to an osm_physp_t object.
484 *
485 *	p_pkey_tbl
486 *		[in] Pointer to the IBA defined P_Key table for this port
487 *		     number.
488 *
489 *	block_num
490 *		[in] The part of the P_Key table as defined in the IBA
491 *		     (valid values 0-2047, and is further limited by the
492 *		     partitionCap).
493 *
494 * RETURN VALUES
495 *  This function does not return a value.
496 *
497 * NOTES
498 *
499 * SEE ALSO
500 *  Port, Physical Port
501 *********/
502 
503 /****f* OpenSM: Physical Port/osm_physp_get_pkey_tbl
504 * NAME
505 *  osm_physp_get_pkey_tbl
506 *
507 * DESCRIPTION
508 *  Returns a pointer to the P_Key table object of the Physical Port object.
509 *
510 * SYNOPSIS
511 */
osm_physp_get_pkey_tbl(IN const osm_physp_t * const p_physp)512 static inline const osm_pkey_tbl_t *osm_physp_get_pkey_tbl(IN const osm_physp_t
513 							   * const p_physp)
514 {
515 	CL_ASSERT(osm_physp_is_valid(p_physp));
516 	/*
517 	   (14.2.5.7) - the block number valid values are 0-2047, and are
518 	   further limited by the size of the P_Key table specified by the
519 	   PartitionCap on the node.
520 	 */
521 	return (&p_physp->pkeys);
522 };
523 
524 /*
525 * PARAMETERS
526 *	p_physp
527 *		[in] Pointer to an osm_physp_t object.
528 *
529 * RETURN VALUES
530 *  The pointer to the P_Key table object.
531 *
532 * NOTES
533 *
534 * SEE ALSO
535 *  Port, Physical Port
536 *********/
537 
538 /****f* OpenSM: Physical Port/osm_physp_set_slvl_tbl
539 * NAME
540 *	osm_physp_set_slvl_tbl
541 *
542 * DESCRIPTION
543 *	Copies the SLtoVL attribute into the Physical Port object.
544 *
545 * SYNOPSIS
546 */
547 static inline void
osm_physp_set_slvl_tbl(IN osm_physp_t * const p_physp,IN ib_slvl_table_t * p_slvl_tbl,IN uint8_t in_port_num)548 osm_physp_set_slvl_tbl(IN osm_physp_t * const p_physp,
549 		       IN ib_slvl_table_t * p_slvl_tbl, IN uint8_t in_port_num)
550 {
551 	ib_slvl_table_t *p_tbl;
552 
553 	CL_ASSERT(p_slvl_tbl);
554 	CL_ASSERT(osm_physp_is_valid(p_physp));
555 	p_tbl = cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);
556 	*p_tbl = *p_slvl_tbl;
557 }
558 
559 /*
560 * PARAMETERS
561 *	p_physp
562 *		[in] Pointer to an osm_physp_t object.
563 *
564 *	p_slvl_tbl
565 *		[in] Pointer to the IBA defined SLtoVL map table for this
566 *		     port number.
567 *
568 *	in_port_num
569 *		[in] Input Port Number for this SLtoVL.
570 *
571 * RETURN VALUES
572 *	This function does not return a value.
573 *
574 * NOTES
575 *
576 * SEE ALSO
577 *	Port, Physical Port
578 *********/
579 
580 /****f* OpenSM: Physical Port/osm_physp_get_slvl_tbl
581 * NAME
582 *	osm_physp_get_slvl_tbl
583 *
584 * DESCRIPTION
585 *	Returns a pointer to the SLtoVL attribute of the Physical Port object.
586 *
587 * SYNOPSIS
588 */
osm_physp_get_slvl_tbl(IN const osm_physp_t * const p_physp,IN uint8_t in_port_num)589 static inline ib_slvl_table_t *osm_physp_get_slvl_tbl(IN const osm_physp_t *
590 						      const p_physp,
591 						      IN uint8_t in_port_num)
592 {
593 	ib_slvl_table_t *p_tbl;
594 
595 	CL_ASSERT(osm_physp_is_valid(p_physp));
596 	p_tbl = cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);
597 	return (p_tbl);
598 }
599 
600 /*
601 * PARAMETERS
602 *	p_physp
603 *		[in] Pointer to an osm_physp_t object.
604 *
605 *	in_port_num
606 *		[in] Input Port Number for this SLtoVL.
607 *
608 * RETURN VALUES
609 *	The pointer to the slvl table
610 *
611 * NOTES
612 *
613 * SEE ALSO
614 *	Port, Physical Port
615 *********/
616 
617 /****f* OpenSM: Physical Port/osm_physp_set_vla_tbl
618 * NAME
619 *	osm_physp_set_vla_tbl
620 *
621 * DESCRIPTION
622 *	Copies the VL Arbitration attribute into the Physical Port object.
623 *
624 * SYNOPSIS
625 */
626 static inline void
osm_physp_set_vla_tbl(IN osm_physp_t * const p_physp,IN ib_vl_arb_table_t * p_vla_tbl,IN uint8_t block_num)627 osm_physp_set_vla_tbl(IN osm_physp_t * const p_physp,
628 		      IN ib_vl_arb_table_t * p_vla_tbl, IN uint8_t block_num)
629 {
630 	CL_ASSERT(p_vla_tbl);
631 	CL_ASSERT(osm_physp_is_valid(p_physp));
632 	CL_ASSERT((1 <= block_num) && (block_num <= 4));
633 	p_physp->vl_arb[block_num - 1] = *p_vla_tbl;
634 }
635 
636 /*
637 * PARAMETERS
638 *	p_physp
639 *		[in] Pointer to an osm_physp_t object.
640 *
641 *	p_vla_tbl
642 *		[in] Pointer to the IBA defined VL Arbitration table for this
643 *		     port number.
644 *
645 *	block_num
646 *		[in] The part of the VL arbitration as defined in the IBA
647 *		     (valid values 1-4)
648 *
649 * RETURN VALUES
650 *	This function does not return a value.
651 *
652 * NOTES
653 *
654 * SEE ALSO
655 *	Port, Physical Port
656 *********/
657 
658 /****f* OpenSM: Physical Port/osm_physp_get_vla_tbl
659 * NAME
660 *	osm_physp_get_vla_tbl
661 *
662 * DESCRIPTION
663 *	Returns a pointer to the VL Arbitration table of the Physical Port object.
664 *
665 * SYNOPSIS
666 */
osm_physp_get_vla_tbl(IN osm_physp_t * const p_physp,IN uint8_t block_num)667 static inline ib_vl_arb_table_t *osm_physp_get_vla_tbl(IN osm_physp_t *
668 						       const p_physp,
669 						       IN uint8_t block_num)
670 {
671 	CL_ASSERT(osm_physp_is_valid(p_physp));
672 	CL_ASSERT((1 <= block_num) && (block_num <= 4));
673 	return (&(p_physp->vl_arb[block_num - 1]));
674 }
675 
676 /*
677 * PARAMETERS
678 *	p_physp
679 *		[in] Pointer to an osm_physp_t object.
680 *
681 *	block_num
682 *		[in] The part of the VL arbitration as defined in the IBA
683 *		     (valid values 1-4)
684 *
685 * RETURN VALUES
686 *  The pointer to the VL Arbitration table
687 *
688 * NOTES
689 *
690 * SEE ALSO
691 *	Port, Physical Port
692 *********/
693 
694 /****f* OpenSM: Physical Port/osm_physp_get_remote
695 * NAME
696 *	osm_physp_get_remote
697 *
698 * DESCRIPTION
699 *	Returns a pointer to the Physical Port on the other side the wire.
700 *
701 * SYNOPSIS
702 */
osm_physp_get_remote(IN const osm_physp_t * const p_physp)703 static inline osm_physp_t *osm_physp_get_remote(IN const osm_physp_t *
704 						const p_physp)
705 {
706 	CL_ASSERT(osm_physp_is_valid(p_physp));
707 	return (p_physp->p_remote_physp);
708 }
709 
710 /*
711 * PARAMETERS
712 *	p_physp
713 *		[in] Pointer to an osm_physp_t object.
714 *
715 * RETURN VALUES
716 *	Returns a pointer to the Physical Port on the other side of
717 *	the wire.  A return value of NULL means there is no link at this port.
718 *
719 * NOTES
720 *
721 * SEE ALSO
722 *	Port, Physical Port
723 *********/
724 
725 /****f* OpenSM: Physical Port/osm_physp_get_port_guid
726 * NAME
727 *	osm_physp_get_port_guid
728 *
729 * DESCRIPTION
730 *	Returns the port guid of this physical port.
731 *
732 * SYNOPSIS
733 */
734 static inline ib_net64_t
osm_physp_get_port_guid(IN const osm_physp_t * const p_physp)735 osm_physp_get_port_guid(IN const osm_physp_t * const p_physp)
736 {
737 	CL_ASSERT(osm_physp_is_valid(p_physp));
738 	return (p_physp->port_guid);
739 }
740 
741 /*
742 * PARAMETERS
743 *	p_physp
744 *		[in] Pointer to an osm_physp_t object.
745 *
746 * RETURN VALUES
747 *	Returns the port guid of this physical port.
748 *
749 * NOTES
750 *
751 * SEE ALSO
752 *	Port, Physical Port
753 *********/
754 
755 /****f* OpenSM: Physical Port/osm_physp_get_subnet_prefix
756 * NAME
757 *	osm_physp_get_subnet_prefix
758 *
759 * DESCRIPTION
760 *	Returns the subnet prefix for this physical port.
761 *
762 * SYNOPSIS
763 */
764 static inline ib_net64_t
osm_physp_get_subnet_prefix(IN const osm_physp_t * const p_physp)765 osm_physp_get_subnet_prefix(IN const osm_physp_t * const p_physp)
766 {
767 	CL_ASSERT(osm_physp_is_valid(p_physp));
768 	return (p_physp->port_info.subnet_prefix);
769 }
770 
771 /*
772 * PARAMETERS
773 *	p_physp
774 *		[in] Pointer to an osm_physp_t object.
775 *
776 * RETURN VALUES
777 *	Returns the subnet prefix for this physical port.
778 *
779 * NOTES
780 *
781 * SEE ALSO
782 *	Port, Physical Port
783 *********/
784 
785 /****f* OpenSM: Physical Port/osm_physp_link_exists
786 * NAME
787 *	osm_physp_link_exists
788 *
789 * DESCRIPTION
790 *	Returns TRUE if the Physical Port has a link to the specified port.
791 *	FALSE otherwise.
792 *
793 * SYNOPSIS
794 */
795 static inline boolean_t
osm_physp_link_exists(IN const osm_physp_t * const p_physp,IN const osm_physp_t * const p_remote_physp)796 osm_physp_link_exists(IN const osm_physp_t * const p_physp,
797 		      IN const osm_physp_t * const p_remote_physp)
798 {
799 	CL_ASSERT(p_physp);
800 	CL_ASSERT(osm_physp_is_valid(p_physp));
801 	CL_ASSERT(p_remote_physp);
802 	CL_ASSERT(osm_physp_is_valid(p_remote_physp));
803 	return ((p_physp->p_remote_physp == p_remote_physp) &&
804 		(p_remote_physp->p_remote_physp == p_physp));
805 }
806 
807 /*
808 * PARAMETERS
809 *	p_physp
810 *		[in] Pointer to an osm_physp_t object.
811 *
812 *	p_remote_physp
813 *		[in] Pointer to an osm_physp_t object.
814 *
815 * RETURN VALUES
816 *	Returns TRUE if the Physical Port has a link to another port.
817 *	FALSE otherwise.
818 *
819 * NOTES
820 *
821 * SEE ALSO
822 *	Port, Physical Port
823 *********/
824 
825 /****f* OpenSM: Physical Port/osm_physp_link
826 * NAME
827 *	osm_physp_link
828 *
829 * DESCRIPTION
830 *	Sets the pointers to the Physical Ports on the other side the wire.
831 *
832 * SYNOPSIS
833 */
834 static inline void
osm_physp_link(IN osm_physp_t * const p_physp,IN osm_physp_t * const p_remote_physp)835 osm_physp_link(IN osm_physp_t * const p_physp,
836 	       IN osm_physp_t * const p_remote_physp)
837 {
838 	CL_ASSERT(p_physp);
839 	CL_ASSERT(p_remote_physp);
840 	p_physp->p_remote_physp = p_remote_physp;
841 	p_remote_physp->p_remote_physp = p_physp;
842 }
843 
844 /*
845 * PARAMETERS
846 *	p_physp
847 *		[in] Pointer to an osm_physp_t object to link.
848 *
849 *	p_remote_physp
850 *		[in] Pointer to the adjacent osm_physp_t object to link.
851 *
852 * RETURN VALUES
853 *	None.
854 *
855 * NOTES
856 *
857 * SEE ALSO
858 *	Port, Physical Port
859 *********/
860 
861 /****f* OpenSM: Physical Port/osm_physp_unlink
862 * NAME
863 *	osm_physp_unlink
864 *
865 * DESCRIPTION
866 *	Clears the pointers to the Physical Port on the other side the wire.
867 *
868 * SYNOPSIS
869 */
870 static inline void
osm_physp_unlink(IN osm_physp_t * const p_physp,IN osm_physp_t * const p_remote_physp)871 osm_physp_unlink(IN osm_physp_t * const p_physp,
872 		 IN osm_physp_t * const p_remote_physp)
873 {
874 	CL_ASSERT(p_physp);
875 	CL_ASSERT(p_remote_physp);
876 	CL_ASSERT(osm_physp_link_exists(p_physp, p_remote_physp));
877 	p_physp->p_remote_physp = NULL;
878 	p_remote_physp->p_remote_physp = NULL;
879 }
880 
881 /*
882 * PARAMETERS
883 *	p_physp
884 *		[in] Pointer to an osm_physp_t object to link.
885 *
886 *	p_remote_physp
887 *		[in] Pointer to the adjacent osm_physp_t object to link.
888 *
889 * RETURN VALUES
890 *	None.
891 *
892 * NOTES
893 *
894 * SEE ALSO
895 *	Port, Physical Port
896 *********/
897 
898 /****f* OpenSM: Physical Port/osm_physp_has_any_link
899 * NAME
900 *	osm_physp_has_any_link
901 *
902 * DESCRIPTION
903 *	Returns TRUE if the Physical Port has a link to another port.
904 *	FALSE otherwise.
905 *
906 * SYNOPSIS
907 */
908 static inline boolean_t
osm_physp_has_any_link(IN const osm_physp_t * const p_physp)909 osm_physp_has_any_link(IN const osm_physp_t * const p_physp)
910 {
911 	CL_ASSERT(p_physp);
912 	if (osm_physp_is_valid(p_physp))
913 		return (p_physp->p_remote_physp != NULL);
914 	else
915 		return (FALSE);
916 }
917 
918 /*
919 * PARAMETERS
920 *	p_physp
921 *		[in] Pointer to an osm_physp_t object.
922 *
923 * RETURN VALUES
924 *	Returns TRUE if the Physical Port has a link to another port.
925 *	FALSE otherwise.
926 *
927 * NOTES
928 *
929 * SEE ALSO
930 *	Port, Physical Port
931 *********/
932 
933 /****f* OpenSM: Physical Port/osm_physp_get_port_num
934 * NAME
935 *	osm_physp_get_port_num
936 *
937 * DESCRIPTION
938 *	Returns the local port number of this Physical Port.
939 *
940 * SYNOPSIS
941 */
942 static inline uint8_t
osm_physp_get_port_num(IN const osm_physp_t * const p_physp)943 osm_physp_get_port_num(IN const osm_physp_t * const p_physp)
944 {
945 	CL_ASSERT(p_physp);
946 	CL_ASSERT(osm_physp_is_valid(p_physp));
947 	return (p_physp->port_num);
948 }
949 
950 /*
951 * PARAMETERS
952 *	p_physp
953 *		[in] Pointer to an osm_physp_t object.
954 *
955 * RETURN VALUES
956 *	Returns the local port number of this Physical Port.
957 *
958 * NOTES
959 *
960 * SEE ALSO
961 *********/
962 
963 /****f* OpenSM: Physical Port/osm_physp_get_node_ptr
964 * NAME
965 *	osm_physp_get_node_ptr
966 *
967 * DESCRIPTION
968 *	Returns a pointer to the parent Node object for this port.
969 *
970 * SYNOPSIS
971 */
osm_physp_get_node_ptr(IN const osm_physp_t * const p_physp)972 static inline struct osm_node *osm_physp_get_node_ptr(IN const osm_physp_t *
973 						       const p_physp)
974 {
975 	CL_ASSERT(p_physp);
976 	CL_ASSERT(osm_physp_is_valid(p_physp));
977 	return ((struct osm_node *)p_physp->p_node);
978 }
979 
980 /*
981 * PARAMETERS
982 *	p_physp
983 *		[in] Pointer to an osm_physp_t object.
984 *
985 * RETURN VALUES
986 *	Returns a pointer to the parent Node object for this port.
987 *
988 * NOTES
989 *
990 * SEE ALSO
991 *********/
992 
993 /****f* OpenSM: Physical Port/osm_physp_get_port_state
994 * NAME
995 *	osm_physp_get_port_state
996 *
997 * DESCRIPTION
998 *	Returns the port state of this Physical Port.
999 *
1000 * SYNOPSIS
1001 */
1002 static inline uint8_t
osm_physp_get_port_state(IN const osm_physp_t * const p_physp)1003 osm_physp_get_port_state(IN const osm_physp_t * const p_physp)
1004 {
1005 	CL_ASSERT(p_physp);
1006 	CL_ASSERT(osm_physp_is_valid(p_physp));
1007 	return (ib_port_info_get_port_state(&p_physp->port_info));
1008 }
1009 
1010 /*
1011 * PARAMETERS
1012 *	p_physp
1013 *		[in] Pointer to an osm_physp_t object.
1014 *
1015 * RETURN VALUES
1016 *	Returns the local port number of this Physical Port.
1017 *
1018 * NOTES
1019 *
1020 * SEE ALSO
1021 *********/
1022 
1023 /****f* OpenSM: Physical Port/osm_physp_get_base_lid
1024 * NAME
1025 *	osm_physp_get_base_lid
1026 *
1027 * DESCRIPTION
1028 *	Returns the base lid of this Physical Port.
1029 *
1030 * SYNOPSIS
1031 */
1032 static inline ib_net16_t
osm_physp_get_base_lid(IN const osm_physp_t * const p_physp)1033 osm_physp_get_base_lid(IN const osm_physp_t * const p_physp)
1034 {
1035 	CL_ASSERT(p_physp);
1036 	CL_ASSERT(osm_physp_is_valid(p_physp));
1037 	return (p_physp->port_info.base_lid);
1038 }
1039 
1040 /*
1041 * PARAMETERS
1042 *	p_physp
1043 *		[in] Pointer to an osm_physp_t object.
1044 *
1045 * RETURN VALUES
1046 *	Returns the base lid of this Physical Port.
1047 *
1048 * NOTES
1049 *
1050 * SEE ALSO
1051 *********/
1052 
1053 /****f* OpenSM: Physical Port/osm_physp_get_lmc
1054 * NAME
1055 *	osm_physp_get_lmc
1056 *
1057 * DESCRIPTION
1058 *	Returns the LMC value of this Physical Port.
1059 *
1060 * SYNOPSIS
1061 */
osm_physp_get_lmc(IN const osm_physp_t * const p_physp)1062 static inline uint8_t osm_physp_get_lmc(IN const osm_physp_t * const p_physp)
1063 {
1064 	CL_ASSERT(p_physp);
1065 	CL_ASSERT(osm_physp_is_valid(p_physp));
1066 	return (ib_port_info_get_lmc(&p_physp->port_info));
1067 }
1068 
1069 /*
1070 * PARAMETERS
1071 *	p_physp
1072 *		[in] Pointer to an osm_physp_t object.
1073 *
1074 * RETURN VALUES
1075 *	Returns the LMC value of this Physical Port.
1076 *
1077 * NOTES
1078 *
1079 * SEE ALSO
1080 *********/
1081 
1082 /****f* OpenSM: Physical Port/osm_physp_get_dr_path_ptr
1083 * NAME
1084 *	osm_physp_get_dr_path_ptr
1085 *
1086 * DESCRIPTION
1087 *	Returns a pointer to the directed route path for this port.
1088 *
1089 * SYNOPSIS
1090 */
osm_physp_get_dr_path_ptr(IN const osm_physp_t * const p_physp)1091 static inline osm_dr_path_t *osm_physp_get_dr_path_ptr(IN const osm_physp_t *
1092 						       const p_physp)
1093 {
1094 	CL_ASSERT(p_physp);
1095 	CL_ASSERT(osm_physp_is_valid(p_physp));
1096 	return ((osm_dr_path_t *) & p_physp->dr_path);
1097 }
1098 
1099 /*
1100 * PARAMETERS
1101 *	p_physp
1102 *		[in] Pointer to a Physical Port object.
1103 *
1104 * RETURN VALUES
1105 *	Returns a pointer to the directed route path for this port.
1106 *
1107 * NOTES
1108 *
1109 * SEE ALSO
1110 *	Physical Port object
1111 *********/
1112 
1113 /****h* OpenSM/Port
1114 * NAME
1115 *	Port
1116 *
1117 * DESCRIPTION
1118 *	The Port object encapsulates the information needed by the
1119 *	OpenSM to manage ports.  The OpenSM allocates one Port object
1120 *	per port in the IBA subnet.
1121 *
1122 *	Each Port object is associated with a single port GUID.  A Port object
1123 *	contains 1 or more Physical Port objects.  An end point node has
1124 *	one Physical Port per Port.  A switch node has more than
1125 *	one Physical Port per Port.
1126 *
1127 *	The Port object is not thread safe, thus callers must provide
1128 *	serialization.
1129 *
1130 *	These objects should be treated as opaque and should be
1131 *	manipulated only through the provided functions.
1132 *
1133 * AUTHOR
1134 *	Steve King, Intel
1135 *
1136 *********/
1137 
1138 /****s* OpenSM: Port/osm_port_t
1139 * NAME
1140 *	osm_port_t
1141 *
1142 * DESCRIPTION
1143 *	This object represents a logical port on a switch, router or end-point.
1144 *
1145 *	The osm_port_t object should be treated as opaque and should
1146 *	be manipulated only through the provided functions.
1147 *
1148 * SYNOPSIS
1149 */
1150 typedef struct osm_port {
1151 	cl_map_item_t map_item;
1152 	cl_list_item_t list_item;
1153 	struct osm_node *p_node;
1154 	ib_net64_t guid;
1155 	uint32_t discovery_count;
1156 	unsigned is_new;
1157 	osm_physp_t *p_physp;
1158 	cl_qlist_t mcm_list;
1159 	int flag;
1160 	void *priv;
1161 } osm_port_t;
1162 /*
1163 * FIELDS
1164 *	map_item
1165 *		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
1166 *
1167 *	list_item
1168 *		Linkage structure for cl_qlist. Used by ucast mgr during LFT calculation.
1169 *
1170 *	p_node
1171 *		Points to the Node object that owns this port.
1172 *
1173 *	guid
1174 *		Manufacturer assigned GUID for this port.
1175 *
1176 *	discovery_count
1177 *		The number of times this port has been discovered
1178 *		during the current fabric sweep.  This number is reset
1179 *		to zero at the start of a sweep.
1180 *
1181 *	p_physp
1182 *		The pointer to physical port used when physical
1183 *		characteristics contained in the Physical Port are needed.
1184 *
1185 *	mcm_list
1186 *		Multicast member list
1187 *
1188 *	flag
1189 *		Utility flag for port management
1190 *
1191 * SEE ALSO
1192 *	Port, Physical Port, Physical Port Table
1193 *********/
1194 
1195 /****f* OpenSM: Port/osm_port_delete
1196 * NAME
1197 *	osm_port_delete
1198 *
1199 * DESCRIPTION
1200 *	This function destroys and deallocates a Port object.
1201 *
1202 * SYNOPSIS
1203 */
1204 void osm_port_delete(IN OUT osm_port_t ** const pp_port);
1205 /*
1206 * PARAMETERS
1207 *	pp_port
1208 *		[in][out] Pointer to a pointer to a Port object to delete.
1209 *		On return, this pointer is NULL.
1210 *
1211 * RETURN VALUE
1212 *	This function does not return a value.
1213 *
1214 * NOTES
1215 *	Performs any necessary cleanup of the specified Port object.
1216 *
1217 * SEE ALSO
1218 *	Port
1219 *********/
1220 
1221 /****f* OpenSM: Port/osm_port_new
1222 * NAME
1223 *	osm_port_new
1224 *
1225 * DESCRIPTION
1226 *	This function allocates and initializes a Port object.
1227 *
1228 * SYNOPSIS
1229 */
1230 osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,
1231 			 IN struct osm_node *const p_parent_node);
1232 /*
1233 * PARAMETERS
1234 *	p_ni
1235 *		[in] Pointer to the NodeInfo attribute relavent for this port.
1236 *
1237 *	p_parent_node
1238 *		[in] Pointer to the initialized parent osm_node_t object
1239 *		that owns this port.
1240 *
1241 * RETURN VALUE
1242 *	Pointer to the initialize Port object.
1243 *
1244 * NOTES
1245 *	Allows calling other port methods.
1246 *
1247 * SEE ALSO
1248 *	Port
1249 *********/
1250 
1251 /****f* OpenSM: Port/osm_port_get_base_lid
1252 * NAME
1253 *	osm_port_get_base_lid
1254 *
1255 * DESCRIPTION
1256 *	Gets the base LID of a port.
1257 *
1258 * SYNOPSIS
1259 */
1260 static inline ib_net16_t
osm_port_get_base_lid(IN const osm_port_t * const p_port)1261 osm_port_get_base_lid(IN const osm_port_t * const p_port)
1262 {
1263 	CL_ASSERT(p_port->p_physp && osm_physp_is_valid(p_port->p_physp));
1264 	return (osm_physp_get_base_lid(p_port->p_physp));
1265 }
1266 
1267 /*
1268 * PARAMETERS
1269 *	p_port
1270 *		[in] Pointer to a Port object.
1271 *
1272 * RETURN VALUE
1273 *	Base LID of the port.
1274 *	If the return value is 0, then this port has no assigned LID.
1275 *
1276 * NOTES
1277 *
1278 * SEE ALSO
1279 *	Port
1280 *********/
1281 
1282 /****f* OpenSM: Port/osm_port_get_lmc
1283 * NAME
1284 *	osm_port_get_lmc
1285 *
1286 * DESCRIPTION
1287 *	Gets the LMC value of a port.
1288 *
1289 * SYNOPSIS
1290 */
osm_port_get_lmc(IN const osm_port_t * const p_port)1291 static inline uint8_t osm_port_get_lmc(IN const osm_port_t * const p_port)
1292 {
1293 	CL_ASSERT(p_port->p_physp && osm_physp_is_valid(p_port->p_physp));
1294 	return (osm_physp_get_lmc(p_port->p_physp));
1295 }
1296 
1297 /*
1298 * PARAMETERS
1299 *	p_port
1300 *		[in] Pointer to a Port object.
1301 *
1302 * RETURN VALUE
1303 *	Gets the LMC value of a port.
1304 *
1305 * NOTES
1306 *
1307 * SEE ALSO
1308 *	Port
1309 *********/
1310 
1311 /****f* OpenSM: Port/osm_port_get_guid
1312 * NAME
1313 *	osm_port_get_guid
1314 *
1315 * DESCRIPTION
1316 *	Gets the GUID of a port.
1317 *
1318 * SYNOPSIS
1319 */
osm_port_get_guid(IN const osm_port_t * const p_port)1320 static inline ib_net64_t osm_port_get_guid(IN const osm_port_t * const p_port)
1321 {
1322 	return (p_port->guid);
1323 }
1324 
1325 /*
1326 * PARAMETERS
1327 *	p_port
1328 *		[in] Pointer to a Port object.
1329 *
1330 * RETURN VALUE
1331 *	Manufacturer assigned GUID of the port.
1332 *
1333 * NOTES
1334 *
1335 * SEE ALSO
1336 *	Port
1337 *********/
1338 
1339 /****f* OpenSM: Port/osm_port_get_lid_range_ho
1340 * NAME
1341 *	osm_port_get_lid_range_ho
1342 *
1343 * DESCRIPTION
1344 *	Returns the HOST ORDER lid min and max values for this port,
1345 *	based on the lmc value.
1346 *
1347 * SYNOPSIS
1348 */
1349 void
1350 osm_port_get_lid_range_ho(IN const osm_port_t * const p_port,
1351 			  OUT uint16_t * const p_min_lid,
1352 			  OUT uint16_t * const p_max_lid);
1353 /*
1354 * PARAMETERS
1355 *	p_port
1356 *		[in] Pointer to a Port object.
1357 *
1358 *	p_min_lid
1359 *		[out] Pointer to the minimum LID value occupied by this port.
1360 *
1361 *	p_max_lid
1362 *		[out] Pointer to the maximum LID value occupied by this port.
1363 *
1364 * RETURN VALUE
1365 *	None.
1366 *
1367 * NOTES
1368 *
1369 * SEE ALSO
1370 *	Port
1371 *********/
1372 
1373 /****f* OpenSM: Port/osm_get_port_by_base_lid
1374 * NAME
1375 *	osm_get_port_by_base_lid
1376 *
1377 * DESCRIPTION
1378 *	Returns a status on whether a Port was able to be
1379 *	determined based on the LID supplied and if so, return the Port.
1380 *
1381 * SYNOPSIS
1382 */
1383 ib_api_status_t
1384 osm_get_port_by_base_lid(IN const osm_subn_t * const p_subn,
1385 			 IN const ib_net16_t lid,
1386 			 IN OUT const osm_port_t ** const pp_port);
1387 /*
1388 * PARAMETERS
1389 *	p_subn
1390 *		[in] Pointer to the subnet data structure.
1391 *
1392 *	lid
1393 *		[in] LID requested.
1394 *
1395 *	pp_port
1396 *		[in][out] Pointer to pointer to Port object.
1397 *
1398 * RETURN VALUES
1399 *	IB_SUCCESS
1400 *	IB_NOT_FOUND
1401 *
1402 * NOTES
1403 *
1404 * SEE ALSO
1405 *       Port
1406 *********/
1407 
1408 /****f* OpenSM: Port/osm_port_add_mgrp
1409 * NAME
1410 *	osm_port_add_mgrp
1411 *
1412 * DESCRIPTION
1413 *	Logically connects a port to a multicast group.
1414 *
1415 * SYNOPSIS
1416 */
1417 ib_api_status_t
1418 osm_port_add_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid);
1419 /*
1420 * PARAMETERS
1421 *	p_port
1422 *		[in] Pointer to an osm_port_t object.
1423 *
1424 *	mlid
1425 *		[in] MLID of the multicast group.
1426 *
1427 * RETURN VALUES
1428 *	IB_SUCCESS
1429 *	IB_INSUFFICIENT_MEMORY
1430 *
1431 * NOTES
1432 *
1433 * SEE ALSO
1434 *	Port object
1435 *********/
1436 
1437 /****f* OpenSM: Port/osm_port_remove_mgrp
1438 * NAME
1439 *	osm_port_remove_mgrp
1440 *
1441 * DESCRIPTION
1442 *	Logically disconnects a port from a multicast group.
1443 *
1444 * SYNOPSIS
1445 */
1446 void
1447 osm_port_remove_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid);
1448 /*
1449 * PARAMETERS
1450 *	p_port
1451 *		[in] Pointer to an osm_port_t object.
1452 *
1453 *	mlid
1454 *		[in] MLID of the multicast group.
1455 *
1456 * RETURN VALUES
1457 *	None.
1458 *
1459 * NOTES
1460 *
1461 * SEE ALSO
1462 *	Port object
1463 *********/
1464 
1465 /****f* OpenSM: Port/osm_port_remove_all_mgrp
1466 * NAME
1467 *	osm_port_remove_all_mgrp
1468 *
1469 * DESCRIPTION
1470 *	Logically disconnects a port from all its multicast groups.
1471 *
1472 * SYNOPSIS
1473 */
1474 void osm_port_remove_all_mgrp(IN osm_port_t * const p_port);
1475 /*
1476 * PARAMETERS
1477 *	p_port
1478 *		[in] Pointer to an osm_port_t object.
1479 *
1480 * RETURN VALUES
1481 *	None.
1482 *
1483 * NOTES
1484 *
1485 * SEE ALSO
1486 *	Port object
1487 *********/
1488 
1489 /****f* OpenSM: Physical Port/osm_physp_calc_link_mtu
1490 * NAME
1491 *	osm_physp_calc_link_mtu
1492 *
1493 * DESCRIPTION
1494 *	Calculate the Port MTU based on current and remote
1495 *  physical ports MTU CAP values.
1496 *
1497 * SYNOPSIS
1498 */
1499 uint8_t
1500 osm_physp_calc_link_mtu(IN osm_log_t * p_log, IN const osm_physp_t * p_physp);
1501 /*
1502 * PARAMETERS
1503 *	p_log
1504 *		[in] Pointer to a log object.
1505 *
1506 *	p_physp
1507 *		[in] Pointer to an osm_physp_t object.
1508 *
1509 * RETURN VALUES
1510 *	The MTU of the link to be used.
1511 *
1512 * NOTES
1513 *
1514 * SEE ALSO
1515 *	PhysPort object
1516 *********/
1517 
1518 /****f* OpenSM: Physical Port/osm_physp_calc_link_op_vls
1519 * NAME
1520 *	osm_physp_calc_link_op_vls
1521 *
1522 * DESCRIPTION
1523 *	Calculate the Port OP_VLS based on current and remote
1524 *  physical ports VL CAP values. Allowing user option for a max limit.
1525 *
1526 * SYNOPSIS
1527 */
1528 uint8_t
1529 osm_physp_calc_link_op_vls(IN osm_log_t * p_log,
1530 			   IN const osm_subn_t * p_subn,
1531 			   IN const osm_physp_t * p_physp);
1532 /*
1533 * PARAMETERS
1534 *	p_log
1535 *		[in] Pointer to a log object.
1536 *
1537 *	p_subn
1538 *		[in] Pointer to the subnet object for accessing of the options.
1539 *
1540 *	p_physp
1541 *		[in] Pointer to an osm_physp_t object.
1542 *
1543 * RETURN VALUES
1544 *	The OP_VLS of the link to be used.
1545 *
1546 * NOTES
1547 *
1548 * SEE ALSO
1549 *  PhysPort object
1550 *********/
1551 
1552 /****f* OpenSM: Physical Port/osm_physp_replace_dr_path_with_alternate_dr_path
1553 * NAME
1554 *	osm_physp_replace_dr_path_with_alternate_dr_path
1555 *
1556 * DESCRIPTION
1557 *	Replace the direct route path for the given phys port with an
1558 *  alternate path going through forien set of phys port.
1559 *
1560 * SYNOPSIS
1561 */
1562 void
1563 osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,
1564 						 IN osm_subn_t const *p_subn,
1565 						 IN osm_physp_t const *p_physp,
1566 						 IN osm_bind_handle_t * h_bind);
1567 /*
1568 * PARAMETERS
1569 *	p_log
1570 *		[in] Pointer to a log object.
1571 *
1572 *	p_subn
1573 *		[in] Pointer to the subnet object for accessing of the options.
1574 *
1575 *	p_physp
1576 *		[in] Pointer to an osm_physp_t object.
1577 *
1578 *	h_bind
1579 *		[in] Pointer to osm_bind_handle_t object.
1580 *
1581 * RETURN VALUES
1582 *	NONE
1583 *
1584 * NOTES
1585 *
1586 * SEE ALSO
1587 *	PhysPort object
1588 *********/
1589 
1590 END_C_DECLS
1591 #endif				/* _OSM_PORT_H_ */
1592