RDMA/vmw_pvrdma: Update device query parameters and port caps
authorAdit Ranadive <aditr@vmware.com>
Wed, 23 Aug 2017 06:19:01 +0000 (23:19 -0700)
committerDoug Ledford <dledford@redhat.com>
Thu, 24 Aug 2017 21:34:57 +0000 (17:34 -0400)
Added support for two device caps - max_sge_rd, max_fast_reg_page_list_len
and the IP_BASED_GIDS port cap flag.

Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Reviewed-by: Bryan Tan <bryantan@vmware.com>
Reviewed-by: Aditya Sarwade <asarwade@vmware.com>
Signed-off-by: Adit Ranadive <aditr@vmware.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c

index 3a308ffe00bd48eca3253618fe4054581a666d95..df0a6b5250210db9f0dec11a71115517df20fbff 100644 (file)
        ((_dev->dsr->caps.mode == PVRDMA_DEVICE_MODE_ROCE) &&           \
         (PVRDMA_IS_VERSION17(_dev) || PVRDMA_IS_VERSION18(_dev)))
 
+/*
+ * Get capability values based on device version.
+ */
+
+#define PVRDMA_GET_CAP(_dev, _old_val, _val) \
+       ((PVRDMA_IS_VERSION18(_dev)) ? _val : _old_val)
+
 enum pvrdma_pci_resource {
        PVRDMA_PCI_RESOURCE_MSIX,       /* BAR0: MSI-X, MMIO. */
        PVRDMA_PCI_RESOURCE_REG,        /* BAR1: Registers, MMIO. */
@@ -251,7 +258,7 @@ struct pvrdma_device_caps {
        u8  atomic_ops;                         /* PVRDMA_ATOMIC_OP_* bits */
        u8  bmme_flags;                         /* FRWR Mem Mgmt Extensions */
        u8  gid_types;                          /* PVRDMA_GID_TYPE_FLAG_ */
-       u8  reserved[4];
+       u32 max_fast_reg_page_list_len;
 };
 
 struct pvrdma_ring_page_info {
index 28517042011d4774371fe83cf5e7c74c4d33833b..48776f5ffb0e105cdb0a5fb6e52a7ddd663e04e9 100644 (file)
@@ -83,6 +83,8 @@ int pvrdma_query_device(struct ib_device *ibdev,
        props->max_qp_wr = dev->dsr->caps.max_qp_wr;
        props->device_cap_flags = dev->dsr->caps.device_cap_flags;
        props->max_sge = dev->dsr->caps.max_sge;
+       props->max_sge_rd = PVRDMA_GET_CAP(dev, dev->dsr->caps.max_sge,
+                                          dev->dsr->caps.max_sge_rd);
        props->max_cq = dev->dsr->caps.max_cq;
        props->max_cqe = dev->dsr->caps.max_cqe;
        props->max_mr = dev->dsr->caps.max_mr;
@@ -101,8 +103,14 @@ int pvrdma_query_device(struct ib_device *ibdev,
            (dev->dsr->caps.bmme_flags & PVRDMA_BMME_FLAG_REMOTE_INV) &&
            (dev->dsr->caps.bmme_flags & PVRDMA_BMME_FLAG_FAST_REG_WR)) {
                props->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS;
+               props->max_fast_reg_page_list_len = PVRDMA_GET_CAP(dev,
+                               PVRDMA_MAX_FAST_REG_PAGES,
+                               dev->dsr->caps.max_fast_reg_page_list_len);
        }
 
+       props->device_cap_flags |= IB_DEVICE_PORT_ACTIVE_EVENT |
+                                  IB_DEVICE_RC_RNR_NAK_GEN;
+
        return 0;
 }
 
@@ -143,6 +151,7 @@ int pvrdma_query_port(struct ib_device *ibdev, u8 port,
        props->gid_tbl_len = resp->attrs.gid_tbl_len;
        props->port_cap_flags =
                pvrdma_port_cap_flags_to_ib(resp->attrs.port_cap_flags);
+       props->port_cap_flags |= IB_PORT_CM_SUP | IB_PORT_IP_BASED_GIDS;
        props->max_msg_sz = resp->attrs.max_msg_sz;
        props->bad_pkey_cntr = resp->attrs.bad_pkey_cntr;
        props->qkey_viol_cntr = resp->attrs.qkey_viol_cntr;