1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright(c) 2019 Intel Corporation. */ 3 4 #ifndef XSK_H_ 5 #define XSK_H_ 6 7 struct xdp_ring_offset_v1 { 8 __u64 producer; 9 __u64 consumer; 10 __u64 desc; 11 }; 12 13 struct xdp_mmap_offsets_v1 { 14 struct xdp_ring_offset_v1 rx; 15 struct xdp_ring_offset_v1 tx; 16 struct xdp_ring_offset_v1 fr; 17 struct xdp_ring_offset_v1 cr; 18 }; 19 20 /* Nodes are linked in the struct xdp_sock map_list field, and used to 21 * track which maps a certain socket reside in. 22 */ 23 24 struct xsk_map_node { 25 struct list_head node; 26 struct xsk_map *map; 27 struct xdp_sock __rcu **map_entry; 28 }; 29 30 static inline struct xdp_sock *xdp_sk(struct sock *sk) 31 { 32 return (struct xdp_sock *)sk; 33 } 34 35 void xsk_map_try_sock_delete(struct xsk_map *map, struct xdp_sock *xs, 36 struct xdp_sock __rcu **map_entry); 37 void xsk_clear_pool_at_qid(struct net_device *dev, u16 queue_id); 38 int xsk_reg_pool_at_qid(struct net_device *dev, struct xsk_buff_pool *pool, 39 u16 queue_id); 40 41 #endif /* XSK_H_ */ 42