Skip to content

Commit 3d249d4

Browse files
Jiri Pirkodavem330
Jiri Pirko
authored andcommitted
net: introduce ethernet teaming device
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver. 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. Python binding of libteam was recently introduced. Daemon providing arpmon/miimon active-backup functionality will be introduced shortly. All what's necessary is already implemented in kernel team driver. v7->v8: - check ndo_ndo_vlan_rx_[add/kill]_vid functions before calling them. - use dev_kfree_skb_any() instead of dev_kfree_skb() v6->v7: - transmit and receive functions are not checked in hot paths. That also resolves memory leak on transmit when no port is present v5->v6: - changed couple of _rcu calls to non _rcu ones in non-readers v4->v5: - team_change_mtu() uses team->lock while travesing though port list - mac address changes are moved completely to jurisdiction of userspace daemon. This way the daemon can do FOM1, FOM2 and possibly other weird things with mac addresses. Only round-robin mode sets up all ports to bond's address then enslaved. - Extended Kconfig text v3->v4: - remove redundant synchronize_rcu from __team_change_mode() - revert "set and clear of mode_ops happens per pointer, not per byte" - extend comment of function __team_change_mode() v2->v3: - team_change_mtu() uses rcu version of list traversal to unwind - set and clear of mode_ops happens per pointer, not per byte - port hashlist changed to be embedded into team structure - error branch in team_port_enter() does cleanup now - fixed rtln->rtnl v1->v2: - modes are made as modules. Makes team more modular and extendable. - several commenters' nitpicks found on v1 were fixed - several other bugs were fixed. - note I ignored Eric's comment about roundrobin port selector as Eric's way may be easily implemented as another mode (mode "random") in future. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5d70b88 commit 3d249d4

File tree

12 files changed

+2133
-0
lines changed

12 files changed

+2133
-0
lines changed

Documentation/networking/team.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Team devices are driven from userspace via libteam library which is here:
2+
https://github.com/jpirko/libteam

MAINTAINERS

+7
Original file line numberDiff line numberDiff line change
@@ -6484,6 +6484,13 @@ W: http://tcp-lp-mod.sourceforge.net/
64846484
S: Maintained
64856485
F: net/ipv4/tcp_lp.c
64866486

6487+
TEAM DRIVER
6488+
M: Jiri Pirko <jpirko@redhat.com>
6489+
L: netdev@vger.kernel.org
6490+
S: Supported
6491+
F: drivers/net/team/
6492+
F: include/linux/if_team.h
6493+
64876494
TEGRA SUPPORT
64886495
M: Colin Cross <ccross@android.com>
64896496
M: Olof Johansson <olof@lixom.net>

drivers/net/Kconfig

+2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ config IFB
125125
'ifb1' etc.
126126
Look at the iproute2 documentation directory for usage etc
127127

128+
source "drivers/net/team/Kconfig"
129+
128130
config MACVLAN
129131
tristate "MAC-VLAN support (EXPERIMENTAL)"
130132
depends on EXPERIMENTAL

drivers/net/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ obj-$(CONFIG_NET) += Space.o loopback.o
1717
obj-$(CONFIG_NETCONSOLE) += netconsole.o
1818
obj-$(CONFIG_PHYLIB) += phy/
1919
obj-$(CONFIG_RIONET) += rionet.o
20+
obj-$(CONFIG_NET_TEAM) += team/
2021
obj-$(CONFIG_TUN) += tun.o
2122
obj-$(CONFIG_VETH) += veth.o
2223
obj-$(CONFIG_VIRTIO_NET) += virtio_net.o

drivers/net/team/Kconfig

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
menuconfig NET_TEAM
2+
tristate "Ethernet team driver support (EXPERIMENTAL)"
3+
depends on EXPERIMENTAL
4+
---help---
5+
This allows one to create virtual interfaces that teams together
6+
multiple ethernet devices.
7+
8+
Team devices can be added using the "ip" command from the
9+
iproute2 package:
10+
11+
"ip link add link [ address MAC ] [ NAME ] type team"
12+
13+
To compile this driver as a module, choose M here: the module
14+
will be called team.
15+
16+
if NET_TEAM
17+
18+
config NET_TEAM_MODE_ROUNDROBIN
19+
tristate "Round-robin mode support"
20+
depends on NET_TEAM
21+
---help---
22+
Basic mode where port used for transmitting packets is selected in
23+
round-robin fashion using packet counter.
24+
25+
All added ports are setup to have bond's mac address.
26+
27+
To compile this team mode as a module, choose M here: the module
28+
will be called team_mode_roundrobin.
29+
30+
config NET_TEAM_MODE_ACTIVEBACKUP
31+
tristate "Active-backup mode support"
32+
depends on NET_TEAM
33+
---help---
34+
Only one port is active at a time and the rest of ports are used
35+
for backup.
36+
37+
Mac addresses of ports are not modified. Userspace is responsible
38+
to do so.
39+
40+
To compile this team mode as a module, choose M here: the module
41+
will be called team_mode_activebackup.
42+
43+
endif # NET_TEAM

drivers/net/team/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Makefile for the network team driver
3+
#
4+
5+
obj-$(CONFIG_NET_TEAM) += team.o
6+
obj-$(CONFIG_NET_TEAM_MODE_ROUNDROBIN) += team_mode_roundrobin.o
7+
obj-$(CONFIG_NET_TEAM_MODE_ACTIVEBACKUP) += team_mode_activebackup.o

0 commit comments

Comments
 (0)