lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241016-fec-cleanups-v1-8-de783bd15e6a@pengutronix.de>
Date: Wed, 16 Oct 2024 23:51:56 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Wei Fang <wei.fang@....com>, Shenwei Wang <shenwei.wang@....com>, 
 Clark Wang <xiaoning.wang@....com>, "David S. Miller" <davem@...emloft.net>, 
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, Richard Cochran <richardcochran@...il.com>
Cc: imx@...ts.linux.dev, netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org, kernel@...gutronix.de, 
 Marc Kleine-Budde <mkl@...gutronix.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@...gutronix.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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ