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 <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
# User-defined CFLAGS.
ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DEBUG),y)
# User-defined CFLAGS.
ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DEBUG),y)
-CFLAGS += -pedantic -UNDEBUG
ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
CFLAGS += -DPEDANTIC
endif
AUTO_CONFIG_CFLAGS += -Wno-pedantic
else
ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
CFLAGS += -DPEDANTIC
endif
AUTO_CONFIG_CFLAGS += -Wno-pedantic
else
-CFLAGS += -DNDEBUG -UPEDANTIC
endif
include $(RTE_SDK)/mk/rte.lib.mk
endif
include $(RTE_SDK)/mk/rte.lib.mk
endif
endforeach
if get_option('buildtype').contains('debug')
endif
endforeach
if get_option('buildtype').contains('debug')
- cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+ cflags += [ '-pedantic', '-DPEDANTIC' ]
- cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+ cflags += [ '-UPEDANTIC' ]
endif
# To maintain the compatibility with the make build system
# mlx4_autoconf.h file is still generated.
endif
# To maintain the compatibility with the make build system
# mlx4_autoconf.h file is still generated.
(void *)dev, strerror(-ret));
goto err;
}
(void *)dev, strerror(-ret));
goto err;
}
+#ifdef RTE_LIBRTE_MLX4_DEBUG
mlx4_mr_dump_dev(dev);
#endif
ret = mlx4_rxq_intr_enable(priv);
mlx4_mr_dump_dev(dev);
#endif
ret = mlx4_rxq_intr_enable(priv);
return;
assert(mlx4_glue);
#endif
return;
assert(mlx4_glue);
#endif
+#ifdef RTE_LIBRTE_MLX4_DEBUG
/* Glue structure must not contain any NULL pointers. */
{
unsigned int i;
/* Glue structure must not contain any NULL pointers. */
{
unsigned int i;
memset(bt, 0, sizeof(*bt));
}
memset(bt, 0, sizeof(*bt));
}
+#ifdef RTE_LIBRTE_MLX4_DEBUG
/**
* Dump all the entries in a B-tree
*
/**
* Dump all the entries in a B-tree
*
rte_smp_wmb();
}
rte_rwlock_write_unlock(&priv->mr.rwlock);
rte_smp_wmb();
}
rte_rwlock_write_unlock(&priv->mr.rwlock);
+#ifdef RTE_LIBRTE_MLX4_DEBUG
if (rebuild)
mlx4_mr_dump_dev(dev);
#endif
if (rebuild)
mlx4_mr_dump_dev(dev);
#endif
+#ifdef RTE_LIBRTE_MLX4_DEBUG
/**
* Dump all the created MRs and the global cache entries.
*
/**
* Dump all the created MRs and the global cache entries.
*
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);
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);
+#ifdef RTE_LIBRTE_MLX4_DEBUG
mlx4_mr_dump_dev(dev);
#endif
rte_rwlock_write_lock(&priv->mr.rwlock);
mlx4_mr_dump_dev(dev);
#endif
rte_rwlock_write_lock(&priv->mr.rwlock);
if (unlikely(!!(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK) ^
!!(cons_index & cq->cqe_cnt)))
break;
if (unlikely(!!(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK) ^
!!(cons_index & cq->cqe_cnt)))
break;
+#ifdef RTE_LIBRTE_MLX4_DEBUG
/*
* Make sure we read the CQE after we read the ownership bit.
*/
/*
* Make sure we read the CQE after we read the ownership bit.
*/
cqe_err->syndrome);
break;
}
cqe_err->syndrome);
break;
}
+#endif /* RTE_LIBRTE_MLX4_DEBUG */
cons_index++;
} while (1);
completed = (cons_index - cq->cons_index) * txq->elts_comp_cd_init;
cons_index++;
} while (1);
completed = (cons_index - cq->cons_index) * txq->elts_comp_cd_init;
((uintptr_t)dseg & (MLX4_TXBB_SIZE - 1))) >>
MLX4_SEG_SHIFT;
switch (nb_segs_txbb) {
((uintptr_t)dseg & (MLX4_TXBB_SIZE - 1))) >>
MLX4_SEG_SHIFT;
switch (nb_segs_txbb) {
+#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;
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 /* RTE_LIBRTE_MLX4_DEBUG */
case 4:
/* Memory region key for this memory pool. */
lkey = mlx4_tx_mb2mr(txq, sbuf);
case 4:
/* Memory region key for this memory pool. */
lkey = mlx4_tx_mb2mr(txq, sbuf);
if (likely(elt->buf != NULL)) {
struct rte_mbuf *tmp = elt->buf;
if (likely(elt->buf != NULL)) {
struct rte_mbuf *tmp = elt->buf;
+#ifdef RTE_LIBRTE_MLX4_DEBUG
/* Poisoning. */
memset(&elt->buf, 0x66, sizeof(struct rte_mbuf *));
#endif
/* Poisoning. */
memset(&elt->buf, 0x66, sizeof(struct rte_mbuf *));
#endif
+#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.
*/
* information replace the driver name (MLX4_DRIVER_NAME) in log messages.
*/
#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
#define claim_zero(...) assert((__VA_ARGS__) == 0)
#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
#define claim_zero(...) assert((__VA_ARGS__) == 0)
+#else /* RTE_LIBRTE_MLX4_DEBUG */
/*
* Like assert(), DEBUG() becomes a no-op and claim_zero() does not perform
/*
* Like assert(), DEBUG() becomes a no-op and claim_zero() does not perform
#define DEBUG(...) (void)0
#define claim_zero(...) (__VA_ARGS__)
#define DEBUG(...) (void)0
#define claim_zero(...) (__VA_ARGS__)
+#endif /* RTE_LIBRTE_MLX4_DEBUG */
#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)