Lines Matching defs:npf
31 * NPF main: dynamic load/initialisation and unload routines.
36 __KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.44 2020/08/27 18:50:25 riastradh Exp $");
78 npf_t *npf;
80 npf = kmem_zalloc(sizeof(npf_t), KM_SLEEP);
81 npf->ebr = npf_ebr_create();
82 npf->stats_percpu = percpu_alloc(NPF_STATS_SIZE);
83 npf->mbufops = mbufops;
84 npf->arg = arg;
86 npf_param_init(npf);
87 npf_state_sysinit(npf);
88 npf_ifmap_init(npf, ifops);
89 npf_conn_init(npf);
90 npf_portmap_init(npf);
91 npf_alg_init(npf);
92 npf_ext_init(npf);
95 npf_config_init(npf);
98 npf_worker_enlist(npf);
100 return npf;
104 npfk_destroy(npf_t *npf)
106 npf_worker_discharge(npf);
112 npf_config_fini(npf);
115 npf_ext_fini(npf);
116 npf_alg_fini(npf);
117 npf_portmap_fini(npf);
118 npf_conn_fini(npf);
119 npf_ifmap_fini(npf);
120 npf_state_sysfini(npf);
121 npf_param_fini(npf);
123 npf_ebr_destroy(npf->ebr);
124 percpu_free(npf->stats_percpu, NPF_STATS_SIZE);
125 kmem_free(npf, sizeof(npf_t));
135 npfk_load(npf_t *npf, const void *config_ref, npf_error_t *err)
142 error = npfctl_run_op(npf, IOC_NPF_LOAD, req, resp);
149 npfk_gc(npf_t *npf)
151 npf_conn_worker(npf);
155 npfk_thread_register(npf_t *npf)
157 npf_ebr_register(npf->ebr);
161 npfk_thread_unregister(npf_t *npf)
163 npf_ebr_full_sync(npf->ebr);
164 npf_ebr_unregister(npf->ebr);
168 npfk_getarg(npf_t *npf)
170 return npf->arg;
174 npf_setkernctx(npf_t *npf)
176 npf_kernel_ctx = npf;
186 * NPF statistics interface.
190 npf_stats_inc(npf_t *npf, npf_stats_t st)
192 uint64_t *stats = percpu_getref(npf->stats_percpu);
194 percpu_putref(npf->stats_percpu);
198 npf_stats_dec(npf_t *npf, npf_stats_t st)
200 uint64_t *stats = percpu_getref(npf->stats_percpu);
202 percpu_putref(npf->stats_percpu);
230 npfk_stats(npf_t *npf, uint64_t *buf)
233 percpu_foreach_xcall(npf->stats_percpu, XC_HIGHPRI_IPL(IPL_SOFTNET),
238 npfk_stats_clear(npf_t *npf)
240 percpu_foreach_xcall(npf->stats_percpu, XC_HIGHPRI_IPL(IPL_SOFTNET),