From patchwork Tue Sep 26 03:51:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 818440 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MPb/WoSa"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y1Rsm45d7z9t3Z for ; Tue, 26 Sep 2017 13:54:36 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D6B71BBF; Tue, 26 Sep 2017 03:52:04 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 2CE8AAB8 for ; Tue, 26 Sep 2017 03:52:01 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 011EA1A6 for ; Tue, 26 Sep 2017 03:52:00 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id g65so4497174pfe.1 for ; Mon, 25 Sep 2017 20:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=M/prPFaPP+CwidyfK3J6h9rFGCaiAcsib4PD2C2e9nI=; b=MPb/WoSa2eQQ7IaDsITzg3kGVWu2ZaTP4a7H5NVNnw8086twDAJh9pLGsd5aTw7oZA f1xZmq7jXKhJZA9fEz4mSRa8Ba/ujANY+FzlHzpQy1/UqXAN8Eg/48i6XLDcdgZNTMZK 4m0KrSYkXPYzCZV3xQMAwED1595h0rBQOWz7x7goa/Bo2Y6oT5ZlvRWLlrP126smRE5a ZVkxrgkBO8JHTP3eKVyEMul7jIemF7oXj2cR2LDB6MsnlrXHLL4Kuvtdk9yen/IK0YgW PkIB/6KL8OwfbaN3ClAintM+KAIo7u5PbUl0+EiLXOWp4kLUjZcD/dSLVtQIHIomu6Z8 8zZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=M/prPFaPP+CwidyfK3J6h9rFGCaiAcsib4PD2C2e9nI=; b=AJSRq4g9TU4oFWRFVt7uKZi0FcuxWwLdoajz3UAOdqGfCI8vF61XcrVK7lCODe9wRm FMZbMWSfFP9I7Eu6WComs5lQx1camn5TKUvQGDnNqMxAzekSMzaon2LgeoCz0kxvV2EG M1dBSyNcXfar7dCokYn1a92X6s3TYp8AgUeiy/K4aFnWIYFEJqlM9pfHwPEKdaoQBDcD C7ovVJfEGeQtfScMaUV7QT+QZXWiCo2FlaU0pQoaxrFwC9m2snY+N9C/TlUXZv9H1bET i7bb5xlmvSDY1tZN2b3EtlU/DvuSdZv4YfixWaDVe0kAtTrp7PFdWvlOCFjWBPn1F0yP ZJWw== X-Gm-Message-State: AHPjjUhdXLi6jw8V82dX8paLS8+nXAt+zq3IYve2zvp3wxMDyaUE44ua SCXxJx2PsOdsSKTkqCuZgU8VQg== X-Google-Smtp-Source: AOwi7QCKQ5IosK+/mGFRl1OrUSBmq5c4/BN39p4R91iJC6EivzqCJim3thletnT4oeqs1Z616Sov/Q== X-Received: by 10.99.127.91 with SMTP id p27mr9301341pgn.405.1506397920693; Mon, 25 Sep 2017 20:52:00 -0700 (PDT) Received: from ubuntu.localdomain ([208.91.2.2]) by smtp.gmail.com with ESMTPSA id x13sm13977770pgt.16.2017.09.25.20.51.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Sep 2017 20:52:00 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Mon, 25 Sep 2017 20:51:46 -0700 Message-Id: <1506397906-120886-5-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1506397906-120886-1-git-send-email-dlu998@gmail.com> References: <1506397906-120886-1-git-send-email-dlu998@gmail.com> X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v3 5/5] conntrack: Minor performance enhancement. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Add an OVS_UNLIKELY and reorder a few variable condition checks. Acked-by: Bhanuprakash Bodireddy Signed-off-by: Darrell Ball --- 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); } }