Skip to contentSkip to conversation

Add suppport for sync of hw addresses to multiple devices.

PATCH Superseded Vlad Yasevich 2 participants 9 messages Apr 15, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

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
#1 lore raw

PATCH 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 case. This is not always the case. Some virtual devices aggreated a number of lower devices and need to sync the address 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
index 6151e90..4c5d42a 100644
@@ -211,6 +211,7 @@ struct netdev_hw_addr {
 #define NETDEV_HW_ADDR_T_UNICAST	4
 #define NETDEV_HW_ADDR_T_MULTICAST	5
 	bool			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
maintainer
#2 lore raw

Re: [PATCH 1/2] net: add dev_uc_sync_multiple() and dev_mc_sync_multiple() api

From: Vlad Yasevich <[email protected]>
Date: Mon, 15 Apr 2013 15:09:56 -0400

Quoted 11 lines

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 case. This is not always the case. Some virtual devices aggreated a number of lower devices and need to sync the address 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.

Did patch #2 get killed by a cosmic ray? :-)

I didn't see it get posted yet.

#3 lore raw

Re: [PATCH 1/2] net: add dev_uc_sync_multiple() and dev_mc_sync_multiple() api

Quoted 12 lines · David Miller

From: Vlad Yasevich <[email protected]>
Date: Mon, 15 Apr 2013 15:09:56 -0400

Quoted 9 lines

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 case. This is not always the case. Some virtual devices aggreated a number of lower devices and need to sync the address 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.

Quoted 7 lines
Quoted 2 lines

Did patch #2 get killed by a cosmic ray? :-)

I didn't see it get posted yet.

I got a CC copy. I'll let float for a few more minutes. If it doesn't arrive, I'll resend it.

-vlad

#6 lore raw

PATCH 2/2 team: Use new sync_multiple api to sync devices adressess.

In reply to Vlad Yasevich

Team drivers attempts to sync addresses to each of of the port devices; however, the current api doesn't do anything for anything after the first device. 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
index bf34192..33d89f8 100644
@@ -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
maintainer
#4 lore raw

Re: [PATCH 1/2] net: add dev_uc_sync_multiple() and dev_mc_sync_multiple() api

In reply to Vlad Yasevich

From: Vlad Yasevich <[email protected]>
Date: Mon, 15 Apr 2013 15:09:56 -0400

Quoted 2 lines

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 case.

What do you mean by "destination of the case", maybe use different words here.

maintainer
#7 lore raw

Re: [PATCH 2/2] team: Use new sync_multiple api to sync devices adressess.

In reply to Vlad Yasevich

From: Vlad Yasevich <[email protected]>
Date: Mon, 15 Apr 2013 15:09:57 -0400

Quoted 1 line

Team drivers attempts to sync addresses to each of of the port

                                                  ^^^^^

Maybe you meant only one "of" here.

Quoted 3 lines

devices; however, the current api doesn't do anything for anything after the first device. Switch to using the new api that will actually sync the addresses to all ports.

"anything for anything" sounds awkward, perhaps "anything for devices on the list after the first device" or something like that.

Thanks.

#5 lore raw

Re: [PATCH 1/2] net: add dev_uc_sync_multiple() and dev_mc_sync_multiple() api

In reply to David Miller
Quoted 8 lines · David Miller

From: Vlad Yasevich <[email protected]>
Date: Mon, 15 Apr 2013 15:09:56 -0400

Quoted 2 lines

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 case.

What do you mean by "destination of the case", maybe use different words here.

That should be "source and destination of the sync".

will fix.

-vlad

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH 2/2] team: Use new sync_multiple api to sync devices adressess.

In reply to David Miller
Quoted 6 lines · David Miller

From: Vlad Yasevich <[email protected]>
Date: Mon, 15 Apr 2013 15:09:57 -0400

Quoted 1 line

Team drivers attempts to sync addresses to each of of the port

                                                   ^^^^^
Quoted 9 lines

Maybe you meant only one "of" here.

Quoted 3 lines

devices; however, the current api doesn't do anything for anything after the first device. Switch to using the new api that will actually sync the addresses to all ports.

"anything for anything" sounds awkward, perhaps "anything for devices on the list after the first device" or something like that.

yes will fix.

-vlad

Quoted 6 lines

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html