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.");
69 "packetpool",
"packetpool",
70 "packetpool",
"packetpool",
73 printf(
"ERROR: TmThreadsCreate failed\n");
78 if (tm_module == NULL) {
79 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
85 if (tm_module == NULL) {
86 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
92 if (tm_module == NULL) {
93 FatalError(
"TmModuleGetByName for FlowWorker failed");
98 printf(
"ERROR: TmThreadSpawn failed\n");
102 SCLogInfo(
"RunModeErfFileSingle initialised");
118 const char *file = NULL;
119 if (
ConfGet(
"erf-file.file", &file) == 0) {
120 FatalError(
"Failed retrieving erf-file.file from config");
139 if (thread_max > 1024)
143 if (queues == NULL) {
144 FatalError(
"RunmodeAutoFpCreatePickupQueuesString failed");
150 "packetpool",
"packetpool",
156 printf(
"ERROR: TmThreadsCreate failed\n");
160 if (tm_module == NULL) {
161 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
167 if (tm_module == NULL) {
168 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
180 printf(
"ERROR: TmThreadSpawn failed\n");
184 for (thread = 0; thread < (uint16_t)thread_max; thread++) {
186 snprintf(qname,
sizeof(qname),
"pickup%d", thread + 1);
188 SCLogDebug(
"tname %s, qname %s", tname, qname);
190 SCLogDebug(
"Assigning %s affinity to cpu %u", tname, cpu);
195 "packetpool",
"packetpool",
197 if (tv_detect_ncpu == NULL) {
198 printf(
"ERROR: TmThreadsCreate failed\n");
203 if (tm_module == NULL) {
204 FatalError(
"TmModuleGetByName for FlowWorker failed");
214 if (cpu == 0 && ncpus > 1) {
216 }
else if (ncpus > 1) {
224 printf(
"ERROR: TmThreadSpawn failed\n");
228 if ((cpu + 1) == ncpus)
234 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)
void RunModeInitialize(void)
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