From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so2.wedos.net (wes1-so2.wedos.net [46.28.106.16]) by dpdk.org (Postfix) with ESMTP id 954C19192 for ; Mon, 4 Jan 2016 21:09:51 +0100 (CET) Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz [147.229.13.147]) by wes1-so2.wedos.net (Postfix) with ESMTPSA id 3pZ7NH3FS4zrs; Mon, 4 Jan 2016 21:09:51 +0100 (CET) From: Jan Viktorin To: dev@dpdk.org Date: Mon, 4 Jan 2016 21:08:20 +0100 Message-Id: <1451938106-12145-9-git-send-email-viktorin@rehivetech.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1451938106-12145-1-git-send-email-viktorin@rehivetech.com> References: <1451938106-12145-1-git-send-email-viktorin@rehivetech.com> Cc: Jan Viktorin Subject: [dpdk-dev] [PATCH 08/14] eal/common: introduce rte_bus_addr 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, 04 Jan 2016 20:09:51 -0000 To support a generic manipulation with devices we need to have a general representation of the rte_*_addr which replaces the rte_pci_addr in the code. Here we introduce the rte_bus_addr consisting of a union of various rte_*_addr fields and the device magic to discriminate among them. A wrapper around rte_eal_compare_pci_addr is introduced and it will be extended while adding a new non-PCI infra. Signed-off-by: Jan Viktorin --- lib/librte_eal/common/include/rte_dev.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index c99d038..48c46fd 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -161,6 +161,23 @@ union rte_device { } /** + * Generic bus address of a device. + */ +struct rte_bus_addr { + union { + struct rte_pci_addr pci; + }; + unsigned int dev_magic; +}; + +static inline int +rte_eal_compare_bus_addr(const struct rte_bus_addr *a, + const struct rte_bus_addr *b) +{ + return rte_eal_compare_pci_addr(&a->pci, &b->pci); +} + +/** * Register a device driver. * * @param driver -- 2.6.3