Blob Blame History Raw
From: Maxim Mikityanskiy <maximmi@mellanox.com>
Date: Fri, 6 Dec 2019 16:14:57 +0200
Subject: net/mlx5e: Pass only eseg to IPSEC offload
Patch-mainline: v5.8-rc1
Git-commit: 0bdb078c74854c48bffa323899f2e0c5ca924e72
References: jsc#SLE-15172

IPSEC offload needs to modify the eseg of the WQE that is being filled,
but it receives a pointer to the whole WQE. To make the contract
stricter, pass only the pointer to the eseg of that WQE. This commit is
preparation for the following refactoring of offloads in the TX path and
for the MPWQE support.

Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h   |    2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c |    4 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
@@ -117,7 +117,7 @@ static inline bool mlx5e_accel_handle_tx
 
 #ifdef CONFIG_MLX5_EN_IPSEC
 	if (test_bit(MLX5E_SQ_STATE_IPSEC, &sq->state)) {
-		if (unlikely(!mlx5e_ipsec_handle_tx_skb(dev, *wqe, skb)))
+		if (unlikely(!mlx5e_ipsec_handle_tx_skb(dev, &(*wqe)->eth, skb)))
 			return false;
 	}
 #endif
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
@@ -234,7 +234,7 @@ static void mlx5e_ipsec_set_metadata(str
 }
 
 bool mlx5e_ipsec_handle_tx_skb(struct net_device *netdev,
-			       struct mlx5e_tx_wqe *wqe,
+			       struct mlx5_wqe_eth_seg *eseg,
 			       struct sk_buff *skb)
 {
 	struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -276,7 +276,7 @@ bool mlx5e_ipsec_handle_tx_skb(struct ne
 		atomic64_inc(&priv->ipsec->sw_stats.ipsec_tx_drop_metadata);
 		goto drop;
 	}
-	mlx5e_ipsec_set_swp(skb, &wqe->eth, x->props.mode, xo);
+	mlx5e_ipsec_set_swp(skb, eseg, x->props.mode, xo);
 	sa_entry = (struct mlx5e_ipsec_sa_entry *)x->xso.offload_handle;
 	sa_entry->set_iv_op(skb, x, xo);
 	mlx5e_ipsec_set_metadata(skb, mdata, xo);
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
@@ -53,7 +53,7 @@ void mlx5e_ipsec_set_iv_esn(struct sk_bu
 void mlx5e_ipsec_set_iv(struct sk_buff *skb, struct xfrm_state *x,
 			struct xfrm_offload *xo);
 bool mlx5e_ipsec_handle_tx_skb(struct net_device *netdev,
-			       struct mlx5e_tx_wqe *wqe,
+			       struct mlx5_wqe_eth_seg *eseg,
 			       struct sk_buff *skb);
 
 #endif /* CONFIG_MLX5_EN_IPSEC */