All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: dev@dpdk.org
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [RFC 12/29] testpmd: add s-txonly
Date: Wed, 21 Jun 2017 10:57:48 +0800	[thread overview]
Message-ID: <1498013885-102779-13-git-send-email-tiwei.bie@intel.com> (raw)
In-Reply-To: <1498013885-102779-1-git-send-email-tiwei.bie@intel.com>

From: Yuanhan Liu <yuanhan.liu@linux.intel.com>

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 app/test-pmd/Makefile   |   1 +
 app/test-pmd/s-txonly.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.c  |   1 +
 app/test-pmd/testpmd.h  |   1 +
 4 files changed, 137 insertions(+)
 create mode 100644 app/test-pmd/s-txonly.c

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 35ecee9..d87cae6 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -55,6 +55,7 @@ SRCS-y += macswap.c
 SRCS-y += flowgen.c
 SRCS-y += rxonly.c
 SRCS-y += txonly.c
+SRCS-y += s-txonly.c
 SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
diff --git a/app/test-pmd/s-txonly.c b/app/test-pmd/s-txonly.c
new file mode 100644
index 0000000..6275136
--- /dev/null
+++ b/app/test-pmd/s-txonly.c
@@ -0,0 +1,134 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 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 <stdarg.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <assert.h>
+
+#include <rte_common.h>
+#include <rte_byteorder.h>
+#include <rte_log.h>
+#include <rte_debug.h>
+#include <rte_cycles.h>
+#include <rte_memory.h>
+#include <rte_memcpy.h>
+#include <rte_memzone.h>
+#include <rte_launch.h>
+#include <rte_eal.h>
+#include <rte_per_lcore.h>
+#include <rte_lcore.h>
+#include <rte_atomic.h>
+#include <rte_branch_prediction.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_mbuf.h>
+#include <rte_memcpy.h>
+#include <rte_interrupts.h>
+#include <rte_pci.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_ip.h>
+#include <rte_tcp.h>
+#include <rte_udp.h>
+#include <rte_string_fns.h>
+#include <rte_flow.h>
+
+#include "testpmd.h"
+
+#undef MAX_PKT_BURST
+#define MAX_PKT_BURST	32
+
+/*
+ * Transmit a burst of multi-segments packets.
+ */
+static void
+pkt_burst_transmit(struct fwd_stream *fs)
+{
+	static struct rte_mbuf *pkts[MAX_PKT_BURST];
+	uint16_t nb_tx;
+	int  i;
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+	uint64_t start_tsc;
+	uint64_t end_tsc;
+	uint64_t core_cycles;
+#endif
+
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+	start_tsc = rte_rdtsc();
+#endif
+
+	for (i = 0; i < MAX_PKT_BURST; i++) {
+		if (unlikely(!pkts[i])) {
+			pkts[i] = rte_pktmbuf_alloc(current_fwd_lcore()->mbp);
+			assert(pkts[i]);
+
+			pkts[i]->data_len = tx_pkt_seg_lengths[0];
+			pkts[i]->pkt_len  = tx_pkt_seg_lengths[0];
+			pkts[i]->nb_segs  = 1;
+		}
+
+		rte_pktmbuf_refcnt_update(pkts[i], 1);
+	}
+
+	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts, MAX_PKT_BURST);
+
+	//uint32_t retry;
+	//if (unlikely(nb_tx < MAX_PKT_BURST) && fs->retry_enabled) {
+	//	retry = 0;
+	//	while (nb_tx < MAX_PKT_BURST && retry++ < burst_tx_retry_num) {
+	//		rte_delay_us(burst_tx_delay_time);
+	//		nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
+	//				&pkts[nb_tx], MAX_PKT_BURST - nb_tx);
+	//	}
+	//}
+
+	fs->tx_packets += nb_tx;
+
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+	end_tsc = rte_rdtsc();
+	core_cycles = (end_tsc - start_tsc);
+	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
+#endif
+}
+
+struct fwd_engine s_tx_only_engine = {
+	.fwd_mode_name  = "s-txonly",
+	.port_fwd_begin = NULL,
+	.port_fwd_end   = NULL,
+	.packet_fwd     = pkt_burst_transmit,
+};
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d1041af..f224357 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -160,6 +160,7 @@ struct fwd_engine * fwd_engines[] = {
 	&flow_gen_engine,
 	&rx_only_engine,
 	&tx_only_engine,
+	&s_tx_only_engine,
 	&csum_fwd_engine,
 	&icmp_echo_engine,
 #ifdef RTE_LIBRTE_IEEE1588
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e6c43ba..b53ce0a 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -248,6 +248,7 @@ extern struct fwd_engine mac_swap_engine;
 extern struct fwd_engine flow_gen_engine;
 extern struct fwd_engine rx_only_engine;
 extern struct fwd_engine tx_only_engine;
+extern struct fwd_engine s_tx_only_engine;
 extern struct fwd_engine csum_fwd_engine;
 extern struct fwd_engine icmp_echo_engine;
 #ifdef RTE_LIBRTE_IEEE1588
-- 
2.7.4

  parent reply	other threads:[~2017-06-21  2:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  2:57 [RFC 00/29] latest virtio1.1 prototype Tiwei Bie
2017-06-21  2:57 ` [RFC 01/29] net/virtio: vring init for 1.1 Tiwei Bie
2017-06-21  2:57 ` [RFC 02/29] net/virtio: implement 1.1 guest Tx Tiwei Bie
2017-06-21  2:57 ` [RFC 03/29] net/virtio-user: add option to enable 1.1 Tiwei Bie
2017-06-21  2:57 ` [RFC 04/29] vhost: enable 1.1 for testing Tiwei Bie
2017-06-21  2:57 ` [RFC 05/29] vhost: set desc addr for 1.1 Tiwei Bie
2017-06-21  2:57 ` [RFC 06/29] vhost: implement virtio 1.1 dequeue path Tiwei Bie
2017-06-21  2:57 ` [RFC 07/29] vhost: mark desc being used Tiwei Bie
2017-06-21  2:57 ` [RFC 08/29] xxx: batch the desc_hw update? Tiwei Bie
2017-06-21  2:57 ` [RFC 09/29] xxx: virtio: remove overheads Tiwei Bie
2017-06-21  2:57 ` [RFC 10/29] vhost: prefetch desc Tiwei Bie
2017-06-21  2:57 ` [RFC 11/29] add virtio 1.1 test guide Tiwei Bie
2017-06-21  2:57 ` Tiwei Bie [this message]
2017-06-21  2:57 ` [RFC 13/29] net/virtio: implement the Rx code path Tiwei Bie
2017-06-21  2:57 ` [RFC 14/29] vhost: a rough implementation on enqueue " Tiwei Bie
2017-06-21  2:57 ` [RFC 15/29] vhost: descriptor length should include vhost header Tiwei Bie
2017-06-21  2:57 ` [RFC 16/29] net/virtio: avoid touching packet data Tiwei Bie
2017-06-21  2:57 ` [RFC 17/29] net/virtio: fix virtio1.1 feature negotiation Tiwei Bie
2017-06-21  2:57 ` [RFC 18/29] net/virtio: the Rx support for virtio1.1 has been added now Tiwei Bie
2017-06-21  2:57 ` [RFC 19/29] vhost: VIRTIO_NET_F_MRG_RXBUF is not supported for now Tiwei Bie
2017-06-21  2:57 ` [RFC 20/29] vhost: fix vring addr setup Tiwei Bie
2017-06-21  2:57 ` [RFC 21/29] net/virtio: free mbuf when need to use Tiwei Bie
2017-06-21  2:57 ` [RFC 22/29] vhost: don't copy descs during Rx Tiwei Bie
2017-06-21  2:57 ` [RFC 23/29] vhost: fix mbuf leak Tiwei Bie
2017-06-21  2:58 ` [RFC 24/29] net/virtio: cleanup txd when free count below threshold Tiwei Bie
2017-06-21  2:58 ` [RFC 25/29] net/virtio: refill descs for vhost in batch Tiwei Bie
2017-06-21  2:58 ` [RFC 26/29] vhost: remove dead code Tiwei Bie
2017-06-21  2:58 ` [RFC 27/29] vhost: various optimizations for Tx Tiwei Bie
2017-06-21  2:58 ` [RFC 28/29] vhost: make the code more readable Tiwei Bie
2017-06-21  2:58 ` [RFC 29/29] vhost: update and return descs in batch Tiwei Bie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498013885-102779-13-git-send-email-tiwei.bie@intel.com \
    --to=tiwei.bie@intel.com \
    --cc=dev@dpdk.org \
    --cc=yuanhan.liu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.