History

IB/mlx5: Add support for CQE compressing

CQE compressing reduces PCI overhead by coalescing and compressing multiple CQEs into a single merged CQE. Successful compressing improves message rate especially for small packet traffic. CQE compressing is supported for all 64B CQE formats (with certain limitations) generated by RQ/Responder or by SQ/Requestor.

Bodong Wang committed 10 years ago

Commit 1cbe6fc1 parent 7e43a2a2 files · +32 −2Browse files

Unified · Split

2 files
  1. drivers/infiniband/hw/mlx5/cq.c +29 −1
  2. include/uapi/rdma/mlx5-abi.h +3 −1
drivers/infiniband/hw/mlx5/cq.c+29−1
@@ -731,7 +731,7 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata, · 730 unmodified lines
731731 int entries, u32 **cqb,
732732 int *cqe_size, int *index, int *inlen)
733733 {
734− struct mlx5_ib_create_cq ucmd;
734+ struct mlx5_ib_create_cq ucmd = {};
735735 size_t ucmdlen;
736736 int page_shift;
737737 __be64 *pas;
@@ -792,8 +792,36 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata, · 54 unmodified lines
792792
793793 *index = to_mucontext(context)->uuari.uars[0].index;
794794
795+ if (ucmd.cqe_comp_en == 1) {
796+ if (unlikely((*cqe_size != 64) ||
797+ !MLX5_CAP_GEN(dev->mdev, cqe_compression))) {
798+ err = -EOPNOTSUPP;
799+ mlx5_ib_warn(dev, "CQE compression is not supported for size %d!\n",
800+ *cqe_size);
801+ goto err_cqb;
802+ }
803+
804+ if (unlikely(!ucmd.cqe_comp_res_format ||
805+ !(ucmd.cqe_comp_res_format <
806+ MLX5_IB_CQE_RES_RESERVED) ||
807+ (ucmd.cqe_comp_res_format &
808+ (ucmd.cqe_comp_res_format - 1)))) {
809+ err = -EOPNOTSUPP;
810+ mlx5_ib_warn(dev, "CQE compression res format %d is not supported!\n",
811+ ucmd.cqe_comp_res_format);
812+ goto err_cqb;
813+ }
814+
815+ MLX5_SET(cqc, cqc, cqe_comp_en, 1);
816+ MLX5_SET(cqc, cqc, mini_cqe_res_format,
817+ ilog2(ucmd.cqe_comp_res_format));
818+ }
819+
795820 return 0;
796821
822+err_cqb:
823+ kfree(cqb);
824+
797825 err_db:
798826 mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db);
799827
include/uapi/rdma/mlx5-abi.h+3−1
@@ -149,7 +149,9 @@ struct mlx5_ib_create_cq { · 148 unmodified lines
149149 __u64 buf_addr;
150150 __u64 db_addr;
151151 __u32 cqe_size;
152− __u32 reserved; /* explicit padding (optional on i386) */
152+ __u8 cqe_comp_en;
153+ __u8 cqe_comp_res_format;
154+ __u16 reserved; /* explicit padding (optional on i386) */
153155 };
154156
155157 struct mlx5_ib_create_cq_resp {