lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 13 Jul 2014 13:59:24 +0200
From:	Yann Droneaud <ydroneaud@...eya.com>
To:	Hariprasad Shenai <hariprasad@...lsio.com>
Cc:	netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
	davem@...emloft.net, roland@...estorage.com,
	swise@...ngridcomputing.com, leedom@...lsio.com,
	nirranjan@...lsio.com, kumaras@...lsio.com
Subject: Re: [PATCH 2/4] cxgb4/iw_cxgb4: use firmware ord/ird resource limits

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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ