From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1D0E25424 for ; Tue, 2 Apr 2019 11:53:59 +0200 (CEST) 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 x329j38l014051; Tue, 2 Apr 2019 02:53:58 -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=bgierSivJ9Wec3fS0gTO+/JkdYY4ZwxqD2zSD1XC0lQ=; b=XuTVROQuy5odYglXr6OR7VYSWGhi57EZN+D8SCwEBA/JPJdhZW9UTkE7uiDkYrW7QWDR q6/3LRod17t9OnYz0/1sKz1/cXaqA9o4jHHMeelUWELlXtb3z9mLuBhMow4tKLX1jnJU vy4N4Xps+WVTp6QJgGKlFkAM8T+F8gIwwcIgbyZEclR9BpftZikVBiXRHDzp97336yMm vIpFS10+8AwWXP7iHmDNY7Nf5c5GlI3Xn3ULuFnLFNRv6wR+uKDOrA+xycDMIzwnnP+i 1nrRactdLjP/shCAhFeqIVXKMEYfoD4/cDSVs0lSwLA+RCyOdsFF1tHV8doQyI5ES05v bQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2rkrb49wyv-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 02 Apr 2019 02:53:58 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 2 Apr 2019 02:53:55 -0700 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (104.47.32.57) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 2 Apr 2019 02:53:55 -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=bgierSivJ9Wec3fS0gTO+/JkdYY4ZwxqD2zSD1XC0lQ=; b=iVy9yCBdcbsb/+WDgJX+jISPYtN1dU+CY2y/EwQeHcqCG4oBL86sxeQJkpgcvI+ON79pt+ZVYjaZ21phLMr3EaocqaOjsDYEOZtgQTWubo78ZU/sL+vN1GIOE9mD7SRzoF2RExfd0J1WquUyC19o4bKtpkuSmgx2Ml2axvSY3ds= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1926.namprd18.prod.outlook.com (10.171.255.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 2 Apr 2019 09:53:37 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::e980:fa09:c83a:851d]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::e980:fa09:c83a:851d%3]) with mapi id 15.20.1750.021; Tue, 2 Apr 2019 09:53:37 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "thomas@monjalon.net" , "arybchenko@solarflare.com" , "ferruh.yigit@intel.com" , "bernard.iremonger@intel.com" , "alialnu@mellanox.com" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula , Yingya Han Thread-Topic: [dpdk-dev] [PATCH v6 4/4] app/testpmd: add mempool bulk get for txonly mode Thread-Index: AQHU6TnxNNXgRzJmD0Wnzkp7ILi1DQ== Date: Tue, 2 Apr 2019 09:53:36 +0000 Message-ID: <20190402095255.848-4-pbhagavatula@marvell.com> References: <20190228194128.14236-1-pbhagavatula@marvell.com> <20190402095255.848-1-pbhagavatula@marvell.com> In-Reply-To: <20190402095255.848-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0029.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::15) 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: [115.113.156.3] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c5981ad5-626d-4c76-bd8c-08d6b751136d x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:CY4PR1801MB1926; x-ms-traffictypediagnostic: CY4PR1801MB1926: x-microsoft-antispam-prvs: x-forefront-prvs: 0995196AA2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(346002)(39860400002)(376002)(189003)(199004)(6486002)(8676002)(55236004)(102836004)(106356001)(26005)(486006)(186003)(86362001)(476003)(2906002)(105586002)(36756003)(11346002)(66066001)(2201001)(8936002)(71200400001)(305945005)(7736002)(2616005)(478600001)(4326008)(71190400001)(446003)(97736004)(6436002)(256004)(1076003)(2501003)(50226002)(54906003)(6506007)(316002)(81156014)(14454004)(81166006)(53936002)(25786009)(6116002)(52116002)(76176011)(110136005)(3846002)(5660300002)(6512007)(386003)(68736007)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1926; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: SOZqTNV4XOxSQvsFHJT79VDMqLPHZEbgAtM9cXBkIC7uqaSs56OgjenyVqdRho8PhP66Ab8uTK+uubJTf/BSHkgNbGszeV/B1PUviyRpbw6D/3OTDhy7i/S+5tlvYa3F9cZbsjgRKOa4eDEjqxs9dEV1mXioVMuMMivoWILDAvdf7K9qdZeZ9pV0OzueLpA6m4HKDKmNuCwhewyeHGNT0xcSiwZYn6ePHeUPoegTJbaBAEaYMiFtq1/kn0n5gp5wsvt/bJKmvV60Z5Lg2RPiztLRt2HPzhZd8d025zZkvQfOEWjuV768EcI+PTbFsGuNO5e09BJENus7YNW3LqvssXPjfmZku472V2sXH2Vt18g/8SepzrZZmMy6kEB7ycyeWMPxSf/YXFQk9EzDI9tGKeLqqFa5gKaNx3cEopc9yKM= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c5981ad5-626d-4c76-bd8c-08d6b751136d X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Apr 2019 09:53:36.9979 (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: CY4PR1801MB1926 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-02_04:, , signatures=0 Subject: [dpdk-dev] [PATCH v6 4/4] 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: , X-List-Received-Date: Tue, 02 Apr 2019 09:53:59 -0000 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 | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 56ca0ad24..66e63788a 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -268,16 +268,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_pktmbuf_free(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_pktmbuf_free(pkt); + break; + } + pkts_burst[nb_pkt] =3D pkt; } - pkts_burst[nb_pkt] =3D pkt; } =20 if (nb_pkt =3D=3D 0) --=20 2.21.0 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 7ECA8A0679 for ; Tue, 2 Apr 2019 11:54:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CA76B5589; Tue, 2 Apr 2019 11:54:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1D0E25424 for ; Tue, 2 Apr 2019 11:53:59 +0200 (CEST) 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 x329j38l014051; Tue, 2 Apr 2019 02:53:58 -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=bgierSivJ9Wec3fS0gTO+/JkdYY4ZwxqD2zSD1XC0lQ=; b=XuTVROQuy5odYglXr6OR7VYSWGhi57EZN+D8SCwEBA/JPJdhZW9UTkE7uiDkYrW7QWDR q6/3LRod17t9OnYz0/1sKz1/cXaqA9o4jHHMeelUWELlXtb3z9mLuBhMow4tKLX1jnJU vy4N4Xps+WVTp6QJgGKlFkAM8T+F8gIwwcIgbyZEclR9BpftZikVBiXRHDzp97336yMm vIpFS10+8AwWXP7iHmDNY7Nf5c5GlI3Xn3ULuFnLFNRv6wR+uKDOrA+xycDMIzwnnP+i 1nrRactdLjP/shCAhFeqIVXKMEYfoD4/cDSVs0lSwLA+RCyOdsFF1tHV8doQyI5ES05v bQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2rkrb49wyv-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 02 Apr 2019 02:53:58 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 2 Apr 2019 02:53:55 -0700 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (104.47.32.57) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 2 Apr 2019 02:53:55 -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=bgierSivJ9Wec3fS0gTO+/JkdYY4ZwxqD2zSD1XC0lQ=; b=iVy9yCBdcbsb/+WDgJX+jISPYtN1dU+CY2y/EwQeHcqCG4oBL86sxeQJkpgcvI+ON79pt+ZVYjaZ21phLMr3EaocqaOjsDYEOZtgQTWubo78ZU/sL+vN1GIOE9mD7SRzoF2RExfd0J1WquUyC19o4bKtpkuSmgx2Ml2axvSY3ds= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1926.namprd18.prod.outlook.com (10.171.255.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 2 Apr 2019 09:53:37 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::e980:fa09:c83a:851d]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::e980:fa09:c83a:851d%3]) with mapi id 15.20.1750.021; Tue, 2 Apr 2019 09:53:37 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "thomas@monjalon.net" , "arybchenko@solarflare.com" , "ferruh.yigit@intel.com" , "bernard.iremonger@intel.com" , "alialnu@mellanox.com" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula , Yingya Han Thread-Topic: [dpdk-dev] [PATCH v6 4/4] app/testpmd: add mempool bulk get for txonly mode Thread-Index: AQHU6TnxNNXgRzJmD0Wnzkp7ILi1DQ== Date: Tue, 2 Apr 2019 09:53:36 +0000 Message-ID: <20190402095255.848-4-pbhagavatula@marvell.com> References: <20190228194128.14236-1-pbhagavatula@marvell.com> <20190402095255.848-1-pbhagavatula@marvell.com> In-Reply-To: <20190402095255.848-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0029.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::15) 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: [115.113.156.3] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c5981ad5-626d-4c76-bd8c-08d6b751136d x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:CY4PR1801MB1926; x-ms-traffictypediagnostic: CY4PR1801MB1926: x-microsoft-antispam-prvs: x-forefront-prvs: 0995196AA2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(346002)(39860400002)(376002)(189003)(199004)(6486002)(8676002)(55236004)(102836004)(106356001)(26005)(486006)(186003)(86362001)(476003)(2906002)(105586002)(36756003)(11346002)(66066001)(2201001)(8936002)(71200400001)(305945005)(7736002)(2616005)(478600001)(4326008)(71190400001)(446003)(97736004)(6436002)(256004)(1076003)(2501003)(50226002)(54906003)(6506007)(316002)(81156014)(14454004)(81166006)(53936002)(25786009)(6116002)(52116002)(76176011)(110136005)(3846002)(5660300002)(6512007)(386003)(68736007)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1926; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: SOZqTNV4XOxSQvsFHJT79VDMqLPHZEbgAtM9cXBkIC7uqaSs56OgjenyVqdRho8PhP66Ab8uTK+uubJTf/BSHkgNbGszeV/B1PUviyRpbw6D/3OTDhy7i/S+5tlvYa3F9cZbsjgRKOa4eDEjqxs9dEV1mXioVMuMMivoWILDAvdf7K9qdZeZ9pV0OzueLpA6m4HKDKmNuCwhewyeHGNT0xcSiwZYn6ePHeUPoegTJbaBAEaYMiFtq1/kn0n5gp5wsvt/bJKmvV60Z5Lg2RPiztLRt2HPzhZd8d025zZkvQfOEWjuV768EcI+PTbFsGuNO5e09BJENus7YNW3LqvssXPjfmZku472V2sXH2Vt18g/8SepzrZZmMy6kEB7ycyeWMPxSf/YXFQk9EzDI9tGKeLqqFa5gKaNx3cEopc9yKM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c5981ad5-626d-4c76-bd8c-08d6b751136d X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Apr 2019 09:53:36.9979 (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: CY4PR1801MB1926 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-02_04:, , signatures=0 Subject: [dpdk-dev] [PATCH v6 4/4] 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: <20190402095336.14d2tf5gLT4g9RQexjQmRJzfYuZmAHKO075Nz0ulxVo@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 | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 56ca0ad24..66e63788a 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -268,16 +268,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_pktmbuf_free(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_pktmbuf_free(pkt); + break; + } + pkts_burst[nb_pkt] =3D pkt; } - pkts_burst[nb_pkt] =3D pkt; } =20 if (nb_pkt =3D=3D 0) --=20 2.21.0