From patchwork Fri Nov 10 07:12:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 836634 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="unknown key hash" (0-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="klKAMhjb"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yYB9q1z0fz9ryr for ; Fri, 10 Nov 2017 18:14:39 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D0E35AAE; Fri, 10 Nov 2017 07:13:15 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id CE86FA80 for ; Fri, 10 Nov 2017 07:13:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6BB1A3D9 for ; Fri, 10 Nov 2017 07:13:14 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171110071312euoutp010093e4dc0965db99e4d61ba52f8a7c34~1qAWj-lvD1340113401euoutp01g; Fri, 10 Nov 2017 07:13:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171110071312euoutp010093e4dc0965db99e4d61ba52f8a7c34~1qAWj-lvD1340113401euoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1510297992; bh=ayOuY6fajSIVPDdeE502RYLC89+d7CHXk0PkfprekTU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=klKAMhjb7MbXqgK7nCHGi6jpeJ3xZGo6nszfe0zfkf8/uSNWe762Yejm9rPv23Htb nARDRe9nq1D2DSTGeRg1n4PzGph5pQ7HFRsS0U0RpIHNOrErmVG2ZWF7E6Qz4EiirQ wGDgizzsGwhwqLtxPYf7kh19w5HibQL7uKzXs+ec= Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171110071311eucas1p289b569820d9ceeb8728a6c16da725901~1qAV1sc5W1853418534eucas1p2B; Fri, 10 Nov 2017 07:13:11 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 24.76.12907.781550A5; Fri, 10 Nov 2017 07:13:11 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171110071310eucas1p1f2c61be6005190455e67836092fe36e9~1qAU_HFK11985919859eucas1p1R; Fri, 10 Nov 2017 07:13:10 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-34-5a055187ed7c Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8D.39.20118.681550A5; Fri, 10 Nov 2017 07:13:10 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OZ6003O0XC8WF90@eusync3.samsung.com>; Fri, 10 Nov 2017 07:13:10 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Fri, 10 Nov 2017 10:12:06 +0300 Message-id: <1510297926-18710-4-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1510297926-18710-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsWy7djPc7rtgaxRBvv/cFus/sVp0dI/k9li 3rO/jBbTPt9mt7jS/pPdYuPDs6wWK26cYrSY++k5o8Xro/+YHTg9Fu95yeTx7OZ/Ro/3+66y efRtWcUYwBLFZZOSmpNZllqkb5fAlXHz/k7WgtciFc8nfGBuYFwg0MXIySEhYCKxYtIXRghb TOLCvfVsXYxcHEICSxklnk47zw7hfGaU+Dh1MksXIwdYx9Wj+RDxZYwS//rnQXU0M0ksvP6R BWQUm4COxKnVR8DGighIS7zufcMKUsQscINJ4lz7R7CEsICnxNxjc5lAbBYBVYl5k2eBxXkF 3CRabv1khrhJTuLmuU4wm1PAXeLvkWXMIIMkBOawSZw+08gGUeQi8XLWJyYIW1ji1fEt7BC2 jMTlyd0sEA3NjBINqy4xQjgTGCW+NC+H6rCXOHXzKpjNLMAnMWnbdGaIR3klOtqEIEo8JN4c bIUqd5R4/fAfM8TPsxglnk0+wj6BUXoBI8MqRpHU0uLc9NRiI73ixNzi0rx0veT83E2MwMg9 /e/4xx2M709YHWIU4GBU4uH9cJclSog1say4MvcQowQHs5IIr748a5QQb0piZVVqUX58UWlO avEhRmkOFiVxXtuotkghgfTEktTs1NSC1CKYLBMHp1QD45YoHYulqek5U3Sm+GxgPDPZ5uTh CUK9BWeWsho/2cXhHa7/jOniLe+iRWwRceJt1aUbrp7vrF2VumbKuo9sDApRV8+FSJoHn3j3 d/uCc9HX7D2eKz2fkqkac3M+1+sPxsxOFXx/spx+tJWles653he1Zmni4mtpCVMlv7slL1Kw Wis2OWBzjBJLcUaioRZzUXEiAPFlEQHYAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVy+t/xq7ptgaxRBnvOy1ms/sVp0dI/k9li 3rO/jBbTPt9mt7jS/pPdYuPDs6wWK26cYrSY++k5o8Xro/+YHTg9Fu95yeTx7OZ/Ro/3+66y efRtWcUYwBLFZZOSmpNZllqkb5fAlXHz/k7WgtciFc8nfGBuYFwg0MXIwSEhYCJx9Wh+FyMn kCkmceHeerYuRi4OIYEljBI//r5lgXBamSR2b5nGBFLFJqAjcWr1EUYQW0RAWuJ17xtWkCJm gVtMEqcP9IEVCQt4Ssw9NhfMZhFQlZg3eRZYA6+Am0TLrZ/MEOvkJG6e6wSzOQXcJf4eWcYM cpEQUM3/HXwTGHkXMDKsYhRJLS3OTc8tNtIrTswtLs1L10vOz93ECAyubcd+btnB2PUu+BCj AAejEg+vxwOWKCHWxLLiytxDjBIczEoivPryrFFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeXv3 rI4UEkhPLEnNTk0tSC2CyTJxcEo1MGanzc6T6lK/c+bVyYTPTL+K7us0yS12mWko4SK0Yu/F SCmB+xzdMkobRJzatQVbYmWmzp1md/FVObuexub1X19qi50+2LHVYkeePNMRz1M754h28ec6 XZt19q3QzumX/y927r2z2HjOaf+Ql99N695P/D8vwPzE7XOVS203vrJP4HxntdN6t5sSS3FG oqEWc1FxIgC5iwZ4KgIAAA== X-CMS-MailID: 20171110071310eucas1p1f2c61be6005190455e67836092fe36e9 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171110071310eucas1p1f2c61be6005190455e67836092fe36e9 X-RootMTR: 20171110071310eucas1p1f2c61be6005190455e67836092fe36e9 References: <1510297926-18710-1-git-send-email-i.maximets@samsung.com> X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Robert Wojciechowicz , Heetae Ahn , Ilya Maximets , Flavio Leitner Subject: [ovs-dev] [PATCH v2 3/3] netdev-dpdk: Fix mempool creation with large MTU. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Currently mempool name size limited to 25 characters by RTE_MEMPOOL_NAMESIZE. netdev-dpdk tries to create mempool with the following name pattern: "ovs_%{hash}_%{socket}_%{mtu}_%{n_mbuf}". We have 3 chars for "ovs" + 4 chars for delimiters + 8 chars for hash (because it's the 32 bit integer printed in hex) + 1 char for socket_id (mostly 1, but it could be 2 on some systems; larger?) = 16. Only 25 - 16 = 9 characters remains for mtu + n_mbufs. Minimum usual value for mtu is 1500 --> 2030 (4 chars) after dpdk_buf_size conversion and the minimum value for n_mbufs is 16384 (5 chars). So, all the 9 characters are used. If we'll try to create port with mtu = 9500, mempool creation will fail, because FRAME_LEN_TO_MTU(dpdk_buf_size(9500)) = 10222 (5 chars) and this value will overflow the RTE_MEMPOOL_NAMESIZE limit. Same issue will happen if we'll try to create port with big enough number of queues or will try to create big enough number of PMD threads (number of tx queues will enlarge the mempool requirements). Fix that by removing the delimiters. To keep the readability (at least partial) of the mempool names exact field sizes with zero padding are used. Following limits should be suitable for now: - Hash length: 8 chars (uint32_t in hex) - Socket ID : 2 chars (For systems with up to 10 sockets) - MTU : 5 chars (MTU (10^5 - 1) should be enough for now) - n_mbufs : 7 chars (Up to 10^7 of mbufs) Total : 22 + 3 (for "ovs") = 25 CC: Antonio Fischetti CC: Robert Wojciechowicz Fixes: f06546a51dd8 ("Fix mempool names to reflect socket id.") Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.") Signed-off-by: Ilya Maximets Acked-by: Antonio Fischetti Acked-by: Mark Kavanagh Tested-by: Mark Kavanagh --- lib/netdev-dpdk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 75856bc..dc210cc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -510,7 +510,8 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu) do { /* Full DPDK memory pool name must be unique and cannot be * longer than RTE_MEMPOOL_NAMESIZE. */ - int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u", + int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, + "ovs%08x%02d%05d%07u", hash, socket_id, mtu, n_mbufs); if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) { VLOG_DBG("snprintf returned %d. "