Merge tag 'v2.7.0' into develop_qemu_2.7
[sdk/emulator/qemu.git] / net / net.c
index d51cb29..660e904 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1428,6 +1428,31 @@ static void net_vm_change_state_handler(void *opaque, int running,
     }
 }
 
+#if defined(CONFIG_MARU)
+LinkInfo *qmp_get_link(const char *name, Error **errp)
+{
+    NetClientState *ncs[MAX_QUEUE_NUM];
+    int queues, i;
+    LinkInfo *info;
+    info = g_malloc0(sizeof (struct LinkInfo));
+
+    queues = qemu_find_net_clients_except(name, ncs,
+                                          NET_CLIENT_DRIVER__MAX,
+                                          MAX_QUEUE_NUM);
+
+    if (queues == 0) {
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+                    "Device '%s' not found", name);
+        return info;
+    }
+
+    for (i = 0; i < queues; i++) {
+        info->is_up = !(ncs[i]->link_down);
+    }
+    return info;
+}
+#endif
+
 void net_cleanup(void)
 {
     NetClientState *nc;