[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z8bNPRtzOBZ7LdGJ@mev-dev.igk.intel.com>
Date: Tue, 4 Mar 2025 10:51:57 +0100
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: Leon Romanovsky <leonro@...dia.com>
Cc: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
Tariq Toukan <tariqt@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Saeed Mahameed <saeedm@...dia.com>, Gal Pressman <gal@...dia.com>,
netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 6/6] net/mlx5e: Properly match IPsec subnet
addresses
On Tue, Mar 04, 2025 at 10:05:43AM +0200, Leon Romanovsky wrote:
> On Tue, Mar 04, 2025 at 08:50:46AM +0100, Michal Swiatkowski wrote:
> > On Wed, Feb 26, 2025 at 01:47:52PM +0200, Tariq Toukan wrote:
> > > From: Leon Romanovsky <leonro@...dia.com>
> > >
> > > Existing match criteria didn't allow to match whole subnet and
> > > only by specific addresses only. This caused to tunnel mode do not
> > > forward such traffic through relevant SA.
> > >
> > > In tunnel mode, policies look like this:
> > > src 192.169.0.0/16 dst 192.169.0.0/16
> > > dir out priority 383615 ptype main
> > > tmpl src 192.169.101.2 dst 192.169.101.1
> > > proto esp spi 0xc5141c18 reqid 1 mode tunnel
> > > crypto offload parameters: dev eth2 mode packet
> > >
> > > In this case, the XFRM core code handled all subnet calculations and
> > > forwarded network address to the drivers e.g. 192.169.0.0.
> > >
> > > For mlx5 devices, there is a need to set relevant prefix e.g. 0xFFFF00
> > > to perform flow steering match operation.
> > >
> > > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> > > Signed-off-by: Tariq Toukan <tariqt@...dia.com>
> > > ---
> > > .../mellanox/mlx5/core/en_accel/ipsec.c | 49 +++++++++++++++++++
> > > .../mellanox/mlx5/core/en_accel/ipsec.h | 9 +++-
> > > .../mellanox/mlx5/core/en_accel/ipsec_fs.c | 20 +++++---
> > > 3 files changed, 69 insertions(+), 9 deletions(-)
> > >
> >
> > [...]
> >
> > >
> > > +static __be32 word_to_mask(int prefix)
> > > +{
> > > + if (prefix < 0)
> > > + return 0;
> > > +
> > > + if (!prefix || prefix > 31)
> > > + return cpu_to_be32(0xFFFFFFFF);
> > > +
> > > + return cpu_to_be32(((1U << prefix) - 1) << (32 - prefix));
> >
> > Isn't it GENMASK(31, 32 - prefix)? I don't know if it is preferable to
> > use this macro in such place.
>
> GENMASK(a, b) expects "b" to be const type, see
> #define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h)))
>
Sorry, I didn't know that, thanks.
> Thanks
Powered by blists - more mailing lists