MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bpf_zero_counters

Function bpf_zero_counters

freebsd/net/bpf.c:2876–2898  ·  view source on GitHub ↗

* Zero out the various packet counters associated with all of the bpf * descriptors. At some point, we will probably want to get a bit more * granular and allow the user to specify descriptors to be zeroed. */

Source from the content-addressed store, hash-verified

2874 * granular and allow the user to specify descriptors to be zeroed.
2875 */
2876static void
2877bpf_zero_counters(void)
2878{
2879 struct bpf_if *bp;
2880 struct bpf_d *bd;
2881
2882 BPF_LOCK();
2883 /*
2884 * We are protected by global lock here, interfaces and
2885 * descriptors can not be deleted while we hold it.
2886 */
2887 CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
2888 CK_LIST_FOREACH(bd, &bp->bif_dlist, bd_next) {
2889 counter_u64_zero(bd->bd_rcount);
2890 counter_u64_zero(bd->bd_dcount);
2891 counter_u64_zero(bd->bd_fcount);
2892 counter_u64_zero(bd->bd_wcount);
2893 counter_u64_zero(bd->bd_wfcount);
2894 counter_u64_zero(bd->bd_zcopy);
2895 }
2896 }
2897 BPF_UNLOCK();
2898}
2899
2900/*
2901 * Fill filter statistics

Callers 1

bpf_stats_sysctlFunction · 0.85

Calls 1

counter_u64_zeroFunction · 0.85

Tested by

no test coverage detected