]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: cleanup locking debug leftovers
authorVictor Julien <vjulien@oisf.net>
Sat, 9 Apr 2022 08:56:04 +0000 (10:56 +0200)
committerVictor Julien <vjulien@oisf.net>
Sat, 9 Apr 2022 15:13:38 +0000 (17:13 +0200)
src/flow-hash.c
src/flow-manager.c

index 56f4a7f5897a7686ca69a0ca27e9eebf4ab31e1b..3f551f05479de0663569505e337f6dba36c57ea6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2020 Open Information Security Foundation
+/* Copyright (C) 2007-2022 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -717,19 +717,6 @@ static inline bool FlowIsTimedOut(const Flow *f, const uint32_t sec, const bool
     return false;
 }
 
-static inline void FromHashLockBucket(FlowBucket *fb)
-{
-    FBLOCK_LOCK(fb);
-}
-static inline void FromHashLockTO(Flow *f)
-{
-    FLOWLOCK_WRLOCK(f);
-}
-static inline void FromHashLockCMP(Flow *f)
-{
-    FLOWLOCK_WRLOCK(f);
-}
-
 /** \brief Get Flow for packet
  *
  * Hash retrieval function for flows. Looks up the hash bucket containing the
@@ -755,7 +742,7 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, FlowLookupStruct *fls,
     /* get our hash bucket and lock it */
     const uint32_t hash = p->flow_hash;
     FlowBucket *fb = &flow_hash[hash % flow_config.hash_size];
-    FromHashLockBucket(fb);
+    FBLOCK_LOCK(fb);
 
     SCLogDebug("fb %p fb->head %p", fb, fb->head);
 
@@ -792,7 +779,7 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, FlowLookupStruct *fls,
         const bool timedout =
             (fb_nextts < (uint32_t)p->ts.tv_sec && FlowIsTimedOut(f, (uint32_t)p->ts.tv_sec, emerg));
         if (timedout) {
-            FromHashLockTO(f);//FLOWLOCK_WRLOCK(f);
+            FLOWLOCK_WRLOCK(f);
             if (likely(f->use_cnt == 0)) {
                 next_f = f->next;
                 MoveToWorkQueue(tv, fls, fb, f, prev_f);
@@ -801,7 +788,7 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, FlowLookupStruct *fls,
             }
             FLOWLOCK_UNLOCK(f);
         } else if (FlowCompare(f, p) != 0) {
-            FromHashLockCMP(f);//FLOWLOCK_WRLOCK(f);
+            FLOWLOCK_WRLOCK(f);
             /* found a matching flow that is not timed out */
             if (unlikely(TcpSessionPacketSsnReuse(p, f, f->protoctx) == 1)) {
                 Flow *new_f = TcpReuseReplace(tv, fls, fb, f, hash, p);
index 1139e4326faa342a070c96f42bc1828edd63c60c..892a84f43da0a3b4458474aa5d0c8c3e5b053e5f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2020 Open Information Security Foundation
+/* Copyright (C) 2007-2022 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -264,11 +264,6 @@ static inline int FlowBypassedTimeout(Flow *f, struct timeval *ts,
     return 1;
 }
 
-static inline void FMFlowLock(Flow *f)
-{
-    FLOWLOCK_WRLOCK(f);
-}
-
 typedef struct FlowManagerTimeoutThread {
     /* used to temporarily store flows that have timed out and are
      * removed from the hash */
@@ -344,7 +339,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td,
             continue;
         }
 
-        FMFlowLock(f); //FLOWLOCK_WRLOCK(f);
+        FLOWLOCK_WRLOCK(f);
 
         Flow *next_flow = f->next;