From: Valentine Fatiev <valentinef@nvidia.com>
Subject: [PATCH] BACKPORT:
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c

Change-Id: I9855117c5fecde6f22fa0614e55c570a400537af
---
 .../mellanox/mlx5/core/en_accel/tls_rxtx.c    | 20 +++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
@@ -31,6 +31,8 @@
  *
  */
 
+#ifdef HAVE_UAPI_LINUX_TLS_H
+
 #include "en_accel/tls.h"
 #include "en_accel/tls_rxtx.h"
 #include "accel/accel.h"
@@ -298,6 +300,7 @@ err_out:
 	return false;
 }
 
+#ifdef HAVE_TLS_OFFLOAD_RX_RESYNC_REQUEST
 static int tls_update_resync_sn(struct net_device *netdev,
 				struct sk_buff *skb,
 				struct mlx5e_tls_metadata *mdata)
@@ -321,11 +324,17 @@ static int tls_update_resync_sn(struct n
 #if IS_ENABLED(CONFIG_IPV6)
 	} else {
 		struct ipv6hdr *ipv6h = (struct ipv6hdr *)iph;
-
+#ifdef HAVE___INET6_LOOKUP_ESTABLISHED_HAS_7_PARAMS
 		sk = __inet6_lookup_established(dev_net(netdev), &tcp_hashinfo,
 						&ipv6h->saddr, th->source,
 						&ipv6h->daddr, ntohs(th->dest),
-						netdev->ifindex, 0);
+						netdev->ifindex);
+#else
+		sk = __inet6_lookup_established(dev_net(netdev), &tcp_hashinfo,
+				&ipv6h->saddr, th->source,
+				&ipv6h->daddr, ntohs(th->dest),
+				netdev->ifindex, 0);
+#endif
 #endif
 	}
 	if (!sk || sk->sk_state == TCP_TIME_WAIT) {
@@ -343,6 +352,7 @@ static int tls_update_resync_sn(struct n
 out:
 	return 0;
 }
+#endif
 
 /* FPGA tls rx handler */
 void mlx5e_tls_handle_rx_skb_metadata(struct mlx5e_rq *rq, struct sk_buff *skb,
@@ -354,14 +364,18 @@ void mlx5e_tls_handle_rx_skb_metadata(st
 	/* Use the metadata */
 	mdata = (struct mlx5e_tls_metadata *)(skb->data + ETH_HLEN);
 	switch (mdata->content.recv.syndrome) {
+#ifdef HAVE_SK_BUFF_DECRYPTED
 	case SYNDROM_DECRYPTED:
 		skb->decrypted = 1;
 		break;
+#endif
+#ifdef HAVE_TLS_OFFLOAD_RX_RESYNC_REQUEST
 	case SYNDROM_RESYNC_REQUEST:
 		tls_update_resync_sn(rq->netdev, skb, mdata);
 		priv = netdev_priv(rq->netdev);
 		atomic64_inc(&priv->tls->sw_stats.rx_tls_resync_request);
 		break;
+#endif
 	case SYNDROM_AUTH_FAILED:
 		/* Authentication failure will be observed and verified by kTLS */
 		priv = netdev_priv(rq->netdev);
@@ -388,3 +402,5 @@ u16 mlx5e_tls_get_stop_room(struct mlx5_
 	/* Resync SKB. */
 	return mlx5e_stop_room_for_max_wqe(mdev);
 }
+
+#endif
