ixgbe: remove simple scalar scattered Rx method
[dpdk.git] / lib / librte_mempool / rte_mempool.h
index 48e9972..9001312 100644 (file)
@@ -198,10 +198,12 @@ struct rte_mempool {
  *   Number to add to the object-oriented statistics.
  */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
-#define __MEMPOOL_STAT_ADD(mp, name, n) do {                   \
-               unsigned __lcore_id = rte_lcore_id();           \
-               mp->stats[__lcore_id].name##_objs += n;         \
-               mp->stats[__lcore_id].name##_bulk += 1;         \
+#define __MEMPOOL_STAT_ADD(mp, name, n) do {                    \
+               unsigned __lcore_id = rte_lcore_id();           \
+               if (__lcore_id < RTE_MAX_LCORE) {               \
+                       mp->stats[__lcore_id].name##_objs += n; \
+                       mp->stats[__lcore_id].name##_bulk += 1; \
+               }                                               \
        } while(0)
 #else
 #define __MEMPOOL_STAT_ADD(mp, name, n) do {} while(0)
@@ -343,7 +345,7 @@ static inline void __mempool_check_cookies(const struct rte_mempool *mp,
                                rte_log_set_history(0);
                                RTE_LOG(CRIT, MEMPOOL,
                                        "obj=%p, mempool=%p, cookie=%" PRIx64 "\n",
-                                       obj, mp, cookie);
+                                       obj, (const void *) mp, cookie);
                                rte_panic("MEMPOOL: bad header cookie (put)\n");
                        }
                        __mempool_write_header_cookie(obj, 1);
@@ -353,7 +355,7 @@ static inline void __mempool_check_cookies(const struct rte_mempool *mp,
                                rte_log_set_history(0);
                                RTE_LOG(CRIT, MEMPOOL,
                                        "obj=%p, mempool=%p, cookie=%" PRIx64 "\n",
-                                       obj, mp, cookie);
+                                       obj, (const void *) mp, cookie);
                                rte_panic("MEMPOOL: bad header cookie (get)\n");
                        }
                        __mempool_write_header_cookie(obj, 0);
@@ -364,7 +366,7 @@ static inline void __mempool_check_cookies(const struct rte_mempool *mp,
                                rte_log_set_history(0);
                                RTE_LOG(CRIT, MEMPOOL,
                                        "obj=%p, mempool=%p, cookie=%" PRIx64 "\n",
-                                       obj, mp, cookie);
+                                       obj, (const void *) mp, cookie);
                                rte_panic("MEMPOOL: bad header cookie (audit)\n");
                        }
                }
@@ -373,7 +375,7 @@ static inline void __mempool_check_cookies(const struct rte_mempool *mp,
                        rte_log_set_history(0);
                        RTE_LOG(CRIT, MEMPOOL,
                                "obj=%p, mempool=%p, cookie=%" PRIx64 "\n",
-                               obj, mp, cookie);
+                               obj, (const void *) mp, cookie);
                        rte_panic("MEMPOOL: bad trailer cookie\n");
                }
        }
@@ -522,7 +524,6 @@ typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *);
  *   with rte_errno set appropriately. Possible rte_errno values include:
  *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
  *    - E_RTE_SECONDARY - function was called from a secondary process instance
- *    - E_RTE_NO_TAILQ - no tailq list could be got for the ring or mempool list
  *    - EINVAL - cache size provided is too large
  *    - ENOSPC - the maximum number of memzones has already been allocated
  *    - EEXIST - a memzone with the same name already exists
@@ -623,7 +624,6 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
  *   with rte_errno set appropriately. Possible rte_errno values include:
  *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
  *    - E_RTE_SECONDARY - function was called from a secondary process instance
- *    - E_RTE_NO_TAILQ - no tailq list could be got for the ring or mempool list
  *    - EINVAL - cache size provided is too large
  *    - ENOSPC - the maximum number of memzones has already been allocated
  *    - EEXIST - a memzone with the same name already exists
@@ -714,7 +714,6 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
  *   with rte_errno set appropriately. Possible rte_errno values include:
  *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
  *    - E_RTE_SECONDARY - function was called from a secondary process instance
- *    - E_RTE_NO_TAILQ - no tailq list could be got for the ring or mempool list
  *    - EINVAL - cache size provided is too large
  *    - ENOSPC - the maximum number of memzones has already been allocated
  *    - EEXIST - a memzone with the same name already exists
@@ -767,8 +766,9 @@ __mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table,
        __MEMPOOL_STAT_ADD(mp, put, n);
 
 #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
-       /* cache is not enabled or single producer */
-       if (unlikely(cache_size == 0 || is_mp == 0))
+       /* cache is not enabled or single producer or non-EAL thread */
+       if (unlikely(cache_size == 0 || is_mp == 0 ||
+                    lcore_id >= RTE_MAX_LCORE))
                goto ring_enqueue;
 
        /* Go straight to ring if put would overflow mem allocated for cache */
@@ -952,7 +952,8 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table,
        uint32_t cache_size = mp->cache_size;
 
        /* cache is not enabled or single consumer */
-       if (unlikely(cache_size == 0 || is_mc == 0 || n >= cache_size))
+       if (unlikely(cache_size == 0 || is_mc == 0 ||
+                    n >= cache_size || lcore_id >= RTE_MAX_LCORE))
                goto ring_dequeue;
 
        cache = &mp->local_cache[lcore_id];