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",
56 if (
ConfGet(
"erf-file.file", &file) == 0) {
57 FatalError(
"Failed to get erf-file.file from config.");
65 "packetpool",
"packetpool",
66 "packetpool",
"packetpool",
69 printf(
"ERROR: TmThreadsCreate failed\n");
74 if (tm_module == NULL) {
75 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
81 if (tm_module == NULL) {
82 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
88 if (tm_module == NULL) {
89 FatalError(
"TmModuleGetByName for FlowWorker failed");
94 printf(
"ERROR: TmThreadSpawn failed\n");
98 SCLogInfo(
"RunModeErfFileSingle initialised");
112 const char *file = NULL;
113 if (
ConfGet(
"erf-file.file", &file) == 0) {
114 FatalError(
"Failed retrieving erf-file.file from config");
133 if (thread_max > 1024)
137 if (queues == NULL) {
138 FatalError(
"RunmodeAutoFpCreatePickupQueuesString failed");
144 "packetpool",
"packetpool",
150 printf(
"ERROR: TmThreadsCreate failed\n");
154 if (tm_module == NULL) {
155 printf(
"ERROR: TmModuleGetByName failed for ReceiveErfFile\n");
161 if (tm_module == NULL) {
162 printf(
"ERROR: TmModuleGetByName DecodeErfFile failed\n");
174 printf(
"ERROR: TmThreadSpawn failed\n");
178 for (thread = 0; thread < (uint16_t)thread_max; thread++) {
180 snprintf(qname,
sizeof(qname),
"pickup%d", thread + 1);
182 SCLogDebug(
"tname %s, qname %s", tname, qname);
184 SCLogDebug(
"Assigning %s affinity to cpu %u", tname, cpu);
189 "packetpool",
"packetpool",
191 if (tv_detect_ncpu == NULL) {
192 printf(
"ERROR: TmThreadsCreate failed\n");
197 if (tm_module == NULL) {
198 FatalError(
"TmModuleGetByName for FlowWorker failed");
208 if (cpu == 0 && ncpus > 1) {
210 }
else if (ncpus > 1) {
218 printf(
"ERROR: TmThreadSpawn failed\n");
222 if ((cpu + 1) == ncpus)
228 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.
bool threading_set_cpu_affinity
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
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.
void RunModeRegisterNewRunMode(enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void), int(*RunModeIsIPSEnabled)(void))
Registers a new runmode.
Per thread variable structure.
#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