Lines Matching refs:cfg

176 static int tcf_bpf_init_from_ops(struct nlattr **tb, struct tcf_bpf_cfg *cfg)  in tcf_bpf_init_from_ops()  argument
207 cfg->bpf_ops = bpf_ops; in tcf_bpf_init_from_ops()
208 cfg->bpf_num_ops = bpf_num_ops; in tcf_bpf_init_from_ops()
209 cfg->filter = fp; in tcf_bpf_init_from_ops()
210 cfg->is_ebpf = false; in tcf_bpf_init_from_ops()
215 static int tcf_bpf_init_from_efd(struct nlattr **tb, struct tcf_bpf_cfg *cfg) in tcf_bpf_init_from_efd() argument
242 cfg->bpf_fd = bpf_fd; in tcf_bpf_init_from_efd()
243 cfg->bpf_name = name; in tcf_bpf_init_from_efd()
244 cfg->filter = fp; in tcf_bpf_init_from_efd()
245 cfg->is_ebpf = true; in tcf_bpf_init_from_efd()
250 static void tcf_bpf_cfg_cleanup(const struct tcf_bpf_cfg *cfg) in tcf_bpf_cfg_cleanup() argument
252 if (cfg->is_ebpf) in tcf_bpf_cfg_cleanup()
253 bpf_prog_put(cfg->filter); in tcf_bpf_cfg_cleanup()
255 bpf_prog_destroy(cfg->filter); in tcf_bpf_cfg_cleanup()
257 kfree(cfg->bpf_ops); in tcf_bpf_cfg_cleanup()
258 kfree(cfg->bpf_name); in tcf_bpf_cfg_cleanup()
262 struct tcf_bpf_cfg *cfg) in tcf_bpf_prog_fill_cfg() argument
264 cfg->is_ebpf = tcf_bpf_is_ebpf(prog); in tcf_bpf_prog_fill_cfg()
268 cfg->filter = rcu_dereference_protected(prog->filter, 1); in tcf_bpf_prog_fill_cfg()
270 cfg->bpf_ops = prog->bpf_ops; in tcf_bpf_prog_fill_cfg()
271 cfg->bpf_name = prog->bpf_name; in tcf_bpf_prog_fill_cfg()
279 struct tcf_bpf_cfg cfg, old; in tcf_bpf_init() local
322 memset(&cfg, 0, sizeof(cfg)); in tcf_bpf_init()
324 ret = is_bpf ? tcf_bpf_init_from_ops(tb, &cfg) : in tcf_bpf_init()
325 tcf_bpf_init_from_efd(tb, &cfg); in tcf_bpf_init()
335 prog->bpf_ops = cfg.bpf_ops; in tcf_bpf_init()
336 prog->bpf_name = cfg.bpf_name; in tcf_bpf_init()
338 if (cfg.bpf_num_ops) in tcf_bpf_init()
339 prog->bpf_num_ops = cfg.bpf_num_ops; in tcf_bpf_init()
340 if (cfg.bpf_fd) in tcf_bpf_init()
341 prog->bpf_fd = cfg.bpf_fd; in tcf_bpf_init()
344 rcu_assign_pointer(prog->filter, cfg.filter); in tcf_bpf_init()