summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-09-06 19:40:32 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-09-06 19:40:32 +0000
commitb2aa57fdbb2257ed31ae95b6b7c676505ab4fd66 (patch)
tree5bf68e4e80c7d1932cf011cddaf69485f87e5658
parent07bbb8e8a5e3eeb5aa44a45d0829f229edcc84e2 (diff)
Formerly ethernet.c.~3~
-rw-r--r--pfinet/ethernet.c47
1 files changed, 15 insertions, 32 deletions
diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c
index 241467c8..c43cd37b 100644
--- a/pfinet/ethernet.c
+++ b/pfinet/ethernet.c
@@ -22,43 +22,26 @@
device_t ether_port;
struct device *ether_dev;
-void
-ethernet_main_loop (void)
+error_t
+device_read_reply_inband (mach_port_t replypt,
+ error_t error_code,
+ vm_address_t data,
+ u_int datalen)
{
- error_t err;
- vm_address_t packet;
- vm_size_t packetlen;
- struct sk_buff *skb;
-
- /* Listen to packets forever. When one arrives,
- it's an "interrupt", so drop to interrupt layer, and call
- the generic code. */
- for (;;)
- {
- err = device_read (ether_port, 0, 0, vm_page_size, &packet,
- &packetlen);
- if (err)
- {
- perror ("Reading from ethernet");
- continue;
- }
-
- begin_interrupt ();
-
- skb = alloc_skb (packetlen, GFP_ATOMIC);
- skb->len = packetlen;
- skb->dev = ether_dev;
- bcopy (packet, skb->data);
- netif_rx (skb);
- }
-}
-
+ mutex_lock (&global_lock);
+ skb = alloc_skb (packetlen, GFP_ATOMIC);
+ skb->len = packetlen;
+ skb->dev = ether_dev;
+ bcopy (packet, skb->data);
+ netif_rx (skb);
+ mutex_unlock (&global_lock);
-
+ device_read_request (ether_port, ether_reply, 0, 0, vm_page_size);
+}
void
start_ethernet (void)
{
- cthread_detach (cthread_fork ((cthread_fn_t) ethernet_main_loop, 0));
+ device_read_request (ether_port, ether_reply, 0, 0, vm_page_size);
}