diff options
Diffstat (limited to 'net/core/dev_mcast.c')
-rw-r--r-- | net/core/dev_mcast.c | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index cadbfbf7e7f..cec582563e0 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c | |||
@@ -113,32 +113,15 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) | |||
113 | * locked by netif_tx_lock_bh. | 113 | * locked by netif_tx_lock_bh. |
114 | * | 114 | * |
115 | * This function is intended to be called from the dev->set_multicast_list | 115 | * This function is intended to be called from the dev->set_multicast_list |
116 | * function of layered software devices. | 116 | * or dev->set_rx_mode function of layered software devices. |
117 | */ | 117 | */ |
118 | int dev_mc_sync(struct net_device *to, struct net_device *from) | 118 | int dev_mc_sync(struct net_device *to, struct net_device *from) |
119 | { | 119 | { |
120 | struct dev_addr_list *da, *next; | ||
121 | int err = 0; | 120 | int err = 0; |
122 | 121 | ||
123 | netif_tx_lock_bh(to); | 122 | netif_tx_lock_bh(to); |
124 | da = from->mc_list; | 123 | err = __dev_addr_sync(&to->mc_list, &to->mc_count, |
125 | while (da != NULL) { | 124 | &from->mc_list, &from->mc_count); |
126 | next = da->next; | ||
127 | if (!da->da_synced) { | ||
128 | err = __dev_addr_add(&to->mc_list, &to->mc_count, | ||
129 | da->da_addr, da->da_addrlen, 0); | ||
130 | if (err < 0) | ||
131 | break; | ||
132 | da->da_synced = 1; | ||
133 | da->da_users++; | ||
134 | } else if (da->da_users == 1) { | ||
135 | __dev_addr_delete(&to->mc_list, &to->mc_count, | ||
136 | da->da_addr, da->da_addrlen, 0); | ||
137 | __dev_addr_delete(&from->mc_list, &from->mc_count, | ||
138 | da->da_addr, da->da_addrlen, 0); | ||
139 | } | ||
140 | da = next; | ||
141 | } | ||
142 | if (!err) | 125 | if (!err) |
143 | __dev_set_rx_mode(to); | 126 | __dev_set_rx_mode(to); |
144 | netif_tx_unlock_bh(to); | 127 | netif_tx_unlock_bh(to); |
@@ -160,23 +143,11 @@ EXPORT_SYMBOL(dev_mc_sync); | |||
160 | */ | 143 | */ |
161 | void dev_mc_unsync(struct net_device *to, struct net_device *from) | 144 | void dev_mc_unsync(struct net_device *to, struct net_device *from) |
162 | { | 145 | { |
163 | struct dev_addr_list *da, *next; | ||
164 | |||
165 | netif_tx_lock_bh(from); | 146 | netif_tx_lock_bh(from); |
166 | netif_tx_lock_bh(to); | 147 | netif_tx_lock_bh(to); |
167 | 148 | ||
168 | da = from->mc_list; | 149 | __dev_addr_unsync(&to->mc_list, &to->mc_count, |
169 | while (da != NULL) { | 150 | &from->mc_list, &from->mc_count); |
170 | next = da->next; | ||
171 | if (da->da_synced) { | ||
172 | __dev_addr_delete(&to->mc_list, &to->mc_count, | ||
173 | da->da_addr, da->da_addrlen, 0); | ||
174 | da->da_synced = 0; | ||
175 | __dev_addr_delete(&from->mc_list, &from->mc_count, | ||
176 | da->da_addr, da->da_addrlen, 0); | ||
177 | } | ||
178 | da = next; | ||
179 | } | ||
180 | __dev_set_rx_mode(to); | 151 | __dev_set_rx_mode(to); |
181 | 152 | ||
182 | netif_tx_unlock_bh(to); | 153 | netif_tx_unlock_bh(to); |