RDMA/qedr: Use pci_enable_atomic_ops_to_root()
Use PCI core interface pci_enable_atomic_ops_to_root() to enable atomic capability. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Michal Kalderon <michal.kalderon@cavium.com> CC: Ram Amrani <Ram.Amrani@cavium.com> CC: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
430a23689d
commit
20c3ff6114
@ -430,59 +430,16 @@ static void qedr_remove_sysfiles(struct qedr_dev *dev)
|
||||
|
||||
static void qedr_pci_set_atomic(struct qedr_dev *dev, struct pci_dev *pdev)
|
||||
{
|
||||
struct pci_dev *bridge;
|
||||
u32 ctl2, cap2;
|
||||
u16 flags;
|
||||
int rc;
|
||||
int rc = pci_enable_atomic_ops_to_root(pdev,
|
||||
PCI_EXP_DEVCAP2_ATOMIC_COMP64);
|
||||
|
||||
bridge = pdev->bus->self;
|
||||
if (!bridge)
|
||||
goto disable;
|
||||
|
||||
/* Check atomic routing support all the way to root complex */
|
||||
while (bridge->bus->parent) {
|
||||
rc = pcie_capability_read_word(bridge, PCI_EXP_FLAGS, &flags);
|
||||
if (rc || ((flags & PCI_EXP_FLAGS_VERS) < 2))
|
||||
goto disable;
|
||||
|
||||
rc = pcie_capability_read_dword(bridge, PCI_EXP_DEVCAP2, &cap2);
|
||||
if (rc)
|
||||
goto disable;
|
||||
|
||||
rc = pcie_capability_read_dword(bridge, PCI_EXP_DEVCTL2, &ctl2);
|
||||
if (rc)
|
||||
goto disable;
|
||||
|
||||
if (!(cap2 & PCI_EXP_DEVCAP2_ATOMIC_ROUTE) ||
|
||||
(ctl2 & PCI_EXP_DEVCTL2_ATOMIC_EGRESS_BLOCK))
|
||||
goto disable;
|
||||
bridge = bridge->bus->parent->self;
|
||||
if (rc) {
|
||||
dev->atomic_cap = IB_ATOMIC_NONE;
|
||||
DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability disabled\n");
|
||||
} else {
|
||||
dev->atomic_cap = IB_ATOMIC_GLOB;
|
||||
DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability enabled\n");
|
||||
}
|
||||
|
||||
rc = pcie_capability_read_word(bridge, PCI_EXP_FLAGS, &flags);
|
||||
if (rc || ((flags & PCI_EXP_FLAGS_VERS) < 2))
|
||||
goto disable;
|
||||
|
||||
rc = pcie_capability_read_dword(bridge, PCI_EXP_DEVCAP2, &cap2);
|
||||
if (rc || !(cap2 & PCI_EXP_DEVCAP2_ATOMIC_COMP64))
|
||||
goto disable;
|
||||
|
||||
/* Set atomic operations */
|
||||
pcie_capability_set_word(pdev, PCI_EXP_DEVCTL2,
|
||||
PCI_EXP_DEVCTL2_ATOMIC_REQ);
|
||||
dev->atomic_cap = IB_ATOMIC_GLOB;
|
||||
|
||||
DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability enabled\n");
|
||||
|
||||
return;
|
||||
|
||||
disable:
|
||||
pcie_capability_clear_word(pdev, PCI_EXP_DEVCTL2,
|
||||
PCI_EXP_DEVCTL2_ATOMIC_REQ);
|
||||
dev->atomic_cap = IB_ATOMIC_NONE;
|
||||
|
||||
DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability disabled\n");
|
||||
|
||||
}
|
||||
|
||||
static const struct qed_rdma_ops *qed_ops;
|
||||
|
Loading…
Reference in New Issue
Block a user