[ovs-dev] [patch v3 5/5] conntrack: Minor performance enhancement.

Darrell Ball dlu998 at gmail.com
Tue Sep 26 03:51:46 UTC 2017


Add an OVS_UNLIKELY and reorder a few variable condition
checks.

Acked-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
Signed-off-by: Darrell Ball <dlu998 at gmail.com>
---
 lib/conntrack.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 3026772..33d2a21 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -1189,7 +1189,7 @@ process_one(struct conntrack *ct, struct dp_packet *pkt,
 
     bool tftp_ctl = is_tftp_ctl(pkt);
     struct conn conn_for_expectation;
-    if (conn && (ftp_ctl || tftp_ctl)) {
+    if (OVS_UNLIKELY((ftp_ctl || tftp_ctl) && conn)) {
         conn_for_expectation = *conn;
     }
 
@@ -1200,10 +1200,10 @@ process_one(struct conntrack *ct, struct dp_packet *pkt,
     }
 
     /* FTP control packet handling with expectation creation. */
-    if (OVS_UNLIKELY(conn && ftp_ctl)) {
+    if (OVS_UNLIKELY(ftp_ctl && conn)) {
         handle_ftp_ctl(ct, ctx, pkt, &conn_for_expectation,
                        now, CT_FTP_CTL_INTEREST, !!nat_action_info);
-    } else if (OVS_UNLIKELY(conn && tftp_ctl)) {
+    } else if (OVS_UNLIKELY(tftp_ctl && conn)) {
         handle_tftp_ctl(ct, &conn_for_expectation, now);
     }
 }
-- 
1.9.1



More information about the dev mailing list