From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from prod-mail-xrelay05.akamai.com (localhost.localdomain [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id C21463F4048; Fri, 1 Apr 2016 19:42:35 +0000 (GMT) Received: from prod-mail-relay11.akamai.com (prod-mail-relay11.akamai.com [172.27.118.250]) by prod-mail-xrelay05.akamai.com (Postfix) with ESMTP id A02373F4003; Fri, 1 Apr 2016 19:42:35 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; s=a1; t=1459539755; bh=RkytaABr5fKea+pm3TU0jqrpYq4HTWgb4AN0zvylGiQ=; l=2193; h=From:To:Date:References:In-Reply-To:From; b=qmcF9UzSlQ97mIQ6anCiYQ1LEh9DruW+oLD8LRWBGER/9uzLbiGkt11qQ0IqBxjZH jRXJj3/RkMZg60HC8XhfWcnBRDAqYPkH02AFS7SabJLdpWJp5oTZKDcV7T9IVazemo j8HbzyQSwPBJRUqvu8RLb1vlYyjGYeKLZSUqYhyg= Received: from email.msg.corp.akamai.com (um-cas.msg.corp.akamai.com [172.27.25.30]) by prod-mail-relay11.akamai.com (Postfix) with ESMTP id 8769F1FC94; Fri, 1 Apr 2016 19:42:35 +0000 (GMT) Received: from USTX2EX-DAG1LAG.msg.corp.akamai.com (172.27.27.106) by ustx2ex-dag1mb3.msg.corp.akamai.com (172.27.27.103) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Fri, 1 Apr 2016 14:42:35 -0500 Received: from ustx2ex-dag1mb6.msg.corp.akamai.com (172.27.27.107) by ustx2ex-dag1lag.msg.corp.akamai.com (172.27.27.106) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Fri, 1 Apr 2016 14:42:35 -0500 Received: from ustx2ex-dag1mb6.msg.corp.akamai.com ([172.27.27.107]) by ustx2ex-dag1mb6.msg.corp.akamai.com ([172.27.27.107]) with mapi id 15.00.1130.005; Fri, 1 Apr 2016 12:42:34 -0700 From: "Sanford, Robert" To: "dev@dpdk.org" , "cristian.dumitrescu@intel.com" Thread-Topic: [dpdk-dev] [PATCH 1/4] app/test: enhance test_port_ring_writer Thread-Index: AQHRiTO+rTdZFKxcvk+/rGruMtpd8Z91vSeA 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> In-Reply-To: <1459198297-49854-2-git-send-email-rsanford@akamai.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.3.140616 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [172.19.132.73] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/4] app/test: enhance test_port_ring_writer 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: Fri, 01 Apr 2016 19:42:36 -0000 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