Index: uspace/srv/hw/netif/dp8390/dp8390.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.c	(revision b18753674db821b4aff9829ab475b50332403b40)
+++ uspace/srv/hw/netif/dp8390/dp8390.c	(revision 39d70ec9205ad8321aa0bad0815cb7db506a880a)
@@ -12,4 +12,5 @@
 #include <netif_local.h>
 #include <net/packet.h>
+#include <nil_interface.h>
 #include <packet_client.h>
 #include "dp8390_drv.h"
@@ -18,29 +19,26 @@
 #include "ne2000.h"
 
-/** Queues the outgoing packet.
- *  @param[in] dep The network interface structure.
- *  @param[in] packet The outgoing packet.
- *  @return EOK on success.
- *  @return EINVAL
- */
-int queue_packet(dpeth_t *dep, packet_t *packet);
-
-/** Reads a memory block byte by byte.
+/** Read a memory block byte by byte.
+ *
  *  @param[in] port The source address.
  *  @param[out] buf The destination buffer.
  *  @param[in] size The memory block size in bytes.
+ *
  */
 static void outsb(port_t port, void * buf, size_t size);
 
-/** Reads a memory block word by word.
+/** Read a memory block word by word.
+ *
  *  @param[in] port The source address.
  *  @param[out] buf The destination buffer.
  *  @param[in] size The memory block size in bytes.
+ *
  */
 static void outsw(port_t port, void * buf, size_t size);
 
-/* Some clones of the dp8390 and the PC emulator 'Bochs' require the CR_STA
+/*
+ * Some clones of the dp8390 and the PC emulator 'Bochs' require the CR_STA
  * on writes to the CR register. Additional CR_STAs do not appear to hurt
- * genuine dp8390s
+ * genuine dp8390s.
  */
 #define CR_EXTRA  CR_STA
@@ -49,9 +47,8 @@
 static void dp_reinit(dpeth_t *dep);
 static void dp_reset(dpeth_t *dep);
-static void dp_recv(dpeth_t *dep);
-static void dp_send(dpeth_t *dep);
+static void dp_recv(int nil_phone, device_id_t device_id, dpeth_t *dep);
 static void dp_pio8_getblock(dpeth_t *dep, int page, size_t offset, size_t size, void *dst);
 static void dp_pio16_getblock(dpeth_t *dep, int page, size_t offset, size_t size, void *dst);
-static int dp_pkt2user(dpeth_t *dep, int page, int length);
+static int dp_pkt2user(int nil_phone, device_id_t device_id, dpeth_t *dep, int page, int length);
 static void dp_pio8_user2nic(dpeth_t *dep, void *buf, size_t offset, int nic_addr, size_t size);
 static void dp_pio16_user2nic(dpeth_t *dep, void *buf, size_t offset, int nic_addr, size_t size);
@@ -96,13 +93,5 @@
 		dep->de_flags |= DEF_BROAD;
 	
-//	dep->de_client = mp->m_source;
 	dp_reinit(dep);
-	
-//	reply_mess.m_type = DL_CONF_REPLY;
-//	reply_mess.m3_i1 = mp->DL_PORT;
-//	reply_mess.m3_i2 = DE_PORT_NR;
-//	*(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
-	
-//	mess_reply(mp, &reply_mess);
 	return EOK;
 }
@@ -118,27 +107,4 @@
 }
 
-int queue_packet(dpeth_t *dep, packet_t *packet)
-{
-	packet_t *tmp;
-	
-	if (dep->packet_count >= MAX_PACKETS) {
-		netif_pq_release(packet_get_id(packet));
-		return ELIMIT;
-	}
-	
-	tmp = dep->packet_queue;
-	while (pq_next(tmp))
-		tmp = pq_next(tmp);
-	
-	if (pq_add(&tmp, packet, 0, 0) != EOK)
-		return EINVAL;
-	
-	if (!dep->packet_count)
-		dep->packet_queue = packet;
-	
-	++dep->packet_count;
-	return EBUSY;
-}
-
 int do_pwrite(dpeth_t *dep, packet_t *packet, int from_int)
 {
@@ -149,8 +115,7 @@
 	assert(dep->de_flags & DEF_ENABLED);
 	
-	if ((dep->packet_queue) && (!from_int)) {
-//	if (dep->de_flags &DEF_SEND_AVAIL){
-//		fprintf(stderr, "dp8390: send already in progress\n");
-		return queue_packet(dep, packet);
+	if (dep->de_flags & DEF_SEND_AVAIL) {
+		fprintf(stderr, "dp8390: send already in progress\n");
+		return EBUSY;
 	}
 	
@@ -159,9 +124,11 @@
 		if (from_int)
 			fprintf(stderr, "dp8390: should not be sending\n");
-//		dep->de_flags |= DEF_SEND_AVAIL;
-		return queue_packet(dep, packet);
-	}
-	
-//	assert(!(dep->de_flags &DEF_PACK_SEND));
+		dep->de_flags |= DEF_SEND_AVAIL;
+		dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
+		
+		return EBUSY;
+	}
+	
+	assert(!(dep->de_flags & DEF_PACK_SEND));
 	
 	void *buf = packet_get_data(packet);
@@ -191,5 +158,10 @@
 	dep->de_sendq_head = sendq_head;
 	
-//	dep->de_flags |= DEF_PACK_SEND;
+	dep->de_flags |= DEF_PACK_SEND;
+	
+	if (from_int)
+		return EOK;
+	
+	dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
 	
 	return EOK;
@@ -360,9 +332,9 @@
 		dep->de_sendq[i].sq_filled = 0;
 	
-	dp_send(dep);
+	dep->de_flags &= ~DEF_SEND_AVAIL;
 	dep->de_flags &= ~DEF_STOPPED;
 }
 
-void dp_check_ints(dpeth_t *dep, int isr)
+void dp_check_ints(int nil_phone, device_id_t device_id, dpeth_t *dep, int isr)
 {
 	int tsr;
@@ -427,12 +399,11 @@
 			}
 			
-//			if (dep->de_flags &DEF_SEND_AVAIL)
-				dp_send(dep);
+			dep->de_flags &= ~DEF_SEND_AVAIL;
 		}
 		
 		if (isr & ISR_PRX) {
 			/* Only call dp_recv if there is a read request */
-//			if (dep->de_flags) &DEF_READING)
-				dp_recv(dep);
+//			if (dep->de_flags) & DEF_READING)
+				dp_recv(nil_phone, device_id, dep);
 		}
 		
@@ -478,7 +449,9 @@
 		dp_reset(dep);
 	}
-}
-
-static void dp_recv(dpeth_t *dep)
+	
+	dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
+}
+
+static void dp_recv(int nil_phone, device_id_t device_id, dpeth_t *dep)
 {
 	dp_rcvhdr_t header;
@@ -522,5 +495,5 @@
 			next = curr;
 		} else if ((header.dr_status & RSR_PRX) && (dep->de_flags & DEF_ENABLED)) {
-			r = dp_pkt2user(dep, pageno, length);
+			r = dp_pkt2user(nil_phone, device_id, dep, pageno, length);
 			if (r != EOK)
 				return;
@@ -539,23 +512,4 @@
 }
 
-static void dp_send(dpeth_t *dep)
-{
-	packet_t *packet;
-	
-//	if (!(dep->de_flags &DEF_SEND_AVAIL))
-//		return;
-	
-	if (dep->packet_queue) {
-		packet = dep->packet_queue;
-		dep->packet_queue = pq_detach(packet);
-		do_pwrite(dep, packet, true);
-		netif_pq_release(packet_get_id(packet));
-		--dep->packet_count;
-	}
-	
-//	if (!dep->packet_queue)
-//		dep->de_flags &= ~DEF_SEND_AVAIL;
-}
-
 static void dp_pio8_getblock(dpeth_t *dep, int page, size_t offset, size_t size, void *dst)
 {
@@ -584,5 +538,5 @@
 }
 
-static int dp_pkt2user(dpeth_t *dep, int page, int length)
+static int dp_pkt2user(int nil_phone, device_id_t device_id, dpeth_t *dep, int page, int length)
 {
 	int last, count;
@@ -614,13 +568,5 @@
 //	dep->de_flags &= ~DEF_READING;
 	
-	if (dep->received_count >= MAX_PACKETS) {
-		netif_pq_release(packet_get_id(packet));
-		return ELIMIT;
-	} else {
-		if (pq_add(&dep->received_queue, packet, 0, 0) == EOK)
-			++dep->received_count;
-		else
-			netif_pq_release(packet_get_id(packet));
-	}
+	nil_received_msg(nil_phone, device_id, packet, SERVICE_NONE);
 	
 	return EOK;
Index: uspace/srv/hw/netif/dp8390/dp8390.h
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.h	(revision b18753674db821b4aff9829ab475b50332403b40)
+++ uspace/srv/hw/netif/dp8390/dp8390.h	(revision 39d70ec9205ad8321aa0bad0815cb7db506a880a)
@@ -219,21 +219,5 @@
 #define SENDQ_PAGES  6  /* 6 * DP_PAGESIZE >= 1514 bytes */
 
-/** Maximum number of waiting packets to be sent or received.
- */
-#define MAX_PACKETS  1024
-
 typedef struct dpeth {
-	/** Outgoing packets queue */
-	packet_t *packet_queue;
-	
-	/** Outgoing packets count */
-	int packet_count;
-	
-	/** Received packets queue */
-	packet_t *received_queue;
-	
-	/** Received packets count */
-	int received_count;
-	
 	/*
 	 * The de_base_port field is the starting point of the probe.
Index: uspace/srv/hw/netif/dp8390/dp8390_drv.h
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_drv.h	(revision b18753674db821b4aff9829ab475b50332403b40)
+++ uspace/srv/hw/netif/dp8390/dp8390_drv.h	(revision 39d70ec9205ad8321aa0bad0815cb7db506a880a)
@@ -56,5 +56,5 @@
  *  @param[in,out] dep The network interface structure.
  */
-void dp_check_ints(dpeth_t *dep, int isr);
+void dp_check_ints(int nil_phone, device_id_t device_id, dpeth_t *dep, int isr);
 
 /** Probes and initializes the network interface.
@@ -69,5 +69,5 @@
  *  @param[in] packet The packet t be sent.
  *  @param[in] from_int The value indicating whether the sending is initialized from the interrupt handler.
- *  @returns 
+ *  @returns
  */
 int do_pwrite(dpeth_t * dep, packet_t *packet, int from_int);
Index: uspace/srv/hw/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision b18753674db821b4aff9829ab475b50332403b40)
+++ uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 39d70ec9205ad8321aa0bad0815cb7db506a880a)
@@ -115,37 +115,23 @@
 static void irq_handler(ipc_callid_t iid, ipc_call_t *call)
 {
+	device_id_t device_id = IRQ_GET_DEVICE(*call);
 	netif_device_t *device;
-	dpeth_t *dep;
-	packet_t *received;
-	device_id_t device_id;
-	int phone;
-	
-	device_id = IRQ_GET_DEVICE(*call);
+	int nil_phone;
+	dpeth_t *dep;
+	
 	fibril_rwlock_write_lock(&netif_globals.lock);
 	
-	if (find_device(device_id, &device) != EOK) {
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return;
-	}
-	
-	dep = (dpeth_t *) device->specific;
-	if (dep->de_mode != DEM_ENABLED) {
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return;
-	}
-	
-	assert(dep->de_flags & DEF_ENABLED);
-	
-	dp_check_ints(dep, IRQ_GET_ISR(*call));
-	
-	if (dep->received_queue) {
-		received = dep->received_queue;
-		phone = device->nil_phone;
-		dep->received_queue = NULL;
-		dep->received_count = 0;
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		nil_received_msg(phone, device_id, received, SERVICE_NONE);
+	if (find_device(device_id, &device) == EOK) {
+		nil_phone = device->nil_phone;
+		dep = (dpeth_t *) device->specific;
 	} else
-		fibril_rwlock_write_unlock(&netif_globals.lock);
+		dep = NULL;
+	
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	
+	if ((dep != NULL) && (dep->de_mode == DEM_ENABLED)) {
+		assert(dep->de_flags & DEF_ENABLED);
+		dp_check_ints(nil_phone, device_id, dep, IRQ_GET_ISR(*call));
+	}
 }
 
