52 static const char *mpipe_default_mode =
"workers";
56 return mpipe_default_mode;
63 "Workers tilegx mpipe mode, each thread does all" 64 " tasks from acquisition to logging",
66 mpipe_default_mode =
"workers";
76 MpipeIfaceConfig *aconf =
SCMalloc(
sizeof(*aconf));
78 char *out_iface = NULL;
89 strlcpy(aconf->iface, iface,
sizeof(aconf->iface));
93 if (mpipe_node == NULL) {
94 SCLogInfo(
"Unable to find mpipe config using default value");
99 if (if_root == NULL) {
100 SCLogInfo(
"Unable to find mpipe config for " 101 "interface %s, using default value",
107 if (strlen(out_iface) > 0) {
108 aconf->out_iface = out_iface;
111 aconf->copy_mode = MPIPE_COPY_MODE_NONE;
113 if (aconf->out_iface == NULL) {
114 SCLogInfo(
"Copy mode activated but no destination" 115 " iface. Disabling feature");
116 }
else if (strlen(copymodestr) <= 0) {
117 aconf->out_iface = NULL;
118 }
else if (strcmp(copymodestr,
"ips") == 0) {
119 SCLogInfo(
"MPIPE IPS mode activated %s->%s",
122 aconf->copy_mode = MPIPE_COPY_MODE_IPS;
123 }
else if (strcmp(copymodestr,
"tap") == 0) {
124 SCLogInfo(
"MPIPE TAP mode activated %s->%s",
127 aconf->copy_mode = MPIPE_COPY_MODE_TAP;
159 unsigned int pipe_max = 1;
161 pipe_max = ncpus - 1;
165 if (
ConfGetInt(
"mpipe.threads", &threads) == 1) {
174 char *mpipe_dev = NULL;
177 SCLogInfo(
"Using %d live device(s).", nlive);
184 if (
ConfGet(
"mpipe.interface", &mpipe_dev) == 0) {
185 if (
ConfGet(
"mpipe.single_mpipe_dev", &mpipe_dev) == 0) {
187 "mpipe.single_mpipe_dev from Conf");
196 int result = tmc_cpus_get_dataplane_cpus(&cpus);
199 "tmc_cpus_get_my_affinity() returned=%d", result);
212 printf(
"ERROR: SCStrdup failed for ReceiveMpipe\n");
221 "packetpool",
"packetpool",
222 "packetpool",
"packetpool",
224 if (tv_worker == NULL) {
225 printf(
"ERROR: TmThreadsCreate failed\n");
229 if (tm_module == NULL) {
230 printf(
"ERROR: TmModuleGetByName failed for ReceiveMpipe\n");
236 int pipe_cpu = tmc_cpus_find_nth_cpu(&cpus, pipe);
237 tv_worker->
rank = pipe;
242 if (tm_module == NULL) {
243 printf(
"ERROR: TmModuleGetByName DecodeMpipe failed\n");
249 if (tm_module == NULL) {
256 if (tm_module == NULL) {
257 printf(
"ERROR: TmModuleGetByName for RespondReject failed\n");
262 SetupOutputs(tv_worker);
265 printf(
"ERROR: TmThreadSpawn failed\n");
void TmSlotSetFuncAppend(ThreadVars *tv, TmModule *tm, const void *data)
Appends a new entry to the slots.
ConfNode * ConfNodeLookupKeyValue(const ConfNode *base, const char *key, const char *value)
Lookup for a key value under a specific node.
void RunModeInitialize(void)
size_t strlcpy(char *dst, const char *src, size_t siz)
void RunModeRegisterNewRunMode(int runmode, const char *name, const char *description, int(*RunModeFunc)(void))
Registers a new runmode.
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 TimeModeSetLive(void)
void RunModeTileMpipeRegister(void)
int LiveGetDeviceCount(void)
Get the number of registered devices.
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
int ConfGetChildValue(const ConfNode *base, const char *name, const char **vptr)
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
int RunModeTileMpipeWorkers(void)
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
int ConfGetInt(const char *name, intmax_t *val)
Retrieve a configuration value as an integer.
#define TM_THREAD_NAME_MAX
TmEcode TmThreadSetCPUAffinity(ThreadVars *tv, uint16_t cpu)
Set the thread options (cpu affinity).
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
TmModule * TmModuleGetByName(const char *name)
get a tm module ptr by name
void * ParseMpipeConfig(const char *iface)
Per thread variable structure.
uint16_t UtilCpuGetNumProcessorsOnline(void)
Get the number of cpus online in the system.
const char * RunModeTileMpipeGetDefaultMode(void)
TmEcode TmThreadSpawn(ThreadVars *tv)
Spawns a thread associated with the ThreadVars instance tv.
const char * thread_name_workers