mstflint

repository·master·Indexed 42 days ago

https://github.com/mellanox/mstflint

A collection of tools and SDKs for Mellanox devices, including the mstflint SDK (libmstflint_sdk.so) for device discovery, register access, and telemetry, and ibdump for sniffing InfiniBand traffic and generating .pcap files.

Tokens
30.4K
Snippets
124
Records
148
Agent score
54%

What's inside mstflint

  1. Overview of ibdump HCA Sniffing Utility

    master
    The ibdump tool is an InfiniBand traffic sniffing utility for Mellanox adapter cards. It functions similarly to tcpdump for Ethernet networks by capturing InfiniBand traffic and generating packet dump files in .pcap format. These files can be analyzed using Wireshark to debug applications and analyze network performance.
  2. Overview of Iniparser 4

    master

    Iniparser is a lightweight C library designed for parsing .ini files. It is highly portable and suitable for embedded or constrained environments.

    Key characteristics:

    • Small footprint: Approximately 1500 source lines of code across 4 files (2 .c and 2 .h).
    • Portable: Written in -ansi -pedantic C89 with no external dependencies.
    • Thread-safe: The library is fully reentrant; to make it thread-safe in a multi-threaded application, simply wrap the library calls with a mutex.
  3. Use mstreg to manage access registers

    master

    The mstreg utility exposes supported access registers on a Mellanox device. It allows users to inspect register fields and attributes, as well as perform GET and SET operations on specific registers using names, IDs, or lengths. Operations can be targeted at specific MST devices using the -d or --device flag.

    mstreg [OPTIONS]
  4. Use mstflint for firmware burning and flash operations

    master

    mstflint is a tool used for firmware (FW) burning and flash memory operations on Mellanox Infiniband HCAs, Ethernet NIC cards, and switch devices.

    Basic Syntax: MstFlint [OPTIONS] <command> [Parameters]

    Commonly used options:

    • -d | --device <device>: Specifies the device the flash is connected to. Affects all commands.
    • -i | --image <image>: Specifies the binary image file. Affects burn and verify commands.
    • -y | --yes: Non-interactive mode; automatically assumes "yes" to all prompts.
    • -s | --silent: Suppresses the burn progress flyer during the burn command.
    • -v | --version: Displays version information.
    MstFlint [OPTIONS] <command> [Parameters]
  5. Use the Sole UUID library

    master

    Sole is a lightweight, header-only C++11 library used to generate and manipulate Universally Unique Identifiers (UUIDs). It supports UUID versions 0, 1, and 4, and allows rebuilding UUIDs from hexadecimal or base62 strings.

    Supported UUID Versions

    • Version 0 (Custom): Combines a 16-bit PID, 48-bit MAC address, and a 60-bit clock (100ns resolution since Unix epoch). Format: EPOCH_LOW-EPOCH_MID-VERSION(0)|EPOCH_HI-PID-MAC.
    • Version 1: Uses a 48-bit MAC address and a 60-bit clock. Best used when you want to avoid collisions based on probability.
    • Version 4: Uses 122 bits of randomness. Best used when security and non-determinism are priorities.

    Integration

    Since it is a header-only library, you can include sole.hpp in your project. When compiling with clang or g++, you may need to specify -std=c++11 and link the real-time library using -lrt.

    g++ sample.cc -std=c++11 -lrt && ./a.out
  6. Use mstlink to check and debug link status

    master

    The mstlink tool is used to check and debug link status and issues related to links, including passive, active, transceiver, and backplane cables. It supports both NETWORK (default) and PCIE port types.

    To perform operations on a specific device and port, use the -d (device) and -p (port) options.

    mstlink -d <device> -p <port_number>
  7. Overview of the mstflint SDK (`libmstflint_sdk.so`)

    master

    The mstflint SDK is a self-contained shared library (libmstflint_sdk.so) that provides a C API (using mst* function prefixes) for interacting with devices. It is designed as the mstflint equivalent to MFT's libmft_sdk.so.

    Capabilities include:

    • Device discovery
    • HCA capability queries
    • PRM register access
    • CR-space access
    • I2C access
    • Telemetry

    The library is self-contained; all mstflint dependencies (including mtcr) are linked statically. At runtime, it only requires standard system libraries such as libstdc++, liblzma, libexpat, and libc.

  8. API Versioning and Breaking Changes

    master

    The current version of Iniparser is 4.1.

    Warning: Version 4.0 introduced breaking changes to the API. If you are migrating from older versions (such as 3.1 or 3.2), you will need to update your code to match the new API. Legacy versions are available via repository tags.

  9. Best practice: Use references to avoid expensive copies

    master

    When accessing or modifying Yaml::Node content, always use references (&) if you do not intend to make a copy. Modifying a copied node will not affect the original node. Copying a node is a slow operation if the node contains significant content.

    Yaml::Node root;
    
    // Use a reference to modify the original node
    Yaml::Node & ref = root; 
    ref["key"] = "value";
    
    // Use a copy if you want to isolate changes (slow for large nodes)
    Yaml::Node copy = root;
    copy["key"] = "value"; // "root" remains unchanged
  10. Understand the mstflint SDK unit test layout

    master

    The unit test repository is organized into functional suites:

    PathContent
    utils.pyShared infrastructure: device discovery, command runner, runner bases, CLI, and KNOWN_MISSING handling.
    mlxlink/5 compare suites (operational info, counters, FEC histogram, cable DDM, module info) and gtest sources.
    mlxreg/5 compare suites (register list, access, metadata, full path, and error handling) and gtest sources.
    discovery/, hca_caps/, telemetry/, segfault/Gtest-only suites (run via the installed harness using --gtest_filter).
    packaging/Validates build_sdk.sh packaging flags (variants, relocation, coexistence) and source-package emission (SRPM / .dsc).
    build/Autotools build-system checks (e.g., configure.ac C++17 / GCC-9 deprecation notices).
    test_utils.*, mft_sdk_test_main.cpp, mlxreg/mlxreg_fields.hGtest harness sources (shared main() and field-name parsing contract).
  11. Compile ibdump with different library support

    master

    Depending on your requirements for library dependencies (MFT, MSTFLINT, or RDMA_CORE), use the following compilation commands:

    Desired SetupCommand
    MFT Library + RDMA_COREmake [install]
    MFT Library + LIBS_EXPmake LIBS_EXP=yes [install]
    MSTFLINT Library + RDMA_COREmake WITH_MSTFLINT=yes [install]
    Without FW toolsmake WITHOUT_FW_TOOLS=yes [install]
    # Example: Compile with MSTFLINT support
    make WITH_MSTFLINT=yes [install]