Skip to content

Commit d9236c3

Browse files
amirvdavem330
authored andcommitted
{NET,IB}/mlx4: Add rmap support to mlx4_assign_eq
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>
1 parent 122733a commit d9236c3

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

drivers/infiniband/hw/mlx4/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,8 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
11591159
sprintf(name, "mlx4-ib-%d-%d@%s",
11601160
i, j, dev->pdev->bus->name);
11611161
/* Set IRQ for specific name (per ring) */
1162-
if (mlx4_assign_eq(dev, name, &ibdev->eq_table[eq])) {
1162+
if (mlx4_assign_eq(dev, name, NULL,
1163+
&ibdev->eq_table[eq])) {
11631164
/* Use legacy (same as mlx4_en driver) */
11641165
pr_warn("Can't allocate EQ %d; reverting to legacy\n", eq);
11651166
ibdev->eq_table[eq] =

drivers/net/ethernet/mellanox/mlx4/en_cq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
9191
sprintf(name, "%s-%d", priv->dev->name,
9292
cq->ring);
9393
/* Set IRQ for specific name (per ring) */
94-
if (mlx4_assign_eq(mdev->dev, name, &cq->vector)) {
94+
if (mlx4_assign_eq(mdev->dev, name, NULL,
95+
&cq->vector)) {
9596
cq->vector = (cq->ring + 1 + priv->port)
9697
% mdev->dev->caps.num_comp_vectors;
9798
mlx4_warn(mdev, "Failed Assigning an EQ to "

drivers/net/ethernet/mellanox/mlx4/eq.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <linux/dma-mapping.h>
4040

4141
#include <linux/mlx4/cmd.h>
42+
#include <linux/cpu_rmap.h>
4243

4344
#include "mlx4.h"
4445
#include "fw.h"
@@ -1060,7 +1061,8 @@ int mlx4_test_interrupts(struct mlx4_dev *dev)
10601061
}
10611062
EXPORT_SYMBOL(mlx4_test_interrupts);
10621063

1063-
int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1064+
int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
1065+
int *vector)
10641066
{
10651067

10661068
struct mlx4_priv *priv = mlx4_priv(dev);
@@ -1074,6 +1076,14 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
10741076
snprintf(priv->eq_table.irq_names +
10751077
vec * MLX4_IRQNAME_SIZE,
10761078
MLX4_IRQNAME_SIZE, "%s", name);
1079+
#ifdef CONFIG_RFS_ACCEL
1080+
if (rmap) {
1081+
err = irq_cpu_rmap_add(rmap,
1082+
priv->eq_table.eq[vec].irq);
1083+
if (err)
1084+
mlx4_warn(dev, "Failed adding irq rmap\n");
1085+
}
1086+
#endif
10771087
err = request_irq(priv->eq_table.eq[vec].irq,
10781088
mlx4_msi_x_interrupt, 0,
10791089
&priv->eq_table.irq_names[vec<<5],

include/linux/mlx4/device.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <linux/pci.h>
3737
#include <linux/completion.h>
3838
#include <linux/radix-tree.h>
39+
#include <linux/cpu_rmap.h>
3940

4041
#include <linux/atomic.h>
4142

@@ -784,7 +785,8 @@ void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr,
784785
int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
785786
int mlx4_SYNC_TPT(struct mlx4_dev *dev);
786787
int mlx4_test_interrupts(struct mlx4_dev *dev);
787-
int mlx4_assign_eq(struct mlx4_dev *dev, char* name , int* vector);
788+
int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
789+
int *vector);
788790
void mlx4_release_eq(struct mlx4_dev *dev, int vec);
789791

790792
int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port);

0 commit comments

Comments
 (0)