/usr/include/infiniband/opensm/osm_node.h is in libopensm-dev 3.3.20-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | /*
* Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/*
* Abstract:
* Declaration of osm_node_t.
* This object represents an IBA node.
* This object is part of the OpenSM family of objects.
*/
#ifndef _OSM_NODE_H_
#define _OSM_NODE_H_
#include <complib/cl_qmap.h>
#include <iba/ib_types.h>
#include <opensm/osm_base.h>
#include <opensm/osm_port.h>
#include <opensm/osm_path.h>
#include <opensm/osm_madw.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS }
#else /* !__cplusplus */
# define BEGIN_C_DECLS
# define END_C_DECLS
#endif /* __cplusplus */
BEGIN_C_DECLS
struct osm_switch;
/****h* OpenSM/Node
* NAME
* Node
*
* DESCRIPTION
* The Node object encapsulates the information needed by the
* OpenSM to manage nodes. The OpenSM allocates one Node object
* per node in the IBA subnet.
*
* The Node object is not thread safe, thus callers must provide
* serialization.
*
* This object should be treated as opaque and should be
* manipulated only through the provided functions.
*
* AUTHOR
* Steve King, Intel
*
*********/
/****s* OpenSM: Node/osm_node_t
* NAME
* osm_node_t
*
* DESCRIPTION
* Node structure.
*
* This object should be treated as opaque and should
* be manipulated only through the provided functions.
*
* SYNOPSIS
*/
typedef struct osm_node {
cl_map_item_t map_item;
struct osm_switch *sw;
ib_node_info_t node_info;
ib_node_desc_t node_desc;
uint32_t discovery_count;
uint32_t physp_tbl_size;
char *print_desc;
uint8_t *physp_discovered;
osm_physp_t physp_table[1];
} osm_node_t;
/*
* FIELDS
* map_item
* Linkage structure for cl_qmap. MUST BE FIRST MEMBER!
*
* sw
* For switch node contains pointer to appropriate osm_switch
* structure. NULL for non-switch nodes. Can be used for fast
* access to switch object and for simple node type detection
*
* node_info
* The IBA defined NodeInfo data for this node.
*
* node_desc
* The IBA defined NodeDescription data for this node.
*
* discovery_count
* The number of times this node has been discovered
* during the current fabric sweep. This number is reset
* to zero at the start of a sweep.
*
* physp_tbl_size
* The size of the physp_table array. This value is one greater
* than the number of ports in the node, since port numbers
* start with 1 for some bizarre reason.
*
* print_desc
* A printable version of the node description.
*
* physp_discovered
* Array of physp_discovered objects for all ports of this node.
* Each object indiactes whether the port has been discovered
* during the sweep or not. 1 means that the port had been discovered.
*
* physp_table
* Array of physical port objects belonging to this node.
* Index is contiguous by local port number.
* For switches, port 0 is the always the management port (14.2.5.6).
* MUST BE LAST MEMBER! - Since it grows !!!!
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_delete
* NAME
* osm_node_delete
*
* DESCRIPTION
* The osm_node_delete function destroys a node, releasing
* all resources.
*
* SYNOPSIS
*/
void osm_node_delete(IN OUT osm_node_t ** p_node);
/*
* PARAMETERS
* p_node
* [in][out] Pointer to a Pointer a Node object to destroy.
* On return, the pointer to set to NULL.
*
* RETURN VALUE
* This function does not return a value.
*
* NOTES
* Performs any necessary cleanup of the specified Node object.
* This function should only be called after a call to osm_node_new.
*
* SEE ALSO
* Node object, osm_node_new
*********/
/****f* OpenSM: Node/osm_node_new
* NAME
* osm_node_new
*
* DESCRIPTION
* The osm_node_new function initializes a Node object for use.
*
* SYNOPSIS
*/
osm_node_t *osm_node_new(IN const osm_madw_t * p_madw);
/*
* PARAMETERS
* p_madw
* [in] Pointer to a osm_madw_t object containing a mad with
* the node's NodeInfo attribute. The caller may discard the
* osm_madw_t structure after calling osm_node_new.
*
* RETURN VALUES
* On success, a pointer to the new initialized osm_node_t structure.
* NULL otherwise.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_get_physp_ptr
* NAME
* osm_node_get_physp_ptr
*
* DESCRIPTION
* Returns a pointer to the physical port object at the
* specified local port number.
*
* SYNOPSIS
*/
static inline osm_physp_t *osm_node_get_physp_ptr(IN osm_node_t * p_node,
IN uint32_t port_num)
{
CL_ASSERT(port_num < p_node->physp_tbl_size);
return osm_physp_is_valid(&p_node->physp_table[port_num]) ?
&p_node->physp_table[port_num] : NULL;
}
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Local port number.
*
* RETURN VALUES
* Returns a pointer to the physical port object at the
* specified local port number.
* A return value of zero means the port number was out of range.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_get_type
* NAME
* osm_node_get_type
*
* DESCRIPTION
* Returns the type of this node.
*
* SYNOPSIS
*/
static inline uint8_t osm_node_get_type(IN const osm_node_t * p_node)
{
return p_node->node_info.node_type;
}
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* RETURN VALUES
* Returns the IBA defined type of this node.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_get_num_physp
* NAME
* osm_node_get_num_physp
*
* DESCRIPTION
* Returns the number of osm_physp ports allocated for this node.
* For switches, it is the number of external physical ports plus
* port 0. For CAs and routers, it is the number of external physical
* ports plus 1.
*
* SYNOPSIS
*/
static inline uint8_t osm_node_get_num_physp(IN const osm_node_t * p_node)
{
return (uint8_t) p_node->physp_tbl_size;
}
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* RETURN VALUES
* Returns the IBA defined type of this node.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_get_remote_node
* NAME
* osm_node_get_remote_node
*
* DESCRIPTION
* Returns a pointer to the node on the other end of the
* specified port.
* Returns NULL if no remote node exists.
*
* SYNOPSIS
*/
osm_node_t *osm_node_get_remote_node(IN osm_node_t * p_node,
IN uint8_t port_num,
OUT uint8_t * p_remote_port_num);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Port number in p_node through which to get the remote node.
*
* p_remote_port_num
* [out] Port number in the remote's node through which this
* link exists. The caller may specify NULL for this pointer
* if the port number isn't needed.
*
* RETURN VALUES
* Returns a pointer to the node on the other end of the
* specified port.
* Returns NULL if no remote node exists.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_get_base_lid
* NAME
* osm_node_get_base_lid
*
* DESCRIPTION
* Returns the LID value of the specified port on this node.
*
* SYNOPSIS
*/
static inline ib_net16_t osm_node_get_base_lid(IN const osm_node_t * p_node,
IN uint32_t port_num)
{
CL_ASSERT(port_num < p_node->physp_tbl_size);
return osm_physp_get_base_lid(&p_node->physp_table[port_num]);
}
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Local port number.
*
* RETURN VALUES
* Returns a pointer to the physical port object at the
* specified local port number.
* A return value of zero means the port number was out of range.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_get_remote_base_lid
* NAME
* osm_node_get_remote_base_lid
*
* DESCRIPTION
* Returns the base LID value of the port on the other side
* of the wire from the specified port on this node.
*
* SYNOPSIS
*/
ib_net16_t osm_node_get_remote_base_lid(IN osm_node_t * p_node,
IN uint32_t port_num);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Local port number.
*
* RETURN VALUES
* Returns a pointer to the physical port object at the
* specified local port number.
* A return value of zero means the port number was out of range.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_get_lmc
* NAME
* osm_node_get_lmc
*
* DESCRIPTION
* Returns the LMC value of the specified port on this node.
*
* SYNOPSIS
*/
static inline uint8_t osm_node_get_lmc(IN const osm_node_t * p_node,
IN uint32_t port_num)
{
CL_ASSERT(port_num < p_node->physp_tbl_size);
return osm_physp_get_lmc(&p_node->physp_table[port_num]);
}
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Local port number.
*
* RETURN VALUES
* Returns the LMC value of the specified port on this node.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_init_physp
* NAME
* osm_node_init_physp
*
* DESCRIPTION
* Initializes a physical port for the given node.
*
* SYNOPSIS
*/
void osm_node_init_physp(IN osm_node_t * p_node, uint8_t port_num,
IN const osm_madw_t * p_madw);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* p_madw
* [in] Pointer to a osm_madw_t object containing a mad with
* the node's NodeInfo attribute as discovered through the
* Physical Port to add to the node. The caller may discard the
* osm_madw_t structure after calling osm_node_new.
*
* RETURN VALUES
* None.
*
* NOTES
*
* SEE ALSO
* Node object, Physical Port object.
*********/
/****f* OpenSM: Node/osm_node_get_node_guid
* NAME
* osm_node_get_node_guid
*
* DESCRIPTION
* Returns the node GUID of this node.
*
* SYNOPSIS
*/
static inline ib_net64_t osm_node_get_node_guid(IN const osm_node_t * p_node)
{
return p_node->node_info.node_guid;
}
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* RETURN VALUES
* Returns the node GUID of this node.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_link
* NAME
* osm_node_link
*
* DESCRIPTION
* Logically connects a node to another node through the specified port.
*
* SYNOPSIS
*/
void osm_node_link(IN osm_node_t * p_node, IN uint8_t port_num,
IN osm_node_t * p_remote_node, IN uint8_t remote_port_num);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Port number in p_node through which to create the link.
*
* p_remote_node
* [in] Pointer to the remote port object.
*
* remote_port_num
* [in] Port number in the remote's node through which to
* create this link.
*
* RETURN VALUES
* None.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_unlink
* NAME
* osm_node_unlink
*
* DESCRIPTION
* Logically disconnects a node from another node through
* the specified port.
*
* SYNOPSIS
*/
void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num,
IN osm_node_t * p_remote_node, IN uint8_t remote_port_num);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Port number in p_node through which to unlink.
*
* p_remote_node
* [in] Pointer to the remote port object.
*
* remote_port_num
* [in] Port number in the remote's node through which to unlink.
*
* RETURN VALUES
* None.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_link_exists
* NAME
* osm_node_link_exists
*
* DESCRIPTION
* Return TRUE if a link exists between the specified nodes on
* the specified ports.
* Returns FALSE otherwise.
*
* SYNOPSIS
*/
boolean_t osm_node_link_exists(IN osm_node_t * p_node, IN uint8_t port_num,
IN osm_node_t * p_remote_node,
IN uint8_t remote_port_num);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Port number in p_node through which to check the link.
*
* p_remote_node
* [in] Pointer to the remote port object.
*
* remote_port_num
* [in] Port number in the remote's node through which to
* check this link.
*
* RETURN VALUES
* Return TRUE if a link exists between the specified nodes on
* the specified ports.
* Returns FALSE otherwise.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_has_any_link
* NAME
* osm_node_has_any_link
*
* DESCRIPTION
* Return TRUE if a any link exists from the specified nodes on
* the specified port.
* Returns FALSE otherwise.
*
* SYNOPSIS
*/
boolean_t osm_node_has_any_link(IN osm_node_t * p_node, IN uint8_t port_num);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Port number in p_node through which to check the link.
*
* RETURN VALUES
* Return TRUE if a any link exists from the specified nodes on
* the specified port.
* Returns FALSE otherwise.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
/****f* OpenSM: Node/osm_node_link_has_valid_ports
* NAME
* osm_node_link_has_valid_ports
*
* DESCRIPTION
* Return TRUE if both ports in the link are valid (initialized).
* Returns FALSE otherwise.
*
* SYNOPSIS
*/
boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node,
IN uint8_t port_num,
IN osm_node_t * p_remote_node,
IN uint8_t remote_port_num);
/*
* PARAMETERS
* p_node
* [in] Pointer to an osm_node_t object.
*
* port_num
* [in] Port number in p_node through which to check the link.
*
* RETURN VALUES
* Return TRUE if both ports in the link are valid (initialized).
* Returns FALSE otherwise.
*
* NOTES
*
* SEE ALSO
* Node object
*********/
END_C_DECLS
#endif /* _OSM_NODE_H_ */
|