From 9e534c0a202939d6e83b0d29e49d51f36bb8d601 Mon Sep 17 00:00:00 2001 From: Jerin Jacob Date: Thu, 6 Jul 2017 19:50:25 +0530 Subject: [PATCH] net/thunderx: remove libm dependency Used rte_log2_u32() to replace integer log2() to remove libm dependency. Signed-off-by: Jerin Jacob Reviewed-by: Olivier Matz --- drivers/net/thunderx/base/nicvf_hw.c | 8 +++++--- drivers/net/thunderx/base/nicvf_plat.h | 1 + mk/rte.app.mk | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/thunderx/base/nicvf_hw.c b/drivers/net/thunderx/base/nicvf_hw.c index c9f0d26422..d10d2c0e0e 100644 --- a/drivers/net/thunderx/base/nicvf_hw.c +++ b/drivers/net/thunderx/base/nicvf_hw.c @@ -448,7 +448,8 @@ nicvf_qsize_regbit(uint32_t len, uint32_t len_shift) { int val; - val = ((uint32_t)log2(len) - len_shift); + val = nicvf_log2_u32(len) - len_shift; + assert(val >= NICVF_QSIZE_MIN_VAL); assert(val <= NICVF_QSIZE_MAX_VAL); return val; @@ -801,7 +802,7 @@ nicvf_rss_reta_update(struct nicvf *nic, uint8_t *tbl, uint32_t max_count) return NICVF_ERR_RSS_GET_SZ; assert(rss->rss_size > 0); - rss->hash_bits = (uint8_t)log2(rss->rss_size); + rss->hash_bits = (uint8_t)nicvf_log2_u32(rss->rss_size); for (idx = 0; idx < rss->rss_size && idx < max_count; idx++) rss->ind_tbl[idx] = tbl[idx]; @@ -822,7 +823,8 @@ nicvf_rss_reta_query(struct nicvf *nic, uint8_t *tbl, uint32_t max_count) return NICVF_ERR_RSS_GET_SZ; assert(rss->rss_size > 0); - rss->hash_bits = (uint8_t)log2(rss->rss_size); + rss->hash_bits = (uint8_t)nicvf_log2_u32(rss->rss_size); + for (idx = 0; idx < rss->rss_size && idx < max_count; idx++) tbl[idx] = rss->ind_tbl[idx]; diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h index 985f4e2247..f821c56f3e 100644 --- a/drivers/net/thunderx/base/nicvf_plat.h +++ b/drivers/net/thunderx/base/nicvf_plat.h @@ -59,6 +59,7 @@ /* utils */ #include #define nicvf_min(x, y) RTE_MIN(x, y) +#define nicvf_log2_u32(x) rte_log2_u32(x) /* byte order */ #include diff --git a/mk/rte.app.mk b/mk/rte.app.mk index e23958144c..5bb4290dad 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -137,7 +137,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring _LDLIBS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += -lrte_pmd_sfc_efx _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 -lsze2 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += -lrte_pmd_tap -_LDLIBS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += -lrte_pmd_thunderx_nicvf -lm +_LDLIBS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += -lrte_pmd_thunderx_nicvf _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost -- 2.20.1