From: Varka Bhadram <varkabhadram@gmail.com>
To: Ethan Zhao <ethan.zhao@oracle.com>,
bhelgaas@google.com, konrad.wilk@oracle.com,
boris.ostrovsky@oracle.com, david.vrabel@citrix.com,
gleb@kernel.org, pbonzini@redhat.com,
jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com,
bruce.w.allan@intel.com, carolyn.wyborny@intel.com,
donald.c.skidmore@intel.com, gregory.v.rose@intel.com,
alexander.h.duyck@intel.com, john.ronciak@intel.com,
mitch.a.williams@intel.com, alex.williamson@redhat.com
Cc: linux-pci@vger.kernel.org, kvm@vger.kernel.org,
linux.nics@intel.com, e1000-devel@lists.sourceforge.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
ethan.kernel@gmail.com, vaughan.cao@oracle.com
Subject: Re: [PATCH 2/2 V3] PCI: implement VFs assignment reference counter
Date: Fri, 11 Jul 2014 18:12:40 +0530 [thread overview]
Message-ID: <53BFDBC0.8000705@gmail.com> (raw)
In-Reply-To: <1405081802-419-2-git-send-email-ethan.zhao@oracle.com>
On 07/11/2014 06:00 PM, Ethan Zhao wrote:
> Current implementation of helper function pci_vfs_assigned() is a
> little complex, to get sum of VFs that assigned to VM, access low
> level configuration space register and then loop in traversing
> device tree.
(...)
> @@ -650,6 +630,11 @@ EXPORT_SYMBOL_GPL(pci_vfs_assigned);
> void pci_iov_assign_device(struct pci_dev *pdev)
> {
> pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
> + if (pdev->is_virtfn && !pdev->is_physfn)
> + if (pdev->physfn)
> + if (pdev->physfn->sriov)
Why don't we make last two 'if' conditions into single 'if'
if (pdev->physfn && pdev->physfn->sriov)
> + atomic_inc(&pdev->physfn->sriov->
> + VFs_assigned_cnt);
> }
> EXPORT_SYMBOL_GPL(pci_iov_assign_device);
>
> @@ -660,6 +645,11 @@ EXPORT_SYMBOL_GPL(pci_iov_assign_device);
> void pci_iov_deassign_device(struct pci_dev *pdev)
> {
> pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
> + if (pdev->is_virtfn && !pdev->is_physfn)
> + if (pdev->physfn)
> + if (pdev->physfn->sriov)
same...
> + atomic_dec(&pdev->physfn->sriov->
> + VFs_assigned_cnt);
> }
> EXPORT_SYMBOL_GPL(pci_iov_deassign_device);
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 6bd0822..d17bda2 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -235,6 +235,7 @@ struct pci_sriov {
> u32 pgsz; /* page size for BAR alignment */
> u8 link; /* Function Dependency Link */
> u16 driver_max_VFs; /* max num VFs driver supports */
> + atomic_t VFs_assigned_cnt; /* counter of VFs assigned to VM */
> struct pci_dev *dev; /* lowest numbered PF */
> struct pci_dev *self; /* this PF */
> struct mutex lock; /* lock for VF bus */
--
Regards,
Varka Bhadram.
next prev parent reply other threads:[~2014-07-11 12:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 12:30 [PATCH 1/2 V3] PCI: introduce device assignment interface and refactory related code Ethan Zhao
2014-07-11 12:30 ` [PATCH 2/2 V3] PCI: implement VFs assignment reference counter Ethan Zhao
2014-07-11 12:42 ` Varka Bhadram [this message]
2014-07-11 13:13 ` [PATCH 1/2 V3] PCI: introduce device assignment interface and refactory related code Alex Williamson
2014-07-11 14:15 ` Alex Williamson
2014-07-21 22:29 ` Alexander Duyck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53BFDBC0.8000705@gmail.com \
--to=varkabhadram@gmail.com \
--cc=alex.williamson@redhat.com \
--cc=alexander.h.duyck@intel.com \
--cc=bhelgaas@google.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bruce.w.allan@intel.com \
--cc=carolyn.wyborny@intel.com \
--cc=david.vrabel@citrix.com \
--cc=donald.c.skidmore@intel.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=ethan.kernel@gmail.com \
--cc=ethan.zhao@oracle.com \
--cc=gleb@kernel.org \
--cc=gregory.v.rose@intel.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=john.ronciak@intel.com \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux.nics@intel.com \
--cc=mitch.a.williams@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vaughan.cao@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).