Commit d84c3a4d authored by Ioana Radulescu's avatar Ioana Radulescu Committed by David S. Miller

dpaa2-eth: Add new DPNI statistics counters

Recent firmware versions expose more  DPNI counters.
Export relevant ones via ethtool -S.
Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae90a6f0
......@@ -28,6 +28,11 @@ static char dpaa2_ethtool_stats[][ETH_GSTRING_LEN] = {
"[hw] rx nobuffer discards",
"[hw] tx discarded frames",
"[hw] tx confirmed frames",
"[hw] tx dequeued bytes",
"[hw] tx dequeued frames",
"[hw] tx rejected bytes",
"[hw] tx rejected frames",
"[hw] tx pending frames",
};
#define DPAA2_ETH_NUM_STATS ARRAY_SIZE(dpaa2_ethtool_stats)
......@@ -192,16 +197,26 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev,
sizeof(dpni_stats.page_0),
sizeof(dpni_stats.page_1),
sizeof(dpni_stats.page_2),
sizeof(dpni_stats.page_3),
sizeof(dpni_stats.page_4),
sizeof(dpni_stats.page_5),
sizeof(dpni_stats.page_6),
};
memset(data, 0,
sizeof(u64) * (DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS));
/* Print standard counters, from DPNI statistics */
for (j = 0; j <= 2; j++) {
for (j = 0; j <= 6; j++) {
/* We're not interested in pages 4 & 5 for now */
if (j == 4 || j == 5)
continue;
err = dpni_get_statistics(priv->mc_io, 0, priv->mc_token,
j, &dpni_stats);
if (err != 0)
if (err == -EINVAL)
/* Older firmware versions don't support all pages */
memset(&dpni_stats, 0, sizeof(dpni_stats));
else
netdev_warn(net_dev, "dpni_get_stats(%d) failed\n", j);
num_cnt = dpni_stats_page_size[j] / sizeof(u64);
......
......@@ -1470,7 +1470,7 @@ int dpni_get_queue(struct fsl_mc_io *mc_io,
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
* @token: Token of DPNI object
* @page: Selects the statistics page to retrieve, see
* DPNI_GET_STATISTICS output. Pages are numbered 0 to 2.
* DPNI_GET_STATISTICS output. Pages are numbered 0 to 6.
* @stat: Structure containing the statistics
*
* Return: '0' on Success; Error code otherwise.
......
......@@ -416,6 +416,26 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
* lack of buffers
* @page_2.egress_discarded_frames: Egress discarded frame count
* @page_2.egress_confirmed_frames: Egress confirmed frame count
* @page3: Page_3 statistics structure
* @page_3.egress_dequeue_bytes: Cumulative count of the number of bytes
* dequeued from egress FQs
* @page_3.egress_dequeue_frames: Cumulative count of the number of frames
* dequeued from egress FQs
* @page_3.egress_reject_bytes: Cumulative count of the number of bytes in
* egress frames whose enqueue was rejected
* @page_3.egress_reject_frames: Cumulative count of the number of egress
* frames whose enqueue was rejected
* @page_4: Page_4 statistics structure: congestion points
* @page_4.cgr_reject_frames: number of rejected frames due to congestion point
* @page_4.cgr_reject_bytes: number of rejected bytes due to congestion point
* @page_5: Page_5 statistics structure: policer
* @page_5.policer_cnt_red: NUmber of red colored frames
* @page_5.policer_cnt_yellow: number of yellow colored frames
* @page_5.policer_cnt_green: number of green colored frames
* @page_5.policer_cnt_re_red: number of recolored red frames
* @page_5.policer_cnt_re_yellow: number of recolored yellow frames
* @page_6: Page_6 statistics structure
* @page_6.tx_pending_frames: total number of frames pending in egress FQs
* @raw: raw statistics structure, used to index counters
*/
union dpni_statistics {
......@@ -442,6 +462,26 @@ union dpni_statistics {
u64 egress_discarded_frames;
u64 egress_confirmed_frames;
} page_2;
struct {
u64 egress_dequeue_bytes;
u64 egress_dequeue_frames;
u64 egress_reject_bytes;
u64 egress_reject_frames;
} page_3;
struct {
u64 cgr_reject_frames;
u64 cgr_reject_bytes;
} page_4;
struct {
u64 policer_cnt_red;
u64 policer_cnt_yellow;
u64 policer_cnt_green;
u64 policer_cnt_re_red;
u64 policer_cnt_re_yellow;
} page_5;
struct {
u64 tx_pending_frames;
} page_6;
struct {
u64 counter[DPNI_STATISTICS_CNT];
} raw;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment