From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sanford, Robert" Subject: Re: [PATCH 1/4] app/test: enhance test_port_ring_writer Date: Fri, 1 Apr 2016 19:42:34 +0000 Message-ID: References: <1459198297-49854-1-git-send-email-rsanford@akamai.com> <1459198297-49854-2-git-send-email-rsanford@akamai.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: "dev@dpdk.org" , "cristian.dumitrescu@intel.com" Return-path: Received: from prod-mail-xrelay05.akamai.com (prod-mail-xrelay05.akamai.com [23.79.238.179]) by dpdk.org (Postfix) with ESMTP id 2AA78CE7 for ; Fri, 1 Apr 2016 21:42:36 +0200 (CEST) In-Reply-To: <1459198297-49854-2-git-send-email-rsanford@akamai.com> Content-Language: en-US Content-ID: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" We don't need to change this line, because we never access more than RTE_PORT_IN_BURST_SIZE_MAX (64) elements in this array: - struct rte_mbuf *mbuf[RTE_PORT_IN_BURST_SIZE_MAX]; + struct rte_mbuf *mbuf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; -- Robert >Add code to send two 60-packet bursts to a ring port_out. >This tests a ring writer buffer overflow problem and fix >(in patch 2/4). > >Signed-off-by: Robert Sanford >--- > app/test/test_table_ports.c | 27 +++++++++++++++++++++++++-- > 1 files changed, 25 insertions(+), 2 deletions(-) > >diff --git a/app/test/test_table_ports.c b/app/test/test_table_ports.c >index 2532367..0c0ec0a 100644 >--- a/app/test/test_table_ports.c >+++ b/app/test/test_table_ports.c >@@ -149,8 +149,8 @@ test_port_ring_writer(void) >=20 > /* -- Traffic TX -- */ > int expected_pkts, received_pkts; >- struct rte_mbuf *mbuf[RTE_PORT_IN_BURST_SIZE_MAX]; >- struct rte_mbuf *res_mbuf[RTE_PORT_IN_BURST_SIZE_MAX]; >+ struct rte_mbuf *mbuf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; >+ struct rte_mbuf *res_mbuf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; >=20 > port_ring_writer_params.ring =3D RING_TX; > port_ring_writer_params.tx_burst_sz =3D RTE_PORT_IN_BURST_SIZE_MAX; >@@ -216,5 +216,28 @@ test_port_ring_writer(void) > for (i =3D 0; i < RTE_PORT_IN_BURST_SIZE_MAX; i++) > rte_pktmbuf_free(res_mbuf[i]); >=20 >+ /* TX Bulk - send two 60-packet bursts */ >+ uint64_t pkt_mask =3D 0xfffffffffffffff0ULL; >+ >+ for (i =3D 0; i < 4; i++) >+ mbuf[i] =3D NULL; >+ for (i =3D 4; i < 64; i++) >+ mbuf[i] =3D rte_pktmbuf_alloc(pool); >+ rte_port_ring_writer_ops.f_tx_bulk(port, mbuf, pkt_mask); >+ for (i =3D 4; i < 64; i++) >+ mbuf[i] =3D rte_pktmbuf_alloc(pool); >+ rte_port_ring_writer_ops.f_tx_bulk(port, mbuf, pkt_mask); >+ rte_port_ring_writer_ops.f_flush(port); >+ >+ expected_pkts =3D 2 * 60; >+ received_pkts =3D rte_ring_sc_dequeue_burst(port_ring_writer_params.ring= , >+ (void **)res_mbuf, 2 * RTE_PORT_IN_BURST_SIZE_MAX); >+ >+ if (received_pkts !=3D expected_pkts) >+ return -10; >+ >+ for (i =3D 0; i < received_pkts; i++) >+ rte_pktmbuf_free(res_mbuf[i]); >+ > return 0; > } >--=20 >1.7.1