From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 6B8572C38 for ; Sun, 7 Oct 2018 11:32:55 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1595221EF8; Sun, 7 Oct 2018 05:32:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 07 Oct 2018 05:32:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=JY+o+Nh04w kl88TnVivQzFAqOQwuxcxgzdT3ApdVd6M=; b=XsErw1spZLJQW70CuA9qRBJFAH Cq2ZSHk/iIaSzQYUwrilKNFfOmJeDZwlRU515ufRbcR0zejrNvWsvt/2oKPueZ80 LLUh3AztEllle7/2/eA2ndpE4iZYOffgNYi5h7UV8VtI+lFqwr234sG6JosMkPOs OzL6/O5RIrjcAzMSI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=JY+o+Nh04wkl88TnVivQzFAqOQwuxcxgzdT3ApdVd6M=; b=iMf2/7XL RMzBTFAD97ELQFkufLVrAIMLHKifGa3CvmvROv21RPySYlK8u/YjEkE974DuTDZo QsYTzOSAVoSGTiWDucFSxqUEK+4DX82QTv/hYqSTw9d0BUe7p97M5nto2QUMjuIt NIflP8+N1dhUIzeQ4Dgoe1R2cj0ogMrSM50Ikqk6vXBkxQNcgJkErxWh3/pq/MjY zJvZq42nHYxWEkf7MDF76cPY8iQEMCHL4PsqYsTsyc+T0VSmIPgWJu0/ifoypOIp RKe1IYSRkBY2pv3PThO1MTK1FWPMjn7S6S6CFZ6yJ81vLqm8bWPoQHLb1KfIEAEJ 49lyDbbJU3bg3A== X-ME-Sender: X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id D35CE102EB; Sun, 7 Oct 2018 05:32:53 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, ophirmu@mellanox.com, qi.z.zhang@intel.com, ferruh.yigit@intel.com, ktraynor@redhat.com Date: Sun, 7 Oct 2018 11:32:42 +0200 Message-Id: <20181007093244.20659-4-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181007093244.20659-1-thomas@monjalon.net> References: <20180907222727.20521-1-thomas@monjalon.net> <20181007093244.20659-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 3/5] eal: add bus pointer in device structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2018 09:32:56 -0000 When a device is added with a devargs (hotplug or whitelist), the bus pointer can be retrieved via its devargs. But there is no such devargs.bus in case of standard scan. A pointer to the rte_bus handle is added to rte_device. When a device is allocated (during a scan), the pointer to its bus is assigned. It will make possible to remove a rte_device, using the function pointer from its bus. The function rte_bus_find_by_device() becomes useless, and may be removed later. Signed-off-by: Thomas Monjalon Acked-by: Gaetan Rivet --- doc/guides/rel_notes/release_18_11.rst | 15 ++++++++++----- drivers/bus/dpaa/Makefile | 2 +- drivers/bus/dpaa/dpaa_bus.c | 2 ++ drivers/bus/dpaa/meson.build | 2 ++ drivers/bus/fslmc/Makefile | 2 +- drivers/bus/fslmc/fslmc_bus.c | 2 ++ drivers/bus/fslmc/meson.build | 2 ++ drivers/bus/ifpga/Makefile | 2 +- drivers/bus/ifpga/ifpga_bus.c | 1 + drivers/bus/ifpga/meson.build | 2 ++ drivers/bus/pci/Makefile | 2 +- drivers/bus/pci/bsd/pci.c | 2 ++ drivers/bus/pci/linux/pci.c | 1 + drivers/bus/pci/meson.build | 2 ++ drivers/bus/pci/private.h | 2 ++ drivers/bus/vdev/Makefile | 2 +- drivers/bus/vdev/meson.build | 2 ++ drivers/bus/vdev/vdev.c | 1 + drivers/bus/vmbus/Makefile | 2 +- drivers/bus/vmbus/linux/vmbus_bus.c | 1 + drivers/bus/vmbus/meson.build | 2 ++ drivers/bus/vmbus/private.h | 3 +++ lib/librte_eal/common/include/rte_dev.h | 1 + 23 files changed, 44 insertions(+), 11 deletions(-) diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst index d534bb71c..c87522f27 100644 --- a/doc/guides/rel_notes/release_18_11.rst +++ b/doc/guides/rel_notes/release_18_11.rst @@ -164,6 +164,10 @@ ABI Changes ``rte_config`` structure on account of improving DPDK usability when using either ``--legacy-mem`` or ``--single-file-segments`` flags. +* eal: The structure ``rte_device`` got a new field to reference a ``rte_bus``. + It is changing the size of the ``struct rte_device`` and the inherited + device structures of all buses. + Removed Items ------------- @@ -199,11 +203,12 @@ The libraries prepended with a plus sign were incremented in this version. librte_bbdev.so.1 librte_bitratestats.so.2 librte_bpf.so.1 - librte_bus_dpaa.so.1 - librte_bus_fslmc.so.1 - librte_bus_pci.so.1 - librte_bus_vdev.so.1 - + librte_bus_vmbus.so.1 + + librte_bus_dpaa.so.2 + + librte_bus_fslmc.so.2 + + librte_bus_ifpga.so.2 + + librte_bus_pci.so.2 + + librte_bus_vdev.so.2 + + librte_bus_vmbus.so.2 librte_cfgfile.so.2 librte_cmdline.so.2 librte_common_octeontx.so.1 diff --git a/drivers/bus/dpaa/Makefile b/drivers/bus/dpaa/Makefile index bffaa9d92..9337b5f92 100644 --- a/drivers/bus/dpaa/Makefile +++ b/drivers/bus/dpaa/Makefile @@ -24,7 +24,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include # versioning export map EXPORT_MAP := rte_bus_dpaa_version.map -LIBABIVER := 1 +LIBABIVER := 2 # all source are stored in SRCS-y # diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 49cd04dbb..138e0f98d 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -165,6 +165,8 @@ dpaa_create_device_list(void) goto cleanup; } + dev->device.bus = &rte_dpaa_bus.bus; + cfg = &dpaa_netcfg->port_cfg[i]; fman_intf = cfg->fman_if; diff --git a/drivers/bus/dpaa/meson.build b/drivers/bus/dpaa/meson.build index d10b62c03..5e7705571 100644 --- a/drivers/bus/dpaa/meson.build +++ b/drivers/bus/dpaa/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018 NXP +version = 2 + if host_machine.system() != 'linux' build = false endif diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index 515d0f534..e95551980 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -24,7 +24,7 @@ LDLIBS += -lrte_ethdev EXPORT_MAP := rte_bus_fslmc_version.map # library version -LIBABIVER := 1 +LIBABIVER := 2 SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \ qbman/qbman_portal.c \ diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index bfe81e236..960f55071 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -161,6 +161,8 @@ scan_one_fslmc_device(char *dev_name) return -ENOMEM; } + dev->device.bus = &rte_fslmc_bus.bus; + /* Parse the device name and ID */ t_ptr = strtok(dup_dev_name, "."); if (!t_ptr) { diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build index 22a56a6fc..54ca92d0c 100644 --- a/drivers/bus/fslmc/meson.build +++ b/drivers/bus/fslmc/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018 NXP +version = 2 + if host_machine.system() != 'linux' build = false endif diff --git a/drivers/bus/ifpga/Makefile b/drivers/bus/ifpga/Makefile index 3ff3bdb81..514452b39 100644 --- a/drivers/bus/ifpga/Makefile +++ b/drivers/bus/ifpga/Makefile @@ -19,7 +19,7 @@ LDLIBS += -lrte_kvargs EXPORT_MAP := rte_bus_ifpga_version.map # library version -LIBABIVER := 1 +LIBABIVER := 2 SRCS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS) += ifpga_bus.c SRCS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS) += ifpga_common.c diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 3ef035b7e..80663328a 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -142,6 +142,7 @@ ifpga_scan_one(struct rte_rawdev *rawdev, if (!afu_dev) goto end; + afu_dev->device.bus = &rte_ifpga_bus; afu_dev->device.devargs = devargs; afu_dev->device.numa_node = SOCKET_ID_ANY; afu_dev->device.name = devargs->name; diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build index c9b08c862..0b5c38d54 100644 --- a/drivers/bus/ifpga/meson.build +++ b/drivers/bus/ifpga/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2010-2018 Intel Corporation +version = 2 + deps += ['pci', 'kvargs', 'rawdev'] install_headers('rte_bus_ifpga.h') sources = files('ifpga_common.c', 'ifpga_bus.c') diff --git a/drivers/bus/pci/Makefile b/drivers/bus/pci/Makefile index 4de953f8f..f33e0120f 100644 --- a/drivers/bus/pci/Makefile +++ b/drivers/bus/pci/Makefile @@ -4,7 +4,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_bus_pci.a -LIBABIVER := 1 +LIBABIVER := 2 EXPORT_MAP := rte_bus_pci_version.map CFLAGS := -I$(SRCDIR) $(CFLAGS) diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index 655b34b7e..40641cad4 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -223,6 +223,8 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) } memset(dev, 0, sizeof(*dev)); + dev->device.bus = &rte_pci_bus.bus; + dev->addr.domain = conf->pc_sel.pc_domain; dev->addr.bus = conf->pc_sel.pc_bus; dev->addr.devid = conf->pc_sel.pc_dev; diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 04648ac93..e31bbb370 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -228,6 +228,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) return -1; memset(dev, 0, sizeof(*dev)); + dev->device.bus = &rte_pci_bus.bus; dev->addr = *addr; /* get vendor id */ diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build index 23d6a5fec..ef9492bb8 100644 --- a/drivers/bus/pci/meson.build +++ b/drivers/bus/pci/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation +version = 2 + deps += ['pci'] install_headers('rte_bus_pci.h') sources = files('pci_common.c', diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h index 0e689fa74..04bffa6e7 100644 --- a/drivers/bus/pci/private.h +++ b/drivers/bus/pci/private.h @@ -15,6 +15,8 @@ extern struct rte_pci_bus rte_pci_bus; struct rte_pci_driver; struct rte_pci_device; +extern struct rte_pci_bus rte_pci_bus; + /** * Probe the PCI bus * diff --git a/drivers/bus/vdev/Makefile b/drivers/bus/vdev/Makefile index 1f9cd7ebe..803b8ea7b 100644 --- a/drivers/bus/vdev/Makefile +++ b/drivers/bus/vdev/Makefile @@ -16,7 +16,7 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API EXPORT_MAP := rte_bus_vdev_version.map # library version -LIBABIVER := 1 +LIBABIVER := 2 SRCS-y += vdev.c SRCS-y += vdev_params.c diff --git a/drivers/bus/vdev/meson.build b/drivers/bus/vdev/meson.build index 12605e5c7..803785f10 100644 --- a/drivers/bus/vdev/meson.build +++ b/drivers/bus/vdev/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation +version = 2 + sources = files('vdev.c', 'vdev_params.c') install_headers('rte_bus_vdev.h') diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index efca962f7..0142fb2c8 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -456,6 +456,7 @@ vdev_scan(void) continue; } + dev->device.bus = &rte_vdev_bus; dev->device.devargs = devargs; dev->device.numa_node = SOCKET_ID_ANY; dev->device.name = devargs->name; diff --git a/drivers/bus/vmbus/Makefile b/drivers/bus/vmbus/Makefile index deee9dd10..e54c557c6 100644 --- a/drivers/bus/vmbus/Makefile +++ b/drivers/bus/vmbus/Makefile @@ -3,7 +3,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_bus_vmbus.a -LIBABIVER := 1 +LIBABIVER := 2 EXPORT_MAP := rte_bus_vmbus_version.map CFLAGS += -I$(SRCDIR) diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c index 527a6a39f..a4755a387 100644 --- a/drivers/bus/vmbus/linux/vmbus_bus.c +++ b/drivers/bus/vmbus/linux/vmbus_bus.c @@ -229,6 +229,7 @@ vmbus_scan_one(const char *name) if (dev == NULL) return -1; + dev->device.bus = &rte_vmbus_bus.bus; dev->device.name = strdup(name); if (!dev->device.name) goto error; diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build index 18daabecc..0e4d058ee 100644 --- a/drivers/bus/vmbus/meson.build +++ b/drivers/bus/vmbus/meson.build @@ -1,5 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause +version = 2 + allow_experimental_apis = true install_headers('rte_bus_vmbus.h','rte_vmbus_reg.h') diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h index f2022a68c..211127dd8 100644 --- a/drivers/bus/vmbus/private.h +++ b/drivers/bus/vmbus/private.h @@ -10,11 +10,14 @@ #include #include #include +#include #ifndef PAGE_SIZE #define PAGE_SIZE 4096 #endif +extern struct rte_vmbus_bus rte_vmbus_bus; + extern int vmbus_logtype_bus; #define VMBUS_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \ diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index b80a80598..d82cba847 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -157,6 +157,7 @@ struct rte_device { TAILQ_ENTRY(rte_device) next; /**< Next device */ const char *name; /**< Device name */ const struct rte_driver *driver;/**< Associated driver */ + const struct rte_bus *bus; /**< Bus handle assigned on scan */ int numa_node; /**< NUMA node connection */ struct rte_devargs *devargs; /**< Device user arguments */ }; -- 2.19.0