In this commit the base structure of the AF_XDP address family is set up. Further, we introduce the abilty register a window of user memory to the kernel via the XDP_UMEM_REG setsockopt syscall. The memory window is viewed by an AF_XDP socket as a set of equally large frames. After a user memory registration all frames are "owned" by the user application, and not the kernel. v2: More robust checks on umem creation and unaccount on error. Call set_page_dirty_lock on cleanup. Simplified xdp_umem_reg.
Showing the changes to include/uapi/linux (1 of 8 files). Show all
Unified · Split
| @@ -0,0 +1,34 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note | |
| 2 | + * | |
| 3 | + * if_xdp: XDP socket user-space interface | |
| 4 | + * Copyright(c) 2018 Intel Corporation. | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or modify it | |
| 7 | + * under the terms and conditions of the GNU General Public License, | |
| 8 | + * version 2, as published by the Free Software Foundation. | |
| 9 | + * | |
| 10 | + * This program is distributed in the hope it will be useful, but WITHOUT | |
| 11 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 12 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 13 | + * more details. | |
| 14 | + * | |
| 15 | + * Author(s): Björn Töpel <bjorn.topel@intel.com> | |
| 16 | + * Magnus Karlsson <magnus.karlsson@intel.com> | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef _LINUX_IF_XDP_H | |
| 20 | +#define _LINUX_IF_XDP_H | |
| 21 | + | |
| 22 | +#include <linux/types.h> | |
| 23 | + | |
| 24 | +/* XDP socket options */ | |
| 25 | +#define XDP_UMEM_REG 3 | |
| 26 | + | |
| 27 | +struct xdp_umem_reg { | |
| 28 | + __u64 addr; /* Start of packet data area */ | |
| 29 | + __u64 len; /* Length of packet data area */ | |
| 30 | + __u32 frame_size; /* Frame size */ | |
| 31 | + __u32 frame_headroom; /* Frame head room */ | |
| 32 | +}; | |
| 33 | + | |
| 34 | +#endif /* _LINUX_IF_XDP_H */ | |