Lines Matching full:offload

29 /* Protects offdevs, members of bpf_offload_netdev and offload members
83 struct bpf_prog_offload *offload; in bpf_prog_offload_init() local
93 offload = kzalloc(sizeof(*offload), GFP_USER); in bpf_prog_offload_init()
94 if (!offload) in bpf_prog_offload_init()
97 offload->prog = prog; in bpf_prog_offload_init()
99 offload->netdev = dev_get_by_index(current->nsproxy->net_ns, in bpf_prog_offload_init()
101 err = bpf_dev_offload_check(offload->netdev); in bpf_prog_offload_init()
106 ondev = bpf_offload_find_netdev(offload->netdev); in bpf_prog_offload_init()
111 offload->offdev = ondev->offdev; in bpf_prog_offload_init()
112 prog->aux->offload = offload; in bpf_prog_offload_init()
113 list_add_tail(&offload->offloads, &ondev->progs); in bpf_prog_offload_init()
114 dev_put(offload->netdev); in bpf_prog_offload_init()
121 if (offload->netdev) in bpf_prog_offload_init()
122 dev_put(offload->netdev); in bpf_prog_offload_init()
123 kfree(offload); in bpf_prog_offload_init()
129 struct bpf_prog_offload *offload; in bpf_prog_offload_verifier_prep() local
133 offload = prog->aux->offload; in bpf_prog_offload_verifier_prep()
134 if (offload) { in bpf_prog_offload_verifier_prep()
135 ret = offload->offdev->ops->prepare(prog); in bpf_prog_offload_verifier_prep()
136 offload->dev_state = !ret; in bpf_prog_offload_verifier_prep()
146 struct bpf_prog_offload *offload; in bpf_prog_offload_verify_insn() local
150 offload = env->prog->aux->offload; in bpf_prog_offload_verify_insn()
151 if (offload) in bpf_prog_offload_verify_insn()
152 ret = offload->offdev->ops->insn_hook(env, insn_idx, in bpf_prog_offload_verify_insn()
161 struct bpf_prog_offload *offload; in bpf_prog_offload_finalize() local
165 offload = env->prog->aux->offload; in bpf_prog_offload_finalize()
166 if (offload) { in bpf_prog_offload_finalize()
167 if (offload->offdev->ops->finalize) in bpf_prog_offload_finalize()
168 ret = offload->offdev->ops->finalize(env); in bpf_prog_offload_finalize()
182 struct bpf_prog_offload *offload; in bpf_prog_offload_replace_insn() local
186 offload = env->prog->aux->offload; in bpf_prog_offload_replace_insn()
187 if (offload) { in bpf_prog_offload_replace_insn()
188 ops = offload->offdev->ops; in bpf_prog_offload_replace_insn()
189 if (!offload->opt_failed && ops->replace_insn) in bpf_prog_offload_replace_insn()
191 offload->opt_failed |= ret; in bpf_prog_offload_replace_insn()
199 struct bpf_prog_offload *offload; in bpf_prog_offload_remove_insns() local
203 offload = env->prog->aux->offload; in bpf_prog_offload_remove_insns()
204 if (offload) { in bpf_prog_offload_remove_insns()
205 if (!offload->opt_failed && offload->offdev->ops->remove_insns) in bpf_prog_offload_remove_insns()
206 ret = offload->offdev->ops->remove_insns(env, off, cnt); in bpf_prog_offload_remove_insns()
207 offload->opt_failed |= ret; in bpf_prog_offload_remove_insns()
214 struct bpf_prog_offload *offload = prog->aux->offload; in __bpf_prog_offload_destroy() local
216 if (offload->dev_state) in __bpf_prog_offload_destroy()
217 offload->offdev->ops->destroy(prog); in __bpf_prog_offload_destroy()
222 list_del_init(&offload->offloads); in __bpf_prog_offload_destroy()
223 kfree(offload); in __bpf_prog_offload_destroy()
224 prog->aux->offload = NULL; in __bpf_prog_offload_destroy()
230 if (prog->aux->offload) in bpf_prog_offload_destroy()
237 struct bpf_prog_offload *offload; in bpf_prog_offload_translate() local
241 offload = prog->aux->offload; in bpf_prog_offload_translate()
242 if (offload) in bpf_prog_offload_translate()
243 ret = offload->offdev->ops->translate(prog); in bpf_prog_offload_translate()
278 if (aux->offload) { in bpf_prog_offload_info_fill_ns()
279 args->info->ifindex = aux->offload->netdev->ifindex; in bpf_prog_offload_info_fill_ns()
280 net = dev_net(aux->offload->netdev); in bpf_prog_offload_info_fill_ns()
317 if (!aux->offload) { in bpf_prog_offload_info_fill()
323 info->jited_prog_len = aux->offload->jited_len; in bpf_prog_offload_info_fill()
327 if (copy_to_user(uinsns, aux->offload->jited_image, ulen)) { in bpf_prog_offload_info_fill()
550 struct bpf_prog_offload *offload; in __bpf_offload_dev_match() local
555 offload = prog->aux->offload; in __bpf_offload_dev_match()
556 if (!offload) in __bpf_offload_dev_match()
558 if (offload->netdev == netdev) in __bpf_offload_dev_match()
561 ondev1 = bpf_offload_find_netdev(offload->netdev); in __bpf_offload_dev_match()
613 netdev_warn(netdev, "failed to register for BPF offload\n"); in bpf_offload_dev_netdev_register()
633 struct bpf_prog_offload *offload, *ptmp; in bpf_offload_dev_netdev_unregister() local
650 list_for_each_entry(offload, &ondev->progs, offloads) in bpf_offload_dev_netdev_unregister()
651 offload->netdev = altdev->netdev; in bpf_offload_dev_netdev_unregister()
658 list_for_each_entry_safe(offload, ptmp, &ondev->progs, offloads) in bpf_offload_dev_netdev_unregister()
659 __bpf_prog_offload_destroy(offload->prog); in bpf_offload_dev_netdev_unregister()