From e99fdaa7a3d30f2e494194b09786a02235887964 Mon Sep 17 00:00:00 2001 From: Alexander Kozyrev Date: Thu, 30 Jan 2020 18:14:37 +0200 Subject: [PATCH] net/mlx4: remove NDEBUG flag Use the RTE_LIBRTE_MLX4_DEBUG compilation 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 MLX4 driver. Signed-off-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx4/Makefile | 4 ++-- drivers/net/mlx4/meson.build | 4 ++-- drivers/net/mlx4/mlx4.c | 4 ++-- drivers/net/mlx4/mlx4_mr.c | 8 ++++---- drivers/net/mlx4/mlx4_rxtx.c | 10 +++++----- drivers/net/mlx4/mlx4_utils.h | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile index 329569dc10..c5543ed3da 100644 --- a/drivers/net/mlx4/Makefile +++ b/drivers/net/mlx4/Makefile @@ -65,13 +65,13 @@ endif # User-defined CFLAGS. ifeq ($(CONFIG_RTE_LIBRTE_MLX4_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/mlx4/meson.build b/drivers/net/mlx4/meson.build index 9eb4988420..0260c5dc59 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -67,9 +67,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 # mlx4_autoconf.h file is still generated. diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index ab5e6c66cb..122d37c7f9 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -305,7 +305,7 @@ mlx4_dev_start(struct rte_eth_dev *dev) (void *)dev, strerror(-ret)); goto err; } -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG mlx4_mr_dump_dev(dev); #endif ret = mlx4_rxq_intr_enable(priv); @@ -1305,7 +1305,7 @@ RTE_INIT(rte_mlx4_pmd_init) return; assert(mlx4_glue); #endif -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG /* Glue structure must not contain any NULL pointers. */ { unsigned int i; diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c index 470cee06be..4b2e8fe6c9 100644 --- a/drivers/net/mlx4/mlx4_mr.c +++ b/drivers/net/mlx4/mlx4_mr.c @@ -242,7 +242,7 @@ mlx4_mr_btree_free(struct mlx4_mr_btree *bt) memset(bt, 0, sizeof(*bt)); } -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG /** * Dump all the entries in a B-tree * @@ -962,7 +962,7 @@ mlx4_mr_mem_event_free_cb(struct rte_eth_dev *dev, const void *addr, size_t len) rte_smp_wmb(); } rte_rwlock_write_unlock(&priv->mr.rwlock); -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG if (rebuild) mlx4_mr_dump_dev(dev); #endif @@ -1380,7 +1380,7 @@ mlx4_mr_update_mp(struct rte_eth_dev *dev, struct mlx4_mr_ctrl *mr_ctrl, return data.ret; } -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG /** * Dump all the created MRs and the global cache entries. * @@ -1440,7 +1440,7 @@ mlx4_mr_release(struct rte_eth_dev *dev) rte_rwlock_write_lock(&mlx4_shared_data->mem_event_rwlock); LIST_REMOVE(priv, mem_event_cb); rte_rwlock_write_unlock(&mlx4_shared_data->mem_event_rwlock); -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG mlx4_mr_dump_dev(dev); #endif rte_rwlock_write_lock(&priv->mr.rwlock); diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index 4dc0adb938..b56436e886 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -321,7 +321,7 @@ mlx4_txq_complete(struct txq *txq, const unsigned int elts_m, if (unlikely(!!(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK) ^ !!(cons_index & cq->cqe_cnt))) break; -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG /* * Make sure we read the CQE after we read the ownership bit. */ @@ -336,7 +336,7 @@ mlx4_txq_complete(struct txq *txq, const unsigned int elts_m, cqe_err->syndrome); break; } -#endif /* NDEBUG */ +#endif /* RTE_LIBRTE_MLX4_DEBUG */ cons_index++; } while (1); completed = (cons_index - cq->cons_index) * txq->elts_comp_cd_init; @@ -488,14 +488,14 @@ mlx4_tx_burst_fill_tso_dsegs(struct rte_mbuf *buf, ((uintptr_t)dseg & (MLX4_TXBB_SIZE - 1))) >> MLX4_SEG_SHIFT; switch (nb_segs_txbb) { -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG default: /* Should never happen. */ rte_panic("%p: Invalid number of SGEs(%d) for a TXBB", (void *)txq, nb_segs_txbb); /* rte_panic never returns. */ break; -#endif /* NDEBUG */ +#endif /* RTE_LIBRTE_MLX4_DEBUG */ case 4: /* Memory region key for this memory pool. */ lkey = mlx4_tx_mb2mr(txq, sbuf); @@ -922,7 +922,7 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) if (likely(elt->buf != NULL)) { struct rte_mbuf *tmp = elt->buf; -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG /* Poisoning. */ memset(&elt->buf, 0x66, sizeof(struct rte_mbuf *)); #endif diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h index 5718b9c742..a84a9ab6f7 100644 --- a/drivers/net/mlx4/mlx4_utils.h +++ b/drivers/net/mlx4/mlx4_utils.h @@ -27,10 +27,10 @@ extern int mlx4_logtype; -#ifndef NDEBUG +#ifdef RTE_LIBRTE_MLX4_DEBUG /* - * When debugging is enabled (NDEBUG not defined), file, line and function + * When debugging is enabled (MLX4_DEBUG is defined), file, line and function * information replace the driver name (MLX4_DRIVER_NAME) in log messages. */ @@ -56,7 +56,7 @@ pmd_drv_log_basename(const char *s) #define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__) #define claim_zero(...) assert((__VA_ARGS__) == 0) -#else /* NDEBUG */ +#else /* RTE_LIBRTE_MLX4_DEBUG */ /* * Like assert(), DEBUG() becomes a no-op and claim_zero() does not perform @@ -71,7 +71,7 @@ pmd_drv_log_basename(const char *s) #define DEBUG(...) (void)0 #define claim_zero(...) (__VA_ARGS__) -#endif /* NDEBUG */ +#endif /* RTE_LIBRTE_MLX4_DEBUG */ #define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__) #define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__) -- 2.20.1