From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 43F035689 for ; Fri, 26 Oct 2018 16:03:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 07:03:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,428,1534834800"; d="scan'208";a="81133315" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.8.177]) ([10.252.8.177]) by fmsmga007.fm.intel.com with ESMTP; 26 Oct 2018 07:03:40 -0700 To: Alejandro Lucero , dev@dpdk.org References: <1540464568-42054-1-git-send-email-alejandro.lucero@netronome.com> From: "Burakov, Anatoly" Message-ID: <073701fc-1189-19f8-a635-4e92e52f948b@intel.com> Date: Fri, 26 Oct 2018 15:03:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1540464568-42054-1-git-send-email-alejandro.lucero@netronome.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] bus/pci: use device driver name instead of handler type 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: Fri, 26 Oct 2018 14:03:42 -0000 On 25-Oct-18 11:49 AM, Alejandro Lucero wrote: > 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") > > v2: > - Use #ifdef for VFIO functions > > Signed-off-by: Alejandro Lucero > --- > 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 5cf78d7..59a2086 100644 > --- a/drivers/bus/pci/linux/pci.c > +++ b/drivers/bus/pci/linux/pci.c > @@ -673,23 +673,21 @@ enum rte_iova_mode > 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] = {0}; Probably "" instead of {0} is better. Same in other case. Otherwise, LGTM Acked-by: Anatoly Burakov > 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,23 +696,21 @@ int rte_pci_read_config(const struct rte_pci_device *device, > 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] = {0}; > 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; > } > } > -- Thanks, Anatoly