diff options
author | Eugenia Emantayev <eugenia@mellanox.com> | 2014-10-27 05:37:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-28 17:18:01 -0400 |
commit | 207af6c5073021dfe32ae01d342a4dbf08e57515 (patch) | |
tree | 1ece44e291837c2c1ee497796f24035dca9fad70 /drivers/net/ethernet | |
parent | f4a36751584bbdfcfd6f3f232e0fe899763434a4 (diff) |
net/mlx4_en: Move spinlocks and work initalizations to beginning of init_netdev
Upon failures, destroy_netdev is called, and spinlocks/works must be
initialized before calling it. Otherwise kernel panic may occur.
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 0e77cb27d7d7..0efbae90f1ba 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -2440,6 +2440,21 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2440 | 2440 | ||
2441 | priv = netdev_priv(dev); | 2441 | priv = netdev_priv(dev); |
2442 | memset(priv, 0, sizeof(struct mlx4_en_priv)); | 2442 | memset(priv, 0, sizeof(struct mlx4_en_priv)); |
2443 | spin_lock_init(&priv->stats_lock); | ||
2444 | INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); | ||
2445 | INIT_WORK(&priv->watchdog_task, mlx4_en_restart); | ||
2446 | INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); | ||
2447 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); | ||
2448 | INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); | ||
2449 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2450 | INIT_WORK(&priv->vxlan_add_task, mlx4_en_add_vxlan_offloads); | ||
2451 | INIT_WORK(&priv->vxlan_del_task, mlx4_en_del_vxlan_offloads); | ||
2452 | #endif | ||
2453 | #ifdef CONFIG_RFS_ACCEL | ||
2454 | INIT_LIST_HEAD(&priv->filters); | ||
2455 | spin_lock_init(&priv->filters_lock); | ||
2456 | #endif | ||
2457 | |||
2443 | priv->dev = dev; | 2458 | priv->dev = dev; |
2444 | priv->mdev = mdev; | 2459 | priv->mdev = mdev; |
2445 | priv->ddev = &mdev->pdev->dev; | 2460 | priv->ddev = &mdev->pdev->dev; |
@@ -2471,16 +2486,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2471 | priv->cqe_size = mdev->dev->caps.cqe_size; | 2486 | priv->cqe_size = mdev->dev->caps.cqe_size; |
2472 | priv->mac_index = -1; | 2487 | priv->mac_index = -1; |
2473 | priv->msg_enable = MLX4_EN_MSG_LEVEL; | 2488 | priv->msg_enable = MLX4_EN_MSG_LEVEL; |
2474 | spin_lock_init(&priv->stats_lock); | ||
2475 | INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); | ||
2476 | INIT_WORK(&priv->watchdog_task, mlx4_en_restart); | ||
2477 | INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); | ||
2478 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); | ||
2479 | INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); | ||
2480 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2481 | INIT_WORK(&priv->vxlan_add_task, mlx4_en_add_vxlan_offloads); | ||
2482 | INIT_WORK(&priv->vxlan_del_task, mlx4_en_del_vxlan_offloads); | ||
2483 | #endif | ||
2484 | #ifdef CONFIG_MLX4_EN_DCB | 2489 | #ifdef CONFIG_MLX4_EN_DCB |
2485 | if (!mlx4_is_slave(priv->mdev->dev)) { | 2490 | if (!mlx4_is_slave(priv->mdev->dev)) { |
2486 | if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_SET_ETH_SCHED) { | 2491 | if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_SET_ETH_SCHED) { |
@@ -2523,11 +2528,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2523 | if (err) | 2528 | if (err) |
2524 | goto out; | 2529 | goto out; |
2525 | 2530 | ||
2526 | #ifdef CONFIG_RFS_ACCEL | ||
2527 | INIT_LIST_HEAD(&priv->filters); | ||
2528 | spin_lock_init(&priv->filters_lock); | ||
2529 | #endif | ||
2530 | |||
2531 | /* Initialize time stamping config */ | 2531 | /* Initialize time stamping config */ |
2532 | priv->hwtstamp_config.flags = 0; | 2532 | priv->hwtstamp_config.flags = 0; |
2533 | priv->hwtstamp_config.tx_type = HWTSTAMP_TX_OFF; | 2533 | priv->hwtstamp_config.tx_type = HWTSTAMP_TX_OFF; |