From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ktraynor@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id A418E1B51D
 for <stable@dpdk.org>; Fri, 23 Nov 2018 11:28:47 +0100 (CET)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
 [10.5.11.14])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 0C1ED83F44;
 Fri, 23 Nov 2018 10:28:47 +0000 (UTC)
Received: from ktraynor.remote.csb (unknown [10.36.118.7])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 776DA18526;
 Fri, 23 Nov 2018 10:28:45 +0000 (UTC)
From: Kevin Traynor <ktraynor@redhat.com>
To: Alejandro Lucero <alejandro.lucero@netronome.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>, dpdk stable <stable@dpdk.org>
Date: Fri, 23 Nov 2018 10:26:11 +0000
Message-Id: <20181123102713.17309-7-ktraynor@redhat.com>
In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com>
References: <20181123102713.17309-1-ktraynor@redhat.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.27]); Fri, 23 Nov 2018 10:28:47 +0000 (UTC)
Subject: [dpdk-stable] patch 'bus/pci: compare kernel driver instead of
	interrupt handler' has been queued to stable release 18.08.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 23 Nov 2018 10:28:48 -0000

Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/29/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>>From 6d96dcc744945a4a90fdacf431ae45300755b3eb Mon Sep 17 00:00:00 2001
From: Alejandro Lucero <alejandro.lucero@netronome.com>
Date: Thu, 25 Oct 2018 11:49:28 +0100
Subject: [PATCH] bus/pci: compare kernel driver instead of interrupt handler

[ upstream commit 630deed612ca382f48a3ef4b65dfc74b7cd09cf9 ]

Invoking the right pci read/write functions is based on interrupt
handler type. However, this is not configured for secondary processes
precluding to use those functions.

This patch fixes the issue using the driver name the device is bound
to instead.

Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/bus/pci/linux/pci.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 04648ac93..58b615a47 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -673,21 +673,19 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 		void *buf, size_t len, off_t offset)
 {
+	char devname[RTE_DEV_NAME_MAX_LEN] = "";
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
-	switch (intr_handle->type) {
-	case RTE_INTR_HANDLE_UIO:
-	case RTE_INTR_HANDLE_UIO_INTX:
+	switch (device->kdrv) {
+	case RTE_KDRV_IGB_UIO:
 		return pci_uio_read_config(intr_handle, buf, len, offset);
-
 #ifdef VFIO_PRESENT
-	case RTE_INTR_HANDLE_VFIO_MSIX:
-	case RTE_INTR_HANDLE_VFIO_MSI:
-	case RTE_INTR_HANDLE_VFIO_LEGACY:
+	case RTE_KDRV_VFIO:
 		return pci_vfio_read_config(intr_handle, buf, len, offset);
 #endif
 	default:
+		rte_pci_device_name(&device->addr, devname,
+				    RTE_DEV_NAME_MAX_LEN);
 		RTE_LOG(ERR, EAL,
-			"Unknown handle type of fd %d\n",
-					intr_handle->fd);
+			"Unknown driver type for %s\n", devname);
 		return -1;
 	}
@@ -698,21 +696,19 @@ int rte_pci_write_config(const struct rte_pci_device *device,
 		const void *buf, size_t len, off_t offset)
 {
+	char devname[RTE_DEV_NAME_MAX_LEN] = "";
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
-	switch (intr_handle->type) {
-	case RTE_INTR_HANDLE_UIO:
-	case RTE_INTR_HANDLE_UIO_INTX:
+	switch (device->kdrv) {
+	case RTE_KDRV_IGB_UIO:
 		return pci_uio_write_config(intr_handle, buf, len, offset);
-
 #ifdef VFIO_PRESENT
-	case RTE_INTR_HANDLE_VFIO_MSIX:
-	case RTE_INTR_HANDLE_VFIO_MSI:
-	case RTE_INTR_HANDLE_VFIO_LEGACY:
+	case RTE_KDRV_VFIO:
 		return pci_vfio_write_config(intr_handle, buf, len, offset);
 #endif
 	default:
+		rte_pci_device_name(&device->addr, devname,
+				    RTE_DEV_NAME_MAX_LEN);
 		RTE_LOG(ERR, EAL,
-			"Unknown handle type of fd %d\n",
-					intr_handle->fd);
+			"Unknown driver type for %s\n", devname);
 		return -1;
 	}
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-23 10:22:54.429167009 +0000
+++ 0007-bus-pci-compare-kernel-driver-instead-of-interrupt-h.patch	2018-11-23 10:22:54.000000000 +0000
@@ -1,8 +1,10 @@
-From 630deed612ca382f48a3ef4b65dfc74b7cd09cf9 Mon Sep 17 00:00:00 2001
+From 6d96dcc744945a4a90fdacf431ae45300755b3eb Mon Sep 17 00:00:00 2001
 From: Alejandro Lucero <alejandro.lucero@netronome.com>
 Date: Thu, 25 Oct 2018 11:49:28 +0100
 Subject: [PATCH] bus/pci: compare kernel driver instead of interrupt handler
 
+[ upstream commit 630deed612ca382f48a3ef4b65dfc74b7cd09cf9 ]
+
 Invoking the right pci read/write functions is based on interrupt
 handler type. However, this is not configured for secondary processes
 precluding to use those functions.
@@ -11,7 +13,6 @@
 to instead.
 
 Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")
-Cc: stable@dpdk.org
 
 Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
 Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
@@ -20,10 +21,10 @@
  1 file changed, 14 insertions(+), 18 deletions(-)
 
 diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
-index d5faa893d..45c24ef7e 100644
+index 04648ac93..58b615a47 100644
 --- a/drivers/bus/pci/linux/pci.c
 +++ b/drivers/bus/pci/linux/pci.c
-@@ -675,21 +675,19 @@ int rte_pci_read_config(const struct rte_pci_device *device,
+@@ -673,21 +673,19 @@ int rte_pci_read_config(const struct rte_pci_device *device,
  		void *buf, size_t len, off_t offset)
  {
 +	char devname[RTE_DEV_NAME_MAX_LEN] = "";
@@ -52,7 +53,7 @@
 +			"Unknown driver type for %s\n", devname);
  		return -1;
  	}
-@@ -700,21 +698,19 @@ int rte_pci_write_config(const struct rte_pci_device *device,
+@@ -698,21 +696,19 @@ int rte_pci_write_config(const struct rte_pci_device *device,
  		const void *buf, size_t len, off_t offset)
  {
 +	char devname[RTE_DEV_NAME_MAX_LEN] = "";