diff options
author | Björn Töpel <bjorn.topel@intel.com> | 2018-06-04 08:06:01 -0400 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-06-05 09:48:57 -0400 |
commit | 9f5232cc7f040f443f81069f553d31b27ab7eb79 (patch) | |
tree | 2b2c63350de9c72b786004ec5c01ce2bc0dea97b | |
parent | ac98d8aab61baf785eb8f099b36daf34fc76a70e (diff) |
samples/bpf: xdpsock: use skb Tx path for XDP_SKB
Make sure that XDP_SKB also uses the skb Tx path.
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | samples/bpf/xdpsock_user.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c index 7494f60fbff8..d69c8d78d3fd 100644 --- a/samples/bpf/xdpsock_user.c +++ b/samples/bpf/xdpsock_user.c | |||
@@ -75,6 +75,7 @@ static int opt_queue; | |||
75 | static int opt_poll; | 75 | static int opt_poll; |
76 | static int opt_shared_packet_buffer; | 76 | static int opt_shared_packet_buffer; |
77 | static int opt_interval = 1; | 77 | static int opt_interval = 1; |
78 | static u32 opt_xdp_bind_flags; | ||
78 | 79 | ||
79 | struct xdp_umem_uqueue { | 80 | struct xdp_umem_uqueue { |
80 | u32 cached_prod; | 81 | u32 cached_prod; |
@@ -541,9 +542,12 @@ static struct xdpsock *xsk_configure(struct xdp_umem *umem) | |||
541 | sxdp.sxdp_family = PF_XDP; | 542 | sxdp.sxdp_family = PF_XDP; |
542 | sxdp.sxdp_ifindex = opt_ifindex; | 543 | sxdp.sxdp_ifindex = opt_ifindex; |
543 | sxdp.sxdp_queue_id = opt_queue; | 544 | sxdp.sxdp_queue_id = opt_queue; |
545 | |||
544 | if (shared) { | 546 | if (shared) { |
545 | sxdp.sxdp_flags = XDP_SHARED_UMEM; | 547 | sxdp.sxdp_flags = XDP_SHARED_UMEM; |
546 | sxdp.sxdp_shared_umem_fd = umem->fd; | 548 | sxdp.sxdp_shared_umem_fd = umem->fd; |
549 | } else { | ||
550 | sxdp.sxdp_flags = opt_xdp_bind_flags; | ||
547 | } | 551 | } |
548 | 552 | ||
549 | lassert(bind(sfd, (struct sockaddr *)&sxdp, sizeof(sxdp)) == 0); | 553 | lassert(bind(sfd, (struct sockaddr *)&sxdp, sizeof(sxdp)) == 0); |
@@ -699,6 +703,7 @@ static void parse_command_line(int argc, char **argv) | |||
699 | break; | 703 | break; |
700 | case 'S': | 704 | case 'S': |
701 | opt_xdp_flags |= XDP_FLAGS_SKB_MODE; | 705 | opt_xdp_flags |= XDP_FLAGS_SKB_MODE; |
706 | opt_xdp_bind_flags |= XDP_COPY; | ||
702 | break; | 707 | break; |
703 | case 'N': | 708 | case 'N': |
704 | opt_xdp_flags |= XDP_FLAGS_DRV_MODE; | 709 | opt_xdp_flags |= XDP_FLAGS_DRV_MODE; |