Backports Archive on lore.kernel.org
 help / Atom feed
* Re: Subject: [PATCH] add support for pci_alloc_irq_vectors
       [not found] <AM0PR02MB36506A5694D9DEFB288445F093160@AM0PR02MB3650.eurprd02.prod.outlook.com>
@ 2018-09-25 19:13 ` Hauke Mehrtens
       [not found]   ` <AM0PR02MB365025326A06C3B60C28036093150@AM0PR02MB3650.eurprd02.prod.outlook.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Hauke Mehrtens @ 2018-09-25 19:13 UTC (permalink / raw)
  To: Omer Dagan, mcgrof; +Cc: backports

[-- Attachment #1.1: Type: text/plain, Size: 4131 bytes --]

On 09/25/2018 09:59 AM, Omer Dagan wrote:
> The following patch adds support for the 'pci_alloc_irq_vectors' function,
> it does not implement the functionality as implemented in later kernels
> but just provides a wrapper around the deprecate dfunctions implemented
> previouslly

Thank you for this patch, I was too lazy to backport this and made
WIL6210 depend on kernel >= 4.8, so this can be removed with your patch.

> Subject: [PATCH] add support for pci_alloc_irq_vectors
> 
>     add support for function in kernels under 4.8
>     function is a wrapper around 'pci_enable_msi_block' or
>     'pci_enable_msi_range' depending on the kernel version
>     since it is a wrapper around these functions and they
>     are defined in 3.14 there was a need to add dependency in the
>     Makefile
>     the min\max number of interrupts was overridden to always use the
>     max number of interrupts which seems correct since it was not
>     supported in the old APIs
> 
> Signed-off-by: Omer Dagan <omer.dagan@tandemg.com>
> 
> diff --git a/backport/backport-include/linux/pci.h
> b/backport/backport-include/linux/pci.h
> index 67ac40fc..531f5a47 100644
> --- a/backport/backport-include/linux/pci.h
> +++ b/backport/backport-include/linux/pci.h
> @@ -134,6 +134,25 @@ static inline int pci_vfs_assigned(struct pci_dev *dev)
>  
>  #endif /* LINUX_VERSION_IS_LESS(3,10,0) */
>  
> +#if LINUX_VERSION_IS_LESS(4,8,0)
> +#define pci_alloc_irq_vectors LINUX_BACKPORT(pci_alloc_irq_vectors)
> +#ifdef CONFIG_PCI_MSI
> +int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> +unsigned int max_vecs, unsigned int flags);
> +#else
> +static inline int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned
> int min_vecs,
> +unsigned int max_vecs, unsigned int flags)
> +{ return -ENOSYS; }
> +#endif
> +#endif
> +
> +#if LINUX_VERSION_IS_LESS(4,8,0)
> +#define pci_free_irq_vectors LINUX_BACKPORT(pci_free_irq_vectors)
> +static inline void pci_free_irq_vectors(struct pci_dev *dev)
> +{
> +}
> +#endif
> +
>  #if LINUX_VERSION_IS_LESS(3,14,0)
>  #define pci_enable_msi_range LINUX_BACKPORT(pci_enable_msi_range)
>  #ifdef CONFIG_PCI_MSI
> diff --git a/backport/compat/Makefile b/backport/compat/Makefile
> index ac70aaf8..52ad69ea 100644
> --- a/backport/compat/Makefile
> +++ b/backport/compat/Makefile
> @@ -34,7 +34,7 @@ compat-$(CPTCFG_KERNEL_4_4) += backport-4.4.o
>  compat-$(CPTCFG_KERNEL_4_5) += backport-4.5.o
>  compat-$(CPTCFG_KERNEL_4_6) += backport-4.6.o
>  compat-$(CPTCFG_KERNEL_4_7) += backport-4.7.o
> -compat-$(CPTCFG_KERNEL_4_8) += backport-4.8.o
> +compat-$(CPTCFG_KERNEL_4_8) += backport-4.8.o backport-3.14.o

I think this change is wrong.

>  compat-$(CPTCFG_KERNEL_4_10) += backport-4.10.o
>  compat-$(CPTCFG_KERNEL_4_12) += backport-4.12.o
>  
> diff --git a/backport/compat/backport-4.8.c b/backport/compat/backport-4.8.c
> index 7d056444..53ebe1d4 100644
> --- a/backport/compat/backport-4.8.c
> +++ b/backport/compat/backport-4.8.c
> @@ -9,6 +9,7 @@
>   */
>  #include <linux/usb.h>
>  #include <linux/usb/cdc.h>
> +#include <linux/pci.h>
>  
>  int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
>  struct usb_interface *intf,
> @@ -144,3 +145,27 @@ next_desc:
>  return cnt;
>  }
>  EXPORT_SYMBOL_GPL(cdc_parse_cdc_header);
> +
> +#if LINUX_VERSION_IS_LESS(4,8,0)
> +int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> +unsigned int max_vecs, unsigned int flags)
> +{
> +int res;
> +int msi_nvect = max_vecs;
> +
> +if (max_vecs < min_vecs)
> +return -ERANGE;
> +
> +#if LINUX_VERSION_IS_LESS(3,15,0)
> +    res = pci_enable_msi_block(dev, msi_nvect);
> +    if (res == 0) {
> +return msi_nvect;
> +}
> +#else
> +res = pci_enable_msi_range(dev, msi_nvect, msi_nvect);
> +return msi_nvect;
> +#endif /*LINUX_VERSION_IS_LESS(3,15,0)*/
> +return -ENOSPC;
> +}
> +EXPORT_SYMBOL(pci_alloc_irq_vectors);
> +#endif /*LINUX_VERSION_IS_LESS(4,8,0)*/
> -- 
> 2.17.1
> 

It looks like most trailing withe spaces are gone, was this intended?

Hauke


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] add support for pci_alloc_irq_vectors
       [not found]   ` <AM0PR02MB365025326A06C3B60C28036093150@AM0PR02MB3650.eurprd02.prod.outlook.com>
@ 2018-09-30 22:04     ` Hauke Mehrtens
  0 siblings, 0 replies; 2+ messages in thread
From: Hauke Mehrtens @ 2018-09-30 22:04 UTC (permalink / raw)
  To: Omer Dagan, mcgrof; +Cc: backports

[-- Attachment #1.1: Type: text/plain, Size: 3602 bytes --]

Hi Omer,

On 09/26/2018 09:29 AM, Omer Dagan wrote:
> Hi Hauke 
> I removed the Makefile dependency - you are correct there was no need
> for that
> the whitespace issue was not intentional - corrected in this patch 

You should use whitespace to do some indention. I do not know if you
missed then or if your mail program removed them. I would suggest to
send the patches with "git send-email".

It also looks like your mail is blocked by the mailling list, probably
because it uses html mail.


Hauke

> 
> from: Omer Dagan <omer.dagan@tandemg.com>
> Date: Sun, 16 Sep 2018 17:25:11 +0300
> Subject: [PATCH] add support for pci_alloc_irq_vectors
> 
>     add support for function in kernels under 4.8
>     function is a wrapper around 'pci_enable_msi_block' or
>     'pci_enable_msi_range' depending on the kernel version
>     the min\max number of interrupts was overridden to always use the
>     max number of interrupts which seems correct since it was not
>     supported in the old APIs
> 
> Signed-off-by: Omer Dagan <omer.dagan@tandemg.com>
> ---
>  backport/backport-include/linux/pci.h | 19 +++++++++++++++++++
>  backport/compat/backport-4.8.c        | 25 +++++++++++++++++++++++++
>  2 files changed, 44 insertions(+)
> 
> diff --git a/backport/backport-include/linux/pci.h
> b/backport/backport-include/linux/pci.h
> index 67ac40fc..531f5a47 100644
> --- a/backport/backport-include/linux/pci.h
> +++ b/backport/backport-include/linux/pci.h
> @@ -134,6 +134,25 @@ static inline int pci_vfs_assigned(struct pci_dev *dev)
>  
>  #endif /* LINUX_VERSION_IS_LESS(3,10,0) */
>  
> +#if LINUX_VERSION_IS_LESS(4,8,0)
> +#define pci_alloc_irq_vectors LINUX_BACKPORT(pci_alloc_irq_vectors)
> +#ifdef CONFIG_PCI_MSI
> +int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> +unsigned int max_vecs, unsigned int flags);
> +#else
> +static inline int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned
> int min_vecs,
> +unsigned int max_vecs, unsigned int flags)
> +{ return -ENOSYS; }
> +#endif
> +#endif
> +
> +#if LINUX_VERSION_IS_LESS(4,8,0)
> +#define pci_free_irq_vectors LINUX_BACKPORT(pci_free_irq_vectors)
> +static inline void pci_free_irq_vectors(struct pci_dev *dev)
> +{
> +}
> +#endif
> +
>  #if LINUX_VERSION_IS_LESS(3,14,0)
>  #define pci_enable_msi_range LINUX_BACKPORT(pci_enable_msi_range)
>  #ifdef CONFIG_PCI_MSI
> diff --git a/backport/compat/backport-4.8.c b/backport/compat/backport-4.8.c
> index 7d056444..706bd067 100644
> --- a/backport/compat/backport-4.8.c
> +++ b/backport/compat/backport-4.8.c
> @@ -9,6 +9,7 @@
>   */
>  #include <linux/usb.h>
>  #include <linux/usb/cdc.h>
> +#include <linux/pci.h>
>  
>  int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
>  struct usb_interface *intf,
> @@ -144,3 +145,27 @@ next_desc:
>  return cnt;
>  }
>  EXPORT_SYMBOL_GPL(cdc_parse_cdc_header);
> +
> +#if LINUX_VERSION_IS_LESS(4,8,0)
> +int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> +unsigned int max_vecs, unsigned int flags)
> +{
> +int res;
> +int msi_nvect = max_vecs;
> +
> +if (max_vecs < min_vecs)
> +return -ERANGE;
> +
> +#if LINUX_VERSION_IS_LESS(3,15,0)
> +res = pci_enable_msi_block(dev, msi_nvect);
> +if (res == 0) {
> +return msi_nvect;
> +}
> +#else
> +res = pci_enable_msi_range(dev, msi_nvect, msi_nvect);
> +return msi_nvect;
> +#endif /*LINUX_VERSION_IS_LESS(3,15,0)*/
> +return -ENOSPC;
> +}
> +EXPORT_SYMBOL(pci_alloc_irq_vectors);
> +#endif /*LINUX_VERSION_IS_LESS(4,8,0)*/
> -- 




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AM0PR02MB36506A5694D9DEFB288445F093160@AM0PR02MB3650.eurprd02.prod.outlook.com>
2018-09-25 19:13 ` Subject: [PATCH] add support for pci_alloc_irq_vectors Hauke Mehrtens
     [not found]   ` <AM0PR02MB365025326A06C3B60C28036093150@AM0PR02MB3650.eurprd02.prod.outlook.com>
2018-09-30 22:04     ` Hauke Mehrtens

Backports Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/backports/0 backports/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 backports backports/ https://lore.kernel.org/backports \
		backports@vger.kernel.org backports@archiver.kernel.org
	public-inbox-index backports


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.backports


AGPL code for this site: git clone https://public-inbox.org/ public-inbox