DPDK  24.03.0
Data Structures | Macros | Typedefs | Functions
rte_class.h File Reference
#include <rte_dev.h>

Go to the source code of this file.

Data Structures

struct  rte_class


#define RTE_REGISTER_CLASS(nm, cls)


typedef int(* rte_class_cmp_t) (const struct rte_class *cls, const void *data)


 RTE_TAILQ_HEAD (rte_class_list, rte_class)
struct rte_classrte_class_find (const struct rte_class *start, rte_class_cmp_t cmp, const void *data)
struct rte_classrte_class_find_by_name (const char *name)
void rte_class_register (struct rte_class *cls)
void rte_class_unregister (struct rte_class *cls)

Detailed Description

DPDK device class interface.

This file describes the interface of the device class abstraction layer.

A device class defines the type of function a device will be used for e.g.: Ethernet adapter (eth), cryptographic co-processor (crypto), etc.

Definition in file rte_class.h.

Macro Definition Documentation


#define RTE_REGISTER_CLASS (   nm,
RTE_INIT_PRIO(classinitfn_ ##nm, CLASS) \
(cls).name = RTE_STR(nm); \
rte_class_register(&cls); \
#define RTE_INIT_PRIO(func, prio)
Definition: rte_common.h:235
#define RTE_STR(x)
Definition: rte_common.h:703

Helper for Class registration. The constructor has lower priority than Bus constructors. The constructor has higher priority than PMD constructors.

Definition at line 111 of file rte_class.h.

Typedef Documentation

◆ rte_class_cmp_t

typedef int(* rte_class_cmp_t) (const struct rte_class *cls, const void *data)

Class comparison function.

clsClass under test.
dataData to compare against.
0 if the class matches the data. !0 if the class does not match. <0 if ordering is possible and the class is lower than the data. >0 if ordering is possible and the class is greater than the data.

Definition at line 54 of file rte_class.h.

Function Documentation


RTE_TAILQ_HEAD ( rte_class_list  ,

Double linked list of classes


◆ rte_class_find()

struct rte_class* rte_class_find ( const struct rte_class start,
rte_class_cmp_t  cmp,
const void *  data 

Class iterator to find a particular class.

This function compares each registered class to find one that matches the data passed as parameter.

If the comparison function returns zero this function will stop iterating over any more classes. To continue a search the class of a previous search can be passed via the start parameter.

startStarting point for the iteration.
cmpComparison function.
dataData to pass to comparison function.
A pointer to a rte_class structure or NULL in case no class matches

◆ rte_class_find_by_name()

struct rte_class* rte_class_find_by_name ( const char *  name)

Find the registered class for a given name.

◆ rte_class_register()

void rte_class_register ( struct rte_class cls)

Register a Class handle.

clsA pointer to a rte_class structure describing the class to be registered.

◆ rte_class_unregister()

void rte_class_unregister ( struct rte_class cls)

Unregister a Class handle.

clsA pointer to a rte_class structure describing the class to be unregistered.