ACK: [PATCH Wily SRU v2] net/mlx5e: Disable VLAN filter in promiscuous mode

Brad Figg brad.figg at canonical.com
Mon Nov 16 13:11:08 UTC 2015


On Wed, Nov 11, 2015 at 06:23:02AM -0700, tim.gardner at canonical.com wrote:
> From: Achiad Shochat <achiad at mellanox.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1514861
> 
> When the device was set to promiscuous mode, we didn't disable
> VLAN filtering, which is wrong behaviour, fix that.
> 
> Now when the device is set to promiscuous mode RX packets
> sent over any VLAN (or no VLAN tag at all) will be accepted.
> 
> Signed-off-by: Achiad Shochat <achiad at mellanox.com>
> Signed-off-by: Or Gerlitz <ogerlitz at mellanox.com>
> Signed-off-by: David S. Miller <davem at davemloft.net>
> (cherry picked from commit c07543431e9f3d126d083808efa0e76461d8833b)
> Signed-off-by: Talat Batheesh <talatb at mellanox.com>
> Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
> ---
> 
> v2: Added BugLink and s-o-b
> 
>  .../ethernet/mellanox/mlx5/core/en_flow_table.c    | 38 +++++++++++++---------
>  1 file changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
> index 70ec31b..40c67d7 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
> @@ -594,26 +594,24 @@ static void mlx5e_del_vlan_rule(struct mlx5e_priv *priv,
>  
>  void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv)
>  {
> -	WARN_ON(!mutex_is_locked(&priv->state_lock));
> +        if (!priv->vlan.filter_disabled)
> +                return;
>  
> -	if (priv->vlan.filter_disabled) {
> -		priv->vlan.filter_disabled = false;
> -		if (test_bit(MLX5E_STATE_OPENED, &priv->state))
> -			mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
> -					    0);
> -	}
> +	priv->vlan.filter_disabled = false;
> +	if (priv->netdev->flags & IFF_PROMISC)
> +		return;
> +	mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0);
>  }
>  
>  void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv)
>  {
> -	WARN_ON(!mutex_is_locked(&priv->state_lock));
> +        if (priv->vlan.filter_disabled)
> +                return;
>  
> -	if (!priv->vlan.filter_disabled) {
> -		priv->vlan.filter_disabled = true;
> -		if (test_bit(MLX5E_STATE_OPENED, &priv->state))
> -			mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
> -					    0);
> -	}
> +	priv->vlan.filter_disabled = true;
> +	if (priv->netdev->flags & IFF_PROMISC)
> +		return;
> +	mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0);
>  }
>  
>  int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
> @@ -775,8 +773,12 @@ void mlx5e_set_rx_mode_core(struct mlx5e_priv *priv)
>  	bool enable_broadcast  = !ea->broadcast_enabled &&  broadcast_enabled;
>  	bool disable_broadcast =  ea->broadcast_enabled && !broadcast_enabled;
>  
> -	if (enable_promisc)
> +	if (enable_promisc) {
>  		mlx5e_add_eth_addr_rule(priv, &ea->promisc, MLX5E_PROMISC);
> +		if (!priv->vlan.filter_disabled)
> +			mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
> +					    0);
> +	}
>  	if (enable_allmulti)
>  		mlx5e_add_eth_addr_rule(priv, &ea->allmulti, MLX5E_ALLMULTI);
>  	if (enable_broadcast)
> @@ -788,8 +790,12 @@ void mlx5e_set_rx_mode_core(struct mlx5e_priv *priv)
>  		mlx5e_del_eth_addr_from_flow_table(priv, &ea->broadcast);
>  	if (disable_allmulti)
>  		mlx5e_del_eth_addr_from_flow_table(priv, &ea->allmulti);
> -	if (disable_promisc)
> +	if (disable_promisc) {
> +		if (!priv->vlan.filter_disabled)
> +			mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
> +					    0);
>  		mlx5e_del_eth_addr_from_flow_table(priv, &ea->promisc);
> +	}
>  
>  	ea->promisc_enabled   = promisc_enabled;
>  	ea->allmulti_enabled  = allmulti_enabled;
> -- 
> 2.5.0
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Positive testing.

-- 
Brad Figg brad.figg at canonical.com http://www.canonical.com




More information about the kernel-team mailing list