Patchwork [net-next] be2net: remove BUG_ON() in be_mcc_compl_is_new()

login
register
mail settings
Submitter Sathya Perla
Date Feb. 13, 2013, 9:05 a.m.
Message ID <df52a8ca-fbd1-41aa-ad6f-995fd724a4d4@CMEXHTCAS1.ad.emulex.com>
Download mbox | patch
Permalink /patch/220090/
State Accepted
Delegated to: David Miller
Headers show

Comments

Sathya Perla - Feb. 13, 2013, 9:05 a.m.
The current code expects that the last word (with valid bit)
of an MCC compl is DMAed in one shot. This may not be the case.
Remove this assertion.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_cmds.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
David Miller - Feb. 13, 2013, 6:53 p.m.
From: Sathya Perla <sathya.perla@emulex.com>
Date: Wed, 13 Feb 2013 14:35:19 +0530

> The current code expects that the last word (with valid bit)
> of an MCC compl is DMAed in one shot. This may not be the case.
> Remove this assertion.
> 
> Signed-off-by: Sathya Perla <sathya.perla@emulex.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 8b04880..071aea7 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -93,13 +93,16 @@  static void be_mcc_notify(struct be_adapter *adapter)
  * little endian) */
 static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
 {
+	u32 flags;
+
 	if (compl->flags != 0) {
-		compl->flags = le32_to_cpu(compl->flags);
-		BUG_ON((compl->flags & CQE_FLAGS_VALID_MASK) == 0);
-		return true;
-	} else {
-		return false;
+		flags = le32_to_cpu(compl->flags);
+		if (flags & CQE_FLAGS_VALID_MASK) {
+			compl->flags = flags;
+			return true;
+		}
 	}
+	return false;
 }
 
 /* Need to reset the entire word that houses the valid bit */