Lines Matching refs:cfg

186 static int tcf_bpf_init_from_ops(struct nlattr **tb, struct tcf_bpf_cfg *cfg)  in tcf_bpf_init_from_ops()  argument
215 cfg->bpf_ops = bpf_ops; in tcf_bpf_init_from_ops()
216 cfg->bpf_num_ops = bpf_num_ops; in tcf_bpf_init_from_ops()
217 cfg->filter = fp; in tcf_bpf_init_from_ops()
218 cfg->is_ebpf = false; in tcf_bpf_init_from_ops()
223 static int tcf_bpf_init_from_efd(struct nlattr **tb, struct tcf_bpf_cfg *cfg) in tcf_bpf_init_from_efd() argument
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 struct bpf_prog *filter = cfg->filter; in tcf_bpf_cfg_cleanup()
255 if (cfg->is_ebpf) in tcf_bpf_cfg_cleanup()
261 kfree(cfg->bpf_ops); in tcf_bpf_cfg_cleanup()
262 kfree(cfg->bpf_name); in tcf_bpf_cfg_cleanup()
266 struct tcf_bpf_cfg *cfg) in tcf_bpf_prog_fill_cfg() argument
268 cfg->is_ebpf = tcf_bpf_is_ebpf(prog); in tcf_bpf_prog_fill_cfg()
272 cfg->filter = rcu_dereference_protected(prog->filter, 1); in tcf_bpf_prog_fill_cfg()
274 cfg->bpf_ops = prog->bpf_ops; in tcf_bpf_prog_fill_cfg()
275 cfg->bpf_name = prog->bpf_name; in tcf_bpf_prog_fill_cfg()
287 struct tcf_bpf_cfg cfg, old; in tcf_bpf_init() local
342 memset(&cfg, 0, sizeof(cfg)); in tcf_bpf_init()
344 ret = is_bpf ? tcf_bpf_init_from_ops(tb, &cfg) : in tcf_bpf_init()
345 tcf_bpf_init_from_efd(tb, &cfg); in tcf_bpf_init()
355 prog->bpf_ops = cfg.bpf_ops; in tcf_bpf_init()
356 prog->bpf_name = cfg.bpf_name; in tcf_bpf_init()
358 if (cfg.bpf_num_ops) in tcf_bpf_init()
359 prog->bpf_num_ops = cfg.bpf_num_ops; in tcf_bpf_init()
362 rcu_assign_pointer(prog->filter, cfg.filter); in tcf_bpf_init()