{NET,IB}/mlx4: Add rmap support to mlx4_assign_eq
authorAmir Vadai <amirv@mellanox.com>
Wed, 18 Jul 2012 22:33:51 +0000 (22:33 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Jul 2012 15:34:37 +0000 (08:34 -0700)
Enable callers of mlx4_assign_eq to supply a pointer to cpu_rmap.
If supplied, the assigned IRQ is tracked using rmap infrastructure.

Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/infiniband/hw/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/en_cq.c
drivers/net/ethernet/mellanox/mlx4/eq.c
include/linux/mlx4/device.h

index 8a3a2037b005bdecf538cf10d572854b3ba53297..a07b774e78640e90fa7a736f93731dba2a2317e5 100644 (file)
@@ -1159,7 +1159,8 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
                        sprintf(name, "mlx4-ib-%d-%d@%s",
                                i, j, dev->pdev->bus->name);
                        /* Set IRQ for specific name (per ring) */
-                       if (mlx4_assign_eq(dev, name, &ibdev->eq_table[eq])) {
+                       if (mlx4_assign_eq(dev, name, NULL,
+                                          &ibdev->eq_table[eq])) {
                                /* Use legacy (same as mlx4_en driver) */
                                pr_warn("Can't allocate EQ %d; reverting to legacy\n", eq);
                                ibdev->eq_table[eq] =
index 908a460d8db6853af4aaea5473185234d96036f1..0ef61568402188a1daa04af96c12171d0b14d83c 100644 (file)
@@ -91,7 +91,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
                                sprintf(name, "%s-%d", priv->dev->name,
                                        cq->ring);
                                /* Set IRQ for specific name (per ring) */
-                               if (mlx4_assign_eq(mdev->dev, name, &cq->vector)) {
+                               if (mlx4_assign_eq(mdev->dev, name, NULL,
+                                                  &cq->vector)) {
                                        cq->vector = (cq->ring + 1 + priv->port)
                                            % mdev->dev->caps.num_comp_vectors;
                                        mlx4_warn(mdev, "Failed Assigning an EQ to "
index bce98d9c0039b87e74f8d7b7fbd9db3b0281d0bb..cd48337cbfc08f719742c2bbe867125d78d30e88 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/dma-mapping.h>
 
 #include <linux/mlx4/cmd.h>
+#include <linux/cpu_rmap.h>
 
 #include "mlx4.h"
 #include "fw.h"
@@ -1060,7 +1061,8 @@ int mlx4_test_interrupts(struct mlx4_dev *dev)
 }
 EXPORT_SYMBOL(mlx4_test_interrupts);
 
-int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
+int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
+                  int *vector)
 {
 
        struct mlx4_priv *priv = mlx4_priv(dev);
@@ -1074,6 +1076,14 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
                        snprintf(priv->eq_table.irq_names +
                                        vec * MLX4_IRQNAME_SIZE,
                                        MLX4_IRQNAME_SIZE, "%s", name);
+#ifdef CONFIG_RFS_ACCEL
+                       if (rmap) {
+                               err = irq_cpu_rmap_add(rmap,
+                                                      priv->eq_table.eq[vec].irq);
+                               if (err)
+                                       mlx4_warn(dev, "Failed adding irq rmap\n");
+                       }
+#endif
                        err = request_irq(priv->eq_table.eq[vec].irq,
                                          mlx4_msi_x_interrupt, 0,
                                          &priv->eq_table.irq_names[vec<<5],
index 6f0d133cc7ada41e8796f6797e736d27a5f73d78..4d7761f8c3f678e0870e982a0954820a53fe05fd 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/pci.h>
 #include <linux/completion.h>
 #include <linux/radix-tree.h>
+#include <linux/cpu_rmap.h>
 
 #include <linux/atomic.h>
 
@@ -784,7 +785,8 @@ void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr,
 int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
 int mlx4_SYNC_TPT(struct mlx4_dev *dev);
 int mlx4_test_interrupts(struct mlx4_dev *dev);
-int mlx4_assign_eq(struct mlx4_dev *dev, char* name , int* vector);
+int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
+                  int *vector);
 void mlx4_release_eq(struct mlx4_dev *dev, int vec);
 
 int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port);