linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Alexander Gordeev <agordeev@redhat.com>
Cc: linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
	Michael Ellerman <michael@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Ben Hutchings <bhutchings@solarflare.com>,
	David Laight <David.Laight@ACULAB.COM>,
	Mark Lord <kernel@start.ca>, "H. Peter Anvin" <hpa@zytor.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH RFC v2 12/29] PCI/MSI: Introduce pcim_enable_msi*() family helpers
Date: Wed, 20 Nov 2013 12:15:26 -0500	[thread overview]
Message-ID: <20131120171526.GL28946@htj.dyndns.org> (raw)
In-Reply-To: <6bc575621ef70f72b206e4aa944acd32f1a75718.1382103786.git.agordeev@redhat.com>

Hello,

On Fri, Oct 18, 2013 at 07:12:12PM +0200, Alexander Gordeev wrote:
> Currently many device drivers need contiguously call functions
> pci_enable_msix() for MSI-X or pci_enable_msi_block() for MSI
> in a loop until success or failure. This update generalizes
> this usage pattern and introduces pcim_enable_msi*() family
> helpers.
> 
> As result, device drivers do not have to deal with tri-state
> return values from pci_enable_msix() and pci_enable_msi_block()
> functions directly and expected to have more clearer and straight
> code.
> 
> So i.e. the request loop described in the documentation...
> 
> 	int foo_driver_enable_msix(struct foo_adapter *adapter,
> 				   int nvec)
> 	{
> 		while (nvec >= FOO_DRIVER_MINIMUM_NVEC) {
> 			rc = pci_enable_msix(adapter->pdev,
> 					     adapter->msix_entries,
> 					     nvec);
> 			if (rc > 0)
> 				nvec = rc;
> 			else
> 				return rc;
> 		}
> 
> 		return -ENOSPC;
> 	}
> 
> ...would turn into a single helper call....
> 
> 	rc = pcim_enable_msix_range(adapter->pdev,
> 				    adapter->msix_entries,
> 				    nvec,
> 				    FOO_DRIVER_MINIMUM_NVEC);
> 
> Device drivers with more specific requirements (i.e. a number of
> MSI-Xs which is a multiple of a certain number within a specified
> range) would still need to implement the loop using the two old
> functions.
> 
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> Suggested-by: Ben Hutchings <bhutchings@solarflare.com>

The use of @nvec and @maxvec is a bit inconsistent.  Maybe it'd be
better to make them uniform?  Also, can you please add function
comments to the new public functions?  People are much more likely to
check them than the documentation.  Other than that,

Reviewed-by: Tejun Heo <tj@kernel.org>

Thanks a lot!

-- 
tejun

  parent reply	other threads:[~2013-11-20 17:15 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 17:12 [PATCH RFC v2 00/29] Introduce pcim_enable_msi*() family helpers Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 01/29] PCI/MSI/s390: Fix single MSI only check Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 02/29] PCI/MSI/s390: Remove superfluous check of MSI type Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 03/29] PCI/MSI/pSeries: Fix wrong error code reporting Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 04/29] PCI/MSI/pSeries: Make quota traversing and requesting race-safe Alexander Gordeev
2013-11-20 15:43   ` Tejun Heo
2013-10-18 17:12 ` [PATCH RFC v2 05/29] PCI/MSI: Fix return value when populate_msi_sysfs() failed Alexander Gordeev
2013-11-20 15:50   ` Tejun Heo
2013-10-18 17:12 ` [PATCH RFC v2 06/29] PCI/MSI: Get rid of useless count of msi_desc leftovers Alexander Gordeev
2013-11-20 16:07   ` Tejun Heo
2013-11-22 18:27     ` Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 07/29] PCI/MSI: Return -ENOSYS for unimplemented interfaces, not -1 Alexander Gordeev
2013-11-20 16:07   ` Tejun Heo
2013-10-18 17:12 ` [PATCH RFC v2 08/29] PCI/MSI: Make pci_enable_msix() 'nvec' argument unsigned int Alexander Gordeev
2013-11-20 16:14   ` Tejun Heo
2013-11-22 18:34     ` Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 09/29] PCI/MSI: Factor out pci_get_msi_cap() interface Alexander Gordeev
2013-11-20 16:18   ` Tejun Heo
2013-11-25 13:49     ` Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 10/29] PCI/MSI: Get rid of pci_enable_msi_block_auto() interface Alexander Gordeev
2013-11-20 16:21   ` Tejun Heo
2013-10-18 17:12 ` [PATCH RFC v2 11/29] PCI/MSI: Convert pci_msix_table_size() to a public interface Alexander Gordeev
2013-11-20 16:23   ` Tejun Heo
2013-11-22 18:38     ` Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 12/29] PCI/MSI: Introduce pcim_enable_msi*() family helpers Alexander Gordeev
2013-10-24 10:51   ` Tejun Heo
2013-10-24 10:57     ` David Laight
2013-10-24 11:01       ` Tejun Heo
2013-10-24 11:41       ` Alexander Gordeev
2013-10-25  2:22         ` Mark Lord
2013-10-25  9:10           ` David Laight
2013-10-25 10:01             ` Alexander Gordeev
2013-10-25 14:52               ` intel e1000e pci driver issue on RT Linux kernel Karicheri, Muralidharan
2013-10-25 14:59                 ` Karicheri, Muralidharan
2013-10-27 22:27               ` [PATCH RFC v2 12/29] PCI/MSI: Introduce pcim_enable_msi*() family helpers Michael Ellerman
2013-10-28 16:30               ` Mark Lord
2013-10-24 14:31     ` Alexander Gordeev
2013-10-25  2:23       ` Mark Lord
2013-11-04  8:12     ` Alexander Gordeev
2013-11-20 17:15   ` Tejun Heo [this message]
2013-11-22 18:44     ` Alexander Gordeev
2013-11-22 18:44       ` Tejun Heo
2013-11-22 18:54         ` Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 13/29] ipr: Do not call pci_disable_msi/msix() if pci_enable_msi/msix() failed Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 14/29] ipr: Make use of pcim_enable_msi/msix() interfaces Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 15/29] ixgbe: Make use of pcim_enable_msix_range() interface Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 16/29] ixgbevf: " Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 17/29] megaraid: Make use of pcim_enable_msix() interface Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 18/29] ntb: Fix missed call to pci_enable_msix() Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 19/29] ntb: Make use of pcim_enable_msix/msix_exact() interfaces Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 20/29] qib: Make use of pcim_enable_msix() and pci_msix_table_size() interfaces Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 21/29] qla2xxx: Make use of pcim_enable_msix_range() interface Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 22/29] qlge: Get rid of an redundant assignment Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 23/29] qlge: Make use of pcim_enable_msix() interface Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 24/29] tg3: " Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 25/29] vmxnet3: Return -EINVAL if number of requested MSI-Xs is not enough Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 26/29] vmxnet3: Fixup a weird loop exit Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 27/29] vmxnet3: Return -ENOSPC when not enough MSI-X vectors available Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 28/29] vmxnet3: Limit number of rx queues to 1 if per-queue MSI-Xs failed Alexander Gordeev
2013-10-18 17:12 ` [PATCH RFC v2 29/29] vmxnet3: Make use of pcim_enable_msix_range() interface Alexander Gordeev
2013-10-21  8:51   ` David Laight
2013-10-21 10:19     ` Alexander Gordeev
2013-11-11 19:56 ` [PATCH RFC v2 00/29] Introduce pcim_enable_msi*() family helpers Alexander Gordeev
2013-11-20 17:16 ` Tejun Heo

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=20131120171526.GL28946@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=agordeev@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=bhutchings@solarflare.com \
    --cc=hpa@zytor.com \
    --cc=kernel@start.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=michael@ellerman.id.au \
    /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).