From: Anoop Saldanha Date: Mon, 15 Jul 2013 13:48:49 +0000 (+0530) Subject: Code to enable cuda support for live mode pcap and af-packet. Keep an eye X-Git-Tag: suricata-2.0beta1~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7f09f24c8281ae2400d15775644872949600177;p=thirdparty%2Fsuricata.git Code to enable cuda support for live mode pcap and af-packet. Keep an eye out on the mailing list and http://planet.suricata-ids.org for performance and other profiling data. --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 1d5d8ae953..3803427b15 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -55,6 +55,18 @@ #include "source-af-packet.h" #include "runmodes.h" +#ifdef __SC_CUDA_SUPPORT__ + +#include "util-cuda.h" +#include "util-cuda-buffer.h" +#include "util-mpm-ac.h" +#include "util-cuda-handlers.h" +#include "detect-engine.h" +#include "detect-engine-mpm.h" +#include "util-cuda-vars.h" + +#endif /* __SC_CUDA_SUPPORT__ */ + #ifdef HAVE_AF_PACKET #if HAVE_SYS_IOCTL_H @@ -1665,6 +1677,11 @@ TmEcode DecodeAFP(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet break; } +#ifdef __SC_CUDA_SUPPORT__ + if (dtv->cuda_vars.mpm_is_cuda) + CudaBufferPacket(&dtv->cuda_vars, p); +#endif + SCReturnInt(TM_ECODE_OK); } @@ -1682,6 +1699,11 @@ TmEcode DecodeAFPThreadInit(ThreadVars *tv, void *initdata, void **data) *data = (void *)dtv; +#ifdef __SC_CUDA_SUPPORT__ + if (CudaThreadVarsInit(&dtv->cuda_vars) < 0) + SCReturnInt(TM_ECODE_FAILED); +#endif + SCReturnInt(TM_ECODE_OK); } diff --git a/src/source-pcap.c b/src/source-pcap.c index 6c235e01f2..60e3625cbe 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -42,6 +42,18 @@ #include "util-ioctl.h" #include "tmqh-packetpool.h" +#ifdef __SC_CUDA_SUPPORT__ + +#include "util-cuda.h" +#include "util-cuda-buffer.h" +#include "util-mpm-ac.h" +#include "util-cuda-handlers.h" +#include "detect-engine.h" +#include "detect-engine-mpm.h" +#include "util-cuda-vars.h" + +#endif /* __SC_CUDA_SUPPORT__ */ + extern uint8_t suricata_ctl_flags; #define PCAP_STATE_DOWN 0 @@ -703,6 +715,11 @@ TmEcode DecodePcap(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe break; } +#ifdef __SC_CUDA_SUPPORT__ + if (dtv->cuda_vars.mpm_is_cuda) + CudaBufferPacket(&dtv->cuda_vars, p); +#endif + SCReturnInt(TM_ECODE_OK); } @@ -718,6 +735,11 @@ TmEcode DecodePcapThreadInit(ThreadVars *tv, void *initdata, void **data) DecodeRegisterPerfCounters(dtv, tv); +#ifdef __SC_CUDA_SUPPORT__ + if (CudaThreadVarsInit(&dtv->cuda_vars) < 0) + SCReturnInt(TM_ECODE_FAILED); +#endif + *data = (void *)dtv; SCReturnInt(TM_ECODE_OK);