Subject: Re: [PATCH net-next 06/10] {NET,IB}/mlx4: Add device managed flow steering firmware API

From: Or Gerlitz <[email-masked]>
Date: Mon, 2 Jul 2012 11:28:18 +0300

On 7/2/2012 11:14 AM, Roland Dreier wrote:
> What was wrong with Dave's initial suggestion of ethtool? All the 
> other steering stuff is configured that way, why not this hash?

Roland, as I wrote earlier on this thread -->  [...] pointed out in the 
change-log, note that this policy is **global** to the HCA, that is 
effects all the Ethernet (and down the road, also when adding support 
for IPoIB flow-steering, under a config of card with one IB port and one 
Eth port) net-devices that relate to that mlx4 device instance.

In a system with (say) one card and two Ethernet ports, where for each 
port there's corresponding ethN interface, **both** mlx4_en net-devices 
use the same instance of struct mlx4_device, which means that if we let 
the user to set through ethtool the flow steering hash of ethN1 this 
will evetually change also the hash used for packets going to ethN2, or 
in other words, in mlx4 language this param belong to the mlx4_core 
module. In that respect, I was  thinking on using sysfs as we do for the 
port link type and IB mtu, hope this makes things clearer, SB  the 
relevant code, now with the global module param which can change to 
using per mlx4_core device sysfs.

Or.

> --- a/drivers/net/ethernet/mellanox/mlx4/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/main.c
> @@ -1231,6 +1236,21 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
>   			goto err_stop_fw;
>   		}
>   
> +		priv->fs_hash_mode = mlx4_flow_steering_hash;
> +
> +		switch (priv->fs_hash_mode) {
> +		case MLX4_FS_L2_HASH:
> +			init_hca.fs_hash_enable_bits = 0;
> +			break;
> +
> +		case MLX4_FS_L2_L3_L4_HASH:
> +			/* Enable flow steering with
> +			   udp unicast and tcp unicast*/
> +			init_hca.fs_hash_enable_bits =
> +				MLX4_FS_UDP_UC_EN | MLX4_FS_TCP_UC_EN;
> +			break;
> +		}
> +
>   		profile = default_profile;
>   		if (dev->caps.steering_mode ==
>   		    MLX4_STEERING_MODE_DEVICE_MANAGED)