42 static uint32_t flow_spare_pool_flow_cnt = 0;
51 size = flow_spare_pool_flow_cnt;
79 static void Validate(
FlowSparePool *top,
const uint32_t target)
96 assert(cnt == target);
103 if (flow_spare_pool == NULL) {
104 flow_spare_pool = FlowSpareGetPool();
112 p->
next = flow_spare_pool;
117 flow_spare_pool_flow_cnt++;
129 flow_spare_pool_flow_cnt += fqp->
len;
130 if (flow_spare_pool != NULL) {
136 flow_spare_pool->
next = p;
139 p->
next = flow_spare_pool;
152 p->
next = flow_spare_pool;
156 flow_spare_pool->
next = p;
162 p->
next = flow_spare_pool;
178 if (flow_spare_pool == NULL || flow_spare_pool_flow_cnt == 0) {
187 flow_spare_pool = p->
next;
189 flow_spare_pool_flow_cnt -= p->
queue.
len;
191 Validate(flow_spare_pool, flow_spare_pool_flow_cnt);
199 }
else if (flow_spare_pool->
next != NULL) {
203 flow_spare_pool_flow_cnt -= p->
queue.
len;
205 Validate(flow_spare_pool, flow_spare_pool_flow_cnt);
223 uint32_t to_remove = (uint32_t)(todo * -1) / 10;
232 flow_spare_pool = p->
next;
233 flow_spare_pool_flow_cnt -= p->
queue.
len;
246 }
else if (todo > 0) {
251 uint32_t flow_cnt = 0;
252 for (uint32_t cnt = 0; cnt < blocks; cnt++) {
257 const bool ok = FlowSparePoolUpdateBlock(p);
274 if (flow_spare_pool == NULL) {
275 flow_spare_pool =
head;
276 }
else if (
tail != NULL) {
284 flow_spare_pool_flow_cnt += flow_cnt;
286 Validate(flow_spare_pool, flow_spare_pool_flow_cnt);
301 FlowSparePoolUpdateBlock(p);
305 p->
next = flow_spare_pool;
307 flow_spare_pool_flow_cnt = cnt;
322 flow_spare_pool_flow_cnt -= cnt;
327 flow_spare_pool = NULL;