2020-06-10 20:20:51

by Jarod Wilson

[permalink] [raw]
Subject: [PATCH net-next v2 3/4] mlx5: become aware of when running as a bonding slave

I've been unable to get my hands on suitable supported hardware to date,
but I believe this ought to be all that is needed to enable the mlx5
driver to also work with bonding active-backup crypto offload passthru.

CC: Boris Pismenny <[email protected]>
CC: Saeed Mahameed <[email protected]>
CC: Leon Romanovsky <[email protected]>
CC: Jay Vosburgh <[email protected]>
CC: Veaceslav Falico <[email protected]>
CC: Andy Gospodarek <[email protected]>
CC: "David S. Miller" <[email protected]>
CC: Jeff Kirsher <[email protected]>
CC: Jakub Kicinski <[email protected]>
CC: Steffen Klassert <[email protected]>
CC: Herbert Xu <[email protected]>
CC: [email protected]
Signed-off-by: Jarod Wilson <[email protected]>
---
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
index 92eb3bad4acd..72ad6664bd73 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
@@ -210,6 +210,9 @@ static inline int mlx5e_xfrm_validate_state(struct xfrm_state *x)
struct net_device *netdev = x->xso.dev;
struct mlx5e_priv *priv;

+ if (x->xso.slave_dev)
+ netdev = x->xso.slave_dev;
+
priv = netdev_priv(netdev);

if (x->props.aalgo != SADB_AALG_NONE) {
@@ -291,6 +294,9 @@ static int mlx5e_xfrm_add_state(struct xfrm_state *x)
unsigned int sa_handle;
int err;

+ if (x->xso.slave_dev)
+ netdev = x->xso.slave_dev;
+
priv = netdev_priv(netdev);

err = mlx5e_xfrm_validate_state(x);
--
2.20.1


2020-06-11 21:53:53

by Saeed Mahameed

[permalink] [raw]
Subject: Re: [PATCH net-next v2 3/4] mlx5: become aware of when running as a bonding slave

On Wed, 2020-06-10 at 14:59 -0400, Jarod Wilson wrote:
> I've been unable to get my hands on suitable supported hardware to
> date,
> but I believe this ought to be all that is needed to enable the mlx5
> driver to also work with bonding active-backup crypto offload
> passthru.
>
> CC: Boris Pismenny <[email protected]>
> CC: Saeed Mahameed <[email protected]>
> CC: Leon Romanovsky <[email protected]>
> CC: Jay Vosburgh <[email protected]>
> CC: Veaceslav Falico <[email protected]>
> CC: Andy Gospodarek <[email protected]>
> CC: "David S. Miller" <[email protected]>
> CC: Jeff Kirsher <[email protected]>
> CC: Jakub Kicinski <[email protected]>
> CC: Steffen Klassert <[email protected]>
> CC: Herbert Xu <[email protected]>
> CC: [email protected]
> Signed-off-by: Jarod Wilson <[email protected]>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> index 92eb3bad4acd..72ad6664bd73 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> @@ -210,6 +210,9 @@ static inline int
> mlx5e_xfrm_validate_state(struct xfrm_state *x)
> struct net_device *netdev = x->xso.dev;
> struct mlx5e_priv *priv;
>
> + if (x->xso.slave_dev)
> + netdev = x->xso.slave_dev;
> +

Do we really need to repeat this per driver ?
why not just setup xso.real_dev, in xfrm layer once and for all before
calling device drivers ?

Device drivers will use xso.real_dev blindly.

Will be useful in the future when you add vlan support, etc..


> priv = netdev_priv(netdev);
>
> if (x->props.aalgo != SADB_AALG_NONE) {
> @@ -291,6 +294,9 @@ static int mlx5e_xfrm_add_state(struct xfrm_state
> *x)
> unsigned int sa_handle;
> int err;
>
> + if (x->xso.slave_dev)
> + netdev = x->xso.slave_dev;
> +
> priv = netdev_priv(netdev);
>
> err = mlx5e_xfrm_validate_state(x);

2020-06-21 20:29:59

by Jarod Wilson

[permalink] [raw]
Subject: Re: [PATCH net-next v2 3/4] mlx5: become aware of when running as a bonding slave

On Thu, Jun 11, 2020 at 5:51 PM Saeed Mahameed <[email protected]> wrote:
>
> On Wed, 2020-06-10 at 14:59 -0400, Jarod Wilson wrote:
> > I've been unable to get my hands on suitable supported hardware to
> > date,
> > but I believe this ought to be all that is needed to enable the mlx5
> > driver to also work with bonding active-backup crypto offload
> > passthru.
> >
> > CC: Boris Pismenny <[email protected]>
> > CC: Saeed Mahameed <[email protected]>
> > CC: Leon Romanovsky <[email protected]>
> > CC: Jay Vosburgh <[email protected]>
> > CC: Veaceslav Falico <[email protected]>
> > CC: Andy Gospodarek <[email protected]>
> > CC: "David S. Miller" <[email protected]>
> > CC: Jeff Kirsher <[email protected]>
> > CC: Jakub Kicinski <[email protected]>
> > CC: Steffen Klassert <[email protected]>
> > CC: Herbert Xu <[email protected]>
> > CC: [email protected]
> > Signed-off-by: Jarod Wilson <[email protected]>
> > ---
> > drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > index 92eb3bad4acd..72ad6664bd73 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > @@ -210,6 +210,9 @@ static inline int
> > mlx5e_xfrm_validate_state(struct xfrm_state *x)
> > struct net_device *netdev = x->xso.dev;
> > struct mlx5e_priv *priv;
> >
> > + if (x->xso.slave_dev)
> > + netdev = x->xso.slave_dev;
> > +
>
> Do we really need to repeat this per driver ?
> why not just setup xso.real_dev, in xfrm layer once and for all before
> calling device drivers ?
>
> Device drivers will use xso.real_dev blindly.
>
> Will be useful in the future when you add vlan support, etc..

Apologies, I didn't catch your reply until just recently. Yeah, that
sounds like a better approach, if I can work it out cleanly. We just
init xso.real_dev to the same thing as xso.dev, then overwrite it in
the upper layer drivers (bonding, vlan, etc), while device drivers
just always use xso.real_dev, if I'm understanding your suggestion.
I'll see what I can come up with.


--
Jarod Wilson
[email protected]

2020-06-23 19:57:42

by Saeed Mahameed

[permalink] [raw]
Subject: Re: [PATCH net-next v2 3/4] mlx5: become aware of when running as a bonding slave

On Sun, 2020-06-21 at 16:25 -0400, Jarod Wilson wrote:
> On Thu, Jun 11, 2020 at 5:51 PM Saeed Mahameed <[email protected]>
> wrote:
> > On Wed, 2020-06-10 at 14:59 -0400, Jarod Wilson wrote:
> > > I've been unable to get my hands on suitable supported hardware
> > > to
> > > date,
> > > but I believe this ought to be all that is needed to enable the
> > > mlx5
> > > driver to also work with bonding active-backup crypto offload
> > > passthru.
> > >
> > > CC: Boris Pismenny <[email protected]>
> > > CC: Saeed Mahameed <[email protected]>
> > > CC: Leon Romanovsky <[email protected]>
> > > CC: Jay Vosburgh <[email protected]>
> > > CC: Veaceslav Falico <[email protected]>
> > > CC: Andy Gospodarek <[email protected]>
> > > CC: "David S. Miller" <[email protected]>
> > > CC: Jeff Kirsher <[email protected]>
> > > CC: Jakub Kicinski <[email protected]>
> > > CC: Steffen Klassert <[email protected]>
> > > CC: Herbert Xu <[email protected]>
> > > CC: [email protected]
> > > Signed-off-by: Jarod Wilson <[email protected]>
> > > ---
> > > drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 6
> > > ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git
> > > a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > > b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > > index 92eb3bad4acd..72ad6664bd73 100644
> > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> > > @@ -210,6 +210,9 @@ static inline int
> > > mlx5e_xfrm_validate_state(struct xfrm_state *x)
> > > struct net_device *netdev = x->xso.dev;
> > > struct mlx5e_priv *priv;
> > >
> > > + if (x->xso.slave_dev)
> > > + netdev = x->xso.slave_dev;
> > > +
> >
> > Do we really need to repeat this per driver ?
> > why not just setup xso.real_dev, in xfrm layer once and for all
> > before
> > calling device drivers ?
> >
> > Device drivers will use xso.real_dev blindly.
> >
> > Will be useful in the future when you add vlan support, etc..
>
> Apologies, I didn't catch your reply until just recently. Yeah, that
> sounds like a better approach, if I can work it out cleanly. We just
> init xso.real_dev to the same thing as xso.dev, then overwrite it in
> the upper layer drivers (bonding, vlan, etc), while device drivers
> just always use xso.real_dev, if I'm understanding your suggestion.
> I'll see what I can come up with.
>
>

Yes, exactly what i meant, Thanks !