aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/cq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mlx4/cq.c')
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 7360bbafbe84..d2e32b03e2f7 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -297,6 +297,20 @@ static void mlx4_ib_handle_error_cqe(struct mlx4_err_cqe *cqe,
297 wc->vendor_err = cqe->vendor_err_syndrome; 297 wc->vendor_err = cqe->vendor_err_syndrome;
298} 298}
299 299
300static int mlx4_ib_ipoib_csum_ok(__be32 status, __be16 checksum)
301{
302 return ((status & cpu_to_be32(MLX4_CQE_IPOIB_STATUS_IPV4 |
303 MLX4_CQE_IPOIB_STATUS_IPV4F |
304 MLX4_CQE_IPOIB_STATUS_IPV4OPT |
305 MLX4_CQE_IPOIB_STATUS_IPV6 |
306 MLX4_CQE_IPOIB_STATUS_IPOK)) ==
307 cpu_to_be32(MLX4_CQE_IPOIB_STATUS_IPV4 |
308 MLX4_CQE_IPOIB_STATUS_IPOK)) &&
309 (status & cpu_to_be32(MLX4_CQE_IPOIB_STATUS_UDP |
310 MLX4_CQE_IPOIB_STATUS_TCP)) &&
311 checksum == cpu_to_be16(0xffff);
312}
313
300static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, 314static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
301 struct mlx4_ib_qp **cur_qp, 315 struct mlx4_ib_qp **cur_qp,
302 struct ib_wc *wc) 316 struct ib_wc *wc)
@@ -434,6 +448,8 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
434 wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; 448 wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;
435 wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0; 449 wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0;
436 wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f; 450 wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f;
451 wc->csum_ok = mlx4_ib_ipoib_csum_ok(cqe->ipoib_status,
452 cqe->checksum);
437 } 453 }
438 454
439 return 0; 455 return 0;