net/thunderx: remove libm dependency
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Thu, 6 Jul 2017 14:20:25 +0000 (19:50 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 10 Jul 2017 14:50:46 +0000 (16:50 +0200)
Used rte_log2_u32() to replace integer log2() to
remove libm dependency.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
drivers/net/thunderx/base/nicvf_hw.c
drivers/net/thunderx/base/nicvf_plat.h
mk/rte.app.mk

index c9f0d26..d10d2c0 100644 (file)
@@ -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];
 
index 985f4e2..f821c56 100644 (file)
@@ -59,6 +59,7 @@
 /* utils */
 #include <rte_common.h>
 #define nicvf_min(x, y) RTE_MIN(x, y)
+#define nicvf_log2_u32(x) rte_log2_u32(x)
 
 /* byte order */
 #include <rte_byteorder.h>
index e239581..5bb4290 100644 (file)
@@ -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