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-next>] [day] [month] [year] [list]
Message-Id: <20220719143912.2727014-1-dqfext@gmail.com>
Date:   Tue, 19 Jul 2022 22:39:12 +0800
From:   Qingfang DENG <dqfext@...il.com>
To:     Russell King <linux@...linux.org.uk>
Cc:     Jose Abreu <Jose.Abreu@...opsys.com>, netdev@...r.kernel.org
Subject: Handling standalone PCS IRQ

Hi all,

I was working with an SoC that has a built-in DWC XPCS with IRQ support.
However the current driver still uses polling.

I may modify xpcs_create() to try getting an IRQ number from DT, and fall back
to polling if it fails (see the code below). But I don't know how to notify
phylink in the IRQ handler.

There is a phylink_mac_change() function to notify phylink, but it is supposed
to be used in a MAC driver, and it requires a (struct phylink *), not a
(struct phylink_pcs *). Do we need a similar one for PCS?

Thanks.

--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -1272,6 +1272,13 @@ static const struct phylink_pcs_ops xpcs_phylink_ops = {
 	.pcs_link_up = xpcs_link_up,
 };
 
+static irqreturn_t xpcs_irq(int irq, void *dev_id) {
+	struct dw_xpcs *xpcs = dev_id;
+
+	/* XXX: notify phylink */
+	return IRQ_HANDLED;
+}
+
 struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
 			    phy_interface_t interface)
 {
@@ -1303,7 +1310,21 @@ struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
 		}
 
 		xpcs->pcs.ops = &xpcs_phylink_ops;
-		xpcs->pcs.poll = true;
+
+		ret = of_irq_get(mdiodev->dev.of_node, 0);
+		if (ret == -EPROBE_DEFER)
+			goto out;
+
+		if (ret > 0) {
+			ret = devm_request_threaded_irq(&mdiodev->dev, ret,
+							NULL, xpcs_irq,
+							IRQF_ONESHOT,
+							KBUILD_MODNAME, xpcs);
+			if (ret < 0)
+				goto out;
+		} else {
+			xpcs->pcs.poll = true;
+		}
 
 		ret = xpcs_soft_reset(xpcs, compat);
 		if (ret)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ