1 From 5a43b0405561fb6feffb7042493b58014ac27a4d Mon Sep 17 00:00:00 2001
2 From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
3 Date: Tue, 12 Feb 2019 22:05:16 +0200
4 Subject: [PATCH] dpaa2-eth: Add channel stat
6 Compute average number of frames processed for each CDAN
7 received on a channel and print it in the detailed channel
10 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
12 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c | 8 +++++---
13 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 1 +
14 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 2 ++
15 drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +-
16 4 files changed, 9 insertions(+), 4 deletions(-)
18 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
19 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
20 @@ -132,16 +132,18 @@ static int dpaa2_dbg_ch_show(struct seq_
23 seq_printf(file, "Channel stats for %s:\n", priv->net_dev->name);
24 - seq_printf(file, "%s%16s%16s%16s%16s\n",
25 - "CHID", "CPU", "Deq busy", "CDANs", "Buf count");
26 + seq_printf(file, "%s%16s%16s%16s%16s%16s%16s\n",
27 + "CHID", "CPU", "Deq busy", "Frames", "CDANs", "Avg Frm/CDAN", "Buf count");
29 for (i = 0; i < priv->num_channels; i++) {
30 ch = priv->channel[i];
31 - seq_printf(file, "%4d%16d%16llu%16llu%16d\n",
32 + seq_printf(file, "%4d%16d%16llu%16llu%16llu%16llu%16d\n",
35 ch->stats.dequeue_portal_busy,
38 + ch->stats.frames / ch->stats.cdan,
42 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
43 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
44 @@ -540,6 +540,7 @@ static int consume_frames(struct dpaa2_e
47 fq->stats.frames += cleaned;
48 + ch->stats.frames += cleaned;
50 /* A dequeue operation only pulls frames from a single queue
51 * into the store. Return the frame queue as an out param.
52 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
53 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
54 @@ -310,6 +310,8 @@ struct dpaa2_eth_ch_stats {
58 + /* Must be last, does not show up in ethtool stats */
62 /* Maximum number of queues associated with a DPNI */
63 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
64 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
65 @@ -234,7 +234,7 @@ static void dpaa2_eth_get_ethtool_stats(
66 /* Per-channel stats */
67 for (k = 0; k < priv->num_channels; k++) {
68 ch_stats = &priv->channel[k]->stats;
69 - for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64); j++)
70 + for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64) - 1; j++)
71 *((__u64 *)data + i + j) += *((__u64 *)ch_stats + j);