diff options
author | Eric Leblond <eric@regit.org> | 2019-06-21 16:13:10 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-06-24 21:18:30 -0400 |
commit | 0bed61371f7d537ecb6e1833acf59a74ae183b37 (patch) | |
tree | fec3937ab54550da57718c313d1686231dd91030 /Documentation/networking | |
parent | 900de4ac4953fcf5e25ea45bea5bb28e797b1420 (diff) |
xsk: sample kernel code is now in libbpf
Fix documentation that mention xdpsock_kern.c which has been
replaced by code embedded in libbpf.
Signed-off-by: Eric Leblond <eric@regit.org>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'Documentation/networking')
-rw-r--r-- | Documentation/networking/af_xdp.rst | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Documentation/networking/af_xdp.rst b/Documentation/networking/af_xdp.rst index 50bccbf68308..eeedc2e826aa 100644 --- a/Documentation/networking/af_xdp.rst +++ b/Documentation/networking/af_xdp.rst | |||
@@ -220,7 +220,21 @@ Usage | |||
220 | In order to use AF_XDP sockets there are two parts needed. The | 220 | In order to use AF_XDP sockets there are two parts needed. The |
221 | user-space application and the XDP program. For a complete setup and | 221 | user-space application and the XDP program. For a complete setup and |
222 | usage example, please refer to the sample application. The user-space | 222 | usage example, please refer to the sample application. The user-space |
223 | side is xdpsock_user.c and the XDP side xdpsock_kern.c. | 223 | side is xdpsock_user.c and the XDP side is part of libbpf. |
224 | |||
225 | The XDP code sample included in tools/lib/bpf/xsk.c is the following:: | ||
226 | |||
227 | SEC("xdp_sock") int xdp_sock_prog(struct xdp_md *ctx) | ||
228 | { | ||
229 | int index = ctx->rx_queue_index; | ||
230 | |||
231 | // A set entry here means that the correspnding queue_id | ||
232 | // has an active AF_XDP socket bound to it. | ||
233 | if (bpf_map_lookup_elem(&xsks_map, &index)) | ||
234 | return bpf_redirect_map(&xsks_map, index, 0); | ||
235 | |||
236 | return XDP_PASS; | ||
237 | } | ||
224 | 238 | ||
225 | Naive ring dequeue and enqueue could look like this:: | 239 | Naive ring dequeue and enqueue could look like this:: |
226 | 240 | ||