aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_eal/common
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2019-03-20 14:50:04 +0000
committerLuca Boccassi <luca.boccassi@gmail.com>2019-03-20 14:50:10 +0000
commit36e178648f46ea9fb63d89097c59ce45fb8a67fe (patch)
treee3ee0ea25a45aa28918dc721dd1fe19b27d6849c /lib/librte_eal/common
parent1ab31fb74132eabd45f326413eb6e4f647de48d9 (diff)
parentf7a9461e29147c47ce2bb81bd157ac1833cf5eb1 (diff)
Merge tag 'upstream/16.11.9' into 16.11.x
Upstream version 16.11.9 Change-Id: I947c2532ec89a9850d135bde544b4d5812b49e4f Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'lib/librte_eal/common')
-rw-r--r--lib/librte_eal/common/eal_common_options.c2
-rw-r--r--lib/librte_eal/common/include/rte_common.h26
-rw-r--r--lib/librte_eal/common/include/rte_pci.h2
-rw-r--r--lib/librte_eal/common/include/rte_version.h2
4 files changed, 21 insertions, 11 deletions
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 6ca8af17..2dc86509 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -179,7 +179,7 @@ eal_plugin_add(const char *path)
return -1;
}
memset(solib, 0, sizeof(*solib));
- strncpy(solib->name, path, PATH_MAX-1);
+ strlcpy(solib->name, path, PATH_MAX-1);
solib->name[PATH_MAX-1] = 0;
TAILQ_INSERT_TAIL(&solib_list, solib, next);
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index f5e2f886..f17926f3 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -200,16 +200,7 @@ rte_is_aligned(void *ptr, unsigned align)
/**
* Triggers an error at compilation time if the condition is true.
*/
-#ifndef __OPTIMIZE__
#define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#else
-extern int RTE_BUILD_BUG_ON_detected_error;
-#define RTE_BUILD_BUG_ON(condition) do { \
- ((void)sizeof(char[1 - 2*!!(condition)])); \
- if (condition) \
- RTE_BUILD_BUG_ON_detected_error = 1; \
-} while(0)
-#endif
/*********** Macros to work with powers of 2 ********/
@@ -326,6 +317,23 @@ rte_bsf32(uint32_t v)
return (uint32_t)__builtin_ctz(v);
}
+/**
+ * Return the last (most-significant) bit set.
+ *
+ * @note The last (most significant) bit is at position 32.
+ * @note rte_fls_u32(0) = 0, rte_fls_u32(1) = 1, rte_fls_u32(0x80000000) = 32
+ *
+ * @param x
+ * The input parameter.
+ * @return
+ * The last (most-significant) bit set, or 0 if the input is 0.
+ */
+static inline int
+rte_fls_u32(uint32_t x)
+{
+ return (x == 0) ? 0 : 32 - __builtin_clz(x);
+}
+
#ifndef offsetof
/** Return the offset of a field in a structure. */
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 9ce88472..10fa8564 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -248,6 +248,8 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
do { \
unsigned long val; \
char *end; \
+ if (*in == '\0') \
+ return -EINVAL; \
errno = 0; \
val = strtoul((in), &end, 16); \
if (errno != 0 || end[0] != (dlm) || val > (lim)) \
diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index 9148ef16..b509ec93 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -66,7 +66,7 @@ extern "C" {
/**
* Patch level number i.e. the z in yy.mm.z
*/
-#define RTE_VER_MINOR 8
+#define RTE_VER_MINOR 9
/**
* Extra string to be appended to version number