Re: [PATCH net 1/1] nfp: correct number of MSI vectors requests returned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 15, 2023 at 02:17:33PM +0200, Louis Peens wrote:
> From: Xiaoyu Li <xiaoyu.li@xxxxxxxxxxxx>
> 
> Before the referenced commit, when we requested a
> certain number of interrupts, if we could not meet
> the requirements, the number of interrupts supported
> by the hardware would be returned. But after the
> referenced commit, if the hardware failed to meet
> the requirements, the error of invalid argument
> would be directly returned, which caused a regression
> in the nfp driver preventing probing to complete.

Please don't break lines. You have upto 80 chars per-line.

> 
> Fixes: bab65e48cb06 ("PCI/MSI: Sanitize MSI-X checks")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Xiaoyu Li <xiaoyu.li@xxxxxxxxxxxx>
> Acked-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
> Signed-off-by: Louis Peens <louis.peens@xxxxxxxxxxxx>
> ---
>  drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> index 62f0bf91d1e1..0e4cab38f075 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> @@ -370,6 +370,12 @@ nfp_net_irqs_alloc(struct pci_dev *pdev, struct msix_entry *irq_entries,
>  {
>  	unsigned int i;
>  	int got_irqs;
> +	int max_irqs;
> +
> +	max_irqs = pci_msix_vec_count(pdev);
> +	if (max_irqs < 0)
> +		return max_irqs;
> +	wanted_irqs = min_t(unsigned int, max_irqs, wanted_irqs);

1. It looks like you need to fix your nfp_net_irqs_alloc() to provide
valid wanted_irqs from the beginning.
2. Both wanted_irqs and min_irqs are wrong type and should be int and
not unsigned int.

Thanks

>  
>  	for (i = 0; i < wanted_irqs; i++)
>  		irq_entries[i].entry = i;
> -- 
> 2.34.1
> 



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux