netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Leon Romanovsky <leonro@nvidia.com>
Cc: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Saeed Mahameed <saeedm@nvidia.com>, Gal Pressman <gal@nvidia.com>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 6/6] net/mlx5e: Properly match IPsec subnet addresses
Date: Tue, 4 Mar 2025 10:51:57 +0100	[thread overview]
Message-ID: <Z8bNPRtzOBZ7LdGJ@mev-dev.igk.intel.com> (raw)
In-Reply-To: <20250304080543.GD1955273@unreal>

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

      reply	other threads:[~2025-03-04  9:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 11:47 [PATCH net-next 0/6] mlx5 misc enhancements 2025-02-26 Tariq Toukan
2025-02-26 11:47 ` [PATCH net-next 1/6] net/mlx5: Relocate function declarations from port.h to mlx5_core.h Tariq Toukan
2025-02-26 11:47 ` [PATCH net-next 2/6] net/mlx5: Refactor link speed handling with mlx5_link_info struct Tariq Toukan
2025-02-26 11:47 ` [PATCH net-next 3/6] net/mlx5e: Enable lanes configuration when auto-negotiation is off Tariq Toukan
2025-02-28 22:51   ` Jakub Kicinski
2025-03-02  8:17     ` Shahar Shitrit
2025-03-03 22:19       ` Jakub Kicinski
2025-02-28 23:54   ` Jakub Kicinski
2025-02-26 11:47 ` [PATCH net-next 4/6] net/mlx5: Lag, Enable Multiport E-Switch offloads on 8 ports LAG Tariq Toukan
2025-03-04  7:12   ` Michal Swiatkowski
2025-02-26 11:47 ` [PATCH net-next 5/6] net/mlx5e: Separate address related variables to be in struct Tariq Toukan
2025-03-04  7:23   ` Michal Swiatkowski
2025-02-26 11:47 ` [PATCH net-next 6/6] net/mlx5e: Properly match IPsec subnet addresses Tariq Toukan
2025-03-04  7:50   ` Michal Swiatkowski
2025-03-04  8:05     ` Leon Romanovsky
2025-03-04  9:51       ` Michal Swiatkowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z8bNPRtzOBZ7LdGJ@mev-dev.igk.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).