From: Jon Mason <jon.mason@exar.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
Sivakumar Subramani <sivakumar.subramani@exar.com>,
Sreenivasa Honnur <sreenivasa.honnur@exar.com>,
Ram Vepa <ram.vepa@exar.com>
Subject: [PATCH 4/7] vxge: transmit timeout deadlock
Date: Fri, 10 Dec 2010 18:02:59 -0600 [thread overview]
Message-ID: <1292025782-16372-4-git-send-email-jon.mason@exar.com> (raw)
In-Reply-To: <1292025782-16372-1-git-send-email-jon.mason@exar.com>
Use a workqueue to handle the device reset during a transmit timeout, as
there can be a deadlock during bringup. Also, set the netif carrier off
before the watchdog reset is started to prevent the timeout from
reoccurring while still processing the first.
Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: Ram Vepa <ram.vepa@exar.com>
---
drivers/net/vxge/vxge-main.c | 19 ++++++++++++++-----
drivers/net/vxge/vxge-main.h | 1 +
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index faebffb..3ec8068 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -1606,12 +1606,16 @@ static int do_vxge_reset(struct vxgedev *vdev, int event)
}
if (event == VXGE_LL_FULL_RESET) {
+ netif_carrier_off(vdev->ndev);
+
/* wait for all the vpath reset to complete */
for (vp_id = 0; vp_id < vdev->no_of_vpath; vp_id++) {
while (test_bit(vp_id, &vdev->vp_reset))
msleep(50);
}
+ netif_carrier_on(vdev->ndev);
+
/* if execution mode is set to debug, don't reset the adapter */
if (unlikely(vdev->exec_mode)) {
vxge_debug_init(VXGE_ERR,
@@ -1765,9 +1769,14 @@ out:
*
* driver may reset the chip on events of serr, eccerr, etc
*/
-static int vxge_reset(struct vxgedev *vdev)
+static void vxge_reset(struct work_struct *work)
{
- return do_vxge_reset(vdev, VXGE_LL_FULL_RESET);
+ struct vxgedev *vdev = container_of(work, struct vxgedev, reset_task);
+
+ if (!netif_running(vdev->ndev))
+ return;
+
+ do_vxge_reset(vdev, VXGE_LL_FULL_RESET);
}
/**
@@ -3111,8 +3120,7 @@ static int vxge_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
* This function is triggered if the Tx Queue is stopped
* for a pre-defined amount of time when the Interface is still up.
*/
-static void
-vxge_tx_watchdog(struct net_device *dev)
+static void vxge_tx_watchdog(struct net_device *dev)
{
struct vxgedev *vdev;
@@ -3122,7 +3130,7 @@ vxge_tx_watchdog(struct net_device *dev)
vdev->cric_err_event = VXGE_HW_EVENT_RESET_START;
- vxge_reset(vdev);
+ schedule_work(&vdev->reset_task);
vxge_debug_entryexit(VXGE_TRACE,
"%s:%d Exiting...", __func__, __LINE__);
}
@@ -3324,6 +3332,7 @@ static int __devinit vxge_device_register(struct __vxge_hw_device *hldev,
ndev->netdev_ops = &vxge_netdev_ops;
ndev->watchdog_timeo = VXGE_LL_WATCH_DOG_TIMEOUT;
+ INIT_WORK(&vdev->reset_task, vxge_reset);
vxge_initialize_ethtool_ops(ndev);
diff --git a/drivers/net/vxge/vxge-main.h b/drivers/net/vxge/vxge-main.h
index 256d5b4..5746fed 100644
--- a/drivers/net/vxge/vxge-main.h
+++ b/drivers/net/vxge/vxge-main.h
@@ -395,6 +395,7 @@ struct vxgedev {
u32 level_err;
u32 level_trace;
char fw_version[VXGE_HW_FW_STRLEN];
+ struct work_struct reset_task;
};
struct vxge_rx_priv {
--
1.7.0.4
next prev parent reply other threads:[~2010-12-11 0:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-11 0:02 [PATCH 1/7] vxge: code cleanup and reorganization Jon Mason
2010-12-11 0:02 ` [PATCH 2/7] vxge: fix crash of VF when unloading PF Jon Mason
2010-12-11 0:08 ` David Miller
2010-12-11 1:04 ` Chris Wright
2010-12-11 1:35 ` Ramkrishna Vepa
2010-12-11 0:02 ` [PATCH 3/7] vxge: use pci_request_region() Jon Mason
2010-12-11 0:09 ` David Miller
2010-12-11 0:02 ` Jon Mason [this message]
2010-12-11 0:09 ` [PATCH 4/7] vxge: transmit timeout deadlock David Miller
2010-12-11 0:03 ` [PATCH 5/7] vxge: hotplug stall Jon Mason
2010-12-11 0:09 ` David Miller
2010-12-11 0:03 ` [PATCH 6/7] vxge: independent interrupt moderation Jon Mason
2010-12-11 0:09 ` David Miller
2010-12-11 0:03 ` [PATCH 7/7] vxge: update driver version Jon Mason
2010-12-11 0:09 ` David Miller
2010-12-11 0:08 ` [PATCH 1/7] vxge: code cleanup and reorganization David Miller
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=1292025782-16372-4-git-send-email-jon.mason@exar.com \
--to=jon.mason@exar.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ram.vepa@exar.com \
--cc=sivakumar.subramani@exar.com \
--cc=sreenivasa.honnur@exar.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).