aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-03-15 03:23:58 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-17 12:50:24 -0400
commit1f9061d27d3d2028805549c4a306324a48209057 (patch)
tree7cfb1a92933f5a9bba6745b68b6a964d9e757ef9 /drivers/net/ethernet/intel
parent7f9421c264f8a6e6137027a45ae576517f66fa56 (diff)
drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0)
Reduce the number of calls required to alloc a zeroed block of memory. Trivially reduces overall object size. Other changes around these removals o Neaten call argument alignment o Remove an unnecessary OOM message after dma_alloc_coherent failure o Remove unnecessary gfp_t stack variable Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_ethtool.c6
-rw-r--r--drivers/net/ethernet/intel/igbvf/netdev.c2
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_main.c3
3 files changed, 3 insertions, 8 deletions
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 43462d596a4e..a9f9c7906769 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1020,12 +1020,11 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1020 txdr->size = txdr->count * sizeof(struct e1000_tx_desc); 1020 txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
1021 txdr->size = ALIGN(txdr->size, 4096); 1021 txdr->size = ALIGN(txdr->size, 4096);
1022 txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, 1022 txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
1023 GFP_KERNEL); 1023 GFP_KERNEL | __GFP_ZERO);
1024 if (!txdr->desc) { 1024 if (!txdr->desc) {
1025 ret_val = 2; 1025 ret_val = 2;
1026 goto err_nomem; 1026 goto err_nomem;
1027 } 1027 }
1028 memset(txdr->desc, 0, txdr->size);
1029 txdr->next_to_use = txdr->next_to_clean = 0; 1028 txdr->next_to_use = txdr->next_to_clean = 0;
1030 1029
1031 ew32(TDBAL, ((u64)txdr->dma & 0x00000000FFFFFFFF)); 1030 ew32(TDBAL, ((u64)txdr->dma & 0x00000000FFFFFFFF));
@@ -1075,12 +1074,11 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1075 1074
1076 rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); 1075 rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc);
1077 rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, 1076 rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
1078 GFP_KERNEL); 1077 GFP_KERNEL | __GFP_ZERO);
1079 if (!rxdr->desc) { 1078 if (!rxdr->desc) {
1080 ret_val = 5; 1079 ret_val = 5;
1081 goto err_nomem; 1080 goto err_nomem;
1082 } 1081 }
1083 memset(rxdr->desc, 0, rxdr->size);
1084 rxdr->next_to_use = rxdr->next_to_clean = 0; 1082 rxdr->next_to_use = rxdr->next_to_clean = 0;
1085 1083
1086 rctl = er32(RCTL); 1084 rctl = er32(RCTL);
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index d60cd4393415..bea46bb26061 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -447,7 +447,6 @@ int igbvf_setup_tx_resources(struct igbvf_adapter *adapter,
447 447
448 tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, 448 tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
449 &tx_ring->dma, GFP_KERNEL); 449 &tx_ring->dma, GFP_KERNEL);
450
451 if (!tx_ring->desc) 450 if (!tx_ring->desc)
452 goto err; 451 goto err;
453 452
@@ -488,7 +487,6 @@ int igbvf_setup_rx_resources(struct igbvf_adapter *adapter,
488 487
489 rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, 488 rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
490 &rx_ring->dma, GFP_KERNEL); 489 &rx_ring->dma, GFP_KERNEL);
491
492 if (!rx_ring->desc) 490 if (!rx_ring->desc)
493 goto err; 491 goto err;
494 492
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index e23f0234cb27..74464c348454 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -717,12 +717,11 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
717 txdr->size = ALIGN(txdr->size, 4096); 717 txdr->size = ALIGN(txdr->size, 4096);
718 718
719 txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, 719 txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
720 GFP_KERNEL); 720 GFP_KERNEL | __GFP_ZERO);
721 if (!txdr->desc) { 721 if (!txdr->desc) {
722 vfree(txdr->buffer_info); 722 vfree(txdr->buffer_info);
723 return -ENOMEM; 723 return -ENOMEM;
724 } 724 }
725 memset(txdr->desc, 0, txdr->size);
726 725
727 txdr->next_to_use = 0; 726 txdr->next_to_use = 0;
728 txdr->next_to_clean = 0; 727 txdr->next_to_clean = 0;