Added changes in e1000 driver for 2.6.27. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Tue, 10 Jan 2012 10:56:24 +0100
branchstable-1.5
changeset 2252 6001f50617a7
parent 2251 5023ce75fe91
child 2257 a2a675601c98
Added changes in e1000 driver for 2.6.27.
devices/e1000/e1000_main-2.6.27-ethercat.c
devices/e1000/e1000_main-2.6.27-orig.c
--- a/devices/e1000/e1000_main-2.6.27-ethercat.c	Tue Jan 10 10:43:56 2012 +0100
+++ b/devices/e1000/e1000_main-2.6.27-ethercat.c	Tue Jan 10 10:56:24 2012 +0100
@@ -4252,22 +4252,13 @@
 
 		length = le16_to_cpu(rx_desc->length);
 		/* !EOP means multiple descriptors were used to store a single
-		 * packet, if thats the case we need to toss it.  In fact, we
-		 * to toss every packet with the EOP bit clear and the next
-		 * frame that _does_ have the EOP bit set, as it is by
-		 * definition only a frame fragment
-		 */
-		if (unlikely(!(status & E1000_RXD_STAT_EOP)))
-			set_bit(__E1000_DISCARDING, &adapter->flags);
-
-		if (test_bit(__E1000_DISCARDING, &adapter->flags)) {
+		 * packet, also make sure the frame isn't just CRC only */
+		if (unlikely(!(status & E1000_RXD_STAT_EOP) || (length <= 4))) {
 			/* All receives must fit into a single buffer */
 			E1000_DBG("%s: Receive packet consumed multiple"
 				  " buffers\n", netdev->name);
 			/* recycle */
 			buffer_info->skb = skb;
-			if (status & E1000_RXD_STAT_EOP)
-				clear_bit(__E1000_DISCARDING, &adapter->flags);
 			goto next_desc;
 		}
 
@@ -4485,8 +4476,12 @@
 			pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
 					PAGE_SIZE, PCI_DMA_FROMDEVICE);
 			ps_page_dma->ps_page_dma[j] = 0;
-			skb_add_rx_frag(skb, j, ps_page->ps_page[j], 0, length);
+			skb_fill_page_desc(skb, j, ps_page->ps_page[j], 0,
+			                   length);
 			ps_page->ps_page[j] = NULL;
+			skb->len += length;
+			skb->data_len += length;
+			skb->truesize += length;
 		}
 
 		/* strip the ethernet crc, problem is we're using pages now so
@@ -4691,7 +4686,7 @@
 			if (j < adapter->rx_ps_pages) {
 				if (likely(!ps_page->ps_page[j])) {
 					ps_page->ps_page[j] =
-						netdev_alloc_page(netdev);
+						alloc_page(GFP_ATOMIC);
 					if (unlikely(!ps_page->ps_page[j])) {
 						adapter->alloc_rx_buff_failed++;
 						goto no_buffers;
@@ -5314,9 +5309,6 @@
 
 	netif_device_detach(netdev);
 
-	if (state == pci_channel_io_perm_failure)
-		return PCI_ERS_RESULT_DISCONNECT;
-
 	if (netif_running(netdev))
 		e1000_down(adapter);
 	pci_disable_device(pdev);
--- a/devices/e1000/e1000_main-2.6.27-orig.c	Tue Jan 10 10:43:56 2012 +0100
+++ b/devices/e1000/e1000_main-2.6.27-orig.c	Tue Jan 10 10:56:24 2012 +0100
@@ -4134,22 +4134,13 @@
 
 		length = le16_to_cpu(rx_desc->length);
 		/* !EOP means multiple descriptors were used to store a single
-		 * packet, if thats the case we need to toss it.  In fact, we
-		 * to toss every packet with the EOP bit clear and the next
-		 * frame that _does_ have the EOP bit set, as it is by
-		 * definition only a frame fragment
-		 */
-		if (unlikely(!(status & E1000_RXD_STAT_EOP)))
-			set_bit(__E1000_DISCARDING, &adapter->flags);
-
-		if (test_bit(__E1000_DISCARDING, &adapter->flags)) {
+		 * packet, also make sure the frame isn't just CRC only */
+		if (unlikely(!(status & E1000_RXD_STAT_EOP) || (length <= 4))) {
 			/* All receives must fit into a single buffer */
 			E1000_DBG("%s: Receive packet consumed multiple"
 				  " buffers\n", netdev->name);
 			/* recycle */
 			buffer_info->skb = skb;
-			if (status & E1000_RXD_STAT_EOP)
-				clear_bit(__E1000_DISCARDING, &adapter->flags);
 			goto next_desc;
 		}
 
@@ -4358,8 +4349,12 @@
 			pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
 					PAGE_SIZE, PCI_DMA_FROMDEVICE);
 			ps_page_dma->ps_page_dma[j] = 0;
-			skb_add_rx_frag(skb, j, ps_page->ps_page[j], 0, length);
+			skb_fill_page_desc(skb, j, ps_page->ps_page[j], 0,
+			                   length);
 			ps_page->ps_page[j] = NULL;
+			skb->len += length;
+			skb->data_len += length;
+			skb->truesize += length;
 		}
 
 		/* strip the ethernet crc, problem is we're using pages now so
@@ -4558,7 +4553,7 @@
 			if (j < adapter->rx_ps_pages) {
 				if (likely(!ps_page->ps_page[j])) {
 					ps_page->ps_page[j] =
-						netdev_alloc_page(netdev);
+						alloc_page(GFP_ATOMIC);
 					if (unlikely(!ps_page->ps_page[j])) {
 						adapter->alloc_rx_buff_failed++;
 						goto no_buffers;
@@ -5175,9 +5170,6 @@
 
 	netif_device_detach(netdev);
 
-	if (state == pci_channel_io_perm_failure)
-		return PCI_ERS_RESULT_DISCONNECT;
-
 	if (netif_running(netdev))
 		e1000_down(adapter);
 	pci_disable_device(pdev);