summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJohn Daley <johndale@cisco.com>2016-07-11 12:45:01 -0700
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-07-15 23:37:13 +0200
commitda24f6f658fb7892606b3796a5ed03a5dff688af (patch)
treec38e038e09476a99adee516b0c5d098faa1123e7 /drivers
parentd0c98d9e19a94a580ad51778e88875715a4460a4 (diff)
downloaddpdk-da24f6f658fb7892606b3796a5ed03a5dff688af.zip
dpdk-da24f6f658fb7892606b3796a5ed03a5dff688af.tar.gz
dpdk-da24f6f658fb7892606b3796a5ed03a5dff688af.tar.xz
net/enic: decrement Tx mbuf reference count before recycling
In the burst Tx cleanup function, the reference count in mbufs returned to the pool should to be decremented before they are returned. Decrementing is not done by rte_mempool_put_bulk() so it must be done separately using __rte_pktmbuf_prefree_seg(). Also when returning unsent buffers when the device is stopped use rte_mbuf_free_seg() instead of rte_mempool_put() so that reference counts are properly decremented. Fixes: 36935afbc53c ("net/enic: refactor Tx mbuf recycling") Reviewed-by: Nelson Escobar <neescoba@cisco.com> Signed-off-by: John Daley <johndale@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/enic/enic_main.c2
-rw-r--r--drivers/net/enic/enic_rxtx.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 89afb9f..a21b300 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -106,7 +106,7 @@ static void enic_free_wq_buf(struct vnic_wq_buf *buf)
{
struct rte_mbuf *mbuf = (struct rte_mbuf *)buf->mb;
- rte_mempool_put(mbuf->pool, mbuf);
+ rte_pktmbuf_free_seg(mbuf);
buf->mb = NULL;
}
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index 2f4a08c..845a8e6 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -398,7 +398,14 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index)
pool = ((struct rte_mbuf *)buf->mb)->pool;
for (i = 0; i < nb_to_free; i++) {
buf = &wq->bufs[tail_idx];
- m = (struct rte_mbuf *)(buf->mb);
+ m = __rte_pktmbuf_prefree_seg((struct rte_mbuf *)(buf->mb));
+ buf->mb = NULL;
+
+ if (unlikely(m == NULL)) {
+ tail_idx = enic_ring_incr(desc_count, tail_idx);
+ continue;
+ }
+
if (likely(m->pool == pool)) {
RTE_ASSERT(nb_free < ENIC_MAX_WQ_DESCS);
free[nb_free++] = m;
@@ -409,7 +416,6 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index)
pool = m->pool;
}
tail_idx = enic_ring_incr(desc_count, tail_idx);
- buf->mb = NULL;
}
rte_mempool_put_bulk(pool, (void **)free, nb_free);