Re: [PATCH 2/4] cxgb4/iw_cxgb4: use firmware ord/ird resource limits

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

 



Hi,

Le vendredi 11 juillet 2014 à 20:44 +0530, Hariprasad Shenai a écrit :
> diff --git a/drivers/infiniband/hw/cxgb4/qp.c
> b/drivers/infiniband/hw/cxgb4/qp.c
> index 6f74e0e..c911e96 100644
> --- a/drivers/infiniband/hw/cxgb4/qp.c
> +++ b/drivers/infiniband/hw/cxgb4/qp.c
> @@ -58,6 +58,30 @@ static int max_fr_immd = T4_MAX_FR_IMMD;
>  module_param(max_fr_immd, int, 0644);
>  MODULE_PARM_DESC(max_fr_immd, "fastreg threshold for using DSGL
> instead of immedate");
>  
> +static int alloc_ird(struct c4iw_dev *dev, u32 ird)
> +{
> +       int ret;
> +
> +       spin_lock_irq(&dev->lock);
> +       if (ird <= dev->avail_ird) {
> +               dev->avail_ird -= ird;
> +               ret = 0;
> +       } else {
> +               ret = -ENOMEM;
> +               pr_info("%s: device IRD resources exhausted\n",
> +                       pci_name(dev->rdev.lldi.pdev));
> +       }
> +       spin_unlock_irq(&dev->lock);
> +       return ret;
> +}
> +

I would have written this function has:

static int alloc_ird(struct c4iw_dev *dev, u32 ird)
{
	int ret = 0

	spin_lock_irq(&dev->lock);
	if (ird <= dev->avail_ird)
		dev->avail_ird -= ird;
	else
		ret = -ENOMEM;
	spin_unlock_irq(&dev->lock);

	if (ret)
		dev_warn(dev->rdev.lldi.pdev,
			 "device IRD resources exhausted\n");

	return ret;
}

Regards.

-- 
Yann Droneaud
OPTEYA


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux