aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
authorAlexander Guller <alexg@mellanox.com>2011-10-09 01:26:46 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-09 23:42:57 -0400
commitfe0af03c69abc2178fc4667664726ec1f688539b (patch)
tree82f809da0de1e1d67b8ef8a865ec32218f4757dd /drivers/net/ethernet/mellanox
parent76532d0c7e7424914ab6f24683c63e50f0a08f1c (diff)
mlx4_en: Removing reserve vectors
Fixed a bug where ring size change caused insufficient memory upon driver restart due to unreleased EQs. Signed-off-by: Alexander Guller <alexg@mellanox.co.il> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_cq.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h5
4 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
index 70ec5298a16a..227997d775e8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
@@ -139,14 +139,13 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
139 return 0; 139 return 0;
140} 140}
141 141
142void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, 142void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)
143 bool reserve_vectors)
144{ 143{
145 struct mlx4_en_dev *mdev = priv->mdev; 144 struct mlx4_en_dev *mdev = priv->mdev;
146 145
147 mlx4_en_unmap_buffer(&cq->wqres.buf); 146 mlx4_en_unmap_buffer(&cq->wqres.buf);
148 mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); 147 mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size);
149 if (priv->mdev->dev->caps.comp_pool && cq->vector && !reserve_vectors) 148 if (priv->mdev->dev->caps.comp_pool && cq->vector)
150 mlx4_release_eq(priv->mdev->dev, cq->vector); 149 mlx4_release_eq(priv->mdev->dev, cq->vector);
151 cq->buf_size = 0; 150 cq->buf_size = 0;
152 cq->buf = NULL; 151 cq->buf = NULL;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index eb096253d781..e247bd7bb940 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -416,7 +416,7 @@ static int mlx4_en_set_ringparam(struct net_device *dev,
416 mlx4_en_stop_port(dev); 416 mlx4_en_stop_port(dev);
417 } 417 }
418 418
419 mlx4_en_free_resources(priv, true); 419 mlx4_en_free_resources(priv);
420 420
421 priv->prof->tx_ring_size = tx_size; 421 priv->prof->tx_ring_size = tx_size;
422 priv->prof->rx_ring_size = rx_size; 422 priv->prof->rx_ring_size = rx_size;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index b42c6aa70742..840298206532 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -876,7 +876,7 @@ static int mlx4_en_close(struct net_device *dev)
876 return 0; 876 return 0;
877} 877}
878 878
879void mlx4_en_free_resources(struct mlx4_en_priv *priv, bool reserve_vectors) 879void mlx4_en_free_resources(struct mlx4_en_priv *priv)
880{ 880{
881 int i; 881 int i;
882 882
@@ -884,14 +884,14 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv, bool reserve_vectors)
884 if (priv->tx_ring[i].tx_info) 884 if (priv->tx_ring[i].tx_info)
885 mlx4_en_destroy_tx_ring(priv, &priv->tx_ring[i]); 885 mlx4_en_destroy_tx_ring(priv, &priv->tx_ring[i]);
886 if (priv->tx_cq[i].buf) 886 if (priv->tx_cq[i].buf)
887 mlx4_en_destroy_cq(priv, &priv->tx_cq[i], reserve_vectors); 887 mlx4_en_destroy_cq(priv, &priv->tx_cq[i]);
888 } 888 }
889 889
890 for (i = 0; i < priv->rx_ring_num; i++) { 890 for (i = 0; i < priv->rx_ring_num; i++) {
891 if (priv->rx_ring[i].rx_info) 891 if (priv->rx_ring[i].rx_info)
892 mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i]); 892 mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i]);
893 if (priv->rx_cq[i].buf) 893 if (priv->rx_cq[i].buf)
894 mlx4_en_destroy_cq(priv, &priv->rx_cq[i], reserve_vectors); 894 mlx4_en_destroy_cq(priv, &priv->rx_cq[i]);
895 } 895 }
896} 896}
897 897
@@ -961,7 +961,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
961 mdev->pndev[priv->port] = NULL; 961 mdev->pndev[priv->port] = NULL;
962 mutex_unlock(&mdev->state_lock); 962 mutex_unlock(&mdev->state_lock);
963 963
964 mlx4_en_free_resources(priv, false); 964 mlx4_en_free_resources(priv);
965 free_netdev(dev); 965 free_netdev(dev);
966} 966}
967 967
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 115784da8efa..fe8146d68b0a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -502,13 +502,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
502int mlx4_en_start_port(struct net_device *dev); 502int mlx4_en_start_port(struct net_device *dev);
503void mlx4_en_stop_port(struct net_device *dev); 503void mlx4_en_stop_port(struct net_device *dev);
504 504
505void mlx4_en_free_resources(struct mlx4_en_priv *priv, bool reserve_vectors); 505void mlx4_en_free_resources(struct mlx4_en_priv *priv);
506int mlx4_en_alloc_resources(struct mlx4_en_priv *priv); 506int mlx4_en_alloc_resources(struct mlx4_en_priv *priv);
507 507
508int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, 508int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
509 int entries, int ring, enum cq_type mode); 509 int entries, int ring, enum cq_type mode);
510void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, 510void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
511 bool reserve_vectors);
512int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, 511int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
513 int cq_idx); 512 int cq_idx);
514void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq); 513void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);