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>] [day] [month] [year] [list]
Message-ID: <13A253B3F9BEFE43B93C09CF75F63CAA6E95E6626F@MNEXMB1.qlogic.org>
Date:	Wed, 6 Apr 2011 07:56:39 -0500
From:	Sucheta Chakraborty <sucheta.chakraborty@...gic.com>
To:	"Stephen Hemminger " 
	<IMCEAMAILTO-shemminger+40vyatta+2Ecom@...gic.com>
CC:	"davem@...emloft.net" <davem@...emloft.net>,
	"bhutchings@...arflare.com" <bhutchings@...arflare.com>,
	Amit Salecha <amit.salecha@...gic.com>,
	Anirban Chakraborty <anirban.chakraborty@...gic.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Sucheta Chakraborty <sucheta.chakraborty@...gic.com>
Subject: RE: [PATCH net-next-2.6 12/12] qlcnic: convert to set_phys_id

> -     if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
> -             dev_down = 1;
> -             if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state))
> -                     return -EIO;
> -
> -             ret = qlcnic_diag_alloc_res(dev, QLCNIC_LED_TEST);
> +     switch (state) {
> +     case ETHTOOL_ID_ACTIVE:
> +             if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
> +                     if (test_and_set_bit(__QLCNIC_RESETTING, &adapter-
> >state))
> +                             return -EIO;
> +
> +                     ret = qlcnic_diag_alloc_res(dev, QLCNIC_LED_TEST);
> +                     if (ret) {
> +                             clear_bit(__QLCNIC_RESETTING, &adapter->state);
> +                             return ret;
> +                     }
> +             }
> +
> +             ret = adapter->nic_ops->config_led(adapter, 1, 0xf);
>               if (ret) {
> -                     clear_bit(__QLCNIC_RESETTING, &adapter->state);
> -                     return ret;
> +                     dev_err(&adapter->pdev->dev,
> +                             "Failed to set LED blink state.\n");
> +                     break;
>               }
> -     }
> -
> -     ret = adapter->nic_ops->config_led(adapter, 1, 0xf);
> -     if (ret) {
> -             dev_err(&adapter->pdev->dev,
> -                     "Failed to set LED blink state.\n");
> -             goto done;
> -     }
> +             return 0;
>
> -     msleep_interruptible(val * 1000);
> +     case ETHTOOL_ID_INACTIVE:
> +             ret = adapter->nic_ops->config_led(adapter, 0, 0xf);
> +             if (ret)
> +                     dev_err(&adapter->pdev->dev,
> +                             "Failed to reset LED blink state.\n");
> +             break;
>
> -     ret = adapter->nic_ops->config_led(adapter, 0, 0xf);
> -     if (ret) {
> -             dev_err(&adapter->pdev->dev,
> -                     "Failed to reset LED blink state.\n");
> -             goto done;
> +     default:
> +             return -EINVAL;
>       }
>
> -done:
> -     if (dev_down) {
> +     if (!netif_running(dev)) {
>               qlcnic_diag_free_res(dev, max_sds_rings);
>               clear_bit(__QLCNIC_RESETTING, &adapter->state);
>       }

netif_running() check will not work here because interface can be brought down when LED test is ACTIVE.
This may result in freeing resources unnecessarily.
You can have a bit flag in adapter->state to track resources allocation (qlcnic_diag_alloc_res()).

Thanks,
Sucheta.


This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

--
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