From patchwork Mon Sep 14 08:23:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 77589 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2ED94A04C9; Mon, 14 Sep 2020 10:24:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD1E31C0D9; Mon, 14 Sep 2020 10:24:05 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 28F5D1C0D8 for ; Mon, 14 Sep 2020 10:24:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600071843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2Ach6iSvxuOhER5LDmuFn1zC44Y0WfwkpK7TXWhMC6s=; b=VNS+RP2zKbSErop8JE/1J4W2CtsAozZOuy5fhyJs8nozeQhvZM/BVGvgBnbPSz2BbYEaKi U5nylugoO96Bg3UFSA1E+z0KDprHalxy5aXgCPTcsvCr/skH5CbP7YTJGu0C53fzxJYAZz fxc8e/h4p0cV5bTrgmLBTYv79mKc7yw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-100-imcSxQj-PPubua2WFZ4_Gw-1; Mon, 14 Sep 2020 04:24:01 -0400 X-MC-Unique: imcSxQj-PPubua2WFZ4_Gw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B383818BFED0; Mon, 14 Sep 2020 08:23:59 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9D3D1A268; Mon, 14 Sep 2020 08:23:54 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ray Kinsella , Neil Horman , John McNamara , Marko Kovacevic , Zyta Szpak , Liron Himi , Harman Kalra , Bruce Richardson , Jasvinder Singh , Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Date: Mon, 14 Sep 2020 10:23:45 +0200 Message-Id: <20200914082350.13279-2-david.marchand@redhat.com> In-Reply-To: <20200914082350.13279-1-david.marchand@redhat.com> References: <20200914081727.12215-1-david.marchand@redhat.com> <20200914082350.13279-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This field was not generic as it was filled with PCI kernel drivers only. It has no known in-tree user (and I could not find opensource projects using it). Signed-off-by: David Marchand Acked-by: Andrew Rybchenko --- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_20_11.rst | 3 +++ drivers/net/mvneta/mvneta_ethdev.c | 1 - drivers/net/mvpp2/mrvl_ethdev.c | 1 - drivers/net/octeontx/octeontx_ethdev.c | 1 - drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/softnic/rte_eth_softnic.c | 1 - lib/librte_ethdev/rte_ethdev_core.h | 1 - lib/librte_ethdev/rte_ethdev_pci.h | 1 - lib/librte_ethdev/rte_ethdev_vdev.h | 1 - 10 files changed, 3 insertions(+), 11 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 64d588d7e0..f13248a0fe 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -127,9 +127,6 @@ Deprecation Notices * pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private to the PCI subsystem as it is used only by the PCI bus driver and PCI drivers. - The associated field ``kdrv`` in the ethdev ``rte_eth_dev_data`` structure - will be removed as it gave no useful abstracted information to the - applications and had no user (neither internal nor external). * mbuf: Some fields will be converted to dynamic API in DPDK 20.11 in order to reserve more space for the dynamic fields, as explained in diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index 5d5be0065a..442b201678 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -87,6 +87,9 @@ API Changes * eal: The ``rte_logs`` struct and global symbol was made private and is no longer part of the API. +* ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data`` + structure as it gave no useful abstracted information to the applications. + * rawdev: Added a structure size parameter to the functions ``rte_rawdev_queue_setup()``, ``rte_rawdev_queue_conf_get()``, ``rte_rawdev_info_get()`` and ``rte_rawdev_configure()``, diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 673a8e2b3a..5bf3ebc4bd 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -827,7 +827,6 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name) memcpy(eth_dev->data->mac_addrs[0].addr_bytes, req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN); - eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->device = &vdev->device; eth_dev->rx_pkt_burst = mvneta_rx_pkt_burst; mvneta_set_tx_function(eth_dev); diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 96b27dfd30..f5e77d07bf 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -2856,7 +2856,6 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name) memcpy(eth_dev->data->mac_addrs[0].addr_bytes, req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN); - eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->device = &vdev->device; eth_dev->rx_pkt_burst = mrvl_rx_pkt_burst; mrvl_set_tx_function(eth_dev); diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 76c69294d0..653ab9b458 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -1363,7 +1363,6 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, eth_dev->device = &dev->device; eth_dev->intr_handle = NULL; - eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->data->numa_node = dev->device.numa_node; data->port_id = eth_dev->data->port_id; diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 733c898259..40fe1ca4ba 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -326,7 +326,6 @@ do_eth_dev_ring_create(const char *name, data->all_multicast = 1; eth_dev->dev_ops = &ops; - data->kdrv = RTE_KDRV_NONE; data->numa_node = numa_node; /* finally assign rx and tx ops */ diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 866d17a93c..e453fd1486 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -391,7 +391,6 @@ pmd_ethdev_register(struct rte_vdev_device *vdev, dev->data->dev_link.link_status = ETH_LINK_DOWN; dev->data->mac_addrs = ð_addr; dev->data->promiscuous = 1; - dev->data->kdrv = RTE_KDRV_NONE; dev->data->numa_node = params->cpu_id; rte_eth_dev_probing_finish(dev); diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 32407dd418..78c7902897 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -866,7 +866,6 @@ struct rte_eth_dev_data { uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT]; /**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */ uint32_t dev_flags; /**< Capabilities. */ - enum rte_kernel_driver kdrv; /**< Kernel driver passthrough. */ int numa_node; /**< NUMA node connection. */ struct rte_vlan_filter_conf vlan_filter_conf; /**< VLAN filter configuration. */ diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h index a999602fdd..6ac6ea41f5 100644 --- a/lib/librte_ethdev/rte_ethdev_pci.h +++ b/lib/librte_ethdev/rte_ethdev_pci.h @@ -67,7 +67,6 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV) eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV; - eth_dev->data->kdrv = pci_dev->kdrv; eth_dev->data->numa_node = pci_dev->device.numa_node; } } diff --git a/lib/librte_ethdev/rte_ethdev_vdev.h b/lib/librte_ethdev/rte_ethdev_vdev.h index b3ef12398e..64fa689ed3 100644 --- a/lib/librte_ethdev/rte_ethdev_vdev.h +++ b/lib/librte_ethdev/rte_ethdev_vdev.h @@ -74,7 +74,6 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size) eth_dev->device = &dev->device; eth_dev->intr_handle = NULL; - eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->data->numa_node = dev->device.numa_node; return eth_dev; } From patchwork Mon Sep 14 08:23:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 77590 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 83717A04C9; Mon, 14 Sep 2020 10:24:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6C1421C10F; Mon, 14 Sep 2020 10:24:16 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id EC6141C0D8 for ; Mon, 14 Sep 2020 10:24:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600071854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2PvzxxQhOcIfD0ZpsvnH73enWtBuR8pb3306L48y/nc=; b=Jsfsk6tAc4fPuee01mKr3l6hC6RtNunyEo1DzjrRXAZIxucjECYbTMQtU24Rf3f6pQw1d6 Ow9dyNbpLJ5th9YcovH17IAOfrPDF6hM8nwJ2AO98Wm81TrXi/rFLHUdUOha5fXXs5viyx CBEAvTCiCYN1CwKQ1ZuglwatWHnJncc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-124-eAz2vZI5Md2zADTtPXncdQ-1; Mon, 14 Sep 2020 04:24:12 -0400 X-MC-Unique: eAz2vZI5Md2zADTtPXncdQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90296801AC2; Mon, 14 Sep 2020 08:24:10 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F8F41A268; Mon, 14 Sep 2020 08:24:00 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ray Kinsella , Neil Horman , John McNamara , Marko Kovacevic , Ferruh Yigit , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , "Wei Hu (Xavier)" , "Min Hu (Connor)" , Yisen Zhuang , Shijith Thotton , Srisivasubramanian Srinivasan , Heinrich Kuhn , Maxime Coquelin , Chenbo Xia , Zhihong Wang Date: Mon, 14 Sep 2020 10:23:46 +0200 Message-Id: <20200914082350.13279-3-david.marchand@redhat.com> In-Reply-To: <20200914082350.13279-1-david.marchand@redhat.com> References: <20200914081727.12215-1-david.marchand@redhat.com> <20200914082350.13279-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 2/6] bus/pci: switch to private kernel driver enum 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The rte_kernel_driver enum actually only pointed at PCI drivers and is only used in the PCI subsystem. Remove it from the generic device API and use a private enum in the PCI code. Signed-off-by: David Marchand Acked-by: Andrew Rybchenko --- doc/guides/rel_notes/deprecation.rst | 4 -- doc/guides/rel_notes/release_20_11.rst | 3 ++ drivers/bus/pci/bsd/pci.c | 17 ++++--- drivers/bus/pci/linux/pci.c | 64 ++++++++++++------------- drivers/bus/pci/linux/pci_uio.c | 2 +- drivers/bus/pci/pci_common.c | 16 +++---- drivers/bus/pci/rte_bus_pci.h | 11 ++++- drivers/bus/pci/windows/pci.c | 6 +-- drivers/net/hinic/base/hinic_pmd_hwif.c | 2 +- drivers/net/hns3/hns3_ethdev_vf.c | 4 +- drivers/net/liquidio/lio_ethdev.c | 4 +- drivers/net/nfp/nfp_net.c | 2 +- drivers/net/virtio/virtio_pci.c | 2 +- lib/librte_eal/include/rte_dev.h | 12 ----- 14 files changed, 72 insertions(+), 77 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index f13248a0fe..d9357fa182 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -124,10 +124,6 @@ Deprecation Notices With this removal, there won't be a need for the mentioned workaround which will be reverted. -* pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private - to the PCI subsystem as it is used only by the PCI bus driver and PCI - drivers. - * mbuf: Some fields will be converted to dynamic API in DPDK 20.11 in order to reserve more space for the dynamic fields, as explained in `this presentation `_. diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index 442b201678..bffbe31947 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -87,6 +87,9 @@ API Changes * eal: The ``rte_logs`` struct and global symbol was made private and is no longer part of the API. +* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and + replaced with a private enum in the PCI subsystem. + * ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data`` structure as it gave no useful abstracted information to the applications. diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index 6ec27b4b5b..a07fc241fe 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -65,7 +65,7 @@ rte_pci_map_device(struct rte_pci_device *dev) /* try mapping the NIC resources */ switch (dev->kdrv) { - case RTE_KDRV_NIC_UIO: + case RTE_PCI_KDRV_NIC_UIO: /* map resources for devices that use uio */ ret = pci_uio_map_resource(dev); break; @@ -85,7 +85,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev) { /* try unmapping the NIC resources */ switch (dev->kdrv) { - case RTE_KDRV_NIC_UIO: + case RTE_PCI_KDRV_NIC_UIO: /* unmap resources for devices that use uio */ pci_uio_unmap_resource(dev); break; @@ -255,7 +255,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) pci_name_set(dev); /* FreeBSD has only one pass through driver */ - dev->kdrv = RTE_KDRV_NIC_UIO; + dev->kdrv = RTE_PCI_KDRV_NIC_UIO; /* parse resources */ switch (conf->pc_hdr & PCIM_HDRTYPE) { @@ -395,8 +395,7 @@ enum rte_iova_mode pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused, const struct rte_pci_device *pdev) { - /* Supports only RTE_KDRV_NIC_UIO */ - if (pdev->kdrv != RTE_KDRV_NIC_UIO) + if (pdev->kdrv != RTE_PCI_KDRV_NIC_UIO) RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to IOVA as 'PA'\n"); return RTE_IOVA_PA; @@ -548,7 +547,7 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar, switch (dev->kdrv) { #if defined(RTE_ARCH_X86) - case RTE_KDRV_NIC_UIO: + case RTE_PCI_KDRV_NIC_UIO: if (rte_eal_iopl_init() != 0) { RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n", __func__, dev->name); @@ -606,7 +605,7 @@ rte_pci_ioport_read(struct rte_pci_ioport *p, void *data, size_t len, off_t offset) { switch (p->dev->kdrv) { - case RTE_KDRV_NIC_UIO: + case RTE_PCI_KDRV_NIC_UIO: pci_uio_ioport_read(p, data, len, offset); break; default: @@ -648,7 +647,7 @@ rte_pci_ioport_write(struct rte_pci_ioport *p, const void *data, size_t len, off_t offset) { switch (p->dev->kdrv) { - case RTE_KDRV_NIC_UIO: + case RTE_PCI_KDRV_NIC_UIO: pci_uio_ioport_write(p, data, len, offset); break; default: @@ -663,7 +662,7 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p) switch (p->dev->kdrv) { #if defined(RTE_ARCH_X86) - case RTE_KDRV_NIC_UIO: + case RTE_PCI_KDRV_NIC_UIO: ret = 0; break; #endif diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index a2198abf43..bf275947f4 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -68,14 +68,14 @@ rte_pci_map_device(struct rte_pci_device *dev) /* try mapping the NIC resources using VFIO if it exists */ switch (dev->kdrv) { - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: #ifdef VFIO_PRESENT if (pci_vfio_is_enabled()) ret = pci_vfio_map_resource(dev); #endif break; - case RTE_KDRV_IGB_UIO: - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_IGB_UIO: + case RTE_PCI_KDRV_UIO_GENERIC: if (rte_eal_using_phys_addrs()) { /* map resources for devices that use uio */ ret = pci_uio_map_resource(dev); @@ -97,14 +97,14 @@ rte_pci_unmap_device(struct rte_pci_device *dev) { /* try unmapping the NIC resources using VFIO if it exists */ switch (dev->kdrv) { - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: #ifdef VFIO_PRESENT if (pci_vfio_is_enabled()) pci_vfio_unmap_resource(dev); #endif break; - case RTE_KDRV_IGB_UIO: - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_IGB_UIO: + case RTE_PCI_KDRV_UIO_GENERIC: /* unmap resources for devices that use uio */ pci_uio_unmap_resource(dev); break; @@ -323,15 +323,15 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) if (!ret) { if (!strcmp(driver, "vfio-pci")) - dev->kdrv = RTE_KDRV_VFIO; + dev->kdrv = RTE_PCI_KDRV_VFIO; else if (!strcmp(driver, "igb_uio")) - dev->kdrv = RTE_KDRV_IGB_UIO; + dev->kdrv = RTE_PCI_KDRV_IGB_UIO; else if (!strcmp(driver, "uio_pci_generic")) - dev->kdrv = RTE_KDRV_UIO_GENERIC; + dev->kdrv = RTE_PCI_KDRV_UIO_GENERIC; else - dev->kdrv = RTE_KDRV_UNKNOWN; + dev->kdrv = RTE_PCI_KDRV_UNKNOWN; } else { - dev->kdrv = RTE_KDRV_NONE; + dev->kdrv = RTE_PCI_KDRV_NONE; return 0; } /* device is valid, add in list (sorted) */ @@ -608,7 +608,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, enum rte_iova_mode iova_mode = RTE_IOVA_DC; switch (pdev->kdrv) { - case RTE_KDRV_VFIO: { + case RTE_PCI_KDRV_VFIO: { #ifdef VFIO_PRESENT static int is_vfio_noiommu_enabled = -1; @@ -626,8 +626,8 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, break; } - case RTE_KDRV_IGB_UIO: - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_IGB_UIO: + case RTE_PCI_KDRV_UIO_GENERIC: iova_mode = RTE_IOVA_PA; break; @@ -647,11 +647,11 @@ int rte_pci_read_config(const struct rte_pci_device *device, const struct rte_intr_handle *intr_handle = &device->intr_handle; switch (device->kdrv) { - case RTE_KDRV_IGB_UIO: - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_IGB_UIO: + case RTE_PCI_KDRV_UIO_GENERIC: return pci_uio_read_config(intr_handle, buf, len, offset); #ifdef VFIO_PRESENT - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: return pci_vfio_read_config(intr_handle, buf, len, offset); #endif default: @@ -671,11 +671,11 @@ int rte_pci_write_config(const struct rte_pci_device *device, const struct rte_intr_handle *intr_handle = &device->intr_handle; switch (device->kdrv) { - case RTE_KDRV_IGB_UIO: - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_IGB_UIO: + case RTE_PCI_KDRV_UIO_GENERIC: return pci_uio_write_config(intr_handle, buf, len, offset); #ifdef VFIO_PRESENT - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: return pci_vfio_write_config(intr_handle, buf, len, offset); #endif default: @@ -760,15 +760,15 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar, switch (dev->kdrv) { #ifdef VFIO_PRESENT - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: if (pci_vfio_is_enabled()) ret = pci_vfio_ioport_map(dev, bar, p); break; #endif - case RTE_KDRV_IGB_UIO: + case RTE_PCI_KDRV_IGB_UIO: ret = pci_uio_ioport_map(dev, bar, p); break; - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_UIO_GENERIC: #if defined(RTE_ARCH_X86) ret = pci_ioport_map(dev, bar, p); #else @@ -791,14 +791,14 @@ rte_pci_ioport_read(struct rte_pci_ioport *p, { switch (p->dev->kdrv) { #ifdef VFIO_PRESENT - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: pci_vfio_ioport_read(p, data, len, offset); break; #endif - case RTE_KDRV_IGB_UIO: + case RTE_PCI_KDRV_IGB_UIO: pci_uio_ioport_read(p, data, len, offset); break; - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_UIO_GENERIC: pci_uio_ioport_read(p, data, len, offset); break; default: @@ -812,14 +812,14 @@ rte_pci_ioport_write(struct rte_pci_ioport *p, { switch (p->dev->kdrv) { #ifdef VFIO_PRESENT - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: pci_vfio_ioport_write(p, data, len, offset); break; #endif - case RTE_KDRV_IGB_UIO: + case RTE_PCI_KDRV_IGB_UIO: pci_uio_ioport_write(p, data, len, offset); break; - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_UIO_GENERIC: pci_uio_ioport_write(p, data, len, offset); break; default: @@ -834,15 +834,15 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p) switch (p->dev->kdrv) { #ifdef VFIO_PRESENT - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: if (pci_vfio_is_enabled()) ret = pci_vfio_ioport_unmap(p); break; #endif - case RTE_KDRV_IGB_UIO: + case RTE_PCI_KDRV_IGB_UIO: ret = pci_uio_ioport_unmap(p); break; - case RTE_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_UIO_GENERIC: #if defined(RTE_ARCH_X86) ret = 0; #else diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 097dc19225..a354920d5f 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -248,7 +248,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, goto error; } - if (dev->kdrv == RTE_KDRV_IGB_UIO) + if (dev->kdrv == RTE_PCI_KDRV_IGB_UIO) dev->intr_handle.type = RTE_INTR_HANDLE_UIO; else { dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX; diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index a8e5fd52c1..dddf2b2aad 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -465,7 +465,7 @@ pci_hot_unplug_handler(struct rte_device *dev) switch (pdev->kdrv) { #ifdef HAVE_VFIO_DEV_REQ_INTERFACE - case RTE_KDRV_VFIO: + case RTE_PCI_KDRV_VFIO: /* * vfio kernel module guaranty the pci device would not be * deleted until the user space release the resource, so no @@ -476,9 +476,9 @@ pci_hot_unplug_handler(struct rte_device *dev) RTE_DEV_EVENT_REMOVE); break; #endif - case RTE_KDRV_IGB_UIO: - case RTE_KDRV_UIO_GENERIC: - case RTE_KDRV_NIC_UIO: + case RTE_PCI_KDRV_IGB_UIO: + case RTE_PCI_KDRV_UIO_GENERIC: + case RTE_PCI_KDRV_NIC_UIO: /* BARs resource is invalid, remap it to be safe. */ ret = pci_uio_remap_resource(pdev); break; @@ -552,7 +552,7 @@ pci_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len) * In case driver don't provides any specific mapping * try fallback to VFIO. */ - if (pdev->kdrv == RTE_KDRV_VFIO) + if (pdev->kdrv == RTE_PCI_KDRV_VFIO) return rte_vfio_container_dma_map (RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr, iova, len); @@ -575,7 +575,7 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len) * In case driver don't provides any specific mapping * try fallback to VFIO. */ - if (pdev->kdrv == RTE_KDRV_VFIO) + if (pdev->kdrv == RTE_PCI_KDRV_VFIO) return rte_vfio_container_dma_unmap (RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr, iova, len); @@ -622,8 +622,8 @@ rte_pci_get_iommu_class(void) iommu_no_va = pci_device_iommu_support_va(dev) ? 0 : 1; - if (dev->kdrv == RTE_KDRV_UNKNOWN || - dev->kdrv == RTE_KDRV_NONE) + if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN || + dev->kdrv == RTE_PCI_KDRV_NONE) continue; FOREACH_DRIVER_ON_PCIBUS(drv) { enum rte_iova_mode dev_iova_mode; diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 29bea6d70d..ff6f072470 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -51,6 +51,15 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver); struct rte_devargs; +enum rte_pci_kernel_driver { + RTE_PCI_KDRV_UNKNOWN = 0, + RTE_PCI_KDRV_IGB_UIO, + RTE_PCI_KDRV_VFIO, + RTE_PCI_KDRV_UIO_GENERIC, + RTE_PCI_KDRV_NIC_UIO, + RTE_PCI_KDRV_NONE, +}; + /** * A structure describing a PCI device. */ @@ -64,7 +73,7 @@ struct rte_pci_device { struct rte_intr_handle intr_handle; /**< Interrupt handle */ struct rte_pci_driver *driver; /**< PCI driver used in probing */ uint16_t max_vfs; /**< sriov enable if not zero */ - enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ + enum rte_pci_kernel_driver kdrv; /**< Kernel driver passthrough */ char name[PCI_PRI_STR_SIZE+1]; /**< PCI location (ASCII) */ struct rte_intr_handle vfio_req_intr_handle; /**< Handler of VFIO request interrupt */ diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c index c80bd55716..9e5c8fafb0 100644 --- a/drivers/bus/pci/windows/pci.c +++ b/drivers/bus/pci/windows/pci.c @@ -211,7 +211,7 @@ get_device_resource_info(HDEVINFO dev_info, BOOL res; switch (dev->kdrv) { - case RTE_KDRV_NONE: + case RTE_PCI_KDRV_NONE: /* Get NUMA node using DEVPKEY_Device_Numa_Node */ res = SetupDiGetDevicePropertyW(dev_info, dev_info_data, &DEVPKEY_Device_Numa_Node, &property_type, @@ -223,7 +223,7 @@ get_device_resource_info(HDEVINFO dev_info, return -1; } dev->device.numa_node = numa_node; - /* mem_resource - Unneeded for RTE_KDRV_NONE */ + /* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */ dev->mem_resource[0].phys_addr = 0; dev->mem_resource[0].len = 0; dev->mem_resource[0].addr = NULL; @@ -292,7 +292,7 @@ get_kernel_driver_type(struct rte_pci_device *dev) * If another kernel driver is supported the relevant checking * functions should be here */ - dev->kdrv = RTE_KDRV_NONE; + dev->kdrv = RTE_PCI_KDRV_NONE; } static int diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c index d7fc1af707..26fa1e27d4 100644 --- a/drivers/net/hinic/base/hinic_pmd_hwif.c +++ b/drivers/net/hinic/base/hinic_pmd_hwif.c @@ -280,7 +280,7 @@ void hinic_set_msix_state(void *hwdev, u16 msix_idx, enum hinic_msix_state flag) /* vfio-pci does not mmap msi-x vector table to user space, * we can not access the space when kernel driver is vfio-pci */ - if (hw->pcidev_hdl->kdrv == RTE_KDRV_VFIO) + if (hw->pcidev_hdl->kdrv == RTE_PCI_KDRV_VFIO) return; mask_bits = readl(hwif->intr_regs_base + offset); diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 1d2941f0e3..63089d0bd4 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -2425,8 +2425,8 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) * UIO enables msix by writing the pcie configuration space * vfio_pci enables msix in rte_intr_enable. */ - if (pci_dev->kdrv == RTE_KDRV_IGB_UIO || - pci_dev->kdrv == RTE_KDRV_UIO_GENERIC) { + if (pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO || + pci_dev->kdrv == RTE_PCI_KDRV_UIO_GENERIC) { if (hns3vf_enable_msix(pci_dev, true)) hns3_err(hw, "Failed to enable msix"); } diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 2258838c4c..2c2b27e62a 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1563,7 +1563,7 @@ lio_dev_close(struct rte_eth_dev *eth_dev) /* Reset ioq regs */ lio_dev->fn_list.setup_device_regs(lio_dev); - if (lio_dev->pci_dev->kdrv == RTE_KDRV_IGB_UIO) { + if (lio_dev->pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO) { cn23xx_vf_ask_pf_to_do_flr(lio_dev); rte_delay_ms(LIO_PCI_FLR_WAIT); } @@ -2012,7 +2012,7 @@ lio_first_time_init(struct lio_device *lio_dev, goto error; /* Request and wait for device reset. */ - if (pdev->kdrv == RTE_KDRV_IGB_UIO) { + if (pdev->kdrv == RTE_PCI_KDRV_IGB_UIO) { cn23xx_vf_ask_pf_to_do_flr(lio_dev); /* FLR wait time doubled as a precaution. */ rte_delay_ms(LIO_PCI_FLR_WAIT * 2); diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 99946279db..1cf949a9ab 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -3614,7 +3614,7 @@ static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, * interface. Here we avoid this telling to the CPP init code to * use a lock file if UIO is being used. */ - if (dev->kdrv == RTE_KDRV_VFIO) + if (dev->kdrv == RTE_PCI_KDRV_VFIO) cpp = nfp_cpp_from_device_name(dev, 0); else cpp = nfp_cpp_from_device_name(dev, 1); diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index 29a354bf76..9915eabf68 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -704,7 +704,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw) PMD_INIT_LOG(INFO, "trying with legacy virtio pci."); if (rte_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) { rte_pci_unmap_device(dev); - if (dev->kdrv == RTE_KDRV_UNKNOWN && + if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN && (!dev->device.devargs || dev->device.devargs->bus != rte_bus_find_by_name("pci"))) { diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h index c8d985fb5c..53c8bc6fab 100644 --- a/lib/librte_eal/include/rte_dev.h +++ b/lib/librte_eal/include/rte_dev.h @@ -54,18 +54,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name, return; \ } while (0) -/** - * Device driver. - */ -enum rte_kernel_driver { - RTE_KDRV_UNKNOWN = 0, - RTE_KDRV_IGB_UIO, - RTE_KDRV_VFIO, - RTE_KDRV_UIO_GENERIC, - RTE_KDRV_NIC_UIO, - RTE_KDRV_NONE, -}; - /** * Device policies. */ From patchwork Mon Sep 14 08:23:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 77591 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E172CA04C9; Mon, 14 Sep 2020 10:24:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 32F641C120; Mon, 14 Sep 2020 10:24:19 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 78B7E1C11F for ; Mon, 14 Sep 2020 10:24:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600071858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JvCInaX7nJAH1TkFjHJ26d2h8myCHL2pjCawv4LrAqg=; b=aukmGEzcbwYydX8S8MIVhzsL0kBki+h3XtxukBkoYomnq6fHCQVYNG/ZrXto6Ejs5vwUXs kkcs8sQMNh1Wg/AZM48LwC0SGyxMsmsa9qaKyY0bVt7FICbCbypzZ737vmADPOOGFYAnLd WWCAbajHOkAZluqS+bOTO9qbzAOmh4k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-gIUL1VRzNtG-og3ciQekVg-1; Mon, 14 Sep 2020 04:24:16 -0400 X-MC-Unique: gIUL1VRzNtG-og3ciQekVg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43FBD1008552; Mon, 14 Sep 2020 08:24:14 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 760491A268; Mon, 14 Sep 2020 08:24:11 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ray Kinsella , Neil Horman , John McNamara , Marko Kovacevic , Ferruh Yigit , Gaetan Rivet Date: Mon, 14 Sep 2020 10:23:47 +0200 Message-Id: <20200914082350.13279-4-david.marchand@redhat.com> In-Reply-To: <20200914082350.13279-1-david.marchand@redhat.com> References: <20200914081727.12215-1-david.marchand@redhat.com> <20200914082350.13279-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 3/6] pci: move resource mapping to the PCI bus 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" As reported during 20.08 work for Windows, the pci_map_resource API was built with the assumption that its flags would be passed to mmap(). This introduced a regression when adding the rte_mem_map API as reported in the workaround commit 9d2b24593724 ("pci: keep API compatibility with mmap values"). This API was only used in the PCI bus code, so move it there. With this move, there is no other user so no ambiguity anymore: the passed additional flags are documented as rte_mem_map API flags. Signed-off-by: David Marchand Acked-by: Andrew Rybchenko --- doc/guides/rel_notes/deprecation.rst | 11 ----- doc/guides/rel_notes/release_20_11.rst | 6 +++ drivers/bus/pci/linux/pci_init.h | 2 + drivers/bus/pci/linux/pci_uio.c | 1 + drivers/bus/pci/pci_common.c | 41 ++++++++++++++++ drivers/bus/pci/private.h | 66 ++++++++++++++++++++++++++ lib/librte_pci/rte_pci.c | 42 ---------------- lib/librte_pci/rte_pci.h | 66 -------------------------- lib/librte_pci/rte_pci_version.map | 2 - 9 files changed, 116 insertions(+), 121 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index d9357fa182..2c7ae1f51e 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -113,17 +113,6 @@ Deprecation Notices us extending existing enum/define. One solution can be using a fixed size array instead of ``.*MAX.*`` value. -* pci: The PCI resources map API (``pci_map_resource`` and - ``pci_unmap_resource``) was not abstracting the Unix mmap flags (see the - workaround for Windows support implemented in the commit - 9d2b24593724 ("pci: keep API compatibility with mmap values")). - This API will be removed from the public API in 20.11 and moved to the PCI - bus driver along with the PCI resources lists and associated structures - (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and - ``mapped_pci_res_list``). - With this removal, there won't be a need for the mentioned workaround which - will be reverted. - * mbuf: Some fields will be converted to dynamic API in DPDK 20.11 in order to reserve more space for the dynamic fields, as explained in `this presentation `_. diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index bffbe31947..0f6a557501 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -90,6 +90,12 @@ API Changes * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and replaced with a private enum in the PCI subsystem. +* pci: Removed the PCI resources map API from the public API + (``pci_map_resource`` and ``pci_unmap_resource``) and moved it to the + PCI bus driver along with the PCI resources lists and associated structures + (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and + ``mapped_pci_res_list``). + * ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data`` structure as it gave no useful abstracted information to the applications. diff --git a/drivers/bus/pci/linux/pci_init.h b/drivers/bus/pci/linux/pci_init.h index c2e603a374..dcea726186 100644 --- a/drivers/bus/pci/linux/pci_init.h +++ b/drivers/bus/pci/linux/pci_init.h @@ -7,6 +7,8 @@ #include +#include "private.h" + /** IO resource type: */ #define IORESOURCE_IO 0x00000100 #define IORESOURCE_MEM 0x00000200 diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index a354920d5f..9ab20a0b25 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -25,6 +25,7 @@ #include "eal_filesystem.h" #include "pci_init.h" +#include "private.h" void *pci_map_addr = NULL; diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index dddf2b2aad..3a2ae07958 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,46 @@ pci_name_set(struct rte_pci_device *dev) dev->device.name = dev->name; } +/* map a particular resource from a file */ +void * +pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size, + int additional_flags) +{ + void *mapaddr; + + /* Map the PCI memory resource of device */ + mapaddr = rte_mem_map(requested_addr, size, + RTE_PROT_READ | RTE_PROT_WRITE, + RTE_MAP_SHARED | additional_flags, fd, offset); + if (mapaddr == NULL) { + RTE_LOG(ERR, EAL, + "%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n", + __func__, fd, requested_addr, size, + (unsigned long long)offset, + rte_strerror(rte_errno), mapaddr); + mapaddr = MAP_FAILED; /* API uses mmap error code */ + } else + RTE_LOG(DEBUG, EAL, " PCI memory mapped at %p\n", mapaddr); + + return mapaddr; +} + +/* unmap a particular resource */ +void +pci_unmap_resource(void *requested_addr, size_t size) +{ + if (requested_addr == NULL) + return; + + /* Unmap the PCI memory resource of device */ + if (rte_mem_unmap(requested_addr, size)) { + RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n", + __func__, requested_addr, size, + rte_strerror(rte_errno)); + } else + RTE_LOG(DEBUG, EAL, " PCI memory unmapped at %p\n", + requested_addr); +} /* * Match the PCI Driver and Device using the ID Table */ diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h index 367cdd9a65..9617268024 100644 --- a/drivers/bus/pci/private.h +++ b/drivers/bus/pci/private.h @@ -81,6 +81,72 @@ void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev, */ int pci_update_device(const struct rte_pci_addr *addr); +/** + * A structure describing a PCI mapping. + */ +struct pci_map { + void *addr; + char *path; + uint64_t offset; + uint64_t size; + uint64_t phaddr; +}; + +struct pci_msix_table { + int bar_index; + uint32_t offset; + uint32_t size; +}; + +/** + * A structure describing a mapped PCI resource. + * For multi-process we need to reproduce all PCI mappings in secondary + * processes, so save them in a tailq. + */ +struct mapped_pci_resource { + TAILQ_ENTRY(mapped_pci_resource) next; + + struct rte_pci_addr pci_addr; + char path[PATH_MAX]; + int nb_maps; + struct pci_map maps[PCI_MAX_RESOURCE]; + struct pci_msix_table msix_table; +}; + + +/** mapped pci device list */ +TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource); + +/** + * Map a particular resource from a file. + * + * @param requested_addr + * The starting address for the new mapping range. + * @param fd + * The file descriptor. + * @param offset + * The offset for the mapping range. + * @param size + * The size for the mapping range. + * @param additional_flags + * The additional rte_mem_map() flags for the mapping range. + * @return + * - On success, the function returns a pointer to the mapped area. + * - On error, MAP_FAILED is returned. + */ +void *pci_map_resource(void *requested_addr, int fd, off_t offset, + size_t size, int additional_flags); + +/** + * Unmap a particular resource. + * + * @param requested_addr + * The address for the unmapping range. + * @param size + * The size for the unmapping range. + */ +void pci_unmap_resource(void *requested_addr, size_t size); + /** * Map the PCI resource of a PCI device in virtual memory * diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c index 1d1cbc75ac..c91be8b167 100644 --- a/lib/librte_pci/rte_pci.c +++ b/lib/librte_pci/rte_pci.c @@ -144,45 +144,3 @@ rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr) return 0; return -1; } - - -/* map a particular resource from a file */ -void * -pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size, - int additional_flags) -{ - void *mapaddr; - - /* Map the PCI memory resource of device */ - mapaddr = rte_mem_map(requested_addr, size, - RTE_PROT_READ | RTE_PROT_WRITE, - RTE_MAP_SHARED | additional_flags, fd, offset); - if (mapaddr == NULL) { - RTE_LOG(ERR, EAL, - "%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n", - __func__, fd, requested_addr, size, - (unsigned long long)offset, - rte_strerror(rte_errno), mapaddr); - mapaddr = MAP_FAILED; /* API uses mmap error code */ - } else - RTE_LOG(DEBUG, EAL, " PCI memory mapped at %p\n", mapaddr); - - return mapaddr; -} - -/* unmap a particular resource */ -void -pci_unmap_resource(void *requested_addr, size_t size) -{ - if (requested_addr == NULL) - return; - - /* Unmap the PCI memory resource of device */ - if (rte_mem_unmap(requested_addr, size)) { - RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n", - __func__, requested_addr, size, - rte_strerror(rte_errno)); - } else - RTE_LOG(DEBUG, EAL, " PCI memory unmapped at %p\n", - requested_addr); -} diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h index a03235da1f..567c8cd68d 100644 --- a/lib/librte_pci/rte_pci.h +++ b/lib/librte_pci/rte_pci.h @@ -64,42 +64,6 @@ struct rte_pci_addr { #define PCI_ANY_ID (0xffff) #define RTE_CLASS_ANY_ID (0xffffff) -/** - * A structure describing a PCI mapping. - */ -struct pci_map { - void *addr; - char *path; - uint64_t offset; - uint64_t size; - uint64_t phaddr; -}; - -struct pci_msix_table { - int bar_index; - uint32_t offset; - uint32_t size; -}; - -/** - * A structure describing a mapped PCI resource. - * For multi-process we need to reproduce all PCI mappings in secondary - * processes, so save them in a tailq. - */ -struct mapped_pci_resource { - TAILQ_ENTRY(mapped_pci_resource) next; - - struct rte_pci_addr pci_addr; - char path[PATH_MAX]; - int nb_maps; - struct pci_map maps[PCI_MAX_RESOURCE]; - struct pci_msix_table msix_table; -}; - - -/** mapped pci device list */ -TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource); - /** * Utility function to write a pci device name, this device name can later be * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_* @@ -145,36 +109,6 @@ int rte_pci_addr_cmp(const struct rte_pci_addr *addr, */ int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr); -/** - * Map a particular resource from a file. - * - * @param requested_addr - * The starting address for the new mapping range. - * @param fd - * The file descriptor. - * @param offset - * The offset for the mapping range. - * @param size - * The size for the mapping range. - * @param additional_flags - * The additional flags for the mapping range. - * @return - * - On success, the function returns a pointer to the mapped area. - * - On error, MAP_FAILED is returned. - */ -void *pci_map_resource(void *requested_addr, int fd, off_t offset, - size_t size, int additional_flags); - -/** - * Unmap a particular resource. - * - * @param requested_addr - * The address for the unmapping range. - * @param size - * The size for the unmapping range. - */ -void pci_unmap_resource(void *requested_addr, size_t size); - #ifdef __cplusplus } #endif diff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map index cd77c9dc9e..1db19a5122 100644 --- a/lib/librte_pci/rte_pci_version.map +++ b/lib/librte_pci/rte_pci_version.map @@ -1,8 +1,6 @@ DPDK_21 { global: - pci_map_resource; - pci_unmap_resource; rte_pci_addr_cmp; rte_pci_addr_parse; rte_pci_device_name; From patchwork Mon Sep 14 08:23:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 77592 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3131BA04C9; Mon, 14 Sep 2020 10:24:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 881101C116; Mon, 14 Sep 2020 10:24:22 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id E6EB01C0D8 for ; Mon, 14 Sep 2020 10:24:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600071860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=04AkxNZqwp5rIP3kc+v/jKT5RnkE9K0ua857j0hJm6c=; b=esqU3UG5Q+9MSE3B3uUvNYyZKDvjrBo0uptI0RJfrc6rLjSTtgSgxxItvamMZuC6M5Ka4l noA4OUzQhStNNuniPqKA67exhEM3VGAEsRNoiSBprvVdykfnP9sNxcOKK7aHlOgGMFSNfq cGan626fna5l59iON39a+7eS0O8uuuQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405-XaH9PEmxOUiKavcqCxnVsg-1; Mon, 14 Sep 2020 04:24:18 -0400 X-MC-Unique: XaH9PEmxOUiKavcqCxnVsg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 54E75AF204; Mon, 14 Sep 2020 08:24:17 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id D06431A268; Mon, 14 Sep 2020 08:24:14 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ferruh Yigit , Anatoly Burakov , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Date: Mon, 14 Sep 2020 10:23:48 +0200 Message-Id: <20200914082350.13279-5-david.marchand@redhat.com> In-Reply-To: <20200914082350.13279-1-david.marchand@redhat.com> References: <20200914081727.12215-1-david.marchand@redhat.com> <20200914082350.13279-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 4/6] mem: drop mapping API workaround 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Now that the pci_map_resource API is private to the PCI bus, we can drop the compatibility workaround we had implemented in 20.08. Signed-off-by: David Marchand Acked-by: Andrew Rybchenko --- drivers/bus/pci/bsd/pci.c | 2 +- drivers/bus/pci/linux/pci_uio.c | 2 +- drivers/bus/pci/linux/pci_vfio.c | 4 ++-- drivers/bus/pci/pci_common.c | 1 - drivers/bus/pci/pci_common_uio.c | 2 +- drivers/bus/pci/private.h | 2 +- lib/librte_eal/include/rte_eal_paging.h | 10 ---------- lib/librte_eal/windows/include/rte_os.h | 6 ------ 8 files changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index a07fc241fe..2ed8261349 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -192,7 +192,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, mapaddr = pci_map_resource(NULL, fd, (off_t)offset, (size_t)dev->mem_resource[res_idx].len, 0); close(fd); - if (mapaddr == MAP_FAILED) + if (mapaddr == NULL) goto error; maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr; diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 9ab20a0b25..f3305a2f28 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -346,7 +346,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, mapaddr = pci_map_resource(pci_map_addr, fd, 0, (size_t)dev->mem_resource[res_idx].len, 0); close(fd); - if (mapaddr == MAP_FAILED) + if (mapaddr == NULL) goto error; pci_map_addr = RTE_PTR_ADD(mapaddr, diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index c15ed3bade..34b5da80df 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -565,7 +565,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res, } /* if there's a second part, try to map it */ - if (map_addr != MAP_FAILED + if (map_addr != NULL && memreg[1].offset && memreg[1].size) { void *second_addr = RTE_PTR_ADD(bar_addr, (uintptr_t)(memreg[1].offset - @@ -577,7 +577,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res, RTE_MAP_FORCE_ADDRESS); } - if (map_addr == NULL || map_addr == MAP_FAILED) { + if (map_addr == NULL) { munmap(bar_addr, bar->size); bar_addr = MAP_FAILED; RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n", diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 3a2ae07958..62d45041bb 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -97,7 +97,6 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size, __func__, fd, requested_addr, size, (unsigned long long)offset, rte_strerror(rte_errno), mapaddr); - mapaddr = MAP_FAILED; /* API uses mmap error code */ } else RTE_LOG(DEBUG, EAL, " PCI memory mapped at %p\n", mapaddr); diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c index f4dca9da91..793dfd0a7c 100644 --- a/drivers/bus/pci/pci_common_uio.c +++ b/drivers/bus/pci/pci_common_uio.c @@ -58,7 +58,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev) "Cannot mmap device resource file %s to address: %p\n", uio_res->maps[i].path, uio_res->maps[i].addr); - if (mapaddr != MAP_FAILED) { + if (mapaddr != NULL) { /* unmap addrs correctly mapped */ for (j = 0; j < i; j++) pci_unmap_resource( diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h index 9617268024..530123767b 100644 --- a/drivers/bus/pci/private.h +++ b/drivers/bus/pci/private.h @@ -132,7 +132,7 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource); * The additional rte_mem_map() flags for the mapping range. * @return * - On success, the function returns a pointer to the mapped area. - * - On error, MAP_FAILED is returned. + * - On error, NULL is returned. */ void *pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size, int additional_flags); diff --git a/lib/librte_eal/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h index 429f896c8c..ed98e70e9e 100644 --- a/lib/librte_eal/include/rte_eal_paging.h +++ b/lib/librte_eal/include/rte_eal_paging.h @@ -3,9 +3,6 @@ */ #include -#ifndef RTE_EXEC_ENV_WINDOWS -#include -#endif #include @@ -25,7 +22,6 @@ enum rte_mem_prot { /** Additional flags for memory mapping. */ enum rte_map_flags { -#ifdef RTE_EXEC_ENV_WINDOWS /** Changes to the mapped memory are visible to other processes. */ RTE_MAP_SHARED = 1 << 0, /** Mapping is not backed by a regular file. */ @@ -39,12 +35,6 @@ enum rte_map_flags { * it is not required to do so, thus mapping with this flag may fail. */ RTE_MAP_FORCE_ADDRESS = 1 << 3 -#else /* map mmap flags because they are exposed in pci_map_resource() API */ - RTE_MAP_SHARED = MAP_SHARED, - RTE_MAP_ANONYMOUS = MAP_ANONYMOUS, - RTE_MAP_PRIVATE = MAP_PRIVATE, - RTE_MAP_FORCE_ADDRESS = MAP_FIXED, -#endif }; /** diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h index 2881bf2224..569ed92d51 100644 --- a/lib/librte_eal/windows/include/rte_os.h +++ b/lib/librte_eal/windows/include/rte_os.h @@ -25,12 +25,6 @@ extern "C" { #define PATH_MAX _MAX_PATH #endif -/* sys/mman.h - * The syscall mmap does not exist on Windows, - * but this error code is used in a badly defined DPDK API for PCI mapping. - */ -#define MAP_FAILED ((void *) -1) - #define sleep(x) Sleep(1000 * (x)) #define strerror_r(a, b, c) strerror_s(b, c, a) From patchwork Mon Sep 14 08:23:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 77593 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FC9AA04C9; Mon, 14 Sep 2020 10:24:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CB4CC1C127; Mon, 14 Sep 2020 10:24:24 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id A4A451C125 for ; Mon, 14 Sep 2020 10:24:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600071863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QB43mvOIVZ4dqvl75WQZrX68LpBwqrwAzJXfX4CoVwM=; b=d+ZzOAkDAv7A2YMd7tbluNkE90L9GeM4JbAkTaiHKS0XTi+SW95B2k6w0zDbja5iiJFZ29 g44dBkpwp0b5MwRRP6YFswtIO9jatL08OzGO8fGXLfnnhApOp7+HnPzFHZUO9+V82v43MA G80rOxS/hEsWCo/pbCER3H2Zo8WXkGA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-hR-ZwhsnM7-16Z__xE0JbA-1; Mon, 14 Sep 2020 04:24:21 -0400 X-MC-Unique: hR-ZwhsnM7-16Z__xE0JbA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E574801AC2; Mon, 14 Sep 2020 08:24:20 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A9981A268; Mon, 14 Sep 2020 08:24:17 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ray Kinsella , Neil Horman , John McNamara , Marko Kovacevic , Jianfeng Tan , Jeff Guo Date: Mon, 14 Sep 2020 10:23:49 +0200 Message-Id: <20200914082350.13279-6-david.marchand@redhat.com> In-Reply-To: <20200914082350.13279-1-david.marchand@redhat.com> References: <20200914081727.12215-1-david.marchand@redhat.com> <20200914082350.13279-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 5/6] eal: hide internal device event 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This structure is not used in the public API. Fixes: a753e53d517b ("eal: add device event monitor framework") Signed-off-by: David Marchand Acked-by: Ray Kinsella --- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_20_11.rst | 3 +++ lib/librte_eal/include/rte_dev.h | 6 ------ lib/librte_eal/linux/eal_dev.c | 6 ++++++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 2c7ae1f51e..3bd3abd7f8 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -70,9 +70,6 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. -* eal: The ``rte_dev_event`` structure will be made private to the EAL as no - public API makes use of it. - * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does not allow for writing optimized code for all the CPU architectures supported in DPDK. DPDK will adopt C11 atomic operations semantics and provide wrappers diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index 0f6a557501..8397046988 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -87,6 +87,9 @@ API Changes * eal: The ``rte_logs`` struct and global symbol was made private and is no longer part of the API. +* eal: Made the ``rte_dev_event`` structure private to the EAL as no public API + used it. + * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and replaced with a private enum in the PCI subsystem. diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h index 53c8bc6fab..81905b3ae3 100644 --- a/lib/librte_eal/include/rte_dev.h +++ b/lib/librte_eal/include/rte_dev.h @@ -33,12 +33,6 @@ enum rte_dev_event_type { RTE_DEV_EVENT_MAX /**< max value of this enum */ }; -struct rte_dev_event { - enum rte_dev_event_type type; /**< device event type */ - int subsystem; /**< subsystem id */ - char *devname; /**< device name */ -}; - typedef void (*rte_dev_event_cb_fn)(const char *device_name, enum rte_dev_event_type event, void *cb_arg); diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c index 83c9cd6607..c8dd77c049 100644 --- a/lib/librte_eal/linux/eal_dev.c +++ b/lib/librte_eal/linux/eal_dev.c @@ -133,6 +133,12 @@ dev_uev_socket_fd_create(void) return ret; } +struct rte_dev_event { + enum rte_dev_event_type type; /**< device event type */ + int subsystem; /**< subsystem id */ + char *devname; /**< device name */ +}; + static int dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) { From patchwork Mon Sep 14 08:23:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 77594 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 255D7A04C9; Mon, 14 Sep 2020 10:24:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1F3431C132; Mon, 14 Sep 2020 10:24:30 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 6B2641C12D for ; Mon, 14 Sep 2020 10:24:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600071867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kArIWgo//OD5CeYHDmEhGI/pkU9OBaSGT5NXQLamPoc=; b=hco7xdNT0OrMi+AmKayjGsqf9hmMFuDeN5/uo161W8003Qx6mXtXlSGfYeUdORFBbA0NUJ TKqCHZdU/Ugl/x4n/64EckUbsVHJYel6MpKVrgam5TkclCEX4fznXA2pi1ddVGjlOoeICx Bmznerkk5hUOAWeO5UrewDO6/MmcFZ0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-th5bUivMMNCvDu2dku_alg-1; Mon, 14 Sep 2020 04:24:24 -0400 X-MC-Unique: th5bUivMMNCvDu2dku_alg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 775FC8030A0; Mon, 14 Sep 2020 08:24:23 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50D0A1A886; Mon, 14 Sep 2020 08:24:21 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Stephen Hemminger , Gaetan Rivet , Thomas Monjalon Date: Mon, 14 Sep 2020 10:23:50 +0200 Message-Id: <20200914082350.13279-7-david.marchand@redhat.com> In-Reply-To: <20200914082350.13279-1-david.marchand@redhat.com> References: <20200914081727.12215-1-david.marchand@redhat.com> <20200914082350.13279-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 6/6] bus/pci: remove duplicate declaration 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This declaration is the same as the one a few lines before. Fixes: 6844d146ff39 ("eal: add bus pointer in device structure") Cc: stable@dpdk.org Signed-off-by: David Marchand Acked-by: Andrew Rybchenko --- drivers/bus/pci/private.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h index 530123767b..9aa7e67c73 100644 --- a/drivers/bus/pci/private.h +++ b/drivers/bus/pci/private.h @@ -15,8 +15,6 @@ extern struct rte_pci_bus rte_pci_bus; struct rte_pci_driver; struct rte_pci_device; -extern struct rte_pci_bus rte_pci_bus; - /** * Scan the content of the PCI bus, and the devices in the devices * list