]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/content-inspect: optimize struct layout
authorVictor Julien <vjulien@oisf.net>
Tue, 26 Sep 2023 08:10:52 +0000 (10:10 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 7 Dec 2023 08:56:59 +0000 (09:56 +0100)
Move members used by DetectEngineContentInspection() to the same cache line.

src/detect.h

index 2b634e76170176f97c1b6b3f56bc8445749c18ee..36e4e2ba3b25351bc8634025e295b4d70bceaade 100644 (file)
@@ -1112,6 +1112,17 @@ typedef struct DetectEngineThreadCtx_ {
      *  points to 1 byte after the start of the last pcre match if a pcre match happened. */
     uint32_t pcre_match_start_offset;
 
+    /** SPM thread context used for scanning. This has been cloned from the
+     * prototype held by DetectEngineCtx. */
+    SpmThreadCtx *spm_thread_ctx;
+
+    /* byte_* values */
+    uint64_t *byte_values;
+
+    uint8_t *base64_decoded;
+    int base64_decoded_len;
+    int base64_decoded_len_max;
+
     /* counter for the filestore array below -- up here for cache reasons. */
     uint16_t filestore_cnt;
 
@@ -1177,13 +1188,6 @@ typedef struct DetectEngineThreadCtx_ {
     MpmThreadCtx mtc; /**< thread ctx for the mpm */
     PrefilterRuleStore pmq;
 
-    /** SPM thread context used for scanning. This has been cloned from the
-     * prototype held by DetectEngineCtx. */
-    SpmThreadCtx *spm_thread_ctx;
-
-    /* byte_* values */
-    uint64_t *byte_values;
-
     /* string to replace */
     DetectReplaceList *replist;
     /* vars to store in post match function */
@@ -1205,10 +1209,6 @@ typedef struct DetectEngineThreadCtx_ {
     int global_keyword_ctxs_size;
     void **global_keyword_ctxs_array;
 
-    uint8_t *base64_decoded;
-    int base64_decoded_len;
-    int base64_decoded_len_max;
-
     AppLayerDecoderEvents *decoder_events;
     uint16_t events;