summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerin Jacob <jerin.jacob@caviumnetworks.com>2018-11-07 06:59:06 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-11-12 13:27:02 +0100
commit5d08fecdd39f2373713a0475b75a4126800c9acf (patch)
treee2a0c88a5f34f98411144fb6e6d0c5d5cddf3fc7
parent3a6f2c50b9dc27a958af87d7ca9533b51a36477b (diff)
downloaddpdk-5d08fecdd39f2373713a0475b75a4126800c9acf.zip
dpdk-5d08fecdd39f2373713a0475b75a4126800c9acf.tar.gz
dpdk-5d08fecdd39f2373713a0475b75a4126800c9acf.tar.xz
eal: fix build
Some toolchain has fls() definition in string.h as argument type int, which is conflicting uint32_t argument type. /export/dpdk.org/lib/librte_eal/common/rte_reciprocal.c:47:19: error: conflicting types for ‘fls’ static inline int fls(uint32_t x) ^~~ /opt/marvell-tools-201/aarch64-marvell-elf/include/strings.h:59:6: note: previous declaration of ‘fls’ was here int fls(int) __pure2; FreeBSD string.h also has fls() with argument as int type. https://www.freebsd.org/cgi/man.cgi?query=fls&sektion=3 Fixing the conflict by using rte version of fls. Fixes: ffe3ec811ef5 ("sched: introduce reciprocal divide") Fixes: faf2b25c9f80 ("fm10k: support VMDQ in multi-queue configuration") Cc: stable@dpdk.org Suggested-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
-rw-r--r--drivers/net/fm10k/fm10k_ethdev.c11
-rw-r--r--lib/librte_eal/common/rte_reciprocal.c17
2 files changed, 4 insertions, 24 deletions
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c852022..85fb6c5 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -464,11 +464,6 @@ fm10k_dev_configure(struct rte_eth_dev *dev)
return 0;
}
-/* fls = find last set bit = 32 minus the number of leading zeros */
-#ifndef fls
-#define fls(x) (((x) == 0) ? 0 : (32 - __builtin_clz((x))))
-#endif
-
static void
fm10k_dev_vmdq_rx_configure(struct rte_eth_dev *dev)
{
@@ -1030,8 +1025,8 @@ fm10k_dev_dglort_map_configure(struct rte_eth_dev *dev)
macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private);
nb_queue_pools = macvlan->nb_queue_pools;
- pool_len = nb_queue_pools ? fls(nb_queue_pools - 1) : 0;
- rss_len = fls(dev->data->nb_rx_queues - 1) - pool_len;
+ pool_len = nb_queue_pools ? rte_fls_u32(nb_queue_pools - 1) : 0;
+ rss_len = rte_fls_u32(dev->data->nb_rx_queues - 1) - pool_len;
/* GLORT 0x0-0x3F are used by PF and VMDQ, 0x40-0x7F used by FD */
dglortdec = (rss_len << FM10K_DGLORTDEC_RSSLENGTH_SHIFT) | pool_len;
@@ -1042,7 +1037,7 @@ fm10k_dev_dglort_map_configure(struct rte_eth_dev *dev)
FM10K_WRITE_REG(hw, FM10K_DGLORTDEC(0), dglortdec);
/* Flow Director configurations, only queue number is valid. */
- dglortdec = fls(dev->data->nb_rx_queues - 1);
+ dglortdec = rte_fls_u32(dev->data->nb_rx_queues - 1);
dglortmask = (GLORT_FD_MASK << FM10K_DGLORTMAP_MASK_SHIFT) |
(hw->mac.dglort_map + GLORT_FD_Q_BASE);
FM10K_WRITE_REG(hw, FM10K_DGLORTMAP(1), dglortmask);
diff --git a/lib/librte_eal/common/rte_reciprocal.c b/lib/librte_eal/common/rte_reciprocal.c
index d81b11d..f017d0c 100644
--- a/lib/librte_eal/common/rte_reciprocal.c
+++ b/lib/librte_eal/common/rte_reciprocal.c
@@ -41,28 +41,13 @@
#include "rte_reciprocal.h"
-/* find largest set bit.
- * portable and slow but does not matter for this usage.
- */
-static inline int fls(uint32_t x)
-{
- int b;
-
- for (b = 31; b >= 0; --b) {
- if (x & (1u << b))
- return b + 1;
- }
-
- return 0;
-}
-
struct rte_reciprocal rte_reciprocal_value(uint32_t d)
{
struct rte_reciprocal R;
uint64_t m;
int l;
- l = fls(d - 1);
+ l = rte_fls_u32(d - 1);
m = ((1ULL << 32) * ((1ULL << l) - d));
m /= d;