Go to the documentation of this file.
58 const char *scheduler = NULL;
60 if (strcasecmp(scheduler,
"round-robin") == 0) {
61 SCLogNotice(
"using flow hash instead of round robin");
63 }
else if (strcasecmp(scheduler,
"active-packets") == 0) {
64 SCLogNotice(
"using flow hash instead of active packets");
66 }
else if (strcasecmp(scheduler,
"hash") == 0) {
68 }
else if (strcasecmp(scheduler,
"ippair") == 0) {
70 }
else if (strcasecmp(scheduler,
"ftp-hash") == 0) {
74 "for autofp-scheduler in conf. Killing engine.",
85 #define PRINT_IF_FUNC(f, msg) \
86 if (tmqh_table[TMQH_FLOW].OutHandler == (f)) \
87 SCLogConfig("AutoFP mode using \"%s\" flow load balancer", (msg))
131 if (
ctx->queues == NULL) {
134 if (
ctx->queues == NULL) {
149 ctx->queues[
ctx->size - 1].q = tmq->
pq;
166 if (queue_str == NULL || strlen(queue_str) == 0)
183 char *comma = strchr(tstr,
',');
187 int r = StoreQueueId(
ctx,qname);
192 int r = StoreQueueId(
ctx,qname);
196 tstr = comma ? (comma + 1) : comma;
197 }
while (tstr != NULL);
213 SCLogPerf(
"AutoFP - Total flow handler queues - %" PRIu16,
226 qid = hash %
ctx->size;
230 if (
ctx->last ==
ctx->size)
249 uint32_t addr_hash = 0;
254 for (
int i = 0; i < 4; i++) {
255 addr_hash +=
p->
src.addr_data32[i] +
p->
dst.addr_data32[i];
258 addr_hash =
p->
src.addr_data32[0] +
p->
dst.addr_data32[0];
261 uint32_t qid = addr_hash %
ctx->size;
276 if (PacketIsTCP(
p) && ((
p->
sp >= 1024 &&
p->
dp >= 1024) ||
p->
dp == 21 ||
p->
sp == 21 ||
277 p->
dp == 20 ||
p->
sp == 20)) {
280 qid = hash %
ctx->size;
284 if (
ctx->last ==
ctx->size)
297 static int TmqhOutputFlowSetupCtxTest01(
void)
310 const char *
str =
"queue1,queue2,another,yetanother";
330 static int TmqhOutputFlowSetupCtxTest02(
void)
343 const char *
str =
"queue1";
360 static int TmqhOutputFlowSetupCtxTest03(
void)
364 const char *
str =
"queue1,queue2,another,yetanother";
399 TmqhOutputFlowSetupCtxTest01);
401 TmqhOutputFlowSetupCtxTest02);
403 TmqhOutputFlowSetupCtxTest03);
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void StatsSyncCountersIfSignalled(StatsThreadContext *stats)
void TmqhOutputFlowIPPair(ThreadVars *t, Packet *p)
select the queue to output based on IP address pair.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
void TmqhFlowPrintAutofpHandler(void)
void PacketEnqueue(PacketQueue *q, Packet *p)
simple fifo queue for packets with mutex and cond Calling the mutex or triggering the cond is respons...
void TmqhFlowRegisterTests(void)
void(* OutHandler)(ThreadVars *, Packet *)
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
void TmqhFlowRegister(void)
Packet *(* InHandler)(ThreadVars *)
void TmqhOutputFlowFreeCtx(void *ctx)
#define PASS
Pass the test.
#define SCMutexUnlock(mut)
int SCConfGetNonNull(const char *name, const char **vptr)
Retrieve the non-null value of a configuration node.
Per thread variable structure.
Tmq * TmqGetQueueByName(const char *name)
void(* RegisterTests)(void)
void * TmqhOutputFlowSetupCtx(const char *queue_str)
setup the queue handlers ctx
void(* OutHandlerCtxFree)(void *)
void TmqhOutputFlowHash(ThreadVars *t, Packet *p)
#define SCRealloc(ptr, sz)
uint32_t FlowGetIpPairProtoHash(const Packet *p)
#define PRINT_IF_FUNC(f, msg)
Tmqh tmqh_table[TMQH_SIZE]
Packet * PacketDequeue(PacketQueue *q)
void *(* OutHandlerCtxSetup)(const char *)
#define SCLogError(...)
Macro used to log ERROR messages.
Tmq * TmqCreateQueue(const char *name)
Packet * TmqhInputFlow(ThreadVars *t)
#define SCLogNotice(...)
Macro used to log NOTICE messages.
Ctx for the flow queue handler.
void TmqResetQueues(void)