[dpdk-dev] [igb_uio PATCH 2/3] igb_uio: pci_config_lock/pci_config_unlock wrappers
Thomas Monjalon
thomas.monjalon at 6wind.com
Tue Jul 22 14:57:21 CEST 2014
2014-07-21 13:42, Stephen Hemminger:
> On Mon, 21 Jul 2014 18:03:53 +0600
> Yerden Zhumabekov <e_zhumabekov at sts.kz> wrote:
>
> > Since PCI config lock/unlock functions were renamed in linux kernel,
> > these wrappers are introduced to reflect this change.
> >
> > Signed-off-by: Yerden Zhumabekov <e_zhumabekov at sts.kz>
> > ---
> > lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 20 ++++++++++++++++++++
> > 1 file changed, 20 insertions(+)
> >
> > diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > index 02545d9..605410e 100644
> > --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > @@ -223,6 +223,26 @@ static const struct attribute_group dev_attr_grp = {
> > .attrs = dev_attrs,
> > };
> >
> > +static inline void
> > +pci_config_lock(struct pci_dev *pdev)
> > +{
> > +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
> > + pci_block_user_cfg_access(pdev);
> > +#else
> > + pci_cfg_access_lock(pdev);
> > +#endif
> > +}
> > +
> > +static inline void
> > +pci_config_unlock(struct pci_dev *pdev)
> > +{
> > +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
> > + pci_unblock_user_cfg_access(pdev);
> > +#else
> > + pci_cfg_access_unlock(pdev);
> > +#endif
> > +}
> > +
> > #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
> > /* Check if INTX works to control irq's.
> > * Set's INTX_DISABLE flag and reads it back
>
> Rather than have wrapper's which have to live forever.
> Please create backward compatability stub's.
>
> My goal is to be able to unifdef out all the version checks and
> submit a version to upstream mainline kernel.
I replace this patch by these simple fallbacks:
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
#define pci_cfg_access_lock pci_block_user_cfg_access
#define pci_cfg_access_unlock pci_unblock_user_cfg_access
#endif
--
Thomas
More information about the dev
mailing list