Index: uspace/drv/nic/e1k/e1k.c
===================================================================
--- uspace/drv/nic/e1k/e1k.c	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/e1k/e1k.c	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -52,7 +52,4 @@
 #include <nil_remote.h>
 #include <ops/nic.h>
-#include <packet_client.h>
-#include <packet_remote.h>
-#include <net/packet_header.h>
 #include "e1k.h"
 
@@ -62,13 +59,13 @@
 
 /* Must be power of 8 */
-#define E1000_RX_PACKETS_COUNT  128
-#define E1000_TX_PACKETS_COUNT  128
+#define E1000_RX_FRAME_COUNT  128
+#define E1000_TX_FRAME_COUNT  128
 
 #define E1000_RECEIVE_ADDRESS  16
 
-/** Maximum sending packet size */
+/** Maximum sending frame size */
 #define E1000_MAX_SEND_FRAME_SIZE  2048
-/** Maximum receiving packet size */
-#define E1000_MAX_RECEIVE_PACKET_SIZE  2048
+/** Maximum receiving frame size */
+#define E1000_MAX_RECEIVE_FRAME_SIZE  2048
 
 /** nic_driver_data_t* -> e1000_t* cast */
@@ -137,11 +134,13 @@
 	void *rx_ring_virt;
 	
-	/** Packets in rx ring  */
-	packet_t **rx_ring_packets;
+	/** Ring of RX frames, physical address */
+	void **rx_frame_phys;
+	/** Ring of RX frames, virtual address */
+	void **rx_frame_virt;
 	
 	/** VLAN tag */
 	uint16_t vlan_tag;
 	
-	/** Add VLAN tag to packet */
+	/** Add VLAN tag to frame */
 	bool vlan_tag_add;
 	
@@ -488,5 +487,5 @@
 }
 
-/** Get state of acceptance of weird packets
+/** Get state of acceptance of weird frames
  *
  * @param      device Device to check
@@ -506,5 +505,5 @@
 };
 
-/** Set acceptance of weird packets
+/** Set acceptance of weird frames
  *
  * @param device Device to update
@@ -690,5 +689,5 @@
 }
 
-/** Disable receiving packets for default address
+/** Disable receiving frames for default address
  *
  * @param e1000 E1000 data structure
@@ -702,5 +701,5 @@
 }
 
-/** Enable receiving packets for default address
+/** Enable receiving frames for default address
  *
  * @param e1000 E1000 data structure
@@ -762,5 +761,5 @@
 }
 
-/** Enable accepting of broadcast packets
+/** Enable accepting of broadcast frames
  *
  * @param e1000 E1000 data structure
@@ -774,5 +773,5 @@
 }
 
-/** Disable accepting of broadcast packets
+/** Disable accepting of broadcast frames
  *
  * @param e1000 E1000 data structure
@@ -810,5 +809,5 @@
 }
 
-/** Set multicast packets acceptance mode
+/** Set multicast frames acceptance mode
  *
  * @param nic      NIC device to update
@@ -864,5 +863,5 @@
 }
 
-/** Set unicast packets acceptance mode
+/** Set unicast frames acceptance mode
  *
  * @param nic      NIC device to update
@@ -922,5 +921,5 @@
 }
 
-/** Set broadcast packets acceptance mode
+/** Set broadcast frames acceptance mode
  *
  * @param nic  NIC device to update
@@ -1007,5 +1006,5 @@
 	if (vlan_mask) {
 		/*
-		 * Disable receiving, so that packet matching
+		 * Disable receiving, so that frame matching
 		 * partially written VLAN is not received.
 		 */
@@ -1074,7 +1073,7 @@
 }
 
-/** Fill receive descriptor with new empty packet
- *
- * Store packet in e1000->rx_ring_packets
+/** Fill receive descriptor with new empty buffer
+ *
+ * Store frame in e1000->rx_frame_phys
  *
  * @param nic    NIC data stricture
@@ -1085,22 +1084,9 @@
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	packet_t *packet =
-	    nic_alloc_packet(nic, E1000_MAX_RECEIVE_PACKET_SIZE);
-	
-	assert(packet);
-	
-	*(e1000->rx_ring_packets + offset) = packet;
+	
 	e1000_rx_descriptor_t *rx_descriptor = (e1000_rx_descriptor_t *)
 	    (e1000->rx_ring_virt + offset * sizeof(e1000_rx_descriptor_t));
 	
-	void *phys;
-	int rc =
-	    nic_dma_lock_packet(packet, E1000_MAX_RECEIVE_PACKET_SIZE, &phys);
-	
-	if (rc == EOK)
-		rx_descriptor->phys_addr = PTR_TO_U64(phys + packet->data_start);
-	else
-		rx_descriptor->phys_addr = 0;
-	
+	rx_descriptor->phys_addr = PTR_TO_U64(e1000->rx_frame_phys[offset]);
 	rx_descriptor->length = 0;
 	rx_descriptor->checksum = 0;
@@ -1166,10 +1152,10 @@
 }
 
-/** Receive packets
+/** Receive frames
  *
  * @param nic NIC data
  *
  */
-static void e1000_receive_packets(nic_t *nic)
+static void e1000_receive_frames(nic_t *nic)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
@@ -1178,5 +1164,5 @@
 	
 	uint32_t *tail_addr = E1000_REG_ADDR(e1000, E1000_RDT);
-	uint32_t next_tail = e1000_inc_tail(*tail_addr, E1000_RX_PACKETS_COUNT);
+	uint32_t next_tail = e1000_inc_tail(*tail_addr, E1000_RX_FRAME_COUNT);
 	
 	e1000_rx_descriptor_t *rx_descriptor = (e1000_rx_descriptor_t *)
@@ -1184,16 +1170,18 @@
 	
 	while (rx_descriptor->status & 0x01) {
-		uint32_t packet_size = rx_descriptor->length - E1000_CRC_SIZE;
+		uint32_t frame_size = rx_descriptor->length - E1000_CRC_SIZE;
 		
-		packet_t *packet = *(e1000->rx_ring_packets + next_tail);
-		packet_suffix(packet, packet_size);
-		
-		nic_dma_unlock_packet(packet, E1000_MAX_RECEIVE_PACKET_SIZE);
-		nic_received_packet(nic, packet);
+		nic_frame_t *frame = nic_alloc_frame(nic, frame_size);
+		if (frame != NULL) {
+			memcpy(frame->data, e1000->rx_frame_virt[next_tail], frame_size);
+			nic_received_frame(nic, frame);
+		} else {
+			ddf_msg(LVL_ERROR, "Memory allocation failed. Frame dropped.");
+		}
 		
 		e1000_fill_new_rx_descriptor(nic, next_tail);
 		
-		*tail_addr = e1000_inc_tail(*tail_addr, E1000_RX_PACKETS_COUNT);
-		next_tail = e1000_inc_tail(*tail_addr, E1000_RX_PACKETS_COUNT);
+		*tail_addr = e1000_inc_tail(*tail_addr, E1000_RX_FRAME_COUNT);
+		next_tail = e1000_inc_tail(*tail_addr, E1000_RX_FRAME_COUNT);
 		
 		rx_descriptor = (e1000_rx_descriptor_t *)
@@ -1236,5 +1224,5 @@
 {
 	if (icr & ICR_RXT0)
-		e1000_receive_packets(nic);
+		e1000_receive_frames(nic);
 }
 
@@ -1286,5 +1274,5 @@
 }
 
-/** Force receiving all packets in the receive buffer
+/** Force receiving all frames in the receive buffer
  *
  * @param nic NIC data
@@ -1359,9 +1347,9 @@
 static void e1000_initialize_rx_registers(e1000_t *e1000)
 {
-	E1000_REG_WRITE(e1000, E1000_RDLEN, E1000_RX_PACKETS_COUNT * 16);
+	E1000_REG_WRITE(e1000, E1000_RDLEN, E1000_RX_FRAME_COUNT * 16);
 	E1000_REG_WRITE(e1000, E1000_RDH, 0);
 	
 	/* It is not posible to let HW use all descriptors */
-	E1000_REG_WRITE(e1000, E1000_RDT, E1000_RX_PACKETS_COUNT - 1);
+	E1000_REG_WRITE(e1000, E1000_RDT, E1000_RX_FRAME_COUNT - 1);
 	
 	/* Set Broadcast Enable Bit */
@@ -1383,5 +1371,5 @@
 	
 	int rc = dmamem_map_anonymous(
-	    E1000_RX_PACKETS_COUNT * sizeof(e1000_rx_descriptor_t),
+	    E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t),
 	    AS_AREA_READ | AS_AREA_WRITE, 0, &e1000->rx_ring_phys,
 	    &e1000->rx_ring_virt);
@@ -1394,52 +1382,92 @@
 	    (uint32_t) PTR_TO_U64(e1000->rx_ring_phys));
 	
-	e1000->rx_ring_packets =
-	    malloc(E1000_RX_PACKETS_COUNT * sizeof(packet_t *));
-	// FIXME: Check return value
-	
+	e1000->rx_frame_phys =
+	    calloc(E1000_RX_FRAME_COUNT, sizeof(void *));
+	e1000->rx_frame_virt =
+	    calloc(E1000_RX_FRAME_COUNT, sizeof(void *));
+	if (e1000->rx_frame_phys == NULL || e1000->rx_frame_virt == NULL) {
+		rc = ENOMEM;
+		goto error;
+	}
+	
+	size_t i;
+	void *frame_virt;
+	void *frame_phys;
+	
+	for (i = 0; i < E1000_RX_FRAME_COUNT; i++) {
+		rc = dmamem_map_anonymous(
+		    E1000_MAX_SEND_FRAME_SIZE, AS_AREA_READ | AS_AREA_WRITE,
+		    0, &frame_phys, &frame_virt);
+		if (rc != EOK)
+			goto error;
+		
+		e1000->rx_frame_virt[i] = frame_virt;
+		e1000->rx_frame_phys[i] = frame_phys;
+	}
+	
+	/* Write descriptor */
+	for (i = 0; i < E1000_RX_FRAME_COUNT; i++)
+		e1000_fill_new_rx_descriptor(nic, i);
+	
+	e1000_initialize_rx_registers(e1000);
+	
+	fibril_mutex_unlock(&e1000->rx_lock);
+	return EOK;
+	
+error:
+	for (i = 0; i < E1000_RX_FRAME_COUNT; i++) {
+		if (e1000->rx_frame_virt[i] != NULL) {
+			dmamem_unmap_anonymous(e1000->rx_frame_virt[i]);
+			e1000->rx_frame_virt[i] = NULL;
+			e1000->rx_frame_phys[i] = NULL;
+		}
+	}
+	
+	if (e1000->rx_frame_phys != NULL) {
+		free(e1000->rx_frame_phys);
+		e1000->rx_frame_phys = NULL;
+	}
+	
+	if (e1000->rx_frame_virt != NULL) {
+		free(e1000->rx_frame_virt);
+		e1000->rx_frame_phys = NULL;
+	}
+	
+	return rc;
+}
+
+/** Uninitialize receive structure
+ *
+ * @param nic NIC data
+ *
+ */
+static void e1000_uninitialize_rx_structure(nic_t *nic)
+{
+	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
+	
+	/* Write descriptor */
+	for (unsigned int offset = 0; offset < E1000_RX_FRAME_COUNT; offset++) {
+		dmamem_unmap_anonymous(e1000->rx_frame_virt[offset]);
+		e1000->rx_frame_virt[offset] = NULL;
+		e1000->rx_frame_phys[offset] = NULL;
+	}
+	
+	free(e1000->rx_frame_virt);
+	free(e1000->rx_frame_phys);
+	e1000->rx_frame_virt = NULL;
+	e1000->rx_frame_phys = NULL;
+	dmamem_unmap_anonymous(e1000->rx_ring_virt);
+}
+
+/** Clear receive descriptor ring
+ *
+ * @param e1000 E1000 data
+ *
+ */
+static void e1000_clear_rx_ring(e1000_t *e1000)
+{
 	/* Write descriptor */
 	for (unsigned int offset = 0;
-	    offset < E1000_RX_PACKETS_COUNT;
-	    offset++)
-		e1000_fill_new_rx_descriptor(nic, offset);
-	
-	e1000_initialize_rx_registers(e1000);
-	
-	fibril_mutex_unlock(&e1000->rx_lock);
-	return EOK;
-}
-
-/** Uninitialize receive structure
- *
- * @param nic NIC data
- *
- */
-static void e1000_uninitialize_rx_structure(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	
-	/* Write descriptor */
-	for (unsigned int offset = 0;
-	    offset < E1000_RX_PACKETS_COUNT;
-	    offset++) {
-		packet_t *packet = *(e1000->rx_ring_packets + offset);
-		nic_dma_unlock_packet(packet, E1000_MAX_RECEIVE_PACKET_SIZE);
-		nic_release_packet(nic, packet);
-	}
-	
-	free(e1000->rx_ring_packets);
-	dmamem_unmap_anonymous(e1000->rx_ring_virt);
-}
-
-/** Clear receive descriptor ring
- *
- * @param e1000 E1000 data
- *
- */
-static void e1000_clear_rx_ring(e1000_t *e1000)
-{
-	/* Write descriptor */
-	for (unsigned int offset = 0;
-	    offset < E1000_RX_PACKETS_COUNT;
+	    offset < E1000_RX_FRAME_COUNT;
 	    offset++)
 		e1000_clear_rx_descriptor(e1000, offset);
@@ -1510,5 +1538,5 @@
 static void e1000_initialize_tx_registers(e1000_t *e1000)
 {
-	E1000_REG_WRITE(e1000, E1000_TDLEN, E1000_TX_PACKETS_COUNT * 16);
+	E1000_REG_WRITE(e1000, E1000_TDLEN, E1000_TX_FRAME_COUNT * 16);
 	E1000_REG_WRITE(e1000, E1000_TDH, 0);
 	E1000_REG_WRITE(e1000, E1000_TDT, 0);
@@ -1542,5 +1570,5 @@
 	
 	int rc = dmamem_map_anonymous(
-	    E1000_TX_PACKETS_COUNT * sizeof(e1000_tx_descriptor_t),
+	    E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t),
 	    AS_AREA_READ | AS_AREA_WRITE, 0, &e1000->tx_ring_phys,
 	    &e1000->tx_ring_virt);
@@ -1549,8 +1577,8 @@
 	
 	bzero(e1000->tx_ring_virt,
-	    E1000_TX_PACKETS_COUNT * sizeof(e1000_tx_descriptor_t));
-	
-	e1000->tx_frame_phys = calloc(E1000_TX_PACKETS_COUNT, sizeof(void *));
-	e1000->tx_frame_virt = calloc(E1000_TX_PACKETS_COUNT, sizeof(void *));
+	    E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t));
+	
+	e1000->tx_frame_phys = calloc(E1000_TX_FRAME_COUNT, sizeof(void *));
+	e1000->tx_frame_virt = calloc(E1000_TX_FRAME_COUNT, sizeof(void *));
 
 	if (e1000->tx_frame_phys == NULL || e1000->tx_frame_virt == NULL) {
@@ -1559,5 +1587,5 @@
 	}
 	
-	for (i = 0; i < E1000_TX_PACKETS_COUNT; i++) {
+	for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
 		rc = dmamem_map_anonymous(
 		    E1000_MAX_SEND_FRAME_SIZE, AS_AREA_READ | AS_AREA_WRITE,
@@ -1584,5 +1612,5 @@
 	
 	if (e1000->tx_frame_phys != NULL && e1000->tx_frame_virt != NULL) {
-		for (i = 0; i < E1000_TX_PACKETS_COUNT; i++) {
+		for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
 			if (e1000->tx_frame_virt[i] != NULL) {
 				dmamem_unmap_anonymous(e1000->tx_frame_virt[i]);
@@ -1615,5 +1643,5 @@
 	size_t i;
 	
-	for (i = 0; i < E1000_TX_PACKETS_COUNT; i++) {
+	for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
 		dmamem_unmap_anonymous(e1000->tx_frame_virt[i]);
 		e1000->tx_frame_virt[i] = NULL;
@@ -1630,4 +1658,5 @@
 		e1000->tx_frame_phys = NULL;
 	}
+	
 	dmamem_unmap_anonymous(e1000->tx_ring_virt);
 }
@@ -1642,5 +1671,5 @@
 	/* Write descriptor */
 	for (unsigned int offset = 0;
-	    offset < E1000_TX_PACKETS_COUNT;
+	    offset < E1000_TX_FRAME_COUNT;
 	    offset++)
 		e1000_clear_tx_descriptor(nic, offset);
@@ -1699,5 +1728,5 @@
 }
 
-/** Activate the device to receive and transmit packets
+/** Activate the device to receive and transmit frames
  *
  * @param nic NIC driver data
@@ -2040,5 +2069,4 @@
 	case E1000_82545:
 	case E1000_82546:
-	case E1000_82572:
 		e1000->info.eerd_start = 0x01;
 		e1000->info.eerd_done = 0x10;
@@ -2047,4 +2075,5 @@
 		break;
 	case E1000_82547:
+	case E1000_82572:
 	case E1000_80003ES2:
 		e1000->info.eerd_start = 0x01;
@@ -2085,4 +2114,5 @@
 int e1000_dev_add(ddf_dev_t *dev)
 {
+	ddf_fun_t *fun;
 	assert(dev);
 	
@@ -2115,11 +2145,14 @@
 	e1000_initialize_vlan(e1000);
 	
-	rc = nic_register_as_ddf_fun(nic, &e1000_dev_ops);
-	if (rc != EOK)
+	fun = ddf_fun_create(nic_get_ddf_dev(nic), fun_exposed, "port0");
+	if (fun == NULL)
 		goto err_tx_structure;
+	nic_set_ddf_fun(nic, fun);
+	fun->ops = &e1000_dev_ops;
+	fun->driver_data = nic;
 	
 	rc = e1000_register_int_handler(nic);
 	if (rc != EOK)
-		goto err_tx_structure;
+		goto err_fun_create;
 	
 	rc = nic_connect_to_services(nic);
@@ -2144,10 +2177,24 @@
 		goto err_rx_structure;
 	
+	rc = ddf_fun_bind(fun);
+	if (rc != EOK)
+		goto err_fun_bind;
+	
+	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
+	if (rc != EOK)
+		goto err_add_to_cat;
+	
 	return EOK;
 	
+err_add_to_cat:
+	ddf_fun_unbind(fun);
+err_fun_bind:
 err_rx_structure:
 	e1000_uninitialize_rx_structure(nic);
 err_irq:
 	unregister_interrupt_handler(dev, DRIVER_DATA_DEV(dev)->irq);
+err_fun_create:
+	ddf_fun_destroy(fun);
+	nic_set_ddf_fun(nic, NULL);
 err_tx_structure:
 	e1000_uninitialize_tx_structure(e1000);
@@ -2295,5 +2342,5 @@
 	
 	if (!descriptor_available) {
-		/* Packet lost */
+		/* Frame lost */
 		fibril_mutex_unlock(&e1000->tx_lock);
 		return;
@@ -2324,5 +2371,5 @@
 	
 	tdt++;
-	if (tdt == E1000_TX_PACKETS_COUNT)
+	if (tdt == E1000_TX_FRAME_COUNT)
 		tdt = 0;
 	
Index: uspace/drv/nic/e1k/e1k.h
===================================================================
--- uspace/drv/nic/e1k/e1k.h	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/e1k/e1k.h	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -39,5 +39,5 @@
 #include <stdint.h>
 
-/** Ethernet CRC size after packet received in rx_descriptor */
+/** Ethernet CRC size after frame received in rx_descriptor */
 #define E1000_CRC_SIZE  4
 
@@ -109,5 +109,5 @@
 /** Transmit descriptor COMMAND field bits */
 typedef enum {
-	TXDESCRIPTOR_COMMAND_VLE = (1 << 6),   /**< VLAN Packet Enable */
+	TXDESCRIPTOR_COMMAND_VLE = (1 << 6),   /**< VLAN frame Enable */
 	TXDESCRIPTOR_COMMAND_RS = (1 << 3),    /**< Report Status */
 	TXDESCRIPTOR_COMMAND_IFCS = (1 << 1),  /**< Insert FCS */
Index: uspace/drv/nic/lo/lo.c
===================================================================
--- uspace/drv/nic/lo/lo.c	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/lo/lo.c	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -42,5 +42,4 @@
 #include <async.h>
 #include <nic.h>
-#include <packet_client.h>
 
 #define NAME  "lo"
@@ -61,17 +60,6 @@
 static void lo_send_frame(nic_t *nic_data, void *data, size_t size)
 {
-	packet_t *packet;
-	int rc;
-
-	packet = nic_alloc_packet(nic_data, size);
-	if (packet == NULL)
-		return;
-
-	rc = packet_copy_data(packet, data, size);
-	if (rc != EOK)
-		return;
-
 	nic_report_send_ok(nic_data, 1, size);
-	nic_received_noneth_packet(nic_data, packet);
+	nic_received_noneth_frame(nic_data, data, size);
 }
 
@@ -92,36 +80,61 @@
 static int lo_dev_add(ddf_dev_t *dev)
 {
-	nic_t *nic_data = nic_create_and_bind(dev);
-	if (nic_data == NULL) {
+	ddf_fun_t *fun = NULL;
+	bool bound = false;
+	
+	nic_t *nic = nic_create_and_bind(dev);
+	if (nic == NULL) {
 		printf("%s: Failed to initialize\n", NAME);
 		return ENOMEM;
 	}
 	
-	dev->driver_data = nic_data;
-	nic_set_send_frame_handler(nic_data, lo_send_frame);
+	dev->driver_data = nic;
+	nic_set_send_frame_handler(nic, lo_send_frame);
 	
-	int rc = nic_connect_to_services(nic_data);
+	int rc = nic_connect_to_services(nic);
 	if (rc != EOK) {
 		printf("%s: Failed to connect to services\n", NAME);
-		nic_unbind_and_destroy(dev);
-		return rc;
+		goto error;
 	}
 	
-	rc = nic_register_as_ddf_fun(nic_data, &lo_dev_ops);
+	fun = ddf_fun_create(nic_get_ddf_dev(nic), fun_exposed, "port0");
+	if (fun == NULL) {
+		printf("%s: Failed creating function\n", NAME);
+		rc = ENOMEM;
+		goto error;
+	}
+	nic_set_ddf_fun(nic, fun);
+	fun->ops = &lo_dev_ops;
+	fun->driver_data = nic;
+	
+	rc = nic_report_address(nic, &lo_addr);
 	if (rc != EOK) {
-		printf("%s: Failed to register as DDF function\n", NAME);
-		nic_unbind_and_destroy(dev);
-		return rc;
+		printf("%s: Failed to setup loopback address\n", NAME);
+		goto error;
 	}
 	
-	rc = nic_report_address(nic_data, &lo_addr);
+	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		printf("%s: Failed to setup loopback address\n", NAME);
-		nic_unbind_and_destroy(dev);
-		return rc;
+		printf("%s: Failed binding function\n", NAME);
+		goto error;
 	}
+	bound = true;
+	
+	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
+	if (rc != EOK)
+		goto error;
 	
 	printf("%s: Adding loopback device '%s'\n", NAME, dev->name);
 	return EOK;
+	
+error:
+	if (bound)
+		ddf_fun_unbind(fun);
+	
+	if (fun != NULL)
+		ddf_fun_destroy(fun);
+	
+	nic_unbind_and_destroy(dev);
+	return rc;
 }
 
Index: uspace/drv/nic/ne2k/dp8390.c
===================================================================
--- uspace/drv/nic/ne2k/dp8390.c	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/ne2k/dp8390.c	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -59,6 +59,4 @@
 #include <stdio.h>
 #include <libarch/ddi.h>
-#include <net/packet.h>
-#include <packet_client.h>
 #include "dp8390.h"
 
@@ -76,5 +74,5 @@
 	uint8_t status;
 	
-	/** Pointer to next packet */
+	/** Pointer to next frame */
 	uint8_t next;
 	
@@ -393,6 +391,6 @@
 	/*
 	 * Reset the transmit ring. If we were transmitting a frame,
-	 * we pretend that the packet is processed. Higher layers will
-	 * retransmit if the packet wasn't actually sent.
+	 * we pretend that the frame is processed. Higher layers will
+	 * retransmit if the frame wasn't actually sent.
 	 */
 	ne2k->sq.dirty = false;
@@ -448,6 +446,5 @@
 		return NULL;
 	
-	void *buf = packet_suffix(frame->packet, length);
-	bzero(buf, length);
+	bzero(frame->data, length);
 	uint8_t last = page + length / DP_PAGE;
 	
@@ -455,10 +452,10 @@
 		size_t left = (ne2k->stop_page - page) * DP_PAGE
 		    - sizeof(recv_header_t);
-		ne2k_download(ne2k, buf, page * DP_PAGE + sizeof(recv_header_t),
+		ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t),
 		    left);
-		ne2k_download(ne2k, buf + left, ne2k->start_page * DP_PAGE,
+		ne2k_download(ne2k, frame->data + left, ne2k->start_page * DP_PAGE,
 		    length - left);
 	} else {
-		ne2k_download(ne2k, buf, page * DP_PAGE + sizeof(recv_header_t),
+		ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t),
 		    length);
 	}
@@ -541,5 +538,5 @@
 		 * Update the boundary pointer
 		 * to the value of the page
-		 * prior to the next packet to
+		 * prior to the next frame to
 		 * be processed.
 		 */
@@ -584,5 +581,5 @@
 		fibril_mutex_lock(&ne2k->sq_mutex);
 		if (ne2k->sq.dirty) {
-			/* Prepare the buffer for next packet */
+			/* Prepare the buffer for next frame */
 			ne2k->sq.dirty = false;
 			ne2k->sq.size = 0;
Index: uspace/drv/nic/ne2k/dp8390.h
===================================================================
--- uspace/drv/nic/ne2k/dp8390.h	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/ne2k/dp8390.h	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -264,5 +264,4 @@
 extern void ne2k_send(nic_t *, void *, size_t);
 extern void ne2k_interrupt(nic_t *, uint8_t, uint8_t);
-extern packet_t *ne2k_alloc_packet(nic_t *, size_t);
 
 extern void ne2k_set_accept_mcast(ne2k_t *, int);
Index: uspace/drv/nic/ne2k/ne2k.c
===================================================================
--- uspace/drv/nic/ne2k/ne2k.c	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/ne2k/ne2k.c	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -286,5 +286,5 @@
 	/* Note: some frame with previous physical address may slip to NIL here
 	 * (for a moment the filtering is not exact), but ethernet should be OK with
-	 * that. Some packet may also be lost, but this is not a problem.
+	 * that. Some frames may also be lost, but this is not a problem.
 	 */
 	ne2k_set_physical_address((ne2k_t *) nic_get_specific(nic_data), address);
@@ -363,4 +363,6 @@
 static int ne2k_dev_add(ddf_dev_t *dev)
 {
+	ddf_fun_t *fun;
+	
 	/* Allocate driver data for the device. */
 	nic_t *nic_data = nic_create_and_bind(dev);
@@ -396,5 +398,5 @@
 	}
 	
-	rc = nic_register_as_ddf_fun(nic_data, &ne2k_dev_ops);
+	rc = nic_connect_to_services(nic_data);
 	if (rc != EOK) {
 		ne2k_dev_cleanup(dev);
@@ -402,7 +404,24 @@
 	}
 	
-	rc = nic_connect_to_services(nic_data);
-	if (rc != EOK) {
+	fun = ddf_fun_create(nic_get_ddf_dev(nic_data), fun_exposed, "port0");
+	if (fun == NULL) {
 		ne2k_dev_cleanup(dev);
+		return ENOMEM;
+	}
+	nic_set_ddf_fun(nic_data, fun);
+	fun->ops = &ne2k_dev_ops;
+	fun->driver_data = nic_data;
+	
+	rc = ddf_fun_bind(fun);
+	if (rc != EOK) {
+		ddf_fun_destroy(fun);
+		ne2k_dev_cleanup(dev);
+		return rc;
+	}
+	
+	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
+	if (rc != EOK) {
+		ddf_fun_unbind(fun);
+		ddf_fun_destroy(fun);
 		return rc;
 	}
Index: uspace/drv/nic/rtl8139/defs.h
===================================================================
--- uspace/drv/nic/rtl8139/defs.h	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/rtl8139/defs.h	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -29,29 +29,33 @@
 /** @file rtl8139_defs.h
  *
- *  Registers, bit positions and masks definition of the RTL8139 network family 
- *  cards
- */
-
-#ifndef RTL8139_DEFS_H_INCLUDED_
-#define RTL8139_DEFS_H_INCLUDED_
+ * Registers, bit positions and masks definition
+ * of the RTL8139 network family cards
+ */
+
+#ifndef RTL8139_DEFS_H_
+#define RTL8139_DEFS_H_
+
 #include <sys/types.h>
 #include <libarch/ddi.h>
 
-
-/** The size of RTL8139 registers address space */
-#define RTL8139_IO_SIZE 256
-
-/** The maximal transmitted packet length in bytes allowed according to RTL8139
- *  documentation (see SIZE part of TSD documentation)
- */
-#define RTL8139_PACKET_MAX_LENGTH 1792
-
+/** Size of RTL8139 registers address space */
+#define RTL8139_IO_SIZE  256
+
+/** Maximal transmitted frame length
+ *
+ * Maximal transmitted frame length in bytes
+ * allowed according to the RTL8139 documentation
+ * (see SIZE part of TSD documentation).
+ *
+ */
+#define RTL8139_FRAME_MAX_LENGTH  1792
 
 /** HW version
  *
- *  as can be detected from HWVERID part of TCR
- *  (Transmit Configuration Register)
- */
-enum rtl8139_version_id {
+ * As can be detected from HWVERID part of TCR
+ * (Transmit Configuration Register).
+ *
+ */
+typedef enum {
 	RTL8139 = 0,          /**< RTL8139 */
 	RTL8139A,             /**< RTL8139A */
@@ -66,7 +70,5 @@
 	RTL8101,              /**< RTL8101 */
 	RTL8139_VER_COUNT     /**< Count of known RTL versions, the last value */
-};
-
-extern const char* model_names[RTL8139_VER_COUNT];
+} rtl8139_version_id_t;
 
 /** Registers of RTL8139 family card offsets from the memory address base */
@@ -75,5 +77,5 @@
 	MAC0  = IDR0,    /**< Alias for IDR0 */
 
-	// 0x6 - 0x7 reserved
+	// 0x06 - 0x07 reserved
 
 	MAR0    = 0x08,  /**< Multicast mask registers 8 1b registers sequence */
@@ -94,5 +96,5 @@
 
 	CR      = 0x37,  /**< Command register, 1b */
-	CAPR    = 0x38,  /**< Current address of packet read, 2b */
+	CAPR    = 0x38,  /**< Current address of frame read, 2b */
 	CBA     = 0x3a,  /**< Current buffer address, 2b */
 
@@ -213,4 +215,5 @@
 	pio_write_8(io_base + CR9346, RTL8139_REGS_LOCKED);
 }
+
 /** Allow to change Config0-4 and BMCR register  */
 static inline void rtl8139_regs_unlock(void *io_base)
@@ -282,5 +285,5 @@
 	RCR_MulERINT = 1 << 17,    /**< Multiple early interrupt select */
 
-	/** Minimal error packet length (1 = 8B, 0 = 64B). If AER/AR is set, RER8
+	/** Minimal error frame length (1 = 8B, 0 = 64B). If AER/AR is set, RER8
 	 * is "Don't care"
 	 */
@@ -302,10 +305,10 @@
 
 	RCR_WRAP              = 1 << 7,  /**< Rx buffer wrapped */
-	RCR_ACCEPT_ERROR      = 1 << 5,  /**< Accept error packet */
-	RCR_ACCEPT_RUNT       = 1 << 4,  /**< Accept Runt (8-64 bytes) packets */
+	RCR_ACCEPT_ERROR      = 1 << 5,  /**< Accept error frame */
+	RCR_ACCEPT_RUNT       = 1 << 4,  /**< Accept Runt (8-64 bytes) frames */
 	RCR_ACCEPT_BROADCAST  = 1 << 3,  /**< Accept broadcast */
 	RCR_ACCEPT_MULTICAST  = 1 << 2,  /**< Accept multicast */
 	RCR_ACCEPT_PHYS_MATCH = 1 << 1,  /**< Accept device MAC address match */
-	RCR_ACCEPT_ALL_PHYS   = 1 << 0,  /**< Accept all packets with 
+	RCR_ACCEPT_ALL_PHYS   = 1 << 0,  /**< Accept all frames with 
 	                                  * phys. desticnation 
 									  */
@@ -362,5 +365,5 @@
 	ANAR_ACK          = (1 << 14),  /**< Capability reception acknowledge */
 	ANAR_REMOTE_FAULT = (1 << 13),  /**< Remote fault detection capability */
-	ANAR_PAUSE        = (1 << 10),  /**< Symetric pause packet capability */
+	ANAR_PAUSE        = (1 << 10),  /**< Symetric pause frame capability */
 	ANAR_100T4        = (1 << 9),   /**< T4, not supported by the device */
 	ANAR_100TX_FD     = (1 << 8),   /**< 100BASE_TX full duplex */
@@ -399,5 +402,5 @@
 	CONFIG3_GNT_SELECT = (1 << 7),  /**< Gnt select */
 	CONFIG3_PARM_EN    = (1 << 6),  /**< Parameter enabled (100MBit mode) */
-	CONFIG3_MAGIC      = (1 << 5),  /**< WoL Magic packet enable */
+	CONFIG3_MAGIC      = (1 << 5),  /**< WoL Magic frame enable */
 	CONFIG3_LINK_UP    = (1 << 4),  /**< Wakeup if link is reestablished */
 	CONFIG3_CLKRUN_EN  = (1 << 2),  /**< CLKRUN enabled */ /* TODO: check what does it mean */
@@ -416,9 +419,9 @@
 };
 
-/** Maximal runt packet size + 1 */
-#define RTL8139_RUNT_MAX_SIZE 64
-
-/** Bits in packet header */
-enum rtl8139_packet_header {
+/** Maximal runt frame size + 1 */
+#define RTL8139_RUNT_MAX_SIZE  64
+
+/** Bits in frame header */
+enum rtl8139_frame_header {
 	RSR_MAR  = (1 << 15),  /**< Multicast received */
 	RSR_PAM  = (1 << 14),  /**< Physical address match */
@@ -426,10 +429,10 @@
 
 	RSR_ISE  = (1 << 5),   /**< Invalid symbol error, 100BASE-TX only */
-	RSR_RUNT = (1 << 4),   /**< Runt packet (< RTL8139_RUNT_MAX_SIZE bytes) */
-
-	RSR_LONG = (1 << 3),   /**< Long packet (size > 4k bytes) */
+	RSR_RUNT = (1 << 4),   /**< Runt frame (< RTL8139_RUNT_MAX_SIZE bytes) */
+
+	RSR_LONG = (1 << 3),   /**< Long frame (size > 4k bytes) */
 	RSR_CRC  = (1 << 2),   /**< CRC error */
 	RSR_FAE  = (1 << 1),   /**< Frame alignment error */
-	RSR_ROK  = (1 << 0)    /**< Good packet received */
+	RSR_ROK  = (1 << 0)    /**< Good frame received */
 };
 
@@ -451,5 +454,5 @@
 									  */
 
-	APPEND_CRC = 1 << 16,        /**< Append CRC at the end of a packet */
+	APPEND_CRC = 1 << 16,        /**< Append CRC at the end of a frame */
 
 	MXTxDMA_SHIFT = 8,  /**< Max. DMA Burst per TxDMA shift, burst = 16^value */
@@ -459,5 +462,5 @@
 	TX_RETRY_COUNT_SIZE  = 4,            /**< Retries before aborting size */
 
-	CLEAR_ABORT = 1 << 0    /**< Retransmit aborted packet at the last 
+	CLEAR_ABORT = 1 << 0    /**< Retransmit aborted frame at the last 
 	                          *  transmitted descriptor 
 							  */
@@ -470,19 +473,21 @@
 
 /** Mapping of HW version -> version ID */
-struct rtl8139_hwver_map { 
-	uint32_t hwverid;                /**< HW version value in the register */
-	enum rtl8139_version_id ver_id;  /**< appropriate version id */
+struct rtl8139_hwver_map {
+	uint32_t hwverid;             /**< HW version value in the register */
+	rtl8139_version_id_t ver_id;  /**< appropriate version id */
 };
 
 /** Mapping of HW version -> version ID */
 extern const struct rtl8139_hwver_map rtl8139_versions[RTL8139_VER_COUNT + 1];
-
-/** Size in the packet header while copying from RxFIFO to Rx buffer */
-#define RTL8139_EARLY_SIZE UINT16_C(0xfff0)
-/** The only supported pause packet time value */
-#define RTL8139_PAUSE_VAL UINT16_C(0xFFFF)
-
-/** Size of the packet header in front of the received frame */
-#define RTL_PACKET_HEADER_SIZE 4
+extern const char* model_names[RTL8139_VER_COUNT];
+
+/** Size in the frame header while copying from RxFIFO to Rx buffer */
+#define RTL8139_EARLY_SIZE  UINT16_C(0xfff0)
+
+/** The only supported pause frame time value */
+#define RTL8139_PAUSE_VAL  UINT16_C(0xFFFF)
+
+/** Size of the frame header in front of the received frame */
+#define RTL_FRAME_HEADER_SIZE  4
 
 /** 8k buffer */
Index: uspace/drv/nic/rtl8139/driver.c
===================================================================
--- uspace/drv/nic/rtl8139/driver.c	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/rtl8139/driver.c	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -39,5 +39,4 @@
 #include <io/log.h>
 #include <nic.h>
-#include <packet_client.h>
 #include <device/pci.h>
 
@@ -56,21 +55,28 @@
 /** Global mutex for work with shared irq structure */
 FIBRIL_MUTEX_INITIALIZE(irq_reg_lock);
+
 /** Lock interrupt structure mutex */
-#define RTL8139_IRQ_STRUCT_LOCK() fibril_mutex_lock(&irq_reg_lock)
+#define RTL8139_IRQ_STRUCT_LOCK() \
+	fibril_mutex_lock(&irq_reg_lock)
+
 /** Unlock interrupt structure mutex */
-#define RTL8139_IRQ_STRUCT_UNLOCK() fibril_mutex_unlock(&irq_reg_lock)
+#define RTL8139_IRQ_STRUCT_UNLOCK() \
+	fibril_mutex_unlock(&irq_reg_lock)
 
 /** PCI clock frequency in kHz */
-#define RTL8139_PCI_FREQ_KHZ 33000
-
-#define RTL8139_AUTONEG_CAPS (ETH_AUTONEG_10BASE_T_HALF \
-    | ETH_AUTONEG_10BASE_T_FULL | ETH_AUTONEG_100BASE_TX_HALF \
-    | ETH_AUTONEG_100BASE_TX_FULL | ETH_AUTONEG_PAUSE_SYMETRIC)
+#define RTL8139_PCI_FREQ_KHZ  33000
+
+#define RTL8139_AUTONEG_CAPS (ETH_AUTONEG_10BASE_T_HALF | \
+	ETH_AUTONEG_10BASE_T_FULL | ETH_AUTONEG_100BASE_TX_HALF | \
+	ETH_AUTONEG_100BASE_TX_FULL | ETH_AUTONEG_PAUSE_SYMETRIC)
 
 /** Lock transmitter and receiver data
- *  This function shall be called whenever both transmitter and receiver locking
- *  to force safe lock ordering (deadlock prevention)
- *
- *  @param rtl8139  RTL8139 private data
+ *
+ * This function shall be called whenever
+ * both transmitter and receiver locking
+ * to force safe lock ordering (deadlock prevention)
+ *
+ * @param rtl8139 RTL8139 private data
+ *
  */
 inline static void rtl8139_lock_all(rtl8139_t *rtl8139)
@@ -83,5 +89,6 @@
 /** Unlock transmitter and receiver data
  *
- *  @param rtl8139  RTL8139 private data
+ * @param rtl8139 RTL8139 private data
+ *
  */
 inline static void rtl8139_unlock_all(rtl8139_t *rtl8139)
@@ -152,5 +159,5 @@
 }
 
-/** Update the mask of accepted packets in the RCR register according to
+/** Update the mask of accepted frames in the RCR register according to
  * rcr_accept_mode value in rtl8139_t
  *
@@ -170,5 +177,5 @@
 }
 
-/** Fill the mask of accepted multicast packets in the card registers
+/** Fill the mask of accepted multicast frames in the card registers
  *
  *  @param rtl8139  The rtl8139 private data
@@ -394,5 +401,5 @@
 #define rtl8139_tbuf_busy(tsd) ((pio_read_32(tsd) & TSD_OWN) == 0)
 
-/** Send packet with the hardware
+/** Send frame with the hardware
  *
  * note: the main_lock is locked when framework calls this function
@@ -412,5 +419,5 @@
 	ddf_msg(LVL_DEBUG, "Sending frame");
 
-	if (size > RTL8139_PACKET_MAX_LENGTH) {
+	if (size > RTL8139_FRAME_MAX_LENGTH) {
 		ddf_msg(LVL_ERROR, "Send frame: frame too long, %zu bytes",
 		    size);
@@ -437,5 +444,5 @@
 	fibril_mutex_unlock(&rtl8139->tx_lock);
 
-	/* Get address of the buffer descriptor and packet data */
+	/* Get address of the buffer descriptor and frame data */
 	void *tsd = rtl8139->io_port + TSD0 + tx_curr * 4;
 	void *buf_addr = rtl8139->tx_buff[tx_curr];
@@ -458,5 +465,5 @@
 	pio_write_32(tsd, tsd_value);
 	return;
-
+	
 err_busy_no_inc:
 err_size:
@@ -505,32 +512,26 @@
 }
 
-/** Create packet structure from the buffer data
+/** Create frame structure from the buffer data
  *
  * @param nic_data      NIC driver data
  * @param rx_buffer     The receiver buffer
  * @param rx_size       The buffer size
- * @param packet_start  The offset where packet data start
- * @param packet_size   The size of the packet data
- *
- * @return The packet   list node (not connected)
- */
-static nic_frame_t *rtl8139_read_packet(nic_t *nic_data,
-    void *rx_buffer, size_t rx_size, size_t packet_start, size_t packet_size)
-{
-	nic_frame_t *frame = nic_alloc_frame(nic_data, packet_size);
+ * @param frame_start   The offset where packet data start
+ * @param frame_size    The size of the frame data
+ *
+ * @return The frame list node (not connected)
+ *
+ */
+static nic_frame_t *rtl8139_read_frame(nic_t *nic_data,
+    void *rx_buffer, size_t rx_size, size_t frame_start, size_t frame_size)
+{
+	nic_frame_t *frame = nic_alloc_frame(nic_data, frame_size);
 	if (! frame) {
-		ddf_msg(LVL_ERROR, "Can not allocate frame for received packet.");
+		ddf_msg(LVL_ERROR, "Can not allocate frame for received frame.");
 		return NULL;
 	}
 
-	void *packet_data = packet_suffix(frame->packet, packet_size);
-	if (!packet_data) {
-		ddf_msg(LVL_ERROR, "Can not get the packet suffix.");
-		nic_release_frame(nic_data, frame);
-		return NULL;
-	}
-
-	void *ret = rtl8139_memcpy_wrapped(packet_data, rx_buffer, packet_start,
-	    RxBUF_SIZE, packet_size);
+	void *ret = rtl8139_memcpy_wrapped(frame->data, rx_buffer, frame_start,
+	    RxBUF_SIZE, frame_size);
 	if (ret == NULL) {
 		nic_release_frame(nic_data, frame);
@@ -568,10 +569,10 @@
 }
 
-/** Receive all packets in queue
+/** Receive all frames in queue
  *
  *  @param nic_data  The controller data
- *  @return The linked list of packet_list_t nodes, each containing one packet
- */
-static nic_frame_list_t *rtl8139_packet_receive(nic_t *nic_data)
+ *  @return The linked list of nic_frame_list_t nodes, each containing one frame
+ */
+static nic_frame_list_t *rtl8139_frame_receive(nic_t *nic_data)
 {
 	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
@@ -581,5 +582,5 @@
 	nic_frame_list_t *frames = nic_alloc_frame_list();
 	if (!frames)
-		ddf_msg(LVL_ERROR, "Can not allocate frame list for received packets.");
+		ddf_msg(LVL_ERROR, "Can not allocate frame list for received frames.");
 
 	void *rx_buffer = rtl8139->rx_buff_virt;
@@ -605,12 +606,12 @@
 	while (!rtl8139_hw_buffer_empty(rtl8139)) {
 		void *rx_ptr = rx_buffer + rx_offset % RxBUF_SIZE;
-		uint32_t packet_header = uint32_t_le2host( *((uint32_t*)rx_ptr) );
-		uint16_t size = packet_header >> 16;
-		uint16_t packet_size = size - RTL8139_CRC_SIZE;
-		/* received packet flags in packet header */
-		uint16_t rcs = (uint16_t) packet_header;
+		uint32_t frame_header = uint32_t_le2host( *((uint32_t*)rx_ptr) );
+		uint16_t size = frame_header >> 16;
+		uint16_t frame_size = size - RTL8139_CRC_SIZE;
+		/* received frame flags in frame header */
+		uint16_t rcs = (uint16_t) frame_header;
 
 		if (size == RTL8139_EARLY_SIZE) {
-			/* The packet copying is still in progress, break receiving */
+			/* The frame copying is still in progress, break receiving */
 			ddf_msg(LVL_DEBUG, "Early threshold reached, not completely coppied");
 			break;
@@ -618,7 +619,7 @@
 
 		/* Check if the header is valid, otherwise we are lost in the buffer */
-		if (size == 0 || size > RTL8139_PACKET_MAX_LENGTH) {
+		if (size == 0 || size > RTL8139_FRAME_MAX_LENGTH) {
 			ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (size: %4"PRIu16", "
-			    "header 0x%4"PRIx16". Offset: %zu)", size, packet_header, 
+			    "header 0x%4"PRIx16". Offset: %zu)", size, frame_header, 
 			    rx_offset);
 			goto rx_err;
@@ -629,11 +630,11 @@
 		}
 
-		cur_read += size + RTL_PACKET_HEADER_SIZE;
+		cur_read += size + RTL_FRAME_HEADER_SIZE;
 		if (cur_read > max_read)
 			break;
 
 		if (frames) {
-			nic_frame_t *frame = rtl8139_read_packet(nic_data, rx_buffer,
-			    RxBUF_SIZE, rx_offset + RTL_PACKET_HEADER_SIZE, packet_size);
+			nic_frame_t *frame = rtl8139_read_frame(nic_data, rx_buffer,
+			    RxBUF_SIZE, rx_offset + RTL_FRAME_HEADER_SIZE, frame_size);
 
 			if (frame)
@@ -642,7 +643,7 @@
 
 		/* Update offset */
-		rx_offset = ALIGN_UP(rx_offset + size + RTL_PACKET_HEADER_SIZE, 4);
-
-		/* Write lesser value to prevent overflow into unread packet
+		rx_offset = ALIGN_UP(rx_offset + size + RTL_FRAME_HEADER_SIZE, 4);
+
+		/* Write lesser value to prevent overflow into unread frame
 		 * (the recomendation from the RealTech rtl8139 programming guide)
 		 */
@@ -735,5 +736,5 @@
 		tx_used++;
 
-		/* If the packet was sent */
+		/* If the frame was sent */
 		if (tsd_value & TSD_TOK) {
 			size_t size = REG_GET_VAL(tsd_value, TSD_SIZE);
@@ -765,9 +766,9 @@
 }
 
-/** Receive all packets from the buffer
+/** Receive all frames from the buffer
  *
  *  @param rtl8139  driver private data
  */
-static void rtl8139_receive_packets(nic_t *nic_data)
+static void rtl8139_receive_frames(nic_t *nic_data)
 {
 	assert(nic_data);
@@ -777,5 +778,5 @@
 
 	fibril_mutex_lock(&rtl8139->rx_lock);
-	nic_frame_list_t *frames = rtl8139_packet_receive(nic_data);
+	nic_frame_list_t *frames = rtl8139_frame_receive(nic_data);
 	fibril_mutex_unlock(&rtl8139->rx_lock);
 
@@ -833,5 +834,5 @@
 	}
 
-	/* Check transmittion interrupts first to allow transmit next packets
+	/* Check transmittion interrupts first to allow transmit next frames
 	 * sooner
 	 */
@@ -840,5 +841,5 @@
 	}
 	if (isr & INT_ROK) {
-		rtl8139_receive_packets(nic_data);
+		rtl8139_receive_frames(nic_data);
 	}
 	if (isr & (INT_RER | INT_RXOVW | INT_FIFOOVW)) {
@@ -942,5 +943,5 @@
 }
 
-/** Activate the device to receive and transmit packets
+/** Activate the device to receive and transmit frames
  *
  *  @param nic_data  The nic driver data
@@ -1222,15 +1223,15 @@
 		goto failed;
 
-	/* Set default packet acceptance */
+	/* Set default frame acceptance */
 	rtl8139->rcr_data.ucast_mask = RTL8139_RCR_UCAST_DEFAULT;
 	rtl8139->rcr_data.mcast_mask = RTL8139_RCR_MCAST_DEFAULT;
 	rtl8139->rcr_data.bcast_mask = RTL8139_RCR_BCAST_DEFAULT;
 	rtl8139->rcr_data.defect_mask = RTL8139_RCR_DEFECT_DEFAULT;
-	/* Set receiver early treshold to 8/16 of packet length */
+	/* Set receiver early treshold to 8/16 of frame length */
 	rtl8139->rcr_data.rcr_base = (0x8 << RCR_ERTH_SHIFT);
 
 	ddf_msg(LVL_DEBUG, "The device is initialized");
 	return ret;
-
+	
 failed:
 	ddf_msg(LVL_ERROR, "The device initialization failed");
@@ -1297,4 +1298,6 @@
 int rtl8139_dev_add(ddf_dev_t *dev)
 {
+	ddf_fun_t *fun;
+
 	assert(dev);
 	ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %d)", dev->name, dev->handle);
@@ -1333,8 +1336,22 @@
 	}
 
-	rc = nic_register_as_ddf_fun(nic_data, &rtl8139_dev_ops);
+	fun = ddf_fun_create(nic_get_ddf_dev(nic_data), fun_exposed, "port0");
+	if (fun == NULL) {
+		ddf_msg(LVL_ERROR, "Failed creating device function");
+		goto err_srv;
+	}
+	nic_set_ddf_fun(nic_data, fun);
+	fun->ops = &rtl8139_dev_ops;
+	fun->driver_data = nic_data;
+
+	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to register as DDF function - error %d", rc);
-		goto err_irq;
+		ddf_msg(LVL_ERROR, "Failed binding device function");
+		goto err_fun_create;
+	}
+	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
+	if (rc != EOK) {
+		ddf_msg(LVL_ERROR, "Failed adding function to category");
+		goto err_fun_bind;
 	}
 
@@ -1343,5 +1360,11 @@
 
 	return EOK;
-
+	
+err_fun_bind:
+	ddf_fun_unbind(fun);
+err_fun_create:
+	ddf_fun_destroy(fun);
+err_srv:
+	/* XXX Disconnect from services */
 err_irq:
 	unregister_interrupt_handler(dev, rtl8139->irq);
@@ -1486,5 +1509,5 @@
 };
 
-/** Check if pause packet operations are valid in current situation 
+/** Check if pause frame operations are valid in current situation 
  *
  *  @param rtl8139  RTL8139 private structure
@@ -1511,5 +1534,5 @@
 }
 
-/** Get current pause packet configuration
+/** Get current pause frame configuration
  *
  *  Values are filled with NIC_RESULT_NOT_AVAILABLE if the value has no sense in
@@ -1517,7 +1540,7 @@
  *
  *  @param[in]  fun         The DDF structure of the RTL8139
- *  @param[out] we_send     Sign if local constroller sends pause packets
- *  @param[out] we_receive  Sign if local constroller receives pause packets
- *  @param[out] time        Time filled in pause packets. 0xFFFF in rtl8139
+ *  @param[out] we_send     Sign if local constroller sends pause frame
+ *  @param[out] we_receive  Sign if local constroller receives pause frame
+ *  @param[out] time        Time filled in pause frames. 0xFFFF in rtl8139
  *
  *  @return EOK if succeed
@@ -1549,12 +1572,12 @@
 };
 
-/** Set current pause packet configuration
+/** Set current pause frame configuration
  *
  *  @param fun            The DDF structure of the RTL8139
- *  @param allow_send     Sign if local constroller sends pause packets
- *  @param allow_receive  Sign if local constroller receives pause packets
+ *  @param allow_send     Sign if local constroller sends pause frame
+ *  @param allow_receive  Sign if local constroller receives pause frames
  *  @param time           Time to use, ignored (not supported by device)
  *
- *  @return EOK if succeed, INVAL if the pause packet has no sence
+ *  @return EOK if succeed, INVAL if the pause frame has no sence
  */
 static int rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 
@@ -1805,5 +1828,5 @@
 }
 
-/** Set unicast packets acceptance mode
+/** Set unicast frames acceptance mode
  *
  *  @param nic_data  The nic device to update
@@ -1863,5 +1886,5 @@
 }
 
-/** Set multicast packets acceptance mode
+/** Set multicast frames acceptance mode
  *
  *  @param nic_data  The nic device to update
@@ -1908,5 +1931,5 @@
 }
 
-/** Set broadcast packets acceptance mode
+/** Set broadcast frames acceptance mode
  *
  *  @param nic_data  The nic device to update
@@ -1938,5 +1961,5 @@
 }
 
-/** Get state of acceptance of weird packets
+/** Get state of acceptance of weird frames
  *
  *  @param[in]  device  The device to check
@@ -1960,5 +1983,5 @@
 };
 
-/** Set acceptance of weird packets
+/** Set acceptance of weird frames
  *
  *  @param device  The device to update
@@ -2136,5 +2159,5 @@
 }
 
-/** Force receiving all packets in the receive buffer
+/** Force receiving all frames in the receive buffer
  *
  *  @param device  The device to receive
Index: uspace/drv/nic/rtl8139/driver.h
===================================================================
--- uspace/drv/nic/rtl8139/driver.h	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/rtl8139/driver.h	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -30,36 +30,40 @@
 #define RTL8139_DRIVER_H_
 
+#include <sys/types.h>
+#include <stdint.h>
 #include "defs.h"
 #include "general.h"
-#include <sys/types.h>
-#include <stdint.h>
 
 /** The driver name */
-#define NAME "rtl8139"
+#define NAME  "rtl8139"
+
 /** Transmittion buffers count */
-#define TX_BUFF_COUNT 4
-/** Size of buffer for one packet
- *  - 2kB
- */
-#define TX_BUFF_SIZE (2 * 1024)
-/** Count of pages to allocate for TxBuffers */
-#define TX_PAGES 2
+#define TX_BUFF_COUNT  4
+
+/** Size of buffer for one frame (2kB) */
+#define TX_BUFF_SIZE  (2 * 1024)
+
+/** Number of pages to allocate for TxBuffers */
+#define TX_PAGES  2
 
 /** Size of the CRC after the received frame in the receiver buffer */
-#define RTL8139_CRC_SIZE 4
-
-/** The default mode of accepting unicast packets */
-#define RTL8139_RCR_UCAST_DEFAULT RCR_ACCEPT_PHYS_MATCH
-/** The default mode of accepting multicast packets */
-#define RTL8139_RCR_MCAST_DEFAULT 0
-/** The default mode of accepting broadcast packets */
-#define RTL8139_RCR_BCAST_DEFAULT RCR_ACCEPT_BROADCAST
-/** The default mode of accepting defect packets */
-#define RTL8139_RCR_DEFECT_DEFAULT 0
+#define RTL8139_CRC_SIZE  4
+
+/** The default mode of accepting unicast frames */
+#define RTL8139_RCR_UCAST_DEFAULT  RCR_ACCEPT_PHYS_MATCH
+
+/** The default mode of accepting multicast frames */
+#define RTL8139_RCR_MCAST_DEFAULT  0
+
+/** The default mode of accepting broadcast frames */
+#define RTL8139_RCR_BCAST_DEFAULT  RCR_ACCEPT_BROADCAST
+
+/** The default mode of accepting defect frames */
+#define RTL8139_RCR_DEFECT_DEFAULT  0
 
 /** Mask for accepting all multicast */
-#define RTL8139_MCAST_MASK_PROMISC UINT64_MAX
-
-/** Data  */
+#define RTL8139_MCAST_MASK_PROMISC  UINT64_MAX
+
+/** Data */
 struct rtl8139_rcr_data {
 	/** Configuration part of RCR */
@@ -112,5 +116,5 @@
 	size_t tx_used;
 
-	/** Buffer for receiving packets */
+	/** Buffer for receiving frames */
 	void *rx_buff_phys;
 	void *rx_buff_virt;
@@ -134,7 +138,6 @@
 
 	/** Version of RT8139 controller */
-	enum rtl8139_version_id hw_version;
+	rtl8139_version_id_t hw_version;
 } rtl8139_t;
-
 
 /* ***** Pointers casting - for both amd64 and ia32 ***** */
@@ -160,6 +163,4 @@
  */
 #define IOADDR_TO_PTR(ioaddr) ((void*)((size_t)(ioaddr)))
-
-
 
 /* ***** Bit operation macros ***** */
@@ -177,5 +178,5 @@
  * @return New value
  */
-#define bit_set_part_g( src, value, mask, type ) \
+#define bit_set_part_g(src, value, mask, type) \
 	((type)(((src) & ~((type)(mask))) | ((value) & (type)(mask))))
 
@@ -237,4 +238,3 @@
 	bit_set_part_32(tsd_value, (size) << TSD_SIZE_SHIFT, TSD_SIZE_MASK << TSD_SIZE_SHIFT)
 
-
 #endif
Index: uspace/drv/nic/rtl8139/general.h
===================================================================
--- uspace/drv/nic/rtl8139/general.h	(revision e7778478ec6096c87bc7a5be1c827fff262b0cce)
+++ uspace/drv/nic/rtl8139/general.h	(revision cfb797479986d908acecc09ba43bc68e3051022f)
@@ -29,5 +29,5 @@
 /** @file
  *
- *  General functions and structures used in rtl8139 driver
+ * General functions and structures used in rtl8139 driver
  */
 
@@ -37,30 +37,30 @@
 #include <unistd.h>
 
-extern void* rtl8139_memcpy_wrapped(void *dest, const void *src_buf,
-    size_t src_offset, size_t src_size, size_t data_size);
-
+/** Number of microseconds in second */
+#define RTL8139_USEC_IN_SEC  1000000
 
 /** Structure for HW timer control */
-typedef struct rtl8139_timer_act {
+typedef struct {
 	/** Register value set in the last timer period */
 	uint32_t last_val;
+	
 	/** Register value set in the common timer period */
 	uint32_t full_val;
-
+	
 	/** Amount of full register periods in timer period */
 	size_t full_skips;
+	
 	/** Remaining full register periods to the next period end */
 	size_t full_skips_remains;
+	
 	/** Mark if there is a last run */
 	int last_run;
 } rtl8139_timer_act_t;
 
-/** Count of microseconds in second */
-#define RTL8139_USEC_IN_SEC 1000000
-
-extern int rtl8139_timer_act_init(rtl8139_timer_act_t *ta, uint32_t timer_freq,
-    const struct timeval *time);
-extern int rtl8139_timer_act_step(rtl8139_timer_act_t *ta, uint32_t *new_reg);
-
+extern void *rtl8139_memcpy_wrapped(void *, const void *, size_t, size_t,
+    size_t);
+extern int rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,
+    const struct timeval *);
+extern int rtl8139_timer_act_step(rtl8139_timer_act_t *, uint32_t *);
 
 #endif
