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.
Unified · Split
| @@ -731,7 +731,7 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata, · 730 unmodified lines | ||
| 731 | 731 | int entries, u32 **cqb, |
| 732 | 732 | int *cqe_size, int *index, int *inlen) |
| 733 | 733 | { |
| 734 | − struct mlx5_ib_create_cq ucmd; | |
| 734 | + struct mlx5_ib_create_cq ucmd = {}; | |
| 735 | 735 | size_t ucmdlen; |
| 736 | 736 | int page_shift; |
| 737 | 737 | __be64 *pas; |
| @@ -792,8 +792,36 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata, · 54 unmodified lines | ||
| 792 | 792 | |
| 793 | 793 | *index = to_mucontext(context)->uuari.uars[0].index; |
| 794 | 794 | |
| 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 | + | |
| 795 | 820 | return 0; |
| 796 | 821 | |
| 822 | +err_cqb: | |
| 823 | + kfree(cqb); | |
| 824 | + | |
| 797 | 825 | err_db: |
| 798 | 826 | mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db); |
| 799 | 827 | |
| @@ -149,7 +149,9 @@ struct mlx5_ib_create_cq { · 148 unmodified lines | ||
| 149 | 149 | __u64 buf_addr; |
| 150 | 150 | __u64 db_addr; |
| 151 | 151 | __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) */ | |
| 153 | 155 | }; |
| 154 | 156 | |
| 155 | 157 | struct mlx5_ib_create_cq_resp { |