All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ibmvnic: Add device identification to requested IRQs
@ 2019-04-25 14:02 Murilo Fossa Vicentini
  2019-04-25 16:51 ` Mauro Rodrigues
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Murilo Fossa Vicentini @ 2019-04-25 14:02 UTC (permalink / raw)
  To: netdev; +Cc: tlfalcon, maurosr

The ibmvnic driver currently uses the same fixed name when using
request_irq, this makes it hard to parse when multiple VNIC devices are
available at the same time. This patch adds the unit_address as the device
identification along with an id for each queue.

The original idea was to use the interface name as an identifier, but it
is not feasible given these requests happen at adapter probe, and at this
point netdev is not yet registered so it doesn't have the proper name
assigned to it.

Signed-off-by: Murilo Fossa Vicentini <muvic@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 13 +++++++++----
 drivers/net/ethernet/ibm/ibmvnic.h |  2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5e3cdb0b46d5..b398d6c94dbd 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -2919,8 +2919,10 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
 			goto req_tx_irq_failed;
 		}
 
+		snprintf(scrq->name, sizeof(scrq->name), "ibmvnic-%x-tx%d",
+			 adapter->vdev->unit_address, i);
 		rc = request_irq(scrq->irq, ibmvnic_interrupt_tx,
-				 0, "ibmvnic_tx", scrq);
+				 0, scrq->name, scrq);
 
 		if (rc) {
 			dev_err(dev, "Couldn't register tx irq 0x%x. rc=%d\n",
@@ -2940,8 +2942,10 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
 			dev_err(dev, "Error mapping irq\n");
 			goto req_rx_irq_failed;
 		}
+		snprintf(scrq->name, sizeof(scrq->name), "ibmvnic-%x-rx%d",
+			 adapter->vdev->unit_address, i);
 		rc = request_irq(scrq->irq, ibmvnic_interrupt_rx,
-				 0, "ibmvnic_rx", scrq);
+				 0, scrq->name, scrq);
 		if (rc) {
 			dev_err(dev, "Couldn't register rx irq 0x%x. rc=%d\n",
 				scrq->irq, rc);
@@ -4667,8 +4671,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
 		     (unsigned long)adapter);
 
 	netdev_dbg(adapter->netdev, "registering irq 0x%x\n", vdev->irq);
-	rc = request_irq(vdev->irq, ibmvnic_interrupt, 0, IBMVNIC_NAME,
-			 adapter);
+	snprintf(crq->name, sizeof(crq->name), "ibmvnic-%x",
+		 adapter->vdev->unit_address);
+	rc = request_irq(vdev->irq, ibmvnic_interrupt, 0, crq->name, adapter);
 	if (rc) {
 		dev_err(dev, "Couldn't register irq 0x%x. rc=%d\n",
 			vdev->irq, rc);
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index d5260a206708..cffdac372a33 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -855,6 +855,7 @@ struct ibmvnic_crq_queue {
 	dma_addr_t msg_token;
 	spinlock_t lock;
 	bool active;
+	char name[32];
 };
 
 union sub_crq {
@@ -881,6 +882,7 @@ struct ibmvnic_sub_crq_queue {
 	struct sk_buff *rx_skb_top;
 	struct ibmvnic_adapter *adapter;
 	atomic_t used;
+	char name[32];
 };
 
 struct ibmvnic_long_term_buff {
-- 
2.17.2 (Apple Git-113)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] ibmvnic: Add device identification to requested IRQs
  2019-04-25 14:02 [PATCH net-next] ibmvnic: Add device identification to requested IRQs Murilo Fossa Vicentini
@ 2019-04-25 16:51 ` Mauro Rodrigues
  2019-04-25 17:18 ` Thomas Falcon
  2019-04-28  0:20 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Mauro Rodrigues @ 2019-04-25 16:51 UTC (permalink / raw)
  To: Murilo Fossa Vicentini; +Cc: netdev, tlfalcon

On Thu, Apr 25, 2019 at 11:02:33AM -0300, Murilo Fossa Vicentini wrote:
> The ibmvnic driver currently uses the same fixed name when using
> request_irq, this makes it hard to parse when multiple VNIC devices are
> available at the same time. This patch adds the unit_address as the device
> identification along with an id for each queue.
> 
> The original idea was to use the interface name as an identifier, but it
> is not feasible given these requests happen at adapter probe, and at this
> point netdev is not yet registered so it doesn't have the proper name
> assigned to it.
> 
> Signed-off-by: Murilo Fossa Vicentini <muvic@linux.ibm.com>
Reviewed-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>

This is very useful, thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] ibmvnic: Add device identification to requested IRQs
  2019-04-25 14:02 [PATCH net-next] ibmvnic: Add device identification to requested IRQs Murilo Fossa Vicentini
  2019-04-25 16:51 ` Mauro Rodrigues
@ 2019-04-25 17:18 ` Thomas Falcon
  2019-04-28  0:20 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Falcon @ 2019-04-25 17:18 UTC (permalink / raw)
  To: Murilo Fossa Vicentini, netdev; +Cc: maurosr


On 4/25/19 9:02 AM, Murilo Fossa Vicentini wrote:
> The ibmvnic driver currently uses the same fixed name when using
> request_irq, this makes it hard to parse when multiple VNIC devices are
> available at the same time. This patch adds the unit_address as the device
> identification along with an id for each queue.
>
> The original idea was to use the interface name as an identifier, but it
> is not feasible given these requests happen at adapter probe, and at this
> point netdev is not yet registered so it doesn't have the proper name
> assigned to it.
>
> Signed-off-by: Murilo Fossa Vicentini <muvic@linux.ibm.com>
> ---

Reviewed-by: Thomas Falcon <tlfalcon@linux.ibm.com>

Thanks, Murilo!

>   drivers/net/ethernet/ibm/ibmvnic.c | 13 +++++++++----
>   drivers/net/ethernet/ibm/ibmvnic.h |  2 ++
>   2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 5e3cdb0b46d5..b398d6c94dbd 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -2919,8 +2919,10 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
>   			goto req_tx_irq_failed;
>   		}
>   
> +		snprintf(scrq->name, sizeof(scrq->name), "ibmvnic-%x-tx%d",
> +			 adapter->vdev->unit_address, i);
>   		rc = request_irq(scrq->irq, ibmvnic_interrupt_tx,
> -				 0, "ibmvnic_tx", scrq);
> +				 0, scrq->name, scrq);
>   
>   		if (rc) {
>   			dev_err(dev, "Couldn't register tx irq 0x%x. rc=%d\n",
> @@ -2940,8 +2942,10 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
>   			dev_err(dev, "Error mapping irq\n");
>   			goto req_rx_irq_failed;
>   		}
> +		snprintf(scrq->name, sizeof(scrq->name), "ibmvnic-%x-rx%d",
> +			 adapter->vdev->unit_address, i);
>   		rc = request_irq(scrq->irq, ibmvnic_interrupt_rx,
> -				 0, "ibmvnic_rx", scrq);
> +				 0, scrq->name, scrq);
>   		if (rc) {
>   			dev_err(dev, "Couldn't register rx irq 0x%x. rc=%d\n",
>   				scrq->irq, rc);
> @@ -4667,8 +4671,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
>   		     (unsigned long)adapter);
>   
>   	netdev_dbg(adapter->netdev, "registering irq 0x%x\n", vdev->irq);
> -	rc = request_irq(vdev->irq, ibmvnic_interrupt, 0, IBMVNIC_NAME,
> -			 adapter);
> +	snprintf(crq->name, sizeof(crq->name), "ibmvnic-%x",
> +		 adapter->vdev->unit_address);
> +	rc = request_irq(vdev->irq, ibmvnic_interrupt, 0, crq->name, adapter);
>   	if (rc) {
>   		dev_err(dev, "Couldn't register irq 0x%x. rc=%d\n",
>   			vdev->irq, rc);
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
> index d5260a206708..cffdac372a33 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.h
> +++ b/drivers/net/ethernet/ibm/ibmvnic.h
> @@ -855,6 +855,7 @@ struct ibmvnic_crq_queue {
>   	dma_addr_t msg_token;
>   	spinlock_t lock;
>   	bool active;
> +	char name[32];
>   };
>   
>   union sub_crq {
> @@ -881,6 +882,7 @@ struct ibmvnic_sub_crq_queue {
>   	struct sk_buff *rx_skb_top;
>   	struct ibmvnic_adapter *adapter;
>   	atomic_t used;
> +	char name[32];
>   };
>   
>   struct ibmvnic_long_term_buff {


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] ibmvnic: Add device identification to requested IRQs
  2019-04-25 14:02 [PATCH net-next] ibmvnic: Add device identification to requested IRQs Murilo Fossa Vicentini
  2019-04-25 16:51 ` Mauro Rodrigues
  2019-04-25 17:18 ` Thomas Falcon
@ 2019-04-28  0:20 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-04-28  0:20 UTC (permalink / raw)
  To: muvic; +Cc: netdev, tlfalcon, maurosr

From: Murilo Fossa Vicentini <muvic@linux.ibm.com>
Date: Thu, 25 Apr 2019 11:02:33 -0300

> The ibmvnic driver currently uses the same fixed name when using
> request_irq, this makes it hard to parse when multiple VNIC devices are
> available at the same time. This patch adds the unit_address as the device
> identification along with an id for each queue.
> 
> The original idea was to use the interface name as an identifier, but it
> is not feasible given these requests happen at adapter probe, and at this
> point netdev is not yet registered so it doesn't have the proper name
> assigned to it.
> 
> Signed-off-by: Murilo Fossa Vicentini <muvic@linux.ibm.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-28  0:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-25 14:02 [PATCH net-next] ibmvnic: Add device identification to requested IRQs Murilo Fossa Vicentini
2019-04-25 16:51 ` Mauro Rodrigues
2019-04-25 17:18 ` Thomas Falcon
2019-04-28  0:20 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.