Skip to content

Commit 4a4dcea

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "Most noticeable is that Yishai found a big data corruption regression due to a change in the scatterlist: - Do not wrongly combine non-contiguous pages in scatterlist - Fix compilation warnings on gcc 13 - Oops when using some mlx5 stats - Bad enforcement of atomic responder resources in mlx5" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: lib/scatterlist: Fix to merge contiguous pages into the last SG properly RDMA/mlx5: Fix validation of max_rd_atomic caps for DC RDMA/mlx5: Fix mlx5_ib_get_hw_stats when used for device RDMA/srp: Move large values to a new enum for gcc13
2 parents a7c4127 + e95d50d commit 4a4dcea

File tree

4 files changed

+44
-21
lines changed

4 files changed

+44
-21
lines changed

drivers/infiniband/hw/mlx5/counters.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ static int do_get_hw_stats(struct ib_device *ibdev,
278278
const struct mlx5_ib_counters *cnts = get_counters(dev, port_num - 1);
279279
struct mlx5_core_dev *mdev;
280280
int ret, num_counters;
281-
u32 mdev_port_num;
282281

283282
if (!stats)
284283
return -EINVAL;
@@ -299,8 +298,9 @@ static int do_get_hw_stats(struct ib_device *ibdev,
299298
}
300299

301300
if (MLX5_CAP_GEN(dev->mdev, cc_query_allowed)) {
302-
mdev = mlx5_ib_get_native_port_mdev(dev, port_num,
303-
&mdev_port_num);
301+
if (!port_num)
302+
port_num = 1;
303+
mdev = mlx5_ib_get_native_port_mdev(dev, port_num, NULL);
304304
if (!mdev) {
305305
/* If port is not affiliated yet, its in down state
306306
* which doesn't have any counters yet, so it would be

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,40 @@ static bool mlx5_ib_modify_qp_allowed(struct mlx5_ib_dev *dev,
45024502
return false;
45034503
}
45044504

4505+
static int validate_rd_atomic(struct mlx5_ib_dev *dev, struct ib_qp_attr *attr,
4506+
int attr_mask, enum ib_qp_type qp_type)
4507+
{
4508+
int log_max_ra_res;
4509+
int log_max_ra_req;
4510+
4511+
if (qp_type == MLX5_IB_QPT_DCI) {
4512+
log_max_ra_res = 1 << MLX5_CAP_GEN(dev->mdev,
4513+
log_max_ra_res_dc);
4514+
log_max_ra_req = 1 << MLX5_CAP_GEN(dev->mdev,
4515+
log_max_ra_req_dc);
4516+
} else {
4517+
log_max_ra_res = 1 << MLX5_CAP_GEN(dev->mdev,
4518+
log_max_ra_res_qp);
4519+
log_max_ra_req = 1 << MLX5_CAP_GEN(dev->mdev,
4520+
log_max_ra_req_qp);
4521+
}
4522+
4523+
if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC &&
4524+
attr->max_rd_atomic > log_max_ra_res) {
4525+
mlx5_ib_dbg(dev, "invalid max_rd_atomic value %d\n",
4526+
attr->max_rd_atomic);
4527+
return false;
4528+
}
4529+
4530+
if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC &&
4531+
attr->max_dest_rd_atomic > log_max_ra_req) {
4532+
mlx5_ib_dbg(dev, "invalid max_dest_rd_atomic value %d\n",
4533+
attr->max_dest_rd_atomic);
4534+
return false;
4535+
}
4536+
return true;
4537+
}
4538+
45054539
int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
45064540
int attr_mask, struct ib_udata *udata)
45074541
{
@@ -4589,21 +4623,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
45894623
goto out;
45904624
}
45914625

4592-
if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC &&
4593-
attr->max_rd_atomic >
4594-
(1 << MLX5_CAP_GEN(dev->mdev, log_max_ra_res_qp))) {
4595-
mlx5_ib_dbg(dev, "invalid max_rd_atomic value %d\n",
4596-
attr->max_rd_atomic);
4597-
goto out;
4598-
}
4599-
4600-
if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC &&
4601-
attr->max_dest_rd_atomic >
4602-
(1 << MLX5_CAP_GEN(dev->mdev, log_max_ra_req_qp))) {
4603-
mlx5_ib_dbg(dev, "invalid max_dest_rd_atomic value %d\n",
4604-
attr->max_dest_rd_atomic);
4626+
if (!validate_rd_atomic(dev, attr, attr_mask, qp_type))
46054627
goto out;
4606-
}
46074628

46084629
if (cur_state == new_state && cur_state == IB_QPS_RESET) {
46094630
err = 0;

drivers/infiniband/ulp/srp/ib_srp.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ enum {
6262
SRP_DEFAULT_CMD_SQ_SIZE = SRP_DEFAULT_QUEUE_SIZE - SRP_RSP_SQ_SIZE -
6363
SRP_TSK_MGMT_SQ_SIZE,
6464

65-
SRP_TAG_NO_REQ = ~0U,
66-
SRP_TAG_TSK_MGMT = 1U << 31,
67-
6865
SRP_MAX_PAGES_PER_MR = 512,
6966

7067
SRP_MAX_ADD_CDB_LEN = 16,
@@ -79,6 +76,11 @@ enum {
7976
sizeof(struct srp_imm_buf),
8077
};
8178

79+
enum {
80+
SRP_TAG_NO_REQ = ~0U,
81+
SRP_TAG_TSK_MGMT = BIT(31),
82+
};
83+
8284
enum srp_target_state {
8385
SRP_TARGET_SCANNING,
8486
SRP_TARGET_LIVE,

lib/scatterlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ int sg_alloc_append_table_from_pages(struct sg_append_table *sgt_append,
476476
/* Merge contiguous pages into the last SG */
477477
prv_len = sgt_append->prv->length;
478478
last_pg = sg_page(sgt_append->prv);
479-
while (n_pages && pages_are_mergeable(last_pg, pages[0])) {
479+
while (n_pages && pages_are_mergeable(pages[0], last_pg)) {
480480
if (sgt_append->prv->length + PAGE_SIZE > max_segment)
481481
break;
482482
sgt_append->prv->length += PAGE_SIZE;

0 commit comments

Comments
 (0)