diff mbox series

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

Message ID 1506397906-120886-5-git-send-email-dlu998@gmail.com
State Accepted
Headers show
Series [ovs-dev,v3,1/5] conntrack: Create nat_conn_keys_insert(). | expand

Commit Message

Darrell Ball Sept. 26, 2017, 3:51 a.m. UTC
Add an OVS_UNLIKELY and reorder a few variable condition
checks.

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

Patch

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);
     }
 }