Message ID | 20110211152346.GD2763@psychotron.brq.redhat.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Fri, 11 Feb 2011 16:23:47 +0100 Jiri Pirko <jpirko@redhat.com> wrote: > > Signed-off-by: Jiri Pirko <jpirko@redhat.com> NAK This does not belong in ethtool. It should be done by rt_netlink_ops. I am working on doing that right now.
On Mon, 28 Feb 2011 14:17:29 -0800 Stephen Hemminger <shemminger@linux-foundation.org> wrote: > On Fri, 11 Feb 2011 16:23:47 +0100 > Jiri Pirko <jpirko@redhat.com> wrote: > > > > > Signed-off-by: Jiri Pirko <jpirko@redhat.com> > Never mind, this is good. I was confusing slave with bridge initialization and netdevice ops with ethtool ops. Ethtool ops seems to be growing like weeds lately...
Mon, Feb 28, 2011 at 11:45:16PM CET, shemminger@vyatta.com wrote: >On Mon, 28 Feb 2011 14:17:29 -0800 >Stephen Hemminger <shemminger@linux-foundation.org> wrote: > >> On Fri, 11 Feb 2011 16:23:47 +0100 >> Jiri Pirko <jpirko@redhat.com> wrote: >> >> > >> > Signed-off-by: Jiri Pirko <jpirko@redhat.com> >> > >Never mind, this is good. I was confusing slave with bridge initialization >and netdevice ops with ethtool ops. > >Ethtool ops seems to be growing like weeds lately... This was replaced by: bridge: implement [add/del]_slave ops never intended to be in ethtool > > > >-- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 5564435..5648002 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -297,6 +297,46 @@ void br_netpoll_disable(struct net_bridge_port *p) #endif +static int br_add_slave(struct net_device *dev, struct net_device *slave_dev) +{ + struct net_bridge *br = netdev_priv(dev); + + return br_add_if(br, slave_dev); +} + +static int br_del_slave(struct net_device *dev, struct net_device *slave_dev) +{ + struct net_bridge *br = netdev_priv(dev); + + return br_del_if(br, slave_dev); +} + +static int br_get_slave_count(const struct net_device *dev) +{ + struct net_bridge *br = netdev_priv(dev); + struct net_bridge_port *p; + int i = 0; + + list_for_each_entry(p, &br->port_list, list) { + i++; + } + return i; +} + +static struct net_device *br_get_slave(const struct net_device *dev, + int slave_index) +{ + struct net_bridge *br = netdev_priv(dev); + struct net_bridge_port *p; + int i = 0; + + list_for_each_entry(p, &br->port_list, list) { + if (slave_index == i++) + return p->dev; + } + return NULL; +} + static const struct ethtool_ops br_ethtool_ops = { .get_drvinfo = br_getinfo, .get_link = ethtool_op_get_link, @@ -326,6 +366,10 @@ static const struct net_device_ops br_netdev_ops = { .ndo_netpoll_cleanup = br_netpoll_cleanup, .ndo_poll_controller = br_poll_controller, #endif + .ndo_add_slave = br_add_slave, + .ndo_del_slave = br_del_slave, + .ndo_get_slave_count = br_get_slave_count, + .ndo_get_slave = br_get_slave, }; static void br_dev_free(struct net_device *dev)
Signed-off-by: Jiri Pirko <jpirko@redhat.com> --- net/bridge/br_device.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)