verbs.c (d02cac152c97dffcb0cdd91e09b54fd6e2cca63d) | verbs.c (21a428a019c9a6d133e745b529b9bf18c1187e70) |
---|---|
1/* QLogic qedr NIC Driver 2 * Copyright (c) 2015-2016 QLogic Corporation 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 53 unchanged lines hidden (view full) --- 62{ 63 size_t min_len = min_t(size_t, len, udata->outlen); 64 65 return ib_copy_to_udata(udata, src, min_len); 66} 67 68int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) 69{ | 1/* QLogic qedr NIC Driver 2 * Copyright (c) 2015-2016 QLogic Corporation 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 53 unchanged lines hidden (view full) --- 62{ 63 size_t min_len = min_t(size_t, len, udata->outlen); 64 65 return ib_copy_to_udata(udata, src, min_len); 66} 67 68int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) 69{ |
70 if (index > QEDR_ROCE_PKEY_TABLE_LEN) | 70 if (index >= QEDR_ROCE_PKEY_TABLE_LEN) |
71 return -EINVAL; 72 73 *pkey = QEDR_ROCE_PKEY_DEFAULT; 74 return 0; 75} 76 77int qedr_iw_query_gid(struct ib_device *ibdev, u8 port, 78 int index, union ib_gid *sgid) --- 366 unchanged lines hidden (view full) --- 445 return -EINVAL; 446 } 447 448 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); 449 return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, len, 450 vma->vm_page_prot); 451} 452 | 71 return -EINVAL; 72 73 *pkey = QEDR_ROCE_PKEY_DEFAULT; 74 return 0; 75} 76 77int qedr_iw_query_gid(struct ib_device *ibdev, u8 port, 78 int index, union ib_gid *sgid) --- 366 unchanged lines hidden (view full) --- 445 return -EINVAL; 446 } 447 448 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); 449 return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, len, 450 vma->vm_page_prot); 451} 452 |
453struct ib_pd *qedr_alloc_pd(struct ib_device *ibdev, 454 struct ib_ucontext *context, struct ib_udata *udata) | 453int qedr_alloc_pd(struct ib_pd *ibpd, struct ib_ucontext *context, 454 struct ib_udata *udata) |
455{ | 455{ |
456 struct ib_device *ibdev = ibpd->device; |
|
456 struct qedr_dev *dev = get_qedr_dev(ibdev); | 457 struct qedr_dev *dev = get_qedr_dev(ibdev); |
457 struct qedr_pd *pd; | 458 struct qedr_pd *pd = get_qedr_pd(ibpd); |
458 u16 pd_id; 459 int rc; 460 461 DP_DEBUG(dev, QEDR_MSG_INIT, "Function called from: %s\n", 462 (udata && context) ? "User Lib" : "Kernel"); 463 464 if (!dev->rdma_ctx) { 465 DP_ERR(dev, "invalid RDMA context\n"); | 459 u16 pd_id; 460 int rc; 461 462 DP_DEBUG(dev, QEDR_MSG_INIT, "Function called from: %s\n", 463 (udata && context) ? "User Lib" : "Kernel"); 464 465 if (!dev->rdma_ctx) { 466 DP_ERR(dev, "invalid RDMA context\n"); |
466 return ERR_PTR(-EINVAL); | 467 return -EINVAL; |
467 } 468 | 468 } 469 |
469 pd = kzalloc(sizeof(*pd), GFP_KERNEL); 470 if (!pd) 471 return ERR_PTR(-ENOMEM); 472 | |
473 rc = dev->ops->rdma_alloc_pd(dev->rdma_ctx, &pd_id); 474 if (rc) | 470 rc = dev->ops->rdma_alloc_pd(dev->rdma_ctx, &pd_id); 471 if (rc) |
475 goto err; | 472 return rc; |
476 477 pd->pd_id = pd_id; 478 479 if (udata && context) { 480 struct qedr_alloc_pd_uresp uresp = { 481 .pd_id = pd_id, 482 }; 483 484 rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 485 if (rc) { 486 DP_ERR(dev, "copy error pd_id=0x%x.\n", pd_id); 487 dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd_id); | 473 474 pd->pd_id = pd_id; 475 476 if (udata && context) { 477 struct qedr_alloc_pd_uresp uresp = { 478 .pd_id = pd_id, 479 }; 480 481 rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 482 if (rc) { 483 DP_ERR(dev, "copy error pd_id=0x%x.\n", pd_id); 484 dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd_id); |
488 goto err; | 485 return rc; |
489 } 490 491 pd->uctx = get_qedr_ucontext(context); 492 pd->uctx->pd = pd; 493 } 494 | 486 } 487 488 pd->uctx = get_qedr_ucontext(context); 489 pd->uctx->pd = pd; 490 } 491 |
495 return &pd->ibpd; 496 497err: 498 kfree(pd); 499 return ERR_PTR(rc); | 492 return 0; |
500} 501 | 493} 494 |
502int qedr_dealloc_pd(struct ib_pd *ibpd) | 495void qedr_dealloc_pd(struct ib_pd *ibpd) |
503{ 504 struct qedr_dev *dev = get_qedr_dev(ibpd->device); 505 struct qedr_pd *pd = get_qedr_pd(ibpd); 506 | 496{ 497 struct qedr_dev *dev = get_qedr_dev(ibpd->device); 498 struct qedr_pd *pd = get_qedr_pd(ibpd); 499 |
507 if (!pd) { 508 pr_err("Invalid PD received in dealloc_pd\n"); 509 return -EINVAL; 510 } 511 | |
512 DP_DEBUG(dev, QEDR_MSG_INIT, "Deallocating PD %d\n", pd->pd_id); 513 dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd->pd_id); | 500 DP_DEBUG(dev, QEDR_MSG_INIT, "Deallocating PD %d\n", pd->pd_id); 501 dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd->pd_id); |
514 515 kfree(pd); 516 517 return 0; | |
518} 519 520static void qedr_free_pbl(struct qedr_dev *dev, 521 struct qedr_pbl_info *pbl_info, struct qedr_pbl *pbl) 522{ 523 struct pci_dev *pdev = dev->pdev; 524 int i; 525 --- 205 unchanged lines hidden (view full) --- 731 732 /* We allocate an extra entry that we don't report to the FW. */ 733 size = (entries + 1) * QEDR_CQE_SIZE; 734 aligned_size = ALIGN(size, PAGE_SIZE); 735 736 return aligned_size / QEDR_CQE_SIZE; 737} 738 | 502} 503 504static void qedr_free_pbl(struct qedr_dev *dev, 505 struct qedr_pbl_info *pbl_info, struct qedr_pbl *pbl) 506{ 507 struct pci_dev *pdev = dev->pdev; 508 int i; 509 --- 205 unchanged lines hidden (view full) --- 715 716 /* We allocate an extra entry that we don't report to the FW. */ 717 size = (entries + 1) * QEDR_CQE_SIZE; 718 aligned_size = ALIGN(size, PAGE_SIZE); 719 720 return aligned_size / QEDR_CQE_SIZE; 721} 722 |
739static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx, | 723static inline int qedr_init_user_queue(struct ib_udata *udata, |
740 struct qedr_dev *dev, | 724 struct qedr_dev *dev, |
741 struct qedr_userq *q, 742 u64 buf_addr, size_t buf_len, 743 int access, int dmasync, | 725 struct qedr_userq *q, u64 buf_addr, 726 size_t buf_len, int access, int dmasync, |
744 int alloc_and_init) 745{ 746 u32 fw_pages; 747 int rc; 748 749 q->buf_addr = buf_addr; 750 q->buf_len = buf_len; | 727 int alloc_and_init) 728{ 729 u32 fw_pages; 730 int rc; 731 732 q->buf_addr = buf_addr; 733 q->buf_len = buf_len; |
751 q->umem = ib_umem_get(ib_ctx, q->buf_addr, q->buf_len, access, dmasync); | 734 q->umem = ib_umem_get(udata, q->buf_addr, q->buf_len, access, dmasync); |
752 if (IS_ERR(q->umem)) { 753 DP_ERR(dev, "create user queue: failed ib_umem_get, got %ld\n", 754 PTR_ERR(q->umem)); 755 return PTR_ERR(q->umem); 756 } 757 758 fw_pages = ib_umem_page_count(q->umem) << 759 (q->umem->page_shift - FW_PAGE_SHIFT); --- 140 unchanged lines hidden (view full) --- 900 if (!ureq.len) { 901 DP_ERR(dev, 902 "create cq: cannot create a cq with 0 entries\n"); 903 goto err0; 904 } 905 906 cq->cq_type = QEDR_CQ_TYPE_USER; 907 | 735 if (IS_ERR(q->umem)) { 736 DP_ERR(dev, "create user queue: failed ib_umem_get, got %ld\n", 737 PTR_ERR(q->umem)); 738 return PTR_ERR(q->umem); 739 } 740 741 fw_pages = ib_umem_page_count(q->umem) << 742 (q->umem->page_shift - FW_PAGE_SHIFT); --- 140 unchanged lines hidden (view full) --- 883 if (!ureq.len) { 884 DP_ERR(dev, 885 "create cq: cannot create a cq with 0 entries\n"); 886 goto err0; 887 } 888 889 cq->cq_type = QEDR_CQ_TYPE_USER; 890 |
908 rc = qedr_init_user_queue(ib_ctx, dev, &cq->q, ureq.addr, 909 ureq.len, IB_ACCESS_LOCAL_WRITE, 910 1, 1); | 891 rc = qedr_init_user_queue(udata, dev, &cq->q, ureq.addr, 892 ureq.len, IB_ACCESS_LOCAL_WRITE, 1, 893 1); |
911 if (rc) 912 goto err0; 913 914 pbl_ptr = cq->q.pbl_tbl->pa; 915 page_cnt = cq->q.pbl_info.num_pbes; 916 917 cq->ibcq.cqe = chain_entries; 918 } else { --- 420 unchanged lines hidden (view full) --- 1339 1340 dev->ops->common->chain_free(dev->cdev, &hw_srq->pbl); 1341 1342 dma_free_coherent(&dev->pdev->dev, sizeof(struct rdma_srq_producers), 1343 hw_srq->virt_prod_pair_addr, 1344 hw_srq->phy_prod_pair_addr); 1345} 1346 | 894 if (rc) 895 goto err0; 896 897 pbl_ptr = cq->q.pbl_tbl->pa; 898 page_cnt = cq->q.pbl_info.num_pbes; 899 900 cq->ibcq.cqe = chain_entries; 901 } else { --- 420 unchanged lines hidden (view full) --- 1322 1323 dev->ops->common->chain_free(dev->cdev, &hw_srq->pbl); 1324 1325 dma_free_coherent(&dev->pdev->dev, sizeof(struct rdma_srq_producers), 1326 hw_srq->virt_prod_pair_addr, 1327 hw_srq->phy_prod_pair_addr); 1328} 1329 |
1347static int qedr_init_srq_user_params(struct ib_ucontext *ib_ctx, | 1330static int qedr_init_srq_user_params(struct ib_udata *udata, |
1348 struct qedr_srq *srq, 1349 struct qedr_create_srq_ureq *ureq, 1350 int access, int dmasync) 1351{ 1352 struct scatterlist *sg; 1353 int rc; 1354 | 1331 struct qedr_srq *srq, 1332 struct qedr_create_srq_ureq *ureq, 1333 int access, int dmasync) 1334{ 1335 struct scatterlist *sg; 1336 int rc; 1337 |
1355 rc = qedr_init_user_queue(ib_ctx, srq->dev, &srq->usrq, ureq->srq_addr, | 1338 rc = qedr_init_user_queue(udata, srq->dev, &srq->usrq, ureq->srq_addr, |
1356 ureq->srq_len, access, dmasync, 1); 1357 if (rc) 1358 return rc; 1359 | 1339 ureq->srq_len, access, dmasync, 1); 1340 if (rc) 1341 return rc; 1342 |
1360 srq->prod_umem = ib_umem_get(ib_ctx, ureq->prod_pair_addr, 1361 sizeof(struct rdma_srq_producers), 1362 access, dmasync); | 1343 srq->prod_umem = 1344 ib_umem_get(udata, ureq->prod_pair_addr, 1345 sizeof(struct rdma_srq_producers), access, dmasync); |
1363 if (IS_ERR(srq->prod_umem)) { 1364 qedr_free_pbl(srq->dev, &srq->usrq.pbl_info, srq->usrq.pbl_tbl); 1365 ib_umem_release(srq->usrq.umem); 1366 DP_ERR(srq->dev, 1367 "create srq: failed ib_umem_get for producer, got %ld\n", 1368 PTR_ERR(srq->prod_umem)); 1369 return PTR_ERR(srq->prod_umem); 1370 } --- 58 unchanged lines hidden (view full) --- 1429{ 1430 struct qed_rdma_destroy_srq_in_params destroy_in_params; 1431 struct qed_rdma_create_srq_in_params in_params = {}; 1432 struct qedr_dev *dev = get_qedr_dev(ibpd->device); 1433 struct qed_rdma_create_srq_out_params out_params; 1434 struct qedr_pd *pd = get_qedr_pd(ibpd); 1435 struct qedr_create_srq_ureq ureq = {}; 1436 u64 pbl_base_addr, phy_prod_pair_addr; | 1346 if (IS_ERR(srq->prod_umem)) { 1347 qedr_free_pbl(srq->dev, &srq->usrq.pbl_info, srq->usrq.pbl_tbl); 1348 ib_umem_release(srq->usrq.umem); 1349 DP_ERR(srq->dev, 1350 "create srq: failed ib_umem_get for producer, got %ld\n", 1351 PTR_ERR(srq->prod_umem)); 1352 return PTR_ERR(srq->prod_umem); 1353 } --- 58 unchanged lines hidden (view full) --- 1412{ 1413 struct qed_rdma_destroy_srq_in_params destroy_in_params; 1414 struct qed_rdma_create_srq_in_params in_params = {}; 1415 struct qedr_dev *dev = get_qedr_dev(ibpd->device); 1416 struct qed_rdma_create_srq_out_params out_params; 1417 struct qedr_pd *pd = get_qedr_pd(ibpd); 1418 struct qedr_create_srq_ureq ureq = {}; 1419 u64 pbl_base_addr, phy_prod_pair_addr; |
1437 struct ib_ucontext *ib_ctx = NULL; | |
1438 struct qedr_srq_hwq_info *hw_srq; 1439 u32 page_cnt, page_size; 1440 struct qedr_srq *srq; 1441 int rc = 0; 1442 1443 DP_DEBUG(dev, QEDR_MSG_QP, 1444 "create SRQ called from %s (pd %p)\n", 1445 (udata) ? "User lib" : "kernel", pd); --- 9 unchanged lines hidden (view full) --- 1455 srq->dev = dev; 1456 hw_srq = &srq->hw_srq; 1457 spin_lock_init(&srq->lock); 1458 1459 hw_srq->max_wr = init_attr->attr.max_wr; 1460 hw_srq->max_sges = init_attr->attr.max_sge; 1461 1462 if (udata && ibpd->uobject && ibpd->uobject->context) { | 1420 struct qedr_srq_hwq_info *hw_srq; 1421 u32 page_cnt, page_size; 1422 struct qedr_srq *srq; 1423 int rc = 0; 1424 1425 DP_DEBUG(dev, QEDR_MSG_QP, 1426 "create SRQ called from %s (pd %p)\n", 1427 (udata) ? "User lib" : "kernel", pd); --- 9 unchanged lines hidden (view full) --- 1437 srq->dev = dev; 1438 hw_srq = &srq->hw_srq; 1439 spin_lock_init(&srq->lock); 1440 1441 hw_srq->max_wr = init_attr->attr.max_wr; 1442 hw_srq->max_sges = init_attr->attr.max_sge; 1443 1444 if (udata && ibpd->uobject && ibpd->uobject->context) { |
1463 ib_ctx = ibpd->uobject->context; 1464 | |
1465 if (ib_copy_from_udata(&ureq, udata, sizeof(ureq))) { 1466 DP_ERR(dev, 1467 "create srq: problem copying data from user space\n"); 1468 goto err0; 1469 } 1470 | 1445 if (ib_copy_from_udata(&ureq, udata, sizeof(ureq))) { 1446 DP_ERR(dev, 1447 "create srq: problem copying data from user space\n"); 1448 goto err0; 1449 } 1450 |
1471 rc = qedr_init_srq_user_params(ib_ctx, srq, &ureq, 0, 0); | 1451 rc = qedr_init_srq_user_params(udata, srq, &ureq, 0, 0); |
1472 if (rc) 1473 goto err0; 1474 1475 page_cnt = srq->usrq.pbl_info.num_pbes; 1476 pbl_base_addr = srq->usrq.pbl_tbl->pa; 1477 phy_prod_pair_addr = hw_srq->phy_prod_pair_addr; 1478 page_size = BIT(srq->usrq.umem->page_shift); 1479 } else { --- 214 unchanged lines hidden (view full) --- 1694 struct qedr_qp *qp, 1695 struct ib_pd *ibpd, 1696 struct ib_udata *udata, 1697 struct ib_qp_init_attr *attrs) 1698{ 1699 struct qed_rdma_create_qp_in_params in_params; 1700 struct qed_rdma_create_qp_out_params out_params; 1701 struct qedr_pd *pd = get_qedr_pd(ibpd); | 1452 if (rc) 1453 goto err0; 1454 1455 page_cnt = srq->usrq.pbl_info.num_pbes; 1456 pbl_base_addr = srq->usrq.pbl_tbl->pa; 1457 phy_prod_pair_addr = hw_srq->phy_prod_pair_addr; 1458 page_size = BIT(srq->usrq.umem->page_shift); 1459 } else { --- 214 unchanged lines hidden (view full) --- 1674 struct qedr_qp *qp, 1675 struct ib_pd *ibpd, 1676 struct ib_udata *udata, 1677 struct ib_qp_init_attr *attrs) 1678{ 1679 struct qed_rdma_create_qp_in_params in_params; 1680 struct qed_rdma_create_qp_out_params out_params; 1681 struct qedr_pd *pd = get_qedr_pd(ibpd); |
1702 struct ib_ucontext *ib_ctx = NULL; | |
1703 struct qedr_create_qp_ureq ureq; 1704 int alloc_and_init = rdma_protocol_roce(&dev->ibdev, 1); 1705 int rc = -EINVAL; 1706 | 1682 struct qedr_create_qp_ureq ureq; 1683 int alloc_and_init = rdma_protocol_roce(&dev->ibdev, 1); 1684 int rc = -EINVAL; 1685 |
1707 ib_ctx = ibpd->uobject->context; 1708 | |
1709 memset(&ureq, 0, sizeof(ureq)); 1710 rc = ib_copy_from_udata(&ureq, udata, sizeof(ureq)); 1711 if (rc) { 1712 DP_ERR(dev, "Problem copying data from user space\n"); 1713 return rc; 1714 } 1715 1716 /* SQ - read access only (0), dma sync not required (0) */ | 1686 memset(&ureq, 0, sizeof(ureq)); 1687 rc = ib_copy_from_udata(&ureq, udata, sizeof(ureq)); 1688 if (rc) { 1689 DP_ERR(dev, "Problem copying data from user space\n"); 1690 return rc; 1691 } 1692 1693 /* SQ - read access only (0), dma sync not required (0) */ |
1717 rc = qedr_init_user_queue(ib_ctx, dev, &qp->usq, ureq.sq_addr, | 1694 rc = qedr_init_user_queue(udata, dev, &qp->usq, ureq.sq_addr, |
1718 ureq.sq_len, 0, 0, alloc_and_init); 1719 if (rc) 1720 return rc; 1721 1722 if (!qp->srq) { 1723 /* RQ - read access only (0), dma sync not required (0) */ | 1695 ureq.sq_len, 0, 0, alloc_and_init); 1696 if (rc) 1697 return rc; 1698 1699 if (!qp->srq) { 1700 /* RQ - read access only (0), dma sync not required (0) */ |
1724 rc = qedr_init_user_queue(ib_ctx, dev, &qp->urq, ureq.rq_addr, | 1701 rc = qedr_init_user_queue(udata, dev, &qp->urq, ureq.rq_addr, |
1725 ureq.rq_len, 0, 0, alloc_and_init); 1726 if (rc) 1727 return rc; 1728 } 1729 1730 memset(&in_params, 0, sizeof(in_params)); 1731 qedr_init_common_qp_in_params(dev, pd, qp, attrs, false, &in_params); 1732 in_params.qp_handle_lo = ureq.qp_handle_lo; --- 379 unchanged lines hidden (view full) --- 2112 case QED_ROCE_QP_STATE_INIT: 2113 qp->prev_wqe_size = 0; 2114 qedr_reset_qp_hwq_info(&qp->sq); 2115 qedr_reset_qp_hwq_info(&qp->rq); 2116 break; 2117 default: 2118 status = -EINVAL; 2119 break; | 1702 ureq.rq_len, 0, 0, alloc_and_init); 1703 if (rc) 1704 return rc; 1705 } 1706 1707 memset(&in_params, 0, sizeof(in_params)); 1708 qedr_init_common_qp_in_params(dev, pd, qp, attrs, false, &in_params); 1709 in_params.qp_handle_lo = ureq.qp_handle_lo; --- 379 unchanged lines hidden (view full) --- 2089 case QED_ROCE_QP_STATE_INIT: 2090 qp->prev_wqe_size = 0; 2091 qedr_reset_qp_hwq_info(&qp->sq); 2092 qedr_reset_qp_hwq_info(&qp->rq); 2093 break; 2094 default: 2095 status = -EINVAL; 2096 break; |
2120 }; | 2097 } |
2121 break; 2122 case QED_ROCE_QP_STATE_INIT: 2123 switch (new_state) { 2124 case QED_ROCE_QP_STATE_RTR: 2125 /* Update doorbell (in case post_recv was 2126 * done before move to RTR) 2127 */ 2128 --- 4 unchanged lines hidden (view full) --- 2133 } 2134 break; 2135 case QED_ROCE_QP_STATE_ERR: 2136 break; 2137 default: 2138 /* Invalid state change. */ 2139 status = -EINVAL; 2140 break; | 2098 break; 2099 case QED_ROCE_QP_STATE_INIT: 2100 switch (new_state) { 2101 case QED_ROCE_QP_STATE_RTR: 2102 /* Update doorbell (in case post_recv was 2103 * done before move to RTR) 2104 */ 2105 --- 4 unchanged lines hidden (view full) --- 2110 } 2111 break; 2112 case QED_ROCE_QP_STATE_ERR: 2113 break; 2114 default: 2115 /* Invalid state change. */ 2116 status = -EINVAL; 2117 break; |
2141 }; | 2118 } |
2142 break; 2143 case QED_ROCE_QP_STATE_RTR: 2144 /* RTR->XXX */ 2145 switch (new_state) { 2146 case QED_ROCE_QP_STATE_RTS: 2147 break; 2148 case QED_ROCE_QP_STATE_ERR: 2149 break; 2150 default: 2151 /* Invalid state change. */ 2152 status = -EINVAL; 2153 break; | 2119 break; 2120 case QED_ROCE_QP_STATE_RTR: 2121 /* RTR->XXX */ 2122 switch (new_state) { 2123 case QED_ROCE_QP_STATE_RTS: 2124 break; 2125 case QED_ROCE_QP_STATE_ERR: 2126 break; 2127 default: 2128 /* Invalid state change. */ 2129 status = -EINVAL; 2130 break; |
2154 }; | 2131 } |
2155 break; 2156 case QED_ROCE_QP_STATE_RTS: 2157 /* RTS->XXX */ 2158 switch (new_state) { 2159 case QED_ROCE_QP_STATE_SQD: 2160 break; 2161 case QED_ROCE_QP_STATE_ERR: 2162 break; 2163 default: 2164 /* Invalid state change. */ 2165 status = -EINVAL; 2166 break; | 2132 break; 2133 case QED_ROCE_QP_STATE_RTS: 2134 /* RTS->XXX */ 2135 switch (new_state) { 2136 case QED_ROCE_QP_STATE_SQD: 2137 break; 2138 case QED_ROCE_QP_STATE_ERR: 2139 break; 2140 default: 2141 /* Invalid state change. */ 2142 status = -EINVAL; 2143 break; |
2167 }; | 2144 } |
2168 break; 2169 case QED_ROCE_QP_STATE_SQD: 2170 /* SQD->XXX */ 2171 switch (new_state) { 2172 case QED_ROCE_QP_STATE_RTS: 2173 case QED_ROCE_QP_STATE_ERR: 2174 break; 2175 default: 2176 /* Invalid state change. */ 2177 status = -EINVAL; 2178 break; | 2145 break; 2146 case QED_ROCE_QP_STATE_SQD: 2147 /* SQD->XXX */ 2148 switch (new_state) { 2149 case QED_ROCE_QP_STATE_RTS: 2150 case QED_ROCE_QP_STATE_ERR: 2151 break; 2152 default: 2153 /* Invalid state change. */ 2154 status = -EINVAL; 2155 break; |
2179 }; | 2156 } |
2180 break; 2181 case QED_ROCE_QP_STATE_ERR: 2182 /* ERR->XXX */ 2183 switch (new_state) { 2184 case QED_ROCE_QP_STATE_RESET: 2185 if ((qp->rq.prod != qp->rq.cons) || 2186 (qp->sq.prod != qp->sq.cons)) { 2187 DP_NOTICE(dev, 2188 "Error->Reset with rq/sq not empty rq.prod=%x rq.cons=%x sq.prod=%x sq.cons=%x\n", 2189 qp->rq.prod, qp->rq.cons, qp->sq.prod, 2190 qp->sq.cons); 2191 status = -EINVAL; 2192 } 2193 break; 2194 default: 2195 status = -EINVAL; 2196 break; | 2157 break; 2158 case QED_ROCE_QP_STATE_ERR: 2159 /* ERR->XXX */ 2160 switch (new_state) { 2161 case QED_ROCE_QP_STATE_RESET: 2162 if ((qp->rq.prod != qp->rq.cons) || 2163 (qp->sq.prod != qp->sq.cons)) { 2164 DP_NOTICE(dev, 2165 "Error->Reset with rq/sq not empty rq.prod=%x rq.cons=%x sq.prod=%x sq.cons=%x\n", 2166 qp->rq.prod, qp->rq.cons, qp->sq.prod, 2167 qp->sq.cons); 2168 status = -EINVAL; 2169 } 2170 break; 2171 default: 2172 status = -EINVAL; 2173 break; |
2197 }; | 2174 } |
2198 break; 2199 default: 2200 status = -EINVAL; 2201 break; | 2175 break; 2176 default: 2177 status = -EINVAL; 2178 break; |
2202 }; | 2179 } |
2203 2204 return status; 2205} 2206 2207int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 2208 int attr_mask, struct ib_udata *udata) 2209{ 2210 struct qedr_qp *qp = get_qedr_qp(ibqp); --- 503 unchanged lines hidden (view full) --- 2714 return ERR_PTR(-EINVAL); 2715 2716 mr = kzalloc(sizeof(*mr), GFP_KERNEL); 2717 if (!mr) 2718 return ERR_PTR(rc); 2719 2720 mr->type = QEDR_MR_USER; 2721 | 2180 2181 return status; 2182} 2183 2184int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 2185 int attr_mask, struct ib_udata *udata) 2186{ 2187 struct qedr_qp *qp = get_qedr_qp(ibqp); --- 503 unchanged lines hidden (view full) --- 2691 return ERR_PTR(-EINVAL); 2692 2693 mr = kzalloc(sizeof(*mr), GFP_KERNEL); 2694 if (!mr) 2695 return ERR_PTR(rc); 2696 2697 mr->type = QEDR_MR_USER; 2698 |
2722 mr->umem = ib_umem_get(ibpd->uobject->context, start, len, acc, 0); | 2699 mr->umem = ib_umem_get(udata, start, len, acc, 0); |
2723 if (IS_ERR(mr->umem)) { 2724 rc = -EFAULT; 2725 goto err0; 2726 } 2727 2728 rc = init_mr_info(dev, &mr->info, ib_umem_page_count(mr->umem), 1); 2729 if (rc) 2730 goto err1; --- 1524 unchanged lines hidden --- | 2700 if (IS_ERR(mr->umem)) { 2701 rc = -EFAULT; 2702 goto err0; 2703 } 2704 2705 rc = init_mr_info(dev, &mr->info, ib_umem_page_count(mr->umem), 1); 2706 if (rc) 2707 goto err1; --- 1524 unchanged lines hidden --- |