Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2019 Intel Corporation. */
0003 
0004 #ifndef XSK_H_
0005 #define XSK_H_
0006 
0007 /* Masks for xdp_umem_page flags.
0008  * The low 12-bits of the addr will be 0 since this is the page address, so we
0009  * can use them for flags.
0010  */
0011 #define XSK_NEXT_PG_CONTIG_SHIFT 0
0012 #define XSK_NEXT_PG_CONTIG_MASK BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
0013 
0014 struct xdp_ring_offset_v1 {
0015     __u64 producer;
0016     __u64 consumer;
0017     __u64 desc;
0018 };
0019 
0020 struct xdp_mmap_offsets_v1 {
0021     struct xdp_ring_offset_v1 rx;
0022     struct xdp_ring_offset_v1 tx;
0023     struct xdp_ring_offset_v1 fr;
0024     struct xdp_ring_offset_v1 cr;
0025 };
0026 
0027 /* Nodes are linked in the struct xdp_sock map_list field, and used to
0028  * track which maps a certain socket reside in.
0029  */
0030 
0031 struct xsk_map_node {
0032     struct list_head node;
0033     struct xsk_map *map;
0034     struct xdp_sock __rcu **map_entry;
0035 };
0036 
0037 static inline struct xdp_sock *xdp_sk(struct sock *sk)
0038 {
0039     return (struct xdp_sock *)sk;
0040 }
0041 
0042 void xsk_map_try_sock_delete(struct xsk_map *map, struct xdp_sock *xs,
0043                  struct xdp_sock __rcu **map_entry);
0044 void xsk_clear_pool_at_qid(struct net_device *dev, u16 queue_id);
0045 int xsk_reg_pool_at_qid(struct net_device *dev, struct xsk_buff_pool *pool,
0046             u16 queue_id);
0047 
0048 #endif /* XSK_H_ */