Skip to contentSkip to conversation

mlxsw: convert to pci_alloc_irq_vectors

PATCH In review Christoph Hellwig 4 participants 8 messages Apr 6, 2017 – Apr 10, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mlxsw: convert to pci_alloc_irq_vectors

Trivial conversion as only one vector is supported, but at least we lose the useless msix_entry member in the per-device structure.

---

Changes since V1:
- rebase due to a trivial conflict in net-next

 drivers/net/ethernet/mellanox/mlxsw/pci.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/pci.c +6 -7
index eaa3e3bf5a2b..23f7d828cf67 100644
@@ -136,7 +136,6 @@ struct mlxsw_pci {
 	u8 __iomem *hw_addr;
 	struct mlxsw_pci_queue_type_group queues[MLXSW_PCI_QUEUE_TYPE_COUNT];
 	u32 doorbell_offset;
-	struct msix_entry msix_entry;
 	struct mlxsw_core *core;
 	struct {
 		struct mlxsw_pci_mem_item *items;
@@ -1409,7 +1408,7 @@ static int mlxsw_pci_init(void *bus_priv, struct mlxsw_core *mlxsw_core,
 	if (err)
 		goto err_aqs_init;
 
-	err = request_irq(mlxsw_pci->msix_entry.vector,
+	err = request_irq(pci_irq_vector(pdev, 0),
 			  mlxsw_pci_eq_irq_handler, 0,
 			  mlxsw_pci->bus_info.device_kind, mlxsw_pci);
 	if (err) {
@@ -1442,7 +1441,7 @@ static void mlxsw_pci_fini(void *bus_priv)
 {
 	struct mlxsw_pci *mlxsw_pci = bus_priv;
 
-	free_irq(mlxsw_pci->msix_entry.vector, mlxsw_pci);
+	free_irq(pci_irq_vector(mlxsw_pci->pdev, 0), mlxsw_pci);
 	mlxsw_pci_aqs_fini(mlxsw_pci);
 	mlxsw_pci_fw_area_fini(mlxsw_pci);
 	mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.out_mbox);
@@ -1717,8 +1716,8 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		goto err_sw_reset;
 	}
 
-	err = pci_enable_msix_exact(pdev, &mlxsw_pci->msix_entry, 1);
-	if (err) {
+	err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
+	if (err < 0) {
 		dev_err(&pdev->dev, "MSI-X init failed\n");
 		goto err_msix_init;
 	}
@@ -1737,7 +1736,7 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	return 0;
 
 err_bus_device_register:
-	pci_disable_msix(mlxsw_pci->pdev);
+	pci_free_irq_vectors(mlxsw_pci->pdev);
 err_msix_init:
 err_sw_reset:
 	iounmap(mlxsw_pci->hw_addr);
@@ -1757,7 +1756,7 @@ static void mlxsw_pci_remove(struct pci_dev *pdev)
 	struct mlxsw_pci *mlxsw_pci = pci_get_drvdata(pdev);
 
 	mlxsw_core_bus_device_unregister(mlxsw_pci->core);
-	pci_disable_msix(mlxsw_pci->pdev);
+	pci_free_irq_vectors(mlxsw_pci->pdev);
 	iounmap(mlxsw_pci->hw_addr);
 	pci_release_regions(mlxsw_pci->pdev);
 	pci_disable_device(mlxsw_pci->pdev);
Signature · 1 line
2.11.0
#2 lore raw
In reply to Ido Schimmel

Hi Dave,

Quoted 7 lines · Ido Schimmel
Quoted 4 lines · Christoph Hellwig

Trivial conversion as only one vector is supported, but at least we lose the useless msix_entry member in the per-device structure.

For net-next:

I noticed this is marked as "Not Applicable" in patchwork:
https://patchwork.ozlabs.org/patch/747723/

But I'm not quite sure why. Maybe you meant to mark only v1?
https://patchwork.ozlabs.org/patch/747674/

Thanks

maintainer
#3 lore raw

From: Ido Schimmel <[email protected]>
Date: Fri, 7 Apr 2017 16:08:08 +0300

Quoted 9 lines

Hi Dave,

Quoted 6 lines · Ido Schimmel
Quoted 4 lines · Christoph Hellwig

Trivial conversion as only one vector is supported, but at least we lose the useless msix_entry member in the per-device structure.

Quoted 7 lines
Quoted 1 line

For net-next:

I noticed this is marked as "Not Applicable" in patchwork:
https://patchwork.ozlabs.org/patch/747723/

But I'm not quite sure why. Maybe you meant to mark only v1?
https://patchwork.ozlabs.org/patch/747674/

If the last patch of his series removes a kernel global API, it shouldn't go via my tree. He can send it directly to Linus or via the PCI maintainer.

#4 lore raw
Quoted 11 lines · David Miller
Quoted 7 lines
Quoted 1 line

For net-next:

I noticed this is marked as "Not Applicable" in patchwork:
https://patchwork.ozlabs.org/patch/747723/

But I'm not quite sure why. Maybe you meant to mark only v1?
https://patchwork.ozlabs.org/patch/747674/

If the last patch of his series removes a kernel global API, it shouldn't go via my tree. He can send it directly to Linus or via the PCI maintainer.

This is a single patch that does not remove anything.

For the different series I explicitly asked if it's okay if the whole thing goes in through the net tree and Bjorn was fine it. If you're not it would be nice if you could state that in the series so that the submitter can act on it.

maintainer
#5 lore raw

From: Christoph Hellwig <[email protected]>
Date: Mon, 10 Apr 2017 09:35:51 +0200

Quoted 13 lines · David Miller
Quoted 11 lines
Quoted 7 lines
Quoted 1 line

For net-next:

I noticed this is marked as "Not Applicable" in patchwork:
https://patchwork.ozlabs.org/patch/747723/

But I'm not quite sure why. Maybe you meant to mark only v1?
https://patchwork.ozlabs.org/patch/747674/

If the last patch of his series removes a kernel global API, it shouldn't go via my tree. He can send it directly to Linus or via the PCI maintainer.

Quoted 6 lines

This is a single patch that does not remove anything.

For the different series I explicitly asked if it's okay if the whole thing goes in through the net tree and Bjorn was fine it. If you're not it would be nice if you could state that in the series so that the submitter can act on it.

My bad I thought this was part of that series.

Could you do me a favor and repost that series, with this mlxsw patch added to it. I will apply it to net-next.

Thanks!

#6 lore raw
Quoted 4 lines · David Miller

My bad I thought this was part of that series.

Could you do me a favor and repost that series, with this mlxsw patch added to it. I will apply it to net-next.

Note that mlxsw uses pci_enable_msix_exact which isn't going away with the other series, only pci_enable_msix goes away for now.

But if you still want them together I'll happily repost.