From: Michal Schmidt <mschmidt@redhat.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Dmitry Kravkov <dmitry@broadcom.com>,
Ariel Elior <ariele@broadcom.com>,
Eilon Greenstein <eilong@broadcom.com>
Subject: [PATCH net] bnx2x: bail out if unable to acquire stats_sema
Date: Tue, 3 Sep 2013 17:45:59 +0200 [thread overview]
Message-ID: <1378223159-8710-1-git-send-email-mschmidt@redhat.com> (raw)
If we fail to acquire stats_sema in the specified time limit,
the chip is probably dead. It probably does not matter whether we
try to continue or not, but certainly we should not up() the semaphore
afterwards.
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 24 +++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index 86436c7..d60bb8b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -538,16 +538,20 @@ static void __bnx2x_stats_start(struct bnx2x *bp)
static void bnx2x_stats_start(struct bnx2x *bp)
{
- if (down_timeout(&bp->stats_sema, HZ/10))
+ if (down_timeout(&bp->stats_sema, HZ/10)) {
BNX2X_ERR("Unable to acquire stats lock\n");
+ return;
+ }
__bnx2x_stats_start(bp);
up(&bp->stats_sema);
}
static void bnx2x_stats_pmf_start(struct bnx2x *bp)
{
- if (down_timeout(&bp->stats_sema, HZ/10))
+ if (down_timeout(&bp->stats_sema, HZ/10)) {
BNX2X_ERR("Unable to acquire stats lock\n");
+ return;
+ }
bnx2x_stats_comp(bp);
__bnx2x_stats_pmf_update(bp);
__bnx2x_stats_start(bp);
@@ -556,8 +560,10 @@ static void bnx2x_stats_pmf_start(struct bnx2x *bp)
static void bnx2x_stats_pmf_update(struct bnx2x *bp)
{
- if (down_timeout(&bp->stats_sema, HZ/10))
+ if (down_timeout(&bp->stats_sema, HZ/10)) {
BNX2X_ERR("Unable to acquire stats lock\n");
+ return;
+ }
__bnx2x_stats_pmf_update(bp);
up(&bp->stats_sema);
}
@@ -569,8 +575,10 @@ static void bnx2x_stats_restart(struct bnx2x *bp)
*/
if (IS_VF(bp))
return;
- if (down_timeout(&bp->stats_sema, HZ/10))
+ if (down_timeout(&bp->stats_sema, HZ/10)) {
BNX2X_ERR("Unable to acquire stats lock\n");
+ return;
+ }
bnx2x_stats_comp(bp);
__bnx2x_stats_start(bp);
up(&bp->stats_sema);
@@ -1361,8 +1369,10 @@ static void bnx2x_stats_stop(struct bnx2x *bp)
{
int update = 0;
- if (down_timeout(&bp->stats_sema, HZ/10))
+ if (down_timeout(&bp->stats_sema, HZ/10)) {
BNX2X_ERR("Unable to acquire stats lock\n");
+ return;
+ }
bp->stats_started = false;
@@ -1997,8 +2007,10 @@ void bnx2x_afex_collect_stats(struct bnx2x *bp, void *void_afex_stats,
void bnx2x_stats_safe_exec(struct bnx2x *bp,
void (func_to_exec)(void *cookie),
void *cookie){
- if (down_timeout(&bp->stats_sema, HZ/10))
+ if (down_timeout(&bp->stats_sema, HZ/10)) {
BNX2X_ERR("Unable to acquire stats lock\n");
+ return;
+ }
bnx2x_stats_comp(bp);
func_to_exec(cookie);
__bnx2x_stats_start(bp);
--
1.8.3.1
next reply other threads:[~2013-09-03 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 15:45 Michal Schmidt [this message]
2013-09-03 15:51 ` [PATCH net] bnx2x: bail out if unable to acquire stats_sema Dmitry Kravkov
2013-09-04 17:17 ` Neal Cardwell
2013-09-06 6:40 ` Dmitry Kravkov
2013-09-07 3:53 ` Neal Cardwell
2013-09-07 9:34 ` Dmitry Kravkov
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=1378223159-8710-1-git-send-email-mschmidt@redhat.com \
--to=mschmidt@redhat.com \
--cc=ariele@broadcom.com \
--cc=davem@davemloft.net \
--cc=dmitry@broadcom.com \
--cc=eilong@broadcom.com \
--cc=netdev@vger.kernel.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