XDP Socket
Defaults
Constructor
Destructor
Methods
-
int xdp_sock_lookup_bpf_map(xdp_sock_t *self, xdp_iface_t *xdp_interface, const char *map_name, uint32_t key_size, uint32_t value_size)
[source] Attach XSKS map to socket fd
- Parameters:
self_p (xdp_sock_t*) – pointer to xdp_sock_t object
xdp_interface (xdp_iface_t*) – pointer to xdp_iface_t object
map_name (const char*) – map name
key_size (uint32_t) – map keys size
value_size (uint32_t) – map values size
- Returns:
0 on success, err value on failiure
-
int xdp_sock_set_sockopt(xdp_sock_t *self, int opt_type, int opt_value)
[source] Set socket option
- Parameters:
self_p (xdp_sock_t*) – pointer to xdp_sock_t object
opt_type (int) – option type
opt_value (int) – option value
- Returns:
0 on success, err value on failiure
Sock Options
-
int xdp_sock_get_fd(xdp_sock_t *self)
[source] Get socket descriptor
- Parameters:
self_p (xdp_sock_t*) – pointer to xdp_sock_t object
- Returns:
socket descriptor
-
int xdp_sock_rx_batch_get_size(xdp_sock_t *self, uint32_t *frames_rcvd, uint32_t nb)
[source] Get size, number of frames received
- Parameters:
self_p (xdp_sock_t*) – pointer to xdp_sock_t object
frames_rcvd (uint32_t*) – number of received frames
nb (uint32_t) – maximum number of frames to receive
- Returns:
0 on success, -1 on failiure
-
int xdp_sock_rx_batch_release(xdp_sock_t *self, uint32_t frames_rcvd)
[source] Release received batch
- Parameters:
self_p (xdp_sock_t*) – pointer to xdp_sock_t object
frames_rcvd (uint32_t) – number of received frames to release
- Returns:
0 on success
-
int xdp_sock_recv(xdp_sock_t *self, char *buffer, size_t *buffer_size)
[source] Read/receive a frame from the RX batch
- Parameters:
self_p (xdp_sock_t*) – pointer to xdp_sock_t object
buffer (char*) – receive buffer
buffer_size (size_t*) – size of the received buffer
- Returns:
0 on success
-
int xdp_sock_tx_batch_set_size(xdp_sock_t *self, uint32_t nb)
[source] Set size of the TX batch
- Parameters:
self_p (xdp_sock_t*) – pointer to xdp_sock_t object
nb (uint32_t) – number of slots to prepare in the tx ring
- Returns:
0 on success, -1 on failiure