]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dpaa2-eth: add channel stat to debugfs
authorIoana Ciornei <ioana.ciornei@nxp.com>
Fri, 24 Apr 2020 09:33:18 +0000 (12:33 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 26 Apr 2020 03:37:22 +0000 (20:37 -0700)
Compute the average number of frames processed for each CDAN (Channel
Data Availability Notification) and export it to debugfs detailed
channel stats.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c

index a9afe46b837ff9a929a6df05dc112938bcec3d7c..80291afff3eaa10d238cbf53563a5580961fc247 100644 (file)
@@ -127,16 +127,19 @@ static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset)
        int i;
 
        seq_printf(file, "Channel stats for %s:\n", priv->net_dev->name);
-       seq_printf(file, "%s%16s%16s%16s%16s\n",
-                  "CHID", "CPU", "Deq busy", "CDANs", "Buf count");
+       seq_printf(file, "%s%16s%16s%16s%16s%16s%16s\n",
+                  "CHID", "CPU", "Deq busy", "Frames", "CDANs",
+                  "Avg Frm/CDAN", "Buf count");
 
        for (i = 0; i < priv->num_channels; i++) {
                ch = priv->channel[i];
-               seq_printf(file, "%4d%16d%16llu%16llu%16d\n",
+               seq_printf(file, "%4d%16d%16llu%16llu%16llu%16llu%16d\n",
                           ch->ch_id,
                           ch->nctx.desired_cpu,
                           ch->stats.dequeue_portal_busy,
+                          ch->stats.frames,
                           ch->stats.cdan,
+                          ch->stats.frames / ch->stats.cdan,
                           ch->buf_count);
        }
 
index d271c016229dc4fa701e203866b0037c7d0f1b32..8ec435ba7d27389c318494d6d63f8b5e74dffdf6 100644 (file)
@@ -493,6 +493,7 @@ static int consume_frames(struct dpaa2_eth_channel *ch,
                return 0;
 
        fq->stats.frames += cleaned;
+       ch->stats.frames += cleaned;
 
        /* A dequeue operation only pulls frames from a single queue
         * into the store. Return the frame queue as an out param.
index 289053099974c1abaeab8ef4dfd34458e6c2424a..43cd8409f2e90ca706410ad05b450a7d49a82970 100644 (file)
@@ -288,6 +288,8 @@ struct dpaa2_eth_ch_stats {
        __u64 xdp_tx;
        __u64 xdp_tx_err;
        __u64 xdp_redirect;
+       /* Must be last, does not show up in ethtool stats */
+       __u64 frames;
 };
 
 /* Maximum number of queues associated with a DPNI */
index 94347c6952333e0b0bd7a69396a0901861565e3f..bd13ee48d6230aa8cac8a3db1f963fc696d5a07a 100644 (file)
@@ -277,7 +277,7 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev,
        /* Per-channel stats */
        for (k = 0; k < priv->num_channels; k++) {
                ch_stats = &priv->channel[k]->stats;
-               for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64); j++)
+               for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64) - 1; j++)
                        *((__u64 *)data + i + j) += *((__u64 *)ch_stats + j);
        }
        i += j;