uint32_t rows_checked;
uint32_t rows_skipped;
uint32_t rows_empty;
- uint32_t rows_busy;
uint32_t rows_maxlen;
uint32_t flows_checked;
return 1;
}
-static inline int FMTryLockBucket(FlowBucket *fb)
-{
- int r = FBLOCK_TRYLOCK(fb);
- return r;
-}
static inline void FMFlowLock(Flow *f)
{
FLOWLOCK_WRLOCK(f);
const int emergency = ((SC_ATOMIC_GET(flow_flags) & FLOW_EMERGENCY));
const uint32_t rows_checked = hash_max - hash_min;
uint32_t rows_skipped = 0;
- uint32_t rows_busy = 0;
uint32_t rows_empty = 0;
#if __WORDSIZE==64
for (uint32_t i = 0; i < check; i++) {
FlowBucket *fb = &flow_hash[idx+i];
if ((check_bits & ((TYPE)1 << (TYPE)i)) != 0 && SC_ATOMIC_GET(fb->next_ts) <= (int32_t)ts->tv_sec) {
- if (FMTryLockBucket(fb) == 0) {
- Flow *evicted = NULL;
- if (fb->evicted != NULL || fb->head != NULL) {
- /* if evicted is set, we only process that list right now.
- * Since its set we've had traffic that touched this row
- * very recently, and there is a good chance more of it will
- * come in in the near future. So unlock the row asap and leave
- * the possible eviction of flows to the packet lookup path. */
- if (fb->evicted != NULL) {
- /* transfer out of bucket so we can do additional work outside
- * of the bucket lock */
- evicted = fb->evicted;
- fb->evicted = NULL;
- } else if (fb->head != NULL) {
- int32_t next_ts = 0;
- FlowManagerHashRowTimeout(td,
- fb->head, ts, emergency, counters, &next_ts);
-
- if (SC_ATOMIC_GET(fb->next_ts) != next_ts)
- SC_ATOMIC_SET(fb->next_ts, next_ts);
- }
- if (fb->evicted == NULL && fb->head == NULL) {
- SC_ATOMIC_SET(fb->next_ts, INT_MAX);
- } else if (fb->evicted != NULL && fb->head == NULL) {
- SC_ATOMIC_SET(fb->next_ts, 0);
- }
- } else {
- SC_ATOMIC_SET(fb->next_ts, INT_MAX);
- rows_empty++;
+ FBLOCK_LOCK(fb);
+ Flow *evicted = NULL;
+ if (fb->evicted != NULL || fb->head != NULL) {
+ if (fb->evicted != NULL) {
+ /* transfer out of bucket so we can do additional work outside
+ * of the bucket lock */
+ evicted = fb->evicted;
+ fb->evicted = NULL;
}
- FBLOCK_UNLOCK(fb);
- /* processed evicted list */
- if (evicted) {
- FlowManagerHashRowClearEvictedList(td, evicted, ts, counters);
+ if (fb->head != NULL) {
+ int32_t next_ts = 0;
+ FlowManagerHashRowTimeout(td, fb->head, ts, emergency, counters, &next_ts);
+
+ if (SC_ATOMIC_GET(fb->next_ts) != next_ts)
+ SC_ATOMIC_SET(fb->next_ts, next_ts);
+ }
+ if (fb->evicted == NULL && fb->head == NULL) {
+ SC_ATOMIC_SET(fb->next_ts, INT_MAX);
}
} else {
- rows_busy++;
+ SC_ATOMIC_SET(fb->next_ts, INT_MAX);
+ rows_empty++;
+ }
+ FBLOCK_UNLOCK(fb);
+ /* processed evicted list */
+ if (evicted) {
+ FlowManagerHashRowClearEvictedList(td, evicted, ts, counters);
}
} else {
rows_skipped++;
counters->rows_checked += rows_checked;
counters->rows_skipped += rows_skipped;
- counters->rows_busy += rows_busy;
counters->rows_empty += rows_empty;
if (td->aside_queue.len) {
const uint32_t secs_passed = rt - flow_last_sec;
/* try to time out flows */
- FlowTimeoutCounters counters = { 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ FlowTimeoutCounters counters = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
if (emerg) {
/* in emergency mode, do a full pass of the hash table */