fi_usnic(7)
π fi_usnic(7) β The usNIC Fabric Provider π
Libfabric v2.5.1, bestie β¨ β okay so this is the fi_usnic(7) page, and weβre gonna get you comfy with the usNIC fabric provider.
πΈ NAME πΈ
fi_usnic β The usNIC Fabric Provider. Thatβs the name, and honestly itβs giving main character energy already π.
π¦ OVERVIEW π¦
The usnic provider is designed to run over the Cisco VIC (virtualized NIC) hardware on Cisco UCS servers. It utilizes the Cisco usNIC (user-space NIC) capabilities of the VIC to enable ultra low latency and other offload capabilities on Ethernet networks. Slay for low latency, no cap π₯.
β¨ RELEASE NOTES β¨
Okay bestie, hereβs the tea β β these notes are important, so donβt skip them.
- The usnic libfabric provider requires the use of the β
libnlβ library.- There are two versions of
libnlgenerally available: v1 and v3; the usnic provider can use either version. - If you are building libfabric/the usnic provider from source, you will need to have the
libnlheader files available (e.g., if you are installinglibnlfrom RPM or other packaging system, install the β-develβ versions of the package). - If you have
libnl(either v1 or v3) installed in a non-standard location (e.g., not in/usr/libor/usr/lib64), you may need to tell libfabricβs configure where to findlibnlvia the--with-libnl=DIRcommand line option (whereDIRis the installation prefix of thelibnlpackage).
- There are two versions of
- The most common way to use the libfabric usnic provider is via an MPI implementation that uses libfabric (and the usnic provider) as a lower layer transport. MPI applications do not need to know anything about libfabric or usnic in this use case β the MPI implementation hides all these details from the application. Love that for them π«Ά.
- If you are writing applications directly to the libfabric API:
FI_EP_DGRAMendpoints are the best supported method of utilizing the usNIC interface. Specifically, theFI_EP_DGRAMendpoint type has been extensively tested as the underlying layer for Open MPIβs usnic BTL.FI_EP_MSGandFI_EP_RDMendpoints are implemented, but are only lightly tested. It is likely that there are still some bugs in these endpoint types. In particular, there are known bugs in RDM support in the presence of congestion or packet loss (issue 1621). RMA is not yet supported.fi_provider(7)lists requirements for all providers. The following limitations exist in the usnic provider:- multicast operations are not supported on
FI_EP_DGRAMandFI_EP_RDMendpoints. FI_EP_MSGendpoints only support connect, accept, and getname CM operations.- Passive endpoints only support listen, setname, and getname CM operations.
FI_EP_DGRAMendpoints supportfi_sendmsg()andfi_recvmsg(), but some flags are ignored.fi_sendmsg()supportsFI_INJECTandFI_COMPLETION.fi_recvmsg()supportsFI_MORE.- Address vectors only support
FI_AV_MAP. - No counters are supported.
- The tag matching interface is not supported.
FI_MSG_PREFIXis only supported onFI_EP_DGRAMand usage is limited to releases 1.1 and beyond.fi_controlwithFI_GETWAITmay only be used on CQs that have been bound to an endpoint. Iffi_controlis used on an unbound CQ, it will return-FI_EOPBADSTATE.- There is limited support for data returned as part of an erroneous asynchronous operation. EQs will return error data for CM operations, CQs do not support returning error data.
- As of 1.5, usNIC supports
fi_mr_regv, andfi_mr_regattr. Support is limited to a single iov. - Atomic operations are not supported.
- multicast operations are not supported on
- Resource management is not supported. The application is responsible for resource protection. You got this, bestie π«‘.
- The usnic libfabric provider supports extensions that provide information and functionality beyond the standard libfabric interface. See the βUSNIC EXTENSIONSβ section, below π.
π USNIC EXTENSIONS π
okay so bestie, the usnic libfabric provider straight-up exports extensions for extra VIC, usNIC, and Ethernet capabilities that the standard libfabric interface does not give you. Iconic. β¨
These extensions are available via the fi_ext_usnic.h header file. Yes, that exact one, no cap.
πΈ Fabric Extension: getinfo πΈ
Version 2 of the fabric getinfo extension was introduced in Libfabric release v1.3.0, and it can be used to retrieve IP and SR-IOV information about a usNIC device obtained from the fi_getinfo(3) function. Very demure, very useful. π
You obtain the fabric getinfo extension by calling fi_open_ops and requesting FI_USNIC_FABRIC_OPS_1 to get the usNIC fabric extension operations. The getinfo function accepts a version parameter that can be used to select different versions of the extension. The information returned by the fabric getinfo extension is accessible through a fi_usnic_info struct that uses a version tagged union. The accessed union member must correspond with the requested version β like, actually. π
It is recommended that applications explicitly request a version rather than using the header-provided FI_EXT_USNIC_INFO_VERSION. Although there is a version 1 of the extension, its use is discouraged, and it may not be available in future releases. We donβt love that for v1, but there it is.
#include <rdma/fi_ext_usnic.h>
struct fi_usnic_info {
uint32_t ui_version;
uint8_t ui_pad0[4];
union {
struct fi_usnic_info_v1 v1;
struct fi_usnic_info_v2 v2;
} ui;
} __attribute__((packed));
int getinfo(uint32_t version, struct fid_fabric *fabric,
struct fi_usnic_info *info);
versionβ Version ofgetinfoto be usedfabricβ Fabric descriptorinfoβ Upon successful return, this parameter will contain information about the fabric.
π¦ Version 2 π¦
Hereβs the v2 struct glow-up:
struct fi_usnic_cap {
const char *uc_capability;
int uc_present;
} __attribute__((packed));
struct fi_usnic_info_v2 {
uint32_t ui_link_speed;
uint32_t ui_netmask_be;
char ui_ifname[IFNAMSIZ];
unsigned ui_num_vf;
unsigned ui_qp_per_vf;
unsigned ui_cq_per_vf;
char ui_devname[FI_EXT_USNIC_MAX_DEVNAME];
uint8_t ui_mac_addr[6];
uint8_t ui_pad0[2];
uint32_t ui_ipaddr_be;
uint32_t ui_prefixlen;
uint32_t ui_mtu;
uint8_t ui_link_up;
uint8_t ui_pad1[3];
uint32_t ui_vendor_id;
uint32_t ui_vendor_part_id;
uint32_t ui_device_id;
char ui_firmware[64];
unsigned ui_intr_per_vf;
unsigned ui_max_cq;
unsigned ui_max_qp;
unsigned ui_max_cqe;
unsigned ui_max_send_credits;
unsigned ui_max_recv_credits;
const char *ui_nicname;
const char *ui_pid;
struct fi_usnic_cap **ui_caps;
} __attribute__((packed));
π Version 1 π
struct fi_usnic_info_v1 {
uint32_t ui_link_speed;
uint32_t ui_netmask_be;
char ui_ifname[IFNAMSIZ];
uint32_t ui_num_vf;
uint32_t ui_qp_per_vf;
uint32_t ui_cq_per_vf;
} __attribute__((packed));
Version 1 of the fabric getinfo extension can be used by explicitly requesting it in the call to getinfo and accessing the v1 portion of the fi_usnic_info.ui union. Use of version 1 is not recommended, and it may be removed from future releases. Consider this your friendly little warning, bestie. π
The following is an example of how to utilize version 2 of the usnic fabric getinfo extension.
#include <stdio.h>
#include <rdma/fabric.h>
/* The usNIC extensions are all in the
rdma/fi_ext_usnic.h header */
#include <rdma/fi_ext_usnic.h>
int main(int argc, char *argv[]) {
struct fi_info *info;
struct fi_info *info_list;
struct fi_info hints = {0};
struct fi_ep_attr ep_attr = {0};
struct fi_fabric_attr fabric_attr = {0};
fabric_attr.prov_name = "usnic";
ep_attr.type = FI_EP_DGRAM;
hints.caps = FI_MSG;
hints.mode = FI_LOCAL_MR | FI_MSG_PREFIX;
hints.addr_format = FI_SOCKADDR;
hints.ep_attr = &ep_attr;
hints.fabric_attr = &fabric_attr;
/* Find all usnic providers */
fi_getinfo(FI_VERSION(1, 0), NULL, 0, 0, &hints, &info_list);
for (info = info_list; NULL != info; info = info->next) {
/* Open the fabric on the interface */
struct fid_fabric *fabric;
fi_fabric(info->fabric_attr, &fabric, NULL);
/* Pass FI_USNIC_FABRIC_OPS_1 to get usnic ops
on the fabric */
struct fi_usnic_ops_fabric *usnic_fabric_ops;
fi_open_ops(&fabric->fid, FI_USNIC_FABRIC_OPS_1, 0,
(void **) &usnic_fabric_ops, NULL);
/* Now use the returned usnic ops structure to call
usnic extensions. The following extension queries
some IP and SR-IOV characteristics about the
usNIC device. */
struct fi_usnic_info usnic_info;
/* Explicitly request version 2. */
usnic_fabric_ops->getinfo(2, fabric, &usnic_info);
printf("Fabric interface %s is %s:\n"
"\tNetmask: 0x%08x\n\tLink speed: %d\n"
"\tSR-IOV VFs: %d\n\tQPs per SR-IOV VF: %d\n"
"\tCQs per SR-IOV VF: %d\n",
info->fabric_attr->name,
usnic_info.ui.v2.ui_ifname,
usnic_info.ui.v2.ui_netmask_be,
usnic_info.ui.v2.ui_link_speed,
usnic_info.ui.v2.ui_num_vf,
usnic_info.ui.v2.ui_qp_per_vf,
usnic_info.ui.v2.ui_cq_per_vf);
fi_close(&fabric->fid);
}
fi_freeinfo(info_list);
return 0;
}
π Compatibility issues π
The addition of version 2 of the extension caused an alignment issue that could lead to invalid data in the v1 portion of the structure. This means that the alignment difference manifests when an application using v1 of the extension is compiled with Libfabric v1.1.x or v1.2.x, but then runs with Libfabric.so that is v1.3.x or higher (and vice versa). Messy, honestly.
The v1.4.0 release of Libfabric introduced a padding field to explicitly maintain compatibility with the v1.3.0 release. If the issue is encountered, then it is recommended that you upgrade to a release containing version 2 of the extension, or recompile with a patched version of an older release.
β οΈ If you hit this alignment nonsense, donβt just vibe through it β upgrade or recompile, fr fr. π«Ά
π¦ Adress Vector Extension: get_distance π¦
The address vector get_distance extension was introduced in Libfabric release v1.0.0, and it can be used to retrieve the network distance of an address. Main character energy for address vectors, lowkey. π
The get_distance extension is obtained by calling fi_open_ops and requesting FI_USNIC_AV_OPS_1 to get the usNIC address vector extension operations.
int get_distance(struct fid_av *av, void *addr, int *metric);
avβ Address vectoraddrβ Destination addressmetricβ On output this will contain-1if the destination host is unreachable,0if the destination host is locally connected, and1otherwise.
See fi_ext_usnic.h for more details. π
β¨ VERSION DIFFERENCES β¨
π New naming convention for fabric/domain starting with libfabric v1.4 π
The release of libfabric v1.4 introduced a new naming convention for fabric and domain. However the usNIC provider remains backward compatible with applications supporting the old scheme and decides which one to use based on the version passed to fi_getinfo:
- When
FI_VERSION(1,4)or higher is used:fabricname is the network address with the CIDR notation (i.e.,a.b.c.d/e)domainname is the usNIC Linux interface name (i.e.,usnic_X)
- When a lower version number is used, like
FI_VERSION(1, 3), it follows the same behavior the usNIC provider exhibited inlibfabric <= v1.3:fabricname is the usNIC Linux interface name (i.e.,usnic_X)domainname isNULL
π SEE ALSO π
π AUTHORS π
OpenFabrics.
Thatβs the whole page, bestie β brought to you by the Libfabric Programmerβs Manual, dated 2024-12-10, for fi_usnic(7). Slay. π
β¨
π¦ where this page comes from
- centos-stream 10: libfabric-devel 2.5.1-1.el10 Β· BSD-2-Clause OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms