From: Leon Romanovsky Date: Fri, 13 Feb 2026 10:57:46 +0000 (+0200) Subject: RDMA/mlx5: Save 4 bytes in CQ structure X-Git-Tag: v7.1-rc1~75^2~100 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eebea464f548923a7d624002a04c50fd600a1cf5;p=thirdparty%2Fkernel%2Flinux.git RDMA/mlx5: Save 4 bytes in CQ structure There is no need to maintain separate, nearly empty create_flags and private_flags fields. Unifying them reduces memory usage. Link: https://patch.msgid.link/20260213-refactor-umem-v1-10-f3be85847922@nvidia.com Signed-off-by: Leon Romanovsky --- diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index d0cd3f805bcb..839958d15a83 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c @@ -983,7 +983,8 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, spin_lock_init(&cq->lock); cq->resize_buf = NULL; cq->resize_umem = NULL; - cq->create_flags = attr->flags; + if (attr->flags & IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION) + cq->private_flags |= MLX5_IB_CQ_PR_TIMESTAMP_COMPLETION; INIT_LIST_HEAD(&cq->list_send_qp); INIT_LIST_HEAD(&cq->list_recv_qp); @@ -1017,7 +1018,7 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, MLX5_SET(cqc, cqc, uar_page, index); MLX5_SET(cqc, cqc, c_eqn_or_apu_element, eqn); MLX5_SET64(cqc, cqc, dbr_addr, cq->db.dma); - if (cq->create_flags & IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN) + if (attr->flags & IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN) MLX5_SET(cqc, cqc, oi, 1); if (udata) { diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 4f4114d95130..ce3372aea48b 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h @@ -561,6 +561,7 @@ struct mlx5_ib_cq_buf { enum mlx5_ib_cq_pr_flags { MLX5_IB_CQ_PR_FLAGS_CQE_128_PAD = 1 << 0, MLX5_IB_CQ_PR_FLAGS_REAL_TIME_TS = 1 << 1, + MLX5_IB_CQ_PR_TIMESTAMP_COMPLETION = 1 << 2, }; struct mlx5_ib_cq { @@ -581,7 +582,6 @@ struct mlx5_ib_cq { int cqe_size; struct list_head list_send_qp; struct list_head list_recv_qp; - u32 create_flags; struct list_head wc_list; enum ib_cq_notify_flags notify_flags; struct work_struct notify_work; diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 47de8cc9937e..59f9ddb35d46 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -1273,7 +1273,7 @@ static int get_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, } return MLX5_TIMESTAMP_FORMAT_REAL_TIME; } - if (cq->create_flags & IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION) { + if (cq->private_flags & MLX5_IB_CQ_PR_TIMESTAMP_COMPLETION) { if (!fr_sup) { mlx5_ib_dbg(dev, "Free running TS format is not supported\n");