diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2009-05-24 03:17:11 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-25 00:35:53 -0700 |
commit | 38aab07c14adbf3c7257793d764a91923341e96a (patch) | |
tree | ac27575621410056b4ec970db6b233a50600d15b /drivers/net/mlx4/en_netdev.c | |
parent | 8e29291650ee53a8609d9cc3a303dcbe9aa9b542 (diff) | |
download | op-kernel-dev-38aab07c14adbf3c7257793d764a91923341e96a.zip op-kernel-dev-38aab07c14adbf3c7257793d764a91923341e96a.tar.gz |
mlx4_en: Fix partial rings feature
In case of allocation failure, the actual ring size is rounded down to
nearest power of 2. The remaining descriptors are freed.
The CQ and SRQ are allocated with the actual size and the mask is updated.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mlx4/en_netdev.c')
-rw-r--r-- | drivers/net/mlx4/en_netdev.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index be487fa..0cd185a 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c @@ -556,7 +556,6 @@ int mlx4_en_start_port(struct net_device *dev) struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_cq *cq; struct mlx4_en_tx_ring *tx_ring; - struct mlx4_en_rx_ring *rx_ring; int rx_index = 0; int tx_index = 0; int err = 0; @@ -572,10 +571,15 @@ int mlx4_en_start_port(struct net_device *dev) dev->mtu = min(dev->mtu, priv->max_mtu); mlx4_en_calc_rx_buf(dev); mlx4_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_skb_size); + /* Configure rx cq's and rings */ + err = mlx4_en_activate_rx_rings(priv); + if (err) { + mlx4_err(mdev, "Failed to activate RX rings\n"); + return err; + } for (i = 0; i < priv->rx_ring_num; i++) { cq = &priv->rx_cq[i]; - rx_ring = &priv->rx_ring[i]; err = mlx4_en_activate_cq(priv, cq); if (err) { @@ -591,20 +595,14 @@ int mlx4_en_start_port(struct net_device *dev) goto cq_err; } mlx4_en_arm_cq(priv, cq); - + priv->rx_ring[i].cqn = cq->mcq.cqn; ++rx_index; } - err = mlx4_en_activate_rx_rings(priv); - if (err) { - mlx4_err(mdev, "Failed to activate RX rings\n"); - goto cq_err; - } - err = mlx4_en_config_rss_steer(priv); if (err) { mlx4_err(mdev, "Failed configuring rss steering\n"); - goto rx_err; + goto cq_err; } /* Configure tx cq's and rings */ @@ -691,12 +689,11 @@ tx_err: } mlx4_en_release_rss_steer(priv); -rx_err: - for (i = 0; i < priv->rx_ring_num; i++) - mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); cq_err: while (rx_index--) mlx4_en_deactivate_cq(priv, &priv->rx_cq[rx_index]); + for (i = 0; i < priv->rx_ring_num; i++) + mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); return err; /* need to close devices */ } |