DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Jan Blunck <jblunck@infradead.org>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "shreyansh.jain@nxp.com" <shreyansh.jain@nxp.com>,
	"david.marchand@6wind.com" <david.marchand@6wind.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: Re: [dpdk-dev] [PATCH v5 02/20] eal: Allow passing const rte_intr_handle
Date: Tue, 17 Jan 2017 04:42:48 +0000	[thread overview]
Message-ID: <ED26CBA2FAD1BF48A8719AEF02201E3651115EC4@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1482508691-11408-3-git-send-email-jblunck@infradead.org>

Hi Jan,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jan Blunck
> Sent: Friday, December 23, 2016 11:58 PM
> To: dev@dpdk.org
> Cc: shreyansh.jain@nxp.com; david.marchand@6wind.com;
> stephen@networkplumber.org
> Subject: [dpdk-dev] [PATCH v5 02/20] eal: Allow passing const
> rte_intr_handle
> 
> Both register/unregister and enable/disable don't necessarily require the
> rte_intr_handle to be modifiable. Therefore lets constify it.
> 
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> ---
>  lib/librte_eal/bsdapp/eal/eal_interrupts.c     | 24 ++++++----
>  lib/librte_eal/common/include/rte_interrupts.h |  8 ++--
>  lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 62 ++++++++++++++++++----
> ----
>  3 files changed, 63 insertions(+), 31 deletions(-)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/eal_interrupts.c
> b/lib/librte_eal/bsdapp/eal/eal_interrupts.c
> index 836e483..ea2afff 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_interrupts.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_interrupts.c
> @@ -36,29 +36,37 @@
>  #include "eal_private.h"
> 
[...]
> 
> +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)
> +			src->intr_handle.max_intr = 1;
> +		else if (src->intr_handle.max_intr >
> RTE_MAX_RXTX_INTR_VEC_ID)

See "src" instead of intr_handle is used here. "src" is only initialized as calling rte_intr_callback_register at device init phase. But max_intr is usually changed as calling rte_intr_efd_enable() after that. How to make sure max_intr in "src" is valid? And, why shall we use src instead of intr_handle here?

Thanks,
Jianfeng

> +			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(struct rte_intr_handle *intr_handle) {
> +vfio_enable_msix(const struct rte_intr_handle *intr_handle) {
>  	int len, ret;
>  	char irq_set_buf[MSIX_IRQ_SET_BUF_LEN];
>  	struct vfio_irq_set *irq_set;
> @@ -290,12 +311,15 @@ vfio_enable_msix(struct rte_intr_handle
> *intr_handle) {
> 
>  	irq_set = (struct vfio_irq_set *) irq_set_buf;
>  	irq_set->argsz = len;
> -	if (!intr_handle->max_intr)
> -		intr_handle->max_intr = 1;
> -	else if (intr_handle->max_intr > RTE_MAX_RXTX_INTR_VEC_ID)
> -		intr_handle->max_intr = RTE_MAX_RXTX_INTR_VEC_ID + 1;
> 
> -	irq_set->count = intr_handle->max_intr;
> +	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;
>  	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;
> @@ -318,7 +342,7 @@ vfio_enable_msix(struct rte_intr_handle
> *intr_handle) {
> 

  reply	other threads:[~2017-01-17  4:42 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 15:09 [dpdk-dev] [PATCH v4 00/23] Decouple ethdev from PCI device Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 01/23] eal: define container_of macro Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 02/23] eal: Allow passing const rte_intr_handle Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 03/23] rte_device: make driver pointer const Jan Blunck
2016-12-22  7:18   ` Shreyansh Jain
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 04/23] pmd: remove useless reset of dev_info->dev_pci Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 05/23] e1000: localize mapping from eth_dev to pci Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 06/23] ixgbe: localize mapping from eth_dev to pci_device Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 07/23] i40e: localize mapping of eth_dev to pci Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 08/23] broadcom: localize mapping from " Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 09/23] virtio: Don't fill dev_info->driver_name Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 10/23] virtio: Add vtpci_intr_handle() helper to get rte_intr_handle Jan Blunck
2016-12-21 20:08   ` Stephen Hemminger
2016-12-23 11:04     ` Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 11/23] virtio: Don't depend on struct rte_eth_dev's pci_dev Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 12/23] bnx2x: localize mapping from eth_dev to pci Jan Blunck
2016-12-21 16:35   ` Harish Patil
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 13/23] fm10k: " Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 14/23] qede: localize mapping of " Jan Blunck
2016-12-21 16:35   ` Harish Patil
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 15/23] szedata2: localize handling of pci resources Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 16/23] nfp: localize rte_pci_device handling Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 17/23] vmxnet3: use eth_dev->data->drv_name instead of pci_drv name Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 18/23] ethdev: Helper to map to struct rte_pci_device Jan Blunck
2016-12-22 15:21   ` Thomas Monjalon
2016-12-22 18:13     ` Jan Blunck
2016-12-23  8:30       ` Thomas Monjalon
2016-12-23 10:27         ` Jan Blunck
2016-12-23 12:47           ` Thomas Monjalon
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 19/23] drivers: Replace per-PMD macros with rte_eth_dev_to_pci() helper Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 20/23] drivers: Use " Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 21/23] ethdev: Move filling of rte_eth_dev_info->pci_dev to dev_infos_get() Jan Blunck
2016-12-21 20:09   ` Stephen Hemminger
2016-12-22  8:11     ` Shreyansh Jain
2016-12-23 10:50       ` Jan Blunck
2016-12-23 11:11         ` Shreyansh Jain
     [not found]           ` <CALe+Z005ByAFq03su4VO_=sH299zS_zAQWjyfyW8jQ3sD7zPrw@mail.gmail.com>
2016-12-23 11:39             ` Shreyansh Jain
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 22/23] ethdev: Decouple interrupt handling from PCI device Jan Blunck
2016-12-22 15:13   ` Thomas Monjalon
2016-12-22 18:26     ` Jan Blunck
2016-12-21 15:09 ` [dpdk-dev] [PATCH v4 23/23] ethdev: Decouple struct rte_eth_dev from struct rte_pci_device Jan Blunck
2016-12-22 15:22   ` Thomas Monjalon
2016-12-22 15:26 ` [dpdk-dev] [PATCH v4 00/23] Decouple ethdev from PCI device Thomas Monjalon
2016-12-23 14:28   ` Thomas Monjalon
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 00/20] " Jan Blunck
2016-12-25 22:33   ` Thomas Monjalon
2017-01-03 12:20     ` Ferruh Yigit
2017-01-06 10:07       ` Andrew Rybchenko
2017-01-03 12:24     ` Ferruh Yigit
2017-01-03 14:06       ` Thomas Monjalon
2017-01-03 14:40         ` Ferruh Yigit
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 01/20] eal: define container_of macro Jan Blunck
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 02/20] eal: Allow passing const rte_intr_handle Jan Blunck
2017-01-17  4:42   ` Tan, Jianfeng [this message]
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 03/20] rte_device: make driver pointer const Jan Blunck
2016-12-23 16:19   ` Thomas Monjalon
2016-12-23 22:08   ` Stephen Hemminger
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 04/20] pmd: remove useless reset of dev_info->dev_pci Jan Blunck
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 05/20] e1000: localize mapping from eth_dev to pci Jan Blunck
2016-12-23 16:20   ` Thomas Monjalon
2016-12-23 22:06   ` Stephen Hemminger
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 06/20] ixgbe: localize mapping from eth_dev to pci_device Jan Blunck
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 07/20] i40e: localize mapping of eth_dev to pci Jan Blunck
2016-12-23 15:57 ` [dpdk-dev] [PATCH v5 08/20] broadcom: localize mapping from " Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 09/20] virtio: Don't fill dev_info->driver_name Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 10/20] virtio: Add vtpci_intr_handle() helper to get rte_intr_handle Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 11/20] virtio: Don't depend on struct rte_eth_dev's pci_dev Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 12/20] bnx2x: localize mapping from eth_dev to pci Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 13/20] fm10k: " Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 14/20] qede: localize mapping of " Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 15/20] szedata2: localize handling of pci resources Jan Blunck
2016-12-23 18:31   ` Thomas Monjalon
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 16/20] nfp: localize rte_pci_device handling Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 17/20] vmxnet3: use eth_dev->data->drv_name instead of pci_drv name Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 18/20] ethdev: Decouple interrupt handling from PCI device Jan Blunck
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 19/20] ethdev: Move dev_info filling of PCI information into drivers Jan Blunck
2016-12-23 18:45   ` Thomas Monjalon
2016-12-23 15:58 ` [dpdk-dev] [PATCH v5 20/20] ethdev: Decouple from PCI device Jan Blunck
2016-12-23 16:17   ` Thomas Monjalon
2016-12-23 16:20     ` Jan Blunck

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=ED26CBA2FAD1BF48A8719AEF02201E3651115EC4@SHSMSX103.ccr.corp.intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=jblunck@infradead.org \
    --cc=shreyansh.jain@nxp.com \
    --cc=stephen@networkplumber.org \
    /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).