From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6A18DA05D3 for ; Tue, 26 Mar 2019 14:03:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5E9025592; Tue, 26 Mar 2019 14:03:41 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 007D55589 for ; Tue, 26 Mar 2019 14:03:39 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2QCkQmw010698; Tue, 26 Mar 2019 06:03:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=k8pLp/h18fVWosb+pJTwOxKZ6RCrVNaprRIdicJki3A=; b=Z3bfx2kBsnsYG0ilZ6Goj0z1E1vYmCZMVt95rArkYfyLNS3oDof/0ErSkGfoRY2ABshR oNsbJ5oM3LQ214HuMnbMp9N4kD6qGXWwBwFxUS/9TGtjqyTt+MIuNiFzUukKf2oz9f2y 5uoPOezMGPMuLCr6da4hqGThegm6jwG6hgq8sucfLb+IXXAMHiWfqOY+gVj3+sA5UJkF 0j8dujBeO77BcegAXaV28iK3oMPN8KSJcYEOrCxGAMqiVG3B6pilK5L/iIzQhUeaebmL XU49e+IhriSiAhDREKvuq3opMzYFq6nf1FPw13F4R9uzCoVdpCIDYgtKb8RJSuKsb1DI oA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2rfjtbr9v7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2019 06:03:39 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 26 Mar 2019 06:03:27 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.53) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 26 Mar 2019 06:03:27 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k8pLp/h18fVWosb+pJTwOxKZ6RCrVNaprRIdicJki3A=; b=AhOngQLWPvgASJIGT5Mki/NsqiA6OTzYkIQPIaw0zjfpT6xEbAShQMFIrOO9VsOR2nNZBUlmQt+sEsBdgT91xX8XSuiAtkn6oA8kmfxbydLIlsQpZQCQdDNn0SW3VqVKXiUtrwuWTCh4pljh0wAxvw4+ZtFLxnKdYBFMthLIw54= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1893.namprd18.prod.outlook.com (10.171.255.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 26 Mar 2019 13:03:24 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::286d:5e93:974e:8bfa]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::286d:5e93:974e:8bfa%2]) with mapi id 15.20.1750.014; Tue, 26 Mar 2019 13:03:24 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "thomas@monjalon.net" , "arybchenko@solarflare.com" , "ferruh.yigit@intel.com" , "bernard.iremonger@intel.com" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula , Yingya Han Thread-Topic: [dpdk-dev] [PATCH v4 2/2] app/testpmd: add mempool bulk get for txonly mode Thread-Index: AQHU49RLip1SurcnsUueG/MwQMjtWw== Date: Tue, 26 Mar 2019 13:03:24 +0000 Message-ID: <20190326130247.14360-2-pbhagavatula@marvell.com> References: <20190228194128.14236-1-pbhagavatula@marvell.com> <20190326130247.14360-1-pbhagavatula@marvell.com> In-Reply-To: <20190326130247.14360-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR04CA0193.apcprd04.prod.outlook.com (2603:1096:4:14::31) To CY4PR1801MB1863.namprd18.prod.outlook.com (2603:10b6:910:7a::14) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [183.82.23.126] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e9959330-5802-4140-33f9-08d6b1eb6de0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:CY4PR1801MB1893; x-ms-traffictypediagnostic: CY4PR1801MB1893: x-microsoft-antispam-prvs: x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(39860400002)(366004)(199004)(189003)(102836004)(52116002)(4326008)(68736007)(1076003)(186003)(25786009)(6506007)(386003)(97736004)(14454004)(26005)(11346002)(446003)(76176011)(5660300002)(478600001)(8936002)(78486014)(81166006)(86362001)(50226002)(81156014)(8676002)(256004)(36756003)(2201001)(305945005)(6116002)(71190400001)(7736002)(71200400001)(106356001)(2906002)(105586002)(6486002)(3846002)(6436002)(2501003)(486006)(2616005)(476003)(66066001)(316002)(54906003)(110136005)(53936002)(99286004)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1893; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: +ZB6eu6nEYngZXZOnPZ+czFfc6+xO01LdDR1OXfXkJoeqnWDLKoPFXjHLKH+RLRh7tJMv5HhY/1FhBzQ6SEj9HqqAMLp3DfPSwRbDHdPWxHonCDQGWgJckB4RxQykTH4Sbgr00p+054StBoT272rO3YWctyhgyo1afaZj+DEX87LSfe/89mSP9lO1i99XvNObXNVbwAkXZtUw3HDcZ1Y6ssXg+UDflF30JpgfXkfu8rOfmRrFgTN2su8j43/xSLGjYtGUfwwIdrZD3jwx4WUlhfoc5Ovq3Vqn50jT970OP/HxyNogyNQziVqS2nwqj+X92O3vlBKUSiU1Ey4zQMMRnTBTabIiQ8BbQ6EMriJJjwNpFkXHt+0G5q/We79rWBCFQ9vw4JK6ZWUEIYsnu/zcY74xw/mCOjxuD/gc1m49QM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e9959330-5802-4140-33f9-08d6b1eb6de0 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 13:03:24.5379 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1893 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-26_09:, , signatures=0 Subject: [dpdk-dev] [PATCH v4 2/2] app/testpmd: add mempool bulk get for txonly mode 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190326130324.lADpZXDafbQ1GRbs8AbaZ0CDmBNcgvo3NT2sOPxIDPw@z> From: Pavan Nikhilesh Use mempool bulk get ops to alloc burst of packets and process them. If bulk get fails fallback to rte_mbuf_raw_alloc. Tested-by: Yingya Han Suggested-by: Andrew Rybchenko Signed-off-by: Pavan Nikhilesh --- app/test-pmd/txonly.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 8d49e41b1..0330f4c5a 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -250,18 +250,33 @@ pkt_burst_transmit(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); eth_hdr.ether_type =3D rte_cpu_to_be_16(ETHER_TYPE_IPv4); =20 - for (nb_pkt =3D 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { - pkt =3D rte_mbuf_raw_alloc(mbp); - if (pkt =3D=3D NULL) - break; - if (unlikely(!pkt_burst_prepare(pkt, mbp, - ð_hdr, vlan_tci, - vlan_tci_outer, - ol_flags))) { - rte_mempool_put(mbp, pkt); - break; + if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, + nb_pkt_per_burst) =3D=3D 0) { + for (nb_pkt =3D 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { + if (unlikely(!pkt_burst_prepare(pkts_burst[nb_pkt], mbp, + ð_hdr, vlan_tci, + vlan_tci_outer, + ol_flags))) { + rte_mempool_put_bulk(mbp, + (void **)&pkts_burst[nb_pkt], + nb_pkt_per_burst - nb_pkt); + break; + } + } + } else { + for (nb_pkt =3D 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { + pkt =3D rte_mbuf_raw_alloc(mbp); + if (pkt =3D=3D NULL) + break; + if (unlikely(!pkt_burst_prepare(pkt, mbp, + ð_hdr, vlan_tci, + vlan_tci_outer, + ol_flags))) { + rte_mempool_put(mbp, pkt); + break; + } + pkts_burst[nb_pkt] =3D pkt; } - pkts_burst[nb_pkt] =3D pkt; } =20 if (nb_pkt =3D=3D 0) --=20 2.20.1