0001
0002
0003
0004
0005 #ifndef _NFP_XSK_H_
0006 #define _NFP_XSK_H_
0007
0008 #include <net/xdp_sock_drv.h>
0009
0010 #define NFP_NET_XSK_TX_BATCH 16
0011
0012 static inline bool nfp_net_has_xsk_pool_slow(struct nfp_net_dp *dp,
0013 unsigned int qid)
0014 {
0015 return dp->xdp_prog && dp->xsk_pools[qid];
0016 }
0017
0018 static inline int nfp_net_rx_space(struct nfp_net_rx_ring *rx_ring)
0019 {
0020 return rx_ring->cnt - rx_ring->wr_p + rx_ring->rd_p - 1;
0021 }
0022
0023 static inline int nfp_net_tx_space(struct nfp_net_tx_ring *tx_ring)
0024 {
0025 return tx_ring->cnt - tx_ring->wr_p + tx_ring->rd_p - 1;
0026 }
0027
0028 void nfp_net_xsk_rx_unstash(struct nfp_net_xsk_rx_buf *rxbuf);
0029 void nfp_net_xsk_rx_free(struct nfp_net_xsk_rx_buf *rxbuf);
0030 void nfp_net_xsk_rx_drop(struct nfp_net_r_vector *r_vec,
0031 struct nfp_net_xsk_rx_buf *xrxbuf);
0032 int nfp_net_xsk_setup_pool(struct net_device *netdev, struct xsk_buff_pool *pool,
0033 u16 queue_id);
0034
0035 void nfp_net_xsk_rx_bufs_free(struct nfp_net_rx_ring *rx_ring);
0036
0037 void nfp_net_xsk_rx_ring_fill_freelist(struct nfp_net_rx_ring *rx_ring);
0038
0039 int nfp_net_xsk_wakeup(struct net_device *netdev, u32 queue_id, u32 flags);
0040
0041 #endif