Lines Matching full:offload
30 /* Protects offdevs, members of bpf_offload_netdev and offload members
95 netdev_warn(netdev, "failed to register for BPF offload\n"); in __bpf_offload_dev_netdev_register()
110 struct bpf_prog_offload *offload = prog->aux->offload; in __bpf_prog_offload_destroy() local
112 if (offload->dev_state) in __bpf_prog_offload_destroy()
113 offload->offdev->ops->destroy(prog); in __bpf_prog_offload_destroy()
115 list_del_init(&offload->offloads); in __bpf_prog_offload_destroy()
116 kfree(offload); in __bpf_prog_offload_destroy()
117 prog->aux->offload = NULL; in __bpf_prog_offload_destroy()
150 struct bpf_prog_offload *offload, *ptmp; in __bpf_offload_dev_netdev_unregister() local
169 list_for_each_entry(offload, &ondev->progs, offloads) in __bpf_offload_dev_netdev_unregister()
170 offload->netdev = altdev->netdev; in __bpf_offload_dev_netdev_unregister()
177 list_for_each_entry_safe(offload, ptmp, &ondev->progs, offloads) in __bpf_offload_dev_netdev_unregister()
178 __bpf_prog_offload_destroy(offload->prog); in __bpf_offload_dev_netdev_unregister()
191 struct bpf_prog_offload *offload; in __bpf_prog_dev_bound_init() local
194 offload = kzalloc(sizeof(*offload), GFP_USER); in __bpf_prog_dev_bound_init()
195 if (!offload) in __bpf_prog_dev_bound_init()
198 offload->prog = prog; in __bpf_prog_dev_bound_init()
199 offload->netdev = netdev; in __bpf_prog_dev_bound_init()
201 ondev = bpf_offload_find_netdev(offload->netdev); in __bpf_prog_dev_bound_init()
213 err = __bpf_offload_dev_netdev_register(NULL, offload->netdev); in __bpf_prog_dev_bound_init()
216 ondev = bpf_offload_find_netdev(offload->netdev); in __bpf_prog_dev_bound_init()
218 offload->offdev = ondev->offdev; in __bpf_prog_dev_bound_init()
219 prog->aux->offload = offload; in __bpf_prog_dev_bound_init()
220 list_add_tail(&offload->offloads, &ondev->progs); in __bpf_prog_dev_bound_init()
224 kfree(offload); in __bpf_prog_dev_bound_init()
241 * if it is requesting bpf offload. in bpf_prog_dev_bound_init()
284 if (!old_prog->aux->offload) { in bpf_prog_dev_bound_inherit()
289 err = __bpf_prog_dev_bound_init(new_prog, old_prog->aux->offload->netdev); in bpf_prog_dev_bound_inherit()
298 struct bpf_prog_offload *offload; in bpf_prog_offload_verifier_prep() local
302 offload = prog->aux->offload; in bpf_prog_offload_verifier_prep()
303 if (offload) { in bpf_prog_offload_verifier_prep()
304 ret = offload->offdev->ops->prepare(prog); in bpf_prog_offload_verifier_prep()
305 offload->dev_state = !ret; in bpf_prog_offload_verifier_prep()
315 struct bpf_prog_offload *offload; in bpf_prog_offload_verify_insn() local
319 offload = env->prog->aux->offload; in bpf_prog_offload_verify_insn()
320 if (offload) in bpf_prog_offload_verify_insn()
321 ret = offload->offdev->ops->insn_hook(env, insn_idx, in bpf_prog_offload_verify_insn()
330 struct bpf_prog_offload *offload; in bpf_prog_offload_finalize() local
334 offload = env->prog->aux->offload; in bpf_prog_offload_finalize()
335 if (offload) { in bpf_prog_offload_finalize()
336 if (offload->offdev->ops->finalize) in bpf_prog_offload_finalize()
337 ret = offload->offdev->ops->finalize(env); in bpf_prog_offload_finalize()
351 struct bpf_prog_offload *offload; in bpf_prog_offload_replace_insn() local
355 offload = env->prog->aux->offload; in bpf_prog_offload_replace_insn()
356 if (offload) { in bpf_prog_offload_replace_insn()
357 ops = offload->offdev->ops; in bpf_prog_offload_replace_insn()
358 if (!offload->opt_failed && ops->replace_insn) in bpf_prog_offload_replace_insn()
360 offload->opt_failed |= ret; in bpf_prog_offload_replace_insn()
368 struct bpf_prog_offload *offload; in bpf_prog_offload_remove_insns() local
372 offload = env->prog->aux->offload; in bpf_prog_offload_remove_insns()
373 if (offload) { in bpf_prog_offload_remove_insns()
374 if (!offload->opt_failed && offload->offdev->ops->remove_insns) in bpf_prog_offload_remove_insns()
375 ret = offload->offdev->ops->remove_insns(env, off, cnt); in bpf_prog_offload_remove_insns()
376 offload->opt_failed |= ret; in bpf_prog_offload_remove_insns()
388 if (prog->aux->offload) { in bpf_prog_dev_bound_destroy()
389 list_del_init(&prog->aux->offload->offloads); in bpf_prog_dev_bound_destroy()
391 netdev = prog->aux->offload->netdev; in bpf_prog_dev_bound_destroy()
404 struct bpf_prog_offload *offload; in bpf_prog_offload_translate() local
408 offload = prog->aux->offload; in bpf_prog_offload_translate()
409 if (offload) in bpf_prog_offload_translate()
410 ret = offload->offdev->ops->translate(prog); in bpf_prog_offload_translate()
445 if (aux->offload) { in bpf_prog_offload_info_fill_ns()
446 args->info->ifindex = aux->offload->netdev->ifindex; in bpf_prog_offload_info_fill_ns()
447 net = dev_net(aux->offload->netdev); in bpf_prog_offload_info_fill_ns()
484 if (!aux->offload) { in bpf_prog_offload_info_fill()
490 info->jited_prog_len = aux->offload->jited_len; in bpf_prog_offload_info_fill()
494 if (copy_to_user(uinsns, aux->offload->jited_image, ulen)) { in bpf_prog_offload_info_fill()
698 struct bpf_prog_offload *offload; in __bpf_offload_dev_match() local
703 offload = prog->aux->offload; in __bpf_offload_dev_match()
704 if (!offload) in __bpf_offload_dev_match()
706 if (offload->netdev == netdev) in __bpf_offload_dev_match()
709 ondev1 = bpf_offload_find_netdev(offload->netdev); in __bpf_offload_dev_match()
735 ret = lhs->aux->offload && rhs->aux->offload && in bpf_prog_dev_bound_match()
736 lhs->aux->offload->netdev && in bpf_prog_dev_bound_match()
737 lhs->aux->offload->netdev == rhs->aux->offload->netdev; in bpf_prog_dev_bound_match()
850 if (!prog->aux->offload) in bpf_dev_bound_resolve_kfunc()
853 ops = prog->aux->offload->netdev->xdp_metadata_ops; in bpf_dev_bound_resolve_kfunc()