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

Function unschedule_bw_meter

freebsd/netinet/ip_mroute.c:2151–2184  ·  view source on GitHub ↗

* Unschedule the periodic timer that processes bw_meter entry of type "<=" * by removing the entry from the proper hash bucket. */

Source from the content-addressed store, hash-verified

2149 * by removing the entry from the proper hash bucket.
2150 */
2151static void
2152unschedule_bw_meter(struct bw_meter *x)
2153{
2154 int time_hash;
2155 struct bw_meter *prev, *tmp;
2156
2157 MFC_LOCK_ASSERT();
2158
2159 if (!(x->bm_flags & BW_METER_LEQ))
2160 return; /* XXX: we schedule timers only for "<=" entries */
2161
2162 /*
2163 * Compute the timeout hash value and delete the entry
2164 */
2165 time_hash = x->bm_time_hash;
2166 if (time_hash >= BW_METER_BUCKETS)
2167 return; /* Entry was not scheduled */
2168
2169 for (prev = NULL, tmp = V_bw_meter_timers[time_hash];
2170 tmp != NULL; prev = tmp, tmp = tmp->bm_time_next)
2171 if (tmp == x)
2172 break;
2173
2174 if (tmp == NULL)
2175 panic("unschedule_bw_meter: bw_meter entry not found");
2176
2177 if (prev != NULL)
2178 prev->bm_time_next = x->bm_time_next;
2179 else
2180 V_bw_meter_timers[time_hash] = x->bm_time_next;
2181
2182 x->bm_time_next = NULL;
2183 x->bm_time_hash = BW_METER_BUCKETS;
2184}
2185
2186/*
2187 * Process all "<=" type of bw_meter that should be processed now,

Callers 3

free_bw_listFunction · 0.85
del_bw_upcallFunction · 0.85
bw_meter_receive_packetFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected