diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/eq.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/eq.c | 69 |
1 files changed, 8 insertions, 61 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index d954ec1eac17..2a004b347e1d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -53,11 +53,6 @@ enum { | |||
53 | MLX4_EQ_ENTRY_SIZE = 0x20 | 53 | MLX4_EQ_ENTRY_SIZE = 0x20 |
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct mlx4_irq_notify { | ||
57 | void *arg; | ||
58 | struct irq_affinity_notify notify; | ||
59 | }; | ||
60 | |||
61 | #define MLX4_EQ_STATUS_OK ( 0 << 28) | 56 | #define MLX4_EQ_STATUS_OK ( 0 << 28) |
62 | #define MLX4_EQ_STATUS_WRITE_FAIL (10 << 28) | 57 | #define MLX4_EQ_STATUS_WRITE_FAIL (10 << 28) |
63 | #define MLX4_EQ_OWNER_SW ( 0 << 24) | 58 | #define MLX4_EQ_OWNER_SW ( 0 << 24) |
@@ -1088,57 +1083,6 @@ static void mlx4_unmap_clr_int(struct mlx4_dev *dev) | |||
1088 | iounmap(priv->clr_base); | 1083 | iounmap(priv->clr_base); |
1089 | } | 1084 | } |
1090 | 1085 | ||
1091 | static void mlx4_irq_notifier_notify(struct irq_affinity_notify *notify, | ||
1092 | const cpumask_t *mask) | ||
1093 | { | ||
1094 | struct mlx4_irq_notify *n = container_of(notify, | ||
1095 | struct mlx4_irq_notify, | ||
1096 | notify); | ||
1097 | struct mlx4_priv *priv = (struct mlx4_priv *)n->arg; | ||
1098 | struct radix_tree_iter iter; | ||
1099 | void **slot; | ||
1100 | |||
1101 | radix_tree_for_each_slot(slot, &priv->cq_table.tree, &iter, 0) { | ||
1102 | struct mlx4_cq *cq = (struct mlx4_cq *)(*slot); | ||
1103 | |||
1104 | if (cq->irq == notify->irq) | ||
1105 | cq->irq_affinity_change = true; | ||
1106 | } | ||
1107 | } | ||
1108 | |||
1109 | static void mlx4_release_irq_notifier(struct kref *ref) | ||
1110 | { | ||
1111 | struct mlx4_irq_notify *n = container_of(ref, struct mlx4_irq_notify, | ||
1112 | notify.kref); | ||
1113 | kfree(n); | ||
1114 | } | ||
1115 | |||
1116 | static void mlx4_assign_irq_notifier(struct mlx4_priv *priv, | ||
1117 | struct mlx4_dev *dev, int irq) | ||
1118 | { | ||
1119 | struct mlx4_irq_notify *irq_notifier = NULL; | ||
1120 | int err = 0; | ||
1121 | |||
1122 | irq_notifier = kzalloc(sizeof(*irq_notifier), GFP_KERNEL); | ||
1123 | if (!irq_notifier) { | ||
1124 | mlx4_warn(dev, "Failed to allocate irq notifier. irq %d\n", | ||
1125 | irq); | ||
1126 | return; | ||
1127 | } | ||
1128 | |||
1129 | irq_notifier->notify.irq = irq; | ||
1130 | irq_notifier->notify.notify = mlx4_irq_notifier_notify; | ||
1131 | irq_notifier->notify.release = mlx4_release_irq_notifier; | ||
1132 | irq_notifier->arg = priv; | ||
1133 | err = irq_set_affinity_notifier(irq, &irq_notifier->notify); | ||
1134 | if (err) { | ||
1135 | kfree(irq_notifier); | ||
1136 | irq_notifier = NULL; | ||
1137 | mlx4_warn(dev, "Failed to set irq notifier. irq %d\n", irq); | ||
1138 | } | ||
1139 | } | ||
1140 | |||
1141 | |||
1142 | int mlx4_alloc_eq_table(struct mlx4_dev *dev) | 1086 | int mlx4_alloc_eq_table(struct mlx4_dev *dev) |
1143 | { | 1087 | { |
1144 | struct mlx4_priv *priv = mlx4_priv(dev); | 1088 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -1409,8 +1353,6 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | |||
1409 | continue; | 1353 | continue; |
1410 | /*we dont want to break here*/ | 1354 | /*we dont want to break here*/ |
1411 | } | 1355 | } |
1412 | mlx4_assign_irq_notifier(priv, dev, | ||
1413 | priv->eq_table.eq[vec].irq); | ||
1414 | 1356 | ||
1415 | eq_set_ci(&priv->eq_table.eq[vec], 1); | 1357 | eq_set_ci(&priv->eq_table.eq[vec], 1); |
1416 | } | 1358 | } |
@@ -1427,6 +1369,14 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | |||
1427 | } | 1369 | } |
1428 | EXPORT_SYMBOL(mlx4_assign_eq); | 1370 | EXPORT_SYMBOL(mlx4_assign_eq); |
1429 | 1371 | ||
1372 | int mlx4_eq_get_irq(struct mlx4_dev *dev, int vec) | ||
1373 | { | ||
1374 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
1375 | |||
1376 | return priv->eq_table.eq[vec].irq; | ||
1377 | } | ||
1378 | EXPORT_SYMBOL(mlx4_eq_get_irq); | ||
1379 | |||
1430 | void mlx4_release_eq(struct mlx4_dev *dev, int vec) | 1380 | void mlx4_release_eq(struct mlx4_dev *dev, int vec) |
1431 | { | 1381 | { |
1432 | struct mlx4_priv *priv = mlx4_priv(dev); | 1382 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -1438,9 +1388,6 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec) | |||
1438 | Belonging to a legacy EQ*/ | 1388 | Belonging to a legacy EQ*/ |
1439 | mutex_lock(&priv->msix_ctl.pool_lock); | 1389 | mutex_lock(&priv->msix_ctl.pool_lock); |
1440 | if (priv->msix_ctl.pool_bm & 1ULL << i) { | 1390 | if (priv->msix_ctl.pool_bm & 1ULL << i) { |
1441 | irq_set_affinity_notifier( | ||
1442 | priv->eq_table.eq[vec].irq, | ||
1443 | NULL); | ||
1444 | free_irq(priv->eq_table.eq[vec].irq, | 1391 | free_irq(priv->eq_table.eq[vec].irq, |
1445 | &priv->eq_table.eq[vec]); | 1392 | &priv->eq_table.eq[vec]); |
1446 | priv->msix_ctl.pool_bm &= ~(1ULL << i); | 1393 | priv->msix_ctl.pool_bm &= ~(1ULL << i); |