> -----Original Message----- > From: Joakim Tjernlund <joakim.tjernl...@infinera.com> > Sent: Thursday, December 6, 2018 5:32 PM > To: netdev @ vger . kernel . org <netdev@vger.kernel.org>; Madalin- > cristian Bucur <madalin.bu...@nxp.com> > Cc: jo...@infinera.com <joakim.tjernl...@infinera.com> > Subject: [PATCH] dpaa_eth: Add dpaa_change_carrier() > > This allows to control carrier from /sys/class/net/ethX/carrier
Hi, can you please explain why it's needed? Thanks, Madalin > Signed-off-by: Joakim Tjernlund <joakim.tjernl...@infinera.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