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 BA1794CA0 for ; Tue, 26 Mar 2019 13:27:27 +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 x2QCFckR016623; Tue, 26 Mar 2019 05:27:26 -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=zlgvmf++6NUoKHXfvK5VKCDDZcFFcMGuE7o7Ctr8HFE=; b=h7tAkrMMqKBAPPpmJs8B+q0ivI22zp6uiq7wNvuNAc3wwaAiVtluR6QukESrJYBjX7Zh ALjdsghatpKmB5KMDaTB/rWF9W+m6cli26C3E9Cxc0JyWksUuIFNfn3dLsNI6Z00oWlX J2MfgWyaSy/aRs/pB+IWtf7nSaJrbuJkZhIbdapC6g6fqCbUZ7FIxTRxuh2JuQB0ARoJ S0mmfx4vjpRU384AfzbWyvAb9qUHDys5zxIg4n5OFWII6+OX5pbSTJnShaRO7EeFFh66 ePqzhjv5ei1UM0wd9ZkT9mZkzlU2fSGa80akJVqoL8r6vnft3tdm3RaW9HE+ttPAxyma kA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2rfjtbr6e8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2019 05:27:26 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 26 Mar 2019 05:27:15 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.53) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 26 Mar 2019 05:27:15 -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=zlgvmf++6NUoKHXfvK5VKCDDZcFFcMGuE7o7Ctr8HFE=; b=LLLxcxUsReReB6C0wh9M4+YxCYxibug004DuuXPwCFuODC0o14bdkaB/qXpYApZSLAsQ8Y94cUIN8zJSOC71BrpMDo3qDajg7SW0AZ2Jh/raHZZSncR1u58e6At1kKoteBEfIKbMdLOQGWAgfh4jwh3A8eBw9uEvAqVjxXuYkpk= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1942.namprd18.prod.outlook.com (10.171.255.33) 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 12:27:03 +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 12:27:03 +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 v3 2/2] app/testpmd: add mempool bulk get for txonly mode Thread-Index: AQHU4883zX3OLPTdekeuo24Xl3r0ug== Date: Tue, 26 Mar 2019 12:27:02 +0000 Message-ID: <20190326122625.10540-2-pbhagavatula@marvell.com> References: <20190228194128.14236-1-pbhagavatula@marvell.com> <20190326122625.10540-1-pbhagavatula@marvell.com> In-Reply-To: <20190326122625.10540-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR0401CA0022.apcprd04.prod.outlook.com (2603:1096:3:1::32) 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: 4c4cd6c5-c2c5-4797-7ca3-08d6b1e659aa x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:CY4PR1801MB1942; x-ms-traffictypediagnostic: CY4PR1801MB1942: x-microsoft-antispam-prvs: x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(396003)(366004)(376002)(346002)(199004)(189003)(8936002)(50226002)(110136005)(54906003)(97736004)(36756003)(316002)(2906002)(105586002)(68736007)(66066001)(106356001)(8676002)(81156014)(486006)(86362001)(102836004)(76176011)(6506007)(386003)(2201001)(52116002)(26005)(81166006)(186003)(4326008)(78486014)(6512007)(71200400001)(53936002)(6486002)(7736002)(305945005)(6436002)(1076003)(14454004)(3846002)(2501003)(25786009)(6116002)(478600001)(99286004)(11346002)(2616005)(476003)(446003)(256004)(71190400001)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1942; 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: fTy8tdg6HXQsa6heeyCwGt0gl5jYuz3U4gTGS3EyUvU19qGsxWT3ID3RKiMwCVtmr0SWkyuO3NrjI2DbeGL7XR20WJSxXzr2aj0svGdundivTCvT99qLFg6TWcHuuXJSYtpBUmJRypw8quxjeNaOTS7/07ldNmhFAo3hnuLlgzDeRUSvIq3QDfAMgA7I0MrXryZ6K6EXrJSV7pMgn5jbRLwiyGe01TQVMglUeR+9hIxV5PIME9f8rTPmaA7tdxIDI6kbXk/1I+DLUuQRKLxEfG8c2bFBKjbDoz5/PGYpdHRKfXW7MQuEZ9XBdu0DyZ8JSDDEX0SBLQPCiHQglsGOBpdUFEw4VCJwORE0Zbt8yARnnBArsZMYRF1NUpgv/MwtPFg5Mq8Its46pZUBzxU4BZ6iUCnUqXB016Qg+yC9WNw= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4c4cd6c5-c2c5-4797-7ca3-08d6b1e659aa X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 12:27:03.1028 (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: CY4PR1801MB1942 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-26_08:, , signatures=0 Subject: [dpdk-dev] [PATCH v3 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: , X-List-Received-Date: Tue, 26 Mar 2019 12:27:28 -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 | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 5610e0e42..3ca13e622 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -249,18 +249,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 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 98965A05D3 for ; Tue, 26 Mar 2019 13:27:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7D61C4CAB; Tue, 26 Mar 2019 13:27:28 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id BA1794CA0 for ; Tue, 26 Mar 2019 13:27:27 +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 x2QCFckR016623; Tue, 26 Mar 2019 05:27:26 -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=zlgvmf++6NUoKHXfvK5VKCDDZcFFcMGuE7o7Ctr8HFE=; b=h7tAkrMMqKBAPPpmJs8B+q0ivI22zp6uiq7wNvuNAc3wwaAiVtluR6QukESrJYBjX7Zh ALjdsghatpKmB5KMDaTB/rWF9W+m6cli26C3E9Cxc0JyWksUuIFNfn3dLsNI6Z00oWlX J2MfgWyaSy/aRs/pB+IWtf7nSaJrbuJkZhIbdapC6g6fqCbUZ7FIxTRxuh2JuQB0ARoJ S0mmfx4vjpRU384AfzbWyvAb9qUHDys5zxIg4n5OFWII6+OX5pbSTJnShaRO7EeFFh66 ePqzhjv5ei1UM0wd9ZkT9mZkzlU2fSGa80akJVqoL8r6vnft3tdm3RaW9HE+ttPAxyma kA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2rfjtbr6e8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2019 05:27:26 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 26 Mar 2019 05:27:15 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.53) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 26 Mar 2019 05:27:15 -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=zlgvmf++6NUoKHXfvK5VKCDDZcFFcMGuE7o7Ctr8HFE=; b=LLLxcxUsReReB6C0wh9M4+YxCYxibug004DuuXPwCFuODC0o14bdkaB/qXpYApZSLAsQ8Y94cUIN8zJSOC71BrpMDo3qDajg7SW0AZ2Jh/raHZZSncR1u58e6At1kKoteBEfIKbMdLOQGWAgfh4jwh3A8eBw9uEvAqVjxXuYkpk= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1942.namprd18.prod.outlook.com (10.171.255.33) 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 12:27:03 +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 12:27:03 +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 v3 2/2] app/testpmd: add mempool bulk get for txonly mode Thread-Index: AQHU4883zX3OLPTdekeuo24Xl3r0ug== Date: Tue, 26 Mar 2019 12:27:02 +0000 Message-ID: <20190326122625.10540-2-pbhagavatula@marvell.com> References: <20190228194128.14236-1-pbhagavatula@marvell.com> <20190326122625.10540-1-pbhagavatula@marvell.com> In-Reply-To: <20190326122625.10540-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR0401CA0022.apcprd04.prod.outlook.com (2603:1096:3:1::32) 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: 4c4cd6c5-c2c5-4797-7ca3-08d6b1e659aa x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:CY4PR1801MB1942; x-ms-traffictypediagnostic: CY4PR1801MB1942: x-microsoft-antispam-prvs: x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(396003)(366004)(376002)(346002)(199004)(189003)(8936002)(50226002)(110136005)(54906003)(97736004)(36756003)(316002)(2906002)(105586002)(68736007)(66066001)(106356001)(8676002)(81156014)(486006)(86362001)(102836004)(76176011)(6506007)(386003)(2201001)(52116002)(26005)(81166006)(186003)(4326008)(78486014)(6512007)(71200400001)(53936002)(6486002)(7736002)(305945005)(6436002)(1076003)(14454004)(3846002)(2501003)(25786009)(6116002)(478600001)(99286004)(11346002)(2616005)(476003)(446003)(256004)(71190400001)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1942; 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: fTy8tdg6HXQsa6heeyCwGt0gl5jYuz3U4gTGS3EyUvU19qGsxWT3ID3RKiMwCVtmr0SWkyuO3NrjI2DbeGL7XR20WJSxXzr2aj0svGdundivTCvT99qLFg6TWcHuuXJSYtpBUmJRypw8quxjeNaOTS7/07ldNmhFAo3hnuLlgzDeRUSvIq3QDfAMgA7I0MrXryZ6K6EXrJSV7pMgn5jbRLwiyGe01TQVMglUeR+9hIxV5PIME9f8rTPmaA7tdxIDI6kbXk/1I+DLUuQRKLxEfG8c2bFBKjbDoz5/PGYpdHRKfXW7MQuEZ9XBdu0DyZ8JSDDEX0SBLQPCiHQglsGOBpdUFEw4VCJwORE0Zbt8yARnnBArsZMYRF1NUpgv/MwtPFg5Mq8Its46pZUBzxU4BZ6iUCnUqXB016Qg+yC9WNw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4c4cd6c5-c2c5-4797-7ca3-08d6b1e659aa X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 12:27:03.1028 (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: CY4PR1801MB1942 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-26_08:, , signatures=0 Subject: [dpdk-dev] [PATCH v3 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: <20190326122702.4Pay2exBRDISIFJnrqsfB_XkezmeNPyJCTgNB7Jh6Bs@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 5610e0e42..3ca13e622 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -249,18 +249,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