devices/e1000/e1000_main-2.6.20-ethercat.c
branchstable-1.4
changeset 1684 adf0b6f46ecd
parent 1154 04bcd38cf8dc
child 2050 a3e59f2a8589
equal deleted inserted replaced
1683:815789678f26 1684:adf0b6f46ecd
    21 
    21 
    22   Contact Information:
    22   Contact Information:
    23   Linux NICS <linux.nics@intel.com>
    23   Linux NICS <linux.nics@intel.com>
    24   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
    24   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
    25   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
    25   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
       
    26   
       
    27   vim: noexpandtab
    26 
    28 
    27 *******************************************************************************/
    29 *******************************************************************************/
    28 
    30 
    29 #include "e1000-2.6.20-ethercat.h"
    31 #include "e1000-2.6.20-ethercat.h"
    30 #include <net/ip6_checksum.h>
    32 #include <net/ip6_checksum.h>
   555 	/* call E1000_DESC_UNUSED which always leaves
   557 	/* call E1000_DESC_UNUSED which always leaves
   556 	 * at least 1 descriptor unused to make sure
   558 	 * at least 1 descriptor unused to make sure
   557 	 * next_to_use != next_to_clean */
   559 	 * next_to_use != next_to_clean */
   558 	for (i = 0; i < adapter->num_rx_queues; i++) {
   560 	for (i = 0; i < adapter->num_rx_queues; i++) {
   559 		struct e1000_rx_ring *ring = &adapter->rx_ring[i];
   561 		struct e1000_rx_ring *ring = &adapter->rx_ring[i];
   560 		adapter->alloc_rx_buf(adapter, ring,
   562 		if (adapter->ecdev) {
   561 		                      E1000_DESC_UNUSED(ring));
   563 			/* fill rx ring completely! */
       
   564 			adapter->alloc_rx_buf(adapter, ring, ring->count);
       
   565 		} else {
       
   566             /* this one leaves the last ring element unallocated! */
       
   567 			adapter->alloc_rx_buf(adapter, ring,
       
   568 					E1000_DESC_UNUSED(ring));
       
   569 		}
   562 	}
   570 	}
   563 
   571 
   564 	adapter->tx_queue_len = netdev->tx_queue_len;
   572 	adapter->tx_queue_len = netdev->tx_queue_len;
   565 
   573 
   566     if (!adapter->ecdev) {
   574     if (!adapter->ecdev) {
  2393 
  2401 
  2394 	if (!adapter->netdev && netif_running(netdev)) {
  2402 	if (!adapter->netdev && netif_running(netdev)) {
  2395 		/* No need to loop, because 82542 supports only 1 queue */
  2403 		/* No need to loop, because 82542 supports only 1 queue */
  2396 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2404 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2397 		e1000_configure_rx(adapter);
  2405 		e1000_configure_rx(adapter);
  2398 		adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
  2406 		if (adapter->ecdev) { 
       
  2407 			/* fill rx ring completely! */
       
  2408 			adapter->alloc_rx_buf(adapter, ring, ring->count);
       
  2409 		} else {
       
  2410             /* this one leaves the last ring element unallocated! */
       
  2411 			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
       
  2412 		}
       
  2413 
  2399 	}
  2414 	}
  2400 }
  2415 }
  2401 
  2416 
  2402 /**
  2417 /**
  2403  * e1000_set_mac - Change the Ethernet Address of the NIC
  2418  * e1000_set_mac - Change the Ethernet Address of the NIC
  3854 {
  3869 {
  3855 	struct net_device *netdev = data;
  3870 	struct net_device *netdev = data;
  3856 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3871 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3857 	struct e1000_hw *hw = &adapter->hw;
  3872 	struct e1000_hw *hw = &adapter->hw;
  3858 	int i;
  3873 	int i;
       
  3874 
       
  3875 	if (adapter->ecdev) {
  3859 #ifdef CONFIG_E1000_NAPI
  3876 #ifdef CONFIG_E1000_NAPI
  3860 	int ec_work_done = 0;
  3877 		int ec_work_done = 0;
  3861 #endif
  3878 #endif
  3862 
       
  3863 	if (adapter->ecdev) {
       
  3864 		for (i = 0; i < E1000_MAX_INTR; i++)
  3879 		for (i = 0; i < E1000_MAX_INTR; i++)
  3865 #ifdef CONFIG_E1000_NAPI
  3880 #ifdef CONFIG_E1000_NAPI
  3866 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3881 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3867                             &ec_work_done, 100) &
  3882                             &ec_work_done, 100) &
  3868 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3883 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3957 	struct net_device *netdev = data;
  3972 	struct net_device *netdev = data;
  3958 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3973 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3959 	struct e1000_hw *hw = &adapter->hw;
  3974 	struct e1000_hw *hw = &adapter->hw;
  3960 	uint32_t rctl, icr = E1000_READ_REG(hw, ICR);
  3975 	uint32_t rctl, icr = E1000_READ_REG(hw, ICR);
  3961 	int i;
  3976 	int i;
  3962 #ifdef CONFIG_E1000_NAPI
       
  3963 	int ec_work_done = 0;
       
  3964 #endif
       
  3965 	if (unlikely(!icr))
  3977 	if (unlikely(!icr))
  3966 		return IRQ_NONE;  /* Not our interrupt */
  3978 		return IRQ_NONE;  /* Not our interrupt */
  3967 
  3979 
  3968 #ifdef CONFIG_E1000_NAPI
  3980 #ifdef CONFIG_E1000_NAPI
  3969 	/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
  3981 	/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
  3997 		if (!test_bit(__E1000_DOWN, &adapter->flags))
  4009 		if (!test_bit(__E1000_DOWN, &adapter->flags))
  3998 			mod_timer(&adapter->watchdog_timer, jiffies + 1);
  4010 			mod_timer(&adapter->watchdog_timer, jiffies + 1);
  3999 	}
  4011 	}
  4000 
  4012 
  4001 	if (adapter->ecdev) {
  4013 	if (adapter->ecdev) {
       
  4014 #ifdef CONFIG_E1000_NAPI
       
  4015 		int ec_work_done = 0;
       
  4016 #endif
  4002 		for (i = 0; i < E1000_MAX_INTR; i++)
  4017 		for (i = 0; i < E1000_MAX_INTR; i++)
  4003 #ifdef CONFIG_E1000_NAPI
  4018 #ifdef CONFIG_E1000_NAPI
  4004 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  4019 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  4005                             &ec_work_done, 100) &
  4020                             &ec_work_done, 100) &
  4006 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  4021 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))