Skip to contentSkip to conversation

testpmd: simulating noisy host environment

RFC New Jens Freimann 1 participant 2 messages Mar 23, 2018

lore
Share & tools
lore
#0 lore raw

cover testpmd: simulating noisy host environment

This is an addition to testpmd that will allow to simulate a noisy neighbour VNF. It was previously discussed here:
http://dpdk.org/ml/archives/dev/2017-October/080763.html

It was not thoroughly tested and doesn't implement all features yet. I'm sending this only for early feedback about how to approach this.

Currently I've implmented the logic to buffer incoming packets and flush the queue after a timeout has expired. The logic resides in the iofwd code as an example. I think it needs to be in the forwarding mode logic as packets are send and received from there. To avoid code duplication some of it could be extracted into new helpers and changes to the individual forward mode code kept minimal.

What is missing is actual functionality to simulate route lookups (by doing random r/w memory accesses) and to simulate packet processing. I'm working on this, but would like to get feedback on what I have so far.

regards, Jens

Jens Freimann (1):
testpmd: add parameters buffersize-before-send and flush-timeout

 app/test-pmd/Makefile     |  4 ++++
 app/test-pmd/fifo.c       | 16 +++++++++++++
 app/test-pmd/iofwd.c      | 59 ++++++++++++++++++++++++++++++++++++++++++++++-
 app/test-pmd/parameters.c | 21 ++++++++++++++++-
 app/test-pmd/testpmd.c    | 48 ++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    | 15 ++++++++++++
 config/common_base        |  1 +
 7 files changed, 162 insertions(+), 2 deletions(-)
 create mode 100644 app/test-pmd/fifo.c
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/1 testpmd: add parameters buffersize-before-send and flush-timeout

Create a fifo to buffer received packets. Once it flows over put those packets into the actual tx queue. The fifo is created per tx queue and its size can be set with the --buffersize-before-sending commandline parameter.

A second commandline parameter is used to set a timeout in milliseconds after which the fifo is flushed.

---
 app/test-pmd/Makefile     |  4 ++++
 app/test-pmd/fifo.c       | 16 +++++++++++++
 app/test-pmd/iofwd.c      | 59 ++++++++++++++++++++++++++++++++++++++++++++++-
 app/test-pmd/parameters.c | 21 ++++++++++++++++-
 app/test-pmd/testpmd.c    | 48 ++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    | 15 ++++++++++++
 config/common_base        |  1 +
 7 files changed, 162 insertions(+), 2 deletions(-)
 create mode 100644 app/test-pmd/fifo.c
app/test-pmd/Makefile +4 -0
index 60ae9b9c1..9254a9440 100644
@@ -34,6 +34,10 @@ SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+#ifeq ($(CONFIG_RTE_TEST_PMD_NOISY),y)
+#SRCS-y += fifo.c
+#endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC)$(CONFIG_RTE_LIBRTE_SCHED),yy)
 SRCS-y += tm.c
 endif
app/test-pmd/fifo.c new file +16 -0
new file mode 100644
index 000000000..2271215e8
@@ -0,0 +1,16 @@
+#ifdef RTE_TEST_PMD_NOISY
+//#include <rte_ring.h>
+#include "fifo.h"
+//#include "testpmd.h"
+
+
+struct rte_ring * fifo_init(uint32_t qi)
+{
+	struct noisy_config *n = &noisy_cfg[qi];
+
+	n->f = rte_ring_create("noisy ring", 1024, rte_socket_id(),
+						RING_F_SP_ENQ | RING_F_SC_DEQ);
+	return n->f;
+}
+
+#endif
app/test-pmd/iofwd.c +58 -1

85 lines not on this page · raw message

app/test-pmd/parameters.c +20 -1
index 97d22b860..8e64055a0 100644
@@ -621,6 +621,8 @@ launch_args_parse(int argc, char** argv)
 		{ "print-event",		1, 0, 0 },
 		{ "mask-event",			1, 0, 0 },
 		{ "tx-offloads",		1, 0, 0 },
+		{ "buffersize-before-sending",  1, 0, 0 },
+		{ "flush-timer",                1, 0, 0 },
 		{ 0, 0, 0, 0 },
 	};
 
@@ -1102,7 +1104,24 @@ launch_args_parse(int argc, char** argv)
 					rte_exit(EXIT_FAILURE,
 						 "invalid mask-event argument\n");
 				}
-
+#ifdef RTE_TEST_PMD_NOISY
+			if (!strcmp(lgopts[opt_idx].name, "buffersize-before-sending")) {
+				n = atoi(optarg);
+				if (n > 0)
+					bsize_before_send = (uint16_t) n;
+				else
+					rte_exit(EXIT_FAILURE,
+						 "buffersize-before-sending must be > 0\n");
+			}
+			if (!strcmp(lgopts[opt_idx].name, "flush-timer")) {
+				n = atoi(optarg);
+				if (n >= 0)
+					flush_timer = (uint16_t) n;
+				else
+					rte_exit(EXIT_FAILURE,
+						 "flush-timer must be > 0\n");
+			}
+#endif
 			break;
 		case 'h':
 			usage(argv[0]);
app/test-pmd/testpmd.c +48 -0

84 lines not on this page · raw message

app/test-pmd/testpmd.h +15 -0
index 153abea05..a6c1a17bb 100644
@@ -9,6 +9,9 @@
 #include <rte_bus_pci.h>
 #include <rte_gro.h>
 #include <rte_gso.h>
+#ifdef RTE_TEST_PMD_NOISY
+#include "fifo.h"
+#endif
 
 #define RTE_PORT_ALL            (~(portid_t)0x0)
 
@@ -109,6 +112,15 @@ struct fwd_stream {
 #endif
 };
 
+#ifdef RTE_TEST_PMD_NOISY
+struct noisy_config {
+	struct rte_ring *f;
+	uint64_t prev_time;
+};
+struct noisy_config *noisy_cfg;
+#endif
+
+
 /** Descriptor for a single flow. */
 struct port_flow {
 	size_t size; /**< Allocated space including data[]. */
@@ -382,6 +394,9 @@ extern int8_t rx_drop_en;
 extern int16_t tx_free_thresh;
 extern int16_t tx_rs_thresh;
 
+extern uint16_t bsize_before_send;
+extern uint16_t flush_timer;
+
 extern uint8_t dcb_config;
 extern uint8_t dcb_test;
 
config/common_base +1 -0
index ad03cf433..194e5901f 100644
@@ -808,6 +808,7 @@ CONFIG_RTE_PROC_INFO=n
 CONFIG_RTE_TEST_PMD=y
 CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
 CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+CONFIG_RTE_TEST_PMD_NOISY=y
 
 #
 # Compile the bbdev test application
Signature · 1 line
2.14.3