VPI Driver
Context is the implicit owner of objects created when it's active and their properties. More..
Data Structures | |
struct | VPIParallelForConfig |
Stores the ParallelFor configuration. More.. |
Normally, the Windows computer will automatically recognize or update the drivers needed for the device as soon as you plug it in on the USB port. But sometimes there are issues on Windows not automatically updating the drivers. If this happens, you will need to manually update the drivers by following these steps: 1. Download VPI Service for Windows 10 for Windows to virtual PI by B-TEK Scales, LLC is an electronic paperless scale calibration, service call and time card system designed to save your company time.
Macros | |
#define | VPI_INVALID_CONTEXT ((VPIContext)-1) |
Represents a context was destroyed or is invalid for some other reason. |
Typedefs | |
typedef void(* | VPIParallelTask) (int taskId, int threadId, void *vpiData) |
Parallel task function pointer type. | |
typedef void(* | VPIParallelForCallback) (VPIParallelTask task, int taskCount, void *vpiData, void *userData) |
Parallel for callback function pointer type. More.. | |
typedef void * | VPINativeThreadHandle |
A handle to OS-specific thread handle. | |
typedef struct VPIContextImpl * | VPIContext |
A handle to a context. |
Functions | |
VPIStatus | vpiContextCreate (uint32_t flags, VPIContext *ctx) |
Create a context instance. More.. | |
VPIStatus | vpiContextCreateCudaContextWrapper (uint32_t flags, CUcontext cudaCtx, VPIContext *ctx) |
Create a context instance that wraps a CUDA context. More.. | |
void | vpiContextDestroy (VPIContext ctx) |
Destroy a context instance as well as all resources it owns. More.. | |
VPIStatus | vpiContextSetParallelFor (VPIContext ctx, const VPIParallelForConfig *config) |
Controls low-level task parallelism of CPU devices owned by the context. More.. | |
VPIStatus | vpiContextGetParallelFor (VPIContext ctx, VPIParallelForConfig *config) |
Returns parameters set by vpiContextSetParallelFor. More.. | |
VPIStatus | vpiContextGetCurrent (VPIContext *ctx) |
Gets the context for the calling thread. More.. | |
VPIStatus | vpiContextSetCurrent (VPIContext ctx) |
Sets the context for the calling thread. More.. | |
VPIStatus | vpiContextPush (VPIContext ctx) |
Pushes the context to a per-thread context stack and sets this context as the current context for the calling thread. More.. | |
VPIStatus | vpiContextPop (VPIContext *ctx) |
Pops a context from a per-thread context stack and saves it to the ctx variable. More.. | |
VPIStatus | vpiContextGetFlags (VPIContext ctx, uint32_t *flags) |
Get the current context flags. More.. |
Special contexts | |
#define | VPI_GLOBAL_CONTEXT ((VPIContext)0x610BA1C1D) |
Global context identifier. |
Detailed Description
Context is the implicit owner of objects created when it's active and their properties.
This is a top-level class that manages the lifetime and properties of all other API objects. Specifically, it has the following properties:
- Thread-specific - every thread within an application has one current VPIContext instance set. If no instance has been explicitly set for a particular thread, all API calls from this thread will use a process-specific default context instance instead.
- Configurable - the user can specify during construction which kinds of backends are enabled for this context. This effectively allows to mask support for a particular hardware. For example, creating a VPIStream instance for a CUDA backend will fail if the current context doesn't have the VPI_BACKEND_CUDA flag set. These flags are also automatically updated to reflect the actual platform support for a particular backend. For example, if the PVA backend is not available, vpiContextGetFlags will return the flag without VPI_BACKEND_PVA set. The CPU backend cannot be masked and is always supported as a fallback implementation though.
- Allows for association with a specific CUDA driver API
CUcontext
instance - this should permit multi-GPU processing. - Sharing buffers between different contexts is not permitted.
Data Structure Documentation
◆ VPIParallelForConfig
Stores the ParallelFor configuration.
Definition at line 139 of file Types.h.
Data Fields | ||
---|---|---|
callback | A pointer to the parallel_for implementation. If null is passed, the context will fallback to the default internal parallel_for implementation. parallel_for implementation is required to be thread-safe. Internal API implementation might call this function from different threads at the same time. | |
int | maxThreads | The maximum number of threads used by the parallel_for implementation code. Has to be larger than 0. Setting the number to N means that the parallel for implementation will call task functors with task id between 0 and N-1. Calling task functors with thread id outside of this range is not legal and will result in undefined behavior. |
void * | userData | A user defined opaque pointer passed to callback function unaltered. |
Typedef Documentation
◆ VPIParallelForCallback
typedef void(* VPIParallelForCallback) (VPIParallelTask task, int taskCount, void *vpiData, void *userData) |
#include <vpi/Types.h>
Parallel for callback function pointer type.
A serial (reference) implementation of this function might looks as follows:
Advance an-7121 drivers download for windows 10, 8.1, 7, vista, xp. Find and update outdated drivers on your devices to make them perform better and faster. Run a free scan for Windows® 10, 8, 7, Vista & XP Operating Systems.
Parallel implementation should have equivalent behavior; that is, run all tasks between 0 and taskCount-1 and block the calling thread until all tasks have been completed. threadId
parameter should be between 0 and maxThreads-1 (

- See also
- vpiContextSetParallelFor). Implementations that have
maxThreads
set to zero can pass an arbitrarythreadId
value to task functions.
Definition at line 132 of file Types.h.
Function Documentation
◆ vpiContextCreate()
VPIStatus vpiContextCreate | ( | uint32_t | flags, |
VPIContext * | ctx | ||
) |
#include <vpi/Context.h>
Create a context instance.
[in] | flags | Context flags. User can pass a set of VPIBackend flags or-ed together. This will restrict the enabled backends of objects created while this context is active. |
[out] | ctx | Pointer to memory that will receive the new context handle. |
- Returns
- an error code on failure else VPI_SUCCESS.
◆ vpiContextCreateCudaContextWrapper()
VPIStatus vpiContextCreateCudaContextWrapper | ( | uint32_t | flags, |
CUcontext | cudaCtx, | ||
VPIContext * | ctx | ||
) |
#include <vpi/Context.h>
Create a context instance that wraps a CUDA context.
CUDA operations will all under the wrapped context whenever the created context is active.
- Note
- Currently VPI doesn't do anything with the CUDA context, so the call performs exactly like vpiContextCreate().
[in] | flags | Context flags. It's assumed that VPI_BACKEND_CUDA is always enabled. |
[in] | cudaCtx | CUDA context handle to be wrapped. |
[out] | ctx | Pointer to memory that will receive the new context handle. |
- Returns
- an error code on failure else VPI_SUCCESS
◆ vpiContextDestroy()
#include <vpi/Context.h>
Destroy a context instance as well as all resources it owns.
The context ctx will be destroyed regardless of how many threads it is active in. It is the responsibility of the calling function to ensure that no API call issues using ctx while vpiContextDestroy is executing.
If ctx is current to the calling thread, then ctx will also be popped from the current thread's context stack (as though vpiContextPop was called). If ctx is current to other threads, then ctx will remain current to those threads, and attempting to access ctx from those threads will result in the error VPI_ERROR_INVALID_CONTEXT.
[in] | ctx | Context handle. Passing NULL is accepted. In this case no operation is performed. |
◆ vpiContextGetCurrent()
#include <vpi/Context.h>
Gets the context for the calling thread.
If there is no error and current context is NULL, the thread is using the global context.
[out] | ctx | pointer to a context handle |
- Returns
- an error code on failure else VPI_SUCCESS

◆ vpiContextGetFlags()
VPIStatus vpiContextGetFlags | ( | VPIContext | ctx, |
uint32_t * | flags | ||
) |
#include <vpi/Context.h>
Get the current context flags.
This function can be used to verify underlying backend support.
[in] | ctx | a context handle |
[out] | flags | a pointer to a variable which will be set to the current context flags |
- Returns
- an error code on failure else VPI_SUCCESS
◆ vpiContextGetParallelFor()
VPIStatus vpiContextGetParallelFor | ( | VPIContext | ctx, |
VPIParallelForConfig * | config | ||
) |
#include <vpi/Context.h>
Driver Vpi Epson
Returns parameters set by vpiContextSetParallelFor.
[in] | ctx | Context handle |
[out] | config | A pointer to parallel_for configuration. |
- Returns
- an error code on failure else VPI_SUCCESS
◆ vpiContextPop()
#include <vpi/Context.h>
Pops a context from a per-thread context stack and saves it to the ctx variable.
The top of the context stack is set as the current context for the calling thread.
[out] | ctx | pointer to a context handle |
- Returns
- an error code on failure else VPI_SUCCESS
◆ vpiContextPush()
#include <vpi/Context.h>
Pushes the context to a per-thread context stack and sets this context as the current context for the calling thread.
[in] | ctx | Context handle |
- Returns
- an error code on failure else VPI_SUCCESS
◆ vpiContextSetCurrent()
#include <vpi/Context.h>
Sets the context for the calling thread.
If there are items on the context stack this will replace the top of the stack. If ctx is NULL this will clear the context stack and make the thread use the global context.
[in] | ctx | a context handle |
- Returns
- an error code on failure else VPI_SUCCESS
◆ vpiContextSetParallelFor()
VPIStatus vpiContextSetParallelFor | ( | VPIContext | ctx, |
const VPIParallelForConfig * | config | ||
) |
#include <vpi/Context.h>
Controls low-level task parallelism of CPU devices owned by the context.
This function allows the user to overload the parallel_for implementation used by CPU devices. Changing this parallel_for implementation on a context that is performing CPU processing is undefined and might lead to application crashes.
[in] | ctx | Context handle. |
[in] | config | A pointer to parallel_for configuration. Passing NULL will make the context to fallback to its default internal implementation. |
- Returns
- an error code on failure else VPI_SUCCESS
Copyright (c) 2019, Mellanox Technologies LTD.
Contents¶
Enabling the driver and kconfig options¶
CONFIG_MLX5_CORE=(y/m/n) (module mlx5_core.ko)
CONFIG_MLX5_CORE_EN=(y/n)
CONFIG_MLX5_EN_ARFS=(y/n)
CONFIG_MLX5_EN_RXNFC=(y/n)
CONFIG_MLX5_CORE_EN_DCB=(y/n):
CONFIG_MLX5_MPFS=(y/n)
CONFIG_MLX5_ESWITCH=(y/n)
CONFIG_MLX5_CORE_IPOIB=(y/n)
CONFIG_MLX5_FPGA=(y/n)
CONFIG_MLX5_EN_IPSEC=(y/n)
CONFIG_MLX5_EN_TLS=(y/n)
CONFIG_MLX5_INFINIBAND=(y/n/m) (module mlx5_ib.ko)
External options ( Choose if the corresponding mlx5 feature is required )
- CONFIG_PTP_1588_CLOCK: When chosen, mlx5 ptp support will be enabled
- CONFIG_VXLAN: When chosen, mlx5 vxlan support will be enabled.
- CONFIG_MLXFW: When chosen, mlx5 firmware flashing support will be enabled (via devlink and ethtool).
Devlink info¶
The devlink info reports the running and stored firmware versions on device.It also prints the device PSID which represents the HCA board type ID.
User command example:
Devlink parameters¶
flow_steering_mode: Device flow steering mode¶
The flow steering mode parameter controls the flow steering mode of the driver.Two modes are supported:1. ‘dmfs’ - Device managed flow steering.2. ‘smfs - Software/Driver managed flow steering.
In DMFS mode, the HW steering entities are created and managed through theFirmware.In SMFS mode, the HW steering entities are created and managed though bythe driver directly into Hardware without firmware intervention.
SMFS mode is faster and provides better rule inserstion rate compared to default DMFS mode.
User command examples:
Set SMFS flow steering mode:
Read device flow steering mode:
enable_roce: RoCE enablement state¶
RoCE enablement state controls driver support for RoCE traffic.When RoCE is disabled, there is no gid table, only raw ethernet QPs are supported and traffic on the well known UDP RoCE port is handled as raw ethernet traffic.
To change RoCE enablement state a user must change the driverinit cmode value and run devlink reload.
User command examples:
Disable RoCE:
Read RoCE enablement state:
Devlink health reporters¶
tx reporter¶
The tx reporter is responsible for reporting and recovering of the following two error scenarios:
- TX timeout
- Report on kernel tx timeout detection.Recover by searching lost interrupts.
- TX error completion
- Report on error tx completion.Recover by flushing the TX queue and reset it.
TX reporter also support on demand diagnose callback, on which it providesreal time information of its send queues status.
User commands examples:
Diagnose send queues status:
NOTE: This command has valid output only when interface is up, otherwise the command has empty output.
Show number of tx errors indicated, number of recover flows ended successfully,is autorecover enabled and graceful period from last recover:
rx reporter¶
The rx reporter is responsible for reporting and recovering of the following two error scenarios:
- RX queues initialization (population) timeout
- RX queues descriptors population on ring initialization is done innapi context via triggering an irq, in case of a failure to getthe minimum amount of descriptors, a timeout would occur and itcould be recoverable by polling the EQ (Event Queue).
- RX completions with errors (reported by HW on interrupt context)
- Report on rx completion error.Recover (if needed) by flushing the related queue and reset it.
RX reporter also supports on demand diagnose callback, on which itprovides real time information of its receive queues status.
Diagnose rx queues status, and corresponding completion queue:
NOTE: This command has valid output only when interface is up, otherwise the command has empty output.
Show number of rx errors indicated, number of recover flows ended successfully,is autorecover enabled and graceful period from last recover:
fw reporter¶
The fw reporter implements diagnose and dump callbacks.It follows symptoms of fw error such as fw syndrome by triggeringfw core dump and storing it into the dump buffer.The fw reporter diagnose command can be triggered any time by the user to checkcurrent fw status.
User commands examples:
Check fw heath status:
Read FW core dump if already stored or trigger new one:
NOTE: This command can run only on the PF which has fw tracer ownership,running it on other PF or any VF will return “Operation not permitted”.
fw fatal reporter¶
The fw fatal reporter implements dump and recover callbacks.It follows fatal errors indications by CR-space dump and recover flow.The CR-space dump uses vsc interface which is valid even if the FW commandinterface is not functional, which is the case in most FW fatal errors.The recover function runs recover flow which reloads the driver and triggers fwreset if needed.
User commands examples:
Run fw recover flow manually:
Read FW CR-space dump if already strored or trigger new one:
NOTE: This command can run only on PF.
Vpi Driver Portal
mlx5 tracepoints¶
mlx5 driver provides internal trace points for tracking and debugging usingkernel tracepoints interfaces (refer to ftrace - Function Tracer).
Mellanox Vpi Driver
For the list of support mlx5 events check /sys/kernel/debug/tracing/events/mlx5/
Vpi Drivers
tc and eswitch offloads tracepoints:
Connectx-2 Vpi Driver
mlx5e_configure_flower: trace flower filter actions and cookies offloaded to mlx5:
mlx5e_delete_flower: trace flower filter actions and cookies deleted from mlx5:
mlx5e_stats_flower: trace flower stats request:
mlx5e_tc_update_neigh_used_value: trace tunnel rule neigh update value offloaded to mlx5:
mlx5e_rep_neigh_update: trace neigh update tasks scheduled due to neigh state change events: