---
name: "rte_class.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_class.h"
---

# rte\_class.h(3)

## NAME

rte\_class.h

## SYNOPSIS

`#include <rte_dev.h>`\

### Data Structures

struct **rte\_class**\

### Macros

\#define **RTE\_REGISTER\_CLASS**(nm,  cls)\

### Typedefs

**typedef** int(\* **rte\_class\_cmp\_t**) (const struct **rte\_class** \*cls, const void \*data)\

### Functions

**RTE\_TAILQ\_HEAD** (rte\_class\_list, **rte\_class**)\
 struct **rte\_class** \* **rte\_class\_find** (const struct **rte\_class** \*start, **rte\_class\_cmp\_t** cmp, const void \*data)\
 struct **rte\_class** \* **rte\_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, cls)

**Value:**.PP

```
RTE_INIT_PRIO(classinitfn_ ##nm, CLASS) \
{\
    (cls).name = RTE_STR(nm); \
    rte_class_register(&cls); \
}
```

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

### typedef int(\* rte\_class\_cmp\_t) (const struct rte\_class \*cls, const void \*data)

Class comparison function.

**Parameters**

*cls* Class under test.\
 *data* Data to compare against.

**Returns**

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, rte\_class)

Double linked list of classes

### 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.

**Parameters**

*start* Starting point for the iteration.\
 *cmp* Comparison function.\
 *data* Data to pass to comparison function.

**Returns**

A pointer to a **rte\_class** structure or NULL in case no class matches

### struct rte\_class \* rte\_class\_find\_by\_name (const char \* name)

Find the registered class for a given name.

### void rte\_class\_register (struct rte\_class \* cls)

Register a Class handle.

**Parameters**

*cls* A pointer to a **rte\_class** structure describing the class to be registered.

### void rte\_class\_unregister (struct rte\_class \* cls)

Unregister a Class handle.

**Parameters**

*cls* A pointer to a **rte\_class** structure describing the class to be unregistered.

## Author

Generated automatically by Doxygen for DPDK from the source code.
