From patchwork Mon Oct 30 12:52:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 832018 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="TMc2XOcx"; 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 3yQZD23Jh6z9t2l for ; Mon, 30 Oct 2017 23:53:38 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 417EEAF3; Mon, 30 Oct 2017 12:53:04 +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 020D2AD5 for ; Mon, 30 Oct 2017 12:53:03 +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 79BF7175 for ; Mon, 30 Oct 2017 12:53:02 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171030125300euoutp015a77ba94ffe12553b216fb9e41d0b924~yWi5NXEYN2435424354euoutp01P; Mon, 30 Oct 2017 12:53:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171030125300euoutp015a77ba94ffe12553b216fb9e41d0b924~yWi5NXEYN2435424354euoutp01P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509367980; bh=klI+mUkXjw1oEezRz1+1pFTwelDFcOIMHLehwGGXs3w=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=TMc2XOcxrnodNYnNbno9NmY7zWnwcBsQrEcGuf2rhvp9PkzEetcRSw+tPP08XbbZT J97WZVUPHoT+06kd98oIoRIbN6uGUAifXVblo+JzGTggloDWAQHdSn7gXccdzwc3x/ /SJ5bSNXuhDY/fsAnEDtV3vJ/jdUYzWtsH3LZ//Q= Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030125259eucas1p28670488db01c97491f9333cd08c23f4a~yWi4jdBBl2514425144eucas1p2W; Mon, 30 Oct 2017 12:52:59 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 8C.F8.12944.BA027F95; Mon, 30 Oct 2017 12:52:59 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030125258eucas1p21d80d5a509ab3947e69bef3d3618728b~yWi38vsV22515525155eucas1p2H; Mon, 30 Oct 2017 12:52:58 +0000 (GMT) X-AuditID: cbfec7f4-f79ab6d000003290-7f-59f720abfa7f Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AC.3E.18832.AA027F95; Mon, 30 Oct 2017 12:52:58 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYM00KSTZS0IK10@eusync2.samsung.com>; Mon, 30 Oct 2017 12:52:58 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 30 Oct 2017 15:52:38 +0300 Message-id: <1509367961-7172-2-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509367961-7172-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djPc7qrFb5HGhx4ymKx+henRUv/TGaL aZ9vs1tcaf/JbrHx4VlWixU3TjFazP30nNHi9dF/zA4cHov3vGTyeHbzP6NH35ZVjAHMUVw2 Kak5mWWpRfp2CVwZ6y88Yi94zlax7G1iA+NW1i5GTg4JAROJ3ubZjBC2mMSFe+vZuhi5OIQE ljJK/Dp9jhXC+cwo0fNvMSNMx4tpS5ghEssYJTb+WccI4TQzSdz8MQNsLpuAjsSp1UfAOkQE pCVe974BG8UssJ1JYvOdU2wgCWEBd4lDk6eC2SwCqhLbv78Ba+AVcJV4NeszC8Q6OYmb5zqZ QWxOATeJzZu/MIEMkhDoYJNY0HMHqshF4tmCDqj7hCVeHd/CDmHLSHR2HIRqaGaUaFh1iRHC mcAo8aV5ORNElb3EqZtXwWxmAT6JSdumA63jAIrzSnS0CUGUeEjsbIG5yFHiypomaDDNZJT4 8/I22wRG6QWMDKsYRVJLi3PTU4tN9IoTc4tL89L1kvNzNzECo/T0v+NfdjAuPmZ1iFGAg1GJ h/dG7rdIIdbEsuLK3EOMEhzMSiK8j24AhXhTEiurUovy44tKc1KLDzFKc7AoifPaRrVFCgmk J5akZqemFqQWwWSZODilGhgjqzbXX657fTX8uYfa4wdaZ9xdlnY+LsmxqWzZI+kyl6vZd6fo tp5XV3myeqa5hMhGuV/qfThxSd/Cl4uS5b73ZWRf8q45elw5dvGpfqGdzyT6znyKlP5l0bzQ 36fj7NyLBTqFUxS2rr723tum6tviXUbloYcmPN1Utf3u+4KFaSfXOU9ZrSCkxFKckWioxVxU nAgAYEYWKM4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjluLIzCtJLcpLzFFi42I5/e/4Fd1VCt8jDV4f1bBY/YvToqV/JrPF tM+32S2utP9kt9j48CyrxYobpxgt5n56zmjx+ug/ZgcOj8V7XjJ5PLv5n9Gjb8sqxgDmKC6b lNSczLLUIn27BK6M9RcesRc8Z6tY9jaxgXEraxcjJ4eEgInEi2lLmCFsMYkL99azdTFycQgJ LGGUOHb0J5TTyiRx7O0+dpAqNgEdiVOrjzCC2CIC0hKve9+wghQxC+xkknjY8wgsISzgLnFo 8lQ2EJtFQFVi+/c3YHFeAVeJV7M+s0Csk5O4ea4TbDWngJvE5s1fmEBsIaCa7jfHmCcw8i5g ZFjFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGErbjv3cvIPx0sbgQ4wCHIxKPLw3cr9FCrEm lhVX5h5ilOBgVhLhfXQDKMSbklhZlVqUH19UmpNafIhRmoNFSZy3d8/qSCGB9MSS1OzU1ILU IpgsEwenVAOjG7fJY4N/1ks6G0p4GWYxrRB491bx4X7xGe+iw+fFql5s5E7d9Cf58T6eOv6N 17Z3+WV5HDldN33Bm3rT6lMZcT7XH9aYmzl9i+7oX1rM8MRec2LDue9dnE0dU26vK9ob8e2S VlOo+Ur2A47Pl81hE/RZGv5Ptli01X8WI5vP0Ri118GSU0KUWIozEg21mIuKEwGpTrzaIQIA AA== X-CMS-MailID: 20171030125258eucas1p21d80d5a509ab3947e69bef3d3618728b X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030125258eucas1p21d80d5a509ab3947e69bef3d3618728b X-RootMTR: 20171030125258eucas1p21d80d5a509ab3947e69bef3d3618728b References: <1509367961-7172-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 Subject: [ovs-dev] [PATCH 1/4] netdev-dpdk: Fix mp_name leak on snprintf failure. 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 CC: Robert Wojciechowicz CC: Antonio Fischetti Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.") Fixes: 65056fd79694 ("netdev-dpdk: manage failure in mempool name creation.") Signed-off-by: Ilya Maximets --- lib/netdev-dpdk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 82652f0..1e9d78f 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -505,6 +505,7 @@ dpdk_mp_name(struct dpdk_mp *dmp) VLOG_DBG("snprintf returned %d. Failed to generate a mempool " "name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.", ret, dmp->if_name, h, dmp->mtu, dmp->n_mbufs); + free(mp_name); return NULL; } return mp_name; From patchwork Mon Oct 30 12:52:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 832019 X-Patchwork-Delegate: ian.stokes@intel.com 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="mDGYH0SE"; 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 3yQZDm3TWwz9s82 for ; Mon, 30 Oct 2017 23:54:16 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 34CB9B0C; Mon, 30 Oct 2017 12:53:08 +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 0B0C1B0A for ; Mon, 30 Oct 2017 12:53:07 +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 9B45D175 for ; Mon, 30 Oct 2017 12:53:06 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171030125304euoutp01dd93398bca6eb6381622ac36ea907f7b~yWi9Dh1BC2435424354euoutp01T; Mon, 30 Oct 2017 12:53:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171030125304euoutp01dd93398bca6eb6381622ac36ea907f7b~yWi9Dh1BC2435424354euoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509367984; bh=47bAbDJ7W35EImWQwWG1Z0Tm1C2xSmMOyMPDARSOyzs=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=mDGYH0SEZQaXFXan3F3c7+mZsz2AYE+9ErXoVa9svWA23tm+OUU+f+lISDguvBMoG GEuPRQrf11DKyL1zct9jVsgP7lXO6Z+GmSj5iXooxXTjm87Es+FSYyCMUWGjeI4gW1 TAyrngbYgQN6A5GsibRuXotyG6BwstajPIMV7JeM= Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030125303eucas1p183ce8b5a76aef40aa59f2909e00fc9ba~yWi8cnZM31980419804eucas1p1B; Mon, 30 Oct 2017 12:53:03 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 4E.A0.12743.FA027F95; Mon, 30 Oct 2017 12:53:03 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030125302eucas1p2463668779041a5060bd83b48d0fcd5cd~yWi70zJQe2514525145eucas1p2P; Mon, 30 Oct 2017 12:53:02 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d0000031c7-49-59f720af290c Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 7F.3E.18832.EA027F95; Mon, 30 Oct 2017 12:53:02 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYM00KSTZS0IK10@eusync2.samsung.com>; Mon, 30 Oct 2017 12:53:02 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 30 Oct 2017 15:52:39 +0300 Message-id: <1509367961-7172-3-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509367961-7172-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djP87rrFb5HGtw7zG+x+henRUv/TGaL aZ9vs1tcaf/JbrHx4VlWixU3TjFazP30nNHi9dF/zA4cHov3vGTyeHbzP6NH35ZVjAHMUVw2 Kak5mWWpRfp2CVwZe88sZy3YxVlxZOs7pgbGrexdjBwcEgImEq87nLoYOYFMMYkL99azdTFy cQgJLGWUWHR/JSuE85lRYtey6SwQVSYSMy6dZYRILGOUWN0wiRnCaWaSOLdtPhtIFZuAjsSp 1UcYQWwRAWmJ171vwEYxC2xnkth85xRYkbCAq0TrljlgRSwCqhK3dv5jBrF5geI7pu1ghlgn J3HzXCeYzSngJrF58xcmkEESAh1sErtnXmeFKHKReLRuGdR9whKvjm9hh7BlJDo7DkI1NDNK NKy6xAjhTGCU+NK8nAmiyl7i1M2rYDazAJ/EpG3TmSFBwyvR0SYEYXpI7P6bBVHtKLFv1lN2 iJdnMkp82H2fbQKj9AJGhlWMIqmlxbnpqcWmesWJucWleel6yfm5mxiBMXr63/GvOxiXHrM6 xCjAwajEw+sg8j1SiDWxrLgy9xCjBAezkgjvoxvfIoV4UxIrq1KL8uOLSnNSiw8xSnOwKInz 2ka1RQoJpCeWpGanphakFsFkmTg4pRoYS3hPvNp4tjnmreuHrufLJi34Uz/zwwzLUi+FyQe8 29dIpwmklayOtFSzYvs+tXNv6P7k7859Gr/YmjknmmbvPHJ+kdqy3bF6DJP+9DbOEwk89dLh XmWS2NHvkRtmcqjNPnLPkKmA/dGJWQuX/u6fyPFrw663L+8/CTt+ZueD1Xxn2qZd3u5z8YQS S3FGoqEWc1FxIgAIVeyTzQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Fd11Ct8jDXZvMLJY/YvToqV/JrPF tM+32S2utP9kt9j48CyrxYobpxgt5n56zmjx+ug/ZgcOj8V7XjJ5PLv5n9Gjb8sqxgDmKC6b lNSczLLUIn27BK6MvWeWsxbs4qw4svUdUwPjVvYuRk4OCQETiRmXzjJC2GISF+6tZ+ti5OIQ EljCKHHt8HpGCKeVSWL1+j+sIFVsAjoSp1YfAesQEZCWeN37hhWkiFlgJ5PEw55HYAlhAVeJ 1i1zwGwWAVWJWzv/MYPYvEDxHdN2MEOsk5O4ea4TzOYUcJPYvPkLE4gtBFTT/eYY8wRG3gWM DKsYRVJLi3PTc4sN9YoTc4tL89L1kvNzNzECg2nbsZ+bdzBe2hh8iFGAg1GJh/dG7rdIIdbE suLK3EOMEhzMSiK8j24AhXhTEiurUovy44tKc1KLDzFKc7AoifP27lkdKSSQnliSmp2aWpBa BJNl4uCUamBk5av/GvRQwjXh2cb2hvKPGj8FTVP+1x1+eIdZhbtqtuWbFacrFBxvuJyZYOKU 8WXri6ssmzebb+p2OK+h0n7ZWIKXq3MOl14YY+vjOQpL3it8S1kz+yU/Q1pngaFbS3bmy5nX b7c+cHjOtoSN6/qckElLpxxpYo1VrWrtUGaZup5v7hMmTnYlluKMREMt5qLiRADKEyK1IgIA AA== X-CMS-MailID: 20171030125302eucas1p2463668779041a5060bd83b48d0fcd5cd X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030125302eucas1p2463668779041a5060bd83b48d0fcd5cd X-RootMTR: 20171030125302eucas1p2463668779041a5060bd83b48d0fcd5cd References: <1509367961-7172-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 Subject: [ovs-dev] [PATCH 2/4] netdev-dpdk: Fix dpdk_mp leak in case of EEXIST. 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 CC: Robert Wojciechowicz CC: Antonio Fischetti Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.") Fixes: b6b26021d2e2 ("netdev-dpdk: fix management of pre-existing mempools.") Signed-off-by: Ilya Maximets Acked-by: Antonio Fischetti --- lib/netdev-dpdk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 1e9d78f..ba6add2 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -649,6 +649,12 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk *dev) * Update dev with the new values. */ dev->mtu = dev->requested_mtu; dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu); + /* 'mp' should contain pointer to the mempool already owned by netdev. + * Otherwise something went completely wrong. */ + ovs_assert(dev->dpdk_mp); + ovs_assert(dev->dpdk_mp->mp == mp->mp); + /* Free the returned struct dpdk_mp because it will not be used. */ + rte_free(mp); return EEXIST; } else { /* A new mempool was created, release the previous one. */ From patchwork Mon Oct 30 12:52:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 832020 X-Patchwork-Delegate: ian.stokes@intel.com 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="b73rgm6T"; 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 3yQZFT3RdQz9s82 for ; Mon, 30 Oct 2017 23:54:53 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2688DB08; Mon, 30 Oct 2017 12:53:13 +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 576F4AF5 for ; Mon, 30 Oct 2017 12:53:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 29D1C175 for ; Mon, 30 Oct 2017 12:53:11 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171030125308euoutp0296d3caed583d04473f0ae6061278859e~yWjBJLr9Y1015810158euoutp022; Mon, 30 Oct 2017 12:53:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171030125308euoutp0296d3caed583d04473f0ae6061278859e~yWjBJLr9Y1015810158euoutp022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509367988; bh=ti/zs2i8JmuKqqaetSMzIKMipVAt7E9UphK/4pSmk/o=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=b73rgm6TrsQq2a5//Xu4d6nVCgge4v/+CIZlc2TWLW3zJ9/MNvnPBpvptRXl3DC0C a7YmFmbE7Cp74aG+1RQE0MBzeV9ggQmjnMqRZoznbuz8nJgaoZkF1SQKnlZAln4V5r k1SF2YLG5iIymQisopNHeVQlepoduP5jGNgCIkiI= Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030125307eucas1p2f06c8db51fcabb1671a6a5cf481d6479~yWjAVyRvo2231922319eucas1p2e; Mon, 30 Oct 2017 12:53:07 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 17.D8.12867.3B027F95; Mon, 30 Oct 2017 12:53:07 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030125306eucas1p23da490f4faf18aa64ac64d0cad9e0049~yWi-jt3Cf1895918959eucas1p2d; Mon, 30 Oct 2017 12:53:06 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-2a-59f720b311b8 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D2.8F.20118.2B027F95; Mon, 30 Oct 2017 12:53:06 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYM00KSTZS0IK10@eusync2.samsung.com>; Mon, 30 Oct 2017 12:53:06 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 30 Oct 2017 15:52:40 +0300 Message-id: <1509367961-7172-4-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509367961-7172-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsWy7djPc7qbFb5HGvycI2Wx+henRUv/TGaL aZ9vs1tcaf/JbrHx4VlWixU3TjFazP30nNHi9dF/zA4cHov3vGTyeHbzP6NH35ZVjAHMUVw2 Kak5mWWpRfp2CVwZVz5tZiyYl16xau4JpgbGHvcuRk4OCQETicadu1ghbDGJC/fWs3UxcnEI CSxllHj04SEThPOZUaJpQQ87TMfFB3NZIRLLGCU6D92EamlmkpjXO5UFpIpNQEfi1OojjCC2 iIC0xOveN2AdzALbmSQ23znFBpIQFrCRaP/5hBnEZhFQlXi7dz5YA6+Aq8TFlyeYIdbJSdw8 1wlmcwq4SWze/AXsJgmBDjaJr2sfMUIUuUjcfb6HCcIWlnh1fAvUrTISlyd3s0A0NDNKNKy6 xAjhTGCU+NK8HKrDXuLUzatgNrMAn8SkbdOB1nEAxXklOtqEIEo8JM5OW8wCYTtKbH6+lQXi 55mMEu039zBNYJRewMiwilEktbQ4Nz212FivODG3uDQvXS85P3cTIzBOT/87/mkH49cTVocY BTgYlXh4b+R+ixRiTSwrrsw9xCjBwawkwvvoBlCINyWxsiq1KD++qDQntfgQozQHi5I4r21U W6SQQHpiSWp2ampBahFMlomDU6qBMWjehRNvvqTYrVu9YUe6y82LPaW2d9R71Fc2KSl/83l2 UWPz2gP3jn/JnHos8eorzpV99/l/+M7jfT/f4vreMCOG6RJzgnbcOdH/6b2XelbH1GjjnyGP Dju1zPYtq+TRyrh82OluGNvi2SF+D4sCVgddVrSNye/5Ys0vKWVVsGjN2vAQxX2Nl5VYijMS DbWYi4oTAVynGtfPAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Fd1NCt8jDa5sMrJY/YvToqV/JrPF tM+32S2utP9kt9j48CyrxYobpxgt5n56zmjx+ug/ZgcOj8V7XjJ5PLv5n9Gjb8sqxgDmKC6b lNSczLLUIn27BK6MK582MxbMS69YNfcEUwNjj3sXIyeHhICJxMUHc1khbDGJC/fWs3UxcnEI CSxhlHh58AeU08okMWf2XjaQKjYBHYlTq48wgtgiAtISr3vfsIIUMQvsZJJ42PMILCEsYCPR /vMJM4jNIqAq8XbvfLA4r4CrxMWXJ5gh1slJ3DzXCWZzCrhJbN78hQnEFgKq6X5zjHkCI+8C RoZVjCKppcW56bnFRnrFibnFpXnpesn5uZsYgcG07djPLTsYu94FH2IU4GBU4uG9kfstUog1 say4MvcQowQHs5II76MbQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8vXtWRwoJpCeWpGanphak FsFkmTg4pRoY7VoCtR/+19q26Vv8Duao7ztu21+f2Kd9Q3Cmu3T4HpW9bQv5tec4nl9u7NXM dkzltpLqqzpzpzPGT0w+H7y0tuSR6u1uFaVqr3PO4Xo9X53u1rDc/31q08fDsnx8TtcNlv98 yuqpKpQ4Xa6c/UGmebvE+sgU/qz6iL0GhdOtGnJm97pfMFBVYinOSDTUYi4qTgQAFH6+aiIC AAA= X-CMS-MailID: 20171030125306eucas1p23da490f4faf18aa64ac64d0cad9e0049 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030125306eucas1p23da490f4faf18aa64ac64d0cad9e0049 X-RootMTR: 20171030125306eucas1p23da490f4faf18aa64ac64d0cad9e0049 References: <1509367961-7172-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 Subject: [ovs-dev] [PATCH 3/4] netdev-dpdk: Factor out struct dpdk_mp. 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 Since commit d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port."), struct dpdk_mp is redundant because each mempool can be used by single port only and this port already contains all the information we store in dpdk_mp. There is no need to duplicate the information. Fields of this structure currently used only to generate mempool name. But it's required only while creation and after that we can use mp->name directly from the struct rte_mempool. Let's remove this structure and use struct rte_mempool directly instead. Signed-off-by: Ilya Maximets --- lib/netdev-dpdk.c | 190 +++++++++++++++++++----------------------------------- 1 file changed, 65 insertions(+), 125 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ba6add2..cdb3244 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -303,15 +303,6 @@ static struct ovs_list dpdk_list OVS_GUARDED_BY(dpdk_mutex) static struct ovs_mutex dpdk_mp_mutex OVS_ACQ_AFTER(dpdk_mutex) = OVS_MUTEX_INITIALIZER; -struct dpdk_mp { - struct rte_mempool *mp; - int mtu; - int socket_id; - char if_name[IFNAMSIZ]; - unsigned n_mbufs; /* Number of mbufs inside the mempool. */ - struct ovs_list list_node OVS_GUARDED_BY(dpdk_mp_mutex); -}; - /* There should be one 'struct dpdk_tx_queue' created for * each cpu core. */ struct dpdk_tx_queue { @@ -359,7 +350,7 @@ struct netdev_dpdk { struct ovs_mutex mutex OVS_ACQ_AFTER(dpdk_mutex); - struct dpdk_mp *dpdk_mp; + struct rte_mempool *mp; int mtu; int socket_id; int buf_size; @@ -490,38 +481,18 @@ ovs_rte_pktmbuf_init(struct rte_mempool *mp OVS_UNUSED, dp_packet_init_dpdk((struct dp_packet *) pkt, pkt->buf_len); } -/* - * Full DPDK memory pool name must be unique - * and cannot be longer than RTE_MEMPOOL_NAMESIZE - */ -static char * -dpdk_mp_name(struct dpdk_mp *dmp) -{ - uint32_t h = hash_string(dmp->if_name, 0); - char *mp_name = xcalloc(RTE_MEMPOOL_NAMESIZE, sizeof *mp_name); - int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u", - h, dmp->socket_id, dmp->mtu, dmp->n_mbufs); - if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) { - VLOG_DBG("snprintf returned %d. Failed to generate a mempool " - "name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.", - ret, dmp->if_name, h, dmp->mtu, dmp->n_mbufs); - free(mp_name); - return NULL; - } - return mp_name; -} - -static struct dpdk_mp * -dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists) +/* Returns a valid pointer when either of the following is true: + * - a new mempool was just created; + * - a matching mempool already exists. */ +static struct rte_mempool * +dpdk_mp_create(struct netdev_dpdk *dev, int mtu) { - struct dpdk_mp *dmp = dpdk_rte_mzalloc(sizeof *dmp); - if (!dmp) { - return NULL; - } - *mp_exists = false; - dmp->socket_id = dev->requested_socket_id; - dmp->mtu = mtu; - ovs_strzcpy(dmp->if_name, dev->up.name, IFNAMSIZ); + char mp_name[RTE_MEMPOOL_NAMESIZE]; + const char *netdev_name = netdev_get_name(&dev->up); + int socket_id = dev->requested_socket_id; + uint32_t n_mbufs; + uint32_t hash = hash_string(netdev_name, 0); + struct rte_mempool *mp = NULL; /* * XXX: rough estimation of number of mbufs required for this port: @@ -530,95 +501,72 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists) * + * + */ - dmp->n_mbufs = dev->requested_n_rxq * dev->requested_rxq_size - + dev->requested_n_txq * dev->requested_txq_size - + MIN(RTE_MAX_LCORE, dev->requested_n_rxq) * NETDEV_MAX_BURST - + MIN_NB_MBUF; + n_mbufs = dev->requested_n_rxq * dev->requested_rxq_size + + dev->requested_n_txq * dev->requested_txq_size + + MIN(RTE_MAX_LCORE, dev->requested_n_rxq) * NETDEV_MAX_BURST + + MIN_NB_MBUF; + ovs_mutex_lock(&dpdk_mp_mutex); do { - char *mp_name = dpdk_mp_name(dmp); - if (!mp_name) { - rte_free(dmp); - return NULL; + /* 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", + hash, socket_id, mtu, n_mbufs); + if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) { + VLOG_DBG("snprintf returned %d. " + "Failed to generate a mempool name for \"%s\". " + "Hash:0x%x, socket_id: %d, mtu:%d, mbufs:%u.", + ret, netdev_name, hash, socket_id, mtu, n_mbufs); + break; } VLOG_DBG("Port %s: Requesting a mempool of %u mbufs " "on socket %d for %d Rx and %d Tx queues.", - dev->up.name, dmp->n_mbufs, - dev->requested_socket_id, + netdev_name, n_mbufs, socket_id, dev->requested_n_rxq, dev->requested_n_txq); - dmp->mp = rte_pktmbuf_pool_create(mp_name, dmp->n_mbufs, - MP_CACHE_SZ, - sizeof (struct dp_packet) - - sizeof (struct rte_mbuf), - MBUF_SIZE(mtu) - - sizeof(struct dp_packet), - dmp->socket_id); - if (dmp->mp) { - VLOG_DBG("Allocated \"%s\" mempool with %u mbufs", mp_name, - dmp->n_mbufs); + mp = rte_pktmbuf_pool_create(mp_name, n_mbufs, MP_CACHE_SZ, + sizeof (struct dp_packet) - sizeof (struct rte_mbuf), + MBUF_SIZE(mtu) - sizeof(struct dp_packet), socket_id); + + if (mp) { + VLOG_DBG("Allocated \"%s\" mempool with %u mbufs", + mp_name, n_mbufs); /* rte_pktmbuf_pool_create has done some initialization of the * rte_mbuf part of each dp_packet. Some OvS specific fields * of the packet still need to be initialized by * ovs_rte_pktmbuf_init. */ - rte_mempool_obj_iter(dmp->mp, ovs_rte_pktmbuf_init, NULL); + rte_mempool_obj_iter(mp, ovs_rte_pktmbuf_init, NULL); } else if (rte_errno == EEXIST) { /* A mempool with the same name already exists. We just * retrieve its pointer to be returned to the caller. */ - dmp->mp = rte_mempool_lookup(mp_name); - VLOG_DBG("A mempool with name %s already exists at %p.", - mp_name, dmp->mp); + mp = rte_mempool_lookup(mp_name); /* As the mempool create returned EEXIST we can expect the * lookup has returned a valid pointer. If for some reason * that's not the case we keep track of it. */ - *mp_exists = true; + VLOG_DBG("A mempool with name \"%s\" already exists at %p.", + mp_name, mp); } else { VLOG_ERR("Failed mempool \"%s\" create request of %u mbufs", - mp_name, dmp->n_mbufs); - } - free(mp_name); - if (dmp->mp) { - return dmp; + mp_name, n_mbufs); } - } while (!(*mp_exists) && - (rte_errno == ENOMEM && (dmp->n_mbufs /= 2) >= MIN_NB_MBUF)); + } while (!mp && rte_errno == ENOMEM && (n_mbufs /= 2) >= MIN_NB_MBUF); - rte_free(dmp); - return NULL; -} - -/* Returns a valid pointer when either of the following is true: - * - a new mempool was just created; - * - a matching mempool already exists. */ -static struct dpdk_mp * -dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool *mp_exists) -{ - struct dpdk_mp *dmp; - - ovs_mutex_lock(&dpdk_mp_mutex); - dmp = dpdk_mp_create(dev, mtu, mp_exists); ovs_mutex_unlock(&dpdk_mp_mutex); - - return dmp; + return mp; } /* Release an existing mempool. */ static void -dpdk_mp_free(struct dpdk_mp *dmp) +dpdk_mp_free(struct rte_mempool *mp) { - char *mp_name; - - if (!dmp) { + if (!mp) { return; } ovs_mutex_lock(&dpdk_mp_mutex); - mp_name = dpdk_mp_name(dmp); - VLOG_DBG("Releasing \"%s\" mempool", mp_name); - free(mp_name); - rte_mempool_free(dmp->mp); - rte_free(dmp); + VLOG_DBG("Releasing \"%s\" mempool", mp->name); + rte_mempool_free(mp); ovs_mutex_unlock(&dpdk_mp_mutex); } @@ -633,39 +581,32 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk *dev) OVS_REQUIRES(dev->mutex) { uint32_t buf_size = dpdk_buf_size(dev->requested_mtu); - struct dpdk_mp *mp; - bool mp_exists; + struct rte_mempool *mp; + int ret = 0; - mp = dpdk_mp_get(dev, FRAME_LEN_TO_MTU(buf_size), &mp_exists); + mp = dpdk_mp_create(dev, FRAME_LEN_TO_MTU(buf_size)); if (!mp) { VLOG_ERR("Failed to create memory pool for netdev " "%s, with MTU %d on socket %d: %s\n", dev->up.name, dev->requested_mtu, dev->requested_socket_id, rte_strerror(rte_errno)); - return rte_errno; - } else if (mp_exists) { - /* If a new MTU was requested and its rounded value equals the one - * that is currently used, then the existing mempool is returned. - * Update dev with the new values. */ - dev->mtu = dev->requested_mtu; - dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu); - /* 'mp' should contain pointer to the mempool already owned by netdev. - * Otherwise something went completely wrong. */ - ovs_assert(dev->dpdk_mp); - ovs_assert(dev->dpdk_mp->mp == mp->mp); - /* Free the returned struct dpdk_mp because it will not be used. */ - rte_free(mp); - return EEXIST; + ret = rte_errno; } else { - /* A new mempool was created, release the previous one. */ - dpdk_mp_free(dev->dpdk_mp); - dev->dpdk_mp = mp; + /* If a new MTU was requested and its rounded value equals the one + * that is currently used, then the existing mempool is returned. */ + if (dev->mp != mp) { + /* A new mempool was created, release the previous one. */ + dpdk_mp_free(dev->mp); + } else { + ret = EEXIST; + } + dev->mp = mp; dev->mtu = dev->requested_mtu; dev->socket_id = dev->requested_socket_id; dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu); } - return 0; + return ret; } static void @@ -771,8 +712,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq) for (i = 0; i < n_rxq; i++) { diag = rte_eth_rx_queue_setup(dev->port_id, i, dev->rxq_size, - dev->socket_id, NULL, - dev->dpdk_mp->mp); + dev->socket_id, NULL, dev->mp); if (diag) { VLOG_INFO("Interface %s rxq(%d) setup error: %s", dev->up.name, i, rte_strerror(-diag)); @@ -856,7 +796,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) memcpy(dev->hwaddr.ea, eth_addr.addr_bytes, ETH_ADDR_LEN); rte_eth_link_get_nowait(dev->port_id, &dev->link); - mbp_priv = rte_mempool_get_priv(dev->dpdk_mp->mp); + mbp_priv = rte_mempool_get_priv(dev->mp); dev->buf_size = mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM; /* Get the Flow control configuration for DPDK-ETH */ @@ -1103,7 +1043,7 @@ common_destruct(struct netdev_dpdk *dev) OVS_EXCLUDED(dev->mutex) { rte_free(dev->tx_q); - dpdk_mp_free(dev->dpdk_mp); + dpdk_mp_free(dev->mp); ovs_list_remove(&dev->list_node); free(ovsrcu_get_protected(struct ingress_policer *, @@ -1678,7 +1618,7 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq, nb_rx = rte_vhost_dequeue_burst(netdev_dpdk_get_vid(dev), qid * VIRTIO_QNUM + VIRTIO_TXQ, - dev->dpdk_mp->mp, + dev->mp, (struct rte_mbuf **) batch->packets, NETDEV_MAX_BURST); if (!nb_rx) { @@ -1900,7 +1840,7 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch) continue; } - pkts[txcnt] = rte_pktmbuf_alloc(dev->dpdk_mp->mp); + pkts[txcnt] = rte_pktmbuf_alloc(dev->mp); if (OVS_UNLIKELY(!pkts[txcnt])) { dropped += cnt - i; break; From patchwork Mon Oct 30 12:52:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 832021 X-Patchwork-Delegate: ian.stokes@intel.com 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="cnmkKR7/"; 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 3yQZGL5x13z9s82 for ; Mon, 30 Oct 2017 23:55:38 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 45508BA2; Mon, 30 Oct 2017 12:53:16 +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 6B1E5B0B for ; Mon, 30 Oct 2017 12:53:15 +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 13C98175 for ; Mon, 30 Oct 2017 12:53:15 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171030125312euoutp015ef201a7d1c88c35e7a2b1bdd37b9943~yWjE7_4Z42435424354euoutp01Y; Mon, 30 Oct 2017 12:53:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171030125312euoutp015ef201a7d1c88c35e7a2b1bdd37b9943~yWjE7_4Z42435424354euoutp01Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509367992; bh=HlHYNlTijjkn7yYQYy1wJw7fh0jhkXLFVz3/t68ouQ0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=cnmkKR7/zi10GUQYdOirBmGRWfsfl6OytiVWIfebdGx3Zvgnl9Xh74H3FmH5F9dcV IjRif50Wl2BGpNtD0zAW0L9lFZMhPBkEXlVZr8xycS+Jtkd5xmNgL7WZMy9lBgo0CD 4+dVmWjsPBgsuFjL2FlehhXFWN9oalr59vRzfHe4= Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030125311eucas1p16e4f9e6ee5c02fe1263a4ca9c6ee325f~yWjERxCLN2288722887eucas1p1w; Mon, 30 Oct 2017 12:53:11 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 25.D0.12576.7B027F95; Mon, 30 Oct 2017 12:53:11 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030125311eucas1p2ae668a43a2dffbde9274d3c585f31b89~yWjDgU3MA1896718967eucas1p29; Mon, 30 Oct 2017 12:53:11 +0000 (GMT) X-AuditID: cbfec7ef-f79ee6d000003120-16-59f720b7d493 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 36.8F.20118.6B027F95; Mon, 30 Oct 2017 12:53:10 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYM00KSTZS0IK10@eusync2.samsung.com>; Mon, 30 Oct 2017 12:53:10 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 30 Oct 2017 15:52:41 +0300 Message-id: <1509367961-7172-5-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509367961-7172-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsWy7djP87rbFb5HGsz9qWGx+henRUv/TGaL aZ9vs1tcaf/JbrHx4VlWixU3TjFazP30nNHi9dF/zA4cHov3vGTyeHbzP6NH35ZVjAHMUVw2 Kak5mWWpRfp2CVwZ/VtvsxX84q349OwQWwPjfO4uRk4OCQETieVf/zBD2GISF+6tZ+ti5OIQ EljGKHHnwTxmCOczo8TjrZuYYDqefG5DqDrXOh3KaWaSmLRxDSNIFZuAjsSp1UfAbBEBaYnX vW9YQYqYBbYzSWy+c4oNJCEsYCPx+ONEVhCbRUBV4sOdZWAreAVcJS4tWQF1lJzEzXOdYDan gJvE5s1fmEAGSQh0sEm8mPAKqshF4uTa66wQtrDEq+Nb2CFsGYnLk7tZIBqaGSUaVl1ihHAm MEp8aV4O9ZG9xKmbV8FsZgE+iUnbpgNN5QCK80p0tAlBlHhIHGk/B1XuKPH67WFoyMxklNg4 8RjbBEbpBYwMqxhFUkuLc9NTiw31ihNzi0vz0vWS83M3MQLj9PS/4+93MD5tDjnEKMDBqMTD eyP3W6QQa2JZcWXuIUYJDmYlEd5HN4BCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeW2j2iKFBNIT S1KzU1MLUotgskwcnFINjKz1i/x6T5tkKu+pssgvi5S00cgWNd7Vs4p/0ZL9R3zy6+T+h0zd OFHrueykOzN5CpJym6dY1d8q9vBOzZhzfGkQf/eiTS+qTAq6Hz/Ksg18fuyO67TQbN/yQpnF +rILKhJZpx4wueqzN/Ps3wf/Gb2OdD+cEmy97/eyCet4p9t7urRwtr1+q8RSnJFoqMVcVJwI AMG/EtHPAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Fd1tCt8jDc7d0LNY/YvToqV/JrPF tM+32S2utP9kt9j48CyrxYobpxgt5n56zmjx+ug/ZgcOj8V7XjJ5PLv5n9Gjb8sqxgDmKC6b lNSczLLUIn27BK6M/q232Qp+8VZ8enaIrYFxPncXIyeHhICJxJPPbWwQtpjEhXvrgWwuDiGB JYwSj9a8YoRwWpkkDj1YywRSxSagI3Fq9RFGEFtEQFride8bVpAiZoGdTBIPex6BJYQFbCQe f5zICmKzCKhKfLizDKyZV8BV4tKSFcwQ6+Qkbp7rBLM5BdwkNm/+AlYjBFTT/eYY8wRG3gWM DKsYRVJLi3PTc4uN9IoTc4tL89L1kvNzNzECg2nbsZ9bdjB2vQs+xCjAwajEw3sj91ukEGti WXFl7iFGCQ5mJRHeRzeAQrwpiZVVqUX58UWlOanFhxilOViUxHl796yOFBJITyxJzU5NLUgt gskycXBKNTC2Gb+c2Hc3tXpZZubjtR+ajj9ws2mJzj+5ZzNXoNvv6+3cq2bMmzwjdIeuL8s3 45rVGy+XabZF6b9cZzOvTcqSoSvhjPOmU23TnATsZiu4XA9iS9P/uLGybHPKQ78nPzMPLpv2 ftP+Jx4CuxTTVaXnbVh67IT1qpYL3+0vzwoK9Toobrt86x5nJZbijERDLeai4kQAIANOOSIC AAA= X-CMS-MailID: 20171030125311eucas1p2ae668a43a2dffbde9274d3c585f31b89 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030125311eucas1p2ae668a43a2dffbde9274d3c585f31b89 X-RootMTR: 20171030125311eucas1p2ae668a43a2dffbde9274d3c585f31b89 References: <1509367961-7172-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 Subject: [ovs-dev] [PATCH 4/4] netdev-dpdk: Remove unused MAX_NB_MBUF. 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 CC: Robert Wojciechowicz Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.") Signed-off-by: Ilya Maximets Acked-by: Antonio Fischetti --- lib/netdev-dpdk.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index cdb3244..0b40966 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -89,23 +89,13 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); #define NETDEV_DPDK_MBUF_ALIGN 1024 #define NETDEV_DPDK_MAX_PKT_LEN 9728 -/* Max and min number of packets in the mempool. OVS tries to allocate a - * mempool with MAX_NB_MBUF: if this fails (because the system doesn't have - * enough hugepages) we keep halving the number until the allocation succeeds - * or we reach MIN_NB_MBUF */ - -#define MAX_NB_MBUF (4096 * 64) +/* Min number of packets in the mempool. OVS tries to allocate a mempool with + * roughly estimated number of mbufs: if this fails (because the system doesn't + * have enough hugepages) we keep halving the number until the allocation + * succeeds or we reach MIN_NB_MBUF */ #define MIN_NB_MBUF (4096 * 4) #define MP_CACHE_SZ RTE_MEMPOOL_CACHE_MAX_SIZE -/* MAX_NB_MBUF can be divided by 2 many times, until MIN_NB_MBUF */ -BUILD_ASSERT_DECL(MAX_NB_MBUF % ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF) == 0); - -/* The smallest possible NB_MBUF that we're going to try should be a multiple - * of MP_CACHE_SZ. This is advised by DPDK documentation. */ -BUILD_ASSERT_DECL((MAX_NB_MBUF / ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF)) - % MP_CACHE_SZ == 0); - /* * DPDK XSTATS Counter names definition */