devices/e1000/e1000_main-2.6.27-orig.c
branchstable-1.5
changeset 2378 ca345abf0565
parent 2252 6001f50617a7
equal deleted inserted replaced
2377:aa0f6f939cb3 2378:ca345abf0565
  4132 		                 buffer_info->length,
  4132 		                 buffer_info->length,
  4133 		                 PCI_DMA_FROMDEVICE);
  4133 		                 PCI_DMA_FROMDEVICE);
  4134 
  4134 
  4135 		length = le16_to_cpu(rx_desc->length);
  4135 		length = le16_to_cpu(rx_desc->length);
  4136 		/* !EOP means multiple descriptors were used to store a single
  4136 		/* !EOP means multiple descriptors were used to store a single
  4137 		 * packet, if thats the case we need to toss it.  In fact, we
  4137 		 * packet, also make sure the frame isn't just CRC only */
  4138 		 * to toss every packet with the EOP bit clear and the next
  4138 		if (unlikely(!(status & E1000_RXD_STAT_EOP) || (length <= 4))) {
  4139 		 * frame that _does_ have the EOP bit set, as it is by
       
  4140 		 * definition only a frame fragment
       
  4141 		 */
       
  4142 		if (unlikely(!(status & E1000_RXD_STAT_EOP)))
       
  4143 			set_bit(__E1000_DISCARDING, &adapter->flags);
       
  4144 
       
  4145 		if (test_bit(__E1000_DISCARDING, &adapter->flags)) {
       
  4146 			/* All receives must fit into a single buffer */
  4139 			/* All receives must fit into a single buffer */
  4147 			E1000_DBG("%s: Receive packet consumed multiple"
  4140 			E1000_DBG("%s: Receive packet consumed multiple"
  4148 				  " buffers\n", netdev->name);
  4141 				  " buffers\n", netdev->name);
  4149 			/* recycle */
  4142 			/* recycle */
  4150 			buffer_info->skb = skb;
  4143 			buffer_info->skb = skb;
  4151 			if (status & E1000_RXD_STAT_EOP)
       
  4152 				clear_bit(__E1000_DISCARDING, &adapter->flags);
       
  4153 			goto next_desc;
  4144 			goto next_desc;
  4154 		}
  4145 		}
  4155 
  4146 
  4156 		if (unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) {
  4147 		if (unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) {
  4157 			last_byte = *(skb->data + length - 1);
  4148 			last_byte = *(skb->data + length - 1);
  4356 			if (!length)
  4347 			if (!length)
  4357 				break;
  4348 				break;
  4358 			pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
  4349 			pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
  4359 					PAGE_SIZE, PCI_DMA_FROMDEVICE);
  4350 					PAGE_SIZE, PCI_DMA_FROMDEVICE);
  4360 			ps_page_dma->ps_page_dma[j] = 0;
  4351 			ps_page_dma->ps_page_dma[j] = 0;
  4361 			skb_add_rx_frag(skb, j, ps_page->ps_page[j], 0, length);
  4352 			skb_fill_page_desc(skb, j, ps_page->ps_page[j], 0,
       
  4353 			                   length);
  4362 			ps_page->ps_page[j] = NULL;
  4354 			ps_page->ps_page[j] = NULL;
       
  4355 			skb->len += length;
       
  4356 			skb->data_len += length;
       
  4357 			skb->truesize += length;
  4363 		}
  4358 		}
  4364 
  4359 
  4365 		/* strip the ethernet crc, problem is we're using pages now so
  4360 		/* strip the ethernet crc, problem is we're using pages now so
  4366 		 * this whole operation can get a little cpu intensive */
  4361 		 * this whole operation can get a little cpu intensive */
  4367 		pskb_trim(skb, skb->len - 4);
  4362 		pskb_trim(skb, skb->len - 4);
  4556 
  4551 
  4557 		for (j = 0; j < PS_PAGE_BUFFERS; j++) {
  4552 		for (j = 0; j < PS_PAGE_BUFFERS; j++) {
  4558 			if (j < adapter->rx_ps_pages) {
  4553 			if (j < adapter->rx_ps_pages) {
  4559 				if (likely(!ps_page->ps_page[j])) {
  4554 				if (likely(!ps_page->ps_page[j])) {
  4560 					ps_page->ps_page[j] =
  4555 					ps_page->ps_page[j] =
  4561 						netdev_alloc_page(netdev);
  4556 						alloc_page(GFP_ATOMIC);
  4562 					if (unlikely(!ps_page->ps_page[j])) {
  4557 					if (unlikely(!ps_page->ps_page[j])) {
  4563 						adapter->alloc_rx_buff_failed++;
  4558 						adapter->alloc_rx_buff_failed++;
  4564 						goto no_buffers;
  4559 						goto no_buffers;
  4565 					}
  4560 					}
  4566 					ps_page_dma->ps_page_dma[j] =
  4561 					ps_page_dma->ps_page_dma[j] =
  5173 	struct net_device *netdev = pci_get_drvdata(pdev);
  5168 	struct net_device *netdev = pci_get_drvdata(pdev);
  5174 	struct e1000_adapter *adapter = netdev->priv;
  5169 	struct e1000_adapter *adapter = netdev->priv;
  5175 
  5170 
  5176 	netif_device_detach(netdev);
  5171 	netif_device_detach(netdev);
  5177 
  5172 
  5178 	if (state == pci_channel_io_perm_failure)
       
  5179 		return PCI_ERS_RESULT_DISCONNECT;
       
  5180 
       
  5181 	if (netif_running(netdev))
  5173 	if (netif_running(netdev))
  5182 		e1000_down(adapter);
  5174 		e1000_down(adapter);
  5183 	pci_disable_device(pdev);
  5175 	pci_disable_device(pdev);
  5184 
  5176 
  5185 	/* Request a slot slot reset. */
  5177 	/* Request a slot slot reset. */