Lines Matching refs:ctx

103 	struct xdp_buff ctx;  member
146 new_ctx = &head->ctx; in xdp_test_run_init_page()
235 return head->orig_ctx.data != head->ctx.data || in ctx_was_changed()
236 head->orig_ctx.data_meta != head->ctx.data_meta || in ctx_was_changed()
237 head->orig_ctx.data_end != head->ctx.data_end; in ctx_was_changed()
245 head->ctx.data = head->orig_ctx.data; in reset_ctx()
246 head->ctx.data_meta = head->orig_ctx.data_meta; in reset_ctx()
247 head->ctx.data_end = head->orig_ctx.data_end; in reset_ctx()
248 xdp_update_frame_from_buff(&head->ctx, head->frame); in reset_ctx()
295 struct xdp_buff *ctx; in xdp_test_run_batch() local
314 ctx = &head->ctx; in xdp_test_run_batch()
318 act = bpf_prog_run_xdp(prog, ctx); in xdp_test_run_batch()
322 ret = xdp_update_frame_from_buff(ctx, frm); in xdp_test_run_batch()
324 xdp_return_buff(ctx); in xdp_test_run_batch()
341 ret = xdp_do_redirect_frame(xdp->dev, ctx, frm, prog); in xdp_test_run_batch()
343 xdp_return_buff(ctx); in xdp_test_run_batch()
352 xdp_return_buff(ctx); in xdp_test_run_batch()
372 static int bpf_test_run_xdp_live(struct bpf_prog *prog, struct xdp_buff *ctx, in bpf_test_run_xdp_live() argument
383 ret = xdp_test_run_setup(&xdp, ctx); in bpf_test_run_xdp_live()
400 static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, in bpf_test_run() argument
432 *retval = bpf_prog_run_xdp(prog, ctx); in bpf_test_run()
434 *retval = bpf_prog_run(prog, ctx); in bpf_test_run()
736 void *ctx; member
750 info->retval = bpf_prog_run(info->prog, info->ctx); in __bpf_prog_test_run_raw_tp()
780 info.ctx = memdup_user(ctx_in, ctx_size_in); in bpf_prog_test_run_raw_tp()
781 if (IS_ERR(info.ctx)) in bpf_prog_test_run_raw_tp()
782 return PTR_ERR(info.ctx); in bpf_prog_test_run_raw_tp()
784 info.ctx = NULL; in bpf_prog_test_run_raw_tp()
810 kfree(info.ctx); in bpf_prog_test_run_raw_tp()
992 struct __sk_buff *ctx = NULL; in bpf_prog_test_run_skb() local
1010 ctx = bpf_ctx_init(kattr, sizeof(struct __sk_buff)); in bpf_prog_test_run_skb()
1011 if (IS_ERR(ctx)) { in bpf_prog_test_run_skb()
1013 return PTR_ERR(ctx); in bpf_prog_test_run_skb()
1034 kfree(ctx); in bpf_prog_test_run_skb()
1042 kfree(ctx); in bpf_prog_test_run_skb()
1051 if (ctx && ctx->ifindex > 1) { in bpf_prog_test_run_skb()
1052 dev = dev_get_by_index(net, ctx->ifindex); in bpf_prog_test_run_skb()
1087 ret = convert___skb_to_skb(skb, ctx); in bpf_prog_test_run_skb()
1127 convert_skb_to___skb(skb, ctx); in bpf_prog_test_run_skb()
1136 ret = bpf_ctx_finish(kattr, uattr, ctx, in bpf_prog_test_run_skb()
1143 kfree(ctx); in bpf_prog_test_run_skb()
1219 struct xdp_md *ctx; in bpf_prog_test_run_xdp() local
1243 ctx = bpf_ctx_init(kattr, sizeof(struct xdp_md)); in bpf_prog_test_run_xdp()
1244 if (IS_ERR(ctx)) in bpf_prog_test_run_xdp()
1245 return PTR_ERR(ctx); in bpf_prog_test_run_xdp()
1247 if (ctx) { in bpf_prog_test_run_xdp()
1249 if (ctx->data_meta || ctx->data_end != size || in bpf_prog_test_run_xdp()
1250 ctx->data > ctx->data_end || in bpf_prog_test_run_xdp()
1251 unlikely(xdp_metalen_invalid(ctx->data)) || in bpf_prog_test_run_xdp()
1255 headroom -= ctx->data; in bpf_prog_test_run_xdp()
1278 ret = xdp_convert_md_to_buff(ctx, &xdp); in bpf_prog_test_run_xdp()
1329 xdp_convert_buff_to_md(&xdp, ctx); in bpf_prog_test_run_xdp()
1337 ret = bpf_ctx_finish(kattr, uattr, ctx, in bpf_prog_test_run_xdp()
1348 kfree(ctx); in bpf_prog_test_run_xdp()
1352 static int verify_user_bpf_flow_keys(struct bpf_flow_keys *ctx) in verify_user_bpf_flow_keys() argument
1355 if (!range_is_zero(ctx, 0, offsetof(struct bpf_flow_keys, flags))) in verify_user_bpf_flow_keys()
1360 if (!range_is_zero(ctx, offsetofend(struct bpf_flow_keys, flags), in verify_user_bpf_flow_keys()
1373 struct bpf_flow_dissector ctx = {}; in bpf_prog_test_run_flow_dissector() local
1410 ctx.flow_keys = &flow_keys; in bpf_prog_test_run_flow_dissector()
1411 ctx.data = data; in bpf_prog_test_run_flow_dissector()
1412 ctx.data_end = (__u8 *)data + size; in bpf_prog_test_run_flow_dissector()
1416 retval = bpf_flow_dissect(prog, &ctx, eth->h_proto, ETH_HLEN, in bpf_prog_test_run_flow_dissector()
1441 struct bpf_sk_lookup_kern ctx = {}; in bpf_prog_test_run_sk_lookup() local
1475 ctx.family = (u16)user_ctx->family; in bpf_prog_test_run_sk_lookup()
1476 ctx.protocol = (u16)user_ctx->protocol; in bpf_prog_test_run_sk_lookup()
1477 ctx.dport = (u16)user_ctx->local_port; in bpf_prog_test_run_sk_lookup()
1478 ctx.sport = user_ctx->remote_port; in bpf_prog_test_run_sk_lookup()
1480 switch (ctx.family) { in bpf_prog_test_run_sk_lookup()
1482 ctx.v4.daddr = (__force __be32)user_ctx->local_ip4; in bpf_prog_test_run_sk_lookup()
1483 ctx.v4.saddr = (__force __be32)user_ctx->remote_ip4; in bpf_prog_test_run_sk_lookup()
1488 ctx.v6.daddr = (struct in6_addr *)user_ctx->local_ip6; in bpf_prog_test_run_sk_lookup()
1489 ctx.v6.saddr = (struct in6_addr *)user_ctx->remote_ip6; in bpf_prog_test_run_sk_lookup()
1508 ctx.selected_sk = NULL; in bpf_prog_test_run_sk_lookup()
1509 retval = BPF_PROG_SK_LOOKUP_RUN_ARRAY(progs, ctx, bpf_prog_run); in bpf_prog_test_run_sk_lookup()
1517 if (ctx.selected_sk) { in bpf_prog_test_run_sk_lookup()
1518 if (ctx.selected_sk->sk_reuseport && !ctx.no_reuseport) { in bpf_prog_test_run_sk_lookup()
1523 user_ctx->cookie = sock_gen_cookie(ctx.selected_sk); in bpf_prog_test_run_sk_lookup()
1542 void *ctx = NULL; in bpf_prog_test_run_syscall() local
1558 ctx = memdup_user(ctx_in, ctx_size_in); in bpf_prog_test_run_syscall()
1559 if (IS_ERR(ctx)) in bpf_prog_test_run_syscall()
1560 return PTR_ERR(ctx); in bpf_prog_test_run_syscall()
1564 retval = bpf_prog_run_pin_on_cpu(prog, ctx); in bpf_prog_test_run_syscall()
1572 if (copy_to_user(ctx_in, ctx, ctx_size_in)) in bpf_prog_test_run_syscall()
1575 kfree(ctx); in bpf_prog_test_run_syscall()
1646 struct bpf_nf_ctx ctx = { in bpf_prog_test_run_nf() local
1720 ctx.skb = skb; in bpf_prog_test_run_nf()
1722 ret = bpf_test_run(prog, &ctx, repeat, &retval, &duration, false); in bpf_prog_test_run_nf()