Go to the documentation of this file.
45 "Multi threaded ERF file mode. Packets from "
46 "each flow are assigned to a single detect thread",
58 if (
ConfGet(
"erf-file.file", &file) == 0) {
59 FatalError(
"Failed to get erf-file.file from config.");
67 "packetpool",
"packetpool",
68 "packetpool",
"packetpool",
71 printf(
"ERROR: TmThreadsCreate failed\n");
76 if (tm_module == NULL) {
77 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
83 if (tm_module == NULL) {
84 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
90 if (tm_module == NULL) {
91 FatalError(
"TmModuleGetByName for FlowWorker failed");
96 printf(
"ERROR: TmThreadSpawn failed\n");
100 SCLogInfo(
"RunModeErfFileSingle initialised");
114 const char *file = NULL;
115 if (
ConfGet(
"erf-file.file", &file) == 0) {
116 FatalError(
"Failed retrieving erf-file.file from config");
135 if (thread_max > 1024)
139 if (queues == NULL) {
140 FatalError(
"RunmodeAutoFpCreatePickupQueuesString failed");
146 "packetpool",
"packetpool",
152 printf(
"ERROR: TmThreadsCreate failed\n");
156 if (tm_module == NULL) {
157 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
163 if (tm_module == NULL) {
164 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
176 printf(
"ERROR: TmThreadSpawn failed\n");
180 for (thread = 0; thread < (uint16_t)thread_max; thread++) {
182 snprintf(qname,
sizeof(qname),
"pickup%d", thread + 1);
184 SCLogDebug(
"tname %s, qname %s", tname, qname);
186 SCLogDebug(
"Assigning %s affinity to cpu %u", tname, cpu);
191 "packetpool",
"packetpool",
193 if (tv_detect_ncpu == NULL) {
194 printf(
"ERROR: TmThreadsCreate failed\n");
199 if (tm_module == NULL) {
200 FatalError(
"TmModuleGetByName for FlowWorker failed");
210 if (cpu == 0 && ncpus > 1) {
212 }
else if (ncpus > 1) {
220 printf(
"ERROR: TmThreadSpawn failed\n");
224 if ((cpu + 1) == ncpus)
230 SCLogInfo(
"RunModeErfFileAutoFp initialised");
const char * thread_name_workers
TmEcode TmThreadSetCPUAffinity(ThreadVars *tv, uint16_t cpu)
Set the thread options (cpu affinity).
TmEcode TmThreadSpawn(ThreadVars *tv)
Spawns a thread associated with the ThreadVars instance tv.
void RunModeErfFileRegister(void)
const char * RunModeErfFileGetDefaultMode(void)
ThreadVars * TmThreadCreatePacketHandler(const char *name, const char *inq_name, const char *inqh_name, const char *outq_name, const char *outqh_name, const char *slots)
Creates and returns a TV instance for a Packet Processing Thread. This function doesn't support custo...
void TmThreadSetGroupName(ThreadVars *tv, const char *name)
const char * thread_name_autofp
void RunModeRegisterNewRunMode(enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void), void(*RunModeIsIPSEnabled)(void))
Registers a new runmode.
TmEcode TmThreadSetThreadPriority(ThreadVars *tv, int prio)
Set the thread options (thread priority).
const char * thread_name_single
#define TM_THREAD_NAME_MAX
TmModule * TmModuleGetByName(const char *name)
get a tm module ptr by name
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
char * RunmodeAutoFpCreatePickupQueuesString(int n)
create a queue string for autofp to pass to the flow queue handler.
Per thread variable structure.
int threading_set_cpu_affinity
#define TM_QUEUE_NAME_MAX
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
void TmSlotSetFuncAppend(ThreadVars *tv, TmModule *tm, const void *data)
Appends a new entry to the slots.
void TimeModeSetOffline(void)
int TmThreadGetNbThreads(uint8_t type)
int RunModeErfFileSingle(void)
int RunModeErfFileAutoFp(void)
uint16_t UtilCpuGetNumProcessorsOnline(void)
Get the number of cpus online in the system.
float threading_detect_ratio