flow/manager: make fn calls only when necessary

pull/11353/head
Shivani Bhardwaj 1 year ago committed by Victor Julien
parent eb95d2bf66
commit 00a644c5c2

@ -196,6 +196,7 @@ static bool FlowManagerFlowTimeout(Flow *f, SCTime_t ts, uint32_t *next_ts, cons
return true; return true;
} }
#ifdef CAPTURE_OFFLOAD
/** \internal /** \internal
* \brief check timeout of captured bypassed flow by querying capture method * \brief check timeout of captured bypassed flow by querying capture method
* *
@ -208,7 +209,6 @@ static bool FlowManagerFlowTimeout(Flow *f, SCTime_t ts, uint32_t *next_ts, cons
*/ */
static inline bool FlowBypassedTimeout(Flow *f, SCTime_t ts, FlowTimeoutCounters *counters) static inline bool FlowBypassedTimeout(Flow *f, SCTime_t ts, FlowTimeoutCounters *counters)
{ {
#ifdef CAPTURE_OFFLOAD
if (f->flow_state != FLOW_STATE_CAPTURE_BYPASSED) { if (f->flow_state != FLOW_STATE_CAPTURE_BYPASSED) {
return true; return true;
} }
@ -245,9 +245,9 @@ static inline bool FlowBypassedTimeout(Flow *f, SCTime_t ts, FlowTimeoutCounters
} }
counters->bypassed_count++; counters->bypassed_count++;
} }
#endif /* CAPTURE_OFFLOAD */
return true; return true;
} }
#endif /* CAPTURE_OFFLOAD */
typedef struct FlowManagerTimeoutThread { typedef struct FlowManagerTimeoutThread {
/* used to temporarily store flows that have timed out and are /* used to temporarily store flows that have timed out and are
@ -342,6 +342,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *f, SCT
Flow *next_flow = f->next; Flow *next_flow = f->next;
#ifdef CAPTURE_OFFLOAD
/* never prune a flow that is used by a packet we /* never prune a flow that is used by a packet we
* are currently processing in one of the threads */ * are currently processing in one of the threads */
if (!FlowBypassedTimeout(f, ts, counters)) { if (!FlowBypassedTimeout(f, ts, counters)) {
@ -350,7 +351,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *f, SCT
f = f->next; f = f->next;
continue; continue;
} }
#endif
f->flow_end_flags |= FLOW_END_FLAG_TIMEOUT; f->flow_end_flags |= FLOW_END_FLAG_TIMEOUT;
counters->flows_timeout++; counters->flows_timeout++;

Loading…
Cancel
Save