Go to the documentation of this file.
57 const char *scheduler = NULL;
58 if (
ConfGet(
"autofp-scheduler", &scheduler) == 1) {
59 if (strcasecmp(scheduler,
"round-robin") == 0) {
60 SCLogNotice(
"using flow hash instead of round robin");
62 }
else if (strcasecmp(scheduler,
"active-packets") == 0) {
63 SCLogNotice(
"using flow hash instead of active packets");
65 }
else if (strcasecmp(scheduler,
"hash") == 0) {
67 }
else if (strcasecmp(scheduler,
"ippair") == 0) {
71 "for autofp-scheduler in conf. Killing engine.",
84 #define PRINT_IF_FUNC(f, msg) \
85 if (tmqh_table[TMQH_FLOW].OutHandler == (f)) \
86 SCLogConfig("AutoFP mode using \"%s\" flow load balancer", (msg))
118 static int StoreQueueId(
TmqhFlowCtx *ctx,
char *name)
129 if (ctx->
queues == NULL) {
132 if (ctx->
queues == NULL) {
165 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,
228 qid = hash % ctx->
size;
253 uint32_t addr_hash = 0;
258 for (
int i = 0; i < 4; i++) {
259 addr_hash += p->
src.addr_data32[i] + p->
dst.addr_data32[i];
262 addr_hash = p->
src.addr_data32[0] + p->
dst.addr_data32[0];
265 uint32_t qid = addr_hash % ctx->
size;
277 static int TmqhOutputFlowSetupCtxTest01(
void)
290 const char *
str =
"queue1,queue2,another,yetanother";
310 static int TmqhOutputFlowSetupCtxTest02(
void)
323 const char *
str =
"queue1";
340 static int TmqhOutputFlowSetupCtxTest03(
void)
344 const char *
str =
"queue1,queue2,another,yetanother";
379 TmqhOutputFlowSetupCtxTest01);
381 TmqhOutputFlowSetupCtxTest02);
383 TmqhOutputFlowSetupCtxTest03);
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
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 StatsSyncCountersIfSignalled(tv)
#define FAIL_IF_NOT(expr)
Fail a test if expression to true.
void TmqhFlowRegister(void)
Packet *(* InHandler)(ThreadVars *)
void TmqhOutputFlowFreeCtx(void *ctx)
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
#define PASS
Pass the test.
#define SCMutexUnlock(mut)
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)
@ SC_ERR_INVALID_YAML_CONF_ENTRY
#define SCRealloc(ptr, sz)
#define PRINT_IF_FUNC(f, msg)
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Tmqh tmqh_table[TMQH_SIZE]
Packet * PacketDequeue(PacketQueue *q)
void *(* OutHandlerCtxSetup)(const char *)
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)