1 /* SPDX-License-Identifier: GPL-2.0
2 * AF_XDP internal functions
3 * Copyright(c) 2018 Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #ifndef _LINUX_XDP_SOCK_H
16 #define _LINUX_XDP_SOCK_H
18 #include <linux/mutex.h>
26 /* struct sock must be the first member of struct xdp_sock */
29 struct net_device *dev;
30 struct xdp_umem *umem;
31 struct list_head flush_node;
33 struct xsk_queue *tx ____cacheline_aligned_in_smp;
34 /* Protects multiple processes in the control path */
40 #ifdef CONFIG_XDP_SOCKETS
41 int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);
42 int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);
43 void xsk_flush(struct xdp_sock *xs);
44 bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs);
46 static inline int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp)
51 static inline int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp)
56 static inline void xsk_flush(struct xdp_sock *xs)
60 static inline bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs)
64 #endif /* CONFIG_XDP_SOCKETS */
66 #endif /* _LINUX_XDP_SOCK_H */