[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZDWbIWB/W7T99wy+@corigine.com>
Date: Tue, 11 Apr 2023 19:38:41 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
netdev@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
Raed Salem <raeds@...dia.com>, Emeel Hakim <ehakim@...dia.com>
Subject: Re: [PATCH net-next 04/10] net/mlx5e: Prepare IPsec packet reformat
code for tunnel mode
On Tue, Apr 11, 2023 at 07:37:29PM +0300, Leon Romanovsky wrote:
> On Tue, Apr 11, 2023 at 06:00:00PM +0200, Simon Horman wrote:
> > On Mon, Apr 10, 2023 at 09:19:06AM +0300, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@...dia.com>
> > >
> > > Refactor setup_pkt_reformat() function to accommodate future extension
> > > to support tunnel mode.
> > >
> > > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> >
> > ...
> >
> > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
> > > index 060be020ca64..980583fb1e52 100644
> > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
> > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
> > > @@ -836,40 +836,78 @@ static int setup_modify_header(struct mlx5_core_dev *mdev, u32 val, u8 dir,
> > > return 0;
> > > }
> > >
> > > +static int
> > > +setup_pkt_transport_reformat(struct mlx5_accel_esp_xfrm_attrs *attrs,
> > > + struct mlx5_pkt_reformat_params *reformat_params)
> > > +{
> > > + u8 *reformatbf;
> > > + __be32 spi;
> > > +
> > > + switch (attrs->dir) {
> > > + case XFRM_DEV_OFFLOAD_IN:
> > > + reformat_params->type = MLX5_REFORMAT_TYPE_DEL_ESP_TRANSPORT;
> > > + break;
> > > + case XFRM_DEV_OFFLOAD_OUT:
> > > + if (attrs->family == AF_INET)
> > > + reformat_params->type =
> > > + MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4;
> > > + else
> > > + reformat_params->type =
> > > + MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6;
> >
> > Maybe this is nicer? Maybe not.
> >
> > reformat_params->type = attrs->family == AF_INET ?
>
> I didn't like it because of the line above, IMHO it is too long and has
> too many indirection.
Yeah, it's not ideal.
> > MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4 :
> > MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6;
...
Powered by blists - more mailing lists