aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorBjörn Töpel <bjorn.topel@intel.com>2018-06-04 14:05:55 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2018-06-05 15:46:55 +0200
commit173d3adb6f437037f216270955886ca9878187a5 (patch)
tree9eb770a9b2a2b74d1a19dc7ac3d3ec417c337057 /include
parentxdp: add MEM_TYPE_ZERO_COPY (diff)
downloadwireguard-linux-173d3adb6f437037f216270955886ca9878187a5.tar.xz
wireguard-linux-173d3adb6f437037f216270955886ca9878187a5.zip
xsk: add zero-copy support for Rx
Extend the xsk_rcv to support the new MEM_TYPE_ZERO_COPY memory, and wireup ndo_bpf call in bind. Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/xdp_sock.h6
-rw-r--r--include/uapi/linux/if_xdp.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
index caf343a7e224..d93d3aac3fc9 100644
--- a/include/net/xdp_sock.h
+++ b/include/net/xdp_sock.h
@@ -22,6 +22,7 @@ struct xdp_umem_props {
struct xdp_umem_page {
void *addr;
+ dma_addr_t dma;
};
struct xdp_umem {
@@ -38,6 +39,9 @@ struct xdp_umem {
struct work_struct work;
struct page **pgs;
u32 npgs;
+ struct net_device *dev;
+ u16 queue_id;
+ bool zc;
};
struct xdp_sock {
@@ -60,6 +64,8 @@ int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);
int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);
void xsk_flush(struct xdp_sock *xs);
bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs);
+u64 *xsk_umem_peek_addr(struct xdp_umem *umem, u64 *addr);
+void xsk_umem_discard_addr(struct xdp_umem *umem);
#else
static inline int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp)
{
diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h
index e411d6f9ac65..1fa0e977ea8d 100644
--- a/include/uapi/linux/if_xdp.h
+++ b/include/uapi/linux/if_xdp.h
@@ -13,7 +13,9 @@
#include <linux/types.h>
/* Options for the sxdp_flags field */
-#define XDP_SHARED_UMEM 1
+#define XDP_SHARED_UMEM (1 << 0)
+#define XDP_COPY (1 << 1) /* Force copy-mode */
+#define XDP_ZEROCOPY (1 << 2) /* Force zero-copy mode */
struct sockaddr_xdp {
__u16 sxdp_family;