Skip to content

Commit

Permalink
Fix nombufs issue in DPDK 17.11
Browse files Browse the repository at this point in the history
DPDK API rte_ring_sp_enqueue_bulk and rte_ring_mp_enqueue_bulk have
change against its return value, 0 and -ERRORNUM mean success and
error respectively before DPDK 17.05, but return value is 0 or n
after DPDK 17.05 (including 17.05), 0 and n mean error and success
respectively. Details are as below:

/**
 * Enqueue several objects on the ring (multi-producers safe).
 *
 * This function uses a "compare and set" instruction to move the
 * producer index atomically.
 *
 * @param r
 *   A pointer to the ring structure.
 * @param obj_table
 *   A pointer to a table of void * pointers (objects).
 * @param n
 *   The number of objects to add in the ring from the obj_table.
 * @param free_space
 *   if non-NULL, returns the amount of space in the ring after the
 *   enqueue operation has finished.
 * @return
 *   The number of objects enqueued, either 0 or n
 */
static __rte_always_inline unsigned int
rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table,
                         unsigned int n, unsigned int *free_space)

Previous code can work if no enqueue failure, this is why we can't
reproduce nombufs issue.

Closes-Bug: #1765162
Change-Id: Ieb48e216ca8136a8127d4dbaf33b999a181e09f7
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
  • Loading branch information
yi-y-yang authored and Jeya ganesh babu committed Jun 19, 2018
1 parent 96a1df6 commit a2bcb3d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dpdk/vr_dpdk_lcore.c
Expand Up @@ -725,7 +725,11 @@ vr_dpdk_lcore_distribute(struct vr_dpdk_lcore *lcore, const bool io_lcore,
chunk_nb_pkts);
#endif
}
#if (RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0))
if (unlikely(ret == 0)) {
#else
if (unlikely(ret == -ENOBUFS)) {
#endif
/* drop packets if it's the last retry */
if (unlikely(retry == VR_DPDK_RETRY_NUM - 1)) {
/* count out the header */
Expand Down

0 comments on commit a2bcb3d

Please sign in to comment.