On 10/21/2015 2:58 AM, Stephen Hemminger wrote:
> On Tue, 20 Oct 2015 23:30:06 +0800
> Huawei Xie <huawei.xie at intel.com> wrote:
>
>> +    desc_idx = (uint16_t)(vq->vq_used_cons_idx &
>> +            ((vq->vq_nentries >> 1) - 1));
>> +    free[0] = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;
>> +    nb_free = 1;
>> +
>> +    for (i = 1; i < VIRTIO_TX_FREE_NR; i++) {
>> +            m = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;
>> +            if (likely(m->pool == free[0]->pool))
>> +                    free[nb_free++] = m;
>> +            else {
>> +                    rte_mempool_put_bulk(free[0]->pool, (void **)free,
>> +                            nb_free);
>> +                    free[0] = m;
>> +                    nb_free = 1;
>> +            }
>> +    }
>> +
>> +    rte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free);
> Might be better to introduce a function in rte_mbuf.h which
> does this so other drivers can use same code?
>
> rte_pktmbuf_free_bulk(pkts[], n)
Agree. It would be good to have a generic rte_pktmbuf_free(/alloc)_bulk.
Several other drivers and future vhost patches also use the same logic.
I prefer to implement this later as this is API change.

Reply via email to