diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2012-06-24 20:24:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-25 19:30:12 -0400 |
commit | 044ca2a5f2f781c7e4b49c7c0a256913648297ea (patch) | |
tree | 9645a3cfcf0665d48377f2ce3d362dd5320ec64c /drivers/net | |
parent | 9858d2d1acf82758f779e0756d92a011f1d170b3 (diff) |
net/mlx4_en: Release QP range in free_resources
Add a missing resource release in ring cleanup.
Not doing this leaves a range of QPs that are being reserved,
and no one can use them.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index a80280eee06e..073b85b45fc5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -929,15 +929,20 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) | |||
929 | if (priv->rx_cq[i].buf) | 929 | if (priv->rx_cq[i].buf) |
930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); | 930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); |
931 | } | 931 | } |
932 | |||
933 | if (priv->base_tx_qpn) { | ||
934 | mlx4_qp_release_range(priv->mdev->dev, priv->base_tx_qpn, priv->tx_ring_num); | ||
935 | priv->base_tx_qpn = 0; | ||
936 | } | ||
932 | } | 937 | } |
933 | 938 | ||
934 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | 939 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) |
935 | { | 940 | { |
936 | struct mlx4_en_port_profile *prof = priv->prof; | 941 | struct mlx4_en_port_profile *prof = priv->prof; |
937 | int i; | 942 | int i; |
938 | int base_tx_qpn, err; | 943 | int err; |
939 | 944 | ||
940 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &base_tx_qpn); | 945 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &priv->base_tx_qpn); |
941 | if (err) { | 946 | if (err) { |
942 | en_err(priv, "failed reserving range for TX rings\n"); | 947 | en_err(priv, "failed reserving range for TX rings\n"); |
943 | return err; | 948 | return err; |
@@ -949,7 +954,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
949 | prof->tx_ring_size, i, TX)) | 954 | prof->tx_ring_size, i, TX)) |
950 | goto err; | 955 | goto err; |
951 | 956 | ||
952 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], base_tx_qpn + i, | 957 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], priv->base_tx_qpn + i, |
953 | prof->tx_ring_size, TXBB_SIZE)) | 958 | prof->tx_ring_size, TXBB_SIZE)) |
954 | goto err; | 959 | goto err; |
955 | } | 960 | } |
@@ -969,7 +974,6 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
969 | 974 | ||
970 | err: | 975 | err: |
971 | en_err(priv, "Failed to allocate NIC resources\n"); | 976 | en_err(priv, "Failed to allocate NIC resources\n"); |
972 | mlx4_qp_release_range(priv->mdev->dev, base_tx_qpn, priv->tx_ring_num); | ||
973 | return -ENOMEM; | 977 | return -ENOMEM; |
974 | } | 978 | } |
975 | 979 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 6ae350921b1a..225c20d47900 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -495,6 +495,7 @@ struct mlx4_en_priv { | |||
495 | int vids[128]; | 495 | int vids[128]; |
496 | bool wol; | 496 | bool wol; |
497 | struct device *ddev; | 497 | struct device *ddev; |
498 | int base_tx_qpn; | ||
498 | 499 | ||
499 | #ifdef CONFIG_MLX4_EN_DCB | 500 | #ifdef CONFIG_MLX4_EN_DCB |
500 | struct ieee_ets ets; | 501 | struct ieee_ets ets; |