Re: [PATCH v6 1/2] mbuf: provide rte_pktmbuf_alloc_bulk API
From: Xie, Huawei <hidden>
Date: 2016-02-26 09:07:28
On 2/26/2016 4:56 PM, Olivier MATZ wrote:
On 02/23/2016 06:35 AM, Xie, Huawei wrote:quoted
quoted
quoted
Also, it would be nice to have a simple test function in app/test/test_mbuf.c. For instance, you could update test_one_pktmbuf() to take a mbuf pointer as a parameter and remove the mbuf allocation from the function. Then it could be called with a mbuf allocated with rte_pktmbuf_alloc() (like before) and with all the mbufs of rte_pktmbuf_alloc_bulk().Don't quite get you. Is it that we write two cases, one case allocate mbuf through rte_pktmbuf_alloc_bulk and one use rte_pktmbuf_alloc? It is good to have.Yes, something like: test_one_pktmbuf(struct rte_mbuf *m) { /* same as before without the allocation/free */ } test_pkt_mbuf(void) { m = rte_pktmbuf_alloc(pool); test_one_pktmbuf(m); rte_pktmbuf_free(m); ret = rte_pktmbuf_alloc_bulk(pool, mtab, BULK_CNT) for (i = 0; i < BULK_CNT; i++) { m = mtab[i]; test_one_pktmbuf(m); rte_pktmbuf_free(m); } }
This is to test the functionality.
Let us also have the case like the following?
cycles_start = rte_get_timer_cycles();
while(rounds--) {
ret = rte_pktmbuf_alloc_bulk(pool, mtab, BULK_CNT)
for (i = 0; i < BULK_CNT; i++) {
m = mtab[i];
/* some work if needed */
rte_pktmbuf_free(m);
}
}
cycles_end = rte_get_timer_cycles();
to compare with
cycles_start = rte_get_timer_cycles();
while(rounds--) {
for (i = 0; i < BULK_CNT; i++)
mtab[i] = rte_pktmbuf_alloc(...);
ret = rte_pktmbuf_alloc_bulk(pool, mtab, BULK_CNT)
for (i = 0; i < BULK_CNT; i++) {
m = mtab[i];
/* some work if needed */
rte_pktmbuf_free(m);
}
}
cycles_end = rte_get_timer_cycles();
quoted
I could do this after this patch.Yes, please. Thanks, Olivier