aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4/en_netdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/mlx4/en_netdev.c')
-rw-r--r--drivers/net/mlx4/en_netdev.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index c48b0f4b17b7..455464223b43 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)
160static void mlx4_en_clear_list(struct net_device *dev) 160static 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
174static void mlx4_en_cache_mclist(struct net_device *dev) 168static 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 netdev_hw_addr *ha;
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(ha, dev)
183 memcpy(mc_addrs + i++ * ETH_ALEN, ha->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 }
@@ -511,7 +503,7 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
511 503
512 err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0); 504 err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
513 if (err) 505 if (err)
514 en_dbg(HW, priv, "Could not update stats \n"); 506 en_dbg(HW, priv, "Could not update stats\n");
515 507
516 mutex_lock(&mdev->state_lock); 508 mutex_lock(&mdev->state_lock);
517 if (mdev->device_up) { 509 if (mdev->device_up) {
@@ -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);