diff options
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_net.c | 6 | ||||
-rw-r--r-- | drivers/net/mlx4/en_netdev.c | 49 | ||||
-rw-r--r-- | drivers/net/mlx4/mlx4_en.h | 3 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l2_main.c | 2 | ||||
-rw-r--r-- | net/bluetooth/bnep/netdev.c | 10 |
5 files changed, 29 insertions, 41 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index 441c0642b30a..dba1c84058b7 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -1140,7 +1140,6 @@ static void wq_set_multicast_list (struct work_struct *work) | |||
1140 | dprintk("%s: allmulti mode\n", dev->name); | 1140 | dprintk("%s: allmulti mode\n", dev->name); |
1141 | priv->rx_mode = RX_MODE_ALL_MULTI; | 1141 | priv->rx_mode = RX_MODE_ALL_MULTI; |
1142 | } else if (!netdev_mc_empty(dev)) { | 1142 | } else if (!netdev_mc_empty(dev)) { |
1143 | int mci; | ||
1144 | struct dev_mc_list *mc; | 1143 | struct dev_mc_list *mc; |
1145 | 1144 | ||
1146 | dprintk("%s: set_mc_list, %d entries\n", | 1145 | dprintk("%s: set_mc_list, %d entries\n", |
@@ -1149,11 +1148,8 @@ static void wq_set_multicast_list (struct work_struct *work) | |||
1149 | priv->rx_mode = RX_MODE_MULTI; | 1148 | priv->rx_mode = RX_MODE_MULTI; |
1150 | priv->multi_num = 0; | 1149 | priv->multi_num = 0; |
1151 | 1150 | ||
1152 | for (mci = 0, mc=dev->mc_list; | 1151 | netdev_for_each_mc_addr(mc, dev) |
1153 | mci < netdev_mc_count(dev); | ||
1154 | mc = mc->next, mci++) { | ||
1155 | dvb_set_mc_filter(dev, mc); | 1152 | dvb_set_mc_filter(dev, mc); |
1156 | } | ||
1157 | } | 1153 | } |
1158 | 1154 | ||
1159 | netif_addr_unlock_bh(dev); | 1155 | netif_addr_unlock_bh(dev); |
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index c48b0f4b17b7..7cd0933735e2 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
@@ -160,39 +160,29 @@ static void mlx4_en_do_set_mac(struct work_struct *work) | |||
160 | static void mlx4_en_clear_list(struct net_device *dev) | 160 | static void mlx4_en_clear_list(struct net_device *dev) |
161 | { | 161 | { |
162 | struct mlx4_en_priv *priv = netdev_priv(dev); | 162 | struct mlx4_en_priv *priv = netdev_priv(dev); |
163 | struct dev_mc_list *plist = priv->mc_list; | ||
164 | struct dev_mc_list *next; | ||
165 | 163 | ||
166 | while (plist) { | 164 | kfree(priv->mc_addrs); |
167 | next = plist->next; | 165 | priv->mc_addrs_cnt = 0; |
168 | kfree(plist); | ||
169 | plist = next; | ||
170 | } | ||
171 | priv->mc_list = NULL; | ||
172 | } | 166 | } |
173 | 167 | ||
174 | static void mlx4_en_cache_mclist(struct net_device *dev) | 168 | static void mlx4_en_cache_mclist(struct net_device *dev) |
175 | { | 169 | { |
176 | struct mlx4_en_priv *priv = netdev_priv(dev); | 170 | struct mlx4_en_priv *priv = netdev_priv(dev); |
177 | struct dev_mc_list *mclist; | 171 | struct dev_mc_list *mclist; |
178 | struct dev_mc_list *tmp; | 172 | char *mc_addrs; |
179 | struct dev_mc_list *plist = NULL; | 173 | int mc_addrs_cnt = netdev_mc_count(dev); |
180 | 174 | int i; | |
181 | for (mclist = dev->mc_list; mclist; mclist = mclist->next) { | 175 | |
182 | tmp = kmalloc(sizeof(struct dev_mc_list), GFP_ATOMIC); | 176 | mc_addrs = kmalloc(mc_addrs_cnt * ETH_ALEN, GFP_ATOMIC); |
183 | if (!tmp) { | 177 | if (!mc_addrs) { |
184 | en_err(priv, "failed to allocate multicast list\n"); | 178 | en_err(priv, "failed to allocate multicast list\n"); |
185 | mlx4_en_clear_list(dev); | 179 | return; |
186 | return; | ||
187 | } | ||
188 | memcpy(tmp, mclist, sizeof(struct dev_mc_list)); | ||
189 | tmp->next = NULL; | ||
190 | if (plist) | ||
191 | plist->next = tmp; | ||
192 | else | ||
193 | priv->mc_list = tmp; | ||
194 | plist = tmp; | ||
195 | } | 180 | } |
181 | i = 0; | ||
182 | netdev_for_each_mc_addr(mclist, dev) | ||
183 | memcpy(mc_addrs + i++ * ETH_ALEN, mclist->dmi_addr, ETH_ALEN); | ||
184 | priv->mc_addrs = mc_addrs; | ||
185 | priv->mc_addrs_cnt = mc_addrs_cnt; | ||
196 | } | 186 | } |
197 | 187 | ||
198 | 188 | ||
@@ -212,7 +202,6 @@ static void mlx4_en_do_set_multicast(struct work_struct *work) | |||
212 | mcast_task); | 202 | mcast_task); |
213 | struct mlx4_en_dev *mdev = priv->mdev; | 203 | struct mlx4_en_dev *mdev = priv->mdev; |
214 | struct net_device *dev = priv->dev; | 204 | struct net_device *dev = priv->dev; |
215 | struct dev_mc_list *mclist; | ||
216 | u64 mcast_addr = 0; | 205 | u64 mcast_addr = 0; |
217 | int err; | 206 | int err; |
218 | 207 | ||
@@ -288,6 +277,8 @@ static void mlx4_en_do_set_multicast(struct work_struct *work) | |||
288 | if (err) | 277 | if (err) |
289 | en_err(priv, "Failed disabling multicast filter\n"); | 278 | en_err(priv, "Failed disabling multicast filter\n"); |
290 | } else { | 279 | } else { |
280 | int i; | ||
281 | |||
291 | err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, | 282 | err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, |
292 | 0, MLX4_MCAST_DISABLE); | 283 | 0, MLX4_MCAST_DISABLE); |
293 | if (err) | 284 | if (err) |
@@ -302,8 +293,9 @@ static void mlx4_en_do_set_multicast(struct work_struct *work) | |||
302 | netif_tx_lock_bh(dev); | 293 | netif_tx_lock_bh(dev); |
303 | mlx4_en_cache_mclist(dev); | 294 | mlx4_en_cache_mclist(dev); |
304 | netif_tx_unlock_bh(dev); | 295 | netif_tx_unlock_bh(dev); |
305 | for (mclist = priv->mc_list; mclist; mclist = mclist->next) { | 296 | for (i = 0; i < priv->mc_addrs_cnt; i++) { |
306 | mcast_addr = mlx4_en_mac_to_u64(mclist->dmi_addr); | 297 | mcast_addr = |
298 | mlx4_en_mac_to_u64(priv->mc_addrs + i * ETH_ALEN); | ||
307 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, | 299 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, |
308 | mcast_addr, 0, MLX4_MCAST_CONFIG); | 300 | mcast_addr, 0, MLX4_MCAST_CONFIG); |
309 | } | 301 | } |
@@ -984,7 +976,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
984 | priv->flags = prof->flags; | 976 | priv->flags = prof->flags; |
985 | priv->tx_ring_num = prof->tx_ring_num; | 977 | priv->tx_ring_num = prof->tx_ring_num; |
986 | priv->rx_ring_num = prof->rx_ring_num; | 978 | priv->rx_ring_num = prof->rx_ring_num; |
987 | priv->mc_list = NULL; | ||
988 | priv->mac_index = -1; | 979 | priv->mac_index = -1; |
989 | priv->msg_enable = MLX4_EN_MSG_LEVEL; | 980 | priv->msg_enable = MLX4_EN_MSG_LEVEL; |
990 | spin_lock_init(&priv->stats_lock); | 981 | spin_lock_init(&priv->stats_lock); |
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h index 82c3ebc584e3..b55e46c8b682 100644 --- a/drivers/net/mlx4/mlx4_en.h +++ b/drivers/net/mlx4/mlx4_en.h | |||
@@ -492,7 +492,8 @@ struct mlx4_en_priv { | |||
492 | struct mlx4_en_perf_stats pstats; | 492 | struct mlx4_en_perf_stats pstats; |
493 | struct mlx4_en_pkt_stats pkstats; | 493 | struct mlx4_en_pkt_stats pkstats; |
494 | struct mlx4_en_port_stats port_stats; | 494 | struct mlx4_en_port_stats port_stats; |
495 | struct dev_mc_list *mc_list; | 495 | char *mc_addrs; |
496 | int mc_addrs_cnt; | ||
496 | struct mlx4_en_stat_out_mbox hw_stats; | 497 | struct mlx4_en_stat_out_mbox hw_stats; |
497 | }; | 498 | }; |
498 | 499 | ||
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 6f1e3036bafd..7576ad5a833a 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -619,7 +619,7 @@ static void qeth_l2_set_multicast_list(struct net_device *dev) | |||
619 | return; | 619 | return; |
620 | qeth_l2_del_all_mc(card); | 620 | qeth_l2_del_all_mc(card); |
621 | spin_lock_bh(&card->mclock); | 621 | spin_lock_bh(&card->mclock); |
622 | for (dm = dev->mc_list; dm; dm = dm->next) | 622 | netdev_for_each_mc_addr(dm, dev) |
623 | qeth_l2_add_mc(card, dm->da_addr, 0); | 623 | qeth_l2_add_mc(card, dm->da_addr, 0); |
624 | 624 | ||
625 | netdev_for_each_uc_addr(ha, dev) | 625 | netdev_for_each_uc_addr(ha, dev) |
diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c index b6234b73c4cf..326ab453edb7 100644 --- a/net/bluetooth/bnep/netdev.c +++ b/net/bluetooth/bnep/netdev.c | |||
@@ -87,7 +87,7 @@ static void bnep_net_set_mc_list(struct net_device *dev) | |||
87 | memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); | 87 | memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); |
88 | r->len = htons(ETH_ALEN * 2); | 88 | r->len = htons(ETH_ALEN * 2); |
89 | } else { | 89 | } else { |
90 | struct dev_mc_list *dmi = dev->mc_list; | 90 | struct dev_mc_list *dmi; |
91 | int i, len = skb->len; | 91 | int i, len = skb->len; |
92 | 92 | ||
93 | if (dev->flags & IFF_BROADCAST) { | 93 | if (dev->flags & IFF_BROADCAST) { |
@@ -97,12 +97,12 @@ static void bnep_net_set_mc_list(struct net_device *dev) | |||
97 | 97 | ||
98 | /* FIXME: We should group addresses here. */ | 98 | /* FIXME: We should group addresses here. */ |
99 | 99 | ||
100 | for (i = 0; | 100 | i = 0; |
101 | i < netdev_mc_count(dev) && i < BNEP_MAX_MULTICAST_FILTERS; | 101 | netdev_for_each_mc_addr(dmi, dev) { |
102 | i++) { | 102 | if (i == BNEP_MAX_MULTICAST_FILTERS) |
103 | break; | ||
103 | memcpy(__skb_put(skb, ETH_ALEN), dmi->dmi_addr, ETH_ALEN); | 104 | memcpy(__skb_put(skb, ETH_ALEN), dmi->dmi_addr, ETH_ALEN); |
104 | memcpy(__skb_put(skb, ETH_ALEN), dmi->dmi_addr, ETH_ALEN); | 105 | memcpy(__skb_put(skb, ETH_ALEN), dmi->dmi_addr, ETH_ALEN); |
105 | dmi = dmi->next; | ||
106 | } | 106 | } |
107 | r->len = htons(skb->len - len); | 107 | r->len = htons(skb->len - len); |
108 | } | 108 | } |