devices/e1000/e1000_main-2.6.24-ethercat.c
changeset 1325 16aacb421bd4
parent 1154 04bcd38cf8dc
child 2050 a3e59f2a8589
equal deleted inserted replaced
1324:08060693df37 1325:16aacb421bd4
    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.24-ethercat.h"
    31 #include "e1000-2.6.24-ethercat.h"
    30 #include <net/ip6_checksum.h>
    32 #include <net/ip6_checksum.h>
   539 	/* call E1000_DESC_UNUSED which always leaves
   541 	/* call E1000_DESC_UNUSED which always leaves
   540 	 * at least 1 descriptor unused to make sure
   542 	 * at least 1 descriptor unused to make sure
   541 	 * next_to_use != next_to_clean */
   543 	 * next_to_use != next_to_clean */
   542 	for (i = 0; i < adapter->num_rx_queues; i++) {
   544 	for (i = 0; i < adapter->num_rx_queues; i++) {
   543 		struct e1000_rx_ring *ring = &adapter->rx_ring[i];
   545 		struct e1000_rx_ring *ring = &adapter->rx_ring[i];
   544 		adapter->alloc_rx_buf(adapter, ring,
   546 		if (adapter->ecdev) {
   545 		                      E1000_DESC_UNUSED(ring));
   547 			/* fill rx ring completely! */
       
   548 			adapter->alloc_rx_buf(adapter, ring, ring->count);
       
   549 		} else {
       
   550             /* this one leaves the last ring element unallocated! */
       
   551 			adapter->alloc_rx_buf(adapter, ring,
       
   552 					E1000_DESC_UNUSED(ring));
       
   553 		}
   546 	}
   554 	}
   547 
   555 
   548 	adapter->tx_queue_len = netdev->tx_queue_len;
   556 	adapter->tx_queue_len = netdev->tx_queue_len;
   549 }
   557 }
   550 
   558 
  2392 
  2400 
  2393 	if (!adapter->netdev && netif_running(netdev)) {
  2401 	if (!adapter->netdev && netif_running(netdev)) {
  2394 		/* No need to loop, because 82542 supports only 1 queue */
  2402 		/* No need to loop, because 82542 supports only 1 queue */
  2395 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2403 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2396 		e1000_configure_rx(adapter);
  2404 		e1000_configure_rx(adapter);
  2397 		adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
  2405 		if (adapter->ecdev) { 
       
  2406 			/* fill rx ring completely! */
       
  2407 			adapter->alloc_rx_buf(adapter, ring, ring->count);
       
  2408 		} else {
       
  2409             /* this one leaves the last ring element unallocated! */
       
  2410 			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
       
  2411 		}
       
  2412 
  2398 	}
  2413 	}
  2399 }
  2414 }
  2400 
  2415 
  2401 /**
  2416 /**
  2402  * e1000_set_mac - Change the Ethernet Address of the NIC
  2417  * e1000_set_mac - Change the Ethernet Address of the NIC
  3831 e1000_intr_msi(int irq, void *data)
  3846 e1000_intr_msi(int irq, void *data)
  3832 {
  3847 {
  3833 	struct net_device *netdev = data;
  3848 	struct net_device *netdev = data;
  3834 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3849 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3835 	struct e1000_hw *hw = &adapter->hw;
  3850 	struct e1000_hw *hw = &adapter->hw;
  3836 	int ec_work_done = 0;
       
  3837 	int i;
  3851 	int i;
  3838 	
  3852 	
  3839 	if (adapter->ecdev) {
  3853 	if (adapter->ecdev) {
       
  3854 #ifdef CONFIG_E1000_NAPI
       
  3855 		int ec_work_done = 0;
       
  3856 #endif
  3840 		for (i = 0; i < E1000_MAX_INTR; i++)
  3857 		for (i = 0; i < E1000_MAX_INTR; i++)
  3841 #ifdef CONFIG_E1000_NAPI
  3858 #ifdef CONFIG_E1000_NAPI
  3842 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3859 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3843                             &ec_work_done, 100) &
  3860                             &ec_work_done, 100) &
  3844 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3861 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3911 	struct net_device *netdev = data;
  3928 	struct net_device *netdev = data;
  3912 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3929 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3913 	struct e1000_hw *hw = &adapter->hw;
  3930 	struct e1000_hw *hw = &adapter->hw;
  3914 	uint32_t rctl, icr = E1000_READ_REG(hw, ICR);
  3931 	uint32_t rctl, icr = E1000_READ_REG(hw, ICR);
  3915 	int i;
  3932 	int i;
  3916 	int ec_work_done = 0;
       
  3917 	if (unlikely(!icr))
  3933 	if (unlikely(!icr))
  3918 		return IRQ_NONE;  /* Not our interrupt */
  3934 		return IRQ_NONE;  /* Not our interrupt */
  3919 
  3935 
  3920 #ifdef CONFIG_E1000_NAPI
  3936 #ifdef CONFIG_E1000_NAPI
  3921 	/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
  3937 	/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
  3949 		if (!test_bit(__E1000_DOWN, &adapter->flags))
  3965 		if (!test_bit(__E1000_DOWN, &adapter->flags))
  3950 			mod_timer(&adapter->watchdog_timer, jiffies + 1);
  3966 			mod_timer(&adapter->watchdog_timer, jiffies + 1);
  3951 	}
  3967 	}
  3952 
  3968 
  3953 	if (adapter->ecdev) {
  3969 	if (adapter->ecdev) {
       
  3970 #ifdef CONFIG_E1000_NAPI
       
  3971 		int ec_work_done = 0;
       
  3972 #endif
  3954 		for (i = 0; i < E1000_MAX_INTR; i++)
  3973 		for (i = 0; i < E1000_MAX_INTR; i++)
  3955 #ifdef CONFIG_E1000_NAPI
  3974 #ifdef CONFIG_E1000_NAPI
  3956 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3975 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3957                             &ec_work_done, 100) &
  3976                             &ec_work_done, 100) &
  3958 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3977 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))