#ifndef _LINUX_XDP_SOCK_DRV_H
#define _LINUX_XDP_SOCK_DRV_H
#include <net/xdp_sock.h>
#include <net/xsk_buff_pool.h>
#define XDP_UMEM_MIN_CHUNK_SHIFT …
#define XDP_UMEM_MIN_CHUNK_SIZE …
struct xsk_cb_desc { … };
#ifdef CONFIG_XDP_SOCKETS
void xsk_tx_completed(struct xsk_buff_pool *pool, u32 nb_entries);
bool xsk_tx_peek_desc(struct xsk_buff_pool *pool, struct xdp_desc *desc);
u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max);
void xsk_tx_release(struct xsk_buff_pool *pool);
struct xsk_buff_pool *xsk_get_pool_from_qid(struct net_device *dev,
u16 queue_id);
void xsk_set_rx_need_wakeup(struct xsk_buff_pool *pool);
void xsk_set_tx_need_wakeup(struct xsk_buff_pool *pool);
void xsk_clear_rx_need_wakeup(struct xsk_buff_pool *pool);
void xsk_clear_tx_need_wakeup(struct xsk_buff_pool *pool);
bool xsk_uses_need_wakeup(struct xsk_buff_pool *pool);
static inline u32 xsk_pool_get_headroom(struct xsk_buff_pool *pool)
{ … }
static inline u32 xsk_pool_get_chunk_size(struct xsk_buff_pool *pool)
{ … }
static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
{ … }
static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
struct xdp_rxq_info *rxq)
{ … }
static inline void xsk_pool_fill_cb(struct xsk_buff_pool *pool,
struct xsk_cb_desc *desc)
{ … }
static inline unsigned int xsk_pool_get_napi_id(struct xsk_buff_pool *pool)
{ … }
static inline void xsk_pool_dma_unmap(struct xsk_buff_pool *pool,
unsigned long attrs)
{ … }
static inline int xsk_pool_dma_map(struct xsk_buff_pool *pool,
struct device *dev, unsigned long attrs)
{ … }
static inline dma_addr_t xsk_buff_xdp_get_dma(struct xdp_buff *xdp)
{ … }
static inline dma_addr_t xsk_buff_xdp_get_frame_dma(struct xdp_buff *xdp)
{ … }
static inline struct xdp_buff *xsk_buff_alloc(struct xsk_buff_pool *pool)
{ … }
static inline bool xsk_is_eop_desc(struct xdp_desc *desc)
{ … }
static inline u32 xsk_buff_alloc_batch(struct xsk_buff_pool *pool, struct xdp_buff **xdp, u32 max)
{ … }
static inline bool xsk_buff_can_alloc(struct xsk_buff_pool *pool, u32 count)
{ … }
static inline void xsk_buff_free(struct xdp_buff *xdp)
{ … }
static inline void xsk_buff_add_frag(struct xdp_buff *xdp)
{ … }
static inline struct xdp_buff *xsk_buff_get_frag(struct xdp_buff *first)
{ … }
static inline void xsk_buff_del_tail(struct xdp_buff *tail)
{ … }
static inline struct xdp_buff *xsk_buff_get_tail(struct xdp_buff *first)
{ … }
static inline void xsk_buff_set_size(struct xdp_buff *xdp, u32 size)
{ … }
static inline dma_addr_t xsk_buff_raw_get_dma(struct xsk_buff_pool *pool,
u64 addr)
{ … }
static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr)
{ … }
#define XDP_TXMD_FLAGS_VALID …
static inline bool xsk_buff_valid_tx_metadata(struct xsk_tx_metadata *meta)
{ … }
static inline struct xsk_tx_metadata *xsk_buff_get_metadata(struct xsk_buff_pool *pool, u64 addr)
{ … }
static inline void xsk_buff_dma_sync_for_cpu(struct xdp_buff *xdp)
{ … }
static inline void xsk_buff_raw_dma_sync_for_device(struct xsk_buff_pool *pool,
dma_addr_t dma,
size_t size)
{ … }
#else
static inline void xsk_tx_completed(struct xsk_buff_pool *pool, u32 nb_entries)
{
}
static inline bool xsk_tx_peek_desc(struct xsk_buff_pool *pool,
struct xdp_desc *desc)
{
return false;
}
static inline u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max)
{
return 0;
}
static inline void xsk_tx_release(struct xsk_buff_pool *pool)
{
}
static inline struct xsk_buff_pool *
xsk_get_pool_from_qid(struct net_device *dev, u16 queue_id)
{
return NULL;
}
static inline void xsk_set_rx_need_wakeup(struct xsk_buff_pool *pool)
{
}
static inline void xsk_set_tx_need_wakeup(struct xsk_buff_pool *pool)
{
}
static inline void xsk_clear_rx_need_wakeup(struct xsk_buff_pool *pool)
{
}
static inline void xsk_clear_tx_need_wakeup(struct xsk_buff_pool *pool)
{
}
static inline bool xsk_uses_need_wakeup(struct xsk_buff_pool *pool)
{
return false;
}
static inline u32 xsk_pool_get_headroom(struct xsk_buff_pool *pool)
{
return 0;
}
static inline u32 xsk_pool_get_chunk_size(struct xsk_buff_pool *pool)
{
return 0;
}
static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
{
return 0;
}
static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
struct xdp_rxq_info *rxq)
{
}
static inline void xsk_pool_fill_cb(struct xsk_buff_pool *pool,
struct xsk_cb_desc *desc)
{
}
static inline unsigned int xsk_pool_get_napi_id(struct xsk_buff_pool *pool)
{
return 0;
}
static inline void xsk_pool_dma_unmap(struct xsk_buff_pool *pool,
unsigned long attrs)
{
}
static inline int xsk_pool_dma_map(struct xsk_buff_pool *pool,
struct device *dev, unsigned long attrs)
{
return 0;
}
static inline dma_addr_t xsk_buff_xdp_get_dma(struct xdp_buff *xdp)
{
return 0;
}
static inline dma_addr_t xsk_buff_xdp_get_frame_dma(struct xdp_buff *xdp)
{
return 0;
}
static inline struct xdp_buff *xsk_buff_alloc(struct xsk_buff_pool *pool)
{
return NULL;
}
static inline bool xsk_is_eop_desc(struct xdp_desc *desc)
{
return false;
}
static inline u32 xsk_buff_alloc_batch(struct xsk_buff_pool *pool, struct xdp_buff **xdp, u32 max)
{
return 0;
}
static inline bool xsk_buff_can_alloc(struct xsk_buff_pool *pool, u32 count)
{
return false;
}
static inline void xsk_buff_free(struct xdp_buff *xdp)
{
}
static inline void xsk_buff_add_frag(struct xdp_buff *xdp)
{
}
static inline struct xdp_buff *xsk_buff_get_frag(struct xdp_buff *first)
{
return NULL;
}
static inline void xsk_buff_del_tail(struct xdp_buff *tail)
{
}
static inline struct xdp_buff *xsk_buff_get_tail(struct xdp_buff *first)
{
return NULL;
}
static inline void xsk_buff_set_size(struct xdp_buff *xdp, u32 size)
{
}
static inline dma_addr_t xsk_buff_raw_get_dma(struct xsk_buff_pool *pool,
u64 addr)
{
return 0;
}
static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr)
{
return NULL;
}
static inline bool xsk_buff_valid_tx_metadata(struct xsk_tx_metadata *meta)
{
return false;
}
static inline struct xsk_tx_metadata *xsk_buff_get_metadata(struct xsk_buff_pool *pool, u64 addr)
{
return NULL;
}
static inline void xsk_buff_dma_sync_for_cpu(struct xdp_buff *xdp)
{
}
static inline void xsk_buff_raw_dma_sync_for_device(struct xsk_buff_pool *pool,
dma_addr_t dma,
size_t size)
{
}
#endif
#endif