---
name: "ibnd_destroy_fabric"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/ibnd_debug"
---

# ibnd\_destroy\_fabric(3)

initialize ibnetdiscover library.

Part of [ibnd\_debug(3)](/ibnd_debug/3.md).

## NAME

ibnd\_discover\_fabric, ibnd\_destroy\_fabric, ibnd\_debug ibnd\_show\_progress - initialize ibnetdiscover library.

## SYNOPSIS

```
#include <infiniband/ibnetdisc.h>

void ibnd_destroy_fabric(ibnd_fabric_t *fabric)
void ibnd_debug(int i)
void ibnd_show_progress(int i)
int ibnd_set_max_smps_on_wire(int i)
```

## DESCRIPTION

**ibnd\_discover\_fabric()** Discover the fabric connected to the port specified by ibmad\_port, using a timeout specified.  The "from" and "hops" parameters are optional and allow one to scan part of a fabric by specifying a node "from" and a number of hops away from that node to scan, "hops".  This gives the user a "sub-fabric" which is "centered" anywhere they chose.

ibmad\_port must be opened with at least IB\_SMI\_CLASS and IB\_SMI\_DIRECT\_CLASS classes for ibnd\_discover\_fabric to work.

**ibnd\_destroy\_fabric()** free all memory and resources associated with the fabric.

**ibnd\_debug()** Set the debug level to be printed as library operations take place.

**ibnd\_show\_progress()** Indicate that the library should print debug output which shows it's progress through the fabric.

**ibnd\_set\_max\_smps\_on\_wire()** Set the number of SMP´s which will be issued on the wire simultaneously.

## RETURN VALUE

**ibnd\_discover\_fabric()** return NULL on failure, otherwise a valid ibnd\_fabric\_t object.

**ibnd\_destory\_fabric(), ibnd\_debug()** NONE

**ibnd\_set\_max\_smps\_on\_wire()** The previous value is returned

## EXAMPLES

**Discover the entire fabric connected to device mthca0 , port 1.**

	int mgmt\_classes\[2\] = {IB\_SMI\_CLASS, IB\_SMI\_DIRECT\_CLASS};\
 	struct ibmad\_port \*ibmad\_port = mad\_rpc\_open\_port(ca, ca\_port, mgmt\_classes, 2);\
 	ibnd\_fabric\_t \*fabric = ibnd\_discover\_fabric(ibmad\_port, 100, NULL, 0);\
 	...\
 	ibnd\_destroy\_fabric(fabric);\
 	mad\_rpc\_close\_port(ibmad\_port);

**Discover only a single node and those nodes connected to it.**

	...\
 	str2drpath(&(port\_id.drpath), from, 0, 0);\
 	...\
 	ibnd\_discover\_fabric(ibmad\_port, 100, &port\_id, 1);\
 	...

## SEE ALSO

	libibmad, mad\_rpc\_open\_port

## AUTHORS

- Ira Weiny \<weiny2@llnl.gov\>
