netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, gospo@redhat.com,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next-2.6 PATCH 18/23] igb: cleanup clean_rx_irq_adv and alloc_rx_buffers_adv
Date: Wed, 28 Oct 2009 02:51:16 -0700	[thread overview]
Message-ID: <20091028095115.13156.73668.stgit@localhost.localdomain> (raw)
In-Reply-To: <20091028094540.13156.2637.stgit@localhost.localdomain>

From: Alexander Duyck <alexander.h.duyck@intel.com>

This patch cleans up some whitespace issues in clean_rx_irq_adv.  It also
adds NUMA aware page allocation and dma error handling to
alloc_rx_buffers_adv.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/igb/igb_main.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 8f8b7cc..d3e8316 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -4952,6 +4952,7 @@ static bool igb_clean_rx_irq_adv(struct igb_q_vector *q_vector,
 		i++;
 		if (i == rx_ring->count)
 			i = 0;
+
 		next_rxd = E1000_RX_DESC_ADV(*rx_ring, i);
 		prefetch(next_rxd);
 		next_buffer = &rx_ring->buffer_info[i];
@@ -4989,7 +4990,6 @@ static bool igb_clean_rx_irq_adv(struct igb_q_vector *q_vector,
 
 			skb->len += length;
 			skb->data_len += length;
-
 			skb->truesize += length;
 		}
 
@@ -5071,7 +5071,7 @@ void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, int cleaned_count)
 
 		if ((bufsz < IGB_RXBUFFER_1024) && !buffer_info->page_dma) {
 			if (!buffer_info->page) {
-				buffer_info->page = alloc_page(GFP_ATOMIC);
+				buffer_info->page = netdev_alloc_page(netdev);
 				if (!buffer_info->page) {
 					rx_ring->rx_stats.alloc_failed++;
 					goto no_buffers;
@@ -5085,9 +5085,16 @@ void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, int cleaned_count)
 					     buffer_info->page_offset,
 					     PAGE_SIZE / 2,
 					     PCI_DMA_FROMDEVICE);
+			if (pci_dma_mapping_error(rx_ring->pdev,
+			                          buffer_info->page_dma)) {
+				buffer_info->page_dma = 0;
+				rx_ring->rx_stats.alloc_failed++;
+				goto no_buffers;
+			}
 		}
 
-		if (!buffer_info->skb) {
+		skb = buffer_info->skb;
+		if (!skb) {
 			skb = netdev_alloc_skb_ip_align(netdev, bufsz);
 			if (!skb) {
 				rx_ring->rx_stats.alloc_failed++;
@@ -5095,10 +5102,18 @@ void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, int cleaned_count)
 			}
 
 			buffer_info->skb = skb;
+		}
+		if (!buffer_info->dma) {
 			buffer_info->dma = pci_map_single(rx_ring->pdev,
 			                                  skb->data,
 							  bufsz,
 							  PCI_DMA_FROMDEVICE);
+			if (pci_dma_mapping_error(rx_ring->pdev,
+			                          buffer_info->dma)) {
+				buffer_info->dma = 0;
+				rx_ring->rx_stats.alloc_failed++;
+				goto no_buffers;
+			}
 		}
 		/* Refresh the desc even if buffer_addrs didn't change because
 		 * each write-back erases this info. */
@@ -5107,8 +5122,7 @@ void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, int cleaned_count)
 			     cpu_to_le64(buffer_info->page_dma);
 			rx_desc->read.hdr_addr = cpu_to_le64(buffer_info->dma);
 		} else {
-			rx_desc->read.pkt_addr =
-			     cpu_to_le64(buffer_info->dma);
+			rx_desc->read.pkt_addr = cpu_to_le64(buffer_info->dma);
 			rx_desc->read.hdr_addr = 0;
 		}
 


  parent reply	other threads:[~2009-10-28  9:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-28  9:45 [net-next-2.6 PATCH 01/23] igb: add support for seperate tx-usecs setting in ethtool Jeff Kirsher
2009-10-28  9:46 ` [net-next-2.6 PATCH 02/23] igb: cleanup some of the code related to hw timestamping Jeff Kirsher
2009-10-28  9:46 ` [net-next-2.6 PATCH 03/23] igb: misc cleanups within igb_ethtool.c Jeff Kirsher
2009-10-28  9:46 ` [net-next-2.6 PATCH 04/23] igb: use packet buffer sizes from RXPBS register Jeff Kirsher
2009-10-28  9:46 ` [net-next-2.6 PATCH 05/23] igb: replace the VF clear_to_send with a flags value Jeff Kirsher
2009-10-28  9:47 ` [net-next-2.6 PATCH 06/23] igb: rework use of VMOLR in regards to PF and VFs Jeff Kirsher
2009-10-28  9:47 ` [net-next-2.6 PATCH 07/23] igb: rework handling of the vfta and vlvf registers in relation to mng_vlan Jeff Kirsher
2009-10-28  9:47 ` [net-next-2.6 PATCH 08/23] igb: move vf init into a seperate function Jeff Kirsher
2009-10-28  9:48 ` [net-next-2.6 PATCH 09/23] igb: only process global stats in igb_update_stats Jeff Kirsher
2009-10-28  9:48 ` [net-next-2.6 PATCH 10/23] igb: move global_quad_port_a from global into local static define Jeff Kirsher
2009-10-28  9:48 ` [net-next-2.6 PATCH 11/23] igb: make tx hang check multiqueue, check eop descriptor Jeff Kirsher
2009-10-28  9:49 ` [net-next-2.6 PATCH 12/23] igb: cleanup code related to ring resource allocation and free Jeff Kirsher
2009-10-28  9:49 ` [net-next-2.6 PATCH 13/23] igb: change queue ordering for 82576 based adapters Jeff Kirsher
2009-10-28  9:49 ` [net-next-2.6 PATCH 14/23] igb: cleanup interrupt enablement in regards to msix_other Jeff Kirsher
2009-10-28  9:50 ` [net-next-2.6 PATCH 15/23] igb: Remove invalid stats counters Jeff Kirsher
2009-10-28  9:50 ` [net-next-2.6 PATCH 16/23] igb: cleanup igb.h header whitespace and some structure formatting Jeff Kirsher
2009-10-28  9:50 ` [net-next-2.6 PATCH 17/23] igb: cleanup igb xmit frame path Jeff Kirsher
2009-10-28  9:51 ` Jeff Kirsher [this message]
2009-10-28  9:51 ` [net-next-2.6 PATCH 19/23] igb: replace unecessary &adapter->hw with just hw where applicable Jeff Kirsher
2009-10-28  9:51 ` [net-next-2.6 PATCH 20/23] igb: add pci_dev in few spots to clean up use of dev_err/info/warn Jeff Kirsher
2009-10-28  9:52 ` [net-next-2.6 PATCH 21/23] igb: limit minimum mtu to 68 to keep ip bound to interface Jeff Kirsher
2009-10-28  9:52 ` [net-next-2.6 PATCH 22/23] igb: open up SCTP checksum offloads to all MACs 82576 and newer Jeff Kirsher
2009-10-28  9:52 ` [net-next-2.6 PATCH 23/23] igb: cleanup whitespace issues in igb_main.c Jeff Kirsher
2009-10-28 10:39 ` [net-next-2.6 PATCH 01/23] igb: add support for seperate tx-usecs setting in ethtool David Miller
2009-10-28 15:42   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091028095115.13156.73668.stgit@localhost.localdomain \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).