From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3 1/2] ethdev: add callback to get register size in bytes Date: Wed, 08 Jun 2016 10:53:20 +0200 Message-ID: <12994980.C5dFrG15Qg@xps13> References: <1464767771-19159-1-git-send-email-zr@semihalf.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: remy.horton@intel.com, dev@dpdk.org To: zr@semihalf.com Return-path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 4BA553F9 for ; Wed, 8 Jun 2016 10:53:22 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id v199so53274317wmv.0 for ; Wed, 08 Jun 2016 01:53:22 -0700 (PDT) In-Reply-To: <1464767771-19159-1-git-send-email-zr@semihalf.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Zyta, 2016-06-01 09:56, zr@semihalf.com: > rte_eth_dev_get_reg_length and rte_eth_dev_get_reg callbacks > do not provide register size to the app in any way. It is > needed to allocate proper number of bytes before retrieving > registers content with rte_eth_dev_get_reg. Yes, register size is needed. And I think it makes sense to register it in the struct rte_dev_reg_info. We already have a length field, so we could just add a width field. > @@ -1455,6 +1458,8 @@ struct eth_dev_ops { > > eth_get_reg_length_t get_reg_length; > /**< Get # of registers */ > + eth_get_reg_width_t get_reg_width; > + /**< Get # of bytes in register */ > eth_get_reg_t get_reg; > /**< Get registers */ I am not sure it is a good practice to add a new function for each parameter of a request. I would prefer having only one function rte_eth_dev_get_regs() which returns length and width if data is NULL. The first call is a parameter request before buffer allocation, and the second call fills the buffer. We can deprecate the old API and introduce this new one. Opinions?