]> git.sur5r.net Git - u-boot/commitdiff
driver: net: ldpaa: Add debug info of printing DPMAC stats
authorPrabhakar Kushwaha <prabhakar@freescale.com>
Thu, 24 Dec 2015 10:03:37 +0000 (15:33 +0530)
committerYork Sun <york.sun@nxp.com>
Wed, 27 Jan 2016 16:13:11 +0000 (08:13 -0800)
Add debug information prints to provide DPMAC statistics
 - Number of bytes received
 - Number of received and discard frames
 - Number of bytes transferred
 - Number of frames transferred
 etc.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: York Sun <york.sun@nxp.com>
drivers/net/ldpaa_eth/ldpaa_eth.c

index 5138e78e494486119dd3afd09f99934dbe5f9eb8..7f96883d347de6a1a44c0f4f07d666b515dc7164 100644 (file)
@@ -100,6 +100,83 @@ static void ldpaa_eth_get_dpni_counter(void)
        }
        printf("DPNI_CNT_EGR_FRAME_DISCARD =%lld\n", value);
 }
+
+static void ldpaa_eth_get_dpmac_counter(struct eth_device *net_dev)
+{
+       struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;
+       int err = 0;
+       u64 value;
+
+       err = dpmac_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+                    priv->dpmac_handle,
+                    DPMAC_CNT_ING_BYTE,
+                    &value);
+       if (err < 0) {
+               printf("dpmac_get_counter: DPMAC_CNT_ING_BYTE failed\n");
+               return;
+       }
+       printf("DPMAC_CNT_ING_BYTE=%lld\n", value);
+
+       err = dpmac_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+                    priv->dpmac_handle,
+                    DPMAC_CNT_ING_FRAME_DISCARD,
+                    &value);
+       if (err < 0) {
+               printf("dpmac_get_counter: DPMAC_CNT_ING_FRAME_DISCARD failed\n");
+               return;
+       }
+       printf("DPMAC_CNT_ING_FRAME_DISCARD=%lld\n", value);
+
+       err = dpmac_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+                    priv->dpmac_handle,
+                    DPMAC_CNT_ING_ALIGN_ERR,
+                    &value);
+       if (err < 0) {
+               printf("dpmac_get_counter: DPMAC_CNT_ING_ALIGN_ERR failed\n");
+               return;
+       }
+       printf("DPMAC_CNT_ING_ALIGN_ERR =%lld\n", value);
+
+       err = dpmac_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+                    priv->dpmac_handle,
+                    DPMAC_CNT_ING_BYTE,
+                    &value);
+       if (err < 0) {
+               printf("dpmac_get_counter: DPMAC_CNT_ING_BYTE failed\n");
+               return;
+       }
+       printf("DPMAC_CNT_ING_BYTE=%lld\n", value);
+
+       err = dpmac_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+                    priv->dpmac_handle,
+                    DPMAC_CNT_ING_ERR_FRAME,
+                    &value);
+       if (err < 0) {
+               printf("dpmac_get_counter: DPMAC_CNT_ING_ERR_FRAME failed\n");
+               return;
+       }
+       printf("DPMAC_CNT_ING_ERR_FRAME=%lld\n", value);
+
+       err = dpmac_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+                    priv->dpmac_handle,
+                    DPMAC_CNT_EGR_BYTE ,
+                    &value);
+       if (err < 0) {
+               printf("dpmac_get_counter: DPMAC_CNT_EGR_BYTE failed\n");
+               return;
+       }
+       printf("DPMAC_CNT_EGR_BYTE =%lld\n", value);
+
+       err = dpmac_get_counter(dflt_mc_io, MC_CMD_NO_FLAGS,
+                    priv->dpmac_handle,
+                    DPMAC_CNT_EGR_ERR_FRAME ,
+                    &value);
+       if (err < 0) {
+               printf("dpmac_get_counter: DPMAC_CNT_EGR_ERR_FRAME failed\n");
+               return;
+       }
+       printf("DPMAC_CNT_EGR_ERR_FRAME =%lld\n", value);
+}
 #endif
 
 static void ldpaa_eth_rx(struct ldpaa_eth_priv *priv,
@@ -436,6 +513,7 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
 
 #ifdef DEBUG
        ldpaa_eth_get_dpni_counter();
+       ldpaa_eth_get_dpmac_counter(net_dev);
 #endif
 
        err = dprc_disconnect(dflt_mc_io, MC_CMD_NO_FLAGS,