From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0056.outbound.protection.outlook.com [104.47.2.56]) by dpdk.org (Postfix) with ESMTP id D17411B54D for ; Tue, 26 Jun 2018 14:17:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/ZKEhOpfCwbwX/3zy7qgaYVfwC95cSSmwRvKqipbJMw=; b=tdYHzaz7m2rxU6tw8EZM5Bs9IiGZNPavpP38QfHko6GLh3y4Gwbw9qnpnPwEcOOram7Y6gOm5yh5lGx2ZJVq4hcXQpF9fx9wEDqN91yzVNQlrhVl9u8vFINsP0IPBkMZ9NAT8dOsU9wpTPZ9tISNMGEuklUIazovQQguvTHm/gY= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4361.eurprd05.prod.outlook.com (52.134.108.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.23; Tue, 26 Jun 2018 12:17:08 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::4c94:2db9:b8c5:cc6b]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::4c94:2db9:b8c5:cc6b%5]) with mapi id 15.20.0884.025; Tue, 26 Jun 2018 12:17:08 +0000 From: Shahaf Shuler To: Maxime Coquelin , "bernard.iremonger@intel.com" , "dev@dpdk.org" CC: "ailan@redhat.com" , "jan.scheurich@ericsson.com" , "vkaplans@redhat.com" , "bruce.richardson@intel.com" , Thomas Monjalon , "konstantin.ananyev@intel.com" , "ferruh.yigit@intel.com" , Jens Freimann Thread-Topic: [dpdk-dev] [PATCH v4 1/2] testpmd: add forwarding mode to simulate a noisy neighbour Thread-Index: AQHUCugcOyD/LQ820E2VwP/3frkueKRydZZw Date: Tue, 26 Jun 2018 12:17:07 +0000 Message-ID: References: <20180623080840.315-1-maxime.coquelin@redhat.com> <20180623080840.315-2-maxime.coquelin@redhat.com> In-Reply-To: <20180623080840.315-2-maxime.coquelin@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4361; 7:tCfn3QyotGNl5sn66jgaTmOZR3lwhuRi9ib/J7z9EFgTFEox1XBCRaVehSuxyFlPsauw0lAuF5h3MzPFVBsnjIl9aNtJYmblX5qaC68oWeFgZsNDlmq1YMl9AT3mUg0m6FvQxSk7h35ISLiVVLsigYf/PYOCxH7vNROPNx62BRFGW/Y0p+9wol8jLcDpGR8If2vWoXeJUN1WdUkZ0hyAMFqgAVZ7y9m9ll6K7yLDr8EBeH3C2/snsUyyciWdV3h+ x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 70fa62e4-4898-4eed-a735-08d5db5ebc9d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4361; x-ms-traffictypediagnostic: DB7PR05MB4361: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(131327999870524); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4361; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4361; x-forefront-prvs: 071518EF63 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(396003)(376002)(346002)(366004)(199004)(189003)(106356001)(2900100001)(33656002)(6436002)(105586002)(7696005)(5660300001)(76176011)(7416002)(6246003)(14454004)(2906002)(256004)(478600001)(316002)(54906003)(53946003)(110136005)(53936002)(9686003)(55016002)(81166006)(2201001)(476003)(66066001)(86362001)(229853002)(97736004)(4326008)(99286004)(186003)(5250100002)(25786009)(74316002)(6116002)(3846002)(2501003)(7736002)(486006)(26005)(8936002)(6506007)(68736007)(102836004)(446003)(305945005)(81156014)(11346002)(14444005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4361; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: xC2iLyauGI+bETFmJUXUBnrGjGGcS2b44rY/GwiIEbE1R/qbdUgJf6h3wEJuC2vkE1UUhaCWbHeiRPHt3HyZ91DXpD7R0/bxAhHvS8iFoxz5/nfY+RWYBxNWFmmpAm9nAmL2r+k5fDe5UDWD17FKyZpS1O3uu3wq9ko0oPC7ENcLoHHXe9Y/tRDRufgWzQK36n+VpR/ATKao+1km0N9CynxDWZTAILaE3b8ZA3Al/ZMFyDdHI7AZSm2Zs0OOZkEDL78i7QwXDpy8ObQFGX6KE60WZ4gIWnTDyJIcpGmen8SdFuFYEtU4AxnxVttRZSdZXs3RzyEhfpcOP0iNeED9yNofhuuE0+6OPJNp854i3dg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70fa62e4-4898-4eed-a735-08d5db5ebc9d X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jun 2018 12:17:07.8849 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4361 Subject: Re: [dpdk-dev] [PATCH v4 1/2] testpmd: add forwarding mode to simulate a noisy neighbour X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2018 12:17:10 -0000 HI Maxime, Jens Saturday, June 23, 2018 11:09 AM, Maxime Coquelin: > Subject: [dpdk-dev] [PATCH v4 1/2] testpmd: add forwarding mode to > simulate a noisy neighbour >=20 > From: Jens Freimann >=20 > This adds a new forwarding mode to testpmd to simulate more realistic > behavior of a guest machine engaged in receiving and sending packets > performing Virtual Network Function (VNF). I really like the idea of adding application w/ more realistic behavior to = the DPDK tree in order to use them in the non-regression cycle.=20 I am just wondering if putting it as another forward engine in testpmd is t= he right place for it. >>From one side it reuses testpmd command line options which is good. On the other hand it tends to have a lot of options specific only for the V= NF forward use case. And I am quite sure that w/ the time goes by the numbe= r of configuration options will increase.=20 I think this code needs to be as a dedicated example under examples/.=20 Moreover I would refine from directly associate it with VNF. VNF can be one= example but for sure there are more.=20 We can call the example noisy_neigbour or any other name you like. One more comment below.=20 >=20 > The goal is to enable a simple way of measuring performance impact on > cache and memory footprint utilization from various VNF co-located on the > same host machine. For this it does: >=20 > * Buffer packets in a FIFO: >=20 > Create a fifo to buffer received packets. Once it flows over put those pa= ckets > into the actual tx queue. The fifo is created per tx queue and its size c= an be > set with the --buffersize-before-sending commandline parameter. >=20 > A second commandline parameter is used to set a timeout in milliseconds > after which the fifo is flushed. >=20 > --noisy-buffersize-before-sending [packet numbers] Keep the mbuf in a > FIFO and forward the over flooding packets from the FIFO. This queue is p= er > TX-queue (after all other packet processing). >=20 > --noisy-flush-timeout [delay] > Flush the packet queue if no packets have been seen during [delay]. As lo= ng > as packets are seen, the timer is reset. >=20 > Add several options to simulate route lookups (memory reads) in tables th= at > can be quite large, as well as route hit statistics update. > These options simulates the while stack traversal and will trash the cach= e. > Memory access is random. >=20 > * simulate route lookups: >=20 > Allocate a buffer and perform reads and writes on it as specified by > commandline options: >=20 > --noisy-memory-footprint [size] > Size of the VNF internal memory (MB), in which the random read/write will > be done, allocated by rte_malloc (hugepages). >=20 > --noisy-nb-rnd-write [num] > Number of random writes in memory per packet should be performed, > simulating hit-flags update. 64 bits per write, all write in different ca= che lines. >=20 > --noisy-nb-rnd-read [num] > Number of random reads in memory per packet should be performed, > simulating FIB/table lookups. 64 bits per read, all write in different ca= che > lines. >=20 > --noisy-nb-rnd-read-write [num] > Number of random reads and writes in memory per packet should be > performed, simulating stats update. 64 bits per read-write, all reads and > writes in different cache lines. >=20 > Signed-off-by: Jens Freimann > Signed-off-by: Maxime Coquelin > --- > app/test-pmd/Makefile | 1 + > app/test-pmd/meson.build | 1 + > app/test-pmd/noisy_vnf.c | 204 > ++++++++++++++++++++++++++++++++++++++++++++++ > app/test-pmd/noisy_vnf.h | 41 ++++++++++ app/test-pmd/parameters.c > | 54 ++++++++++++ > app/test-pmd/testpmd.c | 52 ++++++++++++ > app/test-pmd/testpmd.h | 17 ++++ > 7 files changed, 370 insertions(+) > create mode 100644 app/test-pmd/noisy_vnf.c create mode 100644 > app/test-pmd/noisy_vnf.h >=20 > diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile index > a5a827bbd..2a1030120 100644 > --- a/app/test-pmd/Makefile > +++ b/app/test-pmd/Makefile > @@ -32,6 +32,7 @@ SRCS-y +=3D rxonly.c > SRCS-y +=3D txonly.c > SRCS-y +=3D csumonly.c > SRCS-y +=3D icmpecho.c > +SRCS-y +=3D noisy_vnf.c > SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) +=3D ieee1588fwd.c > SRCS-$(CONFIG_RTE_LIBRTE_BPF) +=3D bpf_cmd.c >=20 > diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index > 4c9fbbfda..b3abc6e24 100644 > --- a/app/test-pmd/meson.build > +++ b/app/test-pmd/meson.build > @@ -16,6 +16,7 @@ sources =3D files('cmdline.c', > 'iofwd.c', > 'macfwd.c', > 'macswap.c', > + 'noisy_vnf.c', > 'parameters.c', > 'rxonly.c', > 'testpmd.c', > diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c new file > mode 100644 index 000000000..ff205495f > --- /dev/null > +++ b/app/test-pmd/noisy_vnf.c > @@ -0,0 +1,204 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2018 Red Hat Corp. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "testpmd.h" > +#include "noisy_vnf.h" > + > +static inline void > +do_write(char *vnf_mem) > +{ > + uint64_t i =3D rte_rand(); > + uint64_t w =3D rte_rand(); > + > + vnf_mem[i % ((noisy_vnf_memory_footprint * 1024 * 1024) / > + RTE_CACHE_LINE_SIZE)] =3D w; > +} > + > + static inline void > +do_read(char *vnf_mem) > +{ > + uint64_t i =3D rte_rand(); > + uint64_t r; > + > + r =3D vnf_mem[i % ((noisy_vnf_memory_footprint * 1024 * 1024) / > + RTE_CACHE_LINE_SIZE)]; > + r++; > +} > + > + static inline void > +do_rw(char *vnf_mem) > +{ > + do_read(vnf_mem); > + do_write(vnf_mem); > +} > + > +/* > + * Simulate route lookups as defined by commandline parameters */ > + static void > +sim_memory_lookups(struct noisy_config *ncf, uint16_t nb_pkts) { > + uint16_t i, j; > + > + for (i =3D 0; i < nb_pkts; i++) { > + for (j =3D 0; j < noisy_nb_rnd_write; j++) > + do_write(ncf->vnf_mem); > + for (j =3D 0; j < noisy_nb_rnd_read; j++) > + do_read(ncf->vnf_mem); > + for (j =3D 0; j < noisy_nb_rnd_read_write; j++) > + do_rw(ncf->vnf_mem); > + } > +} > + > +/* > + * Forwarding of packets in I/O mode. > + * Forward packets "as-is". > + * This is the fastest possible forwarding operation, as it does not > +access > + * to packets data. > + */ > +static void > +pkt_burst_noisy_vnf(struct fwd_stream *fs) { > + struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; > + uint16_t nb_rx; > + uint16_t nb_tx =3D 0; > + uint32_t retry; > + const uint64_t freq_khz =3D rte_get_timer_hz() / 1000; > + struct noisy_config *ncf =3D &noisy_cfg[fs->tx_queue]; > + struct rte_mbuf *tmp_pkts[MAX_PKT_BURST]; > + uint16_t nb_enqd; > + uint16_t nb_deqd =3D 0; > + uint64_t delta_ms; > + uint64_t now; > + > + /* > + * Receive a burst of packets and forward them. > + */ > + nb_rx =3D rte_eth_rx_burst(fs->rx_port, fs->rx_queue, > + pkts_burst, nb_pkt_per_burst); > + if (unlikely(nb_rx =3D=3D 0)) > + return; > + fs->rx_packets +=3D nb_rx; > + > + if (noisy_bsize_before_send > 0) { > + if (rte_ring_free_count(ncf->f) >=3D nb_rx) { > + /* enqueue into fifo */ > + nb_enqd =3D fifo_put(ncf->f, pkts_burst, nb_rx); > + if (nb_enqd < nb_rx) > + nb_rx =3D nb_enqd; Am not sure I understand this part. The simulation of the memory lookups should happen for every packet **befor= e** deciding on the output queue. Isn't it more realistic to simulate the m= emory access after the rx_burst? > + } else { > + /* fifo is full, dequeue first */ > + nb_deqd =3D fifo_get(ncf->f, tmp_pkts, nb_rx); > + /* enqueue into fifo */ > + nb_enqd =3D fifo_put(ncf->f, pkts_burst, nb_deqd); > + sim_memory_lookups(ncf, nb_rx); > + if (nb_enqd < nb_rx) > + nb_rx =3D nb_enqd; > + if (nb_deqd > 0) > + nb_tx =3D rte_eth_tx_burst(fs->tx_port, > + fs->tx_queue, tmp_pkts, > + nb_deqd); > + } > + } else { > + sim_memory_lookups(ncf, nb_rx); > + nb_tx =3D rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > + pkts_burst, nb_rx); > + } > + > + /* > + * TX burst queue drain > + */ > + if (ncf->prev_time =3D=3D 0) > + now =3D ncf->prev_time =3D rte_get_timer_cycles(); > + else > + now =3D rte_get_timer_cycles(); > + delta_ms =3D (now - ncf->prev_time) / freq_khz; > + if (unlikely(delta_ms >=3D noisy_flush_timer) && noisy_flush_timer > 0 > && > + (nb_tx =3D=3D 0)) { > + while (fifo_count(ncf->f) > 0) { > + nb_deqd =3D fifo_get(ncf->f, tmp_pkts, nb_rx); > + nb_tx =3D rte_eth_tx_burst(fs->tx_port, fs- > >tx_queue, > + tmp_pkts, nb_deqd); > + if (rte_ring_empty(ncf->f)) > + break; > + } > + ncf->prev_time =3D now; > + } > + if (nb_tx < nb_rx && fs->retry_enabled) > + *pkts_burst =3D *tmp_pkts; > + > + /* > + * Retry if necessary > + */ > + if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) { > + retry =3D 0; > + while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { > + rte_delay_us(burst_tx_delay_time); > + sim_memory_lookups(ncf, nb_rx); > + nb_tx +=3D rte_eth_tx_burst(fs->tx_port, fs- > >tx_queue, > + &pkts_burst[nb_tx], nb_rx - nb_tx); > + } > + } > + fs->tx_packets +=3D nb_tx; > + if (unlikely(nb_tx < nb_rx)) { > + fs->fwd_dropped +=3D (nb_rx - nb_tx); > + do { > + rte_pktmbuf_free(pkts_burst[nb_tx]); > + } while (++nb_tx < nb_rx); > + } > +} > + > +struct fwd_engine noisy_vnf_engine =3D { > + .fwd_mode_name =3D "noisy", > + .port_fwd_begin =3D NULL, > + .port_fwd_end =3D NULL, > + .packet_fwd =3D pkt_burst_noisy_vnf, > +}; > + > +#define NOISY_STRSIZE 256 > +#define NOISY_RING "noisy_ring_%d:%d\n" > +struct rte_ring * > +noisy_init(uint32_t qi, uint32_t pi) > +{ > + struct noisy_config *n =3D &noisy_cfg[qi]; > + char name[NOISY_STRSIZE]; > + > + snprintf(name, NOISY_STRSIZE, NOISY_RING, pi, qi); > + n->f =3D rte_ring_create(name, noisy_bsize_before_send, > + rte_socket_id(), 0); > + n->vnf_mem =3D (char *) rte_zmalloc("vnf sim memory", > + noisy_vnf_memory_footprint * 1024 * 1024, > + RTE_CACHE_LINE_SIZE); > + if (n->vnf_mem =3D=3D NULL) > + printf("allocating vnf memory failed\n"); > + > + return n->f; > +} > diff --git a/app/test-pmd/noisy_vnf.h b/app/test-pmd/noisy_vnf.h new file > mode 100644 index 000000000..6c6df7a9e > --- /dev/null > +++ b/app/test-pmd/noisy_vnf.h > @@ -0,0 +1,41 @@ > +#ifndef __NOISY_VNF_H > +#define __NOISY_VNF_H > +#include > +#include > +#include > +#include "testpmd.h" > + > +/** > + * Add elements to fifo. Return number of written elements */ static > +inline unsigned int fifo_put(struct rte_ring *r, struct rte_mbuf > +**data, unsigned num) { > + > + return rte_ring_enqueue_burst(r, (void **)data, num, NULL); } > + > +/** > + * Get elements from fifo. Return number of read elements */ static > +inline unsigned int fifo_get(struct rte_ring *r, struct rte_mbuf > +**data, unsigned num) { > + return rte_ring_dequeue_burst(r, (void **) data, num, NULL); } > + > +static inline unsigned int > +fifo_count(struct rte_ring *r) > +{ > + return rte_ring_count(r); > +} > + > +static inline int > +fifo_full(struct rte_ring *r) > +{ > + return rte_ring_full(r); > +} > + > +struct rte_ring *noisy_init(uint32_t qi, uint32_t pi); > + > +#endif > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index > 75807623c..e6d8b3ef9 100644 > --- a/app/test-pmd/parameters.c > +++ b/app/test-pmd/parameters.c > @@ -625,6 +625,12 @@ launch_args_parse(int argc, char** argv) > { "vxlan-gpe-port", 1, 0, 0 }, > { "mlockall", 0, 0, 0 }, > { "no-mlockall", 0, 0, 0 }, > + { "noisy-buffersize-before-sending", 1, 0, 0 }, > + { "noisy-flush-timeout", 1, 0, 0 }, > + { "noisy-memory-footprint", 1, 0, 0 }, > + { "noisy-nb-rnd-write", 1, 0, 0 }, > + { "noisy-nb-rnd-read", 1, 0, 0 }, > + { "noisy-nb-rnd-read-write", 1, 0, 0 }, > { 0, 0, 0, 0 }, > }; >=20 > @@ -1145,6 +1151,54 @@ launch_args_parse(int argc, char** argv) > do_mlockall =3D 1; > if (!strcmp(lgopts[opt_idx].name, "no-mlockall")) > do_mlockall =3D 0; > + if (!strcmp(lgopts[opt_idx].name, "noisy-buffersize- > before-sending")) { > + n =3D atoi(optarg); > + if (n > 0) > + noisy_bsize_before_send =3D > (uint16_t) n; > + else > + rte_exit(EXIT_FAILURE, > + "noisy-buffersize-before- > sending must be > 0\n"); > + } > + if (!strcmp(lgopts[opt_idx].name, "noisy-flush- > timeout")) { > + n =3D atoi(optarg); > + if (n >=3D 0) > + noisy_flush_timer =3D (uint16_t) n; > + else > + rte_exit(EXIT_FAILURE, > + "noisy-flush-timeout must > be > 0\n"); > + } > + if (!strcmp(lgopts[opt_idx].name, "noisy-memory- > footprint")) { > + n =3D atoi(optarg); > + if (n > 0) > + noisy_vnf_memory_footprint =3D > (uint16_t) n; > + else > + rte_exit(EXIT_FAILURE, > + "noisy-memory-footprint > must be > 0\n"); > + } > + if (!strcmp(lgopts[opt_idx].name, "noisy-nb-rnd- > write")) { > + n =3D atoi(optarg); > + if (n > 0) > + noisy_nb_rnd_write =3D (uint16_t) n; > + else > + rte_exit(EXIT_FAILURE, > + "noisy-nb-rnd-write must be > > 0\n"); > + } > + if (!strcmp(lgopts[opt_idx].name, "noisy-nb-rnd- > read")) { > + n =3D atoi(optarg); > + if (n > 0) > + noisy_nb_rnd_read =3D (uint16_t) n; > + else > + rte_exit(EXIT_FAILURE, > + "noisy-nb-rnd-read must be > > 0\n"); > + } > + if (!strcmp(lgopts[opt_idx].name, "noisy-nb-rnd- > read-write")) { > + n =3D atoi(optarg); > + if (n > 0) > + noisy_nb_rnd_read_write =3D > (uint16_t) n; > + else > + rte_exit(EXIT_FAILURE, > + "noisy-nb-rnd-read-write > must be > 0\n"); > + } > break; > case 'h': > usage(argv[0]); > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > 24c199844..7f3dc6f1c 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -61,6 +61,7 @@ > #include > #endif >=20 > +#include "noisy_vnf.h" > #include "testpmd.h" >=20 > uint16_t verbose_level =3D 0; /**< Silent by default. */ @@ -155,6 +156,= 7 @@ > struct fwd_engine * fwd_engines[] =3D { > &tx_only_engine, > &csum_fwd_engine, > &icmp_echo_engine, > + &noisy_vnf_engine, > #if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED > &softnic_tm_engine, > &softnic_tm_bypass_engine, > @@ -251,6 +253,40 @@ int16_t tx_free_thresh =3D RTE_PMD_PARAM_UNSET; > */ > int16_t tx_rs_thresh =3D RTE_PMD_PARAM_UNSET; >=20 > +/* > + * Configurable value of buffered packed before sending. > + */ > +uint16_t noisy_bsize_before_send; > + > +/* > + * Configurable value of packet buffer timeout. > + */ > +uint16_t noisy_flush_timer; > + > +/* > + * Configurable value for size of VNF internal memory area > + * used for simulating noisy neighbour behaviour */ uint64_t > +noisy_vnf_memory_footprint; > + > +/* > + * Configurable value of number of random writes done in > + * VNF simulation memory area. > + */ > +uint64_t noisy_nb_rnd_write; > + > +/* > + * Configurable value of number of random reads done in > + * VNF simulation memory area. > + */ > +uint64_t noisy_nb_rnd_read; > + > +/* > + * Configurable value of number of random reads/wirtes done in > + * VNF simulation memory area. > + */ > +uint64_t noisy_nb_rnd_read_write; > + > /* > * Receive Side Scaling (RSS) configuration. > */ > @@ -1641,12 +1677,26 @@ start_port(portid_t pid) > return -1; > } > } > + noisy_cfg =3D (struct noisy_config *) rte_zmalloc( > + "testpmd noisy fifo and timers", > + nb_txq * sizeof(struct noisy_config), > + RTE_CACHE_LINE_SIZE); > + if (noisy_cfg =3D=3D NULL) { > + rte_exit(EXIT_FAILURE, > + "rte_zmalloc(%d) struct noisy_config) > failed\n", > + (int)(nb_txq * > + sizeof(struct noisy_config))); > + } > if (port->need_reconfig_queues > 0) { > port->need_reconfig_queues =3D 0; > /* setup tx queues */ > for (qi =3D 0; qi < nb_txq; qi++) { > port->tx_conf[qi].txq_flags =3D > ETH_TXQ_FLAGS_IGNORE; > + if (!noisy_init(qi, pi) && > + noisy_bsize_before_send > > 0) > + rte_exit(EXIT_FAILURE, "%s\n", > + rte_strerror(rte_errno)); > if ((numa_support) && > (txring_numa[pi] !=3D > NUMA_NO_CONFIG)) > diag =3D rte_eth_tx_queue_setup(pi, > qi, @@ -1817,6 +1867,8 @@ stop_port(portid_t pid) > RTE_PORT_HANDLING, RTE_PORT_STOPPED) =3D=3D 0) > printf("Port %d can not be set into stopped\n", pi); > need_check_link_status =3D 1; > + > + rte_free(noisy_cfg); > } > if (need_check_link_status && !no_link_check) > check_all_ports_link_status(RTE_PORT_ALL); > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index > f51cd9dd9..75fb18a25 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include "noisy_vnf.h" >=20 > #define RTE_PORT_ALL (~(portid_t)0x0) >=20 > @@ -122,6 +123,14 @@ struct fwd_stream { #endif }; >=20 > +struct noisy_config { > + struct rte_ring *f; > + uint64_t prev_time; > + char *vnf_mem; > +}; > +struct noisy_config *noisy_cfg; > + > + > /** Descriptor for a single flow. */ > struct port_flow { > size_t size; /**< Allocated space including data[]. */ @@ -266,6 > +275,7 @@ extern struct fwd_engine rx_only_engine; extern struct > fwd_engine tx_only_engine; extern struct fwd_engine csum_fwd_engine; > extern struct fwd_engine icmp_echo_engine; > +extern struct fwd_engine noisy_vnf_engine; > #ifdef TM_MODE > extern struct fwd_engine softnic_tm_engine; extern struct fwd_engine > softnic_tm_bypass_engine; @@ -399,6 +409,13 @@ extern int8_t > rx_drop_en; extern int16_t tx_free_thresh; extern int16_t tx_rs_thresh; >=20 > +extern uint16_t noisy_bsize_before_send; extern uint16_t > +noisy_flush_timer; extern uint64_t noisy_vnf_memory_footprint; extern > +uint64_t noisy_nb_rnd_write; extern uint64_t noisy_nb_rnd_read; extern > +uint64_t noisy_nb_rnd_read_write; > + > extern uint8_t dcb_config; > extern uint8_t dcb_test; >=20 > -- > 2.14.4