Lines Matching refs:cfg

170 static int tcf_bpf_init_from_ops(struct nlattr **tb, struct tcf_bpf_cfg *cfg)  in tcf_bpf_init_from_ops()  argument
201 cfg->bpf_ops = bpf_ops; in tcf_bpf_init_from_ops()
202 cfg->bpf_num_ops = bpf_num_ops; in tcf_bpf_init_from_ops()
203 cfg->filter = fp; in tcf_bpf_init_from_ops()
204 cfg->is_ebpf = false; in tcf_bpf_init_from_ops()
209 static int tcf_bpf_init_from_efd(struct nlattr **tb, struct tcf_bpf_cfg *cfg) in tcf_bpf_init_from_efd() argument
236 cfg->bpf_fd = bpf_fd; in tcf_bpf_init_from_efd()
237 cfg->bpf_name = name; in tcf_bpf_init_from_efd()
238 cfg->filter = fp; in tcf_bpf_init_from_efd()
239 cfg->is_ebpf = true; in tcf_bpf_init_from_efd()
244 static void tcf_bpf_cfg_cleanup(const struct tcf_bpf_cfg *cfg) in tcf_bpf_cfg_cleanup() argument
246 if (cfg->is_ebpf) in tcf_bpf_cfg_cleanup()
247 bpf_prog_put(cfg->filter); in tcf_bpf_cfg_cleanup()
249 bpf_prog_destroy(cfg->filter); in tcf_bpf_cfg_cleanup()
251 kfree(cfg->bpf_ops); in tcf_bpf_cfg_cleanup()
252 kfree(cfg->bpf_name); in tcf_bpf_cfg_cleanup()
256 struct tcf_bpf_cfg *cfg) in tcf_bpf_prog_fill_cfg() argument
258 cfg->is_ebpf = tcf_bpf_is_ebpf(prog); in tcf_bpf_prog_fill_cfg()
259 cfg->filter = prog->filter; in tcf_bpf_prog_fill_cfg()
261 cfg->bpf_ops = prog->bpf_ops; in tcf_bpf_prog_fill_cfg()
262 cfg->bpf_name = prog->bpf_name; in tcf_bpf_prog_fill_cfg()
270 struct tcf_bpf_cfg cfg, old; in tcf_bpf_init() local
292 memset(&cfg, 0, sizeof(cfg)); in tcf_bpf_init()
294 ret = is_bpf ? tcf_bpf_init_from_ops(tb, &cfg) : in tcf_bpf_init()
295 tcf_bpf_init_from_efd(tb, &cfg); in tcf_bpf_init()
324 prog->bpf_ops = cfg.bpf_ops; in tcf_bpf_init()
325 prog->bpf_name = cfg.bpf_name; in tcf_bpf_init()
327 if (cfg.bpf_num_ops) in tcf_bpf_init()
328 prog->bpf_num_ops = cfg.bpf_num_ops; in tcf_bpf_init()
329 if (cfg.bpf_fd) in tcf_bpf_init()
330 prog->bpf_fd = cfg.bpf_fd; in tcf_bpf_init()
333 prog->filter = cfg.filter; in tcf_bpf_init()
345 tcf_bpf_cfg_cleanup(&cfg); in tcf_bpf_init()