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. Signed-off-by: Bodong Wang <bodong@mellanox.com> Reviewed-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
7e43a2a5ba
commit
1cbe6fc86c
@ -731,7 +731,7 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata,
|
|||||||
int entries, u32 **cqb,
|
int entries, u32 **cqb,
|
||||||
int *cqe_size, int *index, int *inlen)
|
int *cqe_size, int *index, int *inlen)
|
||||||
{
|
{
|
||||||
struct mlx5_ib_create_cq ucmd;
|
struct mlx5_ib_create_cq ucmd = {};
|
||||||
size_t ucmdlen;
|
size_t ucmdlen;
|
||||||
int page_shift;
|
int page_shift;
|
||||||
__be64 *pas;
|
__be64 *pas;
|
||||||
@ -792,8 +792,36 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata,
|
|||||||
|
|
||||||
*index = to_mucontext(context)->uuari.uars[0].index;
|
*index = to_mucontext(context)->uuari.uars[0].index;
|
||||||
|
|
||||||
|
if (ucmd.cqe_comp_en == 1) {
|
||||||
|
if (unlikely((*cqe_size != 64) ||
|
||||||
|
!MLX5_CAP_GEN(dev->mdev, cqe_compression))) {
|
||||||
|
err = -EOPNOTSUPP;
|
||||||
|
mlx5_ib_warn(dev, "CQE compression is not supported for size %d!\n",
|
||||||
|
*cqe_size);
|
||||||
|
goto err_cqb;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unlikely(!ucmd.cqe_comp_res_format ||
|
||||||
|
!(ucmd.cqe_comp_res_format <
|
||||||
|
MLX5_IB_CQE_RES_RESERVED) ||
|
||||||
|
(ucmd.cqe_comp_res_format &
|
||||||
|
(ucmd.cqe_comp_res_format - 1)))) {
|
||||||
|
err = -EOPNOTSUPP;
|
||||||
|
mlx5_ib_warn(dev, "CQE compression res format %d is not supported!\n",
|
||||||
|
ucmd.cqe_comp_res_format);
|
||||||
|
goto err_cqb;
|
||||||
|
}
|
||||||
|
|
||||||
|
MLX5_SET(cqc, cqc, cqe_comp_en, 1);
|
||||||
|
MLX5_SET(cqc, cqc, mini_cqe_res_format,
|
||||||
|
ilog2(ucmd.cqe_comp_res_format));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_cqb:
|
||||||
|
kfree(cqb);
|
||||||
|
|
||||||
err_db:
|
err_db:
|
||||||
mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db);
|
mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db);
|
||||||
|
|
||||||
|
@ -149,7 +149,9 @@ struct mlx5_ib_create_cq {
|
|||||||
__u64 buf_addr;
|
__u64 buf_addr;
|
||||||
__u64 db_addr;
|
__u64 db_addr;
|
||||||
__u32 cqe_size;
|
__u32 cqe_size;
|
||||||
__u32 reserved; /* explicit padding (optional on i386) */
|
__u8 cqe_comp_en;
|
||||||
|
__u8 cqe_comp_res_format;
|
||||||
|
__u16 reserved; /* explicit padding (optional on i386) */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ib_create_cq_resp {
|
struct mlx5_ib_create_cq_resp {
|
||||||
|
Loading…
Reference in New Issue
Block a user