net/mlx: fix support for new Rx checksum flags
authorNelio Laranjeiro <nelio.laranjeiro@6wind.com>
Wed, 2 Nov 2016 10:39:39 +0000 (11:39 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 7 Nov 2016 17:42:29 +0000 (18:42 +0100)
Fixes: 5842289a546c ("mbuf: add new Rx checksum flags")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
drivers/net/mlx4/mlx4.c
drivers/net/mlx5/mlx5_rxtx.c

index faa9acd..da61a85 100644 (file)
@@ -2995,25 +2995,20 @@ rxq_cq_to_ol_flags(const struct rxq *rxq, uint32_t flags)
 
        if (rxq->csum)
                ol_flags |=
-                       TRANSPOSE(~flags,
+                       TRANSPOSE(flags,
                                  IBV_EXP_CQ_RX_IP_CSUM_OK,
-                                 PKT_RX_IP_CKSUM_BAD) |
-                       TRANSPOSE(~flags,
+                                 PKT_RX_IP_CKSUM_GOOD) |
+                       TRANSPOSE(flags,
                                  IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK,
-                                 PKT_RX_L4_CKSUM_BAD);
-       /*
-        * PKT_RX_IP_CKSUM_BAD and PKT_RX_L4_CKSUM_BAD are used in place
-        * of PKT_RX_EIP_CKSUM_BAD because the latter is not functional
-        * (its value is 0).
-        */
+                                 PKT_RX_L4_CKSUM_GOOD);
        if ((flags & IBV_EXP_CQ_RX_TUNNEL_PACKET) && (rxq->csum_l2tun))
                ol_flags |=
-                       TRANSPOSE(~flags,
+                       TRANSPOSE(flags,
                                  IBV_EXP_CQ_RX_OUTER_IP_CSUM_OK,
-                                 PKT_RX_IP_CKSUM_BAD) |
-                       TRANSPOSE(~flags,
+                                 PKT_RX_IP_CKSUM_GOOD) |
+                       TRANSPOSE(flags,
                                  IBV_EXP_CQ_RX_OUTER_TCP_UDP_CSUM_OK,
-                                 PKT_RX_L4_CKSUM_BAD);
+                                 PKT_RX_L4_CKSUM_GOOD);
        return ol_flags;
 }
 
index 8d5f946..9b59801 100644 (file)
@@ -1237,29 +1237,24 @@ rxq_cq_to_ol_flags(struct rxq *rxq, volatile struct mlx5_cqe *cqe)
 
        if ((l3_hdr == MLX5_CQE_L3_HDR_TYPE_IPV4) ||
            (l3_hdr == MLX5_CQE_L3_HDR_TYPE_IPV6))
-               ol_flags |=
-                       (!(cqe->hds_ip_ext & MLX5_CQE_L3_OK) *
-                        PKT_RX_IP_CKSUM_BAD);
+               ol_flags |= TRANSPOSE(cqe->hds_ip_ext,
+                                     MLX5_CQE_L3_OK,
+                                     PKT_RX_IP_CKSUM_GOOD);
        if ((l4_hdr == MLX5_CQE_L4_HDR_TYPE_TCP) ||
            (l4_hdr == MLX5_CQE_L4_HDR_TYPE_TCP_EMP_ACK) ||
            (l4_hdr == MLX5_CQE_L4_HDR_TYPE_TCP_ACK) ||
            (l4_hdr == MLX5_CQE_L4_HDR_TYPE_UDP))
-               ol_flags |=
-                       (!(cqe->hds_ip_ext & MLX5_CQE_L4_OK) *
-                        PKT_RX_L4_CKSUM_BAD);
-       /*
-        * PKT_RX_IP_CKSUM_BAD and PKT_RX_L4_CKSUM_BAD are used in place
-        * of PKT_RX_EIP_CKSUM_BAD because the latter is not functional
-        * (its value is 0).
-        */
+               ol_flags |= TRANSPOSE(cqe->hds_ip_ext,
+                                     MLX5_CQE_L4_OK,
+                                     PKT_RX_L4_CKSUM_GOOD);
        if ((cqe->pkt_info & MLX5_CQE_RX_TUNNEL_PACKET) && (rxq->csum_l2tun))
                ol_flags |=
-                       TRANSPOSE(~cqe->l4_hdr_type_etc,
+                       TRANSPOSE(cqe->l4_hdr_type_etc,
                                  MLX5_CQE_RX_OUTER_IP_CSUM_OK,
-                                 PKT_RX_IP_CKSUM_BAD) |
-                       TRANSPOSE(~cqe->l4_hdr_type_etc,
+                                 PKT_RX_IP_CKSUM_GOOD) |
+                       TRANSPOSE(cqe->l4_hdr_type_etc,
                                  MLX5_CQE_RX_OUTER_TCP_UDP_CSUM_OK,
-                                 PKT_RX_L4_CKSUM_BAD);
+                                 PKT_RX_L4_CKSUM_GOOD);
        return ol_flags;
 }