diff mbox series

[net-next,08/13] net: fec: fec_probe(): let IRQ name reflect its function

Message ID 20241016-fec-cleanups-v1-8-de783bd15e6a@pengutronix.de (mailing list archive)
State New
Headers show
Series net: fec: cleanups, update quirk, update IRQ naming | expand

Commit Message

Marc Kleine-Budde Oct. 16, 2024, 9:51 p.m. UTC
The FEC IP core in the i.MX7 and newer SoCs has 4 IRQs. The first 3
correspond to the 3 RX/TX queues, the 4th is for processing Pulses Per
Second. In addition, the 1st IRQ handles the remaining IRQ sources of
the IP core. They are all displayed with the same name in
/proc/interrupts:

| 208:          0          0          0          0     GICv3 150 Level     30be0000.ethernet
| 209:          0          0          0          0     GICv3 151 Level     30be0000.ethernet
| 210:       3898          0          0          0     GICv3 152 Level     30be0000.ethernet
| 211:          0          0          0          0     GICv3 153 Level     30be0000.ethernet

For easier debugging make the name of the IRQ reflect its function.
Use the postfix "-RxTx" and the queue number for the first 3 IRQs, add
"+misc" for the 1st IRQ. The postfix "-PPS" specifies the PPS IRQ.

With this change /proc/interrupts looks like this:

| 208:          2          0          0          0     GICv3 150 Level     30be0000.ethernet-RxTx1
| 209:          0          0          0          0     GICv3 151 Level     30be0000.ethernet-RxTx2
| 210:       3526          0          0          0     GICv3 152 Level     30be0000.ethernet-RxTx0+misc
| 211:          0          0          0          0     GICv3 153 Level     30be0000.ethernet-PPS

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 9 ++++++++-
 drivers/net/ethernet/freescale/fec_ptp.c  | 5 ++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Frank Li Oct. 17, 2024, 2:24 a.m. UTC | #1
On Wed, Oct 16, 2024 at 11:51:56PM +0200, Marc Kleine-Budde wrote:
> The FEC IP core in the i.MX7 and newer SoCs has 4 IRQs. The first 3
> correspond to the 3 RX/TX queues, the 4th is for processing Pulses Per
> Second. In addition, the 1st IRQ handles the remaining IRQ sources of
> the IP core. They are all displayed with the same name in
> /proc/interrupts:
>
> | 208:          0          0          0          0     GICv3 150 Level     30be0000.ethernet
> | 209:          0          0          0          0     GICv3 151 Level     30be0000.ethernet
> | 210:       3898          0          0          0     GICv3 152 Level     30be0000.ethernet
> | 211:          0          0          0          0     GICv3 153 Level     30be0000.ethernet
>
> For easier debugging make the name of the IRQ reflect its function.
> Use the postfix "-RxTx" and the queue number for the first 3 IRQs, add
> "+misc" for the 1st IRQ. The postfix "-PPS" specifies the PPS IRQ.
>
> With this change /proc/interrupts looks like this:
>
> | 208:          2          0          0          0     GICv3 150 Level     30be0000.ethernet-RxTx1
> | 209:          0          0          0          0     GICv3 151 Level     30be0000.ethernet-RxTx2
> | 210:       3526          0          0          0     GICv3 152 Level     30be0000.ethernet-RxTx0+misc
> | 211:          0          0          0          0     GICv3 153 Level     30be0000.ethernet-PPS

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 9 ++++++++-
>  drivers/net/ethernet/freescale/fec_ptp.c  | 5 ++++-
>  2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index f124ffe3619d82dc089f8494d33d2398e6f631fb..c8b2170735e599cd10492169ab32d0e20b28311b 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -4492,8 +4492,15 @@ fec_probe(struct platform_device *pdev)
>  		goto failed_init;
>
>  	for (i = 0; i < irq_cnt; i++) {
> +		const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-RxTx%d%s",
> +						      pdev->name, i, i == 0 ? "+misc" : "");
>  		int irq_num;
>
> +		if (!dev_name) {
> +			ret = -ENOMEM;
> +			goto failed_irq;
> +		}
> +
>  		if (fep->quirks & FEC_QUIRK_DT_IRQ2_IS_MAIN_IRQ)
>  			irq_num = (i + irq_cnt - 1) % irq_cnt;
>  		else
> @@ -4508,7 +4515,7 @@ fec_probe(struct platform_device *pdev)
>  			goto failed_irq;
>  		}
>  		ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt,
> -				       0, pdev->name, ndev);
> +				       0, dev_name, ndev);
>  		if (ret)
>  			goto failed_irq;
>
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
> index 8722f623d9e47e385439f1cee8c677e2b95b236d..0ac89fed366a83bcbfc900ea4409f4e98c4e14da 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -749,8 +749,11 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
>  	 * only the PTP_CLOCK_PPS clock events should stop
>  	 */
>  	if (irq >= 0) {
> +		const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> +						      "%s-PPS", pdev->name);
> +
>  		ret = devm_request_irq(&pdev->dev, irq, fec_pps_interrupt,
> -				       0, pdev->name, ndev);
> +				       0, dev_name ? dev_name : pdev->name, ndev);
>  		if (ret < 0)
>  			dev_warn(&pdev->dev, "request for pps irq failed(%d)\n",
>  				 ret);
>
> --
> 2.45.2
>
>
Wei Fang Oct. 17, 2024, 3:12 a.m. UTC | #2
> -----Original Message-----
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Sent: 2024年10月17日 5:52
> To: Wei Fang <wei.fang@nxp.com>; Shenwei Wang <shenwei.wang@nxp.com>;
> Clark Wang <xiaoning.wang@nxp.com>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Richard
> Cochran <richardcochran@gmail.com>
> Cc: imx@lists.linux.dev; netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> kernel@pengutronix.de; Marc Kleine-Budde <mkl@pengutronix.de>
> Subject: [PATCH net-next 08/13] net: fec: fec_probe(): let IRQ name reflect its
> function
> 
> The FEC IP core in the i.MX7 and newer SoCs has 4 IRQs. The first 3
> correspond to the 3 RX/TX queues, the 4th is for processing Pulses Per
> Second. In addition, the 1st IRQ handles the remaining IRQ sources of
> the IP core. They are all displayed with the same name in
> /proc/interrupts:
> 
> | 208:          0          0          0          0     GICv3 150
> Level     30be0000.ethernet
> | 209:          0          0          0          0     GICv3 151
> Level     30be0000.ethernet
> | 210:       3898          0          0          0     GICv3 152
> Level     30be0000.ethernet
> | 211:          0          0          0          0     GICv3 153
> Level     30be0000.ethernet
> 
> For easier debugging make the name of the IRQ reflect its function.
> Use the postfix "-RxTx" and the queue number for the first 3 IRQs, add
> "+misc" for the 1st IRQ. The postfix "-PPS" specifies the PPS IRQ.
> 
> With this change /proc/interrupts looks like this:
> 
> | 208:          2          0          0          0     GICv3 150
> Level     30be0000.ethernet-RxTx1
> | 209:          0          0          0          0     GICv3 151
> Level     30be0000.ethernet-RxTx2
> | 210:       3526          0          0          0     GICv3 152
> Level     30be0000.ethernet-RxTx0+misc
> | 211:          0          0          0          0     GICv3 153
> Level     30be0000.ethernet-PPS
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 9 ++++++++-
>  drivers/net/ethernet/freescale/fec_ptp.c  | 5 ++++-
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index
> f124ffe3619d82dc089f8494d33d2398e6f631fb..c8b2170735e599cd1049216
> 9ab32d0e20b28311b 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -4492,8 +4492,15 @@ fec_probe(struct platform_device *pdev)
>  		goto failed_init;
> 
>  	for (i = 0; i < irq_cnt; i++) {
> +		const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> "%s-RxTx%d%s",
> +						      pdev->name, i, i == 0 ? "+misc" : "");
>  		int irq_num;
> 
> +		if (!dev_name) {
> +			ret = -ENOMEM;
> +			goto failed_irq;
> +		}
> +
>  		if (fep->quirks & FEC_QUIRK_DT_IRQ2_IS_MAIN_IRQ)
>  			irq_num = (i + irq_cnt - 1) % irq_cnt;
>  		else
> @@ -4508,7 +4515,7 @@ fec_probe(struct platform_device *pdev)
>  			goto failed_irq;
>  		}
>  		ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt,
> -				       0, pdev->name, ndev);
> +				       0, dev_name, ndev);
>  		if (ret)
>  			goto failed_irq;
> 
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c
> b/drivers/net/ethernet/freescale/fec_ptp.c
> index
> 8722f623d9e47e385439f1cee8c677e2b95b236d..0ac89fed366a83bcbfc900e
> a4409f4e98c4e14da 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -749,8 +749,11 @@ void fec_ptp_init(struct platform_device *pdev, int
> irq_idx)
>  	 * only the PTP_CLOCK_PPS clock events should stop
>  	 */
>  	if (irq >= 0) {
> +		const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> +						      "%s-PPS", pdev->name);
> +
>  		ret = devm_request_irq(&pdev->dev, irq, fec_pps_interrupt,
> -				       0, pdev->name, ndev);
> +				       0, dev_name ? dev_name : pdev->name, ndev);
>  		if (ret < 0)
>  			dev_warn(&pdev->dev, "request for pps irq failed(%d)\n",
>  				 ret);
> 
> --
> 2.45.2
> 

Great, thanks!

Reviewed-by: Wei Fang <wei.fang@nxp.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f124ffe3619d82dc089f8494d33d2398e6f631fb..c8b2170735e599cd10492169ab32d0e20b28311b 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -4492,8 +4492,15 @@  fec_probe(struct platform_device *pdev)
 		goto failed_init;
 
 	for (i = 0; i < irq_cnt; i++) {
+		const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-RxTx%d%s",
+						      pdev->name, i, i == 0 ? "+misc" : "");
 		int irq_num;
 
+		if (!dev_name) {
+			ret = -ENOMEM;
+			goto failed_irq;
+		}
+
 		if (fep->quirks & FEC_QUIRK_DT_IRQ2_IS_MAIN_IRQ)
 			irq_num = (i + irq_cnt - 1) % irq_cnt;
 		else
@@ -4508,7 +4515,7 @@  fec_probe(struct platform_device *pdev)
 			goto failed_irq;
 		}
 		ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt,
-				       0, pdev->name, ndev);
+				       0, dev_name, ndev);
 		if (ret)
 			goto failed_irq;
 
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index 8722f623d9e47e385439f1cee8c677e2b95b236d..0ac89fed366a83bcbfc900ea4409f4e98c4e14da 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -749,8 +749,11 @@  void fec_ptp_init(struct platform_device *pdev, int irq_idx)
 	 * only the PTP_CLOCK_PPS clock events should stop
 	 */
 	if (irq >= 0) {
+		const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
+						      "%s-PPS", pdev->name);
+
 		ret = devm_request_irq(&pdev->dev, irq, fec_pps_interrupt,
-				       0, pdev->name, ndev);
+				       0, dev_name ? dev_name : pdev->name, ndev);
 		if (ret < 0)
 			dev_warn(&pdev->dev, "request for pps irq failed(%d)\n",
 				 ret);