Frame reception basically working (still some more testing needed).
authorFlorian Pose <fp@igh-essen.com>
Tue, 30 Sep 2008 10:03:10 +0000
changeset 1228 6d9c686f922e
parent 1227 471ceaf7f89d
child 1229 51d447754109
Frame reception basically working (still some more testing needed).
devices/e100-2.6.20-ethercat.c
--- a/devices/e100-2.6.20-ethercat.c	Tue Sep 30 08:23:00 2008 +0000
+++ b/devices/e100-2.6.20-ethercat.c	Tue Sep 30 10:03:10 2008 +0000
@@ -1884,8 +1884,6 @@
 	if(unlikely(work_done && *work_done >= work_to_do))
 		return -EAGAIN;
 
-	return -ENODATA; // FIXME
-
 	/* Need to sync before taking a peek at cb_complete bit */
 	pci_dma_sync_single_for_cpu(nic->pdev, rx->dma_addr,
 		sizeof(struct rfd), PCI_DMA_FROMDEVICE);
@@ -1902,9 +1900,6 @@
 	if(unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd)))
 		actual_size = RFD_BUF_LEN - sizeof(struct rfd);
 
-	printk(KERN_INFO "ec_e100 rx %p rec %u\n", rx, actual_size);
-	msleep(500); // FIXME
-
 	/* Get data */
 	pci_unmap_single(nic->pdev, rx->dma_addr,
 		RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
@@ -1935,15 +1930,12 @@
 		nic->net_stats.rx_bytes += actual_size;
 		nic->netdev->last_rx = jiffies;
 		if (nic->ecdev) {
-#if 0
 			ecdev_receive(nic->ecdev,
 					skb->data + sizeof(struct rfd), actual_size);
-#endif
+
 			// No need to detect link status as
 			// long as frames are received: Reset watchdog.
-#if 0
 			nic->ec_watchdog_jiffies = jiffies;
-#endif
 		} else {
 			netif_receive_skb(skb);
 		}
@@ -1951,8 +1943,15 @@
 			(*work_done)++;
 	}
 
-	if (!nic->ecdev)
+	if (nic->ecdev) {
+		// make receive frame descriptior usable again
+		rfd->status = 0x0000;
+		rfd->command = cpu_to_le16(cb_el);
+		rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data,
+				RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
+	} else {
 		rx->skb = NULL;
+	}
 
 	return 0;
 }