lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d6e75961-1098-1dc4-b1ea-fa733aeb37c0@ucloud.cn>
Date:   Tue, 24 Mar 2020 20:49:52 +0800
From:   wenxu <wenxu@...oud.cn>
To:     Vlad Buslov <vladbu@...lanox.com>
Cc:     saeedm@...lanox.com, paulb@...lanox.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v5 2/2] net/mlx5e: add mlx5e_rep_indr_setup_ft_cb
 support


在 2020/3/24 20:05, Vlad Buslov 写道:
> On Tue 24 Mar 2020 at 01:44, wenxu@...oud.cn wrote:
>> From: wenxu <wenxu@...oud.cn>
>>
>> Add mlx5e_rep_indr_setup_ft_cb to support indr block setup
>> in FT mode.
>>
>> Signed-off-by: wenxu <wenxu@...oud.cn>
>> ---
>> v5: no change
>>
>>   drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 52 ++++++++++++++++++++++++
>>   1 file changed, 52 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
>> index 057f5f9..30c81c3 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
>> @@ -732,6 +732,55 @@ static int mlx5e_rep_indr_setup_tc_cb(enum tc_setup_type type,
>>   	}
>>   }
>>
>> +static int mlx5e_rep_indr_setup_ft_cb(enum tc_setup_type type,
>> +				      void *type_data, void *indr_priv)
>> +{
>> +	struct mlx5e_rep_indr_block_priv *priv = indr_priv;
>> +	struct flow_cls_offload *f = type_data;
>> +	struct flow_cls_offload tmp;
>> +	struct mlx5e_priv *mpriv;
>> +	struct mlx5_eswitch *esw;
>> +	unsigned long flags;
>> +	int err;
>> +
>> +	mpriv = netdev_priv(priv->rpriv->netdev);
>> +	esw = mpriv->mdev->priv.eswitch;
>> +
>> +	flags = MLX5_TC_FLAG(EGRESS) |
>> +		MLX5_TC_FLAG(ESW_OFFLOAD) |
>> +		MLX5_TC_FLAG(FT_OFFLOAD);
>> +
>> +	switch (type) {
>> +	case TC_SETUP_CLSFLOWER:
>> +		memcpy(&tmp, f, sizeof(*f));
>> +
>> +		if (!mlx5_esw_chains_prios_supported(esw))
>> +			return -EOPNOTSUPP;
>> +
>> +		/* Re-use tc offload path by moving the ft flow to the
>> +		 * reserved ft chain.
>> +		 *
>> +		 * FT offload can use prio range [0, INT_MAX], so we normalize
>> +		 * it to range [1, mlx5_esw_chains_get_prio_range(esw)]
>> +		 * as with tc, where prio 0 isn't supported.
>> +		 *
>> +		 * We only support chain 0 of FT offload.
>> +		 */
>> +		if (tmp.common.prio >= mlx5_esw_chains_get_prio_range(esw))
>> +			return -EOPNOTSUPP;
>> +		if (tmp.common.chain_index != 0)
>> +			return -EOPNOTSUPP;
>> +
>> +		tmp.common.chain_index = mlx5_esw_chains_get_ft_chain(esw);
>> +		tmp.common.prio++;
>> +		err = mlx5e_rep_indr_offload(priv->netdev, &tmp, priv, flags);
>> +		memcpy(&f->stats, &tmp.stats, sizeof(f->stats));
> Why do you need to create temporary copy of flow_cls_offload struct and
> then copy parts of tmp back to the original? Again, this info should
> probably be in the commit message.

This FT mode using the specficed chain_index which changed by driver adnd

using only in driver. It will move the flow table rules to their 
steering domain.

This scenario just follow the mlx5e_rep_setup_ft_cb which did offload in 
FT mode.

So it's an old scenario, Is it necessary to add to the commit message?

>
>> +		return err;
>> +	default:
>> +		return -EOPNOTSUPP;
>> +	}
>> +}
>> +
>>   static void mlx5e_rep_indr_block_unbind(void *cb_priv)
>>   {
>>   	struct mlx5e_rep_indr_block_priv *indr_priv = cb_priv;
>> @@ -809,6 +858,9 @@ int mlx5e_rep_indr_setup_cb(struct net_device *netdev, void *cb_priv,
>>   	case TC_SETUP_BLOCK:
>>   		return mlx5e_rep_indr_setup_block(netdev, cb_priv, type_data,
>>   						  mlx5e_rep_indr_setup_tc_cb);
>> +	case TC_SETUP_FT:
>> +		return mlx5e_rep_indr_setup_block(netdev, cb_priv, type_data,
>> +						  mlx5e_rep_indr_setup_ft_cb);
>>   	default:
>>   		return -EOPNOTSUPP;
>>   	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ