diff options
Diffstat (limited to 'drivers/net/igb/igb_ethtool.c')
-rw-r--r-- | drivers/net/igb/igb_ethtool.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index a6da32f25a83..dafb25bfd9e1 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -739,7 +739,7 @@ static int igb_set_ringparam(struct net_device *netdev, | |||
739 | { | 739 | { |
740 | struct igb_adapter *adapter = netdev_priv(netdev); | 740 | struct igb_adapter *adapter = netdev_priv(netdev); |
741 | struct igb_ring *temp_ring; | 741 | struct igb_ring *temp_ring; |
742 | int i, err; | 742 | int i, err = 0; |
743 | u32 new_rx_count, new_tx_count; | 743 | u32 new_rx_count, new_tx_count; |
744 | 744 | ||
745 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) | 745 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
@@ -759,18 +759,30 @@ static int igb_set_ringparam(struct net_device *netdev, | |||
759 | return 0; | 759 | return 0; |
760 | } | 760 | } |
761 | 761 | ||
762 | while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) | ||
763 | msleep(1); | ||
764 | |||
765 | if (!netif_running(adapter->netdev)) { | ||
766 | for (i = 0; i < adapter->num_tx_queues; i++) | ||
767 | adapter->tx_ring[i].count = new_tx_count; | ||
768 | for (i = 0; i < adapter->num_rx_queues; i++) | ||
769 | adapter->rx_ring[i].count = new_rx_count; | ||
770 | adapter->tx_ring_count = new_tx_count; | ||
771 | adapter->rx_ring_count = new_rx_count; | ||
772 | goto clear_reset; | ||
773 | } | ||
774 | |||
762 | if (adapter->num_tx_queues > adapter->num_rx_queues) | 775 | if (adapter->num_tx_queues > adapter->num_rx_queues) |
763 | temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring)); | 776 | temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring)); |
764 | else | 777 | else |
765 | temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring)); | 778 | temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring)); |
766 | if (!temp_ring) | ||
767 | return -ENOMEM; | ||
768 | 779 | ||
769 | while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) | 780 | if (!temp_ring) { |
770 | msleep(1); | 781 | err = -ENOMEM; |
782 | goto clear_reset; | ||
783 | } | ||
771 | 784 | ||
772 | if (netif_running(adapter->netdev)) | 785 | igb_down(adapter); |
773 | igb_down(adapter); | ||
774 | 786 | ||
775 | /* | 787 | /* |
776 | * We can't just free everything and then setup again, | 788 | * We can't just free everything and then setup again, |
@@ -827,14 +839,11 @@ static int igb_set_ringparam(struct net_device *netdev, | |||
827 | 839 | ||
828 | adapter->rx_ring_count = new_rx_count; | 840 | adapter->rx_ring_count = new_rx_count; |
829 | } | 841 | } |
830 | |||
831 | err = 0; | ||
832 | err_setup: | 842 | err_setup: |
833 | if (netif_running(adapter->netdev)) | 843 | igb_up(adapter); |
834 | igb_up(adapter); | ||
835 | |||
836 | clear_bit(__IGB_RESETTING, &adapter->state); | ||
837 | vfree(temp_ring); | 844 | vfree(temp_ring); |
845 | clear_reset: | ||
846 | clear_bit(__IGB_RESETTING, &adapter->state); | ||
838 | return err; | 847 | return err; |
839 | } | 848 | } |
840 | 849 | ||