diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2009-05-23 23:17:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-25 03:35:53 -0400 |
commit | 38aab07c14adbf3c7257793d764a91923341e96a (patch) | |
tree | ac27575621410056b4ec970db6b233a50600d15b /drivers/net/mlx4/en_netdev.c | |
parent | 8e29291650ee53a8609d9cc3a303dcbe9aa9b542 (diff) |
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 be487fa8d9a7..0cd185a2e089 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) | |||
556 | struct mlx4_en_dev *mdev = priv->mdev; | 556 | struct mlx4_en_dev *mdev = priv->mdev; |
557 | struct mlx4_en_cq *cq; | 557 | struct mlx4_en_cq *cq; |
558 | struct mlx4_en_tx_ring *tx_ring; | 558 | struct mlx4_en_tx_ring *tx_ring; |
559 | struct mlx4_en_rx_ring *rx_ring; | ||
560 | int rx_index = 0; | 559 | int rx_index = 0; |
561 | int tx_index = 0; | 560 | int tx_index = 0; |
562 | int err = 0; | 561 | int err = 0; |
@@ -572,10 +571,15 @@ int mlx4_en_start_port(struct net_device *dev) | |||
572 | dev->mtu = min(dev->mtu, priv->max_mtu); | 571 | dev->mtu = min(dev->mtu, priv->max_mtu); |
573 | mlx4_en_calc_rx_buf(dev); | 572 | mlx4_en_calc_rx_buf(dev); |
574 | mlx4_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_skb_size); | 573 | mlx4_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_skb_size); |
574 | |||
575 | /* Configure rx cq's and rings */ | 575 | /* Configure rx cq's and rings */ |
576 | err = mlx4_en_activate_rx_rings(priv); | ||
577 | if (err) { | ||
578 | mlx4_err(mdev, "Failed to activate RX rings\n"); | ||
579 | return err; | ||
580 | } | ||
576 | for (i = 0; i < priv->rx_ring_num; i++) { | 581 | for (i = 0; i < priv->rx_ring_num; i++) { |
577 | cq = &priv->rx_cq[i]; | 582 | cq = &priv->rx_cq[i]; |
578 | rx_ring = &priv->rx_ring[i]; | ||
579 | 583 | ||
580 | err = mlx4_en_activate_cq(priv, cq); | 584 | err = mlx4_en_activate_cq(priv, cq); |
581 | if (err) { | 585 | if (err) { |
@@ -591,20 +595,14 @@ int mlx4_en_start_port(struct net_device *dev) | |||
591 | goto cq_err; | 595 | goto cq_err; |
592 | } | 596 | } |
593 | mlx4_en_arm_cq(priv, cq); | 597 | mlx4_en_arm_cq(priv, cq); |
594 | 598 | priv->rx_ring[i].cqn = cq->mcq.cqn; | |
595 | ++rx_index; | 599 | ++rx_index; |
596 | } | 600 | } |
597 | 601 | ||
598 | err = mlx4_en_activate_rx_rings(priv); | ||
599 | if (err) { | ||
600 | mlx4_err(mdev, "Failed to activate RX rings\n"); | ||
601 | goto cq_err; | ||
602 | } | ||
603 | |||
604 | err = mlx4_en_config_rss_steer(priv); | 602 | err = mlx4_en_config_rss_steer(priv); |
605 | if (err) { | 603 | if (err) { |
606 | mlx4_err(mdev, "Failed configuring rss steering\n"); | 604 | mlx4_err(mdev, "Failed configuring rss steering\n"); |
607 | goto rx_err; | 605 | goto cq_err; |
608 | } | 606 | } |
609 | 607 | ||
610 | /* Configure tx cq's and rings */ | 608 | /* Configure tx cq's and rings */ |
@@ -691,12 +689,11 @@ tx_err: | |||
691 | } | 689 | } |
692 | 690 | ||
693 | mlx4_en_release_rss_steer(priv); | 691 | mlx4_en_release_rss_steer(priv); |
694 | rx_err: | ||
695 | for (i = 0; i < priv->rx_ring_num; i++) | ||
696 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); | ||
697 | cq_err: | 692 | cq_err: |
698 | while (rx_index--) | 693 | while (rx_index--) |
699 | mlx4_en_deactivate_cq(priv, &priv->rx_cq[rx_index]); | 694 | mlx4_en_deactivate_cq(priv, &priv->rx_cq[rx_index]); |
695 | for (i = 0; i < priv->rx_ring_num; i++) | ||
696 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); | ||
700 | 697 | ||
701 | return err; /* need to close devices */ | 698 | return err; /* need to close devices */ |
702 | } | 699 | } |