Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: Saeed Mahameed <saeedm@mellanox.com>,
	Leon Romanovsky <leonro@mellanox.com>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Yuval Avnery <yuvalav@mellanox.com>,
	Parav Pandit <parav@mellanox.com>
Subject: [PATCH mlx5-next 12/16] net/mlx5: Generalize IRQ interface to work with irq_table
Date: Mon, 10 Jun 2019 23:38:34 +0000	[thread overview]
Message-ID: <20190610233733.12155-13-saeedm@mellanox.com> (raw)
In-Reply-To: <20190610233733.12155-1-saeedm@mellanox.com>

From: Yuval Avnery <yuvalav@mellanox.com>

IRQ interface should operate within the irq_table context.
It should be independent of any EQ data structure.

The interface that will be exposed:
init/clenup, create/destroy, attach/detach

Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 38 +++++++++++++++-----
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index daf9bc3155cc..80a436b5034a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -143,16 +143,22 @@ static struct mlx5_irq_info *mlx5_irq_get(struct mlx5_core_dev *dev, int vecidx)
 	return &irq_table->irq_info[vecidx];
 }
 
-static int mlx5_irq_attach_nb(struct mlx5_irq_info *irq,
+static int mlx5_irq_attach_nb(struct mlx5_irq_table *irq_table, int vecidx,
 			      struct notifier_block *nb)
 {
-	return atomic_notifier_chain_register(&irq->nh, nb);
+	struct mlx5_irq_info *irq_info;
+
+	irq_info = &irq_table->irq_info[vecidx];
+	return atomic_notifier_chain_register(&irq_info->nh, nb);
 }
 
-static int mlx5_irq_detach_nb(struct mlx5_irq_info *irq,
+static int mlx5_irq_detach_nb(struct mlx5_irq_table *irq_table, int vecidx,
 			      struct notifier_block *nb)
 {
-	return atomic_notifier_chain_unregister(&irq->nh, nb);
+	struct mlx5_irq_info *irq_info;
+
+	irq_info = &irq_table->irq_info[vecidx];
+	return atomic_notifier_chain_unregister(&irq_info->nh, nb);
 }
 
 static irqreturn_t mlx5_irq_int_handler(int irq, void *nh)
@@ -465,7 +471,8 @@ create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
 	eq->doorbell = priv->uar->map + MLX5_EQ_DOORBEL_OFFSET;
 	eq->irq_nb = param->nb;
 
-	err = mlx5_irq_attach_nb(mlx5_irq_get(dev, vecidx), param->nb);
+	err = mlx5_irq_attach_nb(dev->priv.eq_table->irq_table, vecidx,
+				 param->nb);
 	if (err)
 		goto err_eq;
 
@@ -481,7 +488,7 @@ create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
 	return 0;
 
 err_detach:
-	mlx5_irq_detach_nb(mlx5_irq_get(dev, vecidx), eq->irq_nb);
+	mlx5_irq_detach_nb(dev->priv.eq_table->irq_table, vecidx, eq->irq_nb);
 
 err_eq:
 	mlx5_cmd_destroy_eq(dev, eq->eqn);
@@ -500,7 +507,8 @@ static int destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
 
 	mlx5_debug_eq_remove(dev, eq);
 
-	err = mlx5_irq_detach_nb(mlx5_irq_get(dev, eq->vecidx), eq->irq_nb);
+	err = mlx5_irq_detach_nb(dev->priv.eq_table->irq_table,
+				 eq->vecidx, eq->irq_nb);
 	if (err)
 		mlx5_core_warn(eq->dev, "eq failed to detach from irq. err %d",
 			       err);
@@ -1023,19 +1031,31 @@ unsigned int mlx5_comp_vectors_count(struct mlx5_core_dev *dev)
 }
 EXPORT_SYMBOL(mlx5_comp_vectors_count);
 
+static struct cpumask *
+mlx5_irq_get_affinity_mask(struct mlx5_irq_table *irq_table, int vecidx)
+{
+	return irq_table->irq_info[vecidx].mask;
+}
+
 struct cpumask *
 mlx5_comp_irq_get_affinity_mask(struct mlx5_core_dev *dev, int vector)
 {
 	int vecidx = vector + MLX5_EQ_VEC_COMP_BASE;
 
-	return dev->priv.eq_table->irq_table->irq_info[vecidx].mask;
+	return mlx5_irq_get_affinity_mask(dev->priv.eq_table->irq_table,
+					  vecidx);
 }
 EXPORT_SYMBOL(mlx5_comp_irq_get_affinity_mask);
 
 #ifdef CONFIG_RFS_ACCEL
+static struct cpu_rmap *mlx5_irq_get_rmap(struct mlx5_irq_table *irq_table)
+{
+	return irq_table->rmap;
+}
+
 struct cpu_rmap *mlx5_eq_table_get_rmap(struct mlx5_core_dev *dev)
 {
-	return dev->priv.eq_table->irq_table->rmap;
+	return mlx5_irq_get_rmap(dev->priv.eq_table->irq_table);
 }
 #endif
 
-- 
2.21.0


  parent reply	other threads:[~2019-06-10 23:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 23:38 [PATCH mlx5-next 00/16] Mellanox, mlx5 next updates 10-06-2019 Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 01/16] net/mlx5: Increase wait time for fw initialization Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 02/16] net/mlx5: E-Switch, Handle representors creation in handler context Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 03/16] net/mlx5: E-Switch, Return raw output for query esw functions Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 04/16] net/mlx5: Support querying max VFs from device Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 05/16] net/mlx5: Introduce EQ polling budget Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 06/16] net/mlx5: Change interrupt handler to call chain notifier Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 07/16] net/mlx5: Separate IRQ request/free from EQ life cycle Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 08/16] net/mlx5: Separate IRQ data from EQ table data Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 09/16] net/mlx5: Move IRQ rmap creation to IRQ allocation phase Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 10/16] net/mlx5: Move IRQ affinity set " Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 11/16] net/mlx5: Separate IRQ table creation from EQ table creation Saeed Mahameed
2019-06-10 23:38 ` Saeed Mahameed [this message]
2019-06-10 23:38 ` [PATCH mlx5-next 13/16] net/mlx5: Move all IRQ logic to pci_irq.c Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 14/16] net/mlx5: Rename mlx5_irq_info to mlx5_irq Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 15/16] net/mlx5: Use a single IRQ for all async EQs Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 16/16] net/mlx5: Add EQ enable/disable API Saeed Mahameed
2019-06-13 18:02 ` [PATCH mlx5-next 00/16] Mellanox, mlx5 next updates 10-06-2019 Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190610233733.12155-13-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=parav@mellanox.com \
    --cc=yuvalav@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox