DPDK  21.08.0
Typedefs | Functions
rte_interrupts.h File Reference
#include <rte_common.h>
#include <rte_compat.h>
#include "rte_eal_interrupts.h"

Go to the source code of this file.

Typedefs

typedef void(* rte_intr_callback_fn) (void *cb_arg)
 
typedef void(* rte_intr_unregister_callback_fn) (struct rte_intr_handle *intr_handle, void *cb_arg)
 

Functions

int rte_intr_callback_register (const struct rte_intr_handle *intr_handle, rte_intr_callback_fn cb, void *cb_arg)
 
int rte_intr_callback_unregister (const struct rte_intr_handle *intr_handle, rte_intr_callback_fn cb, void *cb_arg)
 
__rte_experimental int rte_intr_callback_unregister_pending (const struct rte_intr_handle *intr_handle, rte_intr_callback_fn cb_fn, void *cb_arg, rte_intr_unregister_callback_fn ucb_fn)
 
__rte_experimental int rte_intr_callback_unregister_sync (const struct rte_intr_handle *intr_handle, rte_intr_callback_fn cb, void *cb_arg)
 
int rte_intr_enable (const struct rte_intr_handle *intr_handle)
 
int rte_intr_disable (const struct rte_intr_handle *intr_handle)
 
__rte_experimental int rte_intr_ack (const struct rte_intr_handle *intr_handle)
 

Detailed Description

The RTE interrupt interface provides functions to register/unregister callbacks for a specific interrupt.

Definition in file rte_interrupts.h.

Typedef Documentation

◆ rte_intr_callback_fn

typedef void(* rte_intr_callback_fn) (void *cb_arg)

Function to be registered for the specific interrupt

Definition at line 26 of file rte_interrupts.h.

◆ rte_intr_unregister_callback_fn

typedef void(* rte_intr_unregister_callback_fn) (struct rte_intr_handle *intr_handle, void *cb_arg)

Function to call after a callback is unregistered. Can be used to close fd and free cb_arg.

Definition at line 32 of file rte_interrupts.h.

Function Documentation

◆ rte_intr_callback_register()

int rte_intr_callback_register ( const struct rte_intr_handle intr_handle,
rte_intr_callback_fn  cb,
void *  cb_arg 
)

It registers the callback for the specific interrupt. Multiple callbacks can be registered at the same time.

Parameters
intr_handlePointer to the interrupt handle.
cbcallback address.
cb_argaddress of parameter for callback.
Returns
  • On success, zero.
  • On failure, a negative value.

◆ rte_intr_callback_unregister()

int rte_intr_callback_unregister ( const struct rte_intr_handle intr_handle,
rte_intr_callback_fn  cb,
void *  cb_arg 
)

It unregisters the callback according to the specified interrupt handle.

Parameters
intr_handlepointer to the interrupt handle.
cbcallback address.
cb_argaddress of parameter for callback, (void *)-1 means to remove all registered which has the same callback address.
Returns
  • On success, return the number of callback entities removed.
  • On failure, a negative value.

◆ rte_intr_callback_unregister_pending()

__rte_experimental int rte_intr_callback_unregister_pending ( const struct rte_intr_handle intr_handle,
rte_intr_callback_fn  cb_fn,
void *  cb_arg,
rte_intr_unregister_callback_fn  ucb_fn 
)

Unregister the callback according to the specified interrupt handle, after it's no longer active. Fail if source is not active.

Parameters
intr_handlepointer to the interrupt handle.
cb_fncallback address.
cb_argaddress of parameter for callback, (void *)-1 means to remove all registered which has the same callback address.
ucb_fncallback to call before cb is unregistered (optional). can be used to close fd and free cb_arg.
Returns
  • On success, return the number of callback entities marked for remove.
  • On failure, a negative value.

◆ rte_intr_callback_unregister_sync()

__rte_experimental int rte_intr_callback_unregister_sync ( const struct rte_intr_handle intr_handle,
rte_intr_callback_fn  cb,
void *  cb_arg 
)
Warning
EXPERIMENTAL: this API may change without prior notice

Loop until rte_intr_callback_unregister() succeeds. After a call to this function, the callback provided by the specified interrupt handle is unregistered.

Parameters
intr_handlepointer to the interrupt handle.
cbcallback address.
cb_argaddress of parameter for callback, (void *)-1 means to remove all registered which has the same callback address.
Returns
  • On success, return the number of callback entities removed.
  • On failure, a negative value.

◆ rte_intr_enable()

int rte_intr_enable ( const struct rte_intr_handle intr_handle)

It enables the interrupt for the specified handle.

Parameters
intr_handlepointer to the interrupt handle.
Returns
  • On success, zero.
  • On failure, a negative value.

◆ rte_intr_disable()

int rte_intr_disable ( const struct rte_intr_handle intr_handle)

It disables the interrupt for the specified handle.

Parameters
intr_handlepointer to the interrupt handle.
Returns
  • On success, zero.
  • On failure, a negative value.

◆ rte_intr_ack()

__rte_experimental int rte_intr_ack ( const struct rte_intr_handle intr_handle)
Warning
EXPERIMENTAL: this API may change without prior notice

It acknowledges an interrupt raised for the specified handle.

This function should be called at the end of each interrupt handler either from application or driver, so that currently raised interrupt is acked and further new interrupts are raised.

Parameters
intr_handlepointer to the interrupt handle.
Returns
  • On success, zero.
  • On failure, a negative value.