diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-07-12 12:10:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-13 01:07:56 -0400 |
commit | c2fed9965c60e1f989f57889357c557f7b907ab7 (patch) | |
tree | adc5e1c7a20f1d31c2a8aa3959d1948bf484f91d /drivers/net/e1000e | |
parent | a3d72d5d01b82a86f3b16ca1918d2040b1acba8c (diff) |
e1000e: use GFP_KERNEL allocations at init time
In process and sleep allowed context, favor GFP_KERNEL allocations over
GFP_ATOMIC ones.
-v2: fixed checkpatch.pl warnings
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Ben Greear <greearb@candelatech.com>
CC: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r-- | drivers/net/e1000e/e1000.h | 2 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 37 |
2 files changed, 22 insertions, 17 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index e9d6e0ada543..638d175792cf 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -334,7 +334,7 @@ struct e1000_adapter { | |||
334 | int *work_done, int work_to_do) | 334 | int *work_done, int work_to_do) |
335 | ____cacheline_aligned_in_smp; | 335 | ____cacheline_aligned_in_smp; |
336 | void (*alloc_rx_buf) (struct e1000_adapter *adapter, | 336 | void (*alloc_rx_buf) (struct e1000_adapter *adapter, |
337 | int cleaned_count); | 337 | int cleaned_count, gfp_t gfp); |
338 | struct e1000_ring *rx_ring; | 338 | struct e1000_ring *rx_ring; |
339 | 339 | ||
340 | u32 rx_int_delay; | 340 | u32 rx_int_delay; |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index ed7a93d356f4..4353ad56cf16 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -523,7 +523,7 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | |||
523 | * @adapter: address of board private structure | 523 | * @adapter: address of board private structure |
524 | **/ | 524 | **/ |
525 | static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | 525 | static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, |
526 | int cleaned_count) | 526 | int cleaned_count, gfp_t gfp) |
527 | { | 527 | { |
528 | struct net_device *netdev = adapter->netdev; | 528 | struct net_device *netdev = adapter->netdev; |
529 | struct pci_dev *pdev = adapter->pdev; | 529 | struct pci_dev *pdev = adapter->pdev; |
@@ -544,7 +544,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
544 | goto map_skb; | 544 | goto map_skb; |
545 | } | 545 | } |
546 | 546 | ||
547 | skb = netdev_alloc_skb_ip_align(netdev, bufsz); | 547 | skb = __netdev_alloc_skb_ip_align(netdev, bufsz, gfp); |
548 | if (!skb) { | 548 | if (!skb) { |
549 | /* Better luck next round */ | 549 | /* Better luck next round */ |
550 | adapter->alloc_rx_buff_failed++; | 550 | adapter->alloc_rx_buff_failed++; |
@@ -589,7 +589,7 @@ map_skb: | |||
589 | * @adapter: address of board private structure | 589 | * @adapter: address of board private structure |
590 | **/ | 590 | **/ |
591 | static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | 591 | static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, |
592 | int cleaned_count) | 592 | int cleaned_count, gfp_t gfp) |
593 | { | 593 | { |
594 | struct net_device *netdev = adapter->netdev; | 594 | struct net_device *netdev = adapter->netdev; |
595 | struct pci_dev *pdev = adapter->pdev; | 595 | struct pci_dev *pdev = adapter->pdev; |
@@ -615,7 +615,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
615 | continue; | 615 | continue; |
616 | } | 616 | } |
617 | if (!ps_page->page) { | 617 | if (!ps_page->page) { |
618 | ps_page->page = alloc_page(GFP_ATOMIC); | 618 | ps_page->page = alloc_page(gfp); |
619 | if (!ps_page->page) { | 619 | if (!ps_page->page) { |
620 | adapter->alloc_rx_buff_failed++; | 620 | adapter->alloc_rx_buff_failed++; |
621 | goto no_buffers; | 621 | goto no_buffers; |
@@ -641,8 +641,9 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
641 | cpu_to_le64(ps_page->dma); | 641 | cpu_to_le64(ps_page->dma); |
642 | } | 642 | } |
643 | 643 | ||
644 | skb = netdev_alloc_skb_ip_align(netdev, | 644 | skb = __netdev_alloc_skb_ip_align(netdev, |
645 | adapter->rx_ps_bsize0); | 645 | adapter->rx_ps_bsize0, |
646 | gfp); | ||
646 | 647 | ||
647 | if (!skb) { | 648 | if (!skb) { |
648 | adapter->alloc_rx_buff_failed++; | 649 | adapter->alloc_rx_buff_failed++; |
@@ -692,7 +693,7 @@ no_buffers: | |||
692 | **/ | 693 | **/ |
693 | 694 | ||
694 | static void e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | 695 | static void e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, |
695 | int cleaned_count) | 696 | int cleaned_count, gfp_t gfp) |
696 | { | 697 | { |
697 | struct net_device *netdev = adapter->netdev; | 698 | struct net_device *netdev = adapter->netdev; |
698 | struct pci_dev *pdev = adapter->pdev; | 699 | struct pci_dev *pdev = adapter->pdev; |
@@ -713,7 +714,7 @@ static void e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | |||
713 | goto check_page; | 714 | goto check_page; |
714 | } | 715 | } |
715 | 716 | ||
716 | skb = netdev_alloc_skb_ip_align(netdev, bufsz); | 717 | skb = __netdev_alloc_skb_ip_align(netdev, bufsz, gfp); |
717 | if (unlikely(!skb)) { | 718 | if (unlikely(!skb)) { |
718 | /* Better luck next round */ | 719 | /* Better luck next round */ |
719 | adapter->alloc_rx_buff_failed++; | 720 | adapter->alloc_rx_buff_failed++; |
@@ -724,7 +725,7 @@ static void e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | |||
724 | check_page: | 725 | check_page: |
725 | /* allocate a new page if necessary */ | 726 | /* allocate a new page if necessary */ |
726 | if (!buffer_info->page) { | 727 | if (!buffer_info->page) { |
727 | buffer_info->page = alloc_page(GFP_ATOMIC); | 728 | buffer_info->page = alloc_page(gfp); |
728 | if (unlikely(!buffer_info->page)) { | 729 | if (unlikely(!buffer_info->page)) { |
729 | adapter->alloc_rx_buff_failed++; | 730 | adapter->alloc_rx_buff_failed++; |
730 | break; | 731 | break; |
@@ -888,7 +889,8 @@ next_desc: | |||
888 | 889 | ||
889 | /* return some buffers to hardware, one at a time is too slow */ | 890 | /* return some buffers to hardware, one at a time is too slow */ |
890 | if (cleaned_count >= E1000_RX_BUFFER_WRITE) { | 891 | if (cleaned_count >= E1000_RX_BUFFER_WRITE) { |
891 | adapter->alloc_rx_buf(adapter, cleaned_count); | 892 | adapter->alloc_rx_buf(adapter, cleaned_count, |
893 | GFP_ATOMIC); | ||
892 | cleaned_count = 0; | 894 | cleaned_count = 0; |
893 | } | 895 | } |
894 | 896 | ||
@@ -900,7 +902,7 @@ next_desc: | |||
900 | 902 | ||
901 | cleaned_count = e1000_desc_unused(rx_ring); | 903 | cleaned_count = e1000_desc_unused(rx_ring); |
902 | if (cleaned_count) | 904 | if (cleaned_count) |
903 | adapter->alloc_rx_buf(adapter, cleaned_count); | 905 | adapter->alloc_rx_buf(adapter, cleaned_count, GFP_ATOMIC); |
904 | 906 | ||
905 | adapter->total_rx_bytes += total_rx_bytes; | 907 | adapter->total_rx_bytes += total_rx_bytes; |
906 | adapter->total_rx_packets += total_rx_packets; | 908 | adapter->total_rx_packets += total_rx_packets; |
@@ -1230,7 +1232,8 @@ next_desc: | |||
1230 | 1232 | ||
1231 | /* return some buffers to hardware, one at a time is too slow */ | 1233 | /* return some buffers to hardware, one at a time is too slow */ |
1232 | if (cleaned_count >= E1000_RX_BUFFER_WRITE) { | 1234 | if (cleaned_count >= E1000_RX_BUFFER_WRITE) { |
1233 | adapter->alloc_rx_buf(adapter, cleaned_count); | 1235 | adapter->alloc_rx_buf(adapter, cleaned_count, |
1236 | GFP_ATOMIC); | ||
1234 | cleaned_count = 0; | 1237 | cleaned_count = 0; |
1235 | } | 1238 | } |
1236 | 1239 | ||
@@ -1244,7 +1247,7 @@ next_desc: | |||
1244 | 1247 | ||
1245 | cleaned_count = e1000_desc_unused(rx_ring); | 1248 | cleaned_count = e1000_desc_unused(rx_ring); |
1246 | if (cleaned_count) | 1249 | if (cleaned_count) |
1247 | adapter->alloc_rx_buf(adapter, cleaned_count); | 1250 | adapter->alloc_rx_buf(adapter, cleaned_count, GFP_ATOMIC); |
1248 | 1251 | ||
1249 | adapter->total_rx_bytes += total_rx_bytes; | 1252 | adapter->total_rx_bytes += total_rx_bytes; |
1250 | adapter->total_rx_packets += total_rx_packets; | 1253 | adapter->total_rx_packets += total_rx_packets; |
@@ -1411,7 +1414,8 @@ next_desc: | |||
1411 | 1414 | ||
1412 | /* return some buffers to hardware, one at a time is too slow */ | 1415 | /* return some buffers to hardware, one at a time is too slow */ |
1413 | if (unlikely(cleaned_count >= E1000_RX_BUFFER_WRITE)) { | 1416 | if (unlikely(cleaned_count >= E1000_RX_BUFFER_WRITE)) { |
1414 | adapter->alloc_rx_buf(adapter, cleaned_count); | 1417 | adapter->alloc_rx_buf(adapter, cleaned_count, |
1418 | GFP_ATOMIC); | ||
1415 | cleaned_count = 0; | 1419 | cleaned_count = 0; |
1416 | } | 1420 | } |
1417 | 1421 | ||
@@ -1423,7 +1427,7 @@ next_desc: | |||
1423 | 1427 | ||
1424 | cleaned_count = e1000_desc_unused(rx_ring); | 1428 | cleaned_count = e1000_desc_unused(rx_ring); |
1425 | if (cleaned_count) | 1429 | if (cleaned_count) |
1426 | adapter->alloc_rx_buf(adapter, cleaned_count); | 1430 | adapter->alloc_rx_buf(adapter, cleaned_count, GFP_ATOMIC); |
1427 | 1431 | ||
1428 | adapter->total_rx_bytes += total_rx_bytes; | 1432 | adapter->total_rx_bytes += total_rx_bytes; |
1429 | adapter->total_rx_packets += total_rx_packets; | 1433 | adapter->total_rx_packets += total_rx_packets; |
@@ -3105,7 +3109,8 @@ static void e1000_configure(struct e1000_adapter *adapter) | |||
3105 | e1000_configure_tx(adapter); | 3109 | e1000_configure_tx(adapter); |
3106 | e1000_setup_rctl(adapter); | 3110 | e1000_setup_rctl(adapter); |
3107 | e1000_configure_rx(adapter); | 3111 | e1000_configure_rx(adapter); |
3108 | adapter->alloc_rx_buf(adapter, e1000_desc_unused(adapter->rx_ring)); | 3112 | adapter->alloc_rx_buf(adapter, e1000_desc_unused(adapter->rx_ring), |
3113 | GFP_KERNEL); | ||
3109 | } | 3114 | } |
3110 | 3115 | ||
3111 | /** | 3116 | /** |