> -----Original Message----- > From: Stephen Hemminger [mailto:stephen at networkplumber.org] > Sent: Tuesday, June 24, 2014 4:07 PM > To: Richardson, Bruce > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [RFC PATCH DRAFT 1/2] ethdev: add buffered single pkt > TX function to API > > On Tue, 24 Jun 2014 23:32:15 +0100 > Bruce Richardson <bruce.richardson at intel.com> wrote: > > > Many sample apps include internal buffering for single-packet-at-a-time > > operation. Since this is such a common paradigm, this functionality is > > better suited to being inside the core ethdev API. > > The new APIs include three functions: > > * rte_eth_tx_buffer - buffer up a single packet for future transmission > > * rte_eth_tx_buffer_flush - flush any unsent buffered packets > > * rte_eth_tx_buffer_set_err_callback - set up a callback to be called in > > case transmitting a buffered burst fails. By default, we just free the > > unsent packets > > This must be per-queue to be MP safe. > > Internally, we do something similar but it proved to be fastest to > user per-cpu data in some cases.
The implementation is per-queue. If you look at the changes to the tx queue setup function, we set up a buffer space for each TX queue inside the eth_dev_data structure that is then used for buffering that queue. The fact that it's handled per-queue inside the eth_dev means that it's as thread-safe as the existing tx_burst function, and also is completely driver agnostic.