main.c (498495dba268b20e8eadd7fe93c140c68b6cc9d2) main.c (20c3ff6114b0c32beb85d476d7331ad9ab1942e2)
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:

--- 416 unchanged lines hidden (view full) ---

425 int i;
426
427 for (i = 0; i < ARRAY_SIZE(qedr_attributes); i++)
428 device_remove_file(&dev->ibdev.dev, qedr_attributes[i]);
429}
430
431static void qedr_pci_set_atomic(struct qedr_dev *dev, struct pci_dev *pdev)
432{
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:

--- 416 unchanged lines hidden (view full) ---

425 int i;
426
427 for (i = 0; i < ARRAY_SIZE(qedr_attributes); i++)
428 device_remove_file(&dev->ibdev.dev, qedr_attributes[i]);
429}
430
431static void qedr_pci_set_atomic(struct qedr_dev *dev, struct pci_dev *pdev)
432{
433 struct pci_dev *bridge;
434 u32 ctl2, cap2;
435 u16 flags;
436 int rc;
433 int rc = pci_enable_atomic_ops_to_root(pdev,
434 PCI_EXP_DEVCAP2_ATOMIC_COMP64);
437
435
438 bridge = pdev->bus->self;
439 if (!bridge)
440 goto disable;
441
442 /* Check atomic routing support all the way to root complex */
443 while (bridge->bus->parent) {
444 rc = pcie_capability_read_word(bridge, PCI_EXP_FLAGS, &flags);
445 if (rc || ((flags & PCI_EXP_FLAGS_VERS) < 2))
446 goto disable;
447
448 rc = pcie_capability_read_dword(bridge, PCI_EXP_DEVCAP2, &cap2);
449 if (rc)
450 goto disable;
451
452 rc = pcie_capability_read_dword(bridge, PCI_EXP_DEVCTL2, &ctl2);
453 if (rc)
454 goto disable;
455
456 if (!(cap2 & PCI_EXP_DEVCAP2_ATOMIC_ROUTE) ||
457 (ctl2 & PCI_EXP_DEVCTL2_ATOMIC_EGRESS_BLOCK))
458 goto disable;
459 bridge = bridge->bus->parent->self;
436 if (rc) {
437 dev->atomic_cap = IB_ATOMIC_NONE;
438 DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability disabled\n");
439 } else {
440 dev->atomic_cap = IB_ATOMIC_GLOB;
441 DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability enabled\n");
460 }
442 }
461
462 rc = pcie_capability_read_word(bridge, PCI_EXP_FLAGS, &flags);
463 if (rc || ((flags & PCI_EXP_FLAGS_VERS) < 2))
464 goto disable;
465
466 rc = pcie_capability_read_dword(bridge, PCI_EXP_DEVCAP2, &cap2);
467 if (rc || !(cap2 & PCI_EXP_DEVCAP2_ATOMIC_COMP64))
468 goto disable;
469
470 /* Set atomic operations */
471 pcie_capability_set_word(pdev, PCI_EXP_DEVCTL2,
472 PCI_EXP_DEVCTL2_ATOMIC_REQ);
473 dev->atomic_cap = IB_ATOMIC_GLOB;
474
475 DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability enabled\n");
476
477 return;
478
479disable:
480 pcie_capability_clear_word(pdev, PCI_EXP_DEVCTL2,
481 PCI_EXP_DEVCTL2_ATOMIC_REQ);
482 dev->atomic_cap = IB_ATOMIC_NONE;
483
484 DP_DEBUG(dev, QEDR_MSG_INIT, "Atomic capability disabled\n");
485
486}
487
488static const struct qed_rdma_ops *qed_ops;
489
490#define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo))
491
492static irqreturn_t qedr_irq_handler(int irq, void *handle)
493{

--- 543 unchanged lines hidden ---
443}
444
445static const struct qed_rdma_ops *qed_ops;
446
447#define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo))
448
449static irqreturn_t qedr_irq_handler(int irq, void *handle)
450{

--- 543 unchanged lines hidden ---