From: "Yuval Mintz" <yuvalmin@broadcom.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: eilong@broadcom.com, "Dmitry Kravkov" <dmitry@broadcom.com>,
"Yuval Mintz" <yuvalmin@broadcom.com>
Subject: [net-next 9/9] bnx2x: validate FW trace prior to its printing
Date: Sun, 18 Mar 2012 16:33:45 -0400 [thread overview]
Message-ID: <1332102825-7838-10-git-send-email-yuvalmin@broadcom.com> (raw)
In-Reply-To: <1332102825-7838-1-git-send-email-yuvalmin@broadcom.com>
From: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | 2 ++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 12 +++++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
index 0c5f121..5d71b7d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
@@ -1129,6 +1129,8 @@ struct shm_dev_info { /* size */
#define FW_ACK_NUM_OF_POLL (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS)
+#define MFW_TRACE_SIGNATURE 0x54524342
+
/****************************************************************************
* Driver <-> FW Mailbox *
****************************************************************************/
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index a3d5246..6879d01 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -719,7 +719,17 @@ void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl)
trace_shmem_base = bp->common.shmem_base;
else
trace_shmem_base = SHMEM2_RD(bp, other_shmem_base_addr);
- addr = trace_shmem_base - 0x0800 + 4;
+ addr = trace_shmem_base - 0x800;
+
+ /* validate TRCB signature */
+ mark = REG_RD(bp, addr);
+ if (mark != MFW_TRACE_SIGNATURE) {
+ BNX2X_ERR("Trace buffer signature is missing.");
+ return ;
+ }
+
+ /* read cyclic buffer pointer */
+ addr += 4;
mark = REG_RD(bp, addr);
mark = (CHIP_IS_E1x(bp) ? MCP_REG_MCPR_SCRATCH : MCP_A_REG_MCPR_SCRATCH)
+ ((mark + 0x3) & ~0x3) - 0x08000000;
--
1.7.9.rc2
next prev parent reply other threads:[~2012-03-18 13:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-18 20:33 [net-next 0/9] bnx2x: feature patch series Yuval Mintz
2012-03-18 20:33 ` [net-next 1/9] bnx2x: added 'likely' to fast-path skb existence Yuval Mintz
2012-03-18 20:33 ` [net-next 2/9] bnx2x: revised driver prints Yuval Mintz
2012-03-18 20:33 ` [net-next 3/9] bnx2x: reduced sparse warnings Yuval Mintz
2012-03-18 20:33 ` [net-next 4/9] bnx2x: removed dcb unused code Yuval Mintz
2012-03-18 20:33 ` [net-next 5/9] bnx2x: changed initial dcb configuration Yuval Mintz
2012-03-18 20:33 ` [net-next 6/9] bnx2x: added TLV_NOT_FOUND flags to the dcb Yuval Mintz
2012-03-18 20:33 ` [net-next 7/9] bnx2x: changed iscsi/fcoe mac init and macros Yuval Mintz
2012-03-18 20:33 ` [net-next 8/9] bnx2x: consistent statistics for old FW Yuval Mintz
2012-03-18 20:52 ` Yuval Mintz
2012-03-18 20:33 ` Yuval Mintz [this message]
2012-03-19 20:57 ` [net-next 0/9] bnx2x: feature patch series 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=1332102825-7838-10-git-send-email-yuvalmin@broadcom.com \
--to=yuvalmin@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;
as well as URLs for NNTP newsgroup(s).