On 2/12/2018 8:28 AM, Guo, Jia wrote:
> On 2/9/2018 6:01 AM, Thomas Monjalon wrote:
>> 30/01/2018 11:01, Jeff Guo:
>>> udev could not detect remove and add event of device when hotplug in
>>> and out devices, that related with the fix about using pointer of
>>> rte_uio_pci_dev as dev_id instead of uio_device for irq device handler,
>>> that would result igb uio irq failure when kernel version after than 3.17.
>>> so this patch correct it by use kernel version check before handle the
>>> pci interrupt.
>>> Fixes: 6b9ed026a870 ("igb_uio: fix build with kernel <= 3.17")
>>> Signed-off-by: Jeff Guo <jia....@intel.com>
>>> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
>>> struct rte_uio_pci_dev *udev = (struct rte_uio_pci_dev *)dev_id;
>>> struct uio_info *info = &udev->info;
>>> + struct uio_device *idev = (struct uio_device *)dev_id;
>>> + struct uio_info *info = idev->info;
>>> + struct rte_uio_pci_dev *udev = info->priv;
>> Can we avoid checking Linux version number?
>> This method won't work with kernel backports.
> i don't think that is a bug rather than a kernel feature parameter
> change , so i am not sure if it will definitely a chance exist for the
> kernel backport fix for that.
What we tend to do is add version check to compat.h and define a feature based
on that check and use feature define in .c . This makes .c file more readable
and if in the future we need to add more check because of backported kernels
(mostly we need to do) that checks all goes into compat.h and .c file remains