2017-01-18 11:28 GMT+01:00 Sergey Vyazmitinov <s.vyazmiti...@brain4net.com>: > Optimized kni_allocate_mbufs and kni_free_mbufs by using mbuf bulk > functions. This can improve performance more than two times. > > Signed-off-by: Sergey Vyazmitinov <s.vyazmiti...@brain4net.com> > --- > lib/librte_kni/rte_kni.c | 46 > +++++++++++++++++++++---------------------- > lib/librte_kni/rte_kni_fifo.h | 18 +++++++++++++++++ > 2 files changed, 40 insertions(+), 24 deletions(-) > > diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c > index a80cefd..ad746ad 100644 > --- a/lib/librte_kni/rte_kni.c > +++ b/lib/librte_kni/rte_kni.c [...] > + /* Check if any mbufs not put into alloc_q, and then free them */ > + if (unlikely(put < count)) { > + for (unsigned int j = put; j < count; j++) { > + RTE_LOG(ERR, KNI, "Free allocated buffer\n"); > rte_pktmbuf_free(pkts[j]); > + }
This could also use bulk free, even if only to shave two lines of code. Best Regards, Michał Mirosław