From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Markus Theil <markus.theil@tu-ilmenau.de>, dev@dpdk.org
Cc: stephen@networkplumber.org
Subject: Re: [dpdk-dev] [PATCH v6 5/5] igb_uio: MSI IRQ mode, use kernel functions for masking MSI and MSI-X
Date: Mon, 4 Sep 2017 22:38:33 +0100 [thread overview]
Message-ID: <ed0741d7-1fbb-6089-2117-707662811d22@intel.com> (raw)
In-Reply-To: <1504549066-11067-5-git-send-email-markus.theil@tu-ilmenau.de>
On 9/4/2017 7:17 PM, Markus Theil wrote:
> This patch adds MSI IRQ mode and in a way, that should
> also work on older kernel versions. The base for my patch
> was an attempt to do this in cf705bc36c which was later reverted in
> d8ee82745a. Compilation was tested on Linux 3.2, 4.10 and 4.12.
>
> Furthermore the custom MSI-X mask code is ommited and already existing
> kernel APIs are used for MSI and MSI-X. Feedback/small corrections
> to the previous patch of this series are also incorporated.
>
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> ---
> lib/librte_eal/linuxapp/igb_uio/compat.h | 26 +++-------
> lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 81 ++++++++++++++++++-------------
> 2 files changed, 56 insertions(+), 51 deletions(-)
>
> diff --git a/lib/librte_eal/linuxapp/igb_uio/compat.h b/lib/librte_eal/linuxapp/igb_uio/compat.h
> index 3825933..67a7ab3 100644
> --- a/lib/librte_eal/linuxapp/igb_uio/compat.h
> +++ b/lib/librte_eal/linuxapp/igb_uio/compat.h
> @@ -15,24 +15,6 @@
> #define HAVE_PTE_MASK_PAGE_IOMAP
> #endif
>
> -#ifndef PCI_MSIX_ENTRY_SIZE
> -#define PCI_MSIX_ENTRY_SIZE 16
> -#define PCI_MSIX_ENTRY_LOWER_ADDR 0
> -#define PCI_MSIX_ENTRY_UPPER_ADDR 4
> -#define PCI_MSIX_ENTRY_DATA 8
> -#define PCI_MSIX_ENTRY_VECTOR_CTRL 12
> -#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1
> -#endif
> -
> -/*
> - * for kernels < 2.6.38 and backported patch that moves MSI-X entry definition
> - * to pci_regs.h Those kernels has PCI_MSIX_ENTRY_SIZE defined but not
> - * PCI_MSIX_ENTRY_CTRL_MASKBIT
> - */
> -#ifndef PCI_MSIX_ENTRY_CTRL_MASKBIT
> -#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1
> -#endif
> -
> #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) && \
> (!(defined(RHEL_RELEASE_CODE) && \
> RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 9)))
> @@ -127,3 +109,11 @@ static bool pci_check_and_mask_intx(struct pci_dev *pdev)
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
> #define HAVE_ALLOC_IRQ_VECTORS 1
> #endif
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
> +#define HAVE_PCI_MSI_MASK_IRQ 1
> +#endif
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
> +#define HAVE_IRQ_DATA 1
> +#endif
> diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> index c570eed..b578c4a 100644
> --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> @@ -91,27 +91,6 @@ static struct attribute *dev_attrs[] = {
> static const struct attribute_group dev_attr_grp = {
> .attrs = dev_attrs,
> };
> -/*
> - * It masks the msix on/off of generating MSI-X messages.
> - */
> -static void
> -igbuio_msix_mask_irq(struct msi_desc *desc, int32_t state)
> -{
> - u32 mask_bits = desc->masked;
> - unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE +
> - PCI_MSIX_ENTRY_VECTOR_CTRL;
> -
> - if (state != 0)
> - mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT;
> - else
> - mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT;
> -
> - if (mask_bits != desc->masked) {
> - writel(mask_bits, desc->mask_base + offset);
> - readl(desc->mask_base);
> - desc->masked = mask_bits;
> - }
> -}
>
> /**
> * This is the irqcontrol callback to be registered to uio_info.
> @@ -132,21 +111,31 @@ igbuio_pci_irqcontrol(struct uio_info *info, s32 irq_state)
> struct rte_uio_pci_dev *udev = info->priv;
> struct pci_dev *pdev = udev->pdev;
>
> - pci_cfg_access_lock(pdev);
> - if (udev->mode == RTE_INTR_MODE_LEGACY)
> - pci_intx(pdev, !!irq_state);
> +#ifdef HAVE_IRQ_DATA
> + struct irq_data *irq = irq_get_irq_data(udev->info.irq);
> +#else
> + unsigned int irq = udev->info.irq;
> +#endif
>
> - else if (udev->mode == RTE_INTR_MODE_MSIX) {
> - struct msi_desc *desc;
> + pci_cfg_access_lock(pdev);
>
> -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0))
> - list_for_each_entry(desc, &pdev->msi_list, list)
> - igbuio_msix_mask_irq(desc, irq_state);
> + if (udev->mode == RTE_INTR_MODE_MSIX || udev->mode == RTE_INTR_MODE_MSI) {
> +#ifdef HAVE_PCI_MSI_MASK_IRQ
> + if (irq_state == 1)
> + pci_msi_unmask_irq(irq);
> + else
> + pci_msi_mask_irq(irq);
> #else
> - list_for_each_entry(desc, &pdev->dev.msi_list, list)
> - igbuio_msix_mask_irq(desc, irq_state);
> + if (irq_state == 1)
> + unmask_msi_irq(irq);
> + else
> + mask_msi_irq(irq);
Can you please split this patch into two:
- first converts igbuio_msix_mask_irq() into Linux functions, with
HAVE_IRQ_DATA and HAVE_PCI_MSI_MASK_IRQ checks
- second add MSI support, as it is in this patch
Thanks,
ferruh
next prev parent reply other threads:[~2017-09-04 21:38 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 17:33 [dpdk-dev] [PATCH] igb_uio: MSI IRQ mode, irq enable/disable refactored Markus Theil
2017-08-21 17:51 ` [dpdk-dev] [PATCH v2 1/2] " Markus Theil
2017-08-21 17:51 ` [dpdk-dev] [PATCH v2 2/2] igb_uio: conform to coding conventions Markus Theil
2017-08-22 13:28 ` [dpdk-dev] [PATCH v3] igb_uio: MSI IRQ mode, irq enable/disable refactored Markus Theil
2017-08-30 16:32 ` Ferruh Yigit
2017-08-31 22:05 ` Markus Theil
2017-08-31 10:22 ` [dpdk-dev] [PATCH v4 1/3] igb_uio: refactor irq enable/disable into own functions Markus Theil
2017-08-31 10:22 ` [dpdk-dev] [PATCH v4 2/3] igb_uio: fix irq disable on recent kernels Markus Theil
2017-08-31 10:22 ` [dpdk-dev] [PATCH v4 3/3] igb_uio: MSI IRQ mode Markus Theil
2017-08-31 15:32 ` Stephen Hemminger
2017-08-31 22:07 ` Markus Theil
2017-08-31 21:46 ` [dpdk-dev] [PATCH v5 1/5] igb_uio: refactor irq enable/disable into own functions Markus Theil
2017-08-31 21:46 ` [dpdk-dev] [PATCH v5 2/5] igb_uio: fix irq disable on recent kernels Markus Theil
2017-08-31 21:46 ` [dpdk-dev] [PATCH v5 3/5] igb_uio: MSI IRQ mode Markus Theil
2017-08-31 21:46 ` [dpdk-dev] [PATCH v5 4/5] igb_uio: use msi mask functions from kernel, little corrections Markus Theil
2017-09-01 15:40 ` Stephen Hemminger
2017-09-04 10:03 ` Burakov, Anatoly
2017-09-04 12:43 ` Ferruh Yigit
2017-09-04 15:16 ` Markus Theil
2017-09-04 16:55 ` Ferruh Yigit
2017-08-31 21:47 ` [dpdk-dev] [PATCH v5 5/5] igb_uio: release in exact reverse order Markus Theil
2017-08-22 16:55 ` [dpdk-dev] [PATCH] igb_uio: MSI IRQ mode, irq enable/disable refactored Stephen Hemminger
2017-08-22 18:19 ` Markus Theil
2017-08-23 8:47 ` Bruce Richardson
2017-08-23 8:51 ` Bruce Richardson
2017-09-04 18:17 ` [dpdk-dev] [PATCH v6 1/5] igb_uio: refactor irq enable/disable into own functions Markus Theil
2017-09-04 18:17 ` [dpdk-dev] [PATCH v6 2/5] igb_uio: fix irq disable on recent kernels Markus Theil
2017-09-04 21:32 ` Ferruh Yigit
2017-09-04 18:17 ` [dpdk-dev] [PATCH v6 3/5] igb_uio: fix MSI-X IRQ assignment with new IRQ function Markus Theil
2017-09-04 21:34 ` Ferruh Yigit
2017-09-04 18:17 ` [dpdk-dev] [PATCH v6 4/5] igb_uio: release in exact reverse order Markus Theil
2017-09-04 18:17 ` [dpdk-dev] [PATCH v6 5/5] igb_uio: MSI IRQ mode, use kernel functions for masking MSI and MSI-X Markus Theil
2017-09-04 21:38 ` Ferruh Yigit [this message]
2017-09-05 12:04 ` [dpdk-dev] [PATCH v7 1/6] igb_uio: refactor irq enable/disable into own functions Markus Theil
2017-09-05 12:04 ` [dpdk-dev] [PATCH v7 2/6] igb_uio: fix irq disable on recent kernels Markus Theil
2017-09-05 12:04 ` [dpdk-dev] [PATCH v7 3/6] igb_uio: fix MSI-X IRQ assignment with new IRQ function Markus Theil
2017-09-11 17:56 ` Ferruh Yigit
2017-09-11 22:04 ` Stephen Hemminger
2017-09-12 8:14 ` Bruce Richardson
2017-09-12 15:01 ` Stephen Hemminger
2017-09-12 8:16 ` Bruce Richardson
2017-09-12 16:31 ` Kevin Traynor
2017-09-05 12:04 ` [dpdk-dev] [PATCH v7 4/6] igb_uio: release in exact reverse order Markus Theil
2017-09-05 12:04 ` [dpdk-dev] [PATCH v7 5/6] igb_uio: use kernel functions for masking MSI-X Markus Theil
2017-10-09 21:56 ` Patrick MacArthur
2017-10-12 17:04 ` Ferruh Yigit
2017-10-13 2:49 ` Ferruh Yigit
2017-10-13 8:28 ` Kavanagh, Mark B
2017-10-12 10:50 ` Kavanagh, Mark B
2017-10-12 20:58 ` Ferruh Yigit
2017-10-12 21:15 ` Stephen Hemminger
2017-10-13 0:28 ` Ferruh Yigit
2017-09-05 12:04 ` [dpdk-dev] [PATCH v7 6/6] igb_uio: MSI IRQ mode Markus Theil
2017-09-11 17:48 ` [dpdk-dev] [PATCH v7 1/6] igb_uio: refactor irq enable/disable into own functions Ferruh Yigit
2017-09-14 12:04 ` Markus Theil
2017-10-06 22:05 ` Ferruh Yigit
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=ed0741d7-1fbb-6089-2117-707662811d22@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=markus.theil@tu-ilmenau.de \
--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).