Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[sfrench/cifs-2.6.git] / drivers / infiniband / hw / qedr / main.c
index a0a7ba0a5af4a0d23a2a7a668e3f7eec313c6d25..533157a2a3be09e754a8425650ae9d4f5d7bb9a0 100644 (file)
@@ -314,7 +314,8 @@ static void qedr_free_mem_sb(struct qedr_dev *dev,
                             struct qed_sb_info *sb_info, int sb_id)
 {
        if (sb_info->sb_virt) {
-               dev->ops->common->sb_release(dev->cdev, sb_info, sb_id);
+               dev->ops->common->sb_release(dev->cdev, sb_info, sb_id,
+                                            QED_SB_TYPE_CNQ);
                dma_free_coherent(&dev->pdev->dev, sizeof(*sb_info->sb_virt),
                                  (void *)sb_info->sb_virt, sb_info->sb_phys);
        }
@@ -506,11 +507,13 @@ static irqreturn_t qedr_irq_handler(int irq, void *handle)
 static void qedr_sync_free_irqs(struct qedr_dev *dev)
 {
        u32 vector;
+       u16 idx;
        int i;
 
        for (i = 0; i < dev->int_info.used_cnt; i++) {
                if (dev->int_info.msix_cnt) {
-                       vector = dev->int_info.msix[i * dev->num_hwfns].vector;
+                       idx = i * dev->num_hwfns + dev->affin_hwfn_idx;
+                       vector = dev->int_info.msix[idx].vector;
                        synchronize_irq(vector);
                        free_irq(vector, &dev->cnq_array[i]);
                }
@@ -522,6 +525,7 @@ static void qedr_sync_free_irqs(struct qedr_dev *dev)
 static int qedr_req_msix_irqs(struct qedr_dev *dev)
 {
        int i, rc = 0;
+       u16 idx;
 
        if (dev->num_cnq > dev->int_info.msix_cnt) {
                DP_ERR(dev,
@@ -531,7 +535,8 @@ static int qedr_req_msix_irqs(struct qedr_dev *dev)
        }
 
        for (i = 0; i < dev->num_cnq; i++) {
-               rc = request_irq(dev->int_info.msix[i * dev->num_hwfns].vector,
+               idx = i * dev->num_hwfns + dev->affin_hwfn_idx;
+               rc = request_irq(dev->int_info.msix[idx].vector,
                                 qedr_irq_handler, 0, dev->cnq_array[i].name,
                                 &dev->cnq_array[i]);
                if (rc) {
@@ -868,6 +873,16 @@ static struct qedr_dev *qedr_add(struct qed_dev *cdev, struct pci_dev *pdev,
        dev->user_dpm_enabled = dev_info.user_dpm_enabled;
        dev->rdma_type = dev_info.rdma_type;
        dev->num_hwfns = dev_info.common.num_hwfns;
+
+       if (IS_IWARP(dev) && QEDR_IS_CMT(dev)) {
+               rc = dev->ops->iwarp_set_engine_affin(cdev, false);
+               if (rc) {
+                       DP_ERR(dev, "iWARP is disabled over a 100g device Enabling it may impact L2 performance. To enable it run devlink dev param set <dev> name iwarp_cmt value true cmode runtime\n");
+                       goto init_err;
+               }
+       }
+       dev->affin_hwfn_idx = dev->ops->common->get_affin_hwfn_idx(cdev);
+
        dev->rdma_ctx = dev->ops->rdma_get_rdma_ctx(cdev);
 
        dev->num_cnq = dev->ops->rdma_get_min_cnq_msix(cdev);
@@ -928,6 +943,10 @@ static void qedr_remove(struct qedr_dev *dev)
        qedr_stop_hw(dev);
        qedr_sync_free_irqs(dev);
        qedr_free_resources(dev);
+
+       if (IS_IWARP(dev) && QEDR_IS_CMT(dev))
+               dev->ops->iwarp_set_engine_affin(dev->cdev, true);
+
        ib_dealloc_device(&dev->ibdev);
 }