devices/e1000/e1000_main-2.6.24-ethercat.c
changeset 2589 2b9c78543663
parent 2050 a3e59f2a8589
equal deleted inserted replaced
2415:af21f0bdc7c9 2589:2b9c78543663
  1175 		e1000_get_hw_control(adapter);
  1175 		e1000_get_hw_control(adapter);
  1176 
  1176 
  1177 	// offer device to EtherCAT master module
  1177 	// offer device to EtherCAT master module
  1178 	adapter->ecdev = ecdev_offer(netdev, ec_poll, THIS_MODULE);
  1178 	adapter->ecdev = ecdev_offer(netdev, ec_poll, THIS_MODULE);
  1179 	if (adapter->ecdev) {
  1179 	if (adapter->ecdev) {
  1180 		if (ecdev_open(adapter->ecdev)) {
  1180 		err = ecdev_open(adapter->ecdev);
       
  1181 		if (err) {
  1181 			ecdev_withdraw(adapter->ecdev);
  1182 			ecdev_withdraw(adapter->ecdev);
  1182 			goto err_register;
  1183 			goto err_register;
  1183 		}
  1184 		}
  1184 	} else {
  1185 	} else {
  1185 		/* tell the stack to leave us alone until e1000_open() is called */
  1186 		/* tell the stack to leave us alone until e1000_open() is called */
  1477 
  1478 
  1478 	/* From here on the code is the same as e1000_up() */
  1479 	/* From here on the code is the same as e1000_up() */
  1479 	clear_bit(__E1000_DOWN, &adapter->flags);
  1480 	clear_bit(__E1000_DOWN, &adapter->flags);
  1480 
  1481 
  1481 #ifdef CONFIG_E1000_NAPI
  1482 #ifdef CONFIG_E1000_NAPI
  1482 	napi_enable(&adapter->napi);
  1483 	if (!adapter->ecdev) {
       
  1484 		napi_enable(&adapter->napi);
       
  1485 	}
  1483 #endif
  1486 #endif
  1484 
  1487 
  1485 	e1000_irq_enable(adapter);
  1488 	e1000_irq_enable(adapter);
  1486 
  1489 
  1487 	/* fire a link status change interrupt to start the watchdog */
  1490 	/* fire a link status change interrupt to start the watchdog */
  2400 
  2403 
  2401 	if (!adapter->netdev && netif_running(netdev)) {
  2404 	if (!adapter->netdev && netif_running(netdev)) {
  2402 		/* No need to loop, because 82542 supports only 1 queue */
  2405 		/* No need to loop, because 82542 supports only 1 queue */
  2403 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2406 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2404 		e1000_configure_rx(adapter);
  2407 		e1000_configure_rx(adapter);
  2405 		if (adapter->ecdev) { 
  2408 		if (adapter->ecdev) {
  2406 			/* fill rx ring completely! */
  2409 			/* fill rx ring completely! */
  2407 			adapter->alloc_rx_buf(adapter, ring, ring->count);
  2410 			adapter->alloc_rx_buf(adapter, ring, ring->count);
  2408 		} else {
  2411 		} else {
  2409             /* this one leaves the last ring element unallocated! */
  2412             /* this one leaves the last ring element unallocated! */
  2410 			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
  2413 			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
  3287 
  3290 
  3288 static int __e1000_maybe_stop_tx(struct net_device *netdev, int size)
  3291 static int __e1000_maybe_stop_tx(struct net_device *netdev, int size)
  3289 {
  3292 {
  3290 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3293 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3291 	struct e1000_tx_ring *tx_ring = adapter->tx_ring;
  3294 	struct e1000_tx_ring *tx_ring = adapter->tx_ring;
       
  3295 
       
  3296 	if (adapter->ecdev) {
       
  3297 		return -EBUSY;
       
  3298 	}
  3292 
  3299 
  3293 	netif_stop_queue(netdev);
  3300 	netif_stop_queue(netdev);
  3294 	/* Herbert's original patch had:
  3301 	/* Herbert's original patch had:
  3295 	 *  smp_mb__after_netif_stop_queue();
  3302 	 *  smp_mb__after_netif_stop_queue();
  3296 	 * but since that doesn't exist yet, just open code it. */
  3303 	 * but since that doesn't exist yet, just open code it. */
  3847 {
  3854 {
  3848 	struct net_device *netdev = data;
  3855 	struct net_device *netdev = data;
  3849 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3856 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3850 	struct e1000_hw *hw = &adapter->hw;
  3857 	struct e1000_hw *hw = &adapter->hw;
  3851 	int i;
  3858 	int i;
  3852 	
  3859 
  3853 	if (adapter->ecdev) {
  3860 	if (adapter->ecdev) {
  3854 #ifdef CONFIG_E1000_NAPI
  3861 #ifdef CONFIG_E1000_NAPI
  3855 		int ec_work_done = 0;
  3862 		int ec_work_done = 0;
  3856 #endif
  3863 #endif
  3857 		for (i = 0; i < E1000_MAX_INTR; i++)
  3864 		for (i = 0; i < E1000_MAX_INTR; i++)
  4011 		 */
  4018 		 */
  4012 		if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) {
  4019 		if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) {
  4013 			atomic_inc(&adapter->irq_sem);
  4020 			atomic_inc(&adapter->irq_sem);
  4014 			E1000_WRITE_REG(hw, IMC, ~0);
  4021 			E1000_WRITE_REG(hw, IMC, ~0);
  4015 		}
  4022 		}
  4016 	
  4023 
  4017 		adapter->total_tx_bytes = 0;
  4024 		adapter->total_tx_bytes = 0;
  4018 		adapter->total_rx_bytes = 0;
  4025 		adapter->total_rx_bytes = 0;
  4019 		adapter->total_tx_packets = 0;
  4026 		adapter->total_tx_packets = 0;
  4020 		adapter->total_rx_packets = 0;
  4027 		adapter->total_rx_packets = 0;
  4021 
  4028