From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71708A00C2; Wed, 22 Apr 2020 23:46:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA8611D381; Wed, 22 Apr 2020 23:46:23 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 980F91C437 for ; Wed, 22 Apr 2020 23:46:16 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200422214616euoutp01cf89e54d65c196d1d6e1fc18eaf02ae4~IQn2tAc991855618556euoutp01E for ; Wed, 22 Apr 2020 21:46:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200422214616euoutp01cf89e54d65c196d1d6e1fc18eaf02ae4~IQn2tAc991855618556euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587591976; bh=eaXn8GQn3E8U1fma891erXqgRLPQ6qJioE0YY8JvR+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uifDOoeUYXnl79Fhf1yonbsNCH9PA9JgoCLeOcC7AhGLJdJ26f0NZX2h/4llLDIoc gzfXhShNejxm65fhXPakBUY+UjI1udPVoo2FQ1r47RKEcCnFlwDvAKWaZghqpWJCiD vDSZbeGcVFbP7jXoRHVIxRQlHZMz3oQ1PWAUiFWg= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200422214616eucas1p2d454aeb547e939f2e596066faada9d67~IQn2jEd8u1862618626eucas1p2R; Wed, 22 Apr 2020 21:46:16 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 82.22.60698.72BB0AE5; Wed, 22 Apr 2020 22:46:15 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200422214615eucas1p2a50ce20695a77b5b2888fd4521296094~IQn2C4q9O1865618656eucas1p2E; Wed, 22 Apr 2020 21:46:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200422214615eusmtrp1b6d0b27aacda91bbb0e433296bb66538~IQn2CUlqX3110331103eusmtrp1X; Wed, 22 Apr 2020 21:46:15 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-dc-5ea0bb2700a7 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id FD.7A.08375.72BB0AE5; Wed, 22 Apr 2020 22:46:15 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200422214614eusmtip1c570559530ec4c3b22d1379c1506b61e~IQn1hGxS22464024640eusmtip1D; Wed, 22 Apr 2020 21:46:14 +0000 (GMT) From: Lukasz Wojciechowski To: Olivier Matz , Thomas Monjalon , John McNamara , Marko Kovacevic Cc: dev@dpdk.org Date: Wed, 22 Apr 2020 23:45:55 +0200 Message-Id: <20200422214555.11837-4-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200422214555.11837-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPIsWRmVeSWpSXmKPExsWy7djPc7rquxfEGSzfamPx7tN2Jovz87ay Wpzf2MtqsbVpI5PFpwcnWBxYPS7232H0+LVgKavH4j0vmTyO3ZzGHsASxWWTkpqTWZZapG+X wJWxdR5fwROZimP7ljE2MHZKdDFyckgImEjs+nOKpYuRi0NIYAWjxNRn29kgnC+MEuvX90I5 nxkl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aq cfnDZhaIDfISqzccAItzCrhJnD7awgKxrZFR4vrko0wTGPkWMDKsYhRJLS3OTc8tNtQrTswt Ls1L10vOz93ECAzMbcd+bt7BeGlj8CFGAQ5GJR7eCMUFcUKsiWXFlbmHGCU4mJVEeDc8nBcn xJuSWFmVWpQfX1Sak1p8iNEU6KqJzFKiyfnAqMkriTc0NTS3sDQ0NzY3NrNQEuftEDgYIySQ nliSmp2aWpBaBNPHxMEp1cBYKHdYfa9ooNvfxcvjn6e83iWrZ6p/6P6HqUpH/JJCsu/FXHnJ +2jZ9vg132//bs9lyX2zdL3T4YvxLd8WdaZOkmF65l6342f1X8+sU1MWeWVkRXo3r9jnOXmG RLqp0qLbpSdKHjYfu62skjVH7UVYg3BNf3DTQV9XbuGog8eauO5vyZkxL7BWiaU4I9FQi7mo OBEAAqt6YmICAAA= X-CMS-MailID: 20200422214615eucas1p2a50ce20695a77b5b2888fd4521296094 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200422214615eucas1p2a50ce20695a77b5b2888fd4521296094 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200422214615eucas1p2a50ce20695a77b5b2888fd4521296094 References: <20200417215739.23180-1-l.wojciechow@partner.samsung.com> <20200422214555.11837-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v2 3/3] mbuf: standardize library debug flag 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" Use standardized debug macro RTE_DEBUG_MBUF instead of RTE_LIBRTE_MBUF_DEBUG for wrapping sanity checks. Add runtime control of running sanity checks basing on rte_log_can_log() function. To run mbuf sanity checks all following conditions must occur: 1) RTE_DEBUG_MBUF - must be defined, this can be done by enabling meson rte_debug option or defining CFLAGS="-DRTE_DEBUG_MBUF" 2) global log level must be set to RTE_LOG_DEBUG 3) mbuf library logtype log level (lib.mbuf) must be set to RTE_LOG_DEBUG Tests and documentation were also updated. Signed-off-by: Lukasz Wojciechowski --- app/test/test_mbuf.c | 3 ++- config/common_base | 1 - doc/guides/prog_guide/mbuf_lib.rst | 2 +- lib/librte_mbuf/rte_mbuf.h | 12 ++++++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 8200b4f71..b7b956659 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -994,7 +994,8 @@ test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool) /* * Stress test for rte_mbuf atomic refcnt. * Implies that RTE_MBUF_REFCNT_ATOMIC is defined. - * For more efficiency, recommended to run with RTE_LIBRTE_MBUF_DEBUG defined. + * For more efficiency, recommended to run with RTE_DEBUG_MBUF defined + * or using rte_debug meson build option. */ #ifdef RTE_MBUF_REFCNT_ATOMIC diff --git a/config/common_base b/config/common_base index 38c5ada26..80fa3281f 100644 --- a/config/common_base +++ b/config/common_base @@ -859,7 +859,6 @@ CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL=y # Compile librte_mbuf # CONFIG_RTE_LIBRTE_MBUF=y -CONFIG_RTE_LIBRTE_MBUF_DEBUG=n CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="ring_mp_mc" CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 diff --git a/doc/guides/prog_guide/mbuf_lib.rst b/doc/guides/prog_guide/mbuf_lib.rst index 0d3223b08..d633e9609 100644 --- a/doc/guides/prog_guide/mbuf_lib.rst +++ b/doc/guides/prog_guide/mbuf_lib.rst @@ -243,7 +243,7 @@ can be found in several of the sample applications, for example, the IPv4 Multic Debug ----- -In debug mode (CONFIG_RTE_MBUF_DEBUG is enabled), +In debug mode (RTE_DEBUG_MBUF is enabled, e.g. by using "rte_debug" option during meson build), the functions of the mbuf library perform sanity checks before any operation (such as, buffer corruption, bad type, and so on). Use Cases diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f8e492e59..f27d5e26e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -341,17 +342,20 @@ rte_pktmbuf_priv_flags(struct rte_mempool *mp) #define RTE_MBUF_HAS_PINNED_EXTBUF(mb) \ (rte_pktmbuf_priv_flags(mb->pool) & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) -#ifdef RTE_LIBRTE_MBUF_DEBUG +#ifdef RTE_DEBUG_MBUF /** check mbuf type in debug mode */ -#define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h) +#define __rte_mbuf_sanity_check(m, is_h) do { \ + if (rte_log_can_log(RTE_LOGTYPE_MBUF, RTE_LOG_DEBUG)) \ + rte_mbuf_sanity_check(m, is_h); \ +} while (0) -#else /* RTE_LIBRTE_MBUF_DEBUG */ +#else /* RTE_DEBUG_MBUF */ /** check mbuf type in debug mode */ #define __rte_mbuf_sanity_check(m, is_h) do { } while (0) -#endif /* RTE_LIBRTE_MBUF_DEBUG */ +#endif /* RTE_DEBUG_MBUF */ #ifdef RTE_MBUF_REFCNT_ATOMIC -- 2.17.1