Lines Matching refs:nsim_dev
30 struct nsim_dev *nsim_dev; member
69 if (state->nsim_dev->bpf_bind_verifier_delay && !insn_idx) in nsim_bpf_verify_insn()
70 msleep(state->nsim_dev->bpf_bind_verifier_delay); in nsim_bpf_verify_insn()
75 if (!state->nsim_dev->bpf_bind_verifier_accept) in nsim_bpf_verify_insn()
218 static int nsim_bpf_create_prog(struct nsim_dev *nsim_dev, in nsim_bpf_create_prog() argument
229 state->nsim_dev = nsim_dev; in nsim_bpf_create_prog()
234 sprintf(name, "%u", nsim_dev->prog_id_gen++); in nsim_bpf_create_prog()
235 state->ddir = debugfs_create_dir(name, nsim_dev->ddir_bpf_bound_progs); in nsim_bpf_create_prog()
247 list_add_tail(&state->l, &nsim_dev->bpf_bound_progs); in nsim_bpf_create_prog()
256 struct nsim_dev *nsim_dev = in nsim_bpf_verifier_prep() local
259 if (!nsim_dev->bpf_bind_accept) in nsim_bpf_verifier_prep()
262 return nsim_bpf_create_prog(nsim_dev, prog); in nsim_bpf_verifier_prep()
520 list_add_tail(&nmap->l, &ns->nsim_dev->bpf_bound_maps); in nsim_bpf_map_alloc()
580 int nsim_bpf_dev_init(struct nsim_dev *nsim_dev) in nsim_bpf_dev_init() argument
584 INIT_LIST_HEAD(&nsim_dev->bpf_bound_progs); in nsim_bpf_dev_init()
585 INIT_LIST_HEAD(&nsim_dev->bpf_bound_maps); in nsim_bpf_dev_init()
587 nsim_dev->ddir_bpf_bound_progs = debugfs_create_dir("bpf_bound_progs", in nsim_bpf_dev_init()
588 nsim_dev->ddir); in nsim_bpf_dev_init()
589 if (IS_ERR(nsim_dev->ddir_bpf_bound_progs)) in nsim_bpf_dev_init()
590 return PTR_ERR(nsim_dev->ddir_bpf_bound_progs); in nsim_bpf_dev_init()
592 nsim_dev->bpf_dev = bpf_offload_dev_create(&nsim_bpf_dev_ops, nsim_dev); in nsim_bpf_dev_init()
593 err = PTR_ERR_OR_ZERO(nsim_dev->bpf_dev); in nsim_bpf_dev_init()
597 nsim_dev->bpf_bind_accept = true; in nsim_bpf_dev_init()
598 debugfs_create_bool("bpf_bind_accept", 0600, nsim_dev->ddir, in nsim_bpf_dev_init()
599 &nsim_dev->bpf_bind_accept); in nsim_bpf_dev_init()
600 debugfs_create_u32("bpf_bind_verifier_delay", 0600, nsim_dev->ddir, in nsim_bpf_dev_init()
601 &nsim_dev->bpf_bind_verifier_delay); in nsim_bpf_dev_init()
602 nsim_dev->bpf_bind_verifier_accept = true; in nsim_bpf_dev_init()
603 debugfs_create_bool("bpf_bind_verifier_accept", 0600, nsim_dev->ddir, in nsim_bpf_dev_init()
604 &nsim_dev->bpf_bind_verifier_accept); in nsim_bpf_dev_init()
608 void nsim_bpf_dev_exit(struct nsim_dev *nsim_dev) in nsim_bpf_dev_exit() argument
610 WARN_ON(!list_empty(&nsim_dev->bpf_bound_progs)); in nsim_bpf_dev_exit()
611 WARN_ON(!list_empty(&nsim_dev->bpf_bound_maps)); in nsim_bpf_dev_exit()
612 bpf_offload_dev_destroy(nsim_dev->bpf_dev); in nsim_bpf_dev_exit()
620 err = bpf_offload_dev_netdev_register(ns->nsim_dev->bpf_dev, in nsim_bpf_init()
652 bpf_offload_dev_netdev_unregister(ns->nsim_dev->bpf_dev, ns->netdev); in nsim_bpf_uninit()