Skip to content

Commit 2b84960

Browse files
vladimirolteandavem330
authored andcommitted
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: 6c1adb6 ("net/sched: taprio: add netlink reporting for offload statistics counters") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f2ea0c3 commit 2b84960

3 files changed

Lines changed: 16 additions & 22 deletions

File tree

drivers/net/ethernet/freescale/enetc/enetc_qos.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,14 @@ static void enetc_taprio_stats(struct net_device *ndev,
160160
stats->window_drops = window_drops;
161161
}
162162

163-
static void enetc_taprio_tc_stats(struct net_device *ndev,
164-
struct tc_taprio_qopt_tc_stats *tc_stats)
163+
static void enetc_taprio_queue_stats(struct net_device *ndev,
164+
struct tc_taprio_qopt_queue_stats *queue_stats)
165165
{
166-
struct tc_taprio_qopt_stats *stats = &tc_stats->stats;
166+
struct tc_taprio_qopt_stats *stats = &queue_stats->stats;
167167
struct enetc_ndev_priv *priv = netdev_priv(ndev);
168-
int tc = tc_stats->tc;
169-
u64 window_drops = 0;
170-
int i;
168+
int queue = queue_stats->queue;
171169

172-
for (i = 0; i < priv->num_tx_rings; i++)
173-
if (priv->tx_ring[i]->prio == tc)
174-
window_drops += priv->tx_ring[i]->stats.win_drop;
175-
176-
stats->window_drops = window_drops;
170+
stats->window_drops = priv->tx_ring[queue]->stats.win_drop;
177171
}
178172

179173
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)
208202
case TAPRIO_CMD_STATS:
209203
enetc_taprio_stats(ndev, &offload->stats);
210204
break;
211-
case TAPRIO_CMD_TC_STATS:
212-
enetc_taprio_tc_stats(ndev, &offload->tc_stats);
205+
case TAPRIO_CMD_QUEUE_STATS:
206+
enetc_taprio_queue_stats(ndev, &offload->queue_stats);
213207
break;
214208
default:
215209
err = -EOPNOTSUPP;

include/net/pkt_sched.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ enum tc_taprio_qopt_cmd {
191191
TAPRIO_CMD_REPLACE,
192192
TAPRIO_CMD_DESTROY,
193193
TAPRIO_CMD_STATS,
194-
TAPRIO_CMD_TC_STATS,
194+
TAPRIO_CMD_QUEUE_STATS,
195195
};
196196

197197
/**
@@ -208,8 +208,8 @@ struct tc_taprio_qopt_stats {
208208
u64 tx_overruns;
209209
};
210210

211-
struct tc_taprio_qopt_tc_stats {
212-
int tc;
211+
struct tc_taprio_qopt_queue_stats {
212+
int queue;
213213
struct tc_taprio_qopt_stats stats;
214214
};
215215

@@ -227,8 +227,8 @@ struct tc_taprio_qopt_offload {
227227
union {
228228
/* TAPRIO_CMD_STATS */
229229
struct tc_taprio_qopt_stats stats;
230-
/* TAPRIO_CMD_TC_STATS */
231-
struct tc_taprio_qopt_tc_stats tc_stats;
230+
/* TAPRIO_CMD_QUEUE_STATS */
231+
struct tc_taprio_qopt_queue_stats queue_stats;
232232
/* TAPRIO_CMD_REPLACE */
233233
struct {
234234
struct tc_mqprio_qopt_offload mqprio;

net/sched/sch_taprio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,9 +2458,9 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
24582458
{
24592459
struct netdev_queue *dev_queue = taprio_queue_get(sch, cl);
24602460
struct tc_taprio_qopt_offload offload = {
2461-
.cmd = TAPRIO_CMD_TC_STATS,
2462-
.tc_stats = {
2463-
.tc = cl - 1,
2461+
.cmd = TAPRIO_CMD_QUEUE_STATS,
2462+
.queue_stats = {
2463+
.queue = cl - 1,
24642464
},
24652465
};
24662466
struct Qdisc *child;
@@ -2470,7 +2470,7 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
24702470
qdisc_qstats_copy(d, child) < 0)
24712471
return -1;
24722472

2473-
return taprio_dump_xstats(sch, d, &offload, &offload.tc_stats.stats);
2473+
return taprio_dump_xstats(sch, d, &offload, &offload.queue_stats.stats);
24742474
}
24752475

24762476
static void taprio_walk(struct Qdisc *sch, struct qdisc_walker *arg)

0 commit comments

Comments
 (0)