linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 18/30] net: fec: remove inappropriate calls around fec_restart()
Date: Sun, 22 Jun 2014 08:55:14 +0100	[thread overview]
Message-ID: <20140622075514.GA32514@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <869ac1ad635844ee84adbecd2eb0d0dc@BLUPR03MB373.namprd03.prod.outlook.com>

On Sun, Jun 22, 2014 at 06:54:28AM +0000, fugang.duan at freescale.com wrote:
> From: Russell King <rmk@arm.linux.org.uk> Data: Friday, June 20, 2014 8:13 PM
> >To: linux-arm-kernel at lists.infradead.org
> >Cc: Duan Fugang-B38611; netdev at vger.kernel.org
> >Subject: [PATCH RFC 18/30] net: fec: remove inappropriate calls around
> >fec_restart()
> >
> >This is the second stage to "move calls to quiesce/resume packet
> >processing out of fec_restart()", where we remove calls which are not
> >appropriate to the call site.
> >
> >In the majority of cases, there is no need to detach and reattach the
> >interface as we are holding the queue xmit lock across the reset.  The
> >exception to that is in fec_resume(), where we are already detached by the
> >suspend function.  Here, we can remove the call to detach the interface.
> >
> >We also do not need to stop the transmit queue.  Holding the xmit lock is
> >enough to ensure that the transmit packet processing is not running while
> >we perform our task.  However, since fec_restart() always cleans the rings,
> >we call netif_wake_queue() (or netif_device_attach() in the case of resume)
> >just before dropping the xmit lock.  This prevents the watchdog firing.
> >
> >Lastly, always call napi_enable() after the device has been reattached in
> >the resume path so that we know that the transmit packet processing is
> >already in an enabled state, so we don't call netif_wake_queue() while
> >detached.
> >
> >Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> >---
> > drivers/net/ethernet/freescale/fec_main.c | 26 ++++++--------------------
> > 1 file changed, 6 insertions(+), 20 deletions(-)
> >
> >diff --git a/drivers/net/ethernet/freescale/fec_main.c
> >b/drivers/net/ethernet/freescale/fec_main.c
> >index 4a295b4bfb94..49c154af6da2 100644
> >--- a/drivers/net/ethernet/freescale/fec_main.c
> >+++ b/drivers/net/ethernet/freescale/fec_main.c
> >@@ -1058,15 +1058,12 @@ static void fec_enet_work(struct work_struct *work)
> > 		fep->delay_work.timeout = false;
> > 		rtnl_lock();
> > 		if (netif_device_present(ndev) || netif_running(ndev)) {
> >-			netif_device_detach(ndev);
> > 			napi_disable(&fep->napi);
> >-			netif_tx_disable(ndev);
> > 			netif_tx_lock_bh(ndev);
> > 			fec_restart(ndev, fep->full_duplex);
> >-			netif_tx_unlock_bh(ndev);
> > 			netif_wake_queue(ndev);
> >+			netif_tx_unlock_bh(ndev);
> > 			napi_enable(&fep->napi);
> >-			netif_device_attach(ndev);
> > 		}
> > 		rtnl_unlock();
> > 	}
> >@@ -1524,15 +1521,12 @@ static void fec_enet_adjust_link(struct net_device
> >*ndev)
> >
> > 		/* if any of the above changed restart the FEC */
> > 		if (status_change) {
> >-			netif_device_detach(ndev);
> > 			napi_disable(&fep->napi);
> >-			netif_tx_disable(ndev);
> > 			netif_tx_lock_bh(ndev);
> > 			fec_restart(ndev, phy_dev->duplex);
> >-			netif_tx_unlock_bh(ndev);
> > 			netif_wake_queue(ndev);
> >+			netif_tx_unlock_bh(ndev);
> > 			napi_enable(&fep->napi);
> >-			netif_device_attach(ndev);
> > 		}
> > 	} else {
> > 		if (fep->link) {
> >@@ -1919,15 +1913,12 @@ static int fec_enet_set_pauseparam(struct
> >net_device *ndev,
> > 		phy_start_aneg(fep->phy_dev);
> > 	}
> > 	if (netif_running(ndev)) {
> >-		netif_device_detach(ndev);
> > 		napi_disable(&fep->napi);
> >-		netif_tx_disable(ndev);
> > 		netif_tx_lock_bh(ndev);
> > 		fec_restart(ndev, fep->full_duplex);
> >-		netif_tx_unlock_bh(ndev);
> > 		netif_wake_queue(ndev);
> >+		netif_tx_unlock_bh(ndev);
> > 		napi_enable(&fep->napi);
> >-		netif_device_attach(ndev);
> > 	}
> >
> > 	return 0;
> >@@ -2372,15 +2363,12 @@ static int fec_set_features(struct net_device
> >*netdev,
> >
> > 		if (netif_running(netdev)) {
> > 			fec_stop(netdev);
> >-			netif_device_detach(netdev);
> > 			napi_disable(&fep->napi);
> >-			netif_tx_disable(netdev);
> > 			netif_tx_lock_bh(netdev);
> > 			fec_restart(netdev, fep->phy_dev->duplex);
> >-			netif_tx_unlock_bh(netdev);
> > 			netif_wake_queue(netdev);
> >+			netif_tx_unlock_bh(netdev);
> > 			napi_enable(&fep->napi);
> >-			netif_device_attach(netdev);
> > 		}
> > 	}
> >
> >@@ -2748,15 +2736,13 @@ fec_resume(struct device *dev)
> >
> > 	rtnl_lock();
> > 	if (netif_running(ndev)) {
> >-		netif_device_detach(ndev);
> > 		napi_disable(&fep->napi);
> >-		netif_tx_disable(ndev);
> > 		netif_tx_lock_bh(ndev);
> > 		fec_restart(ndev, fep->full_duplex);
> >+		netif_device_attach(ndev);
> > 		netif_tx_unlock_bh(ndev);
> >-		netif_wake_queue(ndev);
> >-		napi_enable(&fep->napi);
> > 		netif_device_attach(ndev);
> >+		napi_enable(&fep->napi);
> > 		phy_start(fep->phy_dev);
> > 	}
> > 	rtnl_unlock();
> >--
> Patch #17 anc #18 can merge to one patch.

While you can merge various patches together into a single patch, the
question is whether it's the right thing to do.

I kept 17 and 18 separate as 17 is merely moving the calls out without
modification, whereas 18 is changing the functionality.

That makes 17 easy to review - from the reviewer perspective, it's a case
of ensuring that the calls are all placed at the fec_restart() callsite.
Once that's done, then each callsite can be considered on its own merit
for the changes in patch 18.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

  reply	other threads:[~2014-06-22  7:55 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 12:11 [PATCH RFC 00/30] Initial round of Freescale FEC ethernet patches Russell King - ARM Linux
2014-06-20 12:11 ` [PATCH RFC 01/30] net: fec: Don't clear IPV6 header checksum field when IP accelerator enable Russell King
2014-06-20 12:11 ` [PATCH RFC 02/30] net: fec: iMX6 FEC does not support half-duplex gigabit Russell King
2014-06-20 12:11 ` [PATCH RFC 03/30] net: fec: fix ethtool set_pauseparam duplex bug Russell King
2014-06-20 12:12 ` [PATCH RFC 04/30] net: fec: fix interrupt handling races Russell King
2014-06-20 12:39   ` David Laight
2014-06-20 15:36     ` Russell King - ARM Linux
2014-06-20 16:00       ` David Laight
2014-06-22  6:38   ` fugang.duan at freescale.com
2014-06-20 12:12 ` [PATCH RFC 05/30] net: fec: use netif_tx_disable() rather than netif_stop_queue() Russell King
2014-06-20 12:12 ` [PATCH RFC 06/30] net: fec: remove checking for NULL phy_dev in fec_enet_close() Russell King
2014-06-20 12:12 ` [PATCH RFC 07/30] net: fec: ensure that a disconnected phy isn't configured Russell King
2014-06-20 12:12 ` [PATCH RFC 08/30] net: fec: stop the phy before shutting down the MAC Russell King
2014-06-20 12:12 ` [PATCH RFC 09/30] net: fec: remove useless fep->opened Russell King
2014-06-20 12:12 ` [PATCH RFC 10/30] net: fec: make rx skb handling more robust Russell King
2014-06-20 12:12 ` [PATCH RFC 11/30] net: fec: clean up transmit descriptor setup Russell King
2014-06-20 12:12 ` [PATCH RFC 12/30] net: fec: ensure fec_enet_free_buffers() properly cleans the rings Russell King
2014-06-20 12:12 ` [PATCH RFC 13/30] net: fec: fix missing kmalloc() failure check in fec_enet_alloc_buffers() Russell King
2014-06-20 12:12 ` [PATCH RFC 14/30] net: fec: improve safety of suspend/resume/transmit timeout paths Russell King
2014-06-20 12:12 ` [PATCH RFC 15/30] net: fec: ensure fec_enet_close() copes with resume failure Russell King
2014-06-20 12:13 ` [PATCH RFC 16/30] net: fec: only restart or stop the device if it is present and running Russell King
2014-06-20 12:13 ` [PATCH RFC 17/30] net: fec: move calls to quiesce/resume packet processing out of fec_restart() Russell King
2014-06-20 12:13 ` [PATCH RFC 18/30] net: fec: remove inappropriate calls around fec_restart() Russell King
2014-06-22  6:54   ` fugang.duan at freescale.com
2014-06-22  7:55     ` Russell King - ARM Linux [this message]
2014-06-22  8:07       ` fugang.duan at freescale.com
2014-06-20 12:13 ` [PATCH RFC 19/30] net: fec: quiesce packet processing before stopping device in fec_suspend() Russell King
2014-06-20 12:13 ` [PATCH RFC 20/30] net: fec: quiesce packet processing before stopping device in fec_set_features() Russell King
2014-06-20 12:13 ` [PATCH RFC 21/30] net: fec: quiesce packet processing before changing features Russell King
2014-06-20 12:13 ` [PATCH RFC 22/30] net: fec: quiesce packet processing when taking link down in fec_enet_adjust_link() Russell King
2014-06-20 12:13 ` [PATCH RFC 23/30] net: fec: clean up duplex mode handling Russell King
2014-06-20 12:13 ` [PATCH RFC 24/30] net: fec: better implementation of iMX6 ERR006358 quirk Russell King
2014-06-22  7:49   ` fugang.duan at freescale.com
2014-06-22  8:12     ` Russell King - ARM Linux
2014-06-22  8:24       ` Russell King - ARM Linux
2014-06-22  8:38       ` fugang.duan at freescale.com
2014-06-22  8:49         ` Russell King - ARM Linux
2014-06-24 10:29           ` Russell King - ARM Linux
2014-06-25  1:41             ` fugang.duan at freescale.com
2014-06-20 12:13 ` [PATCH RFC 25/30] net: fec: replace delayed work with standard work Russell King
2014-06-20 12:13 ` [PATCH RFC 26/30] net: fec: clear receive interrupts before processing a packet Russell King
2014-06-20 12:14 ` [PATCH RFC 27/30] net: fec: reorder ethtool ops to match order in struct declaration Russell King
2014-06-20 12:14 ` [PATCH RFC 28/30] net: fec: add support for dumping transmit ring on timeout Russell King
2014-06-20 12:14 ` [PATCH RFC 29/30] net: fec: remove useless status check in tx reap path Russell King
2014-06-20 12:14 ` [PATCH RFC 30/30] net: fec: consolidate hwtstamp implementation Russell King
2014-06-21  6:11   ` Richard Cochran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140622075514.GA32514@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).