Index: uspace/lib/c/generic/async/ports.c
===================================================================
--- uspace/lib/c/generic/async/ports.c	(revision 5c55eb7a094000c385bfd4763df91d81b2abe3c8)
+++ uspace/lib/c/generic/async/ports.c	(revision 3951046e0c17eba3d4999c6eca8b8eeda7a55fe5)
@@ -1,3 +1,4 @@
 /*
+ * Copyright (c) 2025 Jiri Svoboda
  * Copyright (c) 2006 Ondrej Palkovsky
  * All rights reserved.
@@ -59,9 +60,9 @@
 	iface_t iface;
 
-	/** Interface ports */
-	hash_table_t port_hash_table;
-
-	/** Next available port ID */
-	port_id_t port_id_avail;
+	/** Interface connection handler */
+	async_port_handler_t handler;
+
+	/** Client data */
+	void *data;
 } interface_t;
 
@@ -73,9 +74,6 @@
 	port_id_t id;
 
-	/** Port connection handler */
-	async_port_handler_t handler;
-
-	/** Client data */
-	void *data;
+	/** Port interfaces */
+	hash_table_t interface_hash_table;
 } port_t;
 
@@ -98,7 +96,9 @@
 static void *fallback_port_data = NULL;
 
-/** Futex guarding the interface hash table. */
-static fibril_rmutex_t interface_mutex;
-static hash_table_t interface_hash_table;
+/** Futex guarding the port hash table. */
+static fibril_rmutex_t port_mutex;
+static hash_table_t port_hash_table;
+/** Next available port ID */
+static port_id_t port_id_avail = 0;
 
 static size_t interface_key_hash(const void *key)
@@ -158,5 +158,6 @@
 };
 
-static interface_t *async_new_interface(iface_t iface)
+static interface_t *async_new_interface(port_t *port, iface_t iface,
+    async_port_handler_t handler, void *data)
 {
 	interface_t *interface =
@@ -164,22 +165,14 @@
 	if (!interface)
 		return NULL;
-
-	bool ret = hash_table_create(&interface->port_hash_table, 0, 0,
-	    &port_hash_table_ops);
-	if (!ret) {
-		free(interface);
-		return NULL;
-	}
-
 	interface->iface = iface;
-	interface->port_id_avail = 0;
-
-	hash_table_insert(&interface_hash_table, &interface->link);
+	interface->handler = handler;
+	interface->data = data;
+
+	hash_table_insert(&port->interface_hash_table, &interface->link);
 
 	return interface;
 }
 
-static port_t *async_new_port(interface_t *interface,
-    async_port_handler_t handler, void *data)
+static port_t *async_new_port(void)
 {
 	// TODO: Move the malloc out of critical section.
@@ -188,12 +181,16 @@
 		return NULL;
 
-	port_id_t id = interface->port_id_avail;
-	interface->port_id_avail++;
+	bool ret = hash_table_create(&port->interface_hash_table, 0, 0,
+	    &interface_hash_table_ops);
+	if (!ret) {
+		free(port);
+		return NULL;
+	}
+
+	port_id_t id = port_id_avail;
+	port_id_avail++;
 
 	port->id = id;
-	port->handler = handler;
-	port->data = data;
-
-	hash_table_insert(&interface->port_hash_table, &port->link);
+	hash_table_insert(&port_hash_table, &port->link);
 
 	return port;
@@ -205,27 +202,21 @@
 	interface_t *interface;
 
-	fibril_rmutex_lock(&interface_mutex);
-
-	ht_link_t *link = hash_table_find(&interface_hash_table, &iface);
-	if (link)
-		interface = hash_table_get_inst(link, interface_t, link);
-	else
-		interface = async_new_interface(iface);
-
-	if (!interface) {
-		fibril_rmutex_unlock(&interface_mutex);
+	fibril_rmutex_lock(&port_mutex);
+
+	port_t *port = async_new_port();
+	if (port == NULL) {
+		fibril_rmutex_unlock(&port_mutex);
 		return ENOMEM;
 	}
 
-	port_t *port = async_new_port(interface, handler, data);
-	if (!port) {
-		fibril_rmutex_unlock(&interface_mutex);
+	interface = async_new_interface(port, iface, handler, data);
+	if (interface == NULL) {
+		// XXX delete port
+		fibril_rmutex_unlock(&port_mutex);
 		return ENOMEM;
 	}
 
 	*port_id = port->id;
-
-	fibril_rmutex_unlock(&interface_mutex);
-
+	fibril_rmutex_unlock(&port_mutex);
 	return EOK;
 }
@@ -248,27 +239,56 @@
 }
 
-static port_t *async_find_port(iface_t iface, port_id_t port_id)
-{
-	port_t *port = NULL;
-
-	fibril_rmutex_lock(&interface_mutex);
-
-	ht_link_t *link = hash_table_find(&interface_hash_table, &iface);
-	if (link) {
-		interface_t *interface =
-		    hash_table_get_inst(link, interface_t, link);
-
-		link = hash_table_find(&interface->port_hash_table, &port_id);
-		if (link)
-			port = hash_table_get_inst(link, port_t, link);
-	}
-
-	fibril_rmutex_unlock(&interface_mutex);
-
-	return port;
-}
-
-async_port_handler_t async_get_port_handler(iface_t iface, port_id_t port_id,
-    void **data)
+typedef struct {
+	iface_t iface;
+	interface_t *interface;
+} find_if_port_t;
+
+static bool find_if_port(ht_link_t *link, void *arg)
+{
+	find_if_port_t *fip = (find_if_port_t *)arg;
+	port_t *port;
+	interface_t *interface;
+
+	(void)arg;
+	port = hash_table_get_inst(link, port_t, link);
+
+	ht_link_t *ilink = hash_table_find(&port->interface_hash_table,
+	    &fip->iface);
+	if (ilink) {
+		interface = hash_table_get_inst(ilink, interface_t,
+		    link);
+		fip->interface = interface;
+		return false;
+	}
+
+	return true;
+}
+
+static interface_t *async_find_interface(iface_t iface, port_id_t port_id)
+{
+	interface_t *interface = NULL;
+	find_if_port_t fip;
+
+	(void)port_id; // XXX !!!
+
+	fibril_rmutex_lock(&port_mutex);
+
+	/*
+	 * XXX Find any port implementing that interface. In reality we should
+	 * only look at port with ID port_id - but server.c does not
+	 * provide us with a correct port ID
+	 */
+
+	fip.iface = iface;
+	fip.interface = NULL;
+	hash_table_apply(&port_hash_table, find_if_port, (void *)&fip);
+	interface = fip.interface;
+
+	fibril_rmutex_unlock(&port_mutex);
+	return interface;
+}
+
+async_port_handler_t async_get_interface_handler(iface_t iface,
+    port_id_t port_id, void **data)
 {
 	assert(data);
@@ -277,8 +297,8 @@
 	*data = fallback_port_data;
 
-	port_t *port = async_find_port(iface, port_id);
-	if (port) {
-		handler = port->handler;
-		*data = port->data;
+	interface_t *interface = async_find_interface(iface, port_id);
+	if (interface != NULL) {
+		handler = interface->handler;
+		*data = interface->data;
 	}
 
@@ -286,14 +306,13 @@
 }
 
-/** Initialize the async framework.
+/** Initialize the async framework ports.
  *
  */
 void __async_ports_init(void)
 {
-	if (fibril_rmutex_initialize(&interface_mutex) != EOK)
+	if (fibril_rmutex_initialize(&port_mutex) != EOK)
 		abort();
 
-	if (!hash_table_create(&interface_hash_table, 0, 0,
-	    &interface_hash_table_ops))
+	if (!hash_table_create(&port_hash_table, 0, 0, &port_hash_table_ops))
 		abort();
 }
@@ -301,4 +320,4 @@
 void __async_ports_fini(void)
 {
-	fibril_rmutex_destroy(&interface_mutex);
-}
+	fibril_rmutex_destroy(&port_mutex);
+}
Index: uspace/lib/c/generic/async/server.c
===================================================================
--- uspace/lib/c/generic/async/server.c	(revision 5c55eb7a094000c385bfd4763df91d81b2abe3c8)
+++ uspace/lib/c/generic/async/server.c	(revision 3951046e0c17eba3d4999c6eca8b8eeda7a55fe5)
@@ -1,3 +1,4 @@
 /*
+ * Copyright (c) 2025 Jiri Svoboda
  * Copyright (c) 2006 Ondrej Palkovsky
  * All rights reserved.
@@ -955,5 +956,5 @@
 		void *data;
 		async_port_handler_t handler =
-		    async_get_port_handler(iface, 0, &data);
+		    async_get_interface_handler(iface, 0, &data);
 
 		async_new_connection(conn, call->task_id, call, handler, data);
Index: uspace/lib/c/generic/private/async.h
===================================================================
--- uspace/lib/c/generic/private/async.h	(revision 5c55eb7a094000c385bfd4763df91d81b2abe3c8)
+++ uspace/lib/c/generic/private/async.h	(revision 3951046e0c17eba3d4999c6eca8b8eeda7a55fe5)
@@ -1,3 +1,4 @@
 /*
+ * Copyright (c) 2025 Jiri Svoboda
  * Copyright (c) 2006 Ondrej Palkovsky
  * All rights reserved.
@@ -103,5 +104,6 @@
 extern errno_t async_create_port_internal(iface_t, async_port_handler_t,
     void *, port_id_t *);
-extern async_port_handler_t async_get_port_handler(iface_t, port_id_t, void **);
+extern async_port_handler_t async_get_interface_handler(iface_t, port_id_t,
+    void **);
 
 extern void async_reply_received(ipc_call_t *);
