git: 3503aa0cdcb0 - main - mlx5en: Handle install SA for ipv6 encapsulated case

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 22 Sep 2024 16:07:51 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=3503aa0cdcb01f141fbc1b60746e840e06ac4987

commit 3503aa0cdcb01f141fbc1b60746e840e06ac4987
Author:     Ariel Ehrenberg <aehrenberg@nvidia.com>
AuthorDate: 2024-09-10 12:26:15 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-09-22 16:06:02 +0000

    mlx5en: Handle install SA for ipv6 encapsulated case
    
    Pass the right encap flag to network card
    
    Sponsored by:   NVidia networking
    MFC after:      1 week
---
 sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c b/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c
index e348ab1992a5..9523dc8d5e95 100644
--- a/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c
+++ b/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c
@@ -388,14 +388,19 @@ setup_pkt_transport_reformat(struct mlx5_accel_esp_xfrm_attrs *attrs,
 	__be32 spi;
 	void *hdr;
 
-	if (attrs->family == AF_INET)
+	if (attrs->family == AF_INET) {
 		if (attrs->encap)
 			reformat_params->type = MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV4;
 		else
 			reformat_params->type = MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4;
-	else
-		reformat_params->type =
-			MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6;
+	} else {
+		if (attrs->encap)
+			reformat_params->type =
+			    MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV6;
+		else
+			reformat_params->type =
+			    MLX5_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6;
+	}
 
 	if (attrs->encap)
 		bfflen += sizeof(*udphdr);