af-packet: no more threads than RSS queues

If we manage to read the number of RSS queues from an interface,
this means that the optimal number of capture threads is equal
to the minimum of this number and of the number of cores on the
system.

This patch implements this logic thanks to the newly introduced
function GetIfaceRSSQueuesNum.
pull/1238/head
Eric Leblond 10 years ago
parent 123c58af4b
commit 56373e5b34

@ -52,6 +52,7 @@
#include "util-affinity.h"
#include "util-device.h"
#include "util-runmodes.h"
#include "util-ioctl.h"
#include "source-af-packet.h"
@ -184,7 +185,17 @@ void *ParseAFPConfig(const char *iface)
}
}
if (aconf->threads == 0) {
int rss_queues;
aconf->threads = (int)UtilCpuGetNumProcessorsOnline();
/* Get the number of RSS queues and take the min */
rss_queues = GetIfaceRSSQueuesNum(iface);
if (rss_queues > 0) {
if (rss_queues < aconf->threads) {
aconf->threads = rss_queues;
SCLogInfo("More core than RSS queues, using %d threads for interface %s",
aconf->threads, iface);
}
}
if (aconf->threads)
SCLogInfo("Using %d AF_PACKET threads for interface %s", aconf->threads, iface);
}

Loading…
Cancel
Save