From patchwork Wed Aug 31 14:24:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 75100 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp365311qga; Wed, 31 Aug 2016 07:25:17 -0700 (PDT) X-Received: by 10.36.220.193 with SMTP id q184mr29650078itg.17.1472653517806; Wed, 31 Aug 2016 07:25:17 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c68si6611649ioa.185.2016.08.31.07.25.16; Wed, 31 Aug 2016 07:25:17 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 9CCB961611; Wed, 31 Aug 2016 14:25:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 44E9060D36; Wed, 31 Aug 2016 14:25:09 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4F50660D73; Wed, 31 Aug 2016 14:25:04 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0101.outbound.protection.outlook.com [104.47.2.101]) by lists.linaro.org (Postfix) with ESMTPS id 4963960CF8 for ; Wed, 31 Aug 2016 14:24:29 +0000 (UTC) Received: from AM3PR07CA0042.eurprd07.prod.outlook.com (10.141.45.170) by VI1PR07MB1533.eurprd07.prod.outlook.com (10.165.238.151) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Wed, 31 Aug 2016 14:24:27 +0000 Received: from DB3FFO11FD011.protection.gbl (2a01:111:f400:7e04::149) by AM3PR07CA0042.outlook.office365.com (2a01:111:e400:882c::42) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9 via Frontend Transport; Wed, 31 Aug 2016 14:24:25 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.240 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.240; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.240) by DB3FFO11FD011.mail.protection.outlook.com (10.47.216.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.587.6 via Frontend Transport; Wed, 31 Aug 2016 14:24:26 +0000 Received: from fihe3nok0734.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u7VEO94K020840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 31 Aug 2016 17:24:09 +0300 Received: from 10.144.19.15 ([10.144.104.92]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u7VEO934020834 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 31 Aug 2016 17:24:09 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo To: Date: Wed, 31 Aug 2016 17:24:07 +0300 Message-ID: <1472653448-23947-2-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472653448-23947-1-git-send-email-matias.elo@nokia.com> References: <1472653448-23947-1-git-send-email-matias.elo@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.240; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(22813001)(356003)(2950100001)(110136002)(81156014)(450100001)(5660300001)(81166006)(106466001)(8936002)(97736004)(77096005)(2906002)(36756003)(19580395003)(50226002)(19580405001)(87936001)(8676002)(107886002)(68736007)(189998001)(2351001)(11100500001)(305945005)(626004)(33646002)(229853001)(47776003)(50466002)(5003940100001)(76176999)(16796002)(92566002)(48376002)(586003)(7846002)(50986999)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR07MB1533; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD011; 1:1wIm0T3kl4ixKhmuuTxc19BxtTXz21mkbeOh3um9mrJ89olqSwtIyqYuEcWwr5ie+8GrxvZApO+tPKSkPjdUxUhCnwKvy/ZH3vzdSyeqEcpcYELeozFL+NVo7h0hAoo+LX0iXSlwh4E8izXtwLfPRQtlx9HLx/w+bN4+pw7fpQToigI9HURAELVfTeISwmW6yhRPCYf019NLU/Wlu9IoTj4va5lxJ2ekPvfJcG1BdiEraSqoMH26DwUTCnvNFXiwPGSLUomvhNQMkOP7pNZyCLRckvjArkNPAIJs2cPwsGYZrFfu7r2qmuBtCZjAPstnBWVNHXUzuAF9gEZ7JegKbni8LPAwRcRKRvijfQvfiPsn73qkwa5GZ08qRstjc9drq+3XxNMjbhvKrl0d91SPywIjVnbsbUqWFLL4m0r8iyK3VtQJK17+Kr1m0DSFVY1gyuk4VoH60/xZITenkEcJP4IljoC8IGZeMDxTwbvlyw+uW9q/to8f0LopdsOhyGG6 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 4d115b94-c9b6-4752-0e83-08d3d1aa8363 X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1533; 2:xeCz256Mq9Ipy9xC5+odSdXyKkgazUcKheQJ1Yhu5VCO2UVxjo0cplXHiuO48a6mM4jZb8gh58MxvWYliDiLzk4iot/ttQp5fcdeBQKfY2oY5fdFxrP669TjQDfFEomOD1mEt+4bIu7yz/Zhn05BuJkUXy61KmbTmmYESoIkwL4GvtKcCv0IurCQsv1FOl8f; 3:aKtDbqVebjj7bfWi35+y8q9CpcwLVUeyvHNmCnbFWbf+LbSgAKfl0M8/rjfdt2fPyjyYwjMbyOh4BXAdnQSZZbD8emaHdWkLV80op4lLmK4MGbjzTYCTQZGDsrNl5yn10m34zzguFzI62bpLRYiVtkHbjhl4oh4BsyYtWAeAdu8N2KZbklMNfK9zaXHQbRNpOQdS9u9QwVfEYJ+NJecciAQX+nemjF66RzTV1p+GA8qcaAdleN7kjmwqnzSdRLySO5uMXj1hMKWM2MmdY13NPQ== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:VI1PR07MB1533; X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1533; 25:8FONbW9YWIeOHNJSefqB3gbFntB3TXXztfoADv7p99v/w/NcCsDpV95P8Dz9EEvZR+19yBrour7scD6IElwZxHWmUnepwu5WZgmuCqwL7BWQ52FdGCH/0K/lZpllD/jMD5BIVrfou1IUCOIYqDAa3GSzNlPXBIoPlfRLysxYqpqC11qpKlJj3ZxBMaBnr+pSOMk2Qfn4QpVz697PsimvDN2HPqqNqB0gTPthPCFMtxb85D/HzwpuWRPE7SiNWexdGUXyPmRqq9LJB9G/OjmXcuJZ8FgUl0ZDdUp5Cim8Aq3vqKI0+FiuR8IbNQKnJiC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NwFoNNDcAKq5jPJXo0cAUFDWMIN7H9nsLpT/dvAsaQII7KYoPTi2ZNZGOLD7M/1FlayMx1/sDRu3+OmsYtR53g4SnbgIZNpQaNNGtg1JGUaD0/4e6KNyXesbvzqN3BW3B8ITaUQHLDgpWXCB6hesGS6XDONQ8/QzfPSdfg1rZ1ptV6v5GmDZS2Q22w76ym0fYe8NKq8Z0qt2yst4LxwgbMOzWvUQKV+KQu89gUBUfSI9rZCER4Zu0/KCL3uqwSWOqT/JlMqMQF9E+LOjgXE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:VI1PR07MB1533; BCL:0; PCL:0; RULEID:; SRVR:VI1PR07MB1533; X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1533; 4:vDHZkIZvUTxIQo4e3ciP7Nq903X+vRli0+72sWt56jqmK1pdFhBAFLWvVupGEf8GWnl1GmD5Z7lRb3ARAdqwhGI6lVyM47VjhcUkX21RFN8tnIVQq9xxly+P3Y9U/dHZqDBRS8bR+okhR0t6u3pcAxs+c5Y/QK1MZHBOq2h/2XdvvdZT6TSZp+j4YsD2TvBSCe3C5FaoxRkLJJmKQnkOOcSKW0ZXlNfI1aHCCp81JpR8M/PzxndT0vYC0ofPYIEtNZCHTbqA6s4Qwa2KXrl+OE4f1F+vjiAMdAkpCqa3WQpUSQK6Kz/DVsNQ6hiT/s0Ac1saZOKicfOWQiy9p/43IsvsYRHfQ/HvmvU+mOsKxl0vAETyEVXjXGx0lWrG/8iPDa8nH/x3qfYBrWq8wObr35pQV7g+ua4FSMpPQcKTJxgffDy0m2uV3ADtEFK7YarvIVePq8SRj91mZHdRAImjJFKSgOQA8WL111MCUwIFYSI= X-Forefront-PRVS: 00514A2FE6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q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WajsRqUdcSGFql2NTpCGHf7GzhSOzKWAH6GwvYfIqKb/wqed9cWCvNS1Yjm+0/d6PqWsrk+jMRfo7csnaPZ3ng7pcAcr0dFahbXA/VcSJ1SXwc+U9kHS7Sr5CN6ayPBs26T2GEOg0DQgYGz7LMLyEVAhviblmGPnCs55jOqHf6YhFGAFX5QcuAF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2016 14:24:26.6452 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.240]; Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB1533 X-Topics: patch Subject: [lng-odp] [PATCH 2/3] linux-gen: dpdk: bulk alloc mbufs in tx X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Bulk alloc mbufs in dpdk_send(). Combined with dpdk mempool cache size increase this improves odp_l2fwd throughput by 5-10 %. Signed-off-by: Matias Elo --- platform/linux-generic/include/odp_packet_dpdk.h | 2 +- platform/linux-generic/pktio/dpdk.c | 28 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/platform/linux-generic/include/odp_packet_dpdk.h b/platform/linux-generic/include/odp_packet_dpdk.h index 31e1ed7..c63685e 100644 --- a/platform/linux-generic/include/odp_packet_dpdk.h +++ b/platform/linux-generic/include/odp_packet_dpdk.h @@ -20,7 +20,7 @@ #define DPDK_MEMORY_MB 512 #define DPDK_NB_MBUF 16384 #define DPDK_MBUF_BUF_SIZE RTE_MBUF_DEFAULT_BUF_SIZE -#define DPDK_MEMPOOL_CACHE_SIZE 32 +#define DPDK_MEMPOOL_CACHE_SIZE 64 #define DPDK_NM_RX_DESC 128 #define DPDK_NM_TX_DESC 512 diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 0a800b7..99eb868 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -826,36 +826,36 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, const odp_packet_t pkt_table[], uint16_t num) { pkt_dpdk_t *pkt_dpdk = &pktio_entry->s.pkt_dpdk; - int i; + int i, j; char *data; uint16_t pkt_len; + if (odp_unlikely((rte_pktmbuf_alloc_bulk(pkt_dpdk->pkt_pool, + mbuf_table, num)))) { + ODP_ERR("Failed to alloc mbuf\n"); + return 0; + } for (i = 0; i < num; i++) { pkt_len = odp_packet_len(pkt_table[i]); if (pkt_len > pkt_dpdk->mtu) { if (i == 0) __odp_errno = EMSGSIZE; - break; - } - - mbuf_table[i] = rte_pktmbuf_alloc(pkt_dpdk->pkt_pool); - if (mbuf_table[i] == NULL) { - ODP_ERR("Failed to alloc mbuf\n"); - break; + goto fail; } + /* Packet always fits in mbuf */ data = rte_pktmbuf_append(mbuf_table[i], pkt_len); - if (data == NULL) { - ODP_ERR("Failed to append mbuf\n"); - rte_pktmbuf_free(mbuf_table[i]); - break; - } - odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data); } return i; + +fail: + for (j = i; j < num; j++) + rte_pktmbuf_free(mbuf_table[j]); + + return i; } static int dpdk_recv(pktio_entry_t *pktio_entry, int index,