[dpdk-dev,4/4] igb_uio: bind error if pcie bridge
Checks
Commit Message
From: Darren Edamura <darren.edamura@broadcom.com>
Probe function should exit immediately if pcie bridge detected
Signed-off-by: Darren Edamura <darren.edamura@broadcom.com>
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On 3/21/2018 6:06 PM, Ajit Khaparde wrote:
> From: Darren Edamura <darren.edamura@broadcom.com>
>
> Probe function should exit immediately if pcie bridge detected
>
> Signed-off-by: Darren Edamura <darren.edamura@broadcom.com>
> Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> index 4cae4dd27..3fabbfc4d 100644
> --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> @@ -473,6 +473,9 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
> void *map_addr;
> int err;
>
> + if (pci_is_bridge(dev))
> + return -ENODEV;
What do you think printing a log here?
> +
> udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL);
> if (!udev)
> return -ENOMEM;
>
Hi Ferruh,
On 18-03-26 10:24 AM, Ferruh Yigit wrote:
> On 3/21/2018 6:06 PM, Ajit Khaparde wrote:
>> From: Darren Edamura <darren.edamura@broadcom.com>
>>
>> Probe function should exit immediately if pcie bridge detected
>>
>> Signed-off-by: Darren Edamura <darren.edamura@broadcom.com>
>> Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
>> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>> ---
>> lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>> index 4cae4dd27..3fabbfc4d 100644
>> --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>> +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>> @@ -473,6 +473,9 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
>> void *map_addr;
>> int err;
>>
>> + if (pci_is_bridge(dev))
>> + return -ENODEV;
> What do you think printing a log here?
I think it brings little value. ENODEV is already returned?
>
>> +
>> udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL);
>> if (!udev)
>> return -ENOMEM;
>>
Regards,
Scott
On 3/26/2018 7:05 PM, Scott Branden wrote:
> Hi Ferruh,
>
>
> On 18-03-26 10:24 AM, Ferruh Yigit wrote:
>> On 3/21/2018 6:06 PM, Ajit Khaparde wrote:
>>> From: Darren Edamura <darren.edamura@broadcom.com>
>>>
>>> Probe function should exit immediately if pcie bridge detected
>>>
>>> Signed-off-by: Darren Edamura <darren.edamura@broadcom.com>
>>> Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
>>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
>>> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>>> ---
>>> lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>>> index 4cae4dd27..3fabbfc4d 100644
>>> --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>>> +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>>> @@ -473,6 +473,9 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
>>> void *map_addr;
>>> int err;
>>>
>>> + if (pci_is_bridge(dev))
>>> + return -ENODEV;
>> What do you think printing a log here?
> I think it brings little value. ENODEV is already returned?
User should not provide bridge address at first place, I guess this is a
protection in case user provides bridge address by mistake.
In that case no device will be probed and user won't have any idea why.
I think a log in dmesg saying bridge device is provided may help to the user.
>>
>>> +
>>> udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL);
>>> if (!udev)
>>> return -ENOMEM;
>>>
> Regards,
> Scott
>
On 18-03-26 11:20 AM, Ferruh Yigit wrote:
> On 3/26/2018 7:05 PM, Scott Branden wrote:
>> Hi Ferruh,
>>
>>
>> On 18-03-26 10:24 AM, Ferruh Yigit wrote:
>>> On 3/21/2018 6:06 PM, Ajit Khaparde wrote:
>>>> From: Darren Edamura <darren.edamura@broadcom.com>
>>>>
>>>> Probe function should exit immediately if pcie bridge detected
>>>>
>>>> Signed-off-by: Darren Edamura <darren.edamura@broadcom.com>
>>>> Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
>>>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
>>>> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>>>> ---
>>>> lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 3 +++
>>>> 1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>>>> index 4cae4dd27..3fabbfc4d 100644
>>>> --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>>>> +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
>>>> @@ -473,6 +473,9 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
>>>> void *map_addr;
>>>> int err;
>>>>
>>>> + if (pci_is_bridge(dev))
>>>> + return -ENODEV;
>>> What do you think printing a log here?
>> I think it brings little value. ENODEV is already returned?
> User should not provide bridge address at first place, I guess this is a
> protection in case user provides bridge address by mistake.
> In that case no device will be probed and user won't have any idea why.
> I think a log in dmesg saying bridge device is provided may help to the user.
I'll add a dev_warn as we actually encounter this issue on old silicon
revisions due to bridge address equaling a PF.
It's not a user error in such case and just needs to be ignored. So
adding this generic check allows such to occur.
For other use cases like you mentioned it would be a user mistake.
>>>> +
>>>> udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL);
>>>> if (!udev)
>>>> return -ENOMEM;
>>>>
>> Regards,
>> Scott
>>
@@ -473,6 +473,9 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
void *map_addr;
int err;
+ if (pci_is_bridge(dev))
+ return -ENODEV;
+
udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL);
if (!udev)
return -ENOMEM;