54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "stellar/packet.h"
|
|
|
|
struct packet_io_stat
|
|
{
|
|
// device packet
|
|
uint64_t pkts_rx;
|
|
uint64_t bytes_rx;
|
|
|
|
uint64_t pkts_tx;
|
|
uint64_t bytes_tx;
|
|
|
|
// keep-alive packet
|
|
uint64_t keep_alive_pkts;
|
|
uint64_t keep_alive_bytes;
|
|
|
|
// drop packet
|
|
uint64_t pkts_dropped;
|
|
uint64_t bytes_dropped;
|
|
|
|
// inject packet
|
|
uint64_t pkts_injected;
|
|
uint64_t bytes_injected;
|
|
|
|
// user freed
|
|
uint64_t pkts_user_freed;
|
|
uint64_t bytes_user_freed;
|
|
} __attribute__((aligned(64)));
|
|
|
|
struct packet_io;
|
|
struct packet_io *packet_io_new(const char *toml_file);
|
|
void packet_io_free(struct packet_io *pkt_io);
|
|
int packet_io_isbreak(struct packet_io *pkt_io);
|
|
|
|
int packet_io_init(struct packet_io *pkt_io, uint16_t thr_idx);
|
|
int packet_io_recv(struct packet_io *pkt_io, uint16_t thr_idx, struct packet *pkts[], int nr_pkts);
|
|
void packet_io_send(struct packet_io *pkt_io, uint16_t thr_idx, struct packet *pkts[], int nr_pkts);
|
|
void packet_io_drop(struct packet_io *pkt_io, uint16_t thr_idx, struct packet *pkts[], int nr_pkts);
|
|
void packet_io_yield(struct packet_io *pkt_io, uint16_t thr_idx);
|
|
void packet_io_polling(struct packet_io *pkt_io, uint16_t thr_idx);
|
|
struct packet_io_stat *packet_io_stat(struct packet_io *pkt_io, uint16_t thr_idx);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|