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: <20181206153215.5711-1-joakim.tjernlund@infinera.com>
Date:   Thu,  6 Dec 2018 16:32:15 +0100
From:   Joakim Tjernlund <joakim.tjernlund@...inera.com>
To:     "netdev @ vger . kernel . org" <netdev@...r.kernel.org>,
        Madalin-cristian Bucur <madalin.bucur@....com>
Cc:     Joakim Tjernlund <joakim.tjernlund@...inera.com>
Subject: [PATCH] dpaa_eth: Add dpaa_change_carrier()

This allows to control carrier from /sys/class/net/ethX/carrier

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@...inera.com>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index a202c50d6fc7..0e93dfa6df0a 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2502,12 +2502,23 @@ static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
 	return phy_mii_ioctl(net_dev->phydev, rq, cmd);
 }
 
+static int dpaa_change_carrier(struct net_device *dev, bool new_carrier)
+{
+	struct phy_device *phydev = dev->phydev;
+
+	if (phydev && phydev->phy_link_change)
+		phydev->phy_link_change(phydev, new_carrier, 1);
+
+	return 0;
+}
+
 static const struct net_device_ops dpaa_ops = {
 	.ndo_open = dpaa_open,
 	.ndo_start_xmit = dpaa_start_xmit,
 	.ndo_stop = dpaa_eth_stop,
 	.ndo_tx_timeout = dpaa_tx_timeout,
 	.ndo_get_stats64 = dpaa_get_stats64,
+	.ndo_change_carrier = dpaa_change_carrier,
 	.ndo_set_mac_address = dpaa_set_mac_address,
 	.ndo_validate_addr = eth_validate_addr,
 	.ndo_set_rx_mode = dpaa_set_rx_mode,
-- 
2.18.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ