Commit f8253df5 authored by Nogah Frankel's avatar Nogah Frankel Committed by David S. Miller

net: sch: red: Change offloaded xstats to be incremental

Change the value of the xstats requested from the driver for offloaded RED
to be incremental, like the normal stats.
It increases consistency - if a qdisc stops being offloaded its xstats
don't change.
Signed-off-by: default avatarNogah Frankel <nogahf@mellanox.com>
Reviewed-by: default avatarYuval Mintz <yuvalm@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f34b4aac
...@@ -212,6 +212,7 @@ mlxsw_sp_qdisc_get_red_xstats(struct mlxsw_sp_port *mlxsw_sp_port, u32 handle, ...@@ -212,6 +212,7 @@ mlxsw_sp_qdisc_get_red_xstats(struct mlxsw_sp_port *mlxsw_sp_port, u32 handle,
{ {
struct red_stats *xstats_base = &mlxsw_sp_qdisc->xstats_base; struct red_stats *xstats_base = &mlxsw_sp_qdisc->xstats_base;
struct mlxsw_sp_port_xstats *xstats; struct mlxsw_sp_port_xstats *xstats;
int early_drops, marks, pdrops;
if (mlxsw_sp_qdisc->handle != handle || if (mlxsw_sp_qdisc->handle != handle ||
mlxsw_sp_qdisc->type != MLXSW_SP_QDISC_RED) mlxsw_sp_qdisc->type != MLXSW_SP_QDISC_RED)
...@@ -219,9 +220,17 @@ mlxsw_sp_qdisc_get_red_xstats(struct mlxsw_sp_port *mlxsw_sp_port, u32 handle, ...@@ -219,9 +220,17 @@ mlxsw_sp_qdisc_get_red_xstats(struct mlxsw_sp_port *mlxsw_sp_port, u32 handle,
xstats = &mlxsw_sp_port->periodic_hw_stats.xstats; xstats = &mlxsw_sp_port->periodic_hw_stats.xstats;
res->prob_drop = xstats->wred_drop[tclass_num] - xstats_base->prob_drop; early_drops = xstats->wred_drop[tclass_num] - xstats_base->prob_drop;
res->prob_mark = xstats->ecn - xstats_base->prob_mark; marks = xstats->ecn - xstats_base->prob_mark;
res->pdrop = xstats->tail_drop[tclass_num] - xstats_base->pdrop; pdrops = xstats->tail_drop[tclass_num] - xstats_base->pdrop;
res->pdrop += pdrops;
res->prob_drop += early_drops;
res->prob_mark += marks;
xstats_base->pdrop += pdrops;
xstats_base->prob_drop += early_drops;
xstats_base->prob_mark += marks;
return 0; return 0;
} }
......
...@@ -344,32 +344,24 @@ static int red_dump_stats(struct Qdisc *sch, struct gnet_dump *d) ...@@ -344,32 +344,24 @@ static int red_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
{ {
struct red_sched_data *q = qdisc_priv(sch); struct red_sched_data *q = qdisc_priv(sch);
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
struct tc_red_xstats st = { struct tc_red_xstats st = {0};
.early = q->stats.prob_drop + q->stats.forced_drop,
.pdrop = q->stats.pdrop,
.other = q->stats.other,
.marked = q->stats.prob_mark + q->stats.forced_mark,
};
if (sch->flags & TCQ_F_OFFLOADED) { if (sch->flags & TCQ_F_OFFLOADED) {
struct red_stats hw_stats = {0};
struct tc_red_qopt_offload hw_stats_request = { struct tc_red_qopt_offload hw_stats_request = {
.command = TC_RED_XSTATS, .command = TC_RED_XSTATS,
.handle = sch->handle, .handle = sch->handle,
.parent = sch->parent, .parent = sch->parent,
{ {
.xstats = &hw_stats, .xstats = &q->stats,
}, },
}; };
if (!dev->netdev_ops->ndo_setup_tc(dev, dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED,
TC_SETUP_QDISC_RED, &hw_stats_request);
&hw_stats_request)) {
st.early += hw_stats.prob_drop + hw_stats.forced_drop;
st.pdrop += hw_stats.pdrop;
st.other += hw_stats.other;
st.marked += hw_stats.prob_mark + hw_stats.forced_mark;
}
} }
st.early = q->stats.prob_drop + q->stats.forced_drop;
st.pdrop = q->stats.pdrop;
st.other = q->stats.other;
st.marked = q->stats.prob_mark + q->stats.forced_mark;
return gnet_stats_copy_app(d, &st, sizeof(st)); return gnet_stats_copy_app(d, &st, sizeof(st));
} }
......
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