flow engine: remove unneeded 'need_srclock' argument for FlowRequeue

remotes/origin/master-1.2.x
Victor Julien 14 years ago
parent 0331da9773
commit fbbdbb251f

@ -405,7 +405,7 @@ Flow *FlowGetFlowFromHash (Packet *p)
f->flags |= FLOW_NEW_LIST;
f->fb = fb;
FlowRequeue(f, NULL, &flow_new_q[f->protomap], 1);
FlowRequeue(f, NULL, &flow_new_q[f->protomap]);
SCSpinUnlock(&fb->s);
FlowHashCountUpdate;
@ -443,7 +443,7 @@ Flow *FlowGetFlowFromHash (Packet *p)
f->flags |= FLOW_NEW_LIST;
f->fb = fb;
FlowRequeue(f, NULL, &flow_new_q[f->protomap], 1);
FlowRequeue(f, NULL, &flow_new_q[f->protomap]);
SCSpinUnlock(&fb->s);
FlowHashCountUpdate;

@ -116,36 +116,38 @@ Flow *FlowDequeue (FlowQueue *q) {
* \param srcq the source queue, where the flow will be removed. The param may
* be NULL.
* \param dstq the dest queue where the flow will be placed
* \param need_srclock does the srcq need locking? 1 yes, 0 no
*
*/
void FlowRequeue(Flow *f, FlowQueue *srcq, FlowQueue *dstq, uint8_t need_srclock)
void FlowRequeue(Flow *f, FlowQueue *srcq, FlowQueue *dstq)
{
#ifdef DEBUG
BUG_ON(dstq == NULL);
#endif /* DEBUG */
if (srcq != NULL) {
if (need_srclock == 1) {
SCMutexLock(&srcq->mutex_q);
}
SCMutexLock(&srcq->mutex_q);
/* remove from old queue */
if (srcq->top == f)
srcq->top = f->lnext; /* remove from queue top */
if (srcq->bot == f)
srcq->bot = f->lprev; /* remove from queue bot */
if (f->lprev)
if (f->lprev != NULL)
f->lprev->lnext = f->lnext; /* remove from flow prev */
if (f->lnext)
if (f->lnext != NULL)
f->lnext->lprev = f->lprev; /* remove from flow next */
srcq->len--; /* adjust len */
#ifdef DEBUG
BUG_ON(srcq->len == 0);
#endif
if (srcq->len > 0)
srcq->len--; /* adjust len */
f->lnext = NULL;
f->lprev = NULL;
/* don't unlock if src and dst are the same */
if (srcq != dstq && need_srclock == 1) {
if (srcq != dstq) {
SCMutexUnlock(&srcq->mutex_q);
}
}
@ -157,7 +159,7 @@ void FlowRequeue(Flow *f, FlowQueue *srcq, FlowQueue *dstq, uint8_t need_srclock
/* add to new queue (append) */
f->lprev = dstq->bot;
if (f->lprev)
if (f->lprev != NULL)
f->lprev->lnext = f;
f->lnext = NULL;
dstq->bot = f;

@ -47,7 +47,8 @@ void FlowQueueDestroy (FlowQueue *);
void FlowEnqueue (FlowQueue *, Flow *);
Flow *FlowDequeue (FlowQueue *);
void FlowRequeue(Flow *, FlowQueue *, FlowQueue *, uint8_t);
void FlowRequeue(Flow *, FlowQueue *, FlowQueue *);
void FlowRequeueMoveToBot(Flow *, FlowQueue *);
void FlowRequeueMoveToSpare(Flow *, FlowQueue *);

@ -107,7 +107,7 @@ void FlowUpdateQueue(Flow *f)
/* in the new list -- we consider a flow no longer
* new if we have seen at least 2 pkts in both ways. */
if (f->flags & FLOW_TO_DST_SEEN && f->flags & FLOW_TO_SRC_SEEN) {
FlowRequeue(f, &flow_new_q[f->protomap], &flow_est_q[f->protomap], 1);
FlowRequeue(f, &flow_new_q[f->protomap], &flow_est_q[f->protomap]);
f->flags |= FLOW_EST_LIST; /* transition */
f->flags &= ~FLOW_NEW_LIST;
@ -122,7 +122,7 @@ void FlowUpdateQueue(Flow *f)
f->flags &=~ FLOW_EST_LIST;
SCLogDebug("flow %p was put into closing queue ts %"PRIuMAX"", f, (uintmax_t)f->lastts_sec);
FlowRequeue(f, &flow_est_q[f->protomap], &flow_close_q[f->protomap], 1);
FlowRequeue(f, &flow_est_q[f->protomap], &flow_close_q[f->protomap]);
} else {
/* Pull and put back -- this way the flows on
* top of the list are least recently used. */
@ -144,7 +144,7 @@ void FlowUpdateQueue(Flow *f)
f->flags &=~ FLOW_CLOSED_LIST;
SCLogDebug("flow %p was put into new queue ts %"PRIuMAX"", f, (uintmax_t)f->lastts_sec);
FlowRequeue(f, &flow_close_q[f->protomap], &flow_new_q[f->protomap], 1);
FlowRequeue(f, &flow_close_q[f->protomap], &flow_new_q[f->protomap]);
} else {
/* Pull and put back -- this way the flows on
* top of the list are least recently used. */

Loading…
Cancel
Save