History

bpf: add msg_pop_data helper to tools

Add the necessary header definitions to tools for new msg_pop_data_helper.

John Fastabend committed 7 years ago

Commit d913a221 parent 7246d8e2 files · +17 −1Browse files

Unified · Split

2 files
  1. tools/include/uapi/linux/bpf.h +15 −1
  2. tools/testing/selftests/bpf/bpf_helpers.h +2 −0
tools/include/uapi/linux/bpf.h+15−1
@@ -2268,6 +2268,19 @@ union bpf_attr { · 2267 unmodified lines
2268 *2268 *
2269 * Return2269 * Return
2270 * 0 on success, or a negative error in case of failure.2270 * 0 on success, or a negative error in case of failure.
2271 *
2272 * int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags)
2273 * Description
2274 * Will remove *pop* bytes from a *msg* starting at byte *start*.
2275 * This may result in **ENOMEM** errors under certain situations if
2276 * an allocation and copy are required due to a full ring buffer.
2277 * However, the helper will try to avoid doing the allocation
2278 * if possible. Other errors can occur if input parameters are
2279 * invalid either due to *start* byte not being valid part of msg
2280 * payload and/or *pop* value being to large.
2281 *
2282 * Return
2283 * 0 on success, or a negative erro in case of failure.
2271 */2284 */
2272#define __BPF_FUNC_MAPPER(FN) \2285#define __BPF_FUNC_MAPPER(FN) \
2273 FN(unspec), \2286 FN(unspec), \
@@ -2360,7 +2373,8 @@ union bpf_attr { · 86 unmodified lines
2360 FN(map_push_elem), \2373 FN(map_push_elem), \
2361 FN(map_pop_elem), \2374 FN(map_pop_elem), \
2362 FN(map_peek_elem), \2375 FN(map_peek_elem), \
2363 FN(msg_push_data),2376 FN(msg_push_data), \
2377 FN(msg_pop_data),
2364 2378
2365/* integer value in 'imm' field of BPF_CALL instruction selects which helper2379/* integer value in 'imm' field of BPF_CALL instruction selects which helper
2366 * function eBPF program intends to call2380 * function eBPF program intends to call
tools/testing/selftests/bpf/bpf_helpers.h+2−0
@@ -113,6 +113,8 @@ static int (*bpf_msg_pull_data)(void *ctx, int start, int end, int flags) = · 112 unmodified lines
113 (void *) BPF_FUNC_msg_pull_data;113 (void *) BPF_FUNC_msg_pull_data;
114static int (*bpf_msg_push_data)(void *ctx, int start, int end, int flags) =114static int (*bpf_msg_push_data)(void *ctx, int start, int end, int flags) =
115 (void *) BPF_FUNC_msg_push_data;115 (void *) BPF_FUNC_msg_push_data;
116static int (*bpf_msg_pop_data)(void *ctx, int start, int cut, int flags) =
117 (void *) BPF_FUNC_msg_pop_data;
116static int (*bpf_bind)(void *ctx, void *addr, int addr_len) =118static int (*bpf_bind)(void *ctx, void *addr, int addr_len) =
117 (void *) BPF_FUNC_bind;119 (void *) BPF_FUNC_bind;
118static int (*bpf_xdp_adjust_tail)(void *ctx, int offset) =120static int (*bpf_xdp_adjust_tail)(void *ctx, int offset) =

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t