Merge tag 'mlx5-fixes-2019-07-11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_rx.c
index 56a2f4666c476f5c9e8ae59d4a4752ab6537bbef..ac6e586d403d8cb6bffdb44fa475efa60b0833c7 100644 (file)
@@ -923,8 +923,14 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
                if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP))
                        goto csum_unnecessary;
 
+               stats->csum_complete++;
                skb->ip_summed = CHECKSUM_COMPLETE;
                skb->csum = csum_unfold((__force __sum16)cqe->check_sum);
+
+               if (test_bit(MLX5E_RQ_STATE_CSUM_FULL, &rq->state))
+                       return; /* CQE csum covers all received bytes */
+
+               /* csum might need some fixups ...*/
                if (network_depth > ETH_HLEN)
                        /* CQE csum is calculated from the IP header and does
                         * not cover VLAN headers (if present). This will add
@@ -935,7 +941,6 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
                                                 skb->csum);
 
                mlx5e_skb_padding_csum(skb, network_depth, proto, stats);
-               stats->csum_complete++;
                return;
        }