Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573575

Re: [PATCH 3/3] net: ethernet: bgmac: driver power manangement

From Florian Fainelli <f.fainelli@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] net: ethernet: bgmac: driver power manangement
Date 2017-02-04 03:20 +0100
Message-ID <t6Y7f-2bM-3@gated-at.bofh.it> (permalink)
References <t6TKi-7ml-17@gated-at.bofh.it> <t6TTX-7qD-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 02/03/2017 01:39 PM, Jon Mason wrote:
> From: Joey Zhong <zhongx@broadcom.com>
> 
> Implements suspend/resume, external phy 54810 is assumed
> to remain powered up during deep-sleep for wake-on-lane.

s/wake-on-lane/Wake-on-LAN, are you positive phy_stop() is not
suspending the PHY and issuing BMCR_PWRDOWN write?

This also seems incomplete in that, if the device is really configured
for Wake-on-LAN (through ethtool) you should call
device_set_wakeup_capable() and then check for device_may_wakeup()
during suspend or resume to know which part of the suspend/resume
portion should be done. You could refer to bcmgenet for an example.

>  
> +int bgmac_enet_suspend(struct bgmac *bgmac)
> +{
> +	netdev_info(bgmac->net_dev, "Suspending\n");

remove that message

> +
> +	if (netif_running(bgmac->net_dev)) {
> +		netif_stop_queue(bgmac->net_dev);
> +
> +		napi_disable(&bgmac->napi);
> +
> +		netif_tx_lock(bgmac->net_dev);
> +		netif_device_detach(bgmac->net_dev);
> +		netif_tx_unlock(bgmac->net_dev);
> +
> +		bgmac_chip_intrs_off(bgmac);
> +		bgmac_chip_reset(bgmac);
> +		bgmac_dma_cleanup(bgmac);
> +	}

Can you change the indentation to test for netiff_running() first and
return 0 in that case?

> +
> +	phy_stop(bgmac->net_dev->phydev);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(bgmac_enet_suspend);
> +
> +int bgmac_enet_resume(struct bgmac *bgmac)
> +{
> +	int rc;
> +
> +	netdev_info(bgmac->net_dev, "Resuming\n");

Same here, this needs to be removed.

> +
> +	phy_start(bgmac->net_dev->phydev);
> +
> +	if (netif_running(bgmac->net_dev)) {
> +		rc = bgmac_dma_init(bgmac);
> +		if (rc)
> +			return rc;
> +
> +		bgmac_chip_init(bgmac);
> +
> +		napi_enable(&bgmac->napi);
> +
> +		netif_tx_lock(bgmac->net_dev);
> +		netif_device_attach(bgmac->net_dev);
> +		netif_tx_unlock(bgmac->net_dev);
> +
> +		netif_start_queue(bgmac->net_dev);
> +	}
-- 
Florian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/3] net: ethernet: bgmac: PM support and clean-ups Jon Mason <jon.mason@broadcom.com> - 2017-02-03 22:40 +0100
  [PATCH 3/3] net: ethernet: bgmac: driver power manangement Jon Mason <jon.mason@broadcom.com> - 2017-02-03 22:50 +0100
    Re: [PATCH 3/3] net: ethernet: bgmac: driver power manangement Florian Fainelli <f.fainelli@gmail.com> - 2017-02-04 03:20 +0100
      Re: [PATCH 3/3] net: ethernet: bgmac: driver power manangement Jon Mason <jon.mason@broadcom.com> - 2017-02-06 17:40 +0100
  [PATCH 1/3] net: ethernet: bgmac: use #defines for MAX size Jon Mason <jon.mason@broadcom.com> - 2017-02-03 22:50 +0100
  [PATCH 2/3] net: ethernet: bgmac: unify code of the same family Jon Mason <jon.mason@broadcom.com> - 2017-02-03 22:50 +0100
    Re: [PATCH 2/3] net: ethernet: bgmac: unify code of the same family Jon Mason <jon.mason@broadcom.com> - 2017-02-03 23:40 +0100
    Re: [PATCH 2/3] net: ethernet: bgmac: unify code of the same family Rafał Miłecki <rafal@milecki.pl> - 2017-02-04 00:10 +0100

csiph-web