62 size_t queues_size = n * 13;
65 char *queues =
SCMalloc(queues_size);
71 memset(queues, 0x00, queues_size);
73 for (
int thread = 0; thread < n; thread++) {
74 if (strlen(queues) > 0)
75 strlcat(queues,
",", queues_size);
77 snprintf(qname,
sizeof(qname),
"pickup%d", (int16_t)thread+1);
78 strlcat(queues, qname, queues_size);
81 SCLogDebug(
"%d %"PRIuMAX
", queues %s", n, (uintmax_t)queues_size, queues);
89 const char *recv_mod_name,
90 const char *decode_mod_name,
91 const char *thread_name,
102 if (queues == NULL) {
106 if ((nlive <= 1) && (live_dev != NULL)) {
109 void *aconf = ConfigParser(live_dev);
115 int threads_count = ModThreadsCount(aconf);
116 SCLogInfo(
"Going to use %" PRId32
" %s receive thread(s)",
117 threads_count, recv_mod_name);
120 for (
int thread = 0; thread < threads_count; thread++) {
121 snprintf(tname,
sizeof(tname),
"%s#%02d", thread_name, thread+1);
124 "packetpool",
"packetpool",
125 queues,
"flow",
"pktacqloop");
126 if (tv_receive == NULL) {
130 if (tm_module == NULL) {
132 "TmModuleGetByName failed for %s",
138 if (tm_module == NULL) {
140 "TmModuleGetByName %s failed", decode_mod_name);
151 SCLogInfo(
"Using %d live device(s).", nlive);
153 for (
int lthread = 0; lthread < nlive; lthread++) {
162 void *aconf = ConfigParser(dev);
168 int threads_count = ModThreadsCount(aconf);
169 for (
int thread = 0; thread < threads_count; thread++) {
170 char *printable_threadname =
SCMalloc(
sizeof(
char) * (strlen(thread_name)+5+strlen(dev)));
171 if (
unlikely(printable_threadname == NULL)) {
174 snprintf(tname,
sizeof(tname),
"%s#%02d-%s", thread_name,
175 thread+1, visual_devname);
176 snprintf(printable_threadname, strlen(thread_name)+5+strlen(dev),
177 "%s#%02d-%s", thread_name, thread+1,
182 "packetpool",
"packetpool",
183 queues,
"flow",
"pktacqloop");
184 if (tv_receive == NULL) {
189 if (tm_module == NULL) {
195 if (tm_module == NULL) {
209 for (uint16_t thread = 0; thread < thread_max; thread++) {
211 snprintf(qname,
sizeof(qname),
"pickup%u", (uint16_t)(thread + 1));
213 SCLogDebug(
"tname %s, qname %s", tname, qname);
218 "packetpool",
"packetpool",
220 if (tv_detect_ncpu == NULL) {
224 if (tm_module == NULL) {
234 if (tm_module == NULL) {
251 const char *recv_mod_name,
252 const char *decode_mod_name,
const char *thread_name,
253 const char *live_dev,
void *aconf,
254 unsigned char single_mode)
262 threads_count =
MIN(ModThreadsCount(aconf), thread_max);
263 SCLogInfo(
"Going to use %" PRId32
" thread(s) for device %s", threads_count, live_dev);
267 for (
int thread = 0; thread < threads_count; thread++) {
271 char *printable_threadname =
SCMalloc(
sizeof(
char) * (strlen(thread_name)+5+strlen(live_dev)));
272 if (
unlikely(printable_threadname == NULL)) {
278 snprintf(tname,
sizeof(tname),
"%s#01-%s", thread_name, visual_devname);
279 snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev),
"%s#01-%s",
280 thread_name, live_dev);
282 snprintf(tname,
sizeof(tname),
"%s#%02d-%s", thread_name,
283 thread+1, visual_devname);
284 snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev),
"%s#%02d-%s",
285 thread_name, thread+1, live_dev);
288 "packetpool",
"packetpool",
289 "packetpool",
"packetpool",
297 if (tm_module == NULL) {
303 if (tm_module == NULL) {
309 if (tm_module == NULL) {
315 if (tm_module == NULL) {
332 const char *recv_mod_name,
333 const char *decode_mod_name,
const char *thread_name,
334 const char *live_dev)
340 for (ldev = 0; ldev < nlive; ldev++) {
341 const char *live_dev_c = NULL;
342 if ((nlive <= 1) && (live_dev != NULL)) {
343 aconf = ConfigParser(live_dev);
344 live_dev_c = live_dev;
350 aconf = ConfigParser(live_dev_c);
352 RunModeSetLiveCaptureWorkersForDevice(ModThreadsCount,
366 const char *recv_mod_name,
367 const char *decode_mod_name,
const char *thread_name,
368 const char *live_dev)
371 const char *live_dev_c = NULL;
376 "Can't use the 'single' runmode with multiple devices");
379 if (live_dev != NULL) {
380 aconf = ConfigParser(live_dev);
381 live_dev_c = live_dev;
384 aconf = ConfigParser(live_dev_c);
387 return RunModeSetLiveCaptureWorkersForDevice(
401 const char *recv_mod_name,
402 const char *verdict_mod_name,
403 const char *decode_mod_name)
415 if (queues == NULL) {
420 for (
int i = 0; i < nqueue; i++) {
422 if (cur_queue == NULL) {
425 memset(tname, 0,
sizeof(tname));
430 "packetpool",
"packetpool",
431 queues,
"flow",
"pktacqloop");
432 if (tv_receive == NULL) {
436 if (tm_module == NULL) {
442 if (tm_module == NULL) {
454 for (
int thread = 0; thread < thread_max; thread++) {
457 snprintf(qname,
sizeof(qname),
"pickup%u", (uint16_t)(thread + 1));
459 SCLogDebug(
"tname %s, qname %s", tname, qname);
464 "verdict-queue",
"simple",
466 if (tv_detect_ncpu == NULL) {
471 if (tm_module == NULL) {
486 for (
int i = 0; i < nqueue; i++) {
487 memset(tname, 0,
sizeof(tname));
492 "verdict-queue",
"simple",
493 "packetpool",
"packetpool",
495 if (tv_verdict == NULL) {
499 if (tm_module == NULL) {
505 if (tm_module == NULL) {
524 const char *recv_mod_name,
525 const char *verdict_mod_name,
526 const char *decode_mod_name)
531 for (
int i = 0; i < nqueue; i++) {
534 if (cur_queue == NULL) {
539 memset(tname, 0,
sizeof(tname));
543 "packetpool",
"packetpool",
544 "packetpool",
"packetpool",
551 if (tm_module == NULL) {
557 if (tm_module == NULL) {
563 if (tm_module == NULL) {
569 if (tm_module == NULL) {
575 if (tm_module == NULL) {