From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.voipfuture.com (mail.voipfuture.com [213.238.34.195]) by dpdk.org (Postfix) with ESMTP id AE5712B8C for ; Fri, 11 Nov 2016 10:49:24 +0100 (CET) X-Footer: dm9pcGZ1dHVyZS5jb20= Received: from [192.168.1.155] ([192.168.1.1]) (authenticated user pbeyer@voipfuture.com) by mail.voipfuture.com (Kerio Connect 9.1.1) with ESMTPSA (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128 bits)) for users@dpdk.org; Fri, 11 Nov 2016 10:49:23 +0100 To: users@dpdk.org From: Philipp Beyer Message-ID: <750170fd-492a-588c-de6a-27c0547d1cbd@voipfuture.com> Date: Fri, 11 Nov 2016 10:49:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [dpdk-users] Beginners question: rte_eth_tx_burst, rte_mbuf access synchronization X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 09:49:24 -0000 Hi! I am just writing my first code using dpdk, a traffic generator, for which I started with the l2fwd example. Basically, I need to send the same packet over a single interface, over an over again, with single bytes changed each time. I use rte_eth_tx_burst to send 16 packets at once. As I want to re-use the same buffers in a very simple way, I just increment the refcnt accordingly. My current code prepares all 16 buffers, calls rte_eth_tx_burst until all 16 packets are stored in the transmit ring, and starts over again, adjusting the buffers to send the next 16 packets. Currently I observe duplicate packets, although every packet should be individual due to single byte adjustments. My current problem is, as I guess, that rte_eth_tx_burst does not synchnolously transmit the count of packets, which is returned to the caller, but just stores them in transmit queue. So, I am not allowed to instantly re-use these buffers again. My question is: How do I know when to re-use buffers passed to rte_eth_tx_burst. Of course, I can check their refcnt member, and this would be perfectly fine. Apparently, I should have at least BURST_SIZE*2 buffers, passing BURST_SIZE buffers at once, so I can manipulate one set of buffers while the other is transmitted. But I am missing the idea of the best synchronization scheme here: How should I wait on this refcnt to drop? Some blind guessing: If I take the documentation of rte_eth_tx_burst literally, I could get the idea that refcounts of buffers are only decreased (buffers are 'freed'), while rte_eth_tx_burst is executed, but one function call might free buffers used by previous function calls. If this is correct, I still do not see a complete synchronization scheme. There is still a chance that I end up without any buffers left, which means I do not have a chance to call rte_eth_tx_burst again to free buffers. Thanks for any help, Philipp