]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/infiniband/hw/bnxt_re/qplib_sp.c
RDMA/bnxt_re: Enable atomics only if host bios supports
[karo-tx-linux.git] / drivers / infiniband / hw / bnxt_re / qplib_sp.c
index fde18cf0e406b9f78e2af96d70077622f3d02732..ef91ab786dd4c77930c49c8673ef9206f0df40ac 100644 (file)
@@ -51,6 +51,19 @@ const struct bnxt_qplib_gid bnxt_qplib_gid_zero = {{ 0, 0, 0, 0, 0, 0, 0, 0,
                                                     0, 0, 0, 0, 0, 0, 0, 0 } };
 
 /* Device */
+
+static bool bnxt_qplib_is_atomic_cap(struct bnxt_qplib_rcfw *rcfw)
+{
+       int rc;
+       u16 pcie_ctl2;
+
+       rc = pcie_capability_read_word(rcfw->pdev, PCI_EXP_DEVCTL2,
+                                      &pcie_ctl2);
+       if (rc)
+               return false;
+       return !!(pcie_ctl2 & PCI_EXP_DEVCTL2_ATOMIC_REQ);
+}
+
 int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
                            struct bnxt_qplib_dev_attr *attr)
 {
@@ -81,6 +94,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;
@@ -129,6 +144,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
                attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc);
        }
 
+       attr->is_atomic = bnxt_qplib_is_atomic_cap(rcfw);
 bail:
        bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf);
        return rc;