From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anatoly.burakov@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id 49E4E1E2B
 for <dev@dpdk.org>; Thu, 25 Oct 2018 11:29:10 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 25 Oct 2018 02:29:08 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.54,423,1534834800"; d="scan'208";a="98504344"
Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.99])
 ([10.237.220.99])
 by fmsmga002.fm.intel.com with ESMTP; 25 Oct 2018 02:29:07 -0700
To: Alejandro Lucero <alejandro.lucero@netronome.com>,
 Thomas Monjalon <thomas@monjalon.net>
Cc: dev <dev@dpdk.org>, Gaetan Rivet <gaetan.rivet@6wind.com>
References: <1539967418-17824-1-git-send-email-alejandro.lucero@netronome.com>
 <1926208.EzcMdV4ig2@xps>
 <CAD+H991sfef0XqN5bHPpQ-_DVasLdd4RkkLdSKRfZ6u+H_m=1A@mail.gmail.com>
 <CAD+H991PGmgSBbzof3Ca6gwQjnmfMtGkSW-mqkTHUH3nVJ3s9g@mail.gmail.com>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <4f2c94c7-8999-80ba-62a0-024551c15e6e@intel.com>
Date: Thu, 25 Oct 2018 10:29:06 +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: <CAD+H991PGmgSBbzof3Ca6gwQjnmfMtGkSW-mqkTHUH3nVJ3s9g@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH] 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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Oct 2018 09:29:10 -0000

On 25-Oct-18 7:00 AM, Alejandro Lucero wrote:
> On Thu, Oct 25, 2018 at 6:30 AM Alejandro Lucero <
> alejandro.lucero@netronome.com> wrote:
> 
>>
>>
>> On Thu, Oct 25, 2018 at 12:11 AM Thomas Monjalon <thomas@monjalon.net>
>> wrote:
>>
>>> Hi,
>>>
>>> 19/10/2018 18:43, Alejandro Lucero:
>>>> --- a/drivers/bus/pci/linux/pci.c
>>>> +++ b/drivers/bus/pci/linux/pci.c
>>>> +     char devname[RTE_DEV_NAME_MAX_LEN] = {0};
>>>
>>> I think "" would be more appropriate than {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_read_config(intr_handle, buf, len, offset);
>>>> -
>>>> -#ifdef VFIO_PRESENT
>>>
>>> Why this #ifdef is removed?
>>>
>>>
>> Because it is not needed. VFIO is present if the kdrv field tells us so.
>>
> 
> And at this point it is clear VFIO is present if that is the case.
> Otherwise this code is not executed.

Actually, i think Thomas is right here. The #ifdef shouldn't be removed, 
because if this is not defined, the function is simply not present - see 
pci_init.h, VFIO-related functions are only declared if VFIO_PRESENT is 
defined.

> 
> 
>>
>>
>>>> -     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;
>>>>        }
>>>
>>>
>>>
>>>
> 


-- 
Thanks,
Anatoly