48 #ifndef XDP_USE_NEED_WAKEUP
57 #define XDP_USE_NEED_WAKEUP (1 << 3)
60 #define XSKDEV_STATS_FLAG (1 << 0)
61 #define XSKDEV_RX_FQ_TX_CQ_FLAG (1 << 1)
63 #define AF_XDP_DFLT_BUSY_BUDGET 64
64 #define AF_XDP_DFLT_BUSY_TIMEOUT 20
66 #ifndef SO_PREFER_BUSY_POLL
67 #define SO_PREFER_BUSY_POLL 69
69 #ifndef SO_BUSY_POLL_BUDGET
70 #define SO_BUSY_POLL_BUDGET 70
73 typedef void *(*xskdev_pull_cq_addr_t)(uint64_t addr, uint64_t umem_addr, uint64_t mask,
74 uint64_t pool_header_sz);
75 typedef uint64_t (*xskdev_get_mbuf_addr_tx_t)(
void *xi,
void *mb, uint64_t umem_addr);
76 typedef uint16_t (*xskdev_get_mbuf_t)(
void *xi,
void *umem_addr,
const struct xdp_desc *d,
78 typedef uint16_t (*xskdev_get_mbuf_rx_t)(
void *xi,
void *umem_addr,
const struct xdp_desc *d,
82 struct xsk_ring_prod fq;
83 struct xsk_ring_cons cq;
84 struct xsk_umem *umem;
94 struct xsk_ring_cons rx;
95 struct xsk_ring_prod tx;
97 struct xskdev_umem *ux;
98 struct xsk_socket *xsk;
103 typedef struct xskdev_queue xskdev_rxq_t;
104 typedef struct xskdev_queue xskdev_txq_t;
106 typedef struct xskdev_info {
107 TAILQ_ENTRY(xskdev_info) next;
108 char ifname[IF_NAMESIZE];
109 unsigned int if_index;
115 pthread_mutex_t tx_lock;
117 uint32_t busy_timeout;
118 uint32_t busy_budget;
119 uds_info_t *uds_info;
129 lport_buf_mgmt_t buf_mgmt;
130 xskdev_get_mbuf_addr_tx_t
132 xskdev_get_mbuf_rx_t __get_mbuf_rx;
133 xskdev_pull_cq_addr_t __pull_cq_addr;
134 struct xdp_statistics orig_stats;
170 return xi->buf_mgmt.buf_rx_burst(xi, bufs, nb_pkts);
188 return xi->buf_mgmt.buf_tx_burst(xi, bufs, nb_pkts);
256 return xi->buf_mgmt.buf_arg;
307 xi->buf_mgmt.buf_set_len(buf, len);
324 xi->buf_mgmt.buf_set_data_len(buf, len);
340 xi->buf_mgmt.buf_set_data(buf, off);
356 return xi->buf_mgmt.buf_get_data_len(buf);
372 return xi->buf_mgmt.buf_get_data(buf);
388 return xi->buf_mgmt.buf_get_addr(buf);
402 return xi->buf_mgmt.buf_inc_ptr(buf);
422 xi->buf_mgmt.buf_reset(buf, buf_len, headroom);
#define __cne_always_inline
CNDP_API __cne_always_inline void xskdev_buf_set_data(xskdev_info_t *xi, void *buf, uint64_t off)
CNDP_API __cne_always_inline uint64_t xskdev_buf_get_addr(xskdev_info_t *xi, void *buf)
CNDP_API __cne_always_inline uint16_t xskdev_rx_burst(xskdev_info_t *xi, void **bufs, uint16_t nb_pkts)
CNDP_API xskdev_info_t * xskdev_socket_create(struct lport_cfg *c)
CNDP_API __cne_always_inline void xskdev_buf_reset(xskdev_info_t *xi, void *buf, uint32_t buf_len, size_t headroom)
CNDP_API void xskdev_socket_destroy(xskdev_info_t *xi)
CNDP_API void xskdev_dump_all(uint32_t flags)
CNDP_API __cne_always_inline void * xskdev_arg_get(xskdev_info_t *xi)
CNDP_API void xskdev_dump(xskdev_info_t *xi, uint32_t flags)
CNDP_API int xskdev_stats_get(xskdev_info_t *xi, lport_stats_t *stats)
CNDP_API __cne_always_inline void ** xskdev_buf_inc_ptr(xskdev_info_t *xi, void **buf)
CNDP_API __cne_always_inline void xskdev_buf_free(xskdev_info_t *xi, void **bufs, uint16_t nb_bufs)
CNDP_API __cne_always_inline uint16_t xskdev_tx_burst(xskdev_info_t *xi, void **bufs, uint16_t nb_pkts)
CNDP_API __cne_always_inline void xskdev_buf_set_data_len(xskdev_info_t *xi, void *buf, int len)
CNDP_API __cne_always_inline int xskdev_buf_alloc(xskdev_info_t *xi, void **bufs, uint16_t nb_bufs)
CNDP_API __cne_always_inline uint64_t xskdev_buf_get_data(xskdev_info_t *xi, void *buf)
CNDP_API int xskdev_stats_reset(xskdev_info_t *xi)
CNDP_API __cne_always_inline void xskdev_buf_set_len(xskdev_info_t *xi, void *buf, int len)
CNDP_API __cne_always_inline uint16_t xskdev_buf_get_data_len(xskdev_info_t *xi, void *buf)
CNDP_API int xskdev_print_stats(const char *name, lport_stats_t *s, bool dbg_stats)