]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Code to enable cuda support for live mode pcap and af-packet. Keep an eye
authorAnoop Saldanha <anoopsaldanha@gmail.com>
Mon, 15 Jul 2013 13:48:49 +0000 (19:18 +0530)
committerVictor Julien <victor@inliniac.net>
Mon, 15 Jul 2013 14:41:56 +0000 (16:41 +0200)
out on the mailing list and http://planet.suricata-ids.org for performance
and other profiling data.

src/source-af-packet.c
src/source-pcap.c

index 1d5d8ae953db4cecbf67d71eec0e4448a2d4ce0e..3803427b1509ed7cfcb5aa05df635480b4c04012 100644 (file)
 #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);
 }
 
index 6c235e01f2bff45f2fd3f4cdd3d8d0b0680e607f..60e3625cbe4f8995aae1ecb0b51e7645bafa99ef 100644 (file)
 #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);