From patchwork Tue Apr 2 14:57:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1074548 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; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 44YXTN3DS8z9sTX for ; Wed, 3 Apr 2019 02:00:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 01AEEECC; Tue, 2 Apr 2019 14:57:48 +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 197FCE97 for ; Tue, 2 Apr 2019 14:57:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id E46897F8 for ; Tue, 2 Apr 2019 14:57:43 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Apr 2019 17:57:38 +0300 Received: from dev-r-vrt-214.mtr.labs.mlnx. (dev-r-vrt-214.mtr.labs.mlnx [10.212.214.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x32EvNDq025807; Tue, 2 Apr 2019 17:57:38 +0300 From: Eli Britstein To: dev@openvswitch.org Date: Tue, 2 Apr 2019 14:57:12 +0000 Message-Id: <20190402145712.7290-7-elibr@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190402145712.7290-1-elibr@mellanox.com> References: <20190402145712.7290-1-elibr@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Oz Shlomo , Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH 6/6] dpif-netdev: Accelerate peer port forwarding by bypassing DP processing 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 Packet parsing and rule matching introduce a large processing overhead for simple port-to-port forwarding scenarios. Accelerate port-to-port forwarding by bypassing the datapath packet processing if a peer-port property is defined. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/dpif-netdev.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 4d6d0c372..7751805ef 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -759,7 +759,8 @@ static void dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd, const struct nlattr *actions, size_t actions_len); static void dp_netdev_input(struct dp_netdev_pmd_thread *, - struct dp_packet_batch *, odp_port_t port_no); + struct dp_packet_batch *, odp_port_t port_no, + struct netdev_rxq *); static void dp_netdev_recirculate(struct dp_netdev_pmd_thread *, struct dp_packet_batch *); @@ -4271,7 +4272,7 @@ dp_netdev_process_rxq_port(struct dp_netdev_pmd_thread *pmd, } } /* Process packet batch. */ - dp_netdev_input(pmd, &batch, port_no); + dp_netdev_input(pmd, &batch, port_no, rxq->rx); /* Assign processing cycles to rx queue. */ cycles = cycle_timer_stop(&pmd->perf_stats, &timer); @@ -6766,9 +6767,17 @@ dp_netdev_input__(struct dp_netdev_pmd_thread *pmd, static void dp_netdev_input(struct dp_netdev_pmd_thread *pmd, struct dp_packet_batch *packets, - odp_port_t port_no) + odp_port_t port_no, + struct netdev_rxq *rxq) { - dp_netdev_input__(pmd, packets, false, port_no); + if (!rxq->netdev->peer) { + dp_netdev_input__(pmd, packets, false, port_no); + } else { + /* Bypassing standard DP processing and forward the packets directly + * to its peer port */ + netdev_send(rxq->netdev->peer, rxq->queue_id, packets, true); + packets->count = 0; + } } static void