On Thu, Aug 15, 2019 at 8:02 AM William Tu <u9012...@gmail.com> wrote: > > Hi Chengqiang, > > Thanks for your reply. > > On Wed, Aug 14, 2019 at 11:52 PM Yao, Chengqiang > <chengqiang....@intel.com> wrote: > > > > Hi William, > > > > You do not need to copy the packets out of memif. Once you finish > > processing all these packets, call memif_refill_queue() function to free > > these buffers. Let's say if you receive 32 packets in memif_rx_burst > > function, after processing, call memif_refill_queue with count=32 to free. > > > > But if I calling memif_refill_queue() with count=32, then where does > libmemif get the 32 free buffer to refill on rx? > And if my code is not copying packet buffer from dev->rx_bufs, how > does libmemif know that I'm done with these > 32 packet buffer and libmemif can re-cycle them back to rx? > Looking at the source code,
When calling memif_rx_burst(), users get rx buffer from b0->data = memif_get_buffer (c, ring, cur_slot & mask); at index cur_slot and memif_get_buffer() returns buffer at conn->regions[ring->desc[index].region].addr + ring->desc[index].offset So users are getting the internal packet buffer from conn->regions I'd assume I have to tell libmemif that I'm done with this buffer and libmemif can reuse it later. Thank you William > Regards, > William > > > > > Best Regards, > > Chengqiang Yao > > > > > > > > -----Original Message----- > > From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of William Tu > > Sent: 2019年8月15日 2:07 > > To: vpp-dev@lists.fd.io > > Subject: [vpp-dev] Question about libmemif API > > > > Hi, > > > > I'm working on using libmemif in OVS. > > https://patchwork.ozlabs.org/patch/1140858/ > > > > While using the API, one question I have is, when I call > > err = memif_rx_burst(dev->handle, qid, dev->rx_bufs, NETDEV_MAX_BURST, > > &recv); > > > > There are 'recv' number of packets are at dev->rx_bufs, do I have to copy > > the packet buffer immediately to my master side? For example, I received 32 > > packets from memif_rx_burst, and I might process these packets in different > > order. Once done, is there an API to free each specific packet buffer back > > to memif buffer pool? > > > > Now the memif_refill_queue() can only specify number of buffers to refill, > > not which buffer. > > > > Thanks > > William > > -=-=-=-=-=-=-=-=-=-=-=- > > Links: You receive all messages sent to this group. > > > > View/Reply Online (#13743): https://lists.fd.io/g/vpp-dev/message/13743 > > Mute This Topic: https://lists.fd.io/mt/32866729/675822 > > Group Owner: vpp-dev+ow...@lists.fd.io > > Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [u9012...@gmail.com] > > -=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#13751): https://lists.fd.io/g/vpp-dev/message/13751 Mute This Topic: https://lists.fd.io/mt/32866729/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-