]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
net/mlx5e: Rx, Fix checksum calculation for new hardware
[mirror_ubuntu-bionic-kernel.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_rx.c
index 52f7dd0c02dd78909a816a00e9b2d840c01f60aa..0dc924e98f98987f06b676bf70813022cb048525 100644 (file)
@@ -770,8 +770,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;
 
+               rq->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
@@ -781,7 +787,6 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
                                                 network_depth - ETH_HLEN,
                                                 skb->csum);
                mlx5e_skb_padding_csum(skb, network_depth, proto, &rq->stats);
-               rq->stats.csum_complete++;
                return;
        }