From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44])
 by dpdk.org (Postfix) with ESMTP id A4E93B34D
 for <dev@dpdk.org>; Tue, 22 Jul 2014 14:56:12 +0200 (CEST)
Received: by mail-wg0-f44.google.com with SMTP id m15so7920599wgh.27
 for <dev@dpdk.org>; Tue, 22 Jul 2014 05:57:29 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:organization
 :user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:content-type;
 bh=rVT+98yAneXvSDubKRuQ+HXcLb5om6RM4ghvNwyD1s4=;
 b=GogF63br4uaevZDBsi0TF4LD6uFX0/szHivjHNigMnpF/AOiPT8GX8XfGCaiADJm8O
 hb2T2ZRW33AiWSFNenF/XEP/PwUxXxP5L7fPhm/zvA/B3ZQlvE5slsUSZtXiMUBuFdLl
 3wKOhkZyOE/M2WcZjl0okVdKGCjgSxKYPJeIHmmXSRtuAI6pRWxB4c7wzUwA2d8Adl3U
 ksFKORU0tQ1+d1BtsyTbyU3unjxNaxgU5Ipa3+SfeSwT72uQSC3nNTL4i7kSkzrLrxox
 Fu3jhbQdNH/Kbi5EVfpDEHugrQb2zxGEwLKIdtew1U5aTxuqJxZ3h2WjRNNHvz+YYo84
 8/7Q==
X-Gm-Message-State: ALoCoQlQawUCSChZt5Trv3SGNdU7SbuopqxPOVVF9KLG0Zc2RWbkgBJbhmmJLvJjwuzVI/wFzLeq
X-Received: by 10.194.158.164 with SMTP id wv4mr24852404wjb.124.1406033849395; 
 Tue, 22 Jul 2014 05:57:29 -0700 (PDT)
Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136])
 by mx.google.com with ESMTPSA id x13sm2437667wib.23.2014.07.22.05.57.27
 for <multiple recipients>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 22 Jul 2014 05:57:28 -0700 (PDT)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
 Yerden Zhumabekov <e_zhumabekov@sts.kz>
Date: Tue, 22 Jul 2014 14:57:21 +0200
Message-ID: <9697334.UVtye4KLXx@xps13>
Organization: 6WIND
User-Agent: KMail/4.13.2 (Linux/3.15.5-2-ARCH; KDE/4.13.2; x86_64; ; )
In-Reply-To: <20140721134200.51fdbcd3@haswell>
References: <2795655.Wj4j2zIbVg@xps13>
 <1405944234-50272-3-git-send-email-e_zhumabekov@sts.kz>
 <20140721134200.51fdbcd3@haswell>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [igb_uio PATCH 2/3] igb_uio:
	pci_config_lock/pci_config_unlock wrappers
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Jul 2014 12:56:12 -0000

2014-07-21 13:42, Stephen Hemminger:
> On Mon, 21 Jul 2014 18:03:53 +0600
> Yerden Zhumabekov <e_zhumabekov@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@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