]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5: E-switch, Don't update group if qos is not enabled
authorChris Mi <cmi@nvidia.com>
Sun, 2 Oct 2022 04:56:31 +0000 (21:56 -0700)
committerJakub Kicinski <kuba@kernel.org>
Mon, 3 Oct 2022 23:55:29 +0000 (16:55 -0700)
Currently, qos group will be updated and qos will be enabled when
unregistering devlink port. Actually no need to update group if qos
is not enabled.

Add a check to prevent unnecessary enabling and disabling qos for
every port.

Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Dmytro Linkin <dlinkin@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c

index 694c540669550a2c6f37656932d1a414c97b1803..4f8a24d84a86a2ba516fc3cc0787b20fe76df2ce 100644 (file)
@@ -924,12 +924,16 @@ int mlx5_esw_qos_vport_update_group(struct mlx5_eswitch *esw,
                                    struct mlx5_esw_rate_group *group,
                                    struct netlink_ext_ack *extack)
 {
-       int err;
+       int err = 0;
 
        mutex_lock(&esw->state_lock);
+       if (!vport->qos.enabled && !group)
+               goto unlock;
+
        err = esw_qos_vport_enable(esw, vport, 0, 0, extack);
        if (!err)
                err = esw_qos_vport_update_group(esw, vport, group, extack);
+unlock:
        mutex_unlock(&esw->state_lock);
        return err;
 }