]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
fdr: remove groups from struct FDR_Runtime_Args
authorJustin Viiret <justin.viiret@intel.com>
Thu, 7 Jul 2016 02:53:09 +0000 (12:53 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 10 Aug 2016 04:55:52 +0000 (14:55 +1000)
src/fdr/fdr.c
src/fdr/fdr_internal.h
src/fdr/teddy.c
src/fdr/teddy.h
src/fdr/teddy_avx2.c

index f973f639e131fa2f6172893574e0c7ee2794c8ae..4230c2b16af9fdecdb29a7b8f50066b853b86000 100644 (file)
@@ -702,8 +702,8 @@ size_t prepareZones(const u8 *buf, size_t len, const u8 *hend,
 
 static never_inline
 hwlm_error_t fdr_engine_exec(const struct FDR *fdr,
-                             const struct FDR_Runtime_Args *a) {
-    hwlmcb_rv_t control = *a->groups;
+                             const struct FDR_Runtime_Args *a,
+                             hwlm_group_t control) {
     u32 floodBackoff = FLOOD_BACKOFF_START;
     u32 last_match_id = INVALID_MATCH_ID;
     u64a domain_mask_adjusted = fdr->domainMask << 1;
@@ -768,7 +768,10 @@ hwlm_error_t fdr_engine_exec(const struct FDR *fdr,
 #define ONLY_AVX2(func) NULL
 #endif
 
-typedef hwlm_error_t (*FDRFUNCTYPE)(const struct FDR *fdr, const struct FDR_Runtime_Args *a);
+typedef hwlm_error_t (*FDRFUNCTYPE)(const struct FDR *fdr,
+                                    const struct FDR_Runtime_Args *a,
+                                    hwlm_group_t control);
+
 static const FDRFUNCTYPE funcs[] = {
     fdr_engine_exec,
     ONLY_AVX2(fdr_exec_teddy_avx2_msks1_fast),
@@ -811,7 +814,6 @@ hwlm_error_t fdrExec(const struct FDR *fdr, const u8 *buf, size_t len,
         start,
         cb,
         ctxt,
-        &groups,
         nextFloodDetect(buf, len, FLOOD_BACKOFF_START),
         0
     };
@@ -819,7 +821,7 @@ hwlm_error_t fdrExec(const struct FDR *fdr, const u8 *buf, size_t len,
         return HWLM_SUCCESS;
     } else {
         assert(funcs[fdr->engineID]);
-        return funcs[fdr->engineID](fdr, &a);
+        return funcs[fdr->engineID](fdr, &a, groups);
     }
 }
 
@@ -837,7 +839,6 @@ hwlm_error_t fdrExecStreaming(const struct FDR *fdr, const u8 *hbuf,
         start,
         cb,
         ctxt,
-        &groups,
         nextFloodDetect(buf, len, FLOOD_BACKOFF_START),
         /* we are guaranteed to always have 16 initialised bytes at the end of
          * the history buffer (they may be garbage). */
@@ -850,7 +851,7 @@ hwlm_error_t fdrExecStreaming(const struct FDR *fdr, const u8 *hbuf,
         ret = HWLM_SUCCESS;
     } else {
         assert(funcs[fdr->engineID]);
-        ret = funcs[fdr->engineID](fdr, &a);
+        ret = funcs[fdr->engineID](fdr, &a, groups);
     }
 
     fdrPackState(fdr, &a, stream_state);
index cde13f6c1fd766cad1da2b944b3219b53bdd4917..6272b69e8523936bdef8df640c077ef5531f59f9 100644 (file)
@@ -105,7 +105,6 @@ struct FDR_Runtime_Args {
     size_t start_offset;
     HWLMCallback cb;
     void *ctxt;
-    hwlm_group_t *groups;
     const u8 *firstFloodDetect;
     const u64a histBytes;
 };
index 462b57df42baea12a41880781976ef1d5390c756..9f8b51042b8ab69f9b994784672db58ad33e1bbd 100644 (file)
@@ -179,10 +179,10 @@ m128 prep_conf_teddy_m4(const m128 *maskBase, m128 *old_1, m128 *old_2,
 }
 
 hwlm_error_t fdr_exec_teddy_msks1(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a) {
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -233,10 +233,10 @@ hwlm_error_t fdr_exec_teddy_msks1(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_msks1_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a) {
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -287,10 +287,10 @@ hwlm_error_t fdr_exec_teddy_msks1_pck(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_msks2(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a) {
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -345,10 +345,10 @@ hwlm_error_t fdr_exec_teddy_msks2(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_msks2_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a) {
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -403,10 +403,10 @@ hwlm_error_t fdr_exec_teddy_msks2_pck(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_msks3(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a) {
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -464,10 +464,10 @@ hwlm_error_t fdr_exec_teddy_msks3(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_msks3_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a) {
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -525,10 +525,10 @@ hwlm_error_t fdr_exec_teddy_msks3_pck(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_msks4(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a) {
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -587,10 +587,10 @@ hwlm_error_t fdr_exec_teddy_msks4(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_msks4_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a) {
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
index f39027237cefd104c41d4638152939d3477bb136..e2936723a11aa24f8028fb512f5da55b526a13b0 100644 (file)
 #ifndef TEDDY_H_
 #define TEDDY_H_
 
+#include "hwlm/hwlm.h" // for hwlm_group_t
+
 struct FDR; // forward declaration from fdr_internal.h
 struct FDR_Runtime_Args;
 
 hwlm_error_t fdr_exec_teddy_msks1(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a);
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_msks1_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a);
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_msks2(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a);
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_msks2_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a);
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_msks3(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a);
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_msks3_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a);
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_msks4(const struct FDR *fdr,
-                                  const struct FDR_Runtime_Args *a);
+                                  const struct FDR_Runtime_Args *a,
+                                  hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_msks4_pck(const struct FDR *fdr,
-                                      const struct FDR_Runtime_Args *a);
+                                      const struct FDR_Runtime_Args *a,
+                                      hwlm_group_t control);
 
 #if defined(__AVX2__)
 
 hwlm_error_t fdr_exec_teddy_avx2_msks1_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a);
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks1_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a);
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks2_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a);
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks2_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a);
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks3_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a);
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks3_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a);
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks4_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a);
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks4_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a);
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control);
 
 hwlm_error_t fdr_exec_teddy_avx2_msks1_fast(const struct FDR *fdr,
-                                            const struct FDR_Runtime_Args *a);
+                                            const struct FDR_Runtime_Args *a,
+                                            hwlm_group_t control);
 
-hwlm_error_t fdr_exec_teddy_avx2_msks1_pck_fast(const struct FDR *fdr,
-                                                const struct FDR_Runtime_Args *a);
+hwlm_error_t
+fdr_exec_teddy_avx2_msks1_pck_fast(const struct FDR *fdr,
+                                   const struct FDR_Runtime_Args *a,
+                                   hwlm_group_t control);
 
 #endif /* __AVX2__ */
 
index 52e75cb4dc644435a94f28da8bdd199848c5b2c9..428c94466fe29ebe789a0552d48d647338bec96d 100644 (file)
@@ -481,10 +481,10 @@ const u32 * getConfBase_avx2(const struct Teddy *teddy, u8 numMask) {
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks1_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a) {
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -536,10 +536,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks1_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks1_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a) {
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -591,10 +591,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks1_pck_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks2_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a) {
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -649,10 +649,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks2_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks2_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a) {
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -707,10 +707,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks2_pck_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks3_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a) {
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -768,10 +768,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks3_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks3_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a) {
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -829,10 +829,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks3_pck_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks4_fat(const struct FDR *fdr,
-                                           const struct FDR_Runtime_Args *a) {
+                                           const struct FDR_Runtime_Args *a,
+                                           hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -894,10 +894,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks4_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks4_pck_fat(const struct FDR *fdr,
-                                               const struct FDR_Runtime_Args *a) {
+                                               const struct FDR_Runtime_Args *a,
+                                               hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -959,10 +959,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks4_pck_fat(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks1_fast(const struct FDR *fdr,
-                                            const struct FDR_Runtime_Args *a) {
+                                            const struct FDR_Runtime_Args *a,
+                                            hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;
@@ -1028,10 +1028,10 @@ hwlm_error_t fdr_exec_teddy_avx2_msks1_fast(const struct FDR *fdr,
 }
 
 hwlm_error_t fdr_exec_teddy_avx2_msks1_pck_fast(const struct FDR *fdr,
-                                                const struct FDR_Runtime_Args *a) {
+                                            const struct FDR_Runtime_Args *a,
+                                            hwlm_group_t control) {
     const u8 *buf_end = a->buf + a->len;
     const u8 *ptr = a->buf + a->start_offset;
-    hwlmcb_rv_t control = *a->groups;
     u32 floodBackoff = FLOOD_BACKOFF_START;
     const u8 *tryFloodDetect = a->firstFloodDetect;
     u32 last_match = (u32)-1;