DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: thomas.monjalon@6wind.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH v7 1/2] vfio: keep interrupt source read only
Date: Thu,  6 Apr 2017 20:42:21 +0800	[thread overview]
Message-ID: <20170406124222.18172-2-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20170406124222.18172-1-qi.z.zhang@intel.com>

Remove the inappropriate modification on get_max_intr
field that keep the intr_source read only.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v4:

- Add back this patch to make patch set complete though it already be applied.

v2:

- Seperate patch 1 of v1 into 2 patches.(part 1)

 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 36 ++++------------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index e293728..3069779 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -279,29 +279,6 @@ vfio_disable_msi(const struct rte_intr_handle *intr_handle) {
 	return ret;
 }
 
-static int
-get_max_intr(const struct rte_intr_handle *intr_handle)
-{
-	struct rte_intr_source *src;
-
-	TAILQ_FOREACH(src, &intr_sources, next) {
-		if (src->intr_handle.fd != intr_handle->fd)
-			continue;
-
-		if (src->intr_handle.max_intr < intr_handle->max_intr)
-			src->intr_handle.max_intr = intr_handle->max_intr;
-		if (!src->intr_handle.max_intr)
-			src->intr_handle.max_intr = 1;
-		else if (src->intr_handle.max_intr > RTE_MAX_RXTX_INTR_VEC_ID)
-			src->intr_handle.max_intr
-				= RTE_MAX_RXTX_INTR_VEC_ID + 1;
-
-		return src->intr_handle.max_intr;
-	}
-
-	return -1;
-}
-
 /* enable MSI-X interrupts */
 static int
 vfio_enable_msix(const struct rte_intr_handle *intr_handle) {
@@ -314,15 +291,10 @@ vfio_enable_msix(const struct rte_intr_handle *intr_handle) {
 
 	irq_set = (struct vfio_irq_set *) irq_set_buf;
 	irq_set->argsz = len;
-
-	ret = get_max_intr(intr_handle);
-	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "Invalid number of MSI-X irqs for fd %d\n",
-			intr_handle->fd);
-		return -1;
-	}
-
-	irq_set->count = ret;
+	/* 0 < irq_set->count < RTE_MAX_RXTX_INTR_VEC_ID + 1 */
+	irq_set->count = intr_handle->max_intr ?
+		(intr_handle->max_intr > RTE_MAX_RXTX_INTR_VEC_ID + 1 ?
+		RTE_MAX_RXTX_INTR_VEC_ID + 1 : intr_handle->max_intr) : 1;
 	irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER;
 	irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
 	irq_set->start = 0;
-- 
2.9.3

  reply	other threads:[~2017-04-06  4:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170404230459.15006-1-qi.z.zhang@intel.com>
2017-04-04 23:09 ` [dpdk-dev] [PATCH v6 0/3] clean up interrupt handle Qi Zhang
2017-04-04 23:09   ` [dpdk-dev] [PATCH v6 1/2] vfio: keep interrupt source read only Qi Zhang
2017-04-04 23:09   ` [dpdk-dev] [PATCH v6 2/2] eal: clean up interrupt handle Qi Zhang
2017-04-04 23:09   ` [dpdk-dev] [PATCH v6 3/3] test/test: update test code Qi Zhang
2017-04-05 16:41   ` [dpdk-dev] [PATCH v6 0/3] clean up interrupt handle Thomas Monjalon
2017-04-06 12:42   ` [dpdk-dev] [PATCH v7 0/2] " Qi Zhang
2017-04-06 12:42     ` Qi Zhang [this message]
2017-04-06 19:15       ` [dpdk-dev] [PATCH v7 1/2] vfio: keep interrupt source read only Thomas Monjalon
2017-04-06 12:42     ` [dpdk-dev] [PATCH v7 2/2] eal: clean up interrupt handle Qi Zhang
2017-04-06 19:16     ` [dpdk-dev] [PATCH v7 0/2] " Thomas Monjalon

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=20170406124222.18172-2-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.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).