Commit 2b84960f authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net/sched: taprio: report class offload stats per TXQ, not per TC

The taprio Qdisc creates child classes per netdev TX queue, but
taprio_dump_class_stats() currently reports offload statistics per
traffic class. Traffic classes are groups of TXQs sharing the same
dequeue priority, so this is incorrect and we shouldn't be bundling up
the TXQ stats when reporting them, as we currently do in enetc.

Modify the API from taprio to drivers such that they report TXQ offload
stats and not TC offload stats.

There is no change in the UAPI or in the global Qdisc stats.

Fixes: 6c1adb65 ("net/sched: taprio: add netlink reporting for offload statistics counters")
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f2ea0c35
...@@ -160,20 +160,14 @@ static void enetc_taprio_stats(struct net_device *ndev, ...@@ -160,20 +160,14 @@ static void enetc_taprio_stats(struct net_device *ndev,
stats->window_drops = window_drops; stats->window_drops = window_drops;
} }
static void enetc_taprio_tc_stats(struct net_device *ndev, static void enetc_taprio_queue_stats(struct net_device *ndev,
struct tc_taprio_qopt_tc_stats *tc_stats) struct tc_taprio_qopt_queue_stats *queue_stats)
{ {
struct tc_taprio_qopt_stats *stats = &tc_stats->stats; struct tc_taprio_qopt_stats *stats = &queue_stats->stats;
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
int tc = tc_stats->tc; int queue = queue_stats->queue;
u64 window_drops = 0;
int i;
for (i = 0; i < priv->num_tx_rings; i++) stats->window_drops = priv->tx_ring[queue]->stats.win_drop;
if (priv->tx_ring[i]->prio == tc)
window_drops += priv->tx_ring[i]->stats.win_drop;
stats->window_drops = window_drops;
} }
static int enetc_taprio_replace(struct net_device *ndev, static int enetc_taprio_replace(struct net_device *ndev,
...@@ -208,8 +202,8 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data) ...@@ -208,8 +202,8 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)
case TAPRIO_CMD_STATS: case TAPRIO_CMD_STATS:
enetc_taprio_stats(ndev, &offload->stats); enetc_taprio_stats(ndev, &offload->stats);
break; break;
case TAPRIO_CMD_TC_STATS: case TAPRIO_CMD_QUEUE_STATS:
enetc_taprio_tc_stats(ndev, &offload->tc_stats); enetc_taprio_queue_stats(ndev, &offload->queue_stats);
break; break;
default: default:
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
......
...@@ -191,7 +191,7 @@ enum tc_taprio_qopt_cmd { ...@@ -191,7 +191,7 @@ enum tc_taprio_qopt_cmd {
TAPRIO_CMD_REPLACE, TAPRIO_CMD_REPLACE,
TAPRIO_CMD_DESTROY, TAPRIO_CMD_DESTROY,
TAPRIO_CMD_STATS, TAPRIO_CMD_STATS,
TAPRIO_CMD_TC_STATS, TAPRIO_CMD_QUEUE_STATS,
}; };
/** /**
...@@ -208,8 +208,8 @@ struct tc_taprio_qopt_stats { ...@@ -208,8 +208,8 @@ struct tc_taprio_qopt_stats {
u64 tx_overruns; u64 tx_overruns;
}; };
struct tc_taprio_qopt_tc_stats { struct tc_taprio_qopt_queue_stats {
int tc; int queue;
struct tc_taprio_qopt_stats stats; struct tc_taprio_qopt_stats stats;
}; };
...@@ -227,8 +227,8 @@ struct tc_taprio_qopt_offload { ...@@ -227,8 +227,8 @@ struct tc_taprio_qopt_offload {
union { union {
/* TAPRIO_CMD_STATS */ /* TAPRIO_CMD_STATS */
struct tc_taprio_qopt_stats stats; struct tc_taprio_qopt_stats stats;
/* TAPRIO_CMD_TC_STATS */ /* TAPRIO_CMD_QUEUE_STATS */
struct tc_taprio_qopt_tc_stats tc_stats; struct tc_taprio_qopt_queue_stats queue_stats;
/* TAPRIO_CMD_REPLACE */ /* TAPRIO_CMD_REPLACE */
struct { struct {
struct tc_mqprio_qopt_offload mqprio; struct tc_mqprio_qopt_offload mqprio;
......
...@@ -2458,9 +2458,9 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, ...@@ -2458,9 +2458,9 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
{ {
struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); struct netdev_queue *dev_queue = taprio_queue_get(sch, cl);
struct tc_taprio_qopt_offload offload = { struct tc_taprio_qopt_offload offload = {
.cmd = TAPRIO_CMD_TC_STATS, .cmd = TAPRIO_CMD_QUEUE_STATS,
.tc_stats = { .queue_stats = {
.tc = cl - 1, .queue = cl - 1,
}, },
}; };
struct Qdisc *child; struct Qdisc *child;
...@@ -2470,7 +2470,7 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, ...@@ -2470,7 +2470,7 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
qdisc_qstats_copy(d, child) < 0) qdisc_qstats_copy(d, child) < 0)
return -1; return -1;
return taprio_dump_xstats(sch, d, &offload, &offload.tc_stats.stats); return taprio_dump_xstats(sch, d, &offload, &offload.queue_stats.stats);
} }
static void taprio_walk(struct Qdisc *sch, struct qdisc_walker *arg) static void taprio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
......
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