Skip to content

Commit 6513787

Browse files
committed
Merge branch 'taprio-xstats'
Vladimir Oltean says: ==================== Fixes for taprio xstats 1. Taprio classes correspond to TXQs, and thus, class stats are TXQ stats not TC stats. 2. Drivers reporting taprio xstats should report xstats for *this* taprio, not for a previous one. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents f2ea0c3 + f1e668d commit 6513787

3 files changed

Lines changed: 25 additions & 22 deletions

File tree

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ static int enetc_setup_taprio(struct enetc_ndev_priv *priv,
127127
return 0;
128128
}
129129

130+
static void enetc_reset_taprio_stats(struct enetc_ndev_priv *priv)
131+
{
132+
int i;
133+
134+
for (i = 0; i < priv->num_tx_rings; i++)
135+
priv->tx_ring[i]->stats.win_drop = 0;
136+
}
137+
130138
static void enetc_reset_taprio(struct enetc_ndev_priv *priv)
131139
{
132140
struct enetc_hw *hw = &priv->si->hw;
@@ -145,6 +153,7 @@ static void enetc_taprio_destroy(struct net_device *ndev)
145153

146154
enetc_reset_taprio(priv);
147155
enetc_reset_tc_mqprio(ndev);
156+
enetc_reset_taprio_stats(priv);
148157
}
149158

150159
static void enetc_taprio_stats(struct net_device *ndev,
@@ -160,20 +169,14 @@ static void enetc_taprio_stats(struct net_device *ndev,
160169
stats->window_drops = window_drops;
161170
}
162171

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

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;
179+
stats->window_drops = priv->tx_ring[queue]->stats.win_drop;
177180
}
178181

179182
static int enetc_taprio_replace(struct net_device *ndev,
@@ -208,8 +211,8 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)
208211
case TAPRIO_CMD_STATS:
209212
enetc_taprio_stats(ndev, &offload->stats);
210213
break;
211-
case TAPRIO_CMD_TC_STATS:
212-
enetc_taprio_tc_stats(ndev, &offload->tc_stats);
214+
case TAPRIO_CMD_QUEUE_STATS:
215+
enetc_taprio_queue_stats(ndev, &offload->queue_stats);
213216
break;
214217
default:
215218
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)