From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by dpdk.org (Postfix) with ESMTP id 58C9A685E for ; Mon, 30 May 2016 11:32:37 +0200 (CEST) Received: by mail-lf0-f50.google.com with SMTP id b73so47330492lfb.3 for ; Mon, 30 May 2016 02:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=iKg4BP5a3m3xB3t4v0e/Cxi6bPGYwk6M5i4lmbDniY0=; b=S7bwjISudkbUgidC5zx5tmS3CKXlrRsRl6ky3kJURrSOSSU4LovfRZVCzKLmevnKOp GzX7oZ5WJ04vDrXrw8DGw1HTS3EDA06yeW6G0jv9h8tN5kDQct7RnU8plYLDrwOXHlIp hcMyCQ6qP37IStj44Uy9INyzfMEhYeLEm+Ap75hHEiIzzDtSH3+thxqNLU+5FXNCI8WL eyCW9jsifIO+r8BvmsVPItzYBn/VTyaRIB3VsDJUOLvnznjako0BPzevqPENt5fF0P7S HZ4pyeFhTp4p6FyQt2e7D1whiqocfJ4e79CU4jNjXwyTlVlonrj+dHmOxcDSfaW4jeDY r+Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=iKg4BP5a3m3xB3t4v0e/Cxi6bPGYwk6M5i4lmbDniY0=; b=iVgJ8IlxjWPRtjsuwY7Cf+XlMd7Mdph3kopJ/QajZQy1IOvwCZQ3EtXe344dta6lAh 2mHHRb6t93slLzSAk0UeSsfsI7FciWjeTU+vLIsxglfkrg/uqB80oVwDn8Byc/Nf1FyH 4Jq+V4e96RnTqrFhnN7SibNr3z47B9DiR34g0VO7etxbSaj5qtKQGEjP+qFtDWMIkmU4 ONwINkMQY+Wo7qZTD6aX6+UdCAXD5k4bH8Y9ZAa3wIJTpl6gbvgVGWf72JrYPGdL3EeI NaXETRzxYQgSDseoIxzNxYvI/S6K1JYMxoZMgeVpHqfgBZswRD/NeOzHpn8xh6FvcsM4 uvlg== X-Gm-Message-State: ALyK8tK0mOpJlPQtqoQFc2y471nTqlT9uqv7+jiD2KrqooQOv+vv76ZxU03VYmJE/3R+qQ== X-Received: by 10.46.0.39 with SMTP id 39mr5261845lja.60.1464600757011; Mon, 30 May 2016 02:32:37 -0700 (PDT) Received: from [10.0.2.212] (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.googlemail.com with ESMTPSA id k66sm4583287lfe.32.2016.05.30.02.32.35 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 May 2016 02:32:36 -0700 (PDT) To: Panu Matilainen , remy.horton@intel.com, thomas.monjalon@6wind.com References: <1462963714-21022-1-git-send-email-zr@semihalf.com> <1464158214-24733-1-git-send-email-zr@semihalf.com> Cc: dev@dpdk.org From: Zyta Szpak Message-ID: <574C08B3.8060301@semihalf.com> Date: Mon, 30 May 2016 11:32:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: add callback to get register size in bytes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2016 09:32:37 -0000 On 27.05.2016 12:28, Panu Matilainen wrote: > On 05/25/2016 09:36 AM, zr@semihalf.com wrote: >> From: Zyta Szpak >> >> Version 2 of fixing the fixed register width assumption. >> 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. >> >> Signed-off-by: Zyta Szpak >> --- >> lib/librte_ether/rte_ethdev.c | 12 ++++++++++++ >> lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++++++ >> 2 files changed, 30 insertions(+) >> >> diff --git a/lib/librte_ether/rte_ethdev.c >> b/lib/librte_ether/rte_ethdev.c >> index a31018e..e0765f8 100644 >> --- a/lib/librte_ether/rte_ethdev.c >> +++ b/lib/librte_ether/rte_ethdev.c >> @@ -3231,6 +3231,18 @@ rte_eth_dev_get_reg_length(uint8_t port_id) >> } >> >> int >> +rte_eth_dev_get_reg_width(uint8_t port_id) >> +{ >> + struct rte_eth_dev *dev; >> + >> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >> + >> + dev = &rte_eth_devices[port_id]; >> + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg_width, -ENOTSUP); >> + return (*dev->dev_ops->get_reg_width)(dev); >> +} >> + >> +int >> rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info >> *info) >> { >> struct rte_eth_dev *dev; >> diff --git a/lib/librte_ether/rte_ethdev.h >> b/lib/librte_ether/rte_ethdev.h >> index 2757510..552eaed 100644 >> --- a/lib/librte_ether/rte_ethdev.h >> +++ b/lib/librte_ether/rte_ethdev.h >> @@ -1292,6 +1292,9 @@ typedef int (*eth_timesync_write_time)(struct >> rte_eth_dev *dev, >> typedef int (*eth_get_reg_length_t)(struct rte_eth_dev *dev); >> /**< @internal Retrieve device register count */ >> >> +typedef int (*eth_get_reg_width_t)(struct rte_eth_dev *dev); >> +/**< @internal Retrieve device register byte number */ >> + >> typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev, >> struct rte_dev_reg_info *info); >> /**< @internal Retrieve registers */ >> @@ -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 */ >> eth_get_eeprom_length_t get_eeprom_length; > > This is an ABI break, but maybe it is part of that "driver > implementation API" which is exempt from the ABI/API policies. Thomas? > >> @@ -3971,6 +3976,19 @@ int rte_eth_tx_queue_info_get(uint8_t port_id, >> uint16_t queue_id, >> */ >> int rte_eth_dev_get_reg_length(uint8_t port_id); >> >> +/* >> + * Retrieve the number of bytes in register for a specific device >> + * >> + * @param port_id >> + * The port identifier of the Ethernet device. >> + * @return >> + * - (>=0) number of registers if successful. >> + * - (-ENOTSUP) if hardware doesn't support. >> + * - (-ENODEV) if *port_id* invalid. >> + * - others depends on the specific operations implementation. >> + */ >> +int rte_eth_dev_get_reg_width(uint8_t port_id); >> + >> /** >> * Retrieve device registers and register attributes >> * > > The function needs to be exported via rte_ether_version.map as well. OK, right! > > - Panu - >> >