From patchwork Wed Jan 27 21:31:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Zhou X-Patchwork-Id: 574439 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 8614F140E01 for ; Thu, 28 Jan 2016 08:31:21 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 20E3D1086A; Wed, 27 Jan 2016 13:31:19 -0800 (PST) X-Original-To: dev@openvswitch.com Delivered-To: dev@openvswitch.com Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by archives.nicira.com (Postfix) with ESMTPS id A6A3B10868 for ; Wed, 27 Jan 2016 13:31:17 -0800 (PST) Received: by mail-pf0-f196.google.com with SMTP id n128so967199pfn.3 for ; Wed, 27 Jan 2016 13:31:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vOQx2Ny6qWgq3yR5PmEYnl9yZ/3qUxA+fJhjjQn95u0=; b=O2dXnDAqHNt2mkU+aVXs+EL3BCGRrYtib+R+CZ9+aBYVWtQ3F0QgmX6hx7iZPROcjK 5qWKeunfHucWuq652wrUKmgMtP6hCpv4bYH2D2uXIe3Fxdn/hKb4fggVYmOh2KW6FYwi Nd427I45sdyf7G48bxNcn4iu9Rx981Eg3RbWrkk+jpF1RUP8yQ682RHVI3BfSxyEPcZ2 MAHPleUlHYuUHhxx9i6JtxhOvCn3m4WhxbP8TXL2UvQc05rnynNHofcWp1W+k6xezzKR 0CK+OXvB3q7R3ZRxcp3fzvaBBpuW4pwD1+67ggnJKEdZEnBlT3xKQOI1BNbVrY/3Ucow mXKw== X-Gm-Message-State: AG10YOSca22IOILiCa7ZpRoVMbfp7TCFBYTAoxdyicG9+3K3H/129JQPgC4MyMBtci76/A== X-Received: by 10.98.17.92 with SMTP id z89mr13349188pfi.16.1453930277300; Wed, 27 Jan 2016 13:31:17 -0800 (PST) Received: from ubuntu.localdomain ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id 3sm11139495pfb.64.2016.01.27.13.31.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jan 2016 13:31:16 -0800 (PST) From: Andy Zhou To: dev@openvswitch.com Date: Wed, 27 Jan 2016 13:31:03 -0800 Message-Id: <1453930264-111017-2-git-send-email-azhou@ovn.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453930264-111017-1-git-send-email-azhou@ovn.org> References: <1453930264-111017-1-git-send-email-azhou@ovn.org> Subject: [ovs-dev] [PATCH 2/3] dpif-netdev: drop swapping X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" emc_processing() moves all the missed packets towards the beginning of packet array; matched packets are queued up into flow queues. Since the remaining of the packet array is not used anymore, don't bother swap packet pointers to save cycles and simplify logic. Signed-off-by: Andy Zhou --- lib/dpif-netdev.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index dec06fc..a7e15aa 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -3188,14 +3188,6 @@ dp_netdev_queue_batches(struct dp_packet *pkt, packet_batch_update(batch, pkt, mf); } -static inline void -dp_packet_swap(struct dp_packet **a, struct dp_packet **b) -{ - struct dp_packet *tmp = *a; - *a = *b; - *b = tmp; -} - /* Try to process all ('cnt') the 'packets' using only the exact match cache * 'flow_cache'. If a flow is not found for a packet 'packets[i]', the * miniflow is copied into 'keys' and the packet pointer is moved at the @@ -3236,10 +3228,9 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets, dp_netdev_queue_batches(packets[i], flow, &key.mf, batches, n_batches); } else { - if (i != n_missed) { - dp_packet_swap(&packets[i], &packets[n_missed]); - } - + /* Exact match cache missed. Group missed packets together at + * the beginning of the 'packets' array. */ + packets[n_missed] = packets[i]; keys[n_missed++] = key; } }