net: introduce ethernet teaming device
Subsystems (3)
RFC PATCH 1/1 net: introduce ethernet teaming device
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven parallel to existing bonding device. Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.
team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
In near future python binding for libteam will be introduced. Also daemon providing arpmon/miimon active-backup functionality will be introduced. All what's necessary is already implemented in kernel team driver.
Plan is to support 8023ad in near future with it's logic mainly in userspace daemon as well.
Please review, try, comment. All feedback would be much appreciated.
--- MAINTAINERS | 7 + drivers/net/Kconfig | 15 + drivers/net/Makefile | 1 + drivers/net/team.c | 1783 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/Kbuild | 1 + include/linux/if.h | 1 + include/linux/if_team.h | 126 ++++ 7 files changed, 1934 insertions(+), 0 deletions(-) create mode 100644 drivers/net/team.c create mode 100644 include/linux/if_team.h
MAINTAINERS +7 -0
@@ -6372,6 +6372,13 @@ W: http://tcp-lp-mod.sourceforge.net/ S: Maintained F: net/ipv4/tcp_lp.c +TEAM DRIVER +M: Jiri Pirko <[email protected]> +L: [email protected] +S: Supported +F: drivers/net/team.c +F: include/linux/team.h + TEGRA SUPPORT M: Colin Cross <[email protected]> M: Erik Gilling <[email protected]>
drivers/net/Kconfig +15 -0
@@ -125,6 +125,21 @@ config IFB 'ifb1' etc. Look at the iproute2 documentation directory for usage etc +config NET_TEAM + tristate "Ethernet teaming support (EXPERIMENTAL)" + depends on EXPERIMENTAL + ---help--- + This allows one to create virtual interfaces that teams together + multiple ethernet devices. + + Team devices can be added using the "ip" command from the + iproute2 package: + + "ip link add link [ address MAC ] [ NAME ] type team" + + To compile this driver as a module, choose M here: the module + will be called team. + config MACVLAN tristate "MAC-VLAN support (EXPERIMENTAL)" depends on EXPERIMENTAL
drivers/net/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_NET) += Space.o loopback.o obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_PHYLIB) += phy/ obj-$(CONFIG_RIONET) += rionet.o +obj-$(CONFIG_NET_TEAM) += team.o obj-$(CONFIG_TUN) += tun.o obj-$(CONFIG_VETH) += veth.o obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
drivers/net/team.c new file +1783 -0
1,783 lines not on this page · raw message
include/linux/Kbuild +1 -0
@@ -185,6 +185,7 @@ header-y += if_pppol2tp.h header-y += if_pppox.h header-y += if_slip.h header-y += if_strip.h +header-y += if_team.h header-y += if_tr.h header-y += if_tun.h header-y += if_tunnel.h
include/linux/if.h +1 -0
@@ -79,6 +79,7 @@#define IFF_TX_SKB_SHARING 0x10000/* The interface supports sharing * skbs on transmit */ #define IFF_UNICAST_FLT 0x20000/* Supports unicast filtering */ +#define IFF_TEAM_PORT 0x40000/* device used as teaming port */ #define IF_GET_IFACE 0x0001/* for querying only */ #define IF_GET_PROTO 0x0002
include/linux/if_team.h new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
1.7.6
drivers/net/team.c line 962
Quoted 12 lines · On Fri, 30 Sep 2011 14:44:03 +0200 Jiri Pirko <[email protected]> wrote:
drivers/net/team.c new file +12
-0+static struct rtnl_link_stats64 *team_get_stats (struct net_device *dev, +struct rtnl_link_stats64 *stats) +{ +struct team *team =netdev_priv (dev); +struct rtnl_link_stats64 temp; +struct team_port *port; + +memset (stats,0 ,sizeof (*stats)); + +rcu_read_lock (); +list_for_each_entry_rcu (port, &team->port_list, list) { +const struct rtnl_link_stats64 *pstats;
You need to use u64_stats_sync macros to make this safe on 32 bit mode.
Also, I am not sure about the handling of speed and duplex. There are people who do active backup with links of different speeds.
The team device doesn't seem to handle hardware offload features as completely as it should. The TSO and transmit checksumming should be the union of the teamed ports.
Quoted 18 lines · Fri, Sep 30, 2011 at 06:26:19PM CEST, [email protected] wrote:
drivers/net/team.c line 962
Quoted 12 lines · On Fri, 30 Sep 2011 14:44:03 +0200 Jiri Pirko <[email protected]> wrote:
drivers/net/team.c new file +12
-0+static struct rtnl_link_stats64 *team_get_stats (struct net_device *dev, +struct rtnl_link_stats64 *stats) +{ +struct team *team =netdev_priv (dev); +struct rtnl_link_stats64 temp; +struct team_port *port; + +memset (stats,0 ,sizeof (*stats)); + +rcu_read_lock (); +list_for_each_entry_rcu (port, &team->port_list, list) { +const struct rtnl_link_stats64 *pstats;You need to use
u64_stats_syncmacros to make this safe on 32 bit mode.
Well I'm doing this the same way it's done on several other place, as for example bonding.
Quoted 3 lines
Also, I am not sure about the handling of speed and duplex. There are people who do active backup with links of different speeds.
Yes, team can handle multiple ifaces with different speeds and duplexes. Why would you think it cannot?
Quoted 5 lines
The team device doesn't seem to handle hardware offload features as completely as it should. The TSO and transmit checksumming should be the union of the teamed ports.
Yeah, you are right here. I probably need something like bond_compute_features() for team. Will add that.
Thank you Stephen.
Jirka
Quoted 15 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven parallel to existing bonding device. Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
In near future python binding for libteam will be introduced. Also daemon providing arpmon/miimon active-backup functionality will be introduced. All what's necessary is already implemented in kernel team driver.
Quoted 6 lines
Plan is to support 8023ad in near future with it's logic mainly in userspace daemon as well.
Please review, try, comment. All feedback would be much appreciated.
Signed-off-by Jiri Pirko <[email protected]>
Not to push my own agenda too much but you might want to take a look at Open vSwitch. It uses the same strategy of userspace directed bonding and already supports active-backup, 802.3ad, and quite a few other networking tools all controlled by userspace.
I know there's been a lot of talk and not a lot of action when it comes to upstreaming but that's changing. We're fixing up a few loose ends in the userspace/kernel interface and then intend to propose a patch fairly soon.
Quoted 28 lines · Sat, Oct 01, 2011 at 08:15:01PM CEST, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven parallel to existing bonding device. Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
In near future python binding for libteam will be introduced. Also daemon providing arpmon/miimon active-backup functionality will be introduced. All what's necessary is already implemented in kernel team driver.
Quoted 6 lines
Plan is to support 8023ad in near future with it's logic mainly in userspace daemon as well.
Please review, try, comment. All feedback would be much appreciated.
Signed-off-by Jiri Pirko <[email protected]>Not to push my own agenda too much but you might want to take a look at Open vSwitch. It uses the same strategy of userspace directed bonding and already supports active-backup, 802.3ad, and quite a few other networking tools all controlled by userspace.
Quoted 4 lines
I know there's been a lot of talk and not a lot of action when it comes to upstreaming but that's changing. We're fixing up a few loose ends in the userspace/kernel interface and then intend to propose a patch fairly soon.
Looks interesting. From quick peak the code is much bigger and fairly complicated. The main reason for doing "team" is to do ethernet teaming in as much simple way as it can be done. Final user destination areas of openvswitch and team seem different to me.
Jirka
Quoted 34 lines · Jiri Pirko
Quoted 28 lines · Sat, Oct 01, 2011 at 08:15:01PM CEST, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven parallel to existing bonding device. Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
In near future python binding for libteam will be introduced. Also daemon providing arpmon/miimon active-backup functionality will be introduced. All what's necessary is already implemented in kernel team driver.
Quoted 6 lines
Plan is to support 8023ad in near future with it's logic mainly in userspace daemon as well.
Please review, try, comment. All feedback would be much appreciated.
Signed-off-by Jiri Pirko <[email protected]>Not to push my own agenda too much but you might want to take a look at Open vSwitch. It uses the same strategy of userspace directed bonding and already supports active-backup, 802.3ad, and quite a few other networking tools all controlled by userspace.
Quoted 4 lines
I know there's been a lot of talk and not a lot of action when it comes to upstreaming but that's changing. We're fixing up a few loose ends in the userspace/kernel interface and then intend to propose a patch fairly soon.
Quoted 4 lines
Looks interesting. From quick peak the code is much bigger and fairly complicated. The main reason for doing "team" is to do ethernet teaming in as much simple way as it can be done. Final user destination areas of openvswitch and team seem different to me.
Yes, to the end user Open vSwitch is clearly a much larger and more complex component. I just thought it might be of interest to you since it already implements some of the features that you are looking at and the kernel portion, at least, has similar goals of pushing more logic to userspace.