netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ameen.rahman@qlogic.com,
	Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Subject: [PATCH NEXT 9/9] qlcnic: add idc debug registers
Date: Thu, 13 May 2010 06:07:50 -0700	[thread overview]
Message-ID: <1273756070-7205-10-git-send-email-amit.salecha@qlogic.com> (raw)
In-Reply-To: <1273756070-7205-1-git-send-email-amit.salecha@qlogic.com>

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

When ever driver changes the device state, it should write
pci-func number and timestamp in debug registers.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h      |    2 ++
 drivers/net/qlcnic/qlcnic_main.c |   21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 5c89f4e..2ed34cd 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -960,6 +960,8 @@ struct qlcnic_adapter {
 
 	u8 mac_addr[ETH_ALEN];
 
+	u64 dev_rst_time;
+
 	struct qlcnic_adapter_stats stats;
 
 	struct qlcnic_recv_context recv_ctx;
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index ce8118c..4bf3d62 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -84,6 +84,7 @@ static void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter);
 static void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter);
 static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter);
 
+static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding);
 static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter);
 static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter);
 
@@ -621,6 +622,7 @@ wait_init:
 		goto err_out;
 
 	QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY);
+	qlcnic_idc_debug_info(adapter, 1);
 
 	qlcnic_check_options(adapter);
 
@@ -1057,6 +1059,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	adapter = netdev_priv(netdev);
 	adapter->netdev  = netdev;
 	adapter->pdev    = pdev;
+	adapter->dev_rst_time = jiffies;
 	adapter->ahw.pci_func  = pci_func_id;
 
 	revision_id = pdev->revision;
@@ -1888,6 +1891,19 @@ static void qlcnic_poll_controller(struct net_device *netdev)
 }
 #endif
 
+static void
+qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding)
+{
+	u32 val;
+
+	val = adapter->portnum & 0xf;
+	val |= encoding << 7;
+	val |= (jiffies - adapter->dev_rst_time) << 8;
+
+	QLCWR32(adapter, QLCNIC_CRB_DRV_SCRATCH, val);
+	adapter->dev_rst_time = jiffies;
+}
+
 static int
 qlcnic_set_drv_state(struct qlcnic_adapter *adapter, u8 state)
 {
@@ -2011,6 +2027,7 @@ qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
 	case QLCNIC_DEV_COLD:
 		QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_INITIALIZING);
 		QLCWR32(adapter, QLCNIC_CRB_DRV_IDC_VER, QLCNIC_DRV_IDC_VER);
+		qlcnic_idc_debug_info(adapter, 0);
 		qlcnic_api_unlock(adapter);
 		return 1;
 
@@ -2103,6 +2120,8 @@ skip_ack_check:
 			qlcnic_schedule_work(adapter, qlcnic_fwinit_work,
 						FW_POLL_DELAY * 2);
 			QLCDB(adapter, DRV, "Quiscing the driver\n");
+			qlcnic_idc_debug_info(adapter, 0);
+
 			qlcnic_api_unlock(adapter);
 			return;
 		}
@@ -2112,6 +2131,7 @@ skip_ack_check:
 						QLCNIC_DEV_INITIALIZING);
 			set_bit(__QLCNIC_START_FW, &adapter->state);
 			QLCDB(adapter, DRV, "Restarting fw\n");
+			qlcnic_idc_debug_info(adapter, 0);
 		}
 
 		qlcnic_api_unlock(adapter);
@@ -2207,6 +2227,7 @@ qlcnic_dev_request_reset(struct qlcnic_adapter *adapter)
 	if (state == QLCNIC_DEV_READY) {
 		QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_NEED_RESET);
 		QLCDB(adapter, DRV, "NEED_RESET state set\n");
+		qlcnic_idc_debug_info(adapter, 0);
 	}
 
 	qlcnic_api_unlock(adapter);
-- 
1.6.0.2


  parent reply	other threads:[~2010-05-13 13:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 13:07 [PATCH 0/9]qlcnic: cleanup Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 1/9] qlcnic: fix context cleanup Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 2/9] qlcnic: remove obsolete register Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 3/9] qlcnic: fix caching window register Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 4/9] qlcnic: cleanup dma mask setting Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 5/9] qlcnic: cleanup unused code Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 6/9] qlcnic: check IDC version Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 7/9] qlcnic: check device class Amit Kumar Salecha
2010-05-13 13:07 ` [PATCH NEXT 8/9] qlcnic: support quisce mode Amit Kumar Salecha
2010-05-13 13:07 ` Amit Kumar Salecha [this message]
2010-05-14 10:15 ` [PATCH 0/9]qlcnic: cleanup 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=1273756070-7205-10-git-send-email-amit.salecha@qlogic.com \
    --to=amit.salecha@qlogic.com \
    --cc=ameen.rahman@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sucheta.chakraborty@qlogic.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).