qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info
@ 2012-05-25 14:02 zwu.kernel
  2012-05-25 14:17 ` Jan Kiszka
  0 siblings, 1 reply; 9+ messages in thread
From: zwu.kernel @ 2012-05-25 14:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, wuzhy, stefanha, kvm, jan.kiszka

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Reviewed-by:   Jan Kiszka  <jan.kiszka@siemens.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 net.c     |   18 ++++++++++++++----
 net.h     |   12 ++++++++++++
 net/hub.c |   23 +++++++++++++++++++++--
 net/hub.h |    1 +
 4 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/net.c b/net.c
index 61dc28d..ae0deec 100644
--- a/net.c
+++ b/net.c
@@ -887,6 +887,12 @@ static const struct {
         },
     },
 #endif /* CONFIG_NET_BRIDGE */
+    [NET_CLIENT_TYPE_HUB] = {
+        .type = "hubport",
+        .desc = {
+            { /* end of list */ }
+        },
+    },
 };
 
 int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
@@ -1068,7 +1074,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
     return 0;
 }
 
-static void print_net_client(Monitor *mon, NetClientState *vc)
+void print_net_client(Monitor *mon, NetClientState *vc)
 {
     monitor_printf(mon, "%s: type=%s,%s\n", vc->name,
                    net_client_types[vc->info->type].type, vc->info_str);
@@ -1079,12 +1085,17 @@ void do_info_network(Monitor *mon)
     NetClientState *nc, *peer;
     net_client_type type;
 
-    monitor_printf(mon, "Devices not on any VLAN:\n");
+    net_hub_info(mon);
+
     QTAILQ_FOREACH(nc, &net_clients, next) {
         peer = nc->peer;
         type = nc->info->type;
+
+        if (net_hub_port_peer_nc(nc)) {
+            continue;
+        }
+
         if (!peer || type == NET_CLIENT_TYPE_NIC) {
-            monitor_printf(mon, "  ");
             print_net_client(mon, nc);
         } /* else it's a netdev connected to a NIC, printed with the NIC */
         if (peer && type == NET_CLIENT_TYPE_NIC) {
@@ -1092,7 +1103,6 @@ void do_info_network(Monitor *mon)
             print_net_client(mon, peer);
         }
     }
-    net_hub_info(mon);
 }
 
 void qmp_set_link(const char *name, bool up, Error **errp)
diff --git a/net.h b/net.h
index 250669a..08306a4 100644
--- a/net.h
+++ b/net.h
@@ -112,6 +112,18 @@ void qemu_check_nic_model(NICInfo *nd, const char *model);
 int qemu_find_nic_model(NICInfo *nd, const char * const *models,
                         const char *default_model);
 
+ssize_t qemu_deliver_packet(NetClientState *sender,
+                            unsigned flags,
+                            const uint8_t *data,
+                            size_t size,
+                            void *opaque);
+ssize_t qemu_deliver_packet_iov(NetClientState *sender,
+                            unsigned flags,
+                            const struct iovec *iov,
+                            int iovcnt,
+                            void *opaque);
+
+void print_net_client(Monitor *mon, NetClientState *vc);
 void do_info_network(Monitor *mon);
 
 /* NIC info */
diff --git a/net/hub.c b/net/hub.c
index 122de69..8c77d03 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id,
 }
 
 /**
+ * Determine if one nc peers with one hub port
+ */
+bool net_hub_port_peer_nc(NetClientState *nc)
+{
+    NetHub *hub;
+    NetHubPort *port;
+
+    QLIST_FOREACH(hub, &hubs, next) {
+        QLIST_FOREACH(port, &hub->ports, next) {
+            if (nc == port->nc.peer) {
+                return true;
+            }
+        }
+    }
+
+    return false;
+}
+
+/**
  * Print hub configuration
  */
 void net_hub_info(Monitor *mon)
@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon)
     QLIST_FOREACH(hub, &hubs, next) {
         monitor_printf(mon, "hub %u\n", hub->id);
         QLIST_FOREACH(port, &hub->ports, next) {
-            monitor_printf(mon, "    port %u peer %s\n", port->id,
-                           port->nc.peer ? port->nc.peer->name : "<none>");
+            monitor_printf(mon, "   \\ ");
+            print_net_client(mon, port->nc.peer);
         }
     }
 }
diff --git a/net/hub.h b/net/hub.h
index ff5024a..550189b 100644
--- a/net/hub.h
+++ b/net/hub.h
@@ -23,5 +23,6 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id,
 void net_hub_info(Monitor *mon);
 int net_hub_id_for_client(NetClientState *nc, unsigned int *id);
 void net_hub_check_clients(void);
+bool net_hub_port_peer_nc(NetClientState *nc);
 
 #endif /* NET_HUB_H */
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info
@ 2012-05-25 14:11 zwu.kernel
  0 siblings, 0 replies; 9+ messages in thread
From: zwu.kernel @ 2012-05-25 14:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, wuzhy, stefanha, kvm, jan.kiszka

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Reviewed-by:   Jan Kiszka  <jan.kiszka@siemens.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 net.c     |   18 ++++++++++++++----
 net.h     |    1 +
 net/hub.c |   23 +++++++++++++++++++++--
 net/hub.h |    1 +
 4 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/net.c b/net.c
index 61dc28d..ae0deec 100644
--- a/net.c
+++ b/net.c
@@ -887,6 +887,12 @@ static const struct {
         },
     },
 #endif /* CONFIG_NET_BRIDGE */
+    [NET_CLIENT_TYPE_HUB] = {
+        .type = "hubport",
+        .desc = {
+            { /* end of list */ }
+        },
+    },
 };
 
 int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
@@ -1068,7 +1074,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
     return 0;
 }
 
-static void print_net_client(Monitor *mon, NetClientState *vc)
+void print_net_client(Monitor *mon, NetClientState *vc)
 {
     monitor_printf(mon, "%s: type=%s,%s\n", vc->name,
                    net_client_types[vc->info->type].type, vc->info_str);
@@ -1079,12 +1085,17 @@ void do_info_network(Monitor *mon)
     NetClientState *nc, *peer;
     net_client_type type;
 
-    monitor_printf(mon, "Devices not on any VLAN:\n");
+    net_hub_info(mon);
+
     QTAILQ_FOREACH(nc, &net_clients, next) {
         peer = nc->peer;
         type = nc->info->type;
+
+        if (net_hub_port_peer_nc(nc)) {
+            continue;
+        }
+
         if (!peer || type == NET_CLIENT_TYPE_NIC) {
-            monitor_printf(mon, "  ");
             print_net_client(mon, nc);
         } /* else it's a netdev connected to a NIC, printed with the NIC */
         if (peer && type == NET_CLIENT_TYPE_NIC) {
@@ -1092,7 +1103,6 @@ void do_info_network(Monitor *mon)
             print_net_client(mon, peer);
         }
     }
-    net_hub_info(mon);
 }
 
 void qmp_set_link(const char *name, bool up, Error **errp)
diff --git a/net.h b/net.h
index 250669a..0692283 100644
--- a/net.h
+++ b/net.h
@@ -112,6 +112,7 @@ void qemu_check_nic_model(NICInfo *nd, const char *model);
 int qemu_find_nic_model(NICInfo *nd, const char * const *models,
                         const char *default_model);
 
+void print_net_client(Monitor *mon, NetClientState *vc);
 void do_info_network(Monitor *mon);
 
 /* NIC info */
diff --git a/net/hub.c b/net/hub.c
index 122de69..8c77d03 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id,
 }
 
 /**
+ * Determine if one nc peers with one hub port
+ */
+bool net_hub_port_peer_nc(NetClientState *nc)
+{
+    NetHub *hub;
+    NetHubPort *port;
+
+    QLIST_FOREACH(hub, &hubs, next) {
+        QLIST_FOREACH(port, &hub->ports, next) {
+            if (nc == port->nc.peer) {
+                return true;
+            }
+        }
+    }
+
+    return false;
+}
+
+/**
  * Print hub configuration
  */
 void net_hub_info(Monitor *mon)
@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon)
     QLIST_FOREACH(hub, &hubs, next) {
         monitor_printf(mon, "hub %u\n", hub->id);
         QLIST_FOREACH(port, &hub->ports, next) {
-            monitor_printf(mon, "    port %u peer %s\n", port->id,
-                           port->nc.peer ? port->nc.peer->name : "<none>");
+            monitor_printf(mon, "   \\ ");
+            print_net_client(mon, port->nc.peer);
         }
     }
 }
diff --git a/net/hub.h b/net/hub.h
index ff5024a..550189b 100644
--- a/net/hub.h
+++ b/net/hub.h
@@ -23,5 +23,6 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id,
 void net_hub_info(Monitor *mon);
 int net_hub_id_for_client(NetClientState *nc, unsigned int *id);
 void net_hub_check_clients(void);
+bool net_hub_port_peer_nc(NetClientState *nc);
 
 #endif /* NET_HUB_H */
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH v4 00/16] hub-based networking patches
@ 2012-06-04  5:29 zwu.kernel
  2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info zwu.kernel
  0 siblings, 1 reply; 9+ messages in thread
From: zwu.kernel @ 2012-06-04  5:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, stefanha, jan.kiszka, Zhi Yong Wu, luowenj, pbonzini

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

All comments from other guys were addressed.

The following changes since commit a854972f8cdec0148087789d62777d8f7176933d:

 Update version to open the 1.2 development branch (Fri Jun 1 16:56:16 2012 +0800)

are available in the git repository at:

 git@github.com:wuzhy/qemu.git for-anthony

Changelog from v3:
 1.) refactor hub own flow control [paolo]
 2.) refactor the output for monitor command "info network" [jan kiszka]

v3:
 1.) add the support for hub own flow control [paolo]
 2.) make the monitor output more reasonable hub info [jan kiszka]

v2:
 1.) cleanup some obsolete vlan info
 2.) cleanup deliver/deliver_iov func pointers [paolo]
 3.) support more flexible flow control [paolo]

Stefan Hajnoczi (12):
  net: Add a hub net client
  net: Use hubs for the vlan feature
  net: Look up 'vlan' net clients using hubs
  hub: Check that hubs are configured correctly
  net: Drop vlan argument to qemu_new_net_client()
  net: Remove vlan qdev property
  net: Remove vlan code from net.c
  net: Remove VLANState
  net: Rename non_vlan_clients to net_clients
  net: Rename VLANClientState to NetClientState
  net: Rename vc local variables to nc
  net: Rename qemu_del_vlan_client() to qemu_del_net_client()

Zhi Yong Wu (4):
  net: Make "info network" output more readable info
  net: cleanup deliver/deliver_iov func pointers
  net: determine if packets can be sent before net queue deliver
    packets
  hub: add the support for hub own flow control

 Makefile.objs           |    2 +-
 hw/cadence_gem.c        |    8 +-
 hw/dp8393x.c            |    6 +-
 hw/e1000.c              |   10 +-
 hw/eepro100.c           |    8 +-
 hw/etraxfs_eth.c        |    8 +-
 hw/lan9118.c            |    8 +-
 hw/lance.c              |    2 +-
 hw/mcf_fec.c            |    6 +-
 hw/milkymist-minimac2.c |    6 +-
 hw/mipsnet.c            |    6 +-
 hw/musicpal.c           |    6 +-
 hw/ne2000-isa.c         |    2 +-
 hw/ne2000.c             |    8 +-
 hw/ne2000.h             |    4 +-
 hw/opencores_eth.c      |    8 +-
 hw/pcnet-pci.c          |    4 +-
 hw/pcnet.c              |    6 +-
 hw/pcnet.h              |    6 +-
 hw/qdev-properties.c    |   78 +------
 hw/qdev.c               |    2 -
 hw/qdev.h               |    8 +-
 hw/rtl8139.c            |   10 +-
 hw/smc91c111.c          |    6 +-
 hw/spapr_llan.c         |    4 +-
 hw/stellaris_enet.c     |    6 +-
 hw/usb/dev-network.c    |    8 +-
 hw/vhost_net.c          |   24 +-
 hw/vhost_net.h          |    2 +-
 hw/virtio-net.c         |   12 +-
 hw/xen_nic.c            |    7 +-
 hw/xgmac.c              |    6 +-
 hw/xilinx_axienet.c     |    6 +-
 hw/xilinx_ethlite.c     |    6 +-
 net.c                   |  605 ++++++++++++++---------------------------------
 net.h                   |   86 ++++----
 net/dump.c              |   28 ++-
 net/dump.h              |    2 +-
 net/hub.c               |  310 ++++++++++++++++++++++++
 net/hub.h               |   28 +++
 net/queue.c             |   37 ++--
 net/queue.h             |   25 +--
 net/slirp.c             |   32 +--
 net/slirp.h             |    2 +-
 net/socket.c            |   66 +++---
 net/socket.h            |    2 +-
 net/tap-win32.c         |   27 +-
 net/tap.c               |   45 ++--
 net/tap.h               |   21 +-
 net/vde.c               |   17 +-
 net/vde.h               |    3 +-
 qemu-common.h           |    3 +-
 slirp/if.c              |    5 -
 slirp/libslirp.h        |    1 -
 54 files changed, 818 insertions(+), 826 deletions(-)
 create mode 100644 net/hub.c
 create mode 100644 net/hub.h

-- 
1.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-04  5:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-25 14:02 [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info zwu.kernel
2012-05-25 14:17 ` Jan Kiszka
2012-05-25 14:25   ` Zhi Yong Wu
2012-05-25 14:40     ` Jan Kiszka
2012-05-25 14:44       ` Zhi Yong Wu
2012-05-25 14:50         ` Jan Kiszka
2012-05-25 14:56           ` Zhi Yong Wu
  -- strict thread matches above, loose matches on Subject: below --
2012-05-25 14:11 zwu.kernel
2012-06-04  5:29 [Qemu-devel] [PATCH v4 00/16] hub-based networking patches zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info zwu.kernel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).