Message ID | 1575972525-20046-2-git-send-email-wenxu@ucloud.cn |
---|---|
State | Awaiting Upstream |
Delegated to: | David Miller |
Headers | show |
Series | [net-next,1/2] net/mlx5e: refactor indr setup block | expand |
On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: > From: wenxu <wenxu@ucloud.cn> > > Add mlx5e_rep_indr_setup_ft_cb to support indr block setup > in FT mode. > > Signed-off-by: wenxu <wenxu@ucloud.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.
On 12/10/2019 7:44 PM, Paul Blakey wrote: > On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: >> From: wenxu <wenxu@ucloud.cn> >> >> Add mlx5e_rep_indr_setup_ft_cb to support indr block setup >> in FT mode. >> >> Signed-off-by: wenxu <wenxu@ucloud.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. The related patch http://patchwork.ozlabs.org/patch/1206935/ is waiting for upstream > > Thanks, > > Paul. > > >
On 12/11/2019 4:41 AM, wenxu wrote: > On 12/10/2019 7:44 PM, Paul Blakey wrote: >> On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: >>> From: wenxu <wenxu@ucloud.cn> >>> >>> Add mlx5e_rep_indr_setup_ft_cb to support indr block setup >>> in FT mode. >>> >>> Signed-off-by: wenxu <wenxu@ucloud.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. > The related patch http://patchwork.ozlabs.org/patch/1206935/ > > is waiting for upstream I see, thanks.
On Wed, 2019-12-11 at 10:41 +0800, wenxu wrote: > On 12/10/2019 7:44 PM, Paul Blakey wrote: > > On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: > > > From: wenxu <wenxu@ucloud.cn> > > > > > > Add mlx5e_rep_indr_setup_ft_cb to support indr block setup > > > in FT mode. > > > > > > Signed-off-by: wenxu <wenxu@ucloud.cn> > > > --- [...] > > +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. > > The related patch http://patchwork.ozlabs.org/patch/1206935/ > > is waiting for upstream > The netfilter patch is still under-review, once accepted i will apply this series. Thanks, Saeed.
On 12/18/2019 3:54 AM, Saeed Mahameed wrote: > On Wed, 2019-12-11 at 10:41 +0800, wenxu wrote: >> On 12/10/2019 7:44 PM, Paul Blakey wrote: >>> On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: >>>> From: wenxu <wenxu@ucloud.cn> >>>> >>>> Add mlx5e_rep_indr_setup_ft_cb to support indr block setup >>>> in FT mode. >>>> >>>> Signed-off-by: wenxu <wenxu@ucloud.cn> >>>> --- > [...] > >>> +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. >> The related patch http://patchwork.ozlabs.org/patch/1206935/ >> >> is waiting for upstream >> > The netfilter patch is still under-review, once accepted i will apply > this series. > > Thanks, > Saeed. > Hi Saeed, Sorry for so long time to update. The netfilter patch is already accepted. This series is also not out of date and can apply to net-next. If you feel ok please apply it thanks. The netfilter patch: http://patchwork.ozlabs.org/patch/1242815/ BR wenxu
On Mon, 2020-03-16 at 11:14 +0800, wenxu wrote: > On 12/18/2019 3:54 AM, Saeed Mahameed wrote: > > On Wed, 2019-12-11 at 10:41 +0800, wenxu wrote: > > > On 12/10/2019 7:44 PM, Paul Blakey wrote: > > > > On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: > > > > > From: wenxu <wenxu@ucloud.cn> > > > > > > > > > > Add mlx5e_rep_indr_setup_ft_cb to support indr block setup > > > > > in FT mode. > > > > > > > > > > Signed-off-by: wenxu <wenxu@ucloud.cn> > > > > > --- > > [...] > > > > > > +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. > > > The related patch http://patchwork.ozlabs.org/patch/1206935/ > > > > > > is waiting for upstream > > > > > The netfilter patch is still under-review, once accepted i will > > apply > > this series. > > > > Thanks, > > Saeed. > > > Hi Saeed, > > > Sorry for so long time to update. The netfilter patch is already > accepted. This series is also > > not out of date and can apply to net-next. If you feel ok please > apply it thanks. > > > The netfilter patch: > > http://patchwork.ozlabs.org/patch/1242815/ > > BR > > wenxu > Applied to net-next-mlx5, doing some build testing now, and will make this run in regression for a couple of days until my next pull request to net-next. Thanks, saeed.
On Tue, 2020-03-17 at 20:58 -0700, Saeed Mahameed wrote: > On Mon, 2020-03-16 at 11:14 +0800, wenxu wrote: > > On 12/18/2019 3:54 AM, Saeed Mahameed wrote: > > > On Wed, 2019-12-11 at 10:41 +0800, wenxu wrote: > > > > On 12/10/2019 7:44 PM, Paul Blakey wrote: > > > > > On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: > > > > > > From: wenxu <wenxu@ucloud.cn> > > > > > > > > > > > > Add mlx5e_rep_indr_setup_ft_cb to support indr block setup > > > > > > in FT mode. > > > > > > > > > > > > Signed-off-by: wenxu <wenxu@ucloud.cn> > > > > > > --- > > > [...] > > > > > > > > +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. > > > > The related patch http://patchwork.ozlabs.org/patch/1206935/ > > > > > > > > is waiting for upstream > > > > > > > The netfilter patch is still under-review, once accepted i will > > > apply > > > this series. > > > > > > Thanks, > > > Saeed. > > > > > Hi Saeed, > > > > > > Sorry for so long time to update. The netfilter patch is already > > accepted. This series is also > > > > not out of date and can apply to net-next. If you feel ok please > > apply it thanks. > > > > > > The netfilter patch: > > > > http://patchwork.ozlabs.org/patch/1242815/ > > > > BR > > > > wenxu > > > > Applied to net-next-mlx5, doing some build testing now, and will > make > this run in regression for a couple of days until my next pull > request > to net-next. > hmmm, i was too optimistic, patches got blocked by CI, apparently some changes in mlx5 eswitch API are causing the following failure, most likely due to the introduction of eswitch_chains API. 05:57:47 make -s -j 96 CC=/usr/llvm/bin/clang drivers/net/ethernet/mellanox/mlx5/core/ 05:58:14 error: drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:752:8: error: implicit declaration of function 'mlx5_eswitch_prios_supported' [-Werror,-Wimplicit-function-declaration] 05:58:14 error: drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:752:8: note: did you mean 'mlx5_esw_chains_prios_supported'? 05:58:14 Please rebase and re-test, I can help you with more details if you need. Thanks, Saeed. > Thanks, > saeed.
On 3/18/2020 12:05 PM, Saeed Mahameed wrote: > On Tue, 2020-03-17 at 20:58 -0700, Saeed Mahameed wrote: >> On Mon, 2020-03-16 at 11:14 +0800, wenxu wrote: >>> On 12/18/2019 3:54 AM, Saeed Mahameed wrote: >>>> On Wed, 2019-12-11 at 10:41 +0800, wenxu wrote: >>>>> On 12/10/2019 7:44 PM, Paul Blakey wrote: >>>>>> On 12/10/2019 12:08 PM, wenxu@ucloud.cn wrote: >>>>>>> From: wenxu <wenxu@ucloud.cn> >>>>>>> >>>>>>> Add mlx5e_rep_indr_setup_ft_cb to support indr block setup >>>>>>> in FT mode. >>>>>>> >>>>>>> Signed-off-by: wenxu <wenxu@ucloud.cn> >>>>>>> --- >>>> [...] >>>> >>>>>> +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. >>>>> The related patch http://patchwork.ozlabs.org/patch/1206935/ >>>>> >>>>> is waiting for upstream >>>>> >>>> The netfilter patch is still under-review, once accepted i will >>>> apply >>>> this series. >>>> >>>> Thanks, >>>> Saeed. >>>> >>> Hi Saeed, >>> >>> >>> Sorry for so long time to update. The netfilter patch is already >>> accepted. This series is also >>> >>> not out of date and can apply to net-next. If you feel ok please >>> apply it thanks. >>> >>> >>> The netfilter patch: >>> >>> http://patchwork.ozlabs.org/patch/1242815/ >>> >>> BR >>> >>> wenxu >>> >> Applied to net-next-mlx5, doing some build testing now, and will >> make >> this run in regression for a couple of days until my next pull >> request >> to net-next. >> > hmmm, i was too optimistic, patches got blocked by CI, apparently some > changes in mlx5 eswitch API are causing the following failure, most > likely due to the introduction of eswitch_chains API. > > 05:57:47 make -s -j 96 CC=/usr/llvm/bin/clang > drivers/net/ethernet/mellanox/mlx5/core/ > 05:58:14 error: drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:752:8: > error: implicit declaration of function 'mlx5_eswitch_prios_supported' > [-Werror,-Wimplicit-function-declaration] > 05:58:14 error: drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:752:8: > note: did you mean 'mlx5_esw_chains_prios_supported'? > 05:58:14 > > > Please rebase and re-test, I can help you with more details if you > need. Will do. > Thanks, > Saeed. > >> Thanks, >> saeed.
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; }