Add suppport for sync of hw addresses to multiple devices.
Subsystems (3)
v2 cover Add suppport for sync of hw addresses to multiple devices.
Current dev_[uc|mc]_addr_sync() API currently correctly syncs the addresses to the first device. Any subsequent calls to sync will not do anything since the synched variable will be set. This variable is used as an optimization to skip over addresses that have been synched.
There are some devices (ex: team) that attempt to do the above. There is other work in progress that needs to above to work corretly.
The short series introduces dev_[uc|mc]_addr_synch_multiple() that allows multiple calls to sync to multiple different devices. Original API is left alone and still has the limitation.
Changes since v1:
- Commit abstract corrections.
Vlad Yasevich (2):
net: add dev_uc_sync_multiple() and dev_mc_sync_multiple() api
team: Use new sync_multiple api to sync devices adressess.
drivers/net/team/team.c | 4 +- include/linux/netdevice.h | 3 + net/core/dev_addr_lists.c | 210 ++++++++++++++++++++++++++++++++++++--------- 3 files changed, 173 insertions(+), 44 deletions(-)
Signature · 1 line
1.7.7.6
PATCH v2 1/2 net: add dev_uc_sync_multiple() and dev_mc_sync_multiple() api
The current implementation of dev_uc_sync/unsync() assumes that there is a strict 1-to-1 relationship between the source and destination of the sync. In other words, once an address has been synced to a destination device, it will not be synced to any other device through the sync API. However, there are some virtual devices that aggreate a number of lower devices and need to sync addresses to all of them. The current API falls short there.
This patch introduces a new dev_uc_sync_multiple() api that can be called in the above circumstances and allows sync to work for every invocation.
--- include/linux/netdevice.h | 3 + net/core/dev_addr_lists.c | 210 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 171 insertions(+), 42 deletions(-)
include/linux/netdevice.h +3 -0
@@ -211,6 +211,7 @@ struct netdev_hw_addr {#define NETDEV_HW_ADDR_T_UNICAST 4#define NETDEV_HW_ADDR_T_MULTICAST 5bool global_use; +int sync_cnt;int refcount;int synced;struct rcu_head rcu_head;
@@ -2621,6 +2622,7 @@ extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);extern int dev_uc_add_excl (struct net_device *dev,const unsigned char *addr);extern int dev_uc_del (struct net_device *dev,const unsigned char *addr);extern int dev_uc_sync (struct net_device *to,struct net_device *from); +extern int dev_uc_sync_multiple (struct net_device *to,struct net_device *from);extern void dev_uc_unsync (struct net_device *to,struct net_device *from);extern void dev_uc_flush (struct net_device *dev);extern void dev_uc_init (struct net_device *dev);
@@ -2632,6 +2634,7 @@ extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);extern int dev_mc_del (struct net_device *dev,const unsigned char *addr);extern int dev_mc_del_global (struct net_device *dev,const unsigned char *addr);extern int dev_mc_sync (struct net_device *to,struct net_device *from); +extern int dev_mc_sync_multiple (struct net_device *to,struct net_device *from);extern void dev_mc_unsync (struct net_device *to,struct net_device *from);extern void dev_mc_flush (struct net_device *dev);extern void dev_mc_init (struct net_device *dev);
net/core/dev_addr_lists.c +168 -42
322 lines not on this page · raw message
Signature · 1 line
1.7.7.6
PATCH v2 2/2 team: Use new sync_multiple api to sync devices adressess.
In reply to Vlad YasevichTeam drivers attempts to sync addresses to each of the port devices; however, the current api doesn't really perform the sync for any device after the first one. Switch to using the new api that will actually sync the addresses to all ports.
--- drivers/net/team/team.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/team/team.c +2 -2
@@ -1491,8 +1491,8 @@ static void team_set_rx_mode(struct net_device *dev)rcu_read_lock ();list_for_each_entry_rcu (port, &team->port_list, list) { -dev_uc_sync (port->dev, dev); -dev_mc_sync (port->dev, dev); +dev_uc_sync_multiple (port->dev, dev); +dev_mc_sync_multiple (port->dev, dev); }rcu_read_unlock (); }
Signature · 1 line
1.7.7.6
David Miller
maintainerFrom: Vlad Yasevich <[email protected]>
Date: Mon, 15 Apr 2013 15:54:24 -0400
Quoted 6 lines
Current dev_[uc|mc]_addr_sync() API currently correctly syncs the addresses to the first device. Any subsequent calls to sync will not do anything since the synched variable will be set. This variable is used as an optimization to skip over addresses that have been synched.
Quoted 6 lines
There are some devices (ex: team) that attempt to do the above. There is other work in progress that needs to above to work corretly.
The short series introduces dev_[uc|mc]_addr_synch_multiple() that allows multiple calls to sync to multiple different devices. Original API is left alone and still has the limitation.
Looks good, applied to net-next, thanks!