Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b77d2bd authored by Eli Cohen's avatar Eli Cohen Committed by Roland Dreier
Browse files

mlx5: Use enum to indicate adapter page size



The Connect-IB adapter has an inherent page size which equals 4K.
Define an new enum that equals the page shift and use it instead of
using the value 12 throughout the code.

Signed-off-by: default avatarEli Cohen <eli@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent c2a3431e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -620,7 +620,7 @@ static int create_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq,
	}
	}
	mlx5_fill_page_array(&cq->buf.buf, (*cqb)->pas);
	mlx5_fill_page_array(&cq->buf.buf, (*cqb)->pas);


	(*cqb)->ctx.log_pg_sz = cq->buf.buf.page_shift - 12;
	(*cqb)->ctx.log_pg_sz = cq->buf.buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT;
	*index = dev->mdev.priv.uuari.uars[0].index;
	*index = dev->mdev.priv.uuari.uars[0].index;


	return 0;
	return 0;
+3 −2
Original line number Original line Diff line number Diff line
@@ -551,7 +551,7 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
	}
	}
	mlx5_ib_populate_pas(dev, qp->umem, page_shift, (*in)->pas, 0);
	mlx5_ib_populate_pas(dev, qp->umem, page_shift, (*in)->pas, 0);
	(*in)->ctx.log_pg_sz_remote_qpn =
	(*in)->ctx.log_pg_sz_remote_qpn =
		cpu_to_be32((page_shift - 12) << 24);
		cpu_to_be32((page_shift - MLX5_ADAPTER_PAGE_SHIFT) << 24);
	(*in)->ctx.params2 = cpu_to_be32(offset << 6);
	(*in)->ctx.params2 = cpu_to_be32(offset << 6);


	(*in)->ctx.qp_counter_set_usr_page = cpu_to_be32(uar_index);
	(*in)->ctx.qp_counter_set_usr_page = cpu_to_be32(uar_index);
@@ -648,7 +648,8 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev,
		goto err_buf;
		goto err_buf;
	}
	}
	(*in)->ctx.qp_counter_set_usr_page = cpu_to_be32(uar_index);
	(*in)->ctx.qp_counter_set_usr_page = cpu_to_be32(uar_index);
	(*in)->ctx.log_pg_sz_remote_qpn = cpu_to_be32((qp->buf.page_shift - 12) << 24);
	(*in)->ctx.log_pg_sz_remote_qpn =
		cpu_to_be32((qp->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT) << 24);
	/* Set "fast registration enabled" for all kernel QPs */
	/* Set "fast registration enabled" for all kernel QPs */
	(*in)->ctx.params1 |= cpu_to_be32(1 << 11);
	(*in)->ctx.params1 |= cpu_to_be32(1 << 11);
	(*in)->ctx.sq_crq_size |= cpu_to_be16(1 << 4);
	(*in)->ctx.sq_crq_size |= cpu_to_be16(1 << 4);
+2 −2
Original line number Original line Diff line number Diff line
@@ -123,7 +123,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
		goto err_in;
		goto err_in;
	}
	}


	(*in)->ctx.log_pg_sz = page_shift - 12;
	(*in)->ctx.log_pg_sz = page_shift - MLX5_ADAPTER_PAGE_SHIFT;
	(*in)->ctx.pgoff_cqn = cpu_to_be32(offset << 26);
	(*in)->ctx.pgoff_cqn = cpu_to_be32(offset << 26);


	return 0;
	return 0;
@@ -192,7 +192,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq,
	}
	}
	srq->wq_sig = !!srq_signature;
	srq->wq_sig = !!srq_signature;


	(*in)->ctx.log_pg_sz = page_shift - 12;
	(*in)->ctx.log_pg_sz = page_shift - MLX5_ADAPTER_PAGE_SHIFT;


	return 0;
	return 0;


+1 −1
Original line number Original line Diff line number Diff line
@@ -354,7 +354,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
	in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_CREATE_EQ);
	in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_CREATE_EQ);
	in->ctx.log_sz_usr_page = cpu_to_be32(ilog2(eq->nent) << 24 | uar->index);
	in->ctx.log_sz_usr_page = cpu_to_be32(ilog2(eq->nent) << 24 | uar->index);
	in->ctx.intr = vecidx;
	in->ctx.intr = vecidx;
	in->ctx.log_page_size = eq->buf.page_shift - 12;
	in->ctx.log_page_size = eq->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT;
	in->events_mask = cpu_to_be64(mask);
	in->events_mask = cpu_to_be64(mask);


	err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out));
	err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out));
+4 −0
Original line number Original line Diff line number Diff line
@@ -230,6 +230,10 @@ enum {
	MLX5_MAX_PAGE_SHIFT		= 31
	MLX5_MAX_PAGE_SHIFT		= 31
};
};


enum {
	MLX5_ADAPTER_PAGE_SHIFT		= 12
};

enum {
enum {
	MLX5_CAP_OFF_DCT		= 41,
	MLX5_CAP_OFF_DCT		= 41,
	MLX5_CAP_OFF_CMDIF_CSUM		= 46,
	MLX5_CAP_OFF_CMDIF_CSUM		= 46,