From 35afa8f3921e05b8e5b85be008ba3bc78101bd21 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 11 Sep 2023 17:04:15 +0200 Subject: [PATCH] detect/tx: improve branch prediction --- src/detect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detect.c b/src/detect.c index b96d96d93a46..7542a79dd47e 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1340,14 +1340,14 @@ static DetectTransaction GetDetectTx(const uint8_t ipproto, const AppProto alpro } uint64_t detect_flags = (flow_flags & STREAM_TOSERVER) ? txd->detect_flags_ts : txd->detect_flags_tc; - if (detect_flags & APP_LAYER_TX_INSPECTED_FLAG) { + if (unlikely(detect_flags & APP_LAYER_TX_INSPECTED_FLAG)) { SCLogDebug("%"PRIu64" tx already fully inspected for %s. Flags %016"PRIx64, tx_id, flow_flags & STREAM_TOSERVER ? "toserver" : "toclient", detect_flags); DetectTransaction no_tx = NO_TX; return no_tx; } - if (detect_flags & APP_LAYER_TX_SKIP_INSPECT_FLAG) { + if (unlikely(detect_flags & APP_LAYER_TX_SKIP_INSPECT_FLAG)) { SCLogDebug("%" PRIu64 " tx should not be inspected in direction %s. Flags %016" PRIx64, tx_id, flow_flags & STREAM_TOSERVER ? "toserver" : "toclient", detect_flags); DetectTransaction no_tx = NO_TX;