All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prabhakar Kushwaha <prabhakar@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information
Date: Wed, 4 Nov 2015 12:26:01 +0530	[thread overview]
Message-ID: <1446620162-21725-11-git-send-email-prabhakar@freescale.com> (raw)
In-Reply-To: <1446620162-21725-1-git-send-email-prabhakar@freescale.com>

Add following debug information in the driver
 - Get various DPNI counter values
 - Get link status of DPNI objects
 - Get information of both ends of connection (DPMAC - DPNI)

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
 Changes for v2: Use child container for DPMAC-DPNI connection
 Changes for v3: Sending as it is
 Changes for v4: Sending as it is


 drivers/net/ldpaa_eth/ldpaa_eth.c | 123 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)

diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 3d4c0f5..5ddc9fe 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -24,6 +24,84 @@ static int init_phy(struct eth_device *dev)
 	return 0;
 }
 
+#ifdef DEBUG
+static void ldpaa_eth_get_dpni_counter(void)
+{
+	int err = 0;
+	u64 value;
+
+	err = dpni_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+		     dflt_dpni->dpni_handle,
+		     DPNI_CNT_ING_FRAME,
+		     &value);
+	if (err < 0) {
+		printf("dpni_get_counter: DPNI_CNT_ING_FRAME failed\n");
+		return;
+	}
+	printf("DPNI_CNT_ING_FRAME=%lld\n", value);
+
+	err = dpni_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+		     dflt_dpni->dpni_handle,
+		     DPNI_CNT_ING_BYTE,
+		     &value);
+	if (err < 0) {
+		printf("dpni_get_counter: DPNI_CNT_ING_BYTE failed\n");
+		return;
+	}
+	printf("DPNI_CNT_ING_BYTE=%lld\n", value);
+
+	err = dpni_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+		     dflt_dpni->dpni_handle,
+		     DPNI_CNT_ING_FRAME_DROP ,
+		     &value);
+	if (err < 0) {
+		printf("dpni_get_counter: DPNI_CNT_ING_FRAME_DROP failed\n");
+		return;
+	}
+	printf("DPNI_CNT_ING_FRAME_DROP =%lld\n", value);
+
+	err = dpni_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+		     dflt_dpni->dpni_handle,
+		     DPNI_CNT_ING_FRAME_DISCARD,
+		     &value);
+	if (err < 0) {
+		printf("dpni_get_counter: DPNI_CNT_ING_FRAME_DISCARD failed\n");
+		return;
+	}
+	printf("DPNI_CNT_ING_FRAME_DISCARD=%lld\n", value);
+
+	err = dpni_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+		     dflt_dpni->dpni_handle,
+		     DPNI_CNT_EGR_FRAME,
+		     &value);
+	if (err < 0) {
+		printf("dpni_get_counter: DPNI_CNT_EGR_FRAME failed\n");
+		return;
+	}
+	printf("DPNI_CNT_EGR_FRAME=%lld\n", value);
+
+	err = dpni_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+		     dflt_dpni->dpni_handle,
+		     DPNI_CNT_EGR_BYTE ,
+		     &value);
+	if (err < 0) {
+		printf("dpni_get_counter: DPNI_CNT_EGR_BYTE failed\n");
+		return;
+	}
+	printf("DPNI_CNT_EGR_BYTE =%lld\n", value);
+
+	err = dpni_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+		     dflt_dpni->dpni_handle,
+		     DPNI_CNT_EGR_FRAME_DISCARD ,
+		     &value);
+	if (err < 0) {
+		printf("dpni_get_counter: DPNI_CNT_EGR_FRAME_DISCARD failed\n");
+		return;
+	}
+	printf("DPNI_CNT_EGR_FRAME_DISCARD =%lld\n", value);
+}
+#endif
+
 static void ldpaa_eth_rx(struct ldpaa_eth_priv *priv,
 			 const struct dpaa_fd *fd)
 {
@@ -222,6 +300,9 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
 	struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;
 	struct dpni_queue_attr rx_queue_attr;
 	struct dpmac_link_state	dpmac_link_state = { 0 };
+#ifdef DEBUG
+	struct dpni_link_state link_state;
+#endif
 	int err;
 
 	if (net_dev->state == ETH_STATE_ACTIVE)
@@ -295,6 +376,20 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
 		printf("dpmac_set_link_state() failed\n");
 		return err;
 	}
+
+#ifdef DEBUG
+	err = dpni_get_link_state(dflt_mc_io, MC_CMD_NO_FLAGS,
+				  dflt_dpni->dpni_handle, &link_state);
+	if (err < 0) {
+		printf("dpni_get_link_state() failed\n");
+		return err;
+	}
+
+	printf("link status: %d - ", link_state.up);
+	link_state.up == 0 ? printf("down\n") :
+	link_state.up == 1 ? printf("up\n") : printf("error state\n");
+#endif
+
 	/* TODO: support multiple Rx flows */
 	err = dpni_get_rx_flow(dflt_mc_io, MC_CMD_NO_FLAGS,
 			       dflt_dpni->dpni_handle, 0, 0, &rx_queue_attr);
@@ -339,6 +434,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
 	    (net_dev->state == ETH_STATE_INIT))
 		return;
 
+#ifdef DEBUG
+	ldpaa_eth_get_dpni_counter();
+#endif
+
 	err = dprc_disconnect(dflt_mc_io, MC_CMD_NO_FLAGS,
 			      dflt_dprc_handle, &dpmac_endpoint);
 	if (err < 0)
@@ -523,6 +622,11 @@ static int ldpaa_dpmac_bind(struct ldpaa_eth_priv *priv)
 		.max_rate = 0
 	};
 
+#ifdef DEBUG
+	struct dprc_endpoint dbg_endpoint;
+	int state = 0;
+#endif
+
 	memset(&dpmac_endpoint, 0, sizeof(struct dprc_endpoint));
 	sprintf(dpmac_endpoint.type, "dpmac");
 	dpmac_endpoint.id = priv->dpmac_id;
@@ -536,6 +640,25 @@ static int ldpaa_dpmac_bind(struct ldpaa_eth_priv *priv)
 			     &dpmac_endpoint,
 			     &dpni_endpoint,
 			     &dprc_connection_cfg);
+	if (err)
+		printf("dprc_connect() failed\n");
+
+#ifdef DEBUG
+	err = dprc_get_connection(dflt_mc_io, MC_CMD_NO_FLAGS,
+				    dflt_dprc_handle, &dpni_endpoint,
+				    &dbg_endpoint, &state);
+	printf("%s, DPMAC Type= %s\n", __func__, dbg_endpoint.type);
+	printf("%s, DPMAC ID= %d\n", __func__, dbg_endpoint.id);
+	printf("%s, DPMAC State= %d\n", __func__, state);
+
+	memset(&dbg_endpoint, 0, sizeof(struct dprc_endpoint));
+	err = dprc_get_connection(dflt_mc_io, MC_CMD_NO_FLAGS,
+				    dflt_dprc_handle, &dpmac_endpoint,
+				    &dbg_endpoint, &state);
+	printf("%s, DPNI Type= %s\n", __func__, dbg_endpoint.type);
+	printf("%s, DPNI ID= %d\n", __func__, dbg_endpoint.id);
+	printf("%s, DPNI State= %d\n", __func__, state);
+#endif
 	return err;
 }
 
-- 
1.9.1

  parent reply	other threads:[~2015-11-04  6:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
2015-11-04  6:55 ` [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic Prabhakar Kushwaha
2015-11-30 17:01   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 02/10][v4] driver: net: fsl-mc: Add create, destroy APIs in flibs Prabhakar Kushwaha
2015-11-30 17:02   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 03/10][v4] driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB Prabhakar Kushwaha
2015-11-30 17:02   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error Prabhakar Kushwaha
2015-11-30 17:02   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 05/10][v4] driver: ldpaa: Add api to return linked PHY ID of DPMAC Prabhakar Kushwaha
2015-11-30 17:03   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout Prabhakar Kushwaha
2015-11-30 17:06   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC Prabhakar Kushwaha
2015-11-26  4:50   ` York Sun
2015-11-30 17:07   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time Prabhakar Kushwaha
2015-11-30 17:07   ` York Sun
2015-11-04  6:56 ` [U-Boot] [PATCH 09/10][v4] driver: net: ldpaa: Use DPMAC as net device Prabhakar Kushwaha
2015-11-30 17:08   ` York Sun
2015-11-04  6:56 ` Prabhakar Kushwaha [this message]
2015-11-30 17:08   ` [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information York Sun
2015-11-04  6:56 ` [U-Boot] [PATCH][v2] driver: net: ldpaa: Fix Rx buffer alignment Prabhakar Kushwaha
2015-11-30 17:09   ` York Sun

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=1446620162-21725-11-git-send-email-prabhakar@freescale.com \
    --to=prabhakar@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.