devices/e1000/e1000_main-2.6.20-ethercat.c
changeset 2589 2b9c78543663
parent 2050 a3e59f2a8589
equal deleted inserted replaced
2415:af21f0bdc7c9 2589:2b9c78543663
    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   
    26 
    27   vim: noexpandtab
    27   vim: noexpandtab
    28 
    28 
    29 *******************************************************************************/
    29 *******************************************************************************/
    30 
    30 
    31 #include "e1000-2.6.20-ethercat.h"
    31 #include "e1000-2.6.20-ethercat.h"
  1188 		e1000_get_hw_control(adapter);
  1188 		e1000_get_hw_control(adapter);
  1189 
  1189 
  1190 	// offer device to EtherCAT master module
  1190 	// offer device to EtherCAT master module
  1191 	adapter->ecdev = ecdev_offer(netdev, ec_poll, THIS_MODULE);
  1191 	adapter->ecdev = ecdev_offer(netdev, ec_poll, THIS_MODULE);
  1192 	if (adapter->ecdev) {
  1192 	if (adapter->ecdev) {
  1193 		if (ecdev_open(adapter->ecdev)) {
  1193 		err = ecdev_open(adapter->ecdev);
       
  1194 		if (err) {
  1194 			ecdev_withdraw(adapter->ecdev);
  1195 			ecdev_withdraw(adapter->ecdev);
  1195 			goto err_register;
  1196 			goto err_register;
  1196 		}
  1197 		}
  1197 	} else {
  1198 	} else {
  1198 		strcpy(netdev->name, "eth%d");
  1199 		strcpy(netdev->name, "eth%d");
  2401 
  2402 
  2402 	if (!adapter->netdev && netif_running(netdev)) {
  2403 	if (!adapter->netdev && netif_running(netdev)) {
  2403 		/* No need to loop, because 82542 supports only 1 queue */
  2404 		/* No need to loop, because 82542 supports only 1 queue */
  2404 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2405 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
  2405 		e1000_configure_rx(adapter);
  2406 		e1000_configure_rx(adapter);
  2406 		if (adapter->ecdev) { 
  2407 		if (adapter->ecdev) {
  2407 			/* fill rx ring completely! */
  2408 			/* fill rx ring completely! */
  2408 			adapter->alloc_rx_buf(adapter, ring, ring->count);
  2409 			adapter->alloc_rx_buf(adapter, ring, ring->count);
  2409 		} else {
  2410 		} else {
  2410             /* this one leaves the last ring element unallocated! */
  2411             /* this one leaves the last ring element unallocated! */
  2411 			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
  2412 			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
  3297 
  3298 
  3298 static int __e1000_maybe_stop_tx(struct net_device *netdev, int size)
  3299 static int __e1000_maybe_stop_tx(struct net_device *netdev, int size)
  3299 {
  3300 {
  3300 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3301 	struct e1000_adapter *adapter = netdev_priv(netdev);
  3301 	struct e1000_tx_ring *tx_ring = adapter->tx_ring;
  3302 	struct e1000_tx_ring *tx_ring = adapter->tx_ring;
       
  3303 
       
  3304 	if (adapter->ecdev) {
       
  3305 		return -EBUSY;
       
  3306 	}
  3302 
  3307 
  3303 	netif_stop_queue(netdev);
  3308 	netif_stop_queue(netdev);
  3304 	/* Herbert's original patch had:
  3309 	/* Herbert's original patch had:
  3305 	 *  smp_mb__after_netif_stop_queue();
  3310 	 *  smp_mb__after_netif_stop_queue();
  3306 	 * but since that doesn't exist yet, just open code it. */
  3311 	 * but since that doesn't exist yet, just open code it. */