[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <140d29e0-712a-31b0-e7b0-e4f8af29d4a8@mellanox.com>
Date: Tue, 10 Dec 2019 11:44:57 +0000
From: Paul Blakey <paulb@...lanox.com>
To: "wenxu@...oud.cn" <wenxu@...oud.cn>
CC: "pablo@...filter.org" <pablo@...filter.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 2/2] net/mlx5e: add mlx5e_rep_indr_setup_ft_cb
support
On 12/10/2019 12:08 PM, 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>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 37 ++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> index 6f304f6..e0da17c 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> @@ -748,6 +748,40 @@ 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 mlx5e_priv *mpriv = netdev_priv(priv->rpriv->netdev);
> + struct mlx5_eswitch *esw = mpriv->mdev->priv.eswitch;
> + struct flow_cls_offload *f = type_data;
> + struct flow_cls_offload cls_flower;
> + unsigned long flags;
> + int err;
> +
> + flags = MLX5_TC_FLAG(EGRESS) |
> + MLX5_TC_FLAG(ESW_OFFLOAD) |
> + MLX5_TC_FLAG(FT_OFFLOAD);
> +
> + switch (type) {
> + case TC_SETUP_CLSFLOWER:
> + if (!mlx5_eswitch_prios_supported(esw) || f->common.chain_index)
> + return -EOPNOTSUPP;
> +
> + /* Re-use tc offload path by moving the ft flow to the
> + * reserved ft chain.
> + */
> + memcpy(&cls_flower, f, sizeof(*f));
> + cls_flower.common.chain_index = FDB_FT_CHAIN;
> + err = mlx5e_rep_indr_offload(priv->netdev, &cls_flower, priv,
> + flags);
> + memcpy(&f->stats, &cls_flower.stats, sizeof(f->stats));
> + 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;
> @@ -825,6 +859,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;
> }
+cc Saeed
This looks good to me, but it should be on top of a patch that will
actual allows the indirect BIND if the nft
table device is a tunnel device. Is that upstream? If so which patch?
Currently (5.5.0-rc1+), nft_register_flowtable_net_hooks calls
nf_flow_table_offload_setup which will see
that the tunnel device doesn't have ndo_setup_tc and return
-EOPNOTSUPPORTED.
Thanks,
Paul.
Powered by blists - more mailing lists