summaryrefslogtreecommitdiffstats
path: root/src/dpdk/lib
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-07-31 11:16:27 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-07-31 11:21:40 +0300
commitdceb010b01e9f8a0e9c905370d39f149f01cab7e (patch)
tree562201fb20db07440462f27e4d8b95ad3ce84611 /src/dpdk/lib
parent81c896604a50486d8b658dc559f7b98492d778e5 (diff)
dpdk 16.07 - merges of final version changes
Diffstat (limited to 'src/dpdk/lib')
-rw-r--r--src/dpdk/lib/librte_eal/common/eal_common_memzone.c12
-rw-r--r--src/dpdk/lib/librte_eal/common/eal_common_options.c19
-rw-r--r--src/dpdk/lib/librte_eal/common/include/rte_tailq.h8
-rw-r--r--src/dpdk/lib/librte_eal/common/include/rte_version.h4
-rw-r--r--src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c17
-rw-r--r--src/dpdk/lib/librte_ether/rte_ethdev.c2
-rw-r--r--src/dpdk/lib/librte_ether/rte_ethdev.h13
-rw-r--r--src/dpdk/lib/librte_mempool/rte_mempool.c3
-rw-r--r--src/dpdk/lib/librte_mempool/rte_mempool.h11
-rw-r--r--src/dpdk/lib/librte_mempool/rte_mempool_ops.c1
-rw-r--r--src/dpdk/lib/librte_ring/rte_ring.h12
11 files changed, 70 insertions, 32 deletions
diff --git a/src/dpdk/lib/librte_eal/common/eal_common_memzone.c b/src/dpdk/lib/librte_eal/common/eal_common_memzone.c
index 5d28341f..1bd0a33d 100644
--- a/src/dpdk/lib/librte_eal/common/eal_common_memzone.c
+++ b/src/dpdk/lib/librte_eal/common/eal_common_memzone.c
@@ -144,16 +144,16 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
return NULL;
}
- /* zone already exist */
- if ((memzone_lookup_thread_unsafe(name)) != NULL) {
- RTE_LOG(DEBUG, EAL, "%s(): memzone <%s> already exists\n",
+ if (strlen(name) > sizeof(mz->name) - 1) {
+ RTE_LOG(DEBUG, EAL, "%s(): memzone <%s>: name too long\n",
__func__, name);
- rte_errno = EEXIST;
+ rte_errno = ENAMETOOLONG;
return NULL;
}
- if (strlen(name) >= sizeof(mz->name) - 1) {
- RTE_LOG(DEBUG, EAL, "%s(): memzone <%s>: name too long\n",
+ /* zone already exist */
+ if ((memzone_lookup_thread_unsafe(name)) != NULL) {
+ RTE_LOG(DEBUG, EAL, "%s(): memzone <%s> already exists\n",
__func__, name);
rte_errno = EEXIST;
return NULL;
diff --git a/src/dpdk/lib/librte_eal/common/eal_common_options.c b/src/dpdk/lib/librte_eal/common/eal_common_options.c
index 0a594d7f..1a1bab36 100644
--- a/src/dpdk/lib/librte_eal/common/eal_common_options.c
+++ b/src/dpdk/lib/librte_eal/common/eal_common_options.c
@@ -116,9 +116,9 @@ TAILQ_HEAD_INITIALIZER(solib_list);
static const char *default_solib_dir = RTE_EAL_PMD_PATH;
/*
- * Stringified version of solib path used by pmdinfo.py
+ * Stringified version of solib path used by dpdk-pmdinfo.py
* Note: PLEASE DO NOT ALTER THIS without making a corresponding
- * change to tools/pmdinfo.py
+ * change to tools/dpdk-pmdinfo.py
*/
static const char dpdk_solib_path[] __attribute__((used)) =
"DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH;
@@ -530,6 +530,13 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num)
str = end + 1;
} while (*end != '\0' && *end != ')');
+ /*
+ * to avoid failure that tail blank makes end character check fail
+ * in eal_parse_lcores( )
+ */
+ while (isblank(*str))
+ str++;
+
return str - input;
}
@@ -578,13 +585,12 @@ eal_parse_lcores(const char *lcores)
struct rte_config *cfg = rte_eal_get_configuration();
static uint16_t set[RTE_MAX_LCORE];
unsigned idx = 0;
- int i;
unsigned count = 0;
const char *lcore_start = NULL;
const char *end = NULL;
int offset;
rte_cpuset_t cpuset;
- int lflags = 0;
+ int lflags;
int ret = -1;
if (lcores == NULL)
@@ -593,9 +599,6 @@ eal_parse_lcores(const char *lcores)
/* Remove all blank characters ahead and after */
while (isblank(*lcores))
lcores++;
- i = strlen(lcores);
- while ((i > 0) && isblank(lcores[i - 1]))
- i--;
CPU_ZERO(&cpuset);
@@ -613,6 +616,8 @@ eal_parse_lcores(const char *lcores)
if (*lcores == '\0')
goto err;
+ lflags = 0;
+
/* record lcore_set start point */
lcore_start = lcores;
diff --git a/src/dpdk/lib/librte_eal/common/include/rte_tailq.h b/src/dpdk/lib/librte_eal/common/include/rte_tailq.h
index 4a686e68..cc3c0f1d 100644
--- a/src/dpdk/lib/librte_eal/common/include/rte_tailq.h
+++ b/src/dpdk/lib/librte_eal/common/include/rte_tailq.h
@@ -155,6 +155,14 @@ void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
}
+/* This macro permits both remove and free var within the loop safely.*/
+#ifndef TAILQ_FOREACH_SAFE
+#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = TAILQ_FIRST((head)); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/src/dpdk/lib/librte_eal/common/include/rte_version.h b/src/dpdk/lib/librte_eal/common/include/rte_version.h
index eacc86c1..615deb7f 100644
--- a/src/dpdk/lib/librte_eal/common/include/rte_version.h
+++ b/src/dpdk/lib/librte_eal/common/include/rte_version.h
@@ -70,14 +70,14 @@ extern "C" {
/**
* Extra string to be appended to version number
*/
-#define RTE_VER_SUFFIX "-rc"
+#define RTE_VER_SUFFIX ""
/**
* Patch release number
* 0-15 = release candidates
* 16 = release
*/
-#define RTE_VER_RELEASE 3
+#define RTE_VER_RELEASE 16
/**
* Macro to compute a version number usable for comparisons
diff --git a/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c b/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c
index 42a29faf..41e0a928 100644
--- a/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -99,6 +99,8 @@
#include "eal_filesystem.h"
#include "eal_hugepages.h"
+#define PFN_MASK_SIZE 8
+
#ifdef RTE_LIBRTE_XEN_DOM0
int rte_xen_dom0_supported(void)
{
@@ -158,7 +160,7 @@ rte_mem_lock_page(const void *virt)
phys_addr_t
rte_mem_virt2phy(const void *virtaddr)
{
- int fd;
+ int fd, retval;
uint64_t page, physaddr;
unsigned long virt_pfn;
int page_size;
@@ -209,10 +211,17 @@ rte_mem_virt2phy(const void *virtaddr)
close(fd);
return RTE_BAD_PHYS_ADDR;
}
- if (read(fd, &page, sizeof(uint64_t)) < 0) {
+
+ retval = read(fd, &page, PFN_MASK_SIZE);
+ close(fd);
+ if (retval < 0) {
RTE_LOG(ERR, EAL, "%s(): cannot read /proc/self/pagemap: %s\n",
__func__, strerror(errno));
- close(fd);
+ return RTE_BAD_PHYS_ADDR;
+ } else if (retval != PFN_MASK_SIZE) {
+ RTE_LOG(ERR, EAL, "%s(): read %d bytes from /proc/self/pagemap "
+ "but expected %d:\n",
+ __func__, retval, PFN_MASK_SIZE);
return RTE_BAD_PHYS_ADDR;
}
@@ -222,7 +231,7 @@ rte_mem_virt2phy(const void *virtaddr)
*/
physaddr = ((page & 0x7fffffffffffffULL) * page_size)
+ ((unsigned long)virtaddr % page_size);
- close(fd);
+
return physaddr;
}
diff --git a/src/dpdk/lib/librte_ether/rte_ethdev.c b/src/dpdk/lib/librte_ether/rte_ethdev.c
index 47ea4696..9e30438c 100644
--- a/src/dpdk/lib/librte_ether/rte_ethdev.c
+++ b/src/dpdk/lib/librte_ether/rte_ethdev.c
@@ -1524,8 +1524,8 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
memset(stats, 0, sizeof(*stats));
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
- (*dev->dev_ops->stats_get)(dev, stats);
stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
+ (*dev->dev_ops->stats_get)(dev, stats);
return 0;
}
diff --git a/src/dpdk/lib/librte_ether/rte_ethdev.h b/src/dpdk/lib/librte_ether/rte_ethdev.h
index 6c99c88b..5339d3be 100644
--- a/src/dpdk/lib/librte_ether/rte_ethdev.h
+++ b/src/dpdk/lib/librte_ether/rte_ethdev.h
@@ -2044,9 +2044,8 @@ int rte_eth_dev_socket_id(uint8_t port_id);
int rte_eth_dev_is_valid_port(uint8_t port_id);
/**
- * Allocate mbuf from mempool, setup the DMA physical address
- * and then start RX for specified queue of a port. It is used
- * when rx_deferred_start flag of the specified queue is true.
+ * Start specified RX queue of a port. It is used when rx_deferred_start
+ * flag of the specified queue is true.
*
* @param port_id
* The port identifier of the Ethernet device
@@ -2055,7 +2054,7 @@ int rte_eth_dev_is_valid_port(uint8_t port_id);
* The value must be in the range [0, nb_rx_queue - 1] previously supplied
* to rte_eth_dev_configure().
* @return
- * - 0: Success, the transmit queue is correctly set up.
+ * - 0: Success, the receive queue is started.
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
@@ -2071,7 +2070,7 @@ int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
* The value must be in the range [0, nb_rx_queue - 1] previously supplied
* to rte_eth_dev_configure().
* @return
- * - 0: Success, the transmit queue is correctly set up.
+ * - 0: Success, the receive queue is stopped.
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
@@ -2088,7 +2087,7 @@ int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
* The value must be in the range [0, nb_tx_queue - 1] previously supplied
* to rte_eth_dev_configure().
* @return
- * - 0: Success, the transmit queue is correctly set up.
+ * - 0: Success, the transmit queue is started.
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
@@ -2104,7 +2103,7 @@ int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
* The value must be in the range [0, nb_tx_queue - 1] previously supplied
* to rte_eth_dev_configure().
* @return
- * - 0: Success, the transmit queue is correctly set up.
+ * - 0: Success, the transmit queue is stopped.
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
diff --git a/src/dpdk/lib/librte_mempool/rte_mempool.c b/src/dpdk/lib/librte_mempool/rte_mempool.c
index 8806633b..2e28e2e8 100644
--- a/src/dpdk/lib/librte_mempool/rte_mempool.c
+++ b/src/dpdk/lib/librte_mempool/rte_mempool.c
@@ -1283,12 +1283,13 @@ void rte_mempool_walk(void (*func)(struct rte_mempool *, void *),
{
struct rte_tailq_entry *te = NULL;
struct rte_mempool_list *mempool_list;
+ void *tmp_te;
mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list);
rte_rwlock_read_lock(RTE_EAL_MEMPOOL_RWLOCK);
- TAILQ_FOREACH(te, mempool_list, next) {
+ TAILQ_FOREACH_SAFE(te, mempool_list, next, tmp_te) {
(*func)((struct rte_mempool *) te->data, arg);
}
diff --git a/src/dpdk/lib/librte_mempool/rte_mempool.h b/src/dpdk/lib/librte_mempool/rte_mempool.h
index 4a8fbb1e..059ad9e5 100644
--- a/src/dpdk/lib/librte_mempool/rte_mempool.h
+++ b/src/dpdk/lib/librte_mempool/rte_mempool.h
@@ -123,7 +123,9 @@ struct rte_mempool_objsz {
/**< Total size of an object (header + elt + trailer). */
};
-#define RTE_MEMPOOL_NAMESIZE 32 /**< Maximum length of a memory pool. */
+/**< Maximum length of a memory pool's name. */
+#define RTE_MEMPOOL_NAMESIZE (RTE_RING_NAMESIZE - \
+ sizeof(RTE_MEMPOOL_MZ_PREFIX) + 1)
#define RTE_MEMPOOL_MZ_PREFIX "MP_"
/* "MP_<name>" */
@@ -208,7 +210,12 @@ struct rte_mempool_memhdr {
* The RTE mempool structure.
*/
struct rte_mempool {
- char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
+ /*
+ * Note: this field kept the RTE_MEMZONE_NAMESIZE size due to ABI
+ * compatibility requirements, it could be changed to
+ * RTE_MEMPOOL_NAMESIZE next time the ABI changes
+ */
+ char name[RTE_MEMZONE_NAMESIZE]; /**< Name of mempool. */
union {
void *pool_data; /**< Ring or pool to store objects. */
uint64_t pool_id; /**< External mempool identifier. */
diff --git a/src/dpdk/lib/librte_mempool/rte_mempool_ops.c b/src/dpdk/lib/librte_mempool/rte_mempool_ops.c
index fd0b64cf..5f24de25 100644
--- a/src/dpdk/lib/librte_mempool/rte_mempool_ops.c
+++ b/src/dpdk/lib/librte_mempool/rte_mempool_ops.c
@@ -81,6 +81,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
ops = &rte_mempool_ops_table.ops[ops_index];
snprintf(ops->name, sizeof(ops->name), "%s", h->name);
ops->alloc = h->alloc;
+ ops->free = h->free;
ops->enqueue = h->enqueue;
ops->dequeue = h->dequeue;
ops->get_count = h->get_count;
diff --git a/src/dpdk/lib/librte_ring/rte_ring.h b/src/dpdk/lib/librte_ring/rte_ring.h
index eb45e414..0e22e694 100644
--- a/src/dpdk/lib/librte_ring/rte_ring.h
+++ b/src/dpdk/lib/librte_ring/rte_ring.h
@@ -100,6 +100,7 @@ extern "C" {
#include <rte_lcore.h>
#include <rte_atomic.h>
#include <rte_branch_prediction.h>
+#include <rte_memzone.h>
#define RTE_TAILQ_RING_NAME "RTE_RING"
@@ -126,8 +127,10 @@ struct rte_ring_debug_stats {
} __rte_cache_aligned;
#endif
-#define RTE_RING_NAMESIZE 32 /**< The maximum length of a ring name. */
#define RTE_RING_MZ_PREFIX "RG_"
+/**< The maximum length of a ring name. */
+#define RTE_RING_NAMESIZE (RTE_MEMZONE_NAMESIZE - \
+ sizeof(RTE_RING_MZ_PREFIX) + 1)
#ifndef RTE_RING_PAUSE_REP_COUNT
#define RTE_RING_PAUSE_REP_COUNT 0 /**< Yield after pause num of times, no yield
@@ -147,7 +150,12 @@ struct rte_memzone; /* forward declaration, so as not to require memzone.h */
* a problem.
*/
struct rte_ring {
- char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */
+ /*
+ * Note: this field kept the RTE_MEMZONE_NAMESIZE size due to ABI
+ * compatibility requirements, it could be changed to RTE_RING_NAMESIZE
+ * next time the ABI changes
+ */
+ char name[RTE_MEMZONE_NAMESIZE]; /**< Name of the ring. */
int flags; /**< Flags supplied at creation. */
const struct rte_memzone *memzone;
/**< Memzone, if any, containing the rte_ring */