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: <20210630174022.1016525-1-robert.hancock@calian.com>
Date:   Wed, 30 Jun 2021 11:40:22 -0600
From:   Robert Hancock <robert.hancock@...ian.com>
To:     radhey.shyam.pandey@...inx.com
Cc:     davem@...emloft.net, kuba@...nel.org, linux@...linux.org.uk,
        netdev@...r.kernel.org, Robert Hancock <robert.hancock@...ian.com>
Subject: [PATCH net-next] net: axienet: Allow phytool access to PCS/PMA PHY

Allow phytool ioctl access to read/write registers in the internal
PCS/PMA PHY if it is enabled.

Signed-off-by: Robert Hancock <robert.hancock@...ian.com>
---
 .../net/ethernet/xilinx/xilinx_axienet_main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 13cd799541aa..41f2c2255118 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1213,10 +1213,29 @@ static void axienet_poll_controller(struct net_device *ndev)
 static int axienet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct axienet_local *lp = netdev_priv(dev);
+	struct mii_ioctl_data *mii = if_mii(rq);
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
+	if (lp->pcs_phy && lp->pcs_phy->addr == mii->phy_id) {
+		int ret;
+
+		switch (cmd) {
+		case SIOCGMIIREG:
+			ret = mdiobus_read(lp->pcs_phy->bus, mii->phy_id, mii->reg_num);
+			if (ret >= 0) {
+				mii->val_out = ret;
+				ret = 0;
+			}
+			return ret;
+
+		case SIOCSMIIREG:
+			return mdiobus_write(lp->pcs_phy->bus, mii->phy_id,
+					     mii->reg_num, mii->val_in);
+		}
+	}
+
 	return phylink_mii_ioctl(lp->phylink, rq, cmd);
 }
 
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ