Re: [PATCH net-next 6/6] net/mlx5e: Properly match IPsec subnet addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > > 
> > > 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@xxxxxxxxxx>
> > > Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
> > > ---
> > >  .../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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux