netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: netdev@vger.kernel.org
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Eilon Greenstein <eilong@broadcom.com>,
	Vladislav Zolotarov <vladz@broadcom.com>,
	Dmitry Kravkov <dmitry@broadcom.com>,
	Michael Chan <mchan@broadcom.com>,
	Breno Leitao <leitao@linux.vnet.ibm.com>,
	Matt Carlson <mcarlson@broadcom.com>
Subject: [RFC PATCH] tg3: use netif_carrier_off to prevent tx timeout
Date: Wed, 12 May 2010 13:16:57 +0200	[thread overview]
Message-ID: <20100512131657.76582f10@dhcp-lab-109.englab.brq.redhat.com> (raw)
In-Reply-To: <20100512130628.69bc3890@dhcp-lab-109.englab.brq.redhat.com>

Touching ->trans_start make netdev watchdog timeouts only less probable.
Use netif_carrier_off to prevent timeout, lately we take care of turning
carrier on.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
Patch was not tested!

 drivers/net/tg3.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 573054a..d745038 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -753,7 +753,7 @@ static void tg3_napi_enable(struct tg3 *tp)
 
 static inline void tg3_netif_stop(struct tg3 *tp)
 {
-	tp->dev->trans_start = jiffies;	/* prevent tx timeout */
+	netif_carrier_off(tp->dev);	/* prevent tx timeout */
 	tg3_napi_disable(tp);
 	netif_tx_disable(tp->dev);
 }
@@ -10964,12 +10964,14 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 {
 	struct tg3 *tp = netdev_priv(dev);
+	int link_up;
 
 	if (!netif_running(dev)) {
 		tp->vlgrp = grp;
 		return;
 	}
 
+	link_up = netif_carrier_ok(dev);
 	tg3_netif_stop(tp);
 
 	tg3_full_lock(tp, 0);
@@ -10979,6 +10981,8 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 	/* Update RX_MODE_KEEP_VLAN_TAG bit in RX_MODE register. */
 	__tg3_set_rx_mode(dev);
 
+	if (link_up)
+		netif_carrier_on(dev);
 	tg3_netif_start(tp);
 
 	tg3_full_unlock(tp);
-- 
1.5.5.6


  reply	other threads:[~2010-05-12 11:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12  9:09 [PATCH net-next] bnx2x: avoid TX timeout when stopping device Stanislaw Gruszka
2010-05-12  9:27 ` Eric Dumazet
2010-05-12 10:58   ` Stanislaw Gruszka
2010-05-12 11:06     ` [RFC PATCH] bnx2: use netif_carrier_off to prevent tx timeout Stanislaw Gruszka
2010-05-12 11:16       ` Stanislaw Gruszka [this message]
2010-05-12 13:31       ` Michael Chan
2010-05-12 14:00         ` Stanislaw Gruszka
2010-05-12 14:09           ` Michael Chan
2010-05-12 11:19     ` [PATCH net-next] bnx2x: avoid TX timeout when stopping device Eilon Greenstein
2010-05-12 12:37       ` Eric Dumazet

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=20100512131657.76582f10@dhcp-lab-109.englab.brq.redhat.com \
    --to=sgruszka@redhat.com \
    --cc=dmitry@broadcom.com \
    --cc=eilong@broadcom.com \
    --cc=eric.dumazet@gmail.com \
    --cc=leitao@linux.vnet.ibm.com \
    --cc=mcarlson@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=vladz@broadcom.com \
    /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).