Index: uspace/lib/net/Makefile
===================================================================
--- uspace/lib/net/Makefile	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/Makefile	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -40,6 +40,4 @@
 	generic/protocol_map.c \
 	adt/module_map.c \
-	netif/netif_remote.c \
-	netif/netif_skel.c \
 	nil/nil_remote.c \
 	nil/nil_skel.c \
Index: uspace/lib/net/generic/generic.c
===================================================================
--- uspace/lib/net/generic/generic.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/generic/generic.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -54,5 +54,5 @@
  */
 int generic_device_state_msg_remote(async_sess_t *sess, sysarg_t message,
-    device_id_t device_id, sysarg_t state, services_t target)
+    nic_device_id_t device_id, sysarg_t state, services_t target)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -68,5 +68,4 @@
  * @param[in] message   Service specific message.
  * @param[in] device_id Device identifier.
- * @param[in] arg2      Second argument of the message.
  * @param[in] service   Device module service.
  *
@@ -77,9 +76,9 @@
  */
 int generic_device_req_remote(async_sess_t *sess, sysarg_t message,
-    device_id_t device_id, sysarg_t arg2, services_t service)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_3_0(exch, message, (sysarg_t) device_id,
-	    arg2, (sysarg_t) service);
+    nic_device_id_t device_id, services_t service)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int rc = async_req_2_0(exch, message, (sysarg_t) device_id,
+	    (sysarg_t) service);
 	async_exchange_end(exch);
 	
@@ -103,25 +102,21 @@
  */
 int generic_get_addr_req(async_sess_t *sess, sysarg_t message,
-    device_id_t device_id, measured_string_t **address, uint8_t **data)
-{
-	if ((!address) || (!data))
+    nic_device_id_t device_id, uint8_t *address, size_t max_len)
+{
+	if (!address)
 		return EBADMEM;
 	
 	/* Request the address */
 	async_exch_t *exch = async_exchange_begin(sess);
-	aid_t message_id = async_send_1(exch, message, (sysarg_t) device_id,
+	aid_t aid = async_send_1(exch, message, (sysarg_t) device_id,
 	    NULL);
-	int rc = measured_strings_return(exch, address, data, 1);
+	int rc = async_data_read_start(exch, address, max_len);
 	async_exchange_end(exch);
 	
 	sysarg_t result;
-	async_wait_for(message_id, &result);
-	
-	/* If not successful */
-	if ((rc == EOK) && (result != EOK)) {
-		/* Clear the data */
-		free(*address);
-		free(*data);
-	}
+	async_wait_for(aid, &result);
+	
+	if (rc != EOK)
+		return rc;
 	
 	return (int) result;
@@ -142,5 +137,5 @@
  */
 int generic_packet_size_req_remote(async_sess_t *sess, sysarg_t message,
-    device_id_t device_id, packet_dimension_t *packet_dimension)
+    nic_device_id_t device_id, packet_dimension_t *packet_dimension)
 {
 	if (!packet_dimension)
@@ -179,5 +174,5 @@
  */
 int generic_received_msg_remote(async_sess_t *sess, sysarg_t message,
-    device_id_t device_id, packet_id_t packet_id, services_t target,
+    nic_device_id_t device_id, packet_id_t packet_id, services_t target,
     services_t error)
 {
@@ -210,5 +205,5 @@
  */
 int generic_send_msg_remote(async_sess_t *sess, sysarg_t message,
-    device_id_t device_id, packet_id_t packet_id, services_t sender,
+    nic_device_id_t device_id, packet_id_t packet_id, services_t sender,
     services_t error)
 {
@@ -251,5 +246,5 @@
  */
 int generic_translate_req(async_sess_t *sess, sysarg_t message,
-    device_id_t device_id, services_t service,
+    nic_device_id_t device_id, services_t service,
     measured_string_t *configuration, size_t count,
     measured_string_t **translation, uint8_t **data)
Index: uspace/lib/net/generic/net_checksum.c
===================================================================
--- uspace/lib/net/generic/net_checksum.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/generic/net_checksum.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -40,8 +40,8 @@
 
 /** Big-endian encoding CRC divider. */
-#define CRC_DIVIDER_BE	0x04c11db7
+#define CRC_DIVIDER_BE  0x04c11db7
 
 /** Little-endian encoding CRC divider. */
-#define CRC_DIVIDER_LE	0xedb88320
+#define CRC_DIVIDER_LE  0xedb88320
 
 /** Compacts the computed checksum to the 16 bit number adding the carries.
@@ -203,5 +203,5 @@
 }
 
-/** Computes the ip header checksum.
+/** Compute the IP header checksum.
  *
  * To compute the checksum of a new packet, the checksum header field must be
Index: uspace/lib/net/generic/net_remote.c
===================================================================
--- uspace/lib/net/generic/net_remote.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/generic/net_remote.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -38,7 +38,7 @@
 #include <ipc/services.h>
 #include <ipc/net_net.h>
-
 #include <malloc.h>
-
+#include <async.h>
+#include <devman.h>
 #include <generic.h>
 #include <net/modules.h>
@@ -98,5 +98,5 @@
     size_t count, uint8_t **data)
 {
-	return generic_translate_req(sess, NET_NET_GET_DEVICE_CONF, 0, 0,
+	return generic_translate_req(sess, NET_NET_GET_CONF, 0, 0,
 	    *configuration, count, configuration, data);
 }
@@ -124,5 +124,5 @@
  *
  */
-int net_get_device_conf_req(async_sess_t *sess, device_id_t device_id,
+int net_get_device_conf_req(async_sess_t *sess, nic_device_id_t device_id,
     measured_string_t **configuration, size_t count, uint8_t **data)
 {
@@ -131,4 +131,49 @@
 }
 
+int net_get_devices_req(async_sess_t *sess, measured_string_t **devices,
+    size_t *count, uint8_t **data)
+{
+	if ((!devices) || (!count))
+		return EBADMEM;
+	
+	async_exch_t *exch = async_exchange_begin(sess);
+	
+	int rc = async_req_0_1(exch, NET_NET_GET_DEVICES_COUNT, count);
+	if (rc != EOK) {
+		async_exchange_end(exch);
+		return rc;
+	}
+	
+	if (*count == 0) {
+		async_exchange_end(exch);
+		*data = NULL;
+		return EOK;
+	}
+	
+	aid_t message_id = async_send_0(exch, NET_NET_GET_DEVICES, NULL);
+	rc = measured_strings_return(exch, devices, data, *count);
+	
+	async_exchange_end(exch);
+	
+	sysarg_t result;
+	async_wait_for(message_id, &result);
+	
+	if ((rc == EOK) && (result != EOK)) {
+		free(*devices);
+		free(*data);
+	}
+	
+	return (int) result;
+}
+
+int net_driver_ready(async_sess_t *sess, devman_handle_t handle)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int rc = async_req_1_0(exch, NET_NET_DRIVER_READY, handle);
+	async_exchange_end(exch);
+	
+	return rc;
+}
+
 /** @}
  */
Index: uspace/lib/net/generic/protocol_map.c
===================================================================
--- uspace/lib/net/generic/protocol_map.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/generic/protocol_map.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -50,5 +50,5 @@
 	switch (nil) {
 	case SERVICE_ETHERNET:
-	case SERVICE_NE2000:
+	case SERVICE_NILDUMMY:
 		switch (il) {
 		case SERVICE_IP:
@@ -76,5 +76,5 @@
 	switch (nil) {
 	case SERVICE_ETHERNET:
-	case SERVICE_NE2000:
+	case SERVICE_NILDUMMY:
 		switch (protocol) {
 		case ETH_P_IP:
@@ -139,5 +139,4 @@
 	switch (nil) {
 	case SERVICE_ETHERNET:
-	case SERVICE_NE2000:
 		return HW_ETHER;
 	default:
Index: uspace/lib/net/il/arp_remote.c
===================================================================
--- uspace/lib/net/il/arp_remote.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/il/arp_remote.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -84,5 +84,5 @@
  *
  */
-int arp_clear_address_req(async_sess_t *sess, device_id_t device_id,
+int arp_clear_address_req(async_sess_t *sess, nic_device_id_t device_id,
     services_t protocol, measured_string_t *address)
 {
@@ -108,5 +108,5 @@
  *
  */
-int arp_clear_device_req(async_sess_t *sess, device_id_t device_id)
+int arp_clear_device_req(async_sess_t *sess, nic_device_id_t device_id)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -143,5 +143,5 @@
  *
  */
-int arp_device_req(async_sess_t *sess, device_id_t device_id,
+int arp_device_req(async_sess_t *sess, nic_device_id_t device_id,
     services_t protocol, services_t netif, measured_string_t *address)
 {
@@ -177,5 +177,5 @@
  *
  */
-int arp_translate_req(async_sess_t *sess, device_id_t device_id,
+int arp_translate_req(async_sess_t *sess, nic_device_id_t device_id,
     services_t protocol, measured_string_t *address,
     measured_string_t **translation, uint8_t **data)
Index: uspace/lib/net/il/il_remote.c
===================================================================
--- uspace/lib/net/il/il_remote.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/il/il_remote.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -55,6 +55,6 @@
  *
  */
-int il_device_state_msg(async_sess_t *sess, device_id_t device_id,
-    device_state_t state, services_t target)
+int il_device_state_msg(async_sess_t *sess, nic_device_id_t device_id,
+    nic_device_state_t state, services_t target)
 {
 	return generic_device_state_msg_remote(sess, NET_IL_DEVICE_STATE,
@@ -73,6 +73,6 @@
  *
  */
-int il_received_msg(async_sess_t *sess, device_id_t device_id, packet_t *packet,
-    services_t target)
+int il_received_msg(async_sess_t *sess, nic_device_id_t device_id,
+    packet_t *packet, services_t target)
 {
 	return generic_received_msg_remote(sess, NET_IL_RECEIVED, device_id,
@@ -91,5 +91,5 @@
  *
  */
-int il_mtu_changed_msg(async_sess_t *sess, device_id_t device_id, size_t mtu,
+int il_mtu_changed_msg(async_sess_t *sess, nic_device_id_t device_id, size_t mtu,
     services_t target)
 {
@@ -98,4 +98,26 @@
 }
 
+/** Notify IL layer modules about address change (implemented by ARP)
+ *
+ */
+int il_addr_changed_msg(async_sess_t *sess, nic_device_id_t device_id,
+    size_t addr_len, const uint8_t *address)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	
+	aid_t message_id = async_send_1(exch, NET_IL_ADDR_CHANGED,
+			(sysarg_t) device_id, NULL);
+	int rc = async_data_write_start(exch, address, addr_len);
+	
+	async_exchange_end(exch);
+	
+	sysarg_t res;
+    async_wait_for(message_id, &res);
+    if (rc != EOK)
+		return rc;
+	
+    return (int) res;
+}
+
 /** @}
  */
Index: uspace/lib/net/il/ip_remote.c
===================================================================
--- uspace/lib/net/il/ip_remote.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/il/ip_remote.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -62,5 +62,5 @@
  *
  */
-int ip_add_route_req_remote(async_sess_t *sess, device_id_t device_id,
+int ip_add_route_req_remote(async_sess_t *sess, nic_device_id_t device_id,
     in_addr_t address, in_addr_t netmask, in_addr_t gateway)
 {
@@ -123,8 +123,8 @@
  *
  */
-int ip_device_req_remote(async_sess_t *sess, device_id_t device_id,
+int ip_device_req_remote(async_sess_t *sess, nic_device_id_t device_id,
     services_t service)
 {
-	return generic_device_req_remote(sess, NET_IP_DEVICE, device_id, 0,
+	return generic_device_req_remote(sess, NET_IP_DEVICE, device_id,
 	    service);
 }
@@ -144,5 +144,5 @@
 int ip_get_route_req_remote(async_sess_t *sess, ip_protocol_t protocol,
     const struct sockaddr *destination, socklen_t addrlen,
-    device_id_t *device_id, void **header, size_t *headerlen)
+    nic_device_id_t *device_id, void **header, size_t *headerlen)
 {
 	if ((!destination) || (addrlen == 0))
@@ -196,5 +196,5 @@
  *
  */
-int ip_packet_size_req_remote(async_sess_t *sess, device_id_t device_id,
+int ip_packet_size_req_remote(async_sess_t *sess, nic_device_id_t device_id,
     packet_dimension_t *packet_dimension)
 {
@@ -216,5 +216,5 @@
  *
  */
-int ip_received_error_msg_remote(async_sess_t *sess, device_id_t device_id,
+int ip_received_error_msg_remote(async_sess_t *sess, nic_device_id_t device_id,
     packet_t *packet, services_t target, services_t error)
 {
@@ -240,5 +240,5 @@
  *
  */
-int ip_send_msg_remote(async_sess_t *sess, device_id_t device_id,
+int ip_send_msg_remote(async_sess_t *sess, nic_device_id_t device_id,
     packet_t *packet, services_t sender, services_t error)
 {
@@ -256,5 +256,5 @@
  *
  */
-int ip_set_gateway_req_remote(async_sess_t *sess, device_id_t device_id,
+int ip_set_gateway_req_remote(async_sess_t *sess, nic_device_id_t device_id,
     in_addr_t gateway)
 {
Index: uspace/lib/net/include/arp_interface.h
===================================================================
--- uspace/lib/net/include/arp_interface.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/arp_interface.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -46,10 +46,10 @@
 /*@{*/
 
-extern int arp_device_req(async_sess_t *, device_id_t, services_t, services_t,
+extern int arp_device_req(async_sess_t *, nic_device_id_t, services_t, services_t,
     measured_string_t *);
-extern int arp_translate_req(async_sess_t *, device_id_t, services_t,
+extern int arp_translate_req(async_sess_t *, nic_device_id_t, services_t,
     measured_string_t *, measured_string_t **, uint8_t **);
-extern int arp_clear_device_req(async_sess_t *, device_id_t);
-extern int arp_clear_address_req(async_sess_t *, device_id_t, services_t,
+extern int arp_clear_device_req(async_sess_t *, nic_device_id_t);
+extern int arp_clear_address_req(async_sess_t *, nic_device_id_t, services_t,
     measured_string_t *);
 extern int arp_clean_cache_req(async_sess_t *);
Index: uspace/lib/net/include/generic.h
===================================================================
--- uspace/lib/net/include/generic.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/generic.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -45,16 +45,16 @@
 
 extern int generic_device_state_msg_remote(async_sess_t *, sysarg_t,
-    device_id_t, sysarg_t, services_t);
-extern int generic_device_req_remote(async_sess_t *, sysarg_t, device_id_t,
-    sysarg_t, services_t);
-extern int generic_get_addr_req(async_sess_t *, sysarg_t, device_id_t,
-    measured_string_t **, uint8_t **);
-extern int generic_packet_size_req_remote(async_sess_t *, sysarg_t, device_id_t,
-    packet_dimension_t *);
-extern int generic_received_msg_remote(async_sess_t *, sysarg_t, device_id_t,
+    nic_device_id_t, sysarg_t, services_t);
+extern int generic_device_req_remote(async_sess_t *, sysarg_t, nic_device_id_t,
+    services_t);
+extern int generic_get_addr_req(async_sess_t *, sysarg_t, nic_device_id_t,
+    uint8_t *address, size_t max_length);
+extern int generic_packet_size_req_remote(async_sess_t *, sysarg_t,
+    nic_device_id_t, packet_dimension_t *);
+extern int generic_received_msg_remote(async_sess_t *, sysarg_t,
+    nic_device_id_t, packet_id_t, services_t, services_t);
+extern int generic_send_msg_remote(async_sess_t *, sysarg_t, nic_device_id_t,
     packet_id_t, services_t, services_t);
-extern int generic_send_msg_remote(async_sess_t *, sysarg_t, device_id_t,
-    packet_id_t, services_t, services_t);
-extern int generic_translate_req(async_sess_t *, sysarg_t, device_id_t,
+extern int generic_translate_req(async_sess_t *, sysarg_t, nic_device_id_t,
     services_t, measured_string_t *, size_t, measured_string_t **, uint8_t **);
 
Index: uspace/lib/net/include/il_remote.h
===================================================================
--- uspace/lib/net/include/il_remote.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/il_remote.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -50,8 +50,12 @@
 /*@{*/
 
-extern int il_device_state_msg(async_sess_t *, device_id_t, device_state_t,
+extern int il_device_state_msg(async_sess_t *, nic_device_id_t,
+    nic_device_state_t, services_t);
+extern int il_received_msg(async_sess_t *, nic_device_id_t, packet_t *,
     services_t);
-extern int il_received_msg(async_sess_t *, device_id_t, packet_t *, services_t);
-extern int il_mtu_changed_msg(async_sess_t *, device_id_t, size_t, services_t);
+extern int il_mtu_changed_msg(async_sess_t *, nic_device_id_t, size_t,
+    services_t);
+extern int il_addr_changed_msg(async_sess_t *, nic_device_id_t, size_t,
+    const uint8_t *);
 
 /*@}*/
Index: uspace/lib/net/include/ip_interface.h
===================================================================
--- uspace/lib/net/include/ip_interface.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/ip_interface.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -69,5 +69,5 @@
  *
  */
-typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t *packet,
+typedef int (*tl_received_msg_t)(nic_device_id_t device_id, packet_t *packet,
     services_t receiver, services_t error);
 
Index: uspace/lib/net/include/ip_remote.h
===================================================================
--- uspace/lib/net/include/ip_remote.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/ip_remote.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -43,16 +43,16 @@
 #include <async.h>
 
-extern int ip_set_gateway_req_remote(async_sess_t *, device_id_t, in_addr_t);
-extern int ip_packet_size_req_remote(async_sess_t *, device_id_t,
+extern int ip_set_gateway_req_remote(async_sess_t *, nic_device_id_t, in_addr_t);
+extern int ip_packet_size_req_remote(async_sess_t *, nic_device_id_t,
     packet_dimension_t *);
-extern int ip_received_error_msg_remote(async_sess_t *, device_id_t, packet_t *,
+extern int ip_received_error_msg_remote(async_sess_t *, nic_device_id_t, packet_t *,
     services_t, services_t);
-extern int ip_device_req_remote(async_sess_t *, device_id_t, services_t);
-extern int ip_add_route_req_remote(async_sess_t *, device_id_t, in_addr_t,
+extern int ip_device_req_remote(async_sess_t *, nic_device_id_t, services_t);
+extern int ip_add_route_req_remote(async_sess_t *, nic_device_id_t, in_addr_t,
     in_addr_t, in_addr_t);
-extern int ip_send_msg_remote(async_sess_t *, device_id_t, packet_t *,
+extern int ip_send_msg_remote(async_sess_t *, nic_device_id_t, packet_t *,
     services_t, services_t);
 extern int ip_get_route_req_remote(async_sess_t *, ip_protocol_t,
-    const struct sockaddr *, socklen_t, device_id_t *, void **, size_t *);
+    const struct sockaddr *, socklen_t, nic_device_id_t *, void **, size_t *);
 
 #endif
Index: uspace/lib/net/include/net_checksum.h
===================================================================
--- uspace/lib/net/include/net_checksum.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/net_checksum.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -30,5 +30,4 @@
  * @{
  */
-
 /** @file
  * General CRC and checksum computation.
@@ -42,14 +41,22 @@
 
 /** IP checksum value for computed zero checksum.
+ *
  * Zero is returned as 0xFFFF (not flipped)
+ *
  */
-#define IP_CHECKSUM_ZERO	0xffffU
+#define IP_CHECKSUM_ZERO  0xffffU
 
-#ifdef ARCH_IS_BIG_ENDIAN
+#ifdef __BE__
+
 #define compute_crc32(seed, data, length) \
 	compute_crc32_be(seed, (uint8_t *) data, length)
-#else
+
+#endif
+
+#ifdef __LE__
+
 #define compute_crc32(seed, data, length) \
 	compute_crc32_le(seed, (uint8_t *) data, length)
+
 #endif
 
Index: uspace/lib/net/include/net_interface.h
===================================================================
--- uspace/lib/net/include/net_interface.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/net_interface.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -35,8 +35,8 @@
 
 #include <ipc/services.h>
-
 #include <net/device.h>
 #include <adt/measured_strings.h>
 #include <async.h>
+#include <devman.h>
 
 /** @name Networking module interface
@@ -45,9 +45,12 @@
 /*@{*/
 
-extern int net_get_device_conf_req(async_sess_t *, device_id_t,
+extern int net_get_device_conf_req(async_sess_t *, nic_device_id_t,
     measured_string_t **, size_t, uint8_t **);
 extern int net_get_conf_req(async_sess_t *, measured_string_t **, size_t,
     uint8_t **);
 extern void net_free_settings(measured_string_t *, uint8_t *);
+extern int net_get_devices_req(async_sess_t *, measured_string_t **, size_t *,
+    uint8_t **);
+extern int net_driver_ready(async_sess_t *, devman_handle_t);
 extern async_sess_t *net_connect_module(void);
 
Index: uspace/lib/net/include/netif_remote.h
===================================================================
--- uspace/lib/net/include/netif_remote.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-#ifndef LIBNET_NETIF_REMOTE_H_
-#define LIBNET_NETIF_REMOTE_H_
-
-#include <ipc/services.h>
-#include <adt/measured_strings.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-
-extern int netif_get_addr_req(async_sess_t *, device_id_t, measured_string_t **,
-    uint8_t **);
-extern int netif_probe_req(async_sess_t *, device_id_t, int, void *);
-extern int netif_send_msg(async_sess_t *, device_id_t, packet_t *, services_t);
-extern int netif_start_req(async_sess_t *, device_id_t);
-extern int netif_stop_req(async_sess_t *, device_id_t);
-extern int netif_stats_req(async_sess_t *, device_id_t, device_stats_t *);
-extern async_sess_t *netif_bind_service(services_t, device_id_t, services_t,
-    async_client_conn_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/netif_skel.h
===================================================================
--- uspace/lib/net/include/netif_skel.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Network interface module skeleton.
- * The skeleton has to be part of each network interface module.
- */
-
-#ifndef NET_NETIF_SKEL_H_
-#define NET_NETIF_SKEL_H_
-
-#include <fibril_synch.h>
-#include <ipc/services.h>
-#include <adt/measured_strings.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-
-/** Network interface device specific data. */
-typedef struct {
-	device_id_t device_id;   /**< Device identifier. */
-	device_state_t state;    /**< Actual device state. */
-	void *specific;          /**< Driver specific data. */
-} netif_device_t;
-
-/** Device map.
- *
- * Maps device identifiers to the network interface device specific data.
- * @see device.h
- *
- */
-DEVICE_MAP_DECLARE(netif_device_map, netif_device_t);
-
-/** Network interface module skeleton global data. */
-typedef struct {
-	async_sess_t *sess;             /**< Networking module session. */
-	async_sess_t *nil_sess;         /**< Network interface layer session. */
-	netif_device_map_t device_map;  /**< Device map. */
-	fibril_rwlock_t lock;           /**< Safety lock. */
-} netif_globals_t;
-
-extern netif_globals_t netif_globals;
-
-/** Initialize the specific module.
- *
- * This function has to be implemented in user code.
- *
- */
-extern int netif_initialize(void);
-
-/** Probe the existence of the device.
- *
- * This has to be implemented in user code.
- *
- * @param[in] device_id Device identifier.
- * @param[in] irq       Device interrupt number.
- * @param[in] io        Device input/output address.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the specific module
- *         message implementation.
- *
- */
-extern int netif_probe_message(device_id_t device_id, int irq, void *io);
-
-/** Send the packet queue.
- *
- * This has to be implemented in user code.
- *
- * @param[in] device_id Device identifier.
- * @param[in] packet    Packet queue.
- * @param[in] sender    Sending module service.
- *
- * @return EOK on success.
- * @return EFORWARD if the device is not active (in the
- *         NETIF_ACTIVE state).
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the specific module
- *         message implementation.
- *
- */
-extern int netif_send_message(device_id_t device_id, packet_t *packet,
-    services_t sender);
-
-/** Start the device.
- *
- * This has to be implemented in user code.
- *
- * @param[in] device Device structure.
- *
- * @return New network interface state (non-negative values).
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the specific module
- *         message implementation.
- *
- */
-extern int netif_start_message(netif_device_t *device);
-
-/** Stop the device.
- *
- * This has to be implemented in user code.
- *
- * @param[in] device Device structure.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the specific module
- *         message implementation.
- *
- */
-extern int netif_stop_message(netif_device_t *device);
-
-/** Return the device local hardware address.
- *
- * This has to be implemented in user code.
- *
- * @param[in] device_id Device identifier.
- * @param[out] address  Device local hardware address.
- *
- * @return EOK on success.
- * @return EBADMEM if the address parameter is NULL.
- * @return ENOENT if there no such device.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the specific module
- *         message implementation.
- *
- */
-extern int netif_get_addr_message(device_id_t device_id,
-    measured_string_t *address);
-
-/** Process the netif driver specific message.
- *
- * This function is called for uncommon messages received by the netif
- * skeleton. This has to be implemented in user code.
- *
- * @param[in]  callid Message identifier.
- * @param[in]  call   Message.
- * @param[out] answer Answer.
- * @param[out] count  Number of answer arguments.
- *
- * @return EOK on success.
- * @return ENOTSUP if the message is not known.
- * @return Other error codes as defined for the specific module
- *         message implementation.
- *
- */
-extern int netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, size_t *count);
-
-/** Return the device usage statistics.
- *
- * This has to be implemented in user code.
- *
- * @param[in]  device_id Device identifier.
- * @param[out] stats     Device usage statistics.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the specific module
- *         message implementation.
- *
- */
-extern int netif_get_device_stats(device_id_t device_id,
-    device_stats_t *stats);
-
-extern int find_device(device_id_t, netif_device_t **);
-extern void null_device_stats(device_stats_t *);
-extern void netif_pq_release(packet_id_t);
-extern packet_t *netif_packet_get_1(size_t);
-
-extern int netif_module_start(void);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_remote.h
===================================================================
--- uspace/lib/net/include/nil_remote.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/nil_remote.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -34,7 +34,7 @@
 #define __NET_NIL_REMOTE_H__
 
-#include <ipc/services.h>
 #include <net/device.h>
 #include <net/packet.h>
+#include <devman.h>
 #include <generic.h>
 #include <async.h>
@@ -58,11 +58,10 @@
 	    packet_get_id(packet), sender, 0)
 
-#define nil_device_req(sess, device_id, mtu, netif_service) \
-	generic_device_req_remote(sess, NET_NIL_DEVICE, device_id, mtu, \
-	    netif_service)
-
-extern int nil_device_state_msg(async_sess_t *, device_id_t, sysarg_t);
-extern int nil_received_msg(async_sess_t *, device_id_t, packet_t *,
-    services_t);
+extern int nil_device_req(async_sess_t *, nic_device_id_t, devman_handle_t,
+    size_t);
+extern int nil_device_state_msg(async_sess_t *, nic_device_id_t, sysarg_t);
+extern int nil_received_msg(async_sess_t *, nic_device_id_t, packet_id_t);
+extern int nil_addr_changed_msg(async_sess_t *, nic_device_id_t,
+    const nic_address_t *);
 
 #endif
Index: uspace/lib/net/include/nil_skel.h
===================================================================
--- uspace/lib/net/include/nil_skel.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/nil_skel.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -70,5 +70,5 @@
  *
  */
-extern int nil_device_state_msg_local(device_id_t device_id, sysarg_t state);
+extern int nil_device_state_msg_local(nic_device_id_t device_id, sysarg_t state);
 
 /** Pass the packet queue to the network interface layer.
@@ -81,5 +81,4 @@
  * @param[in] device_id Source device identifier.
  * @param[in] packet    Received packet or the received packet queue.
- * @param[in] target    Target service. Ignored parameter.
  *
  * @return EOK on success.
@@ -88,6 +87,5 @@
  *
  */
-extern int nil_received_msg_local(device_id_t device_id, packet_t *packet,
-    services_t target);
+extern int nil_received_msg_local(nic_device_id_t device_id, packet_t *packet);
 
 /** Message processing function.
Index: uspace/lib/net/include/tl_common.h
===================================================================
--- uspace/lib/net/include/tl_common.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/tl_common.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -52,7 +52,7 @@
 
 extern int tl_get_ip_packet_dimension(async_sess_t *, packet_dimensions_t *,
-    device_id_t, packet_dimension_t **);
+    nic_device_id_t, packet_dimension_t **);
 extern int tl_get_address_port(const struct sockaddr *, int, uint16_t *);
-extern int tl_update_ip_packet_dimension(packet_dimensions_t *, device_id_t,
+extern int tl_update_ip_packet_dimension(packet_dimensions_t *, nic_device_id_t,
     size_t);
 extern int tl_set_address_port(struct sockaddr *, int, uint16_t);
Index: uspace/lib/net/include/tl_remote.h
===================================================================
--- uspace/lib/net/include/tl_remote.h	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/include/tl_remote.h	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -51,6 +51,6 @@
 /*@{*/
 
-extern int tl_received_msg(async_sess_t *, device_id_t, packet_t *, services_t,
-    services_t);
+extern int tl_received_msg(async_sess_t *, nic_device_id_t, packet_t *,
+    services_t, services_t);
 
 /*@}*/
Index: uspace/lib/net/netif/netif_remote.c
===================================================================
--- uspace/lib/net/netif/netif_remote.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Network interface module interface implementation for remote modules.
- */
-
-#include <netif_remote.h>
-#include <packet_client.h>
-#include <generic.h>
-#include <ipc/services.h>
-#include <ipc/netif.h>
-#include <net/modules.h>
-#include <adt/measured_strings.h>
-#include <net/packet.h>
-#include <net/device.h>
-
-/** Return the device local hardware address.
- *
- * @param[in]  sess      Network interface session.
- * @param[in]  device_id Device identifier.
- * @param[out] address   Device local hardware address.
- * @param[out] data      Address data.
- *
- * @return EOK on success.
- * @return EBADMEM if the address parameter is NULL.
- * @return ENOENT if there no such device.
- * @return Other error codes as defined for the
- *         netif_get_addr_message() function.
- *
- */
-int netif_get_addr_req(async_sess_t *sess, device_id_t device_id,
-    measured_string_t **address, uint8_t **data)
-{
-	return generic_get_addr_req(sess, NET_NETIF_GET_ADDR, device_id,
-	    address, data);
-}
-
-/** Probe the existence of the device.
- *
- * @param[in] sess      Network interface session.
- * @param[in] device_id Device identifier.
- * @param[in] irq       Device interrupt number.
- * @param[in] io        Device input/output address.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the
- *         netif_probe_message().
- *
- */
-int netif_probe_req(async_sess_t *sess, device_id_t device_id, int irq, void *io)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_3_0(exch, NET_NETIF_PROBE, device_id, (sysarg_t) irq,
-	    (sysarg_t) io);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** Send the packet queue.
- *
- * @param[in] sess      Network interface session.
- * @param[in] device_id Device identifier.
- * @param[in] packet    Packet queue.
- * @param[in] sender    Sending module service.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the generic_send_msg()
- *         function.
- *
- */
-int netif_send_msg(async_sess_t *sess, device_id_t device_id, packet_t *packet,
-    services_t sender)
-{
-	return generic_send_msg_remote(sess, NET_NETIF_SEND, device_id,
-	    packet_get_id(packet), sender, 0);
-}
-
-/** Start the device.
- *
- * @param[in] sess      Network interface session.
- * @param[in] device_id Device identifier.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the
- *         netif_start_message() function.
- *
- */
-int netif_start_req(async_sess_t *sess, device_id_t device_id)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_1_0(exch, NET_NETIF_START, device_id);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** Stop the device.
- *
- * @param[in] sess      Network interface session.
- * @param[in] device_id Device identifier.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the
- *         netif_stop_message() function.
- *
- */
-int netif_stop_req(async_sess_t *sess, device_id_t device_id)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_1_0(exch, NET_NETIF_STOP, device_id);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** Return the device usage statistics.
- *
- * @param[in]  sess      Network interface session.
- * @param[in]  device_id Device identifier.
- * @param[out] stats     Device usage statistics.
- *
- * @return EOK on success.
- *
- */
-int netif_stats_req(async_sess_t *sess, device_id_t device_id,
-    device_stats_t *stats)
-{
-	if (!stats)
-		return EBADMEM;
-	
-	async_exch_t *exch = async_exchange_begin(sess);
-	aid_t message_id = async_send_1(exch, NET_NETIF_STATS,
-	    (sysarg_t) device_id, NULL);
-	async_data_read_start(exch, stats, sizeof(*stats));
-	async_exchange_end(exch);
-	
-	sysarg_t result;
-	async_wait_for(message_id, &result);
-	
-	return (int) result;
-}
-
-/** Create bidirectional connection with the network interface module
- *
- * Create bidirectional connection with the network interface module and
- * register the message receiver.
- *
- * @param[in] service   Network interface module service.
- * @param[in] device_id Device identifier.
- * @param[in] me        Requesting module service.
- * @param[in] receiver  Message receiver.
- *
- * @return Session to the needed service.
- * @return NULL on failure.
- *
- */
-async_sess_t *netif_bind_service(services_t service, device_id_t device_id,
-    services_t me, async_client_conn_t receiver)
-{
-	return bind_service(service, device_id, me, 0, receiver);
-}
-
-/** @}
- */
Index: uspace/lib/net/netif/netif_skel.c
===================================================================
--- uspace/lib/net/netif/netif_skel.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ 	(revision )
@@ -1,422 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Network interface module skeleton implementation.
- * @see netif_skel.h
- */
-
-#include <async.h>
-#include <mem.h>
-#include <fibril_synch.h>
-#include <stdio.h>
-#include <ipc/services.h>
-#include <ipc/netif.h>
-#include <errno.h>
-
-#include <generic.h>
-#include <net/modules.h>
-#include <net/packet.h>
-#include <packet_client.h>
-#include <packet_remote.h>
-#include <adt/measured_strings.h>
-#include <net/device.h>
-#include <netif_skel.h>
-#include <nil_remote.h>
-
-DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t);
-
-/** Network interface global data. */
-netif_globals_t netif_globals;
-
-/** Probe the existence of the device.
- *
- * @param[in] device_id   Device identifier.
- * @param[in] irq         Device interrupt number.
- * @param[in] io          Device input/output address.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the
- *         netif_probe_message().
- *
- */
-static int netif_probe_req_local(device_id_t device_id, int irq, void *io)
-{
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	int result = netif_probe_message(device_id, irq, io);
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	
-	return result;
-}
-
-/** Send the packet queue.
- *
- * @param[in] device_id   Device identifier.
- * @param[in] packet      Packet queue.
- * @param[in] sender      Sending module service.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the generic_send_msg()
- *         function.
- *
- */
-static int netif_send_msg_local(device_id_t device_id, packet_t *packet,
-    services_t sender)
-{
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	int result = netif_send_message(device_id, packet, sender);
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	
-	return result;
-}
-
-/** Start the device.
- *
- * @param[in] device_id   Device identifier.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the
- *         netif_start_message() function.
- *
- */
-static int netif_start_req_local(device_id_t device_id)
-{
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	
-	netif_device_t *device;
-	int rc = find_device(device_id, &device);
-	if (rc != EOK) {
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return rc;
-	}
-	
-	int result = netif_start_message(device);
-	if (result > NETIF_NULL) {
-		nil_device_state_msg(netif_globals.nil_sess, device_id, result);
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return EOK;
-	}
-	
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	
-	return result;
-}
-
-/** Stop the device.
- *
- * @param[in] device_id   Device identifier.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the find_device()
- *         function.
- * @return Other error codes as defined for the
- *         netif_stop_message() function.
- *
- */
-static int netif_stop_req_local(device_id_t device_id)
-{
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	
-	netif_device_t *device;
-	int rc = find_device(device_id, &device);
-	if (rc != EOK) {
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return rc;
-	}
-	
-	int result = netif_stop_message(device);
-	if (result > NETIF_NULL) {
-		nil_device_state_msg(netif_globals.nil_sess, device_id, result);
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return EOK;
-	}
-	
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	
-	return result;
-}
-
-/** Find the device specific data.
- *
- * @param[in]  device_id Device identifier.
- * @param[out] device    Device specific data.
- *
- * @return EOK on success.
- * @return ENOENT if device is not found.
- * @return EPERM if the device is not initialized.
- *
- */
-int find_device(device_id_t device_id, netif_device_t **device)
-{
-	if (!device)
-		return EBADMEM;
-	
-	*device = netif_device_map_find(&netif_globals.device_map, device_id);
-	if (*device == NULL)
-		return ENOENT;
-	
-	if ((*device)->state == NETIF_NULL)
-		return EPERM;
-	
-	return EOK;
-}
-
-/** Clear the usage statistics.
- *
- * @param[in] stats The usage statistics.
- *
- */
-void null_device_stats(device_stats_t *stats)
-{
-	bzero(stats, sizeof(device_stats_t));
-}
-
-/** Release the given packet.
- *
- * Prepared for future optimization.
- *
- * @param[in] packet_id The packet identifier.
- *
- */
-void netif_pq_release(packet_id_t packet_id)
-{
-	pq_release_remote(netif_globals.sess, packet_id);
-}
-
-/** Allocate new packet to handle the given content size.
- *
- * @param[in] content Minimum content size.
- *
- * @return The allocated packet.
- * @return NULL on error.
- *
- */
-packet_t *netif_packet_get_1(size_t content)
-{
-	return packet_get_1_remote(netif_globals.sess, content);
-}
-
-/** Register the device notification receiver,
- *
- * Register a network interface layer module as the device
- * notification receiver.
- *
- * @param[in] sess      Session to the network interface layer module.
- *
- * @return EOK on success.
- * @return ELIMIT if there is another module registered.
- *
- */
-static int register_message(async_sess_t *sess)
-{
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	if (netif_globals.nil_sess != NULL) {
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return ELIMIT;
-	}
-	
-	netif_globals.nil_sess = sess;
-	
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	return EOK;
-}
-
-/** Process the netif module messages.
- *
- * @param[in]  callid Mmessage identifier.
- * @param[in]  call   Message.
- * @param[out] answer Answer.
- * @param[out] count  Number of arguments of the answer.
- *
- * @return EOK on success.
- * @return ENOTSUP if the message is unknown.
- * @return Other error codes as defined for each specific module
- *         message function.
- *
- * @see IS_NET_NETIF_MESSAGE()
- *
- */
-static int netif_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, size_t *count)
-{
-	size_t length;
-	device_stats_t stats;
-	packet_t *packet;
-	measured_string_t address;
-	int rc;
-	
-	*count = 0;
-	
-	if (!IPC_GET_IMETHOD(*call))
-		return EOK;
-	
-	async_sess_t *callback =
-	    async_callback_receive_start(EXCHANGE_SERIALIZE, call);
-	if (callback)
-		return register_message(callback);
-	
-	switch (IPC_GET_IMETHOD(*call)) {
-	case NET_NETIF_PROBE:
-		return netif_probe_req_local(IPC_GET_DEVICE(*call),
-		    NETIF_GET_IRQ(*call), NETIF_GET_IO(*call));
-	
-	case NET_NETIF_SEND:
-		rc = packet_translate_remote(netif_globals.sess, &packet,
-		    IPC_GET_PACKET(*call));
-		if (rc != EOK)
-			return rc;
-		
-		return netif_send_msg_local(IPC_GET_DEVICE(*call), packet,
-		    IPC_GET_SENDER(*call));
-	
-	case NET_NETIF_START:
-		return netif_start_req_local(IPC_GET_DEVICE(*call));
-	
-	case NET_NETIF_STATS:
-		fibril_rwlock_read_lock(&netif_globals.lock);
-		
-		rc = async_data_read_receive(&callid, &length);
-		if (rc != EOK) {
-			fibril_rwlock_read_unlock(&netif_globals.lock);
-			return rc;
-		}
-		
-		if (length < sizeof(device_stats_t)) {
-			fibril_rwlock_read_unlock(&netif_globals.lock);
-			return EOVERFLOW;
-		}
-		
-		rc = netif_get_device_stats(IPC_GET_DEVICE(*call), &stats);
-		if (rc == EOK) {
-			rc = async_data_read_finalize(callid, &stats,
-			    sizeof(device_stats_t));
-		}
-		
-		fibril_rwlock_read_unlock(&netif_globals.lock);
-		return rc;
-	
-	case NET_NETIF_STOP:
-		return netif_stop_req_local(IPC_GET_DEVICE(*call));
-	
-	case NET_NETIF_GET_ADDR:
-		fibril_rwlock_read_lock(&netif_globals.lock);
-		
-		rc = netif_get_addr_message(IPC_GET_DEVICE(*call), &address);
-		if (rc == EOK)
-			rc = measured_strings_reply(&address, 1);
-		
-		fibril_rwlock_read_unlock(&netif_globals.lock);
-		return rc;
-	}
-	
-	return netif_specific_message(callid, call, answer, count);
-}
-
-/** Default fibril for new module connections.
- *
- * @param[in] iid   Initial message identifier.
- * @param[in] icall Initial message call structure.
- *
- */
-static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall,
-    void *arg)
-{
-	/*
-	 * Accept the connection by answering
-	 * the initial IPC_M_CONNECT_ME_TO call.
-	 */
-	async_answer_0(iid, EOK);
-	
-	while (true) {
-		ipc_call_t answer;
-		size_t count;
-		
-		/* Clear the answer structure */
-		refresh_answer(&answer, &count);
-		
-		/* Fetch the next message */
-		ipc_call_t call;
-		ipc_callid_t callid = async_get_call(&call);
-		
-		/* Process the message */
-		int res = netif_module_message(callid, &call, &answer, &count);
-		
-		/* End if said to either by the message or the processing result */
-		if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP))
-			return;
-		
-		/* Answer the message */
-		answer_call(callid, res, &answer, count);
-	}
-}
-
-/** Start the network interface module.
- *
- * Initialize the client connection serving function, initialize the module,
- * registers the module service and start the async manager, processing IPC
- * messages in an infinite loop.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module
- *         message function.
- *
- */
-int netif_module_start(void)
-{
-	async_set_client_connection(netif_client_connection);
-	
-	netif_globals.sess = connect_to_service(SERVICE_NETWORKING);
-	netif_globals.nil_sess = NULL;
-	netif_device_map_initialize(&netif_globals.device_map);
-	
-	int rc = pm_init();
-	if (rc != EOK)
-		return rc;
-	
-	fibril_rwlock_initialize(&netif_globals.lock);
-	
-	rc = netif_initialize();
-	if (rc != EOK) {
-		pm_destroy();
-		return rc;
-	}
-	
-	async_manager();
-	
-	pm_destroy();
-	return EOK;
-}
-
-/** @}
- */
Index: uspace/lib/net/nil/nil_remote.c
===================================================================
--- uspace/lib/net/nil/nil_remote.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/nil/nil_remote.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -54,5 +54,5 @@
  *
  */
-int nil_device_state_msg(async_sess_t *sess, device_id_t device_id,
+int nil_device_state_msg(async_sess_t *sess, nic_device_id_t device_id,
     sysarg_t state)
 {
@@ -76,9 +76,44 @@
  *
  */
-int nil_received_msg(async_sess_t *sess, device_id_t device_id,
-    packet_t *packet, services_t target)
+int nil_received_msg(async_sess_t *sess, nic_device_id_t device_id,
+    packet_id_t packet_id)
 {
 	return generic_received_msg_remote(sess, NET_NIL_RECEIVED,
-	    device_id, packet_get_id(packet), target, 0);
+	    device_id, packet_id, 0, 0);
+}
+
+/** Notify upper layers that device address has changed
+ *
+ */
+int nil_addr_changed_msg(async_sess_t *sess, nic_device_id_t device_id,
+    const nic_address_t *address)
+{
+	assert(sess);
+	
+	async_exch_t *exch = async_exchange_begin(sess);
+	
+	aid_t message_id = async_send_1(exch, NET_NIL_ADDR_CHANGED,
+	    (sysarg_t) device_id, NULL);
+	int rc = async_data_write_start(exch, address, sizeof (nic_address_t));
+	
+	async_exchange_end(exch);
+	
+	sysarg_t res;
+    async_wait_for(message_id, &res);
+	
+    if (rc != EOK)
+		return rc;
+	
+    return (int) res;
+}
+
+int nil_device_req(async_sess_t *sess, nic_device_id_t device_id,
+    devman_handle_t handle, size_t mtu)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int rc = async_req_3_0(exch, NET_NIL_DEVICE, (sysarg_t) device_id,
+	    (sysarg_t) handle, (sysarg_t) mtu);
+	async_exchange_end(exch);
+	return rc;
 }
 
Index: uspace/lib/net/tl/icmp_client.c
===================================================================
--- uspace/lib/net/tl/icmp_client.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/tl/icmp_client.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -39,12 +39,6 @@
 #include <icmp_header.h>
 #include <packet_client.h>
-
-#ifdef CONFIG_DEBUG
-#include <stdio.h>
-#endif
-
 #include <errno.h>
 #include <sys/types.h>
-
 #include <net/icmp_codes.h>
 #include <net/packet.h>
@@ -60,6 +54,5 @@
  * @return		Zero if the packet contains no data.
  */
-int
-icmp_client_process_packet(packet_t *packet, icmp_type_t *type,
+int icmp_client_process_packet(packet_t *packet, icmp_type_t *type,
     icmp_code_t *code, icmp_param_t *pointer, icmp_param_t *mtu)
 {
@@ -81,9 +74,4 @@
 		*mtu = header->un.frag.mtu;
 
-	/* Remove debug dump */
-#ifdef CONFIG_DEBUG
-	printf("ICMP error %d (%d) in packet %d\n", header->type, header->code,
-	    packet_get_id(packet));
-#endif
 	return sizeof(icmp_header_t);
 }
Index: uspace/lib/net/tl/tl_common.c
===================================================================
--- uspace/lib/net/tl/tl_common.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/tl/tl_common.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -119,5 +119,5 @@
  */
 int tl_get_ip_packet_dimension(async_sess_t *sess,
-    packet_dimensions_t *packet_dimensions, device_id_t device_id,
+    packet_dimensions_t *packet_dimensions, nic_device_id_t device_id,
     packet_dimension_t **packet_dimension)
 {
@@ -160,5 +160,5 @@
 int
 tl_update_ip_packet_dimension(packet_dimensions_t *packet_dimensions,
-    device_id_t device_id, size_t content)
+    nic_device_id_t device_id, size_t content)
 {
 	packet_dimension_t *packet_dimension;
@@ -170,7 +170,7 @@
 	packet_dimension->content = content;
 
-	if (device_id != DEVICE_INVALID_ID) {
+	if (device_id != NIC_DEVICE_INVALID_ID) {
 		packet_dimension = packet_dimensions_find(packet_dimensions,
-		    DEVICE_INVALID_ID);
+		    NIC_DEVICE_INVALID_ID);
 
 		if (packet_dimension) {
@@ -179,5 +179,5 @@
 			else
 				packet_dimensions_exclude(packet_dimensions,
-				    DEVICE_INVALID_ID, free);
+				    NIC_DEVICE_INVALID_ID, free);
 		}
 	}
Index: uspace/lib/net/tl/tl_remote.c
===================================================================
--- uspace/lib/net/tl/tl_remote.c	(revision ee2fa30aed4921e38c357a0420357b61329be533)
+++ uspace/lib/net/tl/tl_remote.c	(revision 609243f4f1d6e7562d9c9b79e38925b36e844ac0)
@@ -56,5 +56,5 @@
  *
  */
-int tl_received_msg(async_sess_t *sess, device_id_t device_id, packet_t *packet,
+int tl_received_msg(async_sess_t *sess, nic_device_id_t device_id, packet_t *packet,
     services_t target, services_t error)
 {
