Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2ed6db7 authored by Nogah Frankel's avatar Nogah Frankel Committed by David S. Miller
Browse files

mlxsw: spectrum: qdiscs: Make the clean stats function to be for RED only



Improve readability by changing the clean stats function to handle only
RED. Qdiscs that will be offloaded in the future will have a clean stats
function of their own.

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 4d1a4b84
Loading
Loading
Loading
Loading
+13 −20
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ mlxsw_sp_tclass_congestion_disable(struct mlxsw_sp_port *mlxsw_sp_port,
}

static void
mlxsw_sp_setup_tc_qdisc_clean_stats(struct mlxsw_sp_port *mlxsw_sp_port,
mlxsw_sp_setup_tc_qdisc_red_clean_stats(struct mlxsw_sp_port *mlxsw_sp_port,
					struct mlxsw_sp_qdisc *mlxsw_sp_qdisc,
					int tclass_num)
{
@@ -110,24 +110,17 @@ mlxsw_sp_setup_tc_qdisc_clean_stats(struct mlxsw_sp_port *mlxsw_sp_port,
	xstats = &mlxsw_sp_port->periodic_hw_stats.xstats;
	stats = &mlxsw_sp_port->periodic_hw_stats.stats;
	stats_base = &mlxsw_sp_qdisc->stats_base;
	red_base = &mlxsw_sp_qdisc->xstats_base.red;

	stats_base->tx_packets = stats->tx_packets;
	stats_base->tx_bytes = stats->tx_bytes;

	switch (mlxsw_sp_qdisc->type) {
	case MLXSW_SP_QDISC_RED:
		red_base = &mlxsw_sp_qdisc->xstats_base.red;
	red_base->prob_mark = xstats->ecn;
	red_base->prob_drop = xstats->wred_drop[tclass_num];
	red_base->pdrop = xstats->tail_drop[tclass_num];

		stats_base->overlimits = red_base->prob_drop +
					 red_base->prob_mark;
	stats_base->overlimits = red_base->prob_drop + red_base->prob_mark;
	stats_base->drops = red_base->prob_drop + red_base->pdrop;
		break;
	default:
		break;
	}
}

static int
@@ -189,7 +182,7 @@ mlxsw_sp_qdisc_red_replace(struct mlxsw_sp_port *mlxsw_sp_port, u32 handle,

	mlxsw_sp_qdisc->type = MLXSW_SP_QDISC_RED;
	if (mlxsw_sp_qdisc->handle != handle)
		mlxsw_sp_setup_tc_qdisc_clean_stats(mlxsw_sp_port,
		mlxsw_sp_setup_tc_qdisc_red_clean_stats(mlxsw_sp_port,
							mlxsw_sp_qdisc,
							tclass_num);