Re: [PATCH net-next 1/6] net/mlx5: HWS, Enable IPSec hardware offload in legacy mode

From: Jianbo Liu
Date: Mon Jul 14 2025 - 11:07:30 EST




On 7/14/2025 2:43 PM, Michal Swiatkowski wrote:
On Mon, Jul 14, 2025 at 08:39:40AM +0300, Tariq Toukan wrote:
From: Lama Kayal <lkayal@xxxxxxxxxx>

IPSec hardware offload in legacy mode should not be affected by the
steering mode, hence it should also work properly with hmfs mode.

What about dmfs mode? I am not sure, if you didn't remove it because it
is still needed or just forgot about removing it.


It is still needed.
We support packet offload for all steering modes in legacy, and only dmfs in switchdev. This is the logic we added before:

dmfs smfs
legacy Y Y
switchdev Y N

Now we support hmfs. It is the same as smfs. So the table becomes:
dmfs smfs hmfs
legacy Y Y Y
switchdev Y N N

Instead of adding "mdev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_HMFS", We removed "mdev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_SMFS", and the code is simpler and clean.


In case it is ok as it is:
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@xxxxxxxxxxxxxxx>


Yes, it's ok. Thanks for the review.

Jianbo

Thanks


Remove steering mode validation when calculating the cap for packet
offload, this will also enable the missing cap MLX5_IPSEC_CAP_PRIO
needed for crypto offload.

Signed-off-by: Lama Kayal <lkayal@xxxxxxxxxx>
Reviewed-by: Jianbo Liu <jianbol@xxxxxxxxxx>
Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
---
.../net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
index 820debf3fbbf..ef7322d381af 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c
@@ -42,8 +42,7 @@ u32 mlx5_ipsec_device_caps(struct mlx5_core_dev *mdev)
if (MLX5_CAP_IPSEC(mdev, ipsec_full_offload) &&
(mdev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_DMFS ||
- (mdev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_SMFS &&
- is_mdev_legacy_mode(mdev)))) {
+ is_mdev_legacy_mode(mdev))) {
if (MLX5_CAP_FLOWTABLE_NIC_TX(mdev,
reformat_add_esp_trasport) &&
MLX5_CAP_FLOWTABLE_NIC_RX(mdev,
--
2.40.1