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 37191A0531; Mon, 27 Jan 2020 15:43:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 62AE91C00D; Mon, 27 Jan 2020 15:42:45 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C00031BFF6 for ; Mon, 27 Jan 2020 15:42:41 +0100 (CET) Received: from Internal Mail-Server by MTLPINE2 (envelope-from akozyrev@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 Jan 2020 16:42:36 +0200 Received: from pegasus02.mtr.labs.mlnx. (pegasus02.mtr.labs.mlnx [10.210.16.122]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00REgZ7r008031; Mon, 27 Jan 2020 16:42:35 +0200 From: Alexander Kozyrev To: dev@dpdk.org Cc: rasland@mellanox.com, matan@mellanox.com, viacheslavo@mellanox.com, ferruh.yigit@intel.com, thomas@monjalon.net Date: Mon, 27 Jan 2020 16:42:32 +0200 Message-Id: <1580136153-84940-5-git-send-email-akozyrev@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1580136153-84940-1-git-send-email-akozyrev@mellanox.com> References: <1579789555-23239-1-git-send-email-akozyrev@mellanox.com> <1580136153-84940-1-git-send-email-akozyrev@mellanox.com> Subject: [dpdk-dev] [PATCH v3 4/5] net/mlx5: use mlx5 debug flag instead of NDEBUG 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 the RTE_LIBRTE_MLX5_DEBUG configuration flag to get rid of dependency on the NDEBUG definition. This is a preparation step to switch from standard assert clauses to DPDK RTE_ASSERT ones in MLX5 driver. Signed-off-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/Makefile | 4 ++-- drivers/net/mlx5/meson.build | 4 ++-- drivers/net/mlx5/mlx5.c | 6 +++--- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- drivers/net/mlx5/mlx5_mr.c | 4 ++-- drivers/net/mlx5/mlx5_nl.c | 2 +- drivers/net/mlx5/mlx5_rxtx.c | 8 ++++---- drivers/net/mlx5/mlx5_rxtx.h | 6 +++--- drivers/net/mlx5/mlx5_txq.c | 2 +- drivers/net/mlx5/mlx5_utils.h | 14 +++++++------- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 0466d9d..1626860 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -85,13 +85,13 @@ endif # User-defined CFLAGS. ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y) -CFLAGS += -pedantic -UNDEBUG +CFLAGS += -pedantic ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) CFLAGS += -DPEDANTIC endif AUTO_CONFIG_CFLAGS += -Wno-pedantic else -CFLAGS += -DNDEBUG -UPEDANTIC +CFLAGS += -UPEDANTIC endif include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 3ad4f02..c7b835b 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -84,9 +84,9 @@ if build endif endforeach if get_option('buildtype').contains('debug') - cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ] + cflags += [ '-pedantic', '-DPEDANTIC' ] else - cflags += [ '-DNDEBUG', '-UPEDANTIC' ] + cflags += [ '-UPEDANTIC' ] endif # To maintain the compatibility with the make build system # mlx5_autoconf.h file is still generated. diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index ffee39c..6c6a66d 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -654,7 +654,7 @@ struct mlx5_flow_id_pool * mlx5_free_shared_ibctx(struct mlx5_ibv_shared *sh) { pthread_mutex_lock(&mlx5_ibv_list_mutex); -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG /* Check the object presence in the list. */ struct mlx5_ibv_shared *lctx; @@ -2612,7 +2612,7 @@ struct mlx5_flow_id_pool * mac.addr_bytes[0], mac.addr_bytes[1], mac.addr_bytes[2], mac.addr_bytes[3], mac.addr_bytes[4], mac.addr_bytes[5]); -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG { char ifname[IF_NAMESIZE]; @@ -3658,7 +3658,7 @@ struct mlx5_flow_id_pool * return; assert(mlx5_glue); #endif -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG /* Glue structure must not contain any NULL pointers. */ { unsigned int i; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 5a1b426..2c0cb43 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5145,7 +5145,7 @@ struct field_modify_info modify_tcp[] = { return dev_flow; } -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG /** * Sanity check for match mask and value. Similar to check_valid_spec() in * kernel driver. If unmasked bit is present in value, it returns failure. diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index 0d549b6..07ce8df 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -240,7 +240,7 @@ struct mr_update_mp_data { void mlx5_mr_btree_dump(struct mlx5_mr_btree *bt __rte_unused) { -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG int idx; struct mlx5_mr_cache *lkp_tbl; @@ -1551,7 +1551,7 @@ struct mr_update_mp_data { void mlx5_mr_dump_dev(struct mlx5_ibv_shared *sh __rte_unused) { -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG struct mlx5_mr *mr; int mr_n = 0; int chunk_n = 0; diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index e7ba034..ce37460 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -356,7 +356,7 @@ struct mlx5_nl_ifindex_data { rte_errno = ENOMEM; return -rte_errno; } -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG char m[18]; rte_ether_format_addr(m, 18, RTA_DATA(attribute)); diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 5e31f01..4b69409 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -2179,11 +2179,11 @@ enum mlx5_txcmp_code { last->cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS << MLX5_COMP_MODE_OFFSET); /* Save elts_head in dedicated free on completion queue. */ -#ifdef NDEBUG - txq->fcqs[txq->cq_pi++ & txq->cqe_m] = head; -#else +#ifdef RTE_LIBRTE_MLX5_DEBUG txq->fcqs[txq->cq_pi++ & txq->cqe_m] = head | - (last->cseg.opcode >> 8) << 16; + (last->cseg.opcode >> 8) << 16; +#else + txq->fcqs[txq->cq_pi++ & txq->cqe_m] = head; #endif /* A CQE slot must always be available. */ assert((txq->cq_pi - txq->cq_ci) <= txq->cqe_s); diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 3f659d2..fe13a03 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -295,10 +295,10 @@ struct mlx5_txq_data { struct mlx5_mr_ctrl mr_ctrl; /* MR control descriptor. */ struct mlx5_wqe *wqes; /* Work queue. */ struct mlx5_wqe *wqes_end; /* Work queue array limit. */ -#ifdef NDEBUG - uint16_t *fcqs; /* Free completion queue. */ -#else +#ifdef RTE_LIBRTE_MLX5_DEBUG uint32_t *fcqs; /* Free completion queue (debug extended). */ +#else + uint16_t *fcqs; /* Free completion queue. */ #endif volatile struct mlx5_cqe *cqes; /* Completion queue. */ volatile uint32_t *qp_db; /* Work queue doorbell. */ diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 1a76f6e..06e5fac 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -82,7 +82,7 @@ assert(elt != NULL); rte_pktmbuf_free_seg(elt); -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG /* Poisoning. */ memset(&(*elts)[elts_tail & elts_m], 0x77, diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h index ebf79b8..5cc0368 100644 --- a/drivers/net/mlx5/mlx5_utils.h +++ b/drivers/net/mlx5/mlx5_utils.h @@ -81,10 +81,10 @@ RTE_FMT_TAIL(__VA_ARGS__,))) /* - * When debugging is enabled (NDEBUG not defined), file, line and function + * When debugging is enabled (MLX5_DEBUG is defined), file, line and function * information replace the driver name (MLX5_DRIVER_NAME) in log messages. */ -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG #define PMD_DRV_LOG__(level, ...) \ PMD_DRV_LOG___(level, "%s:%u: %s(): " __VA_ARGS__) @@ -96,13 +96,13 @@ __func__, \ __VA_ARGS__) -#else /* NDEBUG */ +#else /* RTE_LIBRTE_MLX5_DEBUG */ #define PMD_DRV_LOG__(level, ...) \ PMD_DRV_LOG___(level, __VA_ARGS__) #define PMD_DRV_LOG_(level, s, ...) \ PMD_DRV_LOG__(level, s "\n", __VA_ARGS__) -#endif /* NDEBUG */ +#endif /* RTE_LIBRTE_MLX5_DEBUG */ /* Generic printf()-like logging macro with automatic line feed. */ #define DRV_LOG(level, ...) \ @@ -111,19 +111,19 @@ PMD_DRV_LOG_CPAREN) /* claim_zero() does not perform any check when debugging is disabled. */ -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX5_DEBUG #define DEBUG(...) DRV_LOG(DEBUG, __VA_ARGS__) #define claim_zero(...) assert((__VA_ARGS__) == 0) #define claim_nonzero(...) assert((__VA_ARGS__) != 0) -#else /* NDEBUG */ +#else /* RTE_LIBRTE_MLX5_DEBUG */ #define DEBUG(...) (void)0 #define claim_zero(...) (__VA_ARGS__) #define claim_nonzero(...) (__VA_ARGS__) -#endif /* NDEBUG */ +#endif /* RTE_LIBRTE_MLX5_DEBUG */ #define INFO(...) DRV_LOG(INFO, __VA_ARGS__) #define WARN(...) DRV_LOG(WARNING, __VA_ARGS__) -- 1.8.3.1