diff --git a/configure.in b/configure.in index f8b4c23be9..4a296e8d75 100644 --- a/configure.in +++ b/configure.in @@ -635,7 +635,7 @@ AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)]) ]) # enable debug validation functions & macro's output - AC_ARG_ENABLE(debug, + AC_ARG_ENABLE(debug-validation, AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),,[enable_debug_validation=no]) AS_IF([test "x$enable_debug_validation" = "xyes"], [ CFLAGS="${CFLAGS} -DDEBUG_VALIDATION" @@ -685,7 +685,7 @@ AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)]) # enable CUDA output AC_ARG_ENABLE(cuda, - AS_HELP_STRING([--enable-cuda], [Enable CUDA pattern matching]),,[enable_cuda=no]) + AS_HELP_STRING([--enable-cuda], [Enable experimental CUDA pattern matching]),,[enable_cuda=no]) AS_IF([test "x$enable_cuda" = "xyes"], [ AC_ARG_WITH(cuda_includes, [ --with-cuda-includes=DIR cuda include directory], diff --git a/src/cuda-packet-batcher.c b/src/cuda-packet-batcher.c index 274b8bddb9..73bc8551da 100644 --- a/src/cuda-packet-batcher.c +++ b/src/cuda-packet-batcher.c @@ -518,6 +518,13 @@ TmEcode SCCudaPBBatchPackets(ThreadVars *tv, Packet *p, void *data, PacketQueue * we end up buffering the packet or not */ p->cuda_mpm_enabled = 0; + /* packets that are too big are handled by the cpu */ + if (p->payload_len > SC_CUDA_PB_MAX_PAYLOAD_SIZE) { + SCLogDebug("p->payload_len %"PRIu16" > %d, inspecting on the CPU.", + p->payload_len, SC_CUDA_PB_MAX_PAYLOAD_SIZE); + return TM_ECODE_OK; + } + SCCudaPBThreadCtx *tctx = data; /* the packets buffer */ SCCudaPBPacketsBuffer *pb = (SCCudaPBPacketsBuffer *)tctx->curr_pb; diff --git a/src/cuda-packet-batcher.h b/src/cuda-packet-batcher.h index eb0579f0fe..c320ffea23 100644 --- a/src/cuda-packet-batcher.h +++ b/src/cuda-packet-batcher.h @@ -20,6 +20,9 @@ * be enabling cuda. We will only end up screwing performance */ #define SC_CUDA_PB_MIN_NO_OF_PACKETS 4000 +/* the maximum payload size we're sending to the card (defined in decode.h) */ +#define SC_CUDA_PB_MAX_PAYLOAD_SIZE CUDA_MAX_PAYLOAD_SIZE + /** * \brief Implement the template SCDQGenericQData to transfer the cuda * packet buffer from the cuda batcher thread to the dispatcher @@ -87,7 +90,7 @@ typedef struct SCCudaPBPacketDataForGPU_ { unsigned int payload_len; /* holds the payload. While we actually store the payload in the buffer, * we may not end up using the entire 1480 bytes if the payload is smaller */ - uint8_t payload[1480]; + uint8_t payload[SC_CUDA_PB_MAX_PAYLOAD_SIZE]; } SCCudaPBPacketDataForGPU; /** diff --git a/src/decode.h b/src/decode.h index fe3954cfe3..a71ccab329 100644 --- a/src/decode.h +++ b/src/decode.h @@ -57,6 +57,10 @@ #include "detect-reference.h" +#ifdef __SC_CUDA_SUPPORT__ +#define CUDA_MAX_PAYLOAD_SIZE 1500 +#endif + /* forward declaration */ struct DetectionEngineThreadCtx_; @@ -384,7 +388,7 @@ typedef struct Packet_ SCMutex cuda_mutex; SCCondT cuda_cond; /* the extra 1 in the 1481, is to hold the no_of_matches from the mpm run */ - uint16_t mpm_offsets[1481]; + uint16_t mpm_offsets[CUDA_MAX_PAYLOAD_SIZE + 1]; #endif } Packet;