CNDP
22.08.0
|
#include <poll.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <bpf/xsk.h>
#include <net/if.h>
#include <cne_common.h>
#include <cne_lport.h>
#include <pktmbuf.h>
#include <uds.h>
Go to the source code of this file.
Macros | |
#define | XSKDEV_STATS_FLAG (1 << 0) |
#define | XSKDEV_RX_FQ_TX_CQ_FLAG (1 << 1) |
Functions | |
CNDP_API xskdev_info_t * | xskdev_socket_create (struct lport_cfg *c) |
CNDP_API void | xskdev_socket_destroy (xskdev_info_t *xi) |
CNDP_API __cne_always_inline uint16_t | xskdev_rx_burst (xskdev_info_t *xi, void **bufs, uint16_t nb_pkts) |
CNDP_API __cne_always_inline uint16_t | xskdev_tx_burst (xskdev_info_t *xi, void **bufs, uint16_t nb_pkts) |
CNDP_API int | xskdev_stats_get (xskdev_info_t *xi, lport_stats_t *stats) |
CNDP_API int | xskdev_stats_reset (xskdev_info_t *xi) |
CNDP_API void | xskdev_dump (xskdev_info_t *xi, uint32_t flags) |
CNDP_API void | xskdev_dump_all (uint32_t flags) |
CNDP_API int | xskdev_print_stats (const char *name, lport_stats_t *s, bool dbg_stats) |
CNDP_API __cne_always_inline void * | xskdev_arg_get (xskdev_info_t *xi) |
CNDP_API __cne_always_inline int | xskdev_buf_alloc (xskdev_info_t *xi, void **bufs, uint16_t nb_bufs) |
CNDP_API __cne_always_inline void | xskdev_buf_free (xskdev_info_t *xi, void **bufs, uint16_t nb_bufs) |
CNDP_API __cne_always_inline void | xskdev_buf_set_len (xskdev_info_t *xi, void *buf, int len) |
CNDP_API __cne_always_inline void | xskdev_buf_set_data_len (xskdev_info_t *xi, void *buf, int len) |
CNDP_API __cne_always_inline void | xskdev_buf_set_data (xskdev_info_t *xi, void *buf, uint64_t off) |
CNDP_API __cne_always_inline uint16_t | xskdev_buf_get_data_len (xskdev_info_t *xi, void *buf) |
CNDP_API __cne_always_inline uint64_t | xskdev_buf_get_data (xskdev_info_t *xi, void *buf) |
CNDP_API __cne_always_inline uint64_t | xskdev_buf_get_addr (xskdev_info_t *xi, void *buf) |
CNDP_API __cne_always_inline void ** | xskdev_buf_inc_ptr (xskdev_info_t *xi, void **buf) |
CNDP_API __cne_always_inline void | xskdev_buf_reset (xskdev_info_t *xi, void *buf, uint32_t buf_len, size_t headroom) |
CNE XSK low-level abstraction
This file provides a low-level abstraction for applications to XSK APIs.
Definition in file xskdev.h.
#define XSKDEV_STATS_FLAG (1 << 0) |
flag to xskdev_dump() to dump out the stats
#define XSKDEV_RX_FQ_TX_CQ_FLAG (1 << 1) |
CNDP_API xskdev_info_t* xskdev_socket_create | ( | struct lport_cfg * | c | ) |
Create a xsk socket helper routine using lport configuration
c | The lport configuration structure |
CNDP_API void xskdev_socket_destroy | ( | xskdev_info_t * | xi | ) |
Close the xsk socket and free resources.
xi | The xskdev_info_t structure returned by xskdev_socket_create() routine |
CNDP_API __cne_always_inline uint16_t xskdev_rx_burst | ( | xskdev_info_t * | xi, |
void ** | bufs, | ||
uint16_t | nb_pkts | ||
) |
Receive packets from the interface
xi | The void * type of xskdev_info_t structure |
bufs | The list or vector or pktmbufs structures to send on the interface. |
nb_pkts | The number of pktmbuf_t pointers in the list or vector bufs |
CNDP_API __cne_always_inline uint16_t xskdev_tx_burst | ( | xskdev_info_t * | xi, |
void ** | bufs, | ||
uint16_t | nb_pkts | ||
) |
Send buffers to be transmitted
xi | The void * type of xskdev_info_t structure |
bufs | The list or vector or pktmbufs structures to send on the interface. |
nb_pkts | The number of pktmbuf_t pointers in the list or vector bufs |
CNDP_API int xskdev_stats_get | ( | xskdev_info_t * | xi, |
lport_stats_t * | stats | ||
) |
Get the stats for the interface
xi | The xskdev_info_t structure pointer |
stats | The lport stats structure to fill in |
CNDP_API int xskdev_stats_reset | ( | xskdev_info_t * | xi | ) |
Reset or clear the stats for an interface
xi | The xskdev_info_t structure pointer |
CNDP_API void xskdev_dump | ( | xskdev_info_t * | xi, |
uint32_t | flags | ||
) |
Debug routine to dump out information about xskdev data
xi | The xskdev_info_t structure pointer |
flags | Flags used to control the amount of information dumped. |
CNDP_API void xskdev_dump_all | ( | uint32_t | flags | ) |
Debug routine dump all of the xskdev interfaces.
flags | Flags used to control the amount of information dumped. |
CNDP_API int xskdev_print_stats | ( | const char * | name, |
lport_stats_t * | s, | ||
bool | dbg_stats | ||
) |
Print the port statistics information.
name | A name used to identify the port. |
s | The pointer to the port statistics |
dbg_stats | Print debug statistics if true. |
CNDP_API __cne_always_inline void* xskdev_arg_get | ( | xskdev_info_t * | xi | ) |
CNDP_API __cne_always_inline int xskdev_buf_alloc | ( | xskdev_info_t * | xi, |
void ** | bufs, | ||
uint16_t | nb_bufs | ||
) |
Allocate the number of buffers requested.
xi | The pointer to the xskdev_info structure. |
bufs | The array of buffer pointers to store the allocated buffers. |
nb_bufs | The max number of buffers pointers to allocate. |
CNDP_API __cne_always_inline void xskdev_buf_free | ( | xskdev_info_t * | xi, |
void ** | bufs, | ||
uint16_t | nb_bufs | ||
) |
CNDP_API __cne_always_inline void xskdev_buf_set_len | ( | xskdev_info_t * | xi, |
void * | buf, | ||
int | len | ||
) |
CNDP_API __cne_always_inline void xskdev_buf_set_data_len | ( | xskdev_info_t * | xi, |
void * | buf, | ||
int | len | ||
) |
CNDP_API __cne_always_inline void xskdev_buf_set_data | ( | xskdev_info_t * | xi, |
void * | buf, | ||
uint64_t | off | ||
) |
CNDP_API __cne_always_inline uint16_t xskdev_buf_get_data_len | ( | xskdev_info_t * | xi, |
void * | buf | ||
) |
CNDP_API __cne_always_inline uint64_t xskdev_buf_get_data | ( | xskdev_info_t * | xi, |
void * | buf | ||
) |
CNDP_API __cne_always_inline uint64_t xskdev_buf_get_addr | ( | xskdev_info_t * | xi, |
void * | buf | ||
) |
CNDP_API __cne_always_inline void** xskdev_buf_inc_ptr | ( | xskdev_info_t * | xi, |
void ** | buf | ||
) |
CNDP_API __cne_always_inline void xskdev_buf_reset | ( | xskdev_info_t * | xi, |
void * | buf, | ||
uint32_t | buf_len, | ||
size_t | headroom | ||
) |
Reset a buffer.
xi | The pointer to the xskdev_info struct. |
buf | The buffer to reset. |
buf_len | The max data length able to be contained in the buffer. If the buffer is 2K and it contains a mbuf like header then buf_len = (2K - sizeof(mbuf)). |
headroom | The buffer headroom to offset the data pointer by (if needed). |