Index: uspace/srv/hw/netif/dp8390/dp8390.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.c	(revision 122b75329f6446a34c17264deda1bbd26ae485b0)
+++ uspace/srv/hw/netif/dp8390/dp8390.c	(revision 40559a967c30f725d9ade5d133fd89412f24e991)
@@ -54,9 +54,8 @@
 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 void dp_pio8_user2nic(dpeth_t *dep, iovec_dat_t *iovp, size_t offset, int nic_addr, size_t count);
-static void dp_pio16_user2nic(dpeth_t *dep, iovec_dat_t *iovp, size_t offset, int nic_addr, size_t count);
-static void dp_pio8_nic2user(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, size_t offset, size_t count);
-static void dp_pio16_nic2user(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, size_t offset, size_t count);
-static void dp_next_iovec(iovec_dat_t *iovp);
+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);
+static void dp_pio8_nic2user(dpeth_t *dep, int nic_addr, void *buf, size_t offset, size_t size);
+static void dp_pio16_nic2user(dpeth_t *dep, int nic_addr, void *buf, size_t offset, size_t size);
 static void conf_hw(dpeth_t *dep);
 static void reply(dpeth_t *dep, int err, int may_block);
@@ -218,9 +217,6 @@
 	}
 */
+	void *buf = packet_get_data(packet);
 	size = packet_get_data_length(packet);
-	dep->de_write_iovec.iod_iovec[0].iov_addr = (void *) packet_get_data(packet);
-	dep->de_write_iovec.iod_iovec[0].iov_size = size;
-	dep->de_write_iovec.iod_iovec_s = 1;
-	dep->de_write_iovec.iod_iovec_addr = NULL;
 	
 	if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) {
@@ -229,5 +225,5 @@
 	}
 	
-	(dep->de_user2nicf)(dep, &dep->de_write_iovec, 0,
+	(dep->de_user2nicf)(dep, buf, 0,
 	    dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE,
 	    size);
@@ -680,8 +676,5 @@
 		return ENOMEM;
 	
-	dep->de_read_iovec.iod_iovec[0].iov_addr = (void *) packet_suffix(packet, length);
-	dep->de_read_iovec.iod_iovec[0].iov_size = length;
-	dep->de_read_iovec.iod_iovec_s = 1;
-	dep->de_read_iovec.iod_iovec_addr = NULL;
+	void *buf = packet_suffix(packet, length);
 	
 	last = page + (length - 1) / DP_PAGESIZE;
@@ -689,13 +682,11 @@
 		count = (dep->de_stoppage - page) * DP_PAGESIZE - sizeof(dp_rcvhdr_t);
 		
-		/* Save read_iovec since we need it twice. */
-		dep->de_tmp_iovec = dep->de_read_iovec;
 		(dep->de_nic2userf)(dep, page * DP_PAGESIZE +
-		    sizeof(dp_rcvhdr_t), &dep->de_tmp_iovec, 0, count);
+		    sizeof(dp_rcvhdr_t), buf, 0, count);
 		(dep->de_nic2userf)(dep, dep->de_startpage * DP_PAGESIZE,
-		    &dep->de_read_iovec, count, length - count);
+		    buf, count, length - count);
 	} else {
 		(dep->de_nic2userf)(dep, page * DP_PAGESIZE +
-		    sizeof(dp_rcvhdr_t), &dep->de_read_iovec, 0, length);
+		    sizeof(dp_rcvhdr_t), buf, 0, length);
 	}
 	
@@ -717,45 +708,17 @@
 }
 
-static void dp_pio8_user2nic(dpeth_t *dep, iovec_dat_t *iovp, size_t offset, int nic_addr, size_t count)
-{
-//	phys_bytes phys_user;
-	int i;
-	size_t bytes;
-	
+static void dp_pio8_user2nic(dpeth_t *dep, void *buf, size_t offset, int nic_addr, size_t size)
+{
 	outb_reg0(dep, DP_ISR, ISR_RDC);
 	
-	outb_reg0(dep, DP_RBCR0, count & 0xFF);
-	outb_reg0(dep, DP_RBCR1, count >> 8);
+	outb_reg0(dep, DP_RBCR0, size & 0xFF);
+	outb_reg0(dep, DP_RBCR1, size >> 8);
 	outb_reg0(dep, DP_RSAR0, nic_addr & 0xFF);
 	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
 	
-	i = 0;
-	while (count > 0) {
-		if (i >= IOVEC_NR) {
-			dp_next_iovec(iovp);
-			i = 0;
-			continue;
-		}
-		
-		assert(i < iovp->iod_iovec_s);
-		
-		if (offset >= iovp->iod_iovec[i].iov_size) {
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-		
-		do_vir_outsb(dep->de_data_port, iovp->iod_iovec[i].iov_addr + offset, bytes);
-		count -= bytes;
-		offset += bytes;
-	}
-	
-	assert(count == 0);
-	
+	outsb(dep->de_data_port, buf + offset, size);
+	
+	unsigned int i;
 	for (i = 0; i < 100; i++) {
 		if (inb_reg0(dep, DP_ISR) & ISR_RDC)
@@ -764,19 +727,14 @@
 	
 	if (i == 100)
-		fprintf(stderr, "dp8390: remote dma failed to complete\n");
-}
-
-static void dp_pio16_user2nic(dpeth_t *dep, iovec_dat_t *iovp, size_t offset, int nic_addr, size_t count)
+		fprintf(stderr, "dp8390: remote DMA failed to complete\n");
+}
+
+static void dp_pio16_user2nic(dpeth_t *dep, void *buf, size_t offset, int nic_addr, size_t size)
 {
 	void *vir_user;
 	size_t ecount;
-	int i;
-	size_t bytes;
-	//uint8_t two_bytes[2];
 	uint16_t two_bytes;
-	int odd_byte;
-	
-	ecount = (count + 1) & ~1;
-	odd_byte = 0;
+	
+	ecount = size & ~1;
 	
 	outb_reg0(dep, DP_ISR, ISR_RDC);
@@ -787,71 +745,22 @@
 	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
 	
-	i = 0;
-	while (count > 0) {
-		if (i >= IOVEC_NR) {
-			dp_next_iovec(iovp);
-			i = 0;
-			continue;
-		}
-		
-		assert(i < iovp->iod_iovec_s);
-		
-		if (offset >= iovp->iod_iovec[i].iov_size) {
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-		
-		vir_user = iovp->iod_iovec[i].iov_addr + offset;
-		
-		if (odd_byte) {
-			memcpy(&(((uint8_t *) &two_bytes)[1]), vir_user, 1);
-			
-			//outw(dep->de_data_port, *(uint16_t *) two_bytes);
-			outw(dep->de_data_port, two_bytes);
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 0;
-			
-			if (!bytes)
-				continue;
-		}
-		
-		ecount= bytes & ~1;
-		if (ecount != 0) {
-			do_vir_outsw(dep->de_data_port, vir_user, ecount);
-			count -= ecount;
-			offset += ecount;
-			bytes -= ecount;
-			vir_user += ecount;
-		}
-		
-		if (bytes) {
-			assert(bytes == 1);
-			
-			memcpy(&(((uint8_t *) &two_bytes)[0]), vir_user, 1);
-			
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 1;
-		}
-	}
-	
-	assert(count == 0);
-	
-	if (odd_byte)
-		//outw(dep->de_data_port, *(uint16_t *) two_bytes);
+	vir_user = buf + offset;
+	if (ecount != 0) {
+		outsw(dep->de_data_port, vir_user, ecount);
+		size -= ecount;
+		offset += ecount;
+		vir_user += ecount;
+	}
+	
+	if (size) {
+		assert(size == 1);
+		
+		memcpy(&(((uint8_t *) &two_bytes)[0]), vir_user, 1);
 		outw(dep->de_data_port, two_bytes);
-	
+	}
+	
+	unsigned int i;
 	for (i = 0; i < 100; i++) {
-		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
+		if (inb_reg0(dep, DP_ISR) & ISR_RDC)
 			break;
 	}
@@ -861,56 +770,22 @@
 }
 
-static void dp_pio8_nic2user(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, size_t offset, size_t count)
-{
-//	phys_bytes phys_user;
-	int i;
-	size_t bytes;
-	
-	outb_reg0(dep, DP_RBCR0, count & 0xFF);
-	outb_reg0(dep, DP_RBCR1, count >> 8);
+static void dp_pio8_nic2user(dpeth_t *dep, int nic_addr, void *buf, size_t offset, size_t size)
+{
+	outb_reg0(dep, DP_RBCR0, size & 0xFF);
+	outb_reg0(dep, DP_RBCR1, size >> 8);
 	outb_reg0(dep, DP_RSAR0, nic_addr & 0xFF);
 	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
 	
-	i = 0;
-	while (count > 0) {
-		if (i >= IOVEC_NR) {
-			dp_next_iovec(iovp);
-			i= 0;
-			continue;
-		}
-		
-		assert(i < iovp->iod_iovec_s);
-		
-		if (offset >= iovp->iod_iovec[i].iov_size) {
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-		
-		do_vir_insb(dep->de_data_port, iovp->iod_iovec[i].iov_addr + offset, bytes);
-		count -= bytes;
-		offset += bytes;
-	}
-	
-	assert(count == 0);
-}
-
-static void dp_pio16_nic2user(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, size_t offset, size_t count)
+	insb(dep->de_data_port, buf + offset, size);
+}
+
+static void dp_pio16_nic2user(dpeth_t *dep, int nic_addr, void *buf, size_t offset, size_t size)
 {
 	void *vir_user;
 	size_t ecount;
-	int i;
-	size_t bytes;
-	//uint8_t two_bytes[2];
 	uint16_t two_bytes;
-	int odd_byte;
-	
-	ecount = (count + 1) & ~1;
-	odd_byte = 0;
+	
+	ecount = size & ~1;
 	
 	outb_reg0(dep, DP_RBCR0, ecount & 0xFF);
@@ -920,82 +795,22 @@
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
 	
-	i = 0;
-	while (count > 0) {
-		if (i >= IOVEC_NR) {
-			dp_next_iovec(iovp);
-			i = 0;
-			continue;
-		}
-		
-		assert(i < iovp->iod_iovec_s);
-		
-		if (offset >= iovp->iod_iovec[i].iov_size) {
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-		
-		vir_user = iovp->iod_iovec[i].iov_addr + offset;
-		
-		if (odd_byte) {
-			memcpy(vir_user, &(((uint8_t *) &two_bytes)[1]), 1);
-			
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 0;
-			
-			if (!bytes)
-				continue;
-		}
-		
-		ecount= bytes & ~1;
-		if (ecount != 0) {
-			do_vir_insw(dep->de_data_port, vir_user, ecount);
-			count -= ecount;
-			offset += ecount;
-			bytes -= ecount;
-			vir_user += ecount;
-		}
-		
-		if (bytes) {
-			assert(bytes == 1);
-			
-			//*(uint16_t *) two_bytes= inw(dep->de_data_port);
-			two_bytes = inw(dep->de_data_port);
-			memcpy(vir_user, &(((uint8_t *) &two_bytes)[0]), 1);
-			
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 1;
-		}
-	}
-	
-	assert(count == 0);
-}
-
-static void dp_next_iovec(iovec_dat_t *iovp)
-{
-	assert(iovp->iod_iovec_s > IOVEC_NR);
-	
-	iovp->iod_iovec_s -= IOVEC_NR;
-	iovp->iod_iovec_addr += IOVEC_NR * sizeof(iovec_t);
-	
-	memcpy(iovp->iod_iovec, iovp->iod_iovec_addr,
-	    (iovp->iod_iovec_s > IOVEC_NR ? IOVEC_NR : iovp->iod_iovec_s) *
-	    sizeof(iovec_t));
+	vir_user = buf + offset;
+	if (ecount != 0) {
+		insw(dep->de_data_port, vir_user, ecount);
+		size -= ecount;
+		offset += ecount;
+		vir_user += ecount;
+	}
+	
+	if (size) {
+		assert(size == 1);
+		
+		two_bytes = inw(dep->de_data_port);
+		memcpy(vir_user, &(((uint8_t *) &two_bytes)[0]), 1);
+	}
 }
 
 static void conf_hw(dpeth_t *dep)
 {
-//	static eth_stat_t empty_stat = {0, 0, 0, 0, 0, 0 	/* ,... */};
-	
 //	int ifnr;
 //	dp_conf_t *dcp;
@@ -1018,5 +833,4 @@
 	dep->de_mode = DEM_ENABLED;
 	dep->de_flags = DEF_EMPTY;
-//	dep->de_stat = empty_stat;
 }
 
Index: uspace/srv/hw/netif/dp8390/dp8390.h
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.h	(revision 122b75329f6446a34c17264deda1bbd26ae485b0)
+++ uspace/srv/hw/netif/dp8390/dp8390.h	(revision 40559a967c30f725d9ade5d133fd89412f24e991)
@@ -189,5 +189,5 @@
  *  @returns The read value.
  */
-#define inb_reg0(dep, reg)  (inb(dep->de_dp8390_port+reg))
+#define inb_reg0(dep, reg)  (inb(dep->de_dp8390_port + reg))
 
 /** Writes 1 byte zero page register.
@@ -196,5 +196,5 @@
  *  @param[in] data The value to be written.
  */
-#define outb_reg0(dep, reg, data)  (outb(dep->de_dp8390_port+reg, data))
+#define outb_reg0(dep, reg, data)  (outb(dep->de_dp8390_port + reg, data))
 
 /** Reads 1 byte from the first page register.
@@ -203,5 +203,5 @@
  *  @returns The read value.
  */
-#define inb_reg1(dep, reg)  (inb(dep->de_dp8390_port+reg))
+#define inb_reg1(dep, reg)  (inb(dep->de_dp8390_port + reg))
 
 /** Writes 1 byte first page register.
@@ -210,24 +210,15 @@
  *  @param[in] data The value to be written.
  */
-#define outb_reg1(dep, reg, data)  (outb(dep->de_dp8390_port+reg, data))
+#define outb_reg1(dep, reg, data)  (outb(dep->de_dp8390_port + reg, data))
 
 /* Software interface to the dp8390 driver */
 
 struct dpeth;
-struct iovec_dat;
 
 typedef void (*dp_initf_t)(struct dpeth *dep);
 typedef void (*dp_stopf_t)(struct dpeth *dep);
-typedef void (*dp_user2nicf_t)(struct dpeth *dep, struct iovec_dat *iovp, size_t offset, int nic_addr, size_t count);
-typedef void (*dp_nic2userf_t)(struct dpeth *dep, int nic_addr, struct iovec_dat *iovp, size_t offset, size_t count);
+typedef void (*dp_user2nicf_t)(struct dpeth *dep, void *buf, size_t offset, int nic_addr, size_t size);
+typedef void (*dp_nic2userf_t)(struct dpeth *dep, int nic_addr, void *buf, size_t offset, size_t size);
 typedef void (*dp_getblock_t)(struct dpeth *dep, int page, size_t offset, size_t size, void *dst);
-
-#define IOVEC_NR  1
-
-typedef struct iovec_dat {
-  iovec_t iod_iovec[IOVEC_NR];
-  int iod_iovec_s;
-  void *iod_iovec_addr;
-} iovec_dat_t;
 
 #define SENDQ_NR     1  /* Maximum size of the send queue */
@@ -295,7 +286,4 @@
 	int de_mode;
 	eth_stat_t de_stat;
-	iovec_dat_t de_read_iovec;
-	iovec_dat_t de_write_iovec;
-	iovec_dat_t de_tmp_iovec;
 	size_t de_read_s;
 //	int de_client;
Index: uspace/srv/hw/netif/dp8390/dp8390_port.h
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_port.h	(revision 122b75329f6446a34c17264deda1bbd26ae485b0)
+++ uspace/srv/hw/netif/dp8390/dp8390_port.h	(revision 40559a967c30f725d9ade5d133fd89412f24e991)
@@ -78,32 +78,4 @@
 #define outw(port, value)  pio_write_16((ioport16_t *) (port), (value))
 
-/** Reads a memory block byte by byte.
- *  @param[in] port The address to be written.
- *  @param[in] dst The destination address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_insb(port, dst, bytes)  insb((port), (void *)(dst), (bytes))
-
-/** Reads a memory block word by word (2 bytes).
- *  @param[in] port The address to be written.
- *  @param[in] dst The destination address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_insw(port, dst, bytes)  insw((port), (void *)(dst), (bytes))
-
-/** Writes a memory block byte by byte.
- *  @param[in] port The address to be written.
- *  @param[in] src The source address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_outsb(port, src, bytes)  outsb((port), (void *)(src), (bytes))
-
-/** Writes a memory block word by word (2 bytes).
- *  @param[in] port The address to be written.
- *  @param[in] src The source address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_outsw(port, src, bytes)  outsw((port), (void *)(src), (bytes))
-
 /* Bits in 'DL_MODE' field of DL requests. */
 #define DL_NOMODE       0x0
@@ -169,5 +141,4 @@
 } eth_stat_t;
 
-/* ether.h */
 /** Minimum Ethernet packet size in bytes.
  */
@@ -186,16 +157,4 @@
 } ether_addr_t;
 
-/** Type definition of the input/output vector.
- */
-typedef struct {
-	/** Address of an I/O buffer.
-	 */
-	void *iov_addr;
-	
-	/** Size of an I/O buffer.
-	 */
-	size_t iov_size;
-} iovec_t;
-
 #endif
 
