introduce inline function version of TmThreadsSlotProcessPkt macro. Retain the macro as well

remotes/origin/master-1.1.x
Anoop Saldanha 14 years ago committed by Victor Julien
parent fd6faac196
commit 94c5ecb069

@ -503,32 +503,6 @@ TmEcode TmThreadsSlotVarRun(ThreadVars *tv, Packet *p,
*/
#if 0
/**
* \brief Process the rest of the functions (if any) and queue.
*/
TmEcode TmThreadsSlotProcessPkt(ThreadVars *tv, TmSlot *s, Packet *p) {
TmEcode r;
if (likely(p != NULL)) {
if (s != NULL ) {
/* run the thread module(s) */
r = TmThreadsSlotVarRun(tv, p, s);
if (unlikely(r == TM_ECODE_FAILED)) {
TmqhOutputPacketpool(tv, p);
TmThreadsSetFlag(tv, THV_FAILED);
return TM_ECODE_FAILED;
}
}
/* output the packet */
tv->tmqh_out(tv, p);
}
return TM_ECODE_OK;
}
#endif
void *TmThreadsSlotPktAcqLoop(void *td) {
ThreadVars *tv = (ThreadVars *)td;
TmSlot *s = tv->tm_slots;

@ -25,6 +25,7 @@
#ifndef __TM_THREADS_H__
#define __TM_THREADS_H__
#include "tmqh-packetpool.h"
#include "tm-threads-common.h"
#include "tm-modules.h"
@ -83,8 +84,6 @@ void TmThreadKillThreads(void);
void TmThreadAppend(ThreadVars *, int);
void TmThreadRemove(ThreadVars *, int);
TmEcode TmThreadsSlotProcessPkt(ThreadVars *, TmSlot *, Packet *);
TmEcode TmThreadSetCPUAffinity(ThreadVars *, uint16_t);
TmEcode TmThreadSetThreadPriority(ThreadVars *, int);
TmEcode TmThreadSetCPU(ThreadVars *, uint8_t);
@ -108,6 +107,8 @@ void TmThreadsUnsetFlag(ThreadVars *, uint8_t);
TmEcode TmThreadsSlotVarRun (ThreadVars *tv, Packet *p, TmSlot *slot);
#if 0
/**
* \brief Process the rest of the functions (if any) and queue.
*/
@ -157,4 +158,55 @@ TmEcode TmThreadsSlotVarRun (ThreadVars *tv, Packet *p, TmSlot *slot);
r; \
})
#endif /* #if 0 */
/**
* \brief Process the rest of the functions (if any) and queue.
*/
static inline TmEcode TmThreadsSlotProcessPkt(ThreadVars *tv, TmSlot *s, Packet *p)
{
TmEcode r = TM_ECODE_OK;
if (s == NULL) {
tv->tmqh_out(tv, p);
return r;
}
if (TmThreadsSlotVarRun(tv, p, s) == TM_ECODE_FAILED) {
TmqhOutputPacketpool(tv, p);
TmSlot *slot = s;
while (slot != NULL) {
TmqhReleasePacketsToPacketPool(&slot->slot_post_pq);
slot = slot->slot_next;
}
TmThreadsSetFlag(tv, THV_FAILED);
r = TM_ECODE_FAILED;
} else {
tv->tmqh_out(tv, p);
/* post process pq */
TmSlot *slot = s;
while (slot != NULL) {
while (slot->slot_post_pq.top != NULL) {
Packet *extra_p = PacketDequeue(&slot->slot_post_pq);
if (extra_p != NULL) {
if (slot->slot_next != NULL) {
r = TmThreadsSlotVarRun(tv, extra_p, slot->slot_next);
if (r == TM_ECODE_FAILED) {
TmqhReleasePacketsToPacketPool(&slot->slot_post_pq);
TmqhOutputPacketpool(tv, extra_p);
TmThreadsSetFlag(tv, THV_FAILED);
break;
}
}
tv->tmqh_out(tv, extra_p);
}
}
slot = slot->slot_next;
}
}
return r;
}
#endif /* __TM_THREADS_H__ */

Loading…
Cancel
Save