Go to the documentation of this file.
42 "Single threaded ERF file mode",
46 "Multi threaded ERF file mode. Packets from "
47 "each flow are assigned to a single detect thread",
59 if (
ConfGet(
"erf-file.file", &file) == 0) {
70 "packetpool",
"packetpool",
71 "packetpool",
"packetpool",
74 printf(
"ERROR: TmThreadsCreate failed\n");
79 if (tm_module == NULL) {
80 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
86 if (tm_module == NULL) {
87 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
93 if (tm_module == NULL) {
99 printf(
"ERROR: TmThreadSpawn failed\n");
103 SCLogInfo(
"RunModeErfFileSingle initialised");
119 const char *file = NULL;
120 if (
ConfGet(
"erf-file.file", &file) == 0) {
122 "Failed retrieving erf-file.file from config");
141 if (thread_max > 1024)
145 if (queues == NULL) {
147 "RunmodeAutoFpCreatePickupQueuesString failed");
153 "packetpool",
"packetpool",
159 printf(
"ERROR: TmThreadsCreate failed\n");
163 if (tm_module == NULL) {
164 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
170 if (tm_module == NULL) {
171 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
183 printf(
"ERROR: TmThreadSpawn failed\n");
187 for (thread = 0; thread < (uint16_t)thread_max; thread++) {
189 snprintf(qname,
sizeof(qname),
"pickup%u", thread+1);
191 SCLogDebug(
"tname %s, qname %s", tname, qname);
193 SCLogDebug(
"Assigning %s affinity to cpu %u", tname, cpu);
198 "packetpool",
"packetpool",
200 if (tv_detect_ncpu == NULL) {
201 printf(
"ERROR: TmThreadsCreate failed\n");
206 if (tm_module == NULL) {
208 "TmModuleGetByName for FlowWorker failed");
218 if (cpu == 0 && ncpus > 1) {
220 }
else if (ncpus > 1) {
228 printf(
"ERROR: TmThreadSpawn failed\n");
232 if ((cpu + 1) == ncpus)
238 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
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)
void RunModeRegisterNewRunMode(enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void))
Registers a new runmode.
int TmThreadGetNbThreads(uint8_t type)
int RunModeErfFileSingle(void)
#define FatalError(x,...)
int RunModeErfFileAutoFp(void)
uint16_t UtilCpuGetNumProcessorsOnline(void)
Get the number of cpus online in the system.
float threading_detect_ratio