aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_ethtool.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2010-02-16 20:02:39 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 16:21:34 -0500
commit3025a446b6d0255ae4399ca5f9b259bd1b51539e (patch)
treee352d223dfb10a75c8e4a7c8fca52504fa9ec878 /drivers/net/igb/igb_ethtool.c
parentb94f2d775a71ed09dc8ca2bf24c611bdce9e82e7 (diff)
igb: Allocate rings seperately instead of as a block
This change makes it so that the rings are allocated seperately. As a result we can allocate them on seperate nodes at some point in the future if we so desire. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/igb_ethtool.c')
-rw-r--r--drivers/net/igb/igb_ethtool.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 485288303f32..a4cead12fd98 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -314,7 +314,7 @@ static int igb_set_pauseparam(struct net_device *netdev,
314static u32 igb_get_rx_csum(struct net_device *netdev) 314static u32 igb_get_rx_csum(struct net_device *netdev)
315{ 315{
316 struct igb_adapter *adapter = netdev_priv(netdev); 316 struct igb_adapter *adapter = netdev_priv(netdev);
317 return !!(adapter->rx_ring[0].flags & IGB_RING_FLAG_RX_CSUM); 317 return !!(adapter->rx_ring[0]->flags & IGB_RING_FLAG_RX_CSUM);
318} 318}
319 319
320static int igb_set_rx_csum(struct net_device *netdev, u32 data) 320static int igb_set_rx_csum(struct net_device *netdev, u32 data)
@@ -324,9 +324,9 @@ static int igb_set_rx_csum(struct net_device *netdev, u32 data)
324 324
325 for (i = 0; i < adapter->num_rx_queues; i++) { 325 for (i = 0; i < adapter->num_rx_queues; i++) {
326 if (data) 326 if (data)
327 adapter->rx_ring[i].flags |= IGB_RING_FLAG_RX_CSUM; 327 adapter->rx_ring[i]->flags |= IGB_RING_FLAG_RX_CSUM;
328 else 328 else
329 adapter->rx_ring[i].flags &= ~IGB_RING_FLAG_RX_CSUM; 329 adapter->rx_ring[i]->flags &= ~IGB_RING_FLAG_RX_CSUM;
330 } 330 }
331 331
332 return 0; 332 return 0;
@@ -789,9 +789,9 @@ static int igb_set_ringparam(struct net_device *netdev,
789 789
790 if (!netif_running(adapter->netdev)) { 790 if (!netif_running(adapter->netdev)) {
791 for (i = 0; i < adapter->num_tx_queues; i++) 791 for (i = 0; i < adapter->num_tx_queues; i++)
792 adapter->tx_ring[i].count = new_tx_count; 792 adapter->tx_ring[i]->count = new_tx_count;
793 for (i = 0; i < adapter->num_rx_queues; i++) 793 for (i = 0; i < adapter->num_rx_queues; i++)
794 adapter->rx_ring[i].count = new_rx_count; 794 adapter->rx_ring[i]->count = new_rx_count;
795 adapter->tx_ring_count = new_tx_count; 795 adapter->tx_ring_count = new_tx_count;
796 adapter->rx_ring_count = new_rx_count; 796 adapter->rx_ring_count = new_rx_count;
797 goto clear_reset; 797 goto clear_reset;
@@ -815,10 +815,10 @@ static int igb_set_ringparam(struct net_device *netdev,
815 * to the tx and rx ring structs. 815 * to the tx and rx ring structs.
816 */ 816 */
817 if (new_tx_count != adapter->tx_ring_count) { 817 if (new_tx_count != adapter->tx_ring_count) {
818 memcpy(temp_ring, adapter->tx_ring,
819 adapter->num_tx_queues * sizeof(struct igb_ring));
820
821 for (i = 0; i < adapter->num_tx_queues; i++) { 818 for (i = 0; i < adapter->num_tx_queues; i++) {
819 memcpy(&temp_ring[i], adapter->tx_ring[i],
820 sizeof(struct igb_ring));
821
822 temp_ring[i].count = new_tx_count; 822 temp_ring[i].count = new_tx_count;
823 err = igb_setup_tx_resources(&temp_ring[i]); 823 err = igb_setup_tx_resources(&temp_ring[i]);
824 if (err) { 824 if (err) {
@@ -830,20 +830,21 @@ static int igb_set_ringparam(struct net_device *netdev,
830 } 830 }
831 } 831 }
832 832
833 for (i = 0; i < adapter->num_tx_queues; i++) 833 for (i = 0; i < adapter->num_tx_queues; i++) {
834 igb_free_tx_resources(&adapter->tx_ring[i]); 834 igb_free_tx_resources(adapter->tx_ring[i]);
835 835
836 memcpy(adapter->tx_ring, temp_ring, 836 memcpy(adapter->tx_ring[i], &temp_ring[i],
837 adapter->num_tx_queues * sizeof(struct igb_ring)); 837 sizeof(struct igb_ring));
838 }
838 839
839 adapter->tx_ring_count = new_tx_count; 840 adapter->tx_ring_count = new_tx_count;
840 } 841 }
841 842
842 if (new_rx_count != adapter->rx_ring->count) { 843 if (new_rx_count != adapter->rx_ring_count) {
843 memcpy(temp_ring, adapter->rx_ring,
844 adapter->num_rx_queues * sizeof(struct igb_ring));
845
846 for (i = 0; i < adapter->num_rx_queues; i++) { 844 for (i = 0; i < adapter->num_rx_queues; i++) {
845 memcpy(&temp_ring[i], adapter->rx_ring[i],
846 sizeof(struct igb_ring));
847
847 temp_ring[i].count = new_rx_count; 848 temp_ring[i].count = new_rx_count;
848 err = igb_setup_rx_resources(&temp_ring[i]); 849 err = igb_setup_rx_resources(&temp_ring[i]);
849 if (err) { 850 if (err) {
@@ -856,11 +857,12 @@ static int igb_set_ringparam(struct net_device *netdev,
856 857
857 } 858 }
858 859
859 for (i = 0; i < adapter->num_rx_queues; i++) 860 for (i = 0; i < adapter->num_rx_queues; i++) {
860 igb_free_rx_resources(&adapter->rx_ring[i]); 861 igb_free_rx_resources(adapter->rx_ring[i]);
861 862
862 memcpy(adapter->rx_ring, temp_ring, 863 memcpy(adapter->rx_ring[i], &temp_ring[i],
863 adapter->num_rx_queues * sizeof(struct igb_ring)); 864 sizeof(struct igb_ring));
865 }
864 866
865 adapter->rx_ring_count = new_rx_count; 867 adapter->rx_ring_count = new_rx_count;
866 } 868 }
@@ -2036,12 +2038,12 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
2036 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 2038 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
2037 } 2039 }
2038 for (j = 0; j < adapter->num_tx_queues; j++) { 2040 for (j = 0; j < adapter->num_tx_queues; j++) {
2039 queue_stat = (u64 *)&adapter->tx_ring[j].tx_stats; 2041 queue_stat = (u64 *)&adapter->tx_ring[j]->tx_stats;
2040 for (k = 0; k < IGB_TX_QUEUE_STATS_LEN; k++, i++) 2042 for (k = 0; k < IGB_TX_QUEUE_STATS_LEN; k++, i++)
2041 data[i] = queue_stat[k]; 2043 data[i] = queue_stat[k];
2042 } 2044 }
2043 for (j = 0; j < adapter->num_rx_queues; j++) { 2045 for (j = 0; j < adapter->num_rx_queues; j++) {
2044 queue_stat = (u64 *)&adapter->rx_ring[j].rx_stats; 2046 queue_stat = (u64 *)&adapter->rx_ring[j]->rx_stats;
2045 for (k = 0; k < IGB_RX_QUEUE_STATS_LEN; k++, i++) 2047 for (k = 0; k < IGB_RX_QUEUE_STATS_LEN; k++, i++)
2046 data[i] = queue_stat[k]; 2048 data[i] = queue_stat[k];
2047 } 2049 }