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

Change-Id: I92bcf893a32c3833c68549923dcf36e97e790806
---
 .../mellanox/mlx5/core/en_accel/ktls.h        | 50 ++++++++++---------
 1 file changed, 27 insertions(+), 23 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
@@ -6,9 +6,17 @@
 
 #include "en.h"
 
-#ifdef CONFIG_MLX5_EN_TLS
-
+#if defined CONFIG_MLX5_EN_TLS && defined HAVE_KTLS_STRUCTS
 void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv);
+bool mlx5e_accel_is_ktls_rx(struct mlx5_core_dev *mdev);
+#else
+static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
+{
+}
+static inline bool mlx5e_accel_is_ktls_rx(struct mlx5_core_dev *mdev) { return false; }
+#endif
+
+#if defined(CONFIG_MLX5_EN_TLS) && defined(HAVE_KTLS_RX_SUPPORT)
 int mlx5e_ktls_init_rx(struct mlx5e_priv *priv);
 void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv);
 int mlx5e_ktls_set_feature_rx(struct net_device *netdev, bool enable);
@@ -16,26 +24,8 @@ struct mlx5e_ktls_resync_resp *
 mlx5e_ktls_rx_resync_create_resp_list(void);
 void mlx5e_ktls_rx_resync_destroy_resp_list(struct mlx5e_ktls_resync_resp *resp_list);
 
-static inline bool mlx5e_accel_is_ktls_tx(struct mlx5_core_dev *mdev)
-{
-	return !is_kdump_kernel() &&
-		mlx5_accel_is_ktls_tx(mdev);
-}
-
-bool mlx5e_accel_is_ktls_rx(struct mlx5_core_dev *mdev);
-
-static inline bool mlx5e_accel_is_ktls_device(struct mlx5_core_dev *mdev)
-{
-	return !is_kdump_kernel() &&
-		mlx5_accel_is_ktls_device(mdev);
-}
 
 #else
-
-static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
-{
-}
-
 static inline int mlx5e_ktls_init_rx(struct mlx5e_priv *priv)
 {
 	return 0;
@@ -60,10 +50,24 @@ mlx5e_ktls_rx_resync_create_resp_list(vo
 static inline void
 mlx5e_ktls_rx_resync_destroy_resp_list(struct mlx5e_ktls_resync_resp *resp_list) {}
 
-static inline bool mlx5e_accel_is_ktls_tx(struct mlx5_core_dev *mdev) { return false; }
-static inline bool mlx5e_accel_is_ktls_rx(struct mlx5_core_dev *mdev) { return false; }
-static inline bool mlx5e_accel_is_ktls_device(struct mlx5_core_dev *mdev) { return false; }
 
 #endif
 
+#if defined(CONFIG_MLX5_EN_TLS)
+static inline bool mlx5e_accel_is_ktls_tx(struct mlx5_core_dev *mdev)
+{
+	return !is_kdump_kernel() &&
+		mlx5_accel_is_ktls_tx(mdev);
+}
+
+
+static inline bool mlx5e_accel_is_ktls_device(struct mlx5_core_dev *mdev)
+{
+	return !is_kdump_kernel() &&
+		mlx5_accel_is_ktls_device(mdev);
+}
+#else
+static inline bool mlx5e_accel_is_ktls_tx(struct mlx5_core_dev *mdev) { return false; }
+static inline bool mlx5e_accel_is_ktls_device(struct mlx5_core_dev *mdev) { return false; }
+#endif
 #endif /* __MLX5E_TLS_H__ */
