From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B0D68C33A for ; Wed, 10 Jun 2015 15:07:38 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 10 Jun 2015 06:07:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,587,1427785200"; d="scan'208";a="744278205" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 10 Jun 2015 06:07:27 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t5AD7PkW010141; Wed, 10 Jun 2015 14:07:25 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t5AD7Pxe019511; Wed, 10 Jun 2015 14:07:25 +0100 Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id t5AD7PLh019507; Wed, 10 Jun 2015 14:07:25 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Wed, 10 Jun 2015 14:07:21 +0100 Message-Id: <1433941641-19405-7-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433941641-19405-1-git-send-email-bruce.richardson@intel.com> References: <20150519113112.GA10700@bricha3-MOBL3> <1433941641-19405-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [RFC-PATCH-v3 6/6] test: add pktdev performance tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2015 13:07:39 -0000 Add in some performance testing for the pktdev library. Looking at cycles count for a ring-based implementation, based off the ring performance tests. Compares ring performance: * native ring calls * calls through pktdev to the ring * calls through ring pmd wrapper to the ring * calls through pktdev to the pmd wrapper to the ring. Signed-off-by: Bruce Richardson --- app/test/Makefile | 4 +- app/test/test_pktdev_perf.c | 260 +++++++++++++++++++++++++++++++++++++++++ lib/librte_pktdev/rte_pktdev.h | 8 +- 3 files changed, 265 insertions(+), 7 deletions(-) create mode 100644 app/test/test_pktdev_perf.c diff --git a/app/test/Makefile b/app/test/Makefile index 77e48c1..8697893 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -58,9 +58,7 @@ SRCS-y += test_ring.c SRCS-y += test_ring_perf.c SRCS-y += test_pmd_perf.c -ifeq ($(CONFIG_RTE_LIBRTE_PKTDEV),y) -SRCS-y += test_pktdev.c -endif +SRCS-$(CONFIG_RTE_LIBRTE_PKTDEV) += test_pktdev.c test_pktdev_perf.c ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y) SRCS-y += test_table.c diff --git a/app/test/test_pktdev_perf.c b/app/test/test_pktdev_perf.c new file mode 100644 index 0000000..6a94e4d --- /dev/null +++ b/app/test/test_pktdev_perf.c @@ -0,0 +1,260 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "test.h" + +/* + * Ring + * ==== + * + * Measures performance of various operations using rdtsc + * * Empty ring dequeue + * * Enqueue/dequeue of bursts in 1 threads + * * Enqueue/dequeue of bursts in 2 threads + */ + +#define RING_NAME "RING_PERF" +#define RING_SIZE 4096 +#define MAX_BURST 32 + +/* + * the sizes to enqueue and dequeue in testing + * (marked volatile so they won't be seen as compile-time constants) + */ +static const volatile unsigned bulk_sizes[] = { 1, 8, 32 }; + +/* The ring structure used for tests */ +static struct rte_ring *r; +static struct rte_pktdev *r_pdev; +static uint8_t ring_ethdev_port; +static struct rte_pktdev *re_pdev; + +/* Get cycle counts for dequeuing from an empty ring. Should be 2 or 3 cycles */ +static void +test_empty_dequeue(void) +{ + const unsigned iter_shift = 26; + const unsigned iterations = 1<> iter_shift); + printf("Pktdev(ring) single enq/deq : %"PRIu64"\n", + (pd_end-pd_start) >> iter_shift); + printf("Ethdev single enq/dequeue : %"PRIu64"\n", + (eth_end-eth_start) >> iter_shift); + printf("Pktdev(ethdev) single enq/deq: %"PRIu64"\n", + (pd_eth_end-pd_eth_start) >> iter_shift); +} + +/* Times enqueue and dequeue on a single lcore */ +static void +test_bulk_enqueue_dequeue(void) +{ + const unsigned iter_shift = 23; + const unsigned iterations = 1< #include +#include #include /* Buffered TX works in bursts of 32 */ @@ -53,9 +54,8 @@ extern "C" { /* * forward definition of data structures. - * We don't need full mbuf/kni/ethdev headers here + * We don't need full kni/ethdev headers here */ -struct rte_mbuf; struct rte_kni; struct rte_eth_dev; @@ -136,7 +136,7 @@ struct rte_pktdev { * of pointers to *rte_mbuf* structures effectively supplied to the * *rx_pkts* array. */ -static inline uint16_t +static inline uint16_t __attribute__((always_inline)) rte_pkt_rx_burst(struct rte_pktdev *dev, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { @@ -168,7 +168,7 @@ rte_pkt_rx_burst(struct rte_pktdev *dev, struct rte_mbuf **rx_pkts, * the transmit ring. The return value can be less than the value of the * *tx_pkts* parameter when the transmit ring is full or has been filled up. */ -static inline uint16_t +static inline uint16_t __attribute__((always_inline)) rte_pkt_tx_burst(struct rte_pktdev *dev, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { -- 2.4.2