]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
RDMA/bnxt_re: Report supported value to IB stack in query_device
authorSelvin Xavier <selvin.xavier@broadcom.com>
Thu, 29 Jun 2017 19:28:12 +0000 (12:28 -0700)
committerDoug Ledford <dledford@redhat.com>
Thu, 20 Jul 2017 15:20:50 +0000 (11:20 -0400)
- Report supported value for max_mr_size to IB stack in query_device.
   Also, check and log if MR size requested by application in
   reg_user_mr() is greater than value currently supported by driver.
 - Report only 4K page size support for now
 - Fix Max_QP value returned by ibv_devinfo -vv.
   In case of PF, FW reserves 129 QPs for creating QP1s of VFs
   and PF. So the max_qp value reported by FW for PF doesn'tt include
   the QP1. Fixing this issue by adding 1 with the value reported
   by FW.

Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/bnxt_re/bnxt_re.h
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/qplib_sp.c

index 08772836fded416e41be8eccfe53cf3e8427691b..4cb257dc61be60122129b1915c08d01e40c7fe7a 100644 (file)
@@ -51,6 +51,8 @@
 #define BNXT_RE_PAGE_SIZE_8M           BIT(23)
 #define BNXT_RE_PAGE_SIZE_1G           BIT(30)
 
+#define BNXT_RE_MAX_MR_SIZE            BIT(30)
+
 #define BNXT_RE_MAX_QPC_COUNT          (64 * 1024)
 #define BNXT_RE_MAX_MRW_COUNT          (64 * 1024)
 #define BNXT_RE_MAX_SRQC_COUNT         (64 * 1024)
index 0cd8372989ce4d4f194bf137d65500ca432e431a..4e3e5b91d8556c7fb36ebcc8c348f4fc24cf23fd 100644 (file)
@@ -145,10 +145,8 @@ int bnxt_re_query_device(struct ib_device *ibdev,
        ib_attr->fw_ver = (u64)(unsigned long)(dev_attr->fw_ver);
        bnxt_qplib_get_guid(rdev->netdev->dev_addr,
                            (u8 *)&ib_attr->sys_image_guid);
-       ib_attr->max_mr_size = ~0ull;
-       ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_8K |
-                                BNXT_RE_PAGE_SIZE_64K | BNXT_RE_PAGE_SIZE_2M |
-                                BNXT_RE_PAGE_SIZE_8M | BNXT_RE_PAGE_SIZE_1G;
+       ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
+       ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K;
 
        ib_attr->vendor_id = rdev->en_dev->pdev->vendor;
        ib_attr->vendor_part_id = rdev->en_dev->pdev->device;
@@ -3229,6 +3227,12 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,
        struct scatterlist *sg;
        int entry;
 
+       if (length > BNXT_RE_MAX_MR_SIZE) {
+               dev_err(rdev_to_dev(rdev), "MR Size: %lld > Max supported:%ld\n",
+                       length, BNXT_RE_MAX_MR_SIZE);
+               return ERR_PTR(-ENOMEM);
+       }
+
        mr = kzalloc(sizeof(*mr), GFP_KERNEL);
        if (!mr)
                return ERR_PTR(-ENOMEM);
index fde18cf0e406b9f78e2af96d70077622f3d02732..5827573875d483295ae3e5e2607759099f146721 100644 (file)
@@ -81,6 +81,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
 
        /* Extract the context from the side buffer */
        attr->max_qp = le32_to_cpu(sb->max_qp);
+       /* max_qp value reported by FW for PF doesn't include the QP1 for PF */
+       attr->max_qp += 1;
        attr->max_qp_rd_atom =
                sb->max_qp_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ?
                BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom;