devices/e1000/e1000_main-2.6.22-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.22-ethercat.h"
    31 #include "e1000-2.6.22-ethercat.h"
    30 #include <net/ip6_checksum.h>
    32 #include <net/ip6_checksum.h>
   538 	/* call E1000_DESC_UNUSED which always leaves
   540 	/* call E1000_DESC_UNUSED which always leaves
   539 	 * at least 1 descriptor unused to make sure
   541 	 * at least 1 descriptor unused to make sure
   540 	 * next_to_use != next_to_clean */
   542 	 * next_to_use != next_to_clean */
   541 	for (i = 0; i < adapter->num_rx_queues; i++) {
   543 	for (i = 0; i < adapter->num_rx_queues; i++) {
   542 		struct e1000_rx_ring *ring = &adapter->rx_ring[i];
   544 		struct e1000_rx_ring *ring = &adapter->rx_ring[i];
   543 		adapter->alloc_rx_buf(adapter, ring,
   545 		if (adapter->ecdev) {
   544 		                      E1000_DESC_UNUSED(ring));
   546 			/* fill rx ring completely! */
       
   547 			adapter->alloc_rx_buf(adapter, ring, ring->count);
       
   548 		} else {
       
   549             /* this one leaves the last ring element unallocated! */
       
   550 			adapter->alloc_rx_buf(adapter, ring,
       
   551 					E1000_DESC_UNUSED(ring));
       
   552 		}
   545 	}
   553 	}
   546 
   554 
   547 	adapter->tx_queue_len = netdev->tx_queue_len;
   555 	adapter->tx_queue_len = netdev->tx_queue_len;
   548 }
   556 }
   549 
   557 
  2394 
  2402 
  2395 	if (!adapter->netdev && netif_running(netdev)) {
  2403 	if (!adapter->netdev && netif_running(netdev)) {
  2396 		/* No need to loop, because 82542 supports only 1 queue */
  2404 		/* No need to loop, because 82542 supports only 1 queue */
  2397 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2405 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2398 		e1000_configure_rx(adapter);
  2406 		e1000_configure_rx(adapter);
  2399 		adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
  2407 		if (adapter->ecdev) { 
       
  2408 			/* fill rx ring completely! */
       
  2409 			adapter->alloc_rx_buf(adapter, ring, ring->count);
       
  2410 		} else {
       
  2411             /* this one leaves the last ring element unallocated! */
       
  2412 			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
       
  2413 		}
       
  2414 
  2400 	}
  2415 	}
  2401 }
  2416 }
  2402 
  2417 
  2403 /**
  2418 /**
  2404  * e1000_set_mac - Change the Ethernet Address of the NIC
  2419  * e1000_set_mac - Change the Ethernet Address of the NIC
  3834 {
  3849 {
  3835 	struct net_device *netdev = data;
  3850 	struct net_device *netdev = data;
  3836 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3851 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3837 	struct e1000_hw *hw = &adapter->hw;
  3852 	struct e1000_hw *hw = &adapter->hw;
  3838 	int i;
  3853 	int i;
       
  3854 	uint32_t icr = E1000_READ_REG(hw, ICR);
       
  3855 
       
  3856 	if (adapter->ecdev) {
  3839 #ifdef CONFIG_E1000_NAPI
  3857 #ifdef CONFIG_E1000_NAPI
  3840 	int ec_work_done = 0;
  3858 		int ec_work_done = 0;
  3841 #endif
  3859 #endif
  3842 	uint32_t icr = E1000_READ_REG(hw, ICR);
       
  3843 
       
  3844 	if (adapter->ecdev) {
       
  3845 		for (i = 0; i < E1000_MAX_INTR; i++)
  3860 		for (i = 0; i < E1000_MAX_INTR; i++)
  3846 #ifdef CONFIG_E1000_NAPI
  3861 #ifdef CONFIG_E1000_NAPI
  3847 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3862 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3848 							&ec_work_done, 100) &
  3863 							&ec_work_done, 100) &
  3849 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3864 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3914 	struct net_device *netdev = data;
  3929 	struct net_device *netdev = data;
  3915 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3930 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3916 	struct e1000_hw *hw = &adapter->hw;
  3931 	struct e1000_hw *hw = &adapter->hw;
  3917 	uint32_t rctl, icr = E1000_READ_REG(hw, ICR);
  3932 	uint32_t rctl, icr = E1000_READ_REG(hw, ICR);
  3918 	int i;
  3933 	int i;
  3919 #ifdef CONFIG_E1000_NAPI
       
  3920 	int ec_work_done = 0;
       
  3921 #endif
       
  3922 	if (unlikely(!icr))
  3934 	if (unlikely(!icr))
  3923 		return IRQ_NONE;  /* Not our interrupt */
  3935 		return IRQ_NONE;  /* Not our interrupt */
  3924 
  3936 
  3925 #ifdef CONFIG_E1000_NAPI
  3937 #ifdef CONFIG_E1000_NAPI
  3926 	/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
  3938 	/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
  3954 		if (!test_bit(__E1000_DOWN, &adapter->flags))
  3966 		if (!test_bit(__E1000_DOWN, &adapter->flags))
  3955 			mod_timer(&adapter->watchdog_timer, jiffies + 1);
  3967 			mod_timer(&adapter->watchdog_timer, jiffies + 1);
  3956 	}
  3968 	}
  3957 
  3969 
  3958 	if (adapter->ecdev) {
  3970 	if (adapter->ecdev) {
       
  3971 #ifdef CONFIG_E1000_NAPI
       
  3972 		int ec_work_done = 0;
       
  3973 #endif
  3959 		for (i = 0; i < E1000_MAX_INTR; i++)
  3974 		for (i = 0; i < E1000_MAX_INTR; i++)
  3960 #ifdef CONFIG_E1000_NAPI
  3975 #ifdef CONFIG_E1000_NAPI
  3961 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3976 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
  3962                             &ec_work_done, 100) &
  3977                             &ec_work_done, 100) &
  3963 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))
  3978 						!e1000_clean_tx_irq(adapter, adapter->tx_ring)))