diff mbox series

[v5,net-next,35/36] net/mlx5e: NVMEoTCP DDGST TX offload optimization

Message ID 20210722110325.371-36-borisp@nvidia.com
State New
Headers show
Series nvme-tcp receive and tarnsmit offloads | expand

Commit Message

Boris Pismenny July 22, 2021, 11:03 a.m. UTC
From: Yoray Zack <yorayz@nvidia.com>

Stop offloading NVMEoTCP OOO packets which aren't contains the pdu DDGST field.

When the driver indicate an OOO NVMEoTCP packet he check if it contains
NVMEoTCP PDU DDGST field, if so he offloads it, otherwise he isn't.

Signed-off-by: Yoray Zack <yorayz@nvidia.com>
---
 .../mellanox/mlx5/core/en_accel/nvmeotcp.c    | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/nvmeotcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/nvmeotcp.c
index f8cba90679ea..f3ef92167e25 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/nvmeotcp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/nvmeotcp.c
@@ -1393,6 +1393,20 @@  bool mlx5e_nvmeotcp_resync_cap(struct mlx5e_nvmeotcp_queue *queue,
 	return false;
 }
 
+static
+bool mlx5e_nvmeotcp_check_if_need_offload(struct mlx5e_nvmeotcp_queue *queue,
+					  u32  end_seq, u32 start_seq)
+{
+	if (!queue->end_seq_hint)
+		return false;
+
+	/* check if skb end after pdu crc start */
+	if (before(queue->end_seq_hint, end_seq) || before(start_seq, queue->start_pdu_hint))
+		return false;
+
+	return true;
+}
+
 static enum mlx5e_nvmeotcp_resync_retval
 mlx5e_nvmeotcp_handle_ooo_skb(struct mlx5e_nvmeotcp_queue *queue,
 			      struct mlx5e_txqsq *sq, struct sk_buff *skb,
@@ -1400,12 +1414,21 @@  mlx5e_nvmeotcp_handle_ooo_skb(struct mlx5e_nvmeotcp_queue *queue,
 {
 	struct ulp_ddp_pdu_info *pdu_info = NULL;
 
+	if (mlx5e_nvmeotcp_check_if_need_offload(queue, seq + datalen, seq)) {
+		return MLX5E_NVMEOTCP_RESYNC_SKIP;
+
 	/* ask for pdu_info that includes the tcp_seq */
 	pdu_info = ulp_ddp_get_pdu_info(skb->sk, seq);
 
 	if (!pdu_info)
 		return MLX5E_NVMEOTCP_RESYNC_SKIP;
 
+	queue->end_seq_hint = pdu_info->end_seq - 4;
+	queue->start_pdu_hint = pdu_info->start_seq;
+	/* check if this packet contain crc - if so offload else no */
+	if (mlx5e_nvmeotcp_check_if_need_offload(queue, seq + datalen, seq)) {
+		return MLX5E_NVMEOTCP_RESYNC_SKIP;
+
 	/*update NIC about resync - he will rebuild parse machine
 	 *send psv with small fence
 	 */