From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3 2/3] ethdev: Add rxtx callback support Date: Wed, 18 Feb 2015 19:19:56 +0100 Message-ID: <1752572.3jiM2I5nLp@xps13> References: <1419266844-4848-1-git-send-email-bruce.richardson@intel.com> <1424281343-2994-1-git-send-email-john.mcnamara@intel.com> <1424281343-2994-3-git-send-email-john.mcnamara@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: John McNamara , bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org Return-path: In-Reply-To: <1424281343-2994-3-git-send-email-john.mcnamara-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 2015-02-18 17:42, John McNamara: > From: Richardson, Bruce > > Add in support for inline processing of packets inside the RX or > TX call. For an RX callback, what happens is that we get a set of > packets from the NIC and then pass them to a callback function, if > configured, to allow additional processing to be done on them, e.g. > filling in more mbuf fields, before passing back to the application. > On TX, the packets are similarly post-processed before being handed > to the NIC for transmission. > > Signed-off-by: Bruce Richardson > Signed-off-by: John McNamara [...] > @@ -2393,7 +2447,18 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id, > struct rte_eth_dev *dev; > > dev = &rte_eth_devices[port_id]; > - return (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], rx_pkts, nb_pkts); > + nb_pkts = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], rx_pkts, > + nb_pkts); > + struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id]; > + > + if (unlikely(cb != NULL)) { > + do { > + nb_pkts = cb->fn(port_id, queue_id, rx_pkts, nb_pkts, > + cb->param); > + cb = cb->next; > + } while (cb != NULL); > + } Excuse me, it wasn't very clear for me but I thought from the following email that the consensus was to use a compile-time option: http://dpdk.org/ml/archives/dev/2015-February/013450.html