提交 47ff6154 编写于 作者: F Florian Fainelli 提交者: David S. Miller

net: bcmgenet: Allow changing carrier from user-space

The GENET driver interfaces with internal MoCA interface as well as
external MoCA chips like the BCM6802/6803 through a fixed link
interface. It is desirable for the mocad user-space daemon to be able to
control the carrier state based upon out of band messages that it
receives from the MoCA chip.
Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 de2afdca
...@@ -3647,6 +3647,22 @@ static struct net_device_stats *bcmgenet_get_stats(struct net_device *dev) ...@@ -3647,6 +3647,22 @@ static struct net_device_stats *bcmgenet_get_stats(struct net_device *dev)
return &dev->stats; return &dev->stats;
} }
static int bcmgenet_change_carrier(struct net_device *dev, bool new_carrier)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
if (!dev->phydev || !phy_is_pseudo_fixed_link(dev->phydev) ||
priv->phy_interface != PHY_INTERFACE_MODE_MOCA)
return -EOPNOTSUPP;
if (new_carrier)
netif_carrier_on(dev);
else
netif_carrier_off(dev);
return 0;
}
static const struct net_device_ops bcmgenet_netdev_ops = { static const struct net_device_ops bcmgenet_netdev_ops = {
.ndo_open = bcmgenet_open, .ndo_open = bcmgenet_open,
.ndo_stop = bcmgenet_close, .ndo_stop = bcmgenet_close,
...@@ -3660,6 +3676,7 @@ static const struct net_device_ops bcmgenet_netdev_ops = { ...@@ -3660,6 +3676,7 @@ static const struct net_device_ops bcmgenet_netdev_ops = {
.ndo_poll_controller = bcmgenet_poll_controller, .ndo_poll_controller = bcmgenet_poll_controller,
#endif #endif
.ndo_get_stats = bcmgenet_get_stats, .ndo_get_stats = bcmgenet_get_stats,
.ndo_change_carrier = bcmgenet_change_carrier,
}; };
/* Array of GENET hardware parameters/characteristics */ /* Array of GENET hardware parameters/characteristics */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册