Skip to content

Commit f31c32e

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: "A few minor fixes: - Fix buffer management in SRP to correct a regression with the login authentication feature from v5.17 - Don't iterate over non-present ports in mlx5 - Fix an error introduced by the foritify work in cxgb4 - Two bug fixes for the recently merged ERDMA driver - Unbreak RDMA dmabuf support, a regresion from v5.19" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA: Handle the return code from dma_resv_wait_timeout() properly RDMA/erdma: Correct the max_qp and max_cq capacities of the device RDMA/erdma: Using the key in FMR WR instead of MR structure RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size RDMA/mlx5: Use the proper number of ports IB/iser: Fix login with authentication
2 parents b9bce6e + b16de8b commit f31c32e

File tree

7 files changed

+42
-40
lines changed

7 files changed

+42
-40
lines changed

drivers/infiniband/core/umem_dmabuf.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf)
1818
struct scatterlist *sg;
1919
unsigned long start, end, cur = 0;
2020
unsigned int nmap = 0;
21+
long ret;
2122
int i;
2223

2324
dma_resv_assert_held(umem_dmabuf->attach->dmabuf->resv);
@@ -67,9 +68,14 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf)
6768
* may be not up-to-date. Wait for the exporter to finish
6869
* the migration.
6970
*/
70-
return dma_resv_wait_timeout(umem_dmabuf->attach->dmabuf->resv,
71+
ret = dma_resv_wait_timeout(umem_dmabuf->attach->dmabuf->resv,
7172
DMA_RESV_USAGE_KERNEL,
7273
false, MAX_SCHEDULE_TIMEOUT);
74+
if (ret < 0)
75+
return ret;
76+
if (ret == 0)
77+
return -ETIMEDOUT;
78+
return 0;
7379
}
7480
EXPORT_SYMBOL(ib_umem_dmabuf_map_pages);
7581

drivers/infiniband/hw/cxgb4/cm.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,31 +2468,24 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
24682468
opt2 |= CCTRL_ECN_V(1);
24692469
}
24702470

2471-
skb_get(skb);
2472-
rpl = cplhdr(skb);
24732471
if (!is_t4(adapter_type)) {
2474-
BUILD_BUG_ON(sizeof(*rpl5) != roundup(sizeof(*rpl5), 16));
2475-
skb_trim(skb, sizeof(*rpl5));
2476-
rpl5 = (void *)rpl;
2477-
INIT_TP_WR(rpl5, ep->hwtid);
2478-
} else {
2479-
skb_trim(skb, sizeof(*rpl));
2480-
INIT_TP_WR(rpl, ep->hwtid);
2481-
}
2482-
OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL,
2483-
ep->hwtid));
2484-
2485-
if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) {
24862472
u32 isn = (prandom_u32() & ~7UL) - 1;
2473+
2474+
skb = get_skb(skb, roundup(sizeof(*rpl5), 16), GFP_KERNEL);
2475+
rpl5 = __skb_put_zero(skb, roundup(sizeof(*rpl5), 16));
2476+
rpl = (void *)rpl5;
2477+
INIT_TP_WR_CPL(rpl5, CPL_PASS_ACCEPT_RPL, ep->hwtid);
24872478
opt2 |= T5_OPT_2_VALID_F;
24882479
opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE);
24892480
opt2 |= T5_ISS_F;
2490-
rpl5 = (void *)rpl;
2491-
memset_after(rpl5, 0, iss);
24922481
if (peer2peer)
24932482
isn += 4;
24942483
rpl5->iss = cpu_to_be32(isn);
24952484
pr_debug("iss %u\n", be32_to_cpu(rpl5->iss));
2485+
} else {
2486+
skb = get_skb(skb, sizeof(*rpl), GFP_KERNEL);
2487+
rpl = __skb_put_zero(skb, sizeof(*rpl));
2488+
INIT_TP_WR_CPL(rpl, CPL_PASS_ACCEPT_RPL, ep->hwtid);
24962489
}
24972490

24982491
rpl->opt0 = cpu_to_be64(opt0);

drivers/infiniband/hw/erdma/erdma_qp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static int erdma_push_one_sqe(struct erdma_qp *qp, u16 *pi,
407407
to_erdma_access_flags(reg_wr(send_wr)->access);
408408
regmr_sge->addr = cpu_to_le64(mr->ibmr.iova);
409409
regmr_sge->length = cpu_to_le32(mr->ibmr.length);
410-
regmr_sge->stag = cpu_to_le32(mr->ibmr.lkey);
410+
regmr_sge->stag = cpu_to_le32(reg_wr(send_wr)->key);
411411
attrs = FIELD_PREP(ERDMA_SQE_MR_MODE_MASK, 0) |
412412
FIELD_PREP(ERDMA_SQE_MR_ACCESS_MASK, mr->access) |
413413
FIELD_PREP(ERDMA_SQE_MR_MTT_CNT_MASK,

drivers/infiniband/hw/erdma/erdma_verbs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ int erdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr,
280280
attr->vendor_id = PCI_VENDOR_ID_ALIBABA;
281281
attr->vendor_part_id = dev->pdev->device;
282282
attr->hw_ver = dev->pdev->revision;
283-
attr->max_qp = dev->attrs.max_qp;
283+
attr->max_qp = dev->attrs.max_qp - 1;
284284
attr->max_qp_wr = min(dev->attrs.max_send_wr, dev->attrs.max_recv_wr);
285285
attr->max_qp_rd_atom = dev->attrs.max_ord;
286286
attr->max_qp_init_rd_atom = dev->attrs.max_ird;
@@ -291,7 +291,7 @@ int erdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr,
291291
attr->max_send_sge = dev->attrs.max_send_sge;
292292
attr->max_recv_sge = dev->attrs.max_recv_sge;
293293
attr->max_sge_rd = dev->attrs.max_sge_rd;
294-
attr->max_cq = dev->attrs.max_cq;
294+
attr->max_cq = dev->attrs.max_cq - 1;
295295
attr->max_cqe = dev->attrs.max_cqe;
296296
attr->max_mr = dev->attrs.max_mr;
297297
attr->max_pd = dev->attrs.max_pd;

drivers/infiniband/hw/mlx5/main.c

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,26 +2738,24 @@ static int set_has_smi_cap(struct mlx5_ib_dev *dev)
27382738
int err;
27392739
int port;
27402740

2741-
for (port = 1; port <= ARRAY_SIZE(dev->port_caps); port++) {
2742-
dev->port_caps[port - 1].has_smi = false;
2743-
if (MLX5_CAP_GEN(dev->mdev, port_type) ==
2744-
MLX5_CAP_PORT_TYPE_IB) {
2745-
if (MLX5_CAP_GEN(dev->mdev, ib_virt)) {
2746-
err = mlx5_query_hca_vport_context(dev->mdev, 0,
2747-
port, 0,
2748-
&vport_ctx);
2749-
if (err) {
2750-
mlx5_ib_err(dev, "query_hca_vport_context for port=%d failed %d\n",
2751-
port, err);
2752-
return err;
2753-
}
2754-
dev->port_caps[port - 1].has_smi =
2755-
vport_ctx.has_smi;
2756-
} else {
2757-
dev->port_caps[port - 1].has_smi = true;
2758-
}
2741+
if (MLX5_CAP_GEN(dev->mdev, port_type) != MLX5_CAP_PORT_TYPE_IB)
2742+
return 0;
2743+
2744+
for (port = 1; port <= dev->num_ports; port++) {
2745+
if (!MLX5_CAP_GEN(dev->mdev, ib_virt)) {
2746+
dev->port_caps[port - 1].has_smi = true;
2747+
continue;
27592748
}
2749+
err = mlx5_query_hca_vport_context(dev->mdev, 0, port, 0,
2750+
&vport_ctx);
2751+
if (err) {
2752+
mlx5_ib_err(dev, "query_hca_vport_context for port=%d failed %d\n",
2753+
port, err);
2754+
return err;
2755+
}
2756+
dev->port_caps[port - 1].has_smi = vport_ctx.has_smi;
27602757
}
2758+
27612759
return 0;
27622760
}
27632761

drivers/infiniband/ulp/iser/iser_initiator.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc)
537537
struct iscsi_hdr *hdr;
538538
char *data;
539539
int length;
540+
bool full_feature_phase;
540541

541542
if (unlikely(wc->status != IB_WC_SUCCESS)) {
542543
iser_err_comp(wc, "login_rsp");
@@ -550,6 +551,9 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc)
550551
hdr = desc->rsp + sizeof(struct iser_ctrl);
551552
data = desc->rsp + ISER_HEADERS_LEN;
552553
length = wc->byte_len - ISER_HEADERS_LEN;
554+
full_feature_phase = ((hdr->flags & ISCSI_FULL_FEATURE_PHASE) ==
555+
ISCSI_FULL_FEATURE_PHASE) &&
556+
(hdr->flags & ISCSI_FLAG_CMD_FINAL);
553557

554558
iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode,
555559
hdr->itt, length);
@@ -560,7 +564,8 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc)
560564
desc->rsp_dma, ISER_RX_LOGIN_SIZE,
561565
DMA_FROM_DEVICE);
562566

563-
if (iser_conn->iscsi_conn->session->discovery_sess)
567+
if (!full_feature_phase ||
568+
iser_conn->iscsi_conn->session->discovery_sess)
564569
return;
565570

566571
/* Post the first RX buffer that is skipped in iser_post_rx_bufs() */

drivers/net/ethernet/chelsio/cxgb4/t4_msg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ struct cpl_t5_pass_accept_rpl {
497497
__be32 opt2;
498498
__be64 opt0;
499499
__be32 iss;
500-
__be32 rsvd[3];
500+
__be32 rsvd;
501501
};
502502

503503
struct cpl_act_open_req {

0 commit comments

Comments
 (0)