mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
net/mlx5e: Check police action rate for matchall filter
As matchall filter uses TSAR (Transmit Scheduling Arbiter) for rate limit, the rate of police action should not be over the port's max link speed, or the maximum aggregated speed of both ports if LAG is configured. Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Reviewed-by: Parav Pandit <parav@nvidia.com> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
8d88e198dc
commit
4291ab7112
|
|
@ -770,6 +770,7 @@ int mlx5_esw_qos_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, u32
|
|||
{
|
||||
u32 ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
|
||||
struct mlx5_vport *vport;
|
||||
u32 link_speed_max;
|
||||
u32 bitmask;
|
||||
int err;
|
||||
|
||||
|
|
@ -777,6 +778,17 @@ int mlx5_esw_qos_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, u32
|
|||
if (IS_ERR(vport))
|
||||
return PTR_ERR(vport);
|
||||
|
||||
if (rate_mbps) {
|
||||
err = mlx5_esw_qos_max_link_speed_get(esw->dev, &link_speed_max, false, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = mlx5_esw_qos_link_speed_verify(esw->dev, "Police",
|
||||
link_speed_max, rate_mbps, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
mutex_lock(&esw->state_lock);
|
||||
if (!vport->qos.enabled) {
|
||||
/* Eswitch QoS wasn't enabled yet. Enable it and vport QoS. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user