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
Unified · Split
| @@ -278,7 +278,6 @@ static int do_get_hw_stats(struct ib_device *ibdev, · 277 unmodified lines | ||
| 278 | 278 | const struct mlx5_ib_counters *cnts = get_counters(dev, port_num - 1); |
| 279 | 279 | struct mlx5_core_dev *mdev; |
| 280 | 280 | int ret, num_counters; |
| 281 | − u32 mdev_port_num; | |
| 282 | 281 | |
| 283 | 282 | if (!stats) |
| 284 | 283 | return -EINVAL; |
| @@ -299,8 +298,9 @@ static int do_get_hw_stats(struct ib_device *ibdev, · 14 unmodified lines | ||
| 299 | 298 | } |
| 300 | 299 | |
| 301 | 300 | 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); | |
| 304 | 304 | if (!mdev) { |
| 305 | 305 | /* If port is not affiliated yet, its in down state |
| 306 | 306 | * which doesn't have any counters yet, so it would be |
| @@ -4502,6 +4502,40 @@ static bool mlx5_ib_modify_qp_allowed(struct mlx5_ib_dev *dev, · 4501 unmodified lines | ||
| 4502 | 4502 | return false; |
| 4503 | 4503 | } |
| 4504 | 4504 | |
| 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 | + | |
| 4505 | 4539 | int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
| 4506 | 4540 | int attr_mask, struct ib_udata *udata) |
| 4507 | 4541 | { |
| @@ -4589,21 +4623,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 81 unmodified lines | ||
| 4589 | 4623 | goto out; |
| 4590 | 4624 | } |
| 4591 | 4625 | |
| 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)) | |
| 4605 | 4627 | goto out; |
| 4606 | − } | |
| 4607 | 4628 | |
| 4608 | 4629 | if (cur_state == new_state && cur_state == IB_QPS_RESET) { |
| 4609 | 4630 | err = 0; |
| @@ -62,9 +62,6 @@ enum { · 61 unmodified lines | ||
| 62 | 62 | SRP_DEFAULT_CMD_SQ_SIZE = SRP_DEFAULT_QUEUE_SIZE - SRP_RSP_SQ_SIZE - |
| 63 | 63 | SRP_TSK_MGMT_SQ_SIZE, |
| 64 | 64 | |
| 65 | − SRP_TAG_NO_REQ = ~0U, | |
| 66 | − SRP_TAG_TSK_MGMT = 1U << 31, | |
| 67 | − | |
| 68 | 65 | SRP_MAX_PAGES_PER_MR = 512, |
| 69 | 66 | |
| 70 | 67 | SRP_MAX_ADD_CDB_LEN = 16, |
| @@ -79,6 +76,11 @@ enum { · 8 unmodified lines | ||
| 79 | 76 | sizeof(struct srp_imm_buf), |
| 80 | 77 | }; |
| 81 | 78 | |
| 79 | +enum { | |
| 80 | + SRP_TAG_NO_REQ = ~0U, | |
| 81 | + SRP_TAG_TSK_MGMT = BIT(31), | |
| 82 | +}; | |
| 83 | + | |
| 82 | 84 | enum srp_target_state { |
| 83 | 85 | SRP_TARGET_SCANNING, |
| 84 | 86 | SRP_TARGET_LIVE, |
| @@ -476,7 +476,7 @@ int sg_alloc_append_table_from_pages(struct sg_append_table *sgt_append, · 475 unmodified lines | ||
| 476 | 476 | /* Merge contiguous pages into the last SG */ |
| 477 | 477 | prv_len = sgt_append->prv->length; |
| 478 | 478 | 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)) { | |
| 480 | 480 | if (sgt_append->prv->length + PAGE_SIZE > max_segment) |
| 481 | 481 | break; |
| 482 | 482 | sgt_append->prv->length += PAGE_SIZE; |