@@ -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
*/