net/mlx5e: Add rollback on add VLAN failure
authorGal Pressman <galp@mellanox.com>
Thu, 14 Sep 2017 13:24:19 +0000 (16:24 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 9 Nov 2017 04:26:56 +0000 (13:26 +0900)
When add VLAN rule fails the active vlan bit should be cleared.

Fixes: afb736e9330a ("net/mlx5: Ethernet resource handling files")
Signed-off-by: Gal Pressman <galp@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c

index 53901537778b81b7f9516b0ead6780ee3ecf47a2..d3d775a931837ba536f6b5f75ec9e6bcc0026fca 100644 (file)
@@ -309,10 +309,15 @@ int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
                          u16 vid)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
+       int err;
 
        set_bit(vid, priv->fs.vlan.active_cvlans);
 
-       return mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_MATCH_CTAG_VID, vid);
+       err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_MATCH_CTAG_VID, vid);
+       if (err)
+               clear_bit(vid, priv->fs.vlan.active_cvlans);
+
+       return err;
 }
 
 int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,