From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: A question about (poor) rte_ethdev internal rx/tx callbacks design Date: Mon, 13 Nov 2017 11:39:27 +0100 Message-ID: <20171113103927.GP24849@6wind.com> References: <2259E047-80C0-40AC-AAF4-F21617605508@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Ilya Matveychikov Return-path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 40CAF1B34E for ; Mon, 13 Nov 2017 11:39:40 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id z3so14153365wme.5 for ; Mon, 13 Nov 2017 02:39:40 -0800 (PST) Content-Disposition: inline In-Reply-To: <2259E047-80C0-40AC-AAF4-F21617605508@gmail.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sat, Nov 11, 2017 at 09:18:45PM +0400, Ilya Matveychikov wrote: > Folks, > > Are you serious with it: > > typedef uint16_t (*eth_rx_burst_t)(void *rxq, > struct rte_mbuf **rx_pkts, > uint16_t nb_pkts); > typedef uint16_t (*eth_tx_burst_t)(void *txq, > struct rte_mbuf **tx_pkts, > uint16_t nb_pkts); > > I’m not surprised that every PMD stores port_id in every and each queue as having just the queue as an argument doesn’t allow to get the device. So the question is - why not to use something like: > > typedef uint16_t (*eth_rx_burst_t)(void *dev, uint16_t queue_id, > struct rte_mbuf **rx_pkts, > uint16_t nb_pkts); > typedef uint16_t (*eth_tx_burst_t)(void *dev, uint16_t queue_id, > struct rte_mbuf **tx_pkts, > uint16_t nb_pkts); I assume it's since the rte_eth_[rt]x_burst() wrappers already pay the price for that indirection, doing it twice would be redundant. Basically the cost of storing a back-pointer to dev or a queue index in each Rx/Tx queue structure is minor compared to saving a couple of CPU cycles wherever we can. I'm not saying its the only solution nor the right approach, it's only one possible explanation for this API. -- Adrien Mazarguil 6WIND