memset(aconf, 0, sizeof(*aconf));
aconf->DerefFunc = NetmapDerefConfig;
- aconf->threads = 1;
+ aconf->threads = 0;
aconf->promisc = 1;
aconf->checksum_mode = CHECKSUM_VALIDATION_AUTO;
aconf->copy_mode = NETMAP_COPY_MODE_NONE;
netmap_node = ConfGetNode("netmap");
if (netmap_node == NULL) {
SCLogInfo("Unable to find netmap config using default value");
- return aconf;
+ goto finalize;
}
if_root = ConfFindDeviceConfig(netmap_node, aconf->iface_name);
SCLogInfo("Unable to find netmap config for "
"interface \"%s\" or \"default\", using default value",
aconf->iface_name);
- return aconf;
+ goto finalize;
}
/* If there is no setting for current interface use default one as main iface */
}
if (ConfGetChildValueWithDefault(if_root, if_default, "threads", &threadsstr) != 1) {
- aconf->threads = 1;
+ aconf->threads = 0;
} else {
if (strcmp(threadsstr, "auto") == 0) {
- aconf->threads = NetmapGetRSSCount(aconf->iface);
+ aconf->threads = 0;
} else {
aconf->threads = (uint8_t)atoi(threadsstr);
}
}
- if (aconf->threads <= 0) {
- aconf->threads = 1;
- }
- if (aconf->threads) {
- SCLogInfo("Using %d threads for interface %s", aconf->threads,
- aconf->iface_name);
- }
-
if (ConfGetChildValueWithDefault(if_root, if_default, "copy-iface", &out_iface) == 1) {
if (strlen(out_iface) > 0) {
aconf->out_iface_name = out_iface;
}
}
- SC_ATOMIC_RESET(aconf->ref);
- (void) SC_ATOMIC_ADD(aconf->ref, aconf->threads);
-
/* load netmap bpf filter */
/* command line value has precedence */
if (ConfGet("bpf-filter", &bpf_filter) != 1) {
}
}
+finalize:
+
+ if (aconf->threads == 0) {
+ aconf->threads = NetmapGetRSSCount(aconf->iface);
+ }
+ if (aconf->threads <= 0) {
+ aconf->threads = 1;
+ }
+ SC_ATOMIC_RESET(aconf->ref);
+ (void) SC_ATOMIC_ADD(aconf->ref, aconf->threads);
+ SCLogInfo("Using %d threads for interface %s", aconf->threads,
+ aconf->iface_name);
+
return aconf;
}