From: Eric Leblond Date: Wed, 31 Jan 2018 20:12:59 +0000 (+0100) Subject: af-packet: count only CPUs once X-Git-Tag: suricata-4.1.0-beta1~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=194751654fba60424df9c2af1bdceae29c672fa1;p=thirdparty%2Fsuricata.git af-packet: count only CPUs once --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 040ab196a5..874118f890 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -314,6 +314,9 @@ static int AFPGetDevFlags(int fd, const char *ifname); static int AFPDerefSocket(AFPPeer* peer); static int AFPRefSocket(AFPPeer* peer); + +static unsigned int nr_cpus; + /** * \brief Registration Function for RecieveAFP. * \todo Unit tests are needed for this module. @@ -330,6 +333,8 @@ void TmModuleReceiveAFPRegister (void) tmm_modules[TMM_RECEIVEAFP].RegisterTests = NULL; tmm_modules[TMM_RECEIVEAFP].cap_flags = SC_CAP_NET_RAW; tmm_modules[TMM_RECEIVEAFP].flags = TM_FLAG_RECEIVE_TM; + + nr_cpus = UtilCpuGetNumProcessorsConfigured(); } @@ -2265,7 +2270,6 @@ TmEcode AFPSetBPFFilter(AFPThreadVars *ptv) */ static int AFPInsertHalfFlow(int mapd, void *key, uint64_t inittime) { - unsigned int nr_cpus = UtilCpuGetNumProcessorsConfigured(); struct pair value[nr_cpus]; unsigned int i;